@webiny/api-form-builder-so-ddb-es 5.41.1 → 5.41.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +20 -0
- package/index.js.map +1 -1
- package/package.json +15 -15
- package/types.d.ts +8 -5
- package/types.js +1 -8
- package/types.js.map +1 -1
package/index.js
CHANGED
|
@@ -133,6 +133,26 @@ const createFormBuilderStorageOperations = params => {
|
|
|
133
133
|
};
|
|
134
134
|
return {
|
|
135
135
|
beforeInit: async context => {
|
|
136
|
+
context.db.registry.register({
|
|
137
|
+
item: entities.form,
|
|
138
|
+
app: "fb",
|
|
139
|
+
tags: ["regular", "form", entities.form.name]
|
|
140
|
+
});
|
|
141
|
+
context.db.registry.register({
|
|
142
|
+
item: entities.esForm,
|
|
143
|
+
app: "fb",
|
|
144
|
+
tags: ["es", "form", entities.esForm.name]
|
|
145
|
+
});
|
|
146
|
+
context.db.registry.register({
|
|
147
|
+
item: entities.submission,
|
|
148
|
+
app: "fb",
|
|
149
|
+
tags: ["regular", "form-submission", entities.submission.name]
|
|
150
|
+
});
|
|
151
|
+
context.db.registry.register({
|
|
152
|
+
item: entities.esSubmission,
|
|
153
|
+
app: "fb",
|
|
154
|
+
tags: ["es", "form-submission", entities.esSubmission.name]
|
|
155
|
+
});
|
|
136
156
|
const types = [
|
|
137
157
|
// Elasticsearch
|
|
138
158
|
_apiElasticsearch.CompressionPlugin.type, _apiElasticsearch.ElasticsearchQueryBuilderOperatorPlugin.type,
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_filters","_interopRequireDefault","require","_elasticsearchFields","_elasticsearchFields2","_error","_types","_table","_form","_submission","_system","_settings","_system2","_submission2","_settings2","_form2","_tableElasticsearch","_plugins","_elasticsearch","_apiElasticsearch","_indices","_createElasticsearchIndex","_plugins2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_createIndexTaskPlugin","reservedFields","isReserved","name","includes","WebinyError","createFormBuilderStorageOperations","params","attributes","table","tableName","esTable","esTableName","documentClient","elasticsearch","plugins","userPlugins","values","attrs","PluginsContainer","submissionElasticsearchFields","formElasticsearchFields","dynamoDbValueFilters","elasticsearchIndexPlugins","createTable","createElasticsearchTable","entities","form","createFormEntity","entityName","ENTITIES","FORM","submission","createSubmissionEntity","SUBMISSION","system","createSystemEntity","SYSTEM","settings","createSettingsEntity","SETTINGS","esForm","createElasticsearchEntity","ES_FORM","esSubmission","ES_SUBMISSION","beforeInit","context","types","CompressionPlugin","type","ElasticsearchQueryBuilderOperatorPlugin","FormDynamoDbFieldPlugin","FormElasticsearchBodyModifierPlugin","FormElasticsearchFieldPlugin","FormElasticsearchIndexPlugin","FormElasticsearchQueryModifierPlugin","FormElasticsearchSortModifierPlugin","SubmissionElasticsearchBodyModifierPlugin","SubmissionElasticsearchFieldPlugin","SubmissionElasticsearchQueryModifierPlugin","SubmissionElasticsearchSortModifierPlugin","mergeByType","register","createIndexTaskPlugin","init","i18n","locales","onLocaleBeforeCreate","subscribe","locale","tenant","createElasticsearchIndex","code","getTable","getEsTable","getEntities","createSystemStorageOperations","entity","createSettingsStorageOperations","createFormStorageOperations","esEntity","createSubmissionStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport formElasticsearchFields from \"./operations/form/elasticsearchFields\";\nimport submissionElasticsearchFields from \"./operations/submission/elasticsearchFields\";\nimport WebinyError from \"@webiny/error\";\nimport { ENTITIES, FormBuilderStorageOperationsFactory } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createFormEntity } from \"~/definitions/form\";\nimport { createSubmissionEntity } from \"~/definitions/submission\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\nimport { createSubmissionStorageOperations } from \"~/operations/submission\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\nimport { createFormStorageOperations } from \"~/operations/form\";\nimport { createElasticsearchTable } from \"~/definitions/tableElasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createElasticsearchEntity } from \"~/definitions/elasticsearch\";\nimport {\n CompressionPlugin,\n ElasticsearchQueryBuilderOperatorPlugin\n} from \"@webiny/api-elasticsearch\";\nimport { elasticsearchIndexPlugins } from \"~/elasticsearch/indices\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\nimport { FormBuilderContext } from \"@webiny/api-form-builder/types\";\nimport {\n FormDynamoDbFieldPlugin,\n FormElasticsearchBodyModifierPlugin,\n FormElasticsearchFieldPlugin,\n FormElasticsearchIndexPlugin,\n FormElasticsearchQueryModifierPlugin,\n FormElasticsearchSortModifierPlugin,\n SubmissionElasticsearchBodyModifierPlugin,\n SubmissionElasticsearchFieldPlugin,\n SubmissionElasticsearchQueryModifierPlugin,\n SubmissionElasticsearchSortModifierPlugin\n} from \"~/plugins\";\nimport { createIndexTaskPlugin } from \"~/tasks/createIndexTaskPlugin\";\n\nconst reservedFields = [\"PK\", \"SK\", \"index\", \"data\", \"TYPE\", \"__type\", \"GSI1_PK\", \"GSI1_SK\"];\n\nconst isReserved = (name: string): void => {\n if (reservedFields.includes(name) === false) {\n return;\n }\n throw new WebinyError(`Attribute name \"${name}\" is not allowed.`, \"ATTRIBUTE_NOT_ALLOWED\", {\n name\n });\n};\n\nexport * from \"./plugins\";\n\nexport const createFormBuilderStorageOperations: FormBuilderStorageOperationsFactory = params => {\n const {\n attributes,\n table: tableName,\n esTable: esTableName,\n documentClient,\n elasticsearch,\n plugins: userPlugins\n } = params;\n\n if (attributes) {\n Object.values(attributes).forEach(attrs => {\n Object.keys(attrs).forEach(isReserved);\n });\n }\n\n const plugins = new PluginsContainer([\n /**\n * User defined plugins.\n */\n userPlugins || [],\n /**\n * Elasticsearch field definitions for the submission record.\n */\n submissionElasticsearchFields(),\n /**\n * Elasticsearch field definitions for the form record.\n */\n formElasticsearchFields(),\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Built-in Elasticsearch index plugins\n */\n elasticsearchIndexPlugins()\n ]);\n\n const table = createTable({\n tableName,\n documentClient\n });\n\n const esTable = createElasticsearchTable({\n tableName: esTableName,\n documentClient\n });\n\n const entities = {\n /**\n * Regular entities.\n */\n form: createFormEntity({\n entityName: ENTITIES.FORM,\n table,\n attributes: attributes ? attributes[ENTITIES.FORM] : {}\n }),\n submission: createSubmissionEntity({\n entityName: ENTITIES.SUBMISSION,\n table,\n attributes: attributes ? attributes[ENTITIES.SUBMISSION] : {}\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n /**\n * Elasticsearch entities.\n */\n esForm: createElasticsearchEntity({\n entityName: ENTITIES.ES_FORM,\n table: esTable,\n attributes: attributes ? attributes[ENTITIES.ES_FORM] : {}\n }),\n esSubmission: createElasticsearchEntity({\n entityName: ENTITIES.ES_SUBMISSION,\n table: esTable,\n attributes: attributes ? attributes[ENTITIES.ES_SUBMISSION] : {}\n })\n };\n\n return {\n beforeInit: async (context: FormBuilderContext) => {\n const types: string[] = [\n // Elasticsearch\n CompressionPlugin.type,\n ElasticsearchQueryBuilderOperatorPlugin.type,\n // Form Builder\n FormDynamoDbFieldPlugin.type,\n FormElasticsearchBodyModifierPlugin.type,\n FormElasticsearchFieldPlugin.type,\n FormElasticsearchIndexPlugin.type,\n FormElasticsearchQueryModifierPlugin.type,\n FormElasticsearchSortModifierPlugin.type,\n SubmissionElasticsearchBodyModifierPlugin.type,\n SubmissionElasticsearchFieldPlugin.type,\n SubmissionElasticsearchQueryModifierPlugin.type,\n SubmissionElasticsearchSortModifierPlugin.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n context.plugins.register([createIndexTaskPlugin(), elasticsearchIndexPlugins()]);\n },\n init: async (context: FormBuilderContext) => {\n context.i18n.locales.onLocaleBeforeCreate.subscribe(async ({ locale, tenant }) => {\n await createElasticsearchIndex({\n elasticsearch,\n plugins,\n tenant,\n locale: locale.code\n });\n });\n },\n getTable: () => table,\n getEsTable: () => esTable,\n getEntities: () => entities,\n ...createSystemStorageOperations({\n table,\n entity: entities.system\n }),\n ...createSettingsStorageOperations({\n table,\n entity: entities.settings\n }),\n ...createFormStorageOperations({\n elasticsearch,\n table,\n entity: entities.form,\n esEntity: entities.esForm,\n plugins\n }),\n ...createSubmissionStorageOperations({\n elasticsearch,\n table,\n entity: entities.submission,\n esEntity: entities.esSubmission,\n plugins\n })\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAX,OAAA;AACA,IAAAY,UAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,mBAAA,GAAAd,OAAA;AACA,IAAAe,QAAA,GAAAf,OAAA;AACA,IAAAgB,cAAA,GAAAhB,OAAA;AACA,IAAAiB,iBAAA,GAAAjB,OAAA;AAIA,IAAAkB,QAAA,GAAAlB,OAAA;AACA,IAAAmB,yBAAA,GAAAn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AAC;IACD0C,IAAI,EAAE,MAAOlB,OAA2B,IAAK;MACzCA,OAAO,CAACmB,IAAI,CAACC,OAAO,CAACC,oBAAoB,CAACC,SAAS,CAAC,OAAO;QAAEC,MAAM;QAAEC;MAAO,CAAC,KAAK;QAC9E,MAAM,IAAAC,kDAAwB,EAAC;UAC3B1D,aAAa;UACbC,OAAO;UACPwD,MAAM;UACND,MAAM,EAAEA,MAAM,CAACG;QACnB,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC;IACDC,QAAQ,EAAEA,CAAA,KAAMjE,KAAK;IACrBkE,UAAU,EAAEA,CAAA,KAAMhE,OAAO;IACzBiE,WAAW,EAAEA,CAAA,KAAMlD,QAAQ;IAC3B,GAAG,IAAAmD,sCAA6B,EAAC;MAC7BpE,KAAK;MACLqE,MAAM,EAAEpD,QAAQ,CAACS;IACrB,CAAC,CAAC;IACF,GAAG,IAAA4C,0CAA+B,EAAC;MAC/BtE,KAAK;MACLqE,MAAM,EAAEpD,QAAQ,CAACY;IACrB,CAAC,CAAC;IACF,GAAG,IAAA0C,kCAA2B,EAAC;MAC3BlE,aAAa;MACbL,KAAK;MACLqE,MAAM,EAAEpD,QAAQ,CAACC,IAAI;MACrBsD,QAAQ,EAAEvD,QAAQ,CAACe,MAAM;MACzB1B;IACJ,CAAC,CAAC;IACF,GAAG,IAAAmE,8CAAiC,EAAC;MACjCpE,aAAa;MACbL,KAAK;MACLqE,MAAM,EAAEpD,QAAQ,CAACM,UAAU;MAC3BiD,QAAQ,EAAEvD,QAAQ,CAACkB,YAAY;MAC/B7B;IACJ,CAAC;EACL,CAAC;AACL,CAAC;AAACnB,OAAA,CAAAU,kCAAA,GAAAA,kCAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_filters","_interopRequireDefault","require","_elasticsearchFields","_elasticsearchFields2","_error","_types","_table","_form","_submission","_system","_settings","_system2","_submission2","_settings2","_form2","_tableElasticsearch","_plugins","_elasticsearch","_apiElasticsearch","_indices","_createElasticsearchIndex","_plugins2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_createIndexTaskPlugin","reservedFields","isReserved","name","includes","WebinyError","createFormBuilderStorageOperations","params","attributes","table","tableName","esTable","esTableName","documentClient","elasticsearch","plugins","userPlugins","values","attrs","PluginsContainer","submissionElasticsearchFields","formElasticsearchFields","dynamoDbValueFilters","elasticsearchIndexPlugins","createTable","createElasticsearchTable","entities","form","createFormEntity","entityName","ENTITIES","FORM","submission","createSubmissionEntity","SUBMISSION","system","createSystemEntity","SYSTEM","settings","createSettingsEntity","SETTINGS","esForm","createElasticsearchEntity","ES_FORM","esSubmission","ES_SUBMISSION","beforeInit","context","db","registry","register","item","app","tags","types","CompressionPlugin","type","ElasticsearchQueryBuilderOperatorPlugin","FormDynamoDbFieldPlugin","FormElasticsearchBodyModifierPlugin","FormElasticsearchFieldPlugin","FormElasticsearchIndexPlugin","FormElasticsearchQueryModifierPlugin","FormElasticsearchSortModifierPlugin","SubmissionElasticsearchBodyModifierPlugin","SubmissionElasticsearchFieldPlugin","SubmissionElasticsearchQueryModifierPlugin","SubmissionElasticsearchSortModifierPlugin","mergeByType","createIndexTaskPlugin","init","i18n","locales","onLocaleBeforeCreate","subscribe","locale","tenant","createElasticsearchIndex","code","getTable","getEsTable","getEntities","createSystemStorageOperations","entity","createSettingsStorageOperations","createFormStorageOperations","esEntity","createSubmissionStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport formElasticsearchFields from \"./operations/form/elasticsearchFields\";\nimport submissionElasticsearchFields from \"./operations/submission/elasticsearchFields\";\nimport WebinyError from \"@webiny/error\";\nimport { ENTITIES, FormBuilderStorageOperationsFactory } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createFormEntity } from \"~/definitions/form\";\nimport { createSubmissionEntity } from \"~/definitions/submission\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\nimport { createSubmissionStorageOperations } from \"~/operations/submission\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\nimport { createFormStorageOperations } from \"~/operations/form\";\nimport { createElasticsearchTable } from \"~/definitions/tableElasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createElasticsearchEntity } from \"~/definitions/elasticsearch\";\nimport {\n CompressionPlugin,\n ElasticsearchQueryBuilderOperatorPlugin\n} from \"@webiny/api-elasticsearch\";\nimport { elasticsearchIndexPlugins } from \"~/elasticsearch/indices\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\nimport { FormBuilderContext } from \"@webiny/api-form-builder/types\";\nimport {\n FormDynamoDbFieldPlugin,\n FormElasticsearchBodyModifierPlugin,\n FormElasticsearchFieldPlugin,\n FormElasticsearchIndexPlugin,\n FormElasticsearchQueryModifierPlugin,\n FormElasticsearchSortModifierPlugin,\n SubmissionElasticsearchBodyModifierPlugin,\n SubmissionElasticsearchFieldPlugin,\n SubmissionElasticsearchQueryModifierPlugin,\n SubmissionElasticsearchSortModifierPlugin\n} from \"~/plugins\";\nimport { createIndexTaskPlugin } from \"~/tasks/createIndexTaskPlugin\";\n\nconst reservedFields = [\"PK\", \"SK\", \"index\", \"data\", \"TYPE\", \"__type\", \"GSI1_PK\", \"GSI1_SK\"];\n\nconst isReserved = (name: string): void => {\n if (reservedFields.includes(name) === false) {\n return;\n }\n throw new WebinyError(`Attribute name \"${name}\" is not allowed.`, \"ATTRIBUTE_NOT_ALLOWED\", {\n name\n });\n};\n\nexport * from \"./plugins\";\n\nexport const createFormBuilderStorageOperations: FormBuilderStorageOperationsFactory = params => {\n const {\n attributes,\n table: tableName,\n esTable: esTableName,\n documentClient,\n elasticsearch,\n plugins: userPlugins\n } = params;\n\n if (attributes) {\n Object.values(attributes).forEach(attrs => {\n Object.keys(attrs).forEach(isReserved);\n });\n }\n\n const plugins = new PluginsContainer([\n /**\n * User defined plugins.\n */\n userPlugins || [],\n /**\n * Elasticsearch field definitions for the submission record.\n */\n submissionElasticsearchFields(),\n /**\n * Elasticsearch field definitions for the form record.\n */\n formElasticsearchFields(),\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Built-in Elasticsearch index plugins\n */\n elasticsearchIndexPlugins()\n ]);\n\n const table = createTable({\n tableName,\n documentClient\n });\n\n const esTable = createElasticsearchTable({\n tableName: esTableName,\n documentClient\n });\n\n const entities = {\n /**\n * Regular entities.\n */\n form: createFormEntity({\n entityName: ENTITIES.FORM,\n table,\n attributes: attributes ? attributes[ENTITIES.FORM] : {}\n }),\n submission: createSubmissionEntity({\n entityName: ENTITIES.SUBMISSION,\n table,\n attributes: attributes ? attributes[ENTITIES.SUBMISSION] : {}\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n /**\n * Elasticsearch entities.\n */\n esForm: createElasticsearchEntity({\n entityName: ENTITIES.ES_FORM,\n table: esTable,\n attributes: attributes ? attributes[ENTITIES.ES_FORM] : {}\n }),\n esSubmission: createElasticsearchEntity({\n entityName: ENTITIES.ES_SUBMISSION,\n table: esTable,\n attributes: attributes ? attributes[ENTITIES.ES_SUBMISSION] : {}\n })\n };\n\n return {\n beforeInit: async (context: FormBuilderContext) => {\n context.db.registry.register({\n item: entities.form,\n app: \"fb\",\n tags: [\"regular\", \"form\", entities.form.name]\n });\n context.db.registry.register({\n item: entities.esForm,\n app: \"fb\",\n tags: [\"es\", \"form\", entities.esForm.name]\n });\n context.db.registry.register({\n item: entities.submission,\n app: \"fb\",\n tags: [\"regular\", \"form-submission\", entities.submission.name]\n });\n context.db.registry.register({\n item: entities.esSubmission,\n app: \"fb\",\n tags: [\"es\", \"form-submission\", entities.esSubmission.name]\n });\n\n const types: string[] = [\n // Elasticsearch\n CompressionPlugin.type,\n ElasticsearchQueryBuilderOperatorPlugin.type,\n // Form Builder\n FormDynamoDbFieldPlugin.type,\n FormElasticsearchBodyModifierPlugin.type,\n FormElasticsearchFieldPlugin.type,\n FormElasticsearchIndexPlugin.type,\n FormElasticsearchQueryModifierPlugin.type,\n FormElasticsearchSortModifierPlugin.type,\n SubmissionElasticsearchBodyModifierPlugin.type,\n SubmissionElasticsearchFieldPlugin.type,\n SubmissionElasticsearchQueryModifierPlugin.type,\n SubmissionElasticsearchSortModifierPlugin.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n context.plugins.register([createIndexTaskPlugin(), elasticsearchIndexPlugins()]);\n },\n init: async (context: FormBuilderContext) => {\n context.i18n.locales.onLocaleBeforeCreate.subscribe(async ({ locale, tenant }) => {\n await createElasticsearchIndex({\n elasticsearch,\n plugins,\n tenant,\n locale: locale.code\n });\n });\n },\n getTable: () => table,\n getEsTable: () => esTable,\n getEntities: () => entities,\n ...createSystemStorageOperations({\n table,\n entity: entities.system\n }),\n ...createSettingsStorageOperations({\n table,\n entity: entities.settings\n }),\n ...createFormStorageOperations({\n elasticsearch,\n table,\n entity: entities.form,\n esEntity: entities.esForm,\n plugins\n }),\n ...createSubmissionStorageOperations({\n elasticsearch,\n table,\n entity: entities.submission,\n esEntity: entities.esSubmission,\n plugins\n })\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,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",
|
|
3
|
-
"version": "5.41.
|
|
3
|
+
"version": "5.41.2-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"@webiny/api-form-builder",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@babel/runtime": "7.24.1",
|
|
29
29
|
"@elastic/elasticsearch": "7.12.0",
|
|
30
|
-
"@webiny/api-elasticsearch": "5.41.
|
|
31
|
-
"@webiny/api-elasticsearch-tasks": "5.41.
|
|
32
|
-
"@webiny/api-form-builder": "5.41.
|
|
33
|
-
"@webiny/aws-sdk": "5.41.
|
|
34
|
-
"@webiny/db-dynamodb": "5.41.
|
|
35
|
-
"@webiny/error": "5.41.
|
|
36
|
-
"@webiny/plugins": "5.41.
|
|
37
|
-
"@webiny/utils": "5.41.
|
|
30
|
+
"@webiny/api-elasticsearch": "5.41.2-beta.0",
|
|
31
|
+
"@webiny/api-elasticsearch-tasks": "5.41.2-beta.0",
|
|
32
|
+
"@webiny/api-form-builder": "5.41.2-beta.0",
|
|
33
|
+
"@webiny/aws-sdk": "5.41.2-beta.0",
|
|
34
|
+
"@webiny/db-dynamodb": "5.41.2-beta.0",
|
|
35
|
+
"@webiny/error": "5.41.2-beta.0",
|
|
36
|
+
"@webiny/plugins": "5.41.2-beta.0",
|
|
37
|
+
"@webiny/utils": "5.41.2-beta.0",
|
|
38
38
|
"elastic-ts": "0.8.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"@babel/core": "7.24.3",
|
|
43
43
|
"@babel/preset-env": "7.24.3",
|
|
44
44
|
"@babel/preset-typescript": "7.24.1",
|
|
45
|
-
"@webiny/api-dynamodb-to-elasticsearch": "5.41.
|
|
46
|
-
"@webiny/cli": "5.41.
|
|
47
|
-
"@webiny/handler-aws": "5.41.
|
|
48
|
-
"@webiny/handler-db": "5.41.
|
|
49
|
-
"@webiny/project-utils": "5.41.
|
|
45
|
+
"@webiny/api-dynamodb-to-elasticsearch": "5.41.2-beta.0",
|
|
46
|
+
"@webiny/cli": "5.41.2-beta.0",
|
|
47
|
+
"@webiny/handler-aws": "5.41.2-beta.0",
|
|
48
|
+
"@webiny/handler-db": "5.41.2-beta.0",
|
|
49
|
+
"@webiny/project-utils": "5.41.2-beta.0",
|
|
50
50
|
"csvtojson": "2.0.10",
|
|
51
51
|
"jest": "29.7.0",
|
|
52
52
|
"jest-dynalite": "3.6.1",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"build": "yarn webiny run build",
|
|
63
63
|
"watch": "yarn webiny run watch"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "a259e2af938ceb1e2d35b2bef9edcee4459352de"
|
|
66
66
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormBuilder, FormBuilderContext as BaseFormBuilderContext, FormBuilderFormStorageOperations as BaseFormBuilderFormStorageOperations, FormBuilderSettingsStorageOperations as BaseFormBuilderSettingsStorageOperations, FormBuilderStorageOperations as BaseFormBuilderStorageOperations, FormBuilderSubmissionStorageOperations as BaseFormBuilderSubmissionStorageOperations, FormBuilderSystemStorageOperations as BaseFormBuilderSystemStorageOperations } from "@webiny/api-form-builder/types";
|
|
2
2
|
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
3
|
-
import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
|
|
4
|
-
import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
+
import { AttributeDefinition, Entity, Table } from "@webiny/db-dynamodb/toolbox";
|
|
5
4
|
import { Client } from "@elastic/elasticsearch";
|
|
6
5
|
import { PluginCollection } from "@webiny/plugins/types";
|
|
7
|
-
export { FormBuilderContext };
|
|
8
6
|
export type Attributes = Record<string, AttributeDefinition>;
|
|
9
7
|
export declare enum ENTITIES {
|
|
10
8
|
FORM = "FormBuilderForm",
|
|
9
|
+
ES_SUBMISSION = "FormBuilderSubmissionEs",
|
|
11
10
|
ES_FORM = "FormBuilderFormEs",
|
|
12
11
|
SUBMISSION = "FormBuilderSubmission",
|
|
13
|
-
ES_SUBMISSION = "FormBuilderSubmissionEs",
|
|
14
12
|
SYSTEM = "FormBuilderSystem",
|
|
15
13
|
SETTINGS = "FormBuilderSettings"
|
|
16
14
|
}
|
|
@@ -63,3 +61,8 @@ export interface FormBuilderStorageOperations extends BaseFormBuilderStorageOper
|
|
|
63
61
|
export interface FormBuilderStorageOperationsFactory {
|
|
64
62
|
(params: FormBuilderStorageOperationsFactoryParams): FormBuilderStorageOperations;
|
|
65
63
|
}
|
|
64
|
+
export interface FormBuilderContext extends BaseFormBuilderContext {
|
|
65
|
+
formBuilder: FormBuilder & {
|
|
66
|
+
storageOperations: FormBuilderStorageOperations;
|
|
67
|
+
};
|
|
68
|
+
}
|
package/types.js
CHANGED
|
@@ -4,18 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ENTITIES = void 0;
|
|
7
|
-
Object.defineProperty(exports, "FormBuilderContext", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _types.FormBuilderContext;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _types = require("@webiny/api-form-builder/types");
|
|
14
7
|
let ENTITIES = exports.ENTITIES = /*#__PURE__*/function (ENTITIES) {
|
|
15
8
|
ENTITIES["FORM"] = "FormBuilderForm";
|
|
9
|
+
ENTITIES["ES_SUBMISSION"] = "FormBuilderSubmissionEs";
|
|
16
10
|
ENTITIES["ES_FORM"] = "FormBuilderFormEs";
|
|
17
11
|
ENTITIES["SUBMISSION"] = "FormBuilderSubmission";
|
|
18
|
-
ENTITIES["ES_SUBMISSION"] = "FormBuilderSubmissionEs";
|
|
19
12
|
ENTITIES["SYSTEM"] = "FormBuilderSystem";
|
|
20
13
|
ENTITIES["SETTINGS"] = "FormBuilderSettings";
|
|
21
14
|
return ENTITIES;
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import {\n FormBuilder,\n FormBuilderContext as BaseFormBuilderContext,\n FormBuilderFormStorageOperations as BaseFormBuilderFormStorageOperations,\n FormBuilderSettingsStorageOperations as BaseFormBuilderSettingsStorageOperations,\n FormBuilderStorageOperations as BaseFormBuilderStorageOperations,\n FormBuilderSubmissionStorageOperations as BaseFormBuilderSubmissionStorageOperations,\n FormBuilderSystemStorageOperations as BaseFormBuilderSystemStorageOperations\n} from \"@webiny/api-form-builder/types\";\nimport { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { AttributeDefinition, Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { PluginCollection } from \"@webiny/plugins/types\";\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n FORM = \"FormBuilderForm\",\n ES_SUBMISSION = \"FormBuilderSubmissionEs\",\n ES_FORM = \"FormBuilderFormEs\",\n SUBMISSION = \"FormBuilderSubmission\",\n SYSTEM = \"FormBuilderSystem\",\n SETTINGS = \"FormBuilderSettings\"\n}\n\nexport interface FormBuilderStorageOperationsFactoryParams {\n documentClient: DynamoDBDocument;\n elasticsearch: Client;\n table?: string;\n esTable?: string;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: PluginCollection;\n}\n\nexport interface FormBuilderSystemCreateKeysParams {\n tenant: string;\n}\n\nexport interface FormBuilderSystemStorageOperations extends BaseFormBuilderSystemStorageOperations {\n createSystemPartitionKey: (params: FormBuilderSystemCreateKeysParams) => string;\n createSystemSortKey: () => string;\n}\n\nexport interface FormBuilderFormCreateKeyParams {\n id: string;\n tenant: string;\n locale: string;\n}\n\nexport interface FormBuilderFormStorageOperations extends BaseFormBuilderFormStorageOperations {\n createFormPartitionKey: (params: FormBuilderFormCreateKeyParams) => string;\n}\n\nexport interface FormBuilderSubmissionStorageOperationsCreatePartitionKeyParams {\n tenant: string;\n locale: string;\n formId: string;\n}\n\nexport interface FormBuilderSubmissionStorageOperations\n extends BaseFormBuilderSubmissionStorageOperations {\n createSubmissionPartitionKey: (\n params: FormBuilderSubmissionStorageOperationsCreatePartitionKeyParams\n ) => string;\n createSubmissionSortKey: (id: string) => string;\n}\n\nexport interface FormBuilderSettingsStorageOperationsCreatePartitionKeyParams {\n tenant: string;\n locale: string;\n}\n\nexport interface FormBuilderSettingsStorageOperations\n extends BaseFormBuilderSettingsStorageOperations {\n createSettingsPartitionKey: (\n params: FormBuilderSettingsStorageOperationsCreatePartitionKeyParams\n ) => string;\n createSettingsSortKey: () => string;\n}\n\nexport type Entities = \"form\" | \"esForm\" | \"submission\" | \"esSubmission\" | \"system\" | \"settings\";\n\nexport interface FormBuilderStorageOperations\n extends BaseFormBuilderStorageOperations,\n FormBuilderSettingsStorageOperations,\n FormBuilderSubmissionStorageOperations,\n FormBuilderFormStorageOperations,\n FormBuilderSystemStorageOperations {\n getTable(): Table<string, string, string>;\n getEsTable(): Table<string, string, string>;\n getEntities(): Record<Entities, Entity<any>>;\n}\n\nexport interface FormBuilderStorageOperationsFactory {\n (params: FormBuilderStorageOperationsFactoryParams): FormBuilderStorageOperations;\n}\n\nexport interface FormBuilderContext extends BaseFormBuilderContext {\n formBuilder: FormBuilder & {\n storageOperations: FormBuilderStorageOperations;\n };\n}\n"],"mappings":";;;;;;IAgBYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA","ignoreList":[]}
|