@webiny/api-form-builder-so-ddb-es 0.0.0-mt-3 → 0.0.0-unstable.085ff6572f

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.
Files changed (101) hide show
  1. package/configurations.d.ts +7 -5
  2. package/configurations.js +23 -12
  3. package/configurations.js.map +1 -0
  4. package/definitions/elasticsearch.d.ts +2 -1
  5. package/definitions/elasticsearch.js +3 -12
  6. package/definitions/elasticsearch.js.map +1 -0
  7. package/definitions/form.d.ts +2 -1
  8. package/definitions/form.js +3 -12
  9. package/definitions/form.js.map +1 -0
  10. package/definitions/settings.d.ts +2 -1
  11. package/definitions/settings.js +3 -12
  12. package/definitions/settings.js.map +1 -0
  13. package/definitions/submission.d.ts +2 -1
  14. package/definitions/submission.js +3 -12
  15. package/definitions/submission.js.map +1 -0
  16. package/definitions/system.d.ts +2 -1
  17. package/definitions/system.js +3 -12
  18. package/definitions/system.js.map +1 -0
  19. package/definitions/table.d.ts +3 -2
  20. package/definitions/table.js +0 -3
  21. package/definitions/table.js.map +1 -0
  22. package/definitions/tableElasticsearch.d.ts +2 -1
  23. package/definitions/tableElasticsearch.js +0 -3
  24. package/definitions/tableElasticsearch.js.map +1 -0
  25. package/elasticsearch/createElasticsearchIndex.d.ts +10 -0
  26. package/elasticsearch/createElasticsearchIndex.js +52 -0
  27. package/elasticsearch/createElasticsearchIndex.js.map +1 -0
  28. package/elasticsearch/indices/base.d.ts +2 -0
  29. package/elasticsearch/indices/base.js +12 -0
  30. package/elasticsearch/indices/base.js.map +1 -0
  31. package/elasticsearch/indices/index.d.ts +1 -0
  32. package/elasticsearch/indices/index.js +12 -0
  33. package/elasticsearch/indices/index.js.map +1 -0
  34. package/elasticsearch/indices/japanese.d.ts +2 -0
  35. package/elasticsearch/indices/japanese.js +13 -0
  36. package/elasticsearch/indices/japanese.js.map +1 -0
  37. package/index.d.ts +1 -0
  38. package/index.js +54 -61
  39. package/index.js.map +1 -0
  40. package/operations/form/elasticsearchBody.js +12 -56
  41. package/operations/form/elasticsearchBody.js.map +1 -0
  42. package/operations/form/elasticsearchFields.js +0 -3
  43. package/operations/form/elasticsearchFields.js.map +1 -0
  44. package/operations/form/fields.js +0 -3
  45. package/operations/form/fields.js.map +1 -0
  46. package/operations/form/index.d.ts +2 -2
  47. package/operations/form/index.js +53 -153
  48. package/operations/form/index.js.map +1 -0
  49. package/operations/settings/index.d.ts +2 -2
  50. package/operations/settings/index.js +5 -29
  51. package/operations/settings/index.js.map +1 -0
  52. package/operations/submission/elasticsearchBody.js +15 -54
  53. package/operations/submission/elasticsearchBody.js.map +1 -0
  54. package/operations/submission/elasticsearchFields.js +0 -3
  55. package/operations/submission/elasticsearchFields.js.map +1 -0
  56. package/operations/submission/index.d.ts +2 -2
  57. package/operations/submission/index.js +23 -76
  58. package/operations/submission/index.js.map +1 -0
  59. package/operations/system/index.d.ts +2 -2
  60. package/operations/system/index.js +4 -26
  61. package/operations/system/index.js.map +1 -0
  62. package/package.json +27 -32
  63. package/plugins/FormDynamoDbFieldPlugin.js +1 -6
  64. package/plugins/FormDynamoDbFieldPlugin.js.map +1 -0
  65. package/plugins/FormElasticsearchBodyModifierPlugin.d.ts +1 -1
  66. package/plugins/FormElasticsearchBodyModifierPlugin.js +3 -8
  67. package/plugins/FormElasticsearchBodyModifierPlugin.js.map +1 -0
  68. package/plugins/FormElasticsearchFieldPlugin.d.ts +1 -1
  69. package/plugins/FormElasticsearchFieldPlugin.js +3 -8
  70. package/plugins/FormElasticsearchFieldPlugin.js.map +1 -0
  71. package/plugins/FormElasticsearchIndexPlugin.d.ts +4 -0
  72. package/plugins/FormElasticsearchIndexPlugin.js +12 -0
  73. package/plugins/FormElasticsearchIndexPlugin.js.map +1 -0
  74. package/plugins/FormElasticsearchQueryModifierPlugin.d.ts +1 -1
  75. package/plugins/FormElasticsearchQueryModifierPlugin.js +3 -8
  76. package/plugins/FormElasticsearchQueryModifierPlugin.js.map +1 -0
  77. package/plugins/FormElasticsearchSortModifierPlugin.d.ts +1 -1
  78. package/plugins/FormElasticsearchSortModifierPlugin.js +3 -8
  79. package/plugins/FormElasticsearchSortModifierPlugin.js.map +1 -0
  80. package/plugins/SubmissionElasticsearchBodyModifierPlugin.d.ts +1 -1
  81. package/plugins/SubmissionElasticsearchBodyModifierPlugin.js +3 -8
  82. package/plugins/SubmissionElasticsearchBodyModifierPlugin.js.map +1 -0
  83. package/plugins/SubmissionElasticsearchFieldPlugin.d.ts +1 -1
  84. package/plugins/SubmissionElasticsearchFieldPlugin.js +3 -8
  85. package/plugins/SubmissionElasticsearchFieldPlugin.js.map +1 -0
  86. package/plugins/SubmissionElasticsearchQueryModifierPlugin.d.ts +1 -1
  87. package/plugins/SubmissionElasticsearchQueryModifierPlugin.js +3 -8
  88. package/plugins/SubmissionElasticsearchQueryModifierPlugin.js.map +1 -0
  89. package/plugins/SubmissionElasticsearchSortModifierPlugin.d.ts +1 -1
  90. package/plugins/SubmissionElasticsearchSortModifierPlugin.js +3 -8
  91. package/plugins/SubmissionElasticsearchSortModifierPlugin.js.map +1 -0
  92. package/plugins/index.d.ts +10 -0
  93. package/plugins/index.js +115 -0
  94. package/plugins/index.js.map +1 -0
  95. package/types.d.ts +2 -2
  96. package/types.js +0 -1
  97. package/types.js.map +1 -0
  98. package/operations/system/createElasticsearchIndex.d.ts +0 -6
  99. package/operations/system/createElasticsearchIndex.js +0 -70
  100. package/upgrades/5.16.0/index.d.ts +0 -8
  101. package/upgrades/5.16.0/index.js +0 -141
package/index.js CHANGED
@@ -1,107 +1,90 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
7
+ var _exportNames = {
8
+ createFormBuilderStorageOperations: true
9
+ };
8
10
  exports.createFormBuilderStorageOperations = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _types = require("./types");
13
-
11
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
+ var _filters = _interopRequireDefault(require("@webiny/db-dynamodb/plugins/filters"));
13
+ var _elasticsearchFields = _interopRequireDefault(require("./operations/form/elasticsearchFields"));
14
+ var _elasticsearchFields2 = _interopRequireDefault(require("./operations/submission/elasticsearchFields"));
14
15
  var _error = _interopRequireDefault(require("@webiny/error"));
15
-
16
+ var _types = require("./types");
16
17
  var _table = require("./definitions/table");
17
-
18
18
  var _form = require("./definitions/form");
19
-
20
19
  var _submission = require("./definitions/submission");
21
-
22
20
  var _system = require("./definitions/system");
23
-
24
21
  var _settings = require("./definitions/settings");
25
-
26
22
  var _system2 = require("./operations/system");
27
-
28
23
  var _submission2 = require("./operations/submission");
29
-
30
24
  var _settings2 = require("./operations/settings");
31
-
32
25
  var _form2 = require("./operations/form");
33
-
34
- var _createElasticsearchIndex = require("./operations/system/createElasticsearchIndex");
35
-
36
26
  var _tableElasticsearch = require("./definitions/tableElasticsearch");
37
-
38
27
  var _plugins = require("@webiny/plugins");
39
-
40
28
  var _elasticsearch = require("./definitions/elasticsearch");
41
-
42
- var _elasticsearchFields = _interopRequireDefault(require("./operations/submission/elasticsearchFields"));
43
-
44
- var _elasticsearchFields2 = _interopRequireDefault(require("./operations/form/elasticsearchFields"));
45
-
46
- var _filters = _interopRequireDefault(require("@webiny/db-dynamodb/plugins/filters"));
47
-
48
- var _operators = require("@webiny/api-elasticsearch/operators");
49
-
50
- var _ = _interopRequireDefault(require("./upgrades/5.16.0"));
51
-
52
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
53
-
54
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
55
-
29
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
30
+ var _indices = require("./elasticsearch/indices");
31
+ var _createElasticsearchIndex = require("./elasticsearch/createElasticsearchIndex");
32
+ var _plugins2 = require("./plugins");
33
+ Object.keys(_plugins2).forEach(function (key) {
34
+ if (key === "default" || key === "__esModule") return;
35
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
36
+ if (key in exports && exports[key] === _plugins2[key]) return;
37
+ Object.defineProperty(exports, key, {
38
+ enumerable: true,
39
+ get: function () {
40
+ return _plugins2[key];
41
+ }
42
+ });
43
+ });
56
44
  const reservedFields = ["PK", "SK", "index", "data", "TYPE", "__type", "GSI1_PK", "GSI1_SK"];
57
-
58
45
  const isReserved = name => {
59
46
  if (reservedFields.includes(name) === false) {
60
47
  return;
61
48
  }
62
-
63
49
  throw new _error.default(`Attribute name "${name}" is not allowed.`, "ATTRIBUTE_NOT_ALLOWED", {
64
50
  name
65
51
  });
66
52
  };
67
-
68
53
  const createFormBuilderStorageOperations = params => {
69
54
  const {
70
- attributes = {},
55
+ attributes,
71
56
  table: tableName,
72
57
  esTable: esTableName,
73
58
  documentClient,
74
59
  elasticsearch,
75
- plugins: pluginsInput
60
+ plugins: userPlugins
76
61
  } = params;
77
-
78
62
  if (attributes) {
79
63
  Object.values(attributes).forEach(attrs => {
80
64
  Object.keys(attrs).forEach(isReserved);
81
65
  });
82
66
  }
83
-
84
67
  const plugins = new _plugins.PluginsContainer([
85
68
  /**
86
69
  * User defined plugins.
87
70
  */
88
- pluginsInput || [],
71
+ userPlugins || [],
89
72
  /**
90
73
  * Elasticsearch field definitions for the submission record.
91
74
  */
92
- (0, _elasticsearchFields.default)(),
75
+ (0, _elasticsearchFields2.default)(),
93
76
  /**
94
77
  * Elasticsearch field definitions for the form record.
95
78
  */
96
- (0, _elasticsearchFields2.default)(),
79
+ (0, _elasticsearchFields.default)(),
97
80
  /**
98
81
  * DynamoDB filter plugins for the where conditions.
99
82
  */
100
83
  (0, _filters.default)(),
101
84
  /**
102
- * Elasticsearch operators.
85
+ * Built-in Elasticsearch index plugins
103
86
  */
104
- (0, _operators.getElasticsearchOperators)()]);
87
+ (0, _indices.elasticsearchIndexPlugins)()]);
105
88
  const table = (0, _table.createTable)({
106
89
  tableName,
107
90
  documentClient
@@ -117,50 +100,61 @@ const createFormBuilderStorageOperations = params => {
117
100
  form: (0, _form.createFormEntity)({
118
101
  entityName: _types.ENTITIES.FORM,
119
102
  table,
120
- attributes: attributes[_types.ENTITIES.FORM]
103
+ attributes: attributes ? attributes[_types.ENTITIES.FORM] : {}
121
104
  }),
122
105
  submission: (0, _submission.createSubmissionEntity)({
123
106
  entityName: _types.ENTITIES.SUBMISSION,
124
107
  table,
125
- attributes: attributes[_types.ENTITIES.SUBMISSION]
108
+ attributes: attributes ? attributes[_types.ENTITIES.SUBMISSION] : {}
126
109
  }),
127
110
  system: (0, _system.createSystemEntity)({
128
111
  entityName: _types.ENTITIES.SYSTEM,
129
112
  table,
130
- attributes: attributes[_types.ENTITIES.SYSTEM]
113
+ attributes: attributes ? attributes[_types.ENTITIES.SYSTEM] : {}
131
114
  }),
132
115
  settings: (0, _settings.createSettingsEntity)({
133
116
  entityName: _types.ENTITIES.SETTINGS,
134
117
  table,
135
- attributes: attributes[_types.ENTITIES.SETTINGS]
118
+ attributes: attributes ? attributes[_types.ENTITIES.SETTINGS] : {}
136
119
  }),
137
-
138
120
  /**
139
121
  * Elasticsearch entities.
140
122
  */
141
123
  esForm: (0, _elasticsearch.createElasticsearchEntity)({
142
124
  entityName: _types.ENTITIES.ES_FORM,
143
125
  table: esTable,
144
- attributes: attributes[_types.ENTITIES.ES_FORM]
126
+ attributes: attributes ? attributes[_types.ENTITIES.ES_FORM] : {}
145
127
  }),
146
128
  esSubmission: (0, _elasticsearch.createElasticsearchEntity)({
147
129
  entityName: _types.ENTITIES.ES_SUBMISSION,
148
130
  table: esTable,
149
- attributes: attributes[_types.ENTITIES.ES_SUBMISSION]
131
+ attributes: attributes ? attributes[_types.ENTITIES.ES_SUBMISSION] : {}
150
132
  })
151
133
  };
152
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
153
- init: async formBuilder => {
154
- formBuilder.onAfterInstall.subscribe(async ({
134
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
135
+ beforeInit: async context => {
136
+ const types = [
137
+ // Elasticsearch
138
+ _apiElasticsearch.CompressionPlugin.type, _apiElasticsearch.ElasticsearchQueryBuilderOperatorPlugin.type,
139
+ // Form Builder
140
+ _plugins2.FormDynamoDbFieldPlugin.type, _plugins2.FormElasticsearchBodyModifierPlugin.type, _plugins2.FormElasticsearchFieldPlugin.type, _plugins2.FormElasticsearchIndexPlugin.type, _plugins2.FormElasticsearchQueryModifierPlugin.type, _plugins2.FormElasticsearchSortModifierPlugin.type, _plugins2.SubmissionElasticsearchBodyModifierPlugin.type, _plugins2.SubmissionElasticsearchFieldPlugin.type, _plugins2.SubmissionElasticsearchQueryModifierPlugin.type, _plugins2.SubmissionElasticsearchSortModifierPlugin.type];
141
+ for (const type of types) {
142
+ plugins.mergeByType(context.plugins, type);
143
+ }
144
+ },
145
+ init: async context => {
146
+ context.i18n.locales.onLocaleBeforeCreate.subscribe(async ({
147
+ locale,
155
148
  tenant
156
149
  }) => {
157
150
  await (0, _createElasticsearchIndex.createElasticsearchIndex)({
158
151
  elasticsearch,
159
- tenant
152
+ plugins,
153
+ tenant,
154
+ locale: locale.code
160
155
  });
161
156
  });
162
157
  },
163
- upgrade: (0, _.default)(),
164
158
  getTable: () => table,
165
159
  getEsTable: () => esTable,
166
160
  getEntities: () => entities
@@ -184,5 +178,4 @@ const createFormBuilderStorageOperations = params => {
184
178
  plugins
185
179
  }));
186
180
  };
187
-
188
181
  exports.createFormBuilderStorageOperations = createFormBuilderStorageOperations;
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["reservedFields","isReserved","name","includes","WebinyError","createFormBuilderStorageOperations","params","attributes","table","tableName","esTable","esTableName","documentClient","elasticsearch","plugins","userPlugins","Object","values","forEach","attrs","keys","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","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 { FormBuilderStorageOperationsFactory, ENTITIES } 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\";\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 },\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AAEA;AAwBA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAXA,MAAMA,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;AAE5F,MAAMC,UAAU,GAAIC,IAAY,IAAW;EACvC,IAAIF,cAAc,CAACG,QAAQ,CAACD,IAAI,CAAC,KAAK,KAAK,EAAE;IACzC;EACJ;EACA,MAAM,IAAIE,cAAW,CAAE,mBAAkBF,IAAK,mBAAkB,EAAE,uBAAuB,EAAE;IACvFA;EACJ,CAAC,CAAC;AACN,CAAC;AAIM,MAAMG,kCAAuE,GAAGC,MAAM,IAAI;EAC7F,MAA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W,mDAAyC,CAACX,IAAI,CACjD;MACD,KAAK,MAAMA,IAAI,IAAIF,KAAK,EAAE;QACtBpC,OAAO,CAACkD,WAAW,CAACf,OAAO,CAACnC,OAAO,EAAEsC,IAAI,CAAC;MAC9C;IACJ,CAAC;IACDa,IAAI,EAAE,MAAOhB,OAA2B,IAAK;MACzCA,OAAO,CAACiB,IAAI,CAACC,OAAO,CAACC,oBAAoB,CAACC,SAAS,CAAC,OAAO;QAAEC,MAAM;QAAEC;MAAO,CAAC,KAAK;QAC9E,MAAM,IAAAC,kDAAwB,EAAC;UAC3B3D,aAAa;UACbC,OAAO;UACPyD,MAAM;UACND,MAAM,EAAEA,MAAM,CAACG;QACnB,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC;IACDC,QAAQ,EAAE,MAAMlE,KAAK;IACrBmE,UAAU,EAAE,MAAMjE,OAAO;IACzBkE,WAAW,EAAE,MAAMhD;EAAQ,GACxB,IAAAiD,sCAA6B,EAAC;IAC7BrE,KAAK;IACLsE,MAAM,EAAElD,QAAQ,CAACS;EACrB,CAAC,CAAC,GACC,IAAA0C,0CAA+B,EAAC;IAC/BvE,KAAK;IACLsE,MAAM,EAAElD,QAAQ,CAACY;EACrB,CAAC,CAAC,GACC,IAAAwC,kCAA2B,EAAC;IAC3BnE,aAAa;IACbL,KAAK;IACLsE,MAAM,EAAElD,QAAQ,CAACC,IAAI;IACrBoD,QAAQ,EAAErD,QAAQ,CAACe,MAAM;IACzB7B;EACJ,CAAC,CAAC,GACC,IAAAoE,8CAAiC,EAAC;IACjCrE,aAAa;IACbL,KAAK;IACLsE,MAAM,EAAElD,QAAQ,CAACM,UAAU;IAC3B+C,QAAQ,EAAErD,QAAQ,CAACkB,YAAY;IAC/BhC;EACJ,CAAC,CAAC;AAEV,CAAC;AAAC"}
@@ -1,42 +1,20 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createFormElasticType = exports.createElasticsearchBody = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _cursors = require("@webiny/api-elasticsearch/cursors");
13
-
14
- var _sort = require("@webiny/api-elasticsearch/sort");
15
-
16
- var _limit = require("@webiny/api-elasticsearch/limit");
17
-
18
- var _ElasticsearchQueryBuilderOperatorPlugin = require("@webiny/api-elasticsearch/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin");
19
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
20
10
  var _FormElasticsearchFieldPlugin = require("../../plugins/FormElasticsearchFieldPlugin");
21
-
22
11
  var _FormElasticsearchSortModifierPlugin = require("../../plugins/FormElasticsearchSortModifierPlugin");
23
-
24
12
  var _FormElasticsearchBodyModifierPlugin = require("../../plugins/FormElasticsearchBodyModifierPlugin");
25
-
26
13
  var _FormElasticsearchQueryModifierPlugin = require("../../plugins/FormElasticsearchQueryModifierPlugin");
27
-
28
- var _where = require("@webiny/api-elasticsearch/where");
29
-
30
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
31
-
32
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
33
-
34
14
  const createFormElasticType = () => {
35
15
  return "fb.form";
36
16
  };
37
-
38
17
  exports.createFormElasticType = createFormElasticType;
39
-
40
18
  const createInitialQueryValue = () => {
41
19
  return {
42
20
  must: [
@@ -53,7 +31,6 @@ const createInitialQueryValue = () => {
53
31
  filter: []
54
32
  };
55
33
  };
56
-
57
34
  const createElasticsearchQuery = params => {
58
35
  const {
59
36
  plugins,
@@ -64,24 +41,16 @@ const createElasticsearchQuery = params => {
64
41
  /**
65
42
  * Be aware that, if having more registered operator plugins of same type, the last one will be used.
66
43
  */
67
-
68
- const operatorPlugins = plugins.byType(_ElasticsearchQueryBuilderOperatorPlugin.ElasticsearchQueryBuilderOperatorPlugin.type).reduce((acc, plugin) => {
69
- acc[plugin.getOperator()] = plugin;
70
- return acc;
71
- }, {});
72
-
73
- const where = _objectSpread({}, initialWhere);
44
+ const operatorPlugins = (0, _apiElasticsearch.getElasticsearchOperatorPluginsByLocale)(plugins, initialWhere.locale);
45
+ const where = (0, _objectSpread2.default)({}, initialWhere);
74
46
  /**
75
47
  * !!! IMPORTANT !!! There are few specific cases where we hardcode the query conditions.
76
48
  *
77
49
  * When ES index is shared between tenants, we need to filter records by tenant ID.
78
50
  * No need for the tenant filtering otherwise as each index is for single tenant.
79
51
  */
80
-
81
-
82
52
  const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === "true";
83
-
84
- if (sharedIndex) {
53
+ if (sharedIndex && where.tenant) {
85
54
  query.must.push({
86
55
  term: {
87
56
  "tenant.keyword": where.tenant
@@ -92,13 +61,10 @@ const createElasticsearchQuery = params => {
92
61
  * Remove tenant so it is not applied again later.
93
62
  * Possibly tenant is not defined, but just in case, remove it.
94
63
  */
95
-
96
-
97
64
  delete where.tenant;
98
65
  /**
99
66
  * Add the locale to filtering.
100
67
  */
101
-
102
68
  query.must.push({
103
69
  term: {
104
70
  "locale.keyword": where.locale
@@ -108,8 +74,7 @@ const createElasticsearchQuery = params => {
108
74
  /**
109
75
  * We apply other conditions as they are passed via the where value.
110
76
  */
111
-
112
- (0, _where.applyWhere)({
77
+ (0, _apiElasticsearch.applyWhere)({
113
78
  query,
114
79
  where,
115
80
  fields: fieldPlugins,
@@ -117,7 +82,6 @@ const createElasticsearchQuery = params => {
117
82
  });
118
83
  return query;
119
84
  };
120
-
121
85
  const createElasticsearchBody = params => {
122
86
  const {
123
87
  plugins,
@@ -130,58 +94,50 @@ const createElasticsearchBody = params => {
130
94
  acc[plugin.field] = plugin;
131
95
  return acc;
132
96
  }, {});
133
- const limit = (0, _limit.createLimit)(initialLimit, 100);
134
- const query = createElasticsearchQuery(_objectSpread(_objectSpread({}, params), {}, {
97
+ const limit = (0, _apiElasticsearch.createLimit)(initialLimit, 100);
98
+ const query = createElasticsearchQuery((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
135
99
  fieldPlugins
136
100
  }));
137
- const sort = (0, _sort.createSort)({
101
+ const sort = (0, _apiElasticsearch.createSort)({
138
102
  sort: initialSort,
139
103
  fieldPlugins
140
104
  });
141
105
  const queryModifiers = plugins.byType(_FormElasticsearchQueryModifierPlugin.FormElasticsearchQueryModifierPlugin.type);
142
-
143
106
  for (const plugin of queryModifiers) {
144
107
  plugin.modifyQuery({
145
108
  query,
146
109
  where
147
110
  });
148
111
  }
149
-
150
112
  const sortModifiers = plugins.byType(_FormElasticsearchSortModifierPlugin.FormElasticsearchSortModifierPlugin.type);
151
-
152
113
  for (const plugin of sortModifiers) {
153
114
  plugin.modifySort({
154
115
  sort
155
116
  });
156
117
  }
157
-
158
118
  const body = {
159
119
  query: {
160
120
  constant_score: {
161
121
  filter: {
162
- bool: _objectSpread({}, query)
122
+ bool: (0, _objectSpread2.default)({}, query)
163
123
  }
164
124
  }
165
125
  },
166
126
  size: limit + 1,
167
-
168
127
  /**
169
128
  * Casting as any is required due to search_after is accepting an array of values.
170
129
  * Which is correct in some cases. In our case, it is not.
171
130
  * https://www.elastic.co/guide/en/elasticsearch/reference/7.13/paginate-search-results.html
172
131
  */
173
- search_after: (0, _cursors.decodeCursor)(after),
132
+ search_after: (0, _apiElasticsearch.decodeCursor)(after),
174
133
  sort
175
134
  };
176
135
  const bodyModifiers = plugins.byType(_FormElasticsearchBodyModifierPlugin.FormElasticsearchBodyModifierPlugin.type);
177
-
178
136
  for (const plugin of bodyModifiers) {
179
137
  plugin.modifyBody({
180
138
  body
181
139
  });
182
140
  }
183
-
184
141
  return body;
185
142
  };
186
-
187
143
  exports.createElasticsearchBody = createElasticsearchBody;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createFormElasticType","createInitialQueryValue","must","term","must_not","should","filter","createElasticsearchQuery","params","plugins","where","initialWhere","fieldPlugins","query","operatorPlugins","getElasticsearchOperatorPluginsByLocale","locale","sharedIndex","process","env","ELASTICSEARCH_SHARED_INDEXES","tenant","push","applyWhere","fields","operators","createElasticsearchBody","limit","initialLimit","sort","initialSort","after","byType","FormElasticsearchFieldPlugin","type","reduce","acc","plugin","field","createLimit","createSort","queryModifiers","FormElasticsearchQueryModifierPlugin","modifyQuery","sortModifiers","FormElasticsearchSortModifierPlugin","modifySort","body","constant_score","bool","size","search_after","decodeCursor","bodyModifiers","FormElasticsearchBodyModifierPlugin","modifyBody"],"sources":["elasticsearchBody.ts"],"sourcesContent":["import { SearchBody as esSearchBody } from \"elastic-ts\";\nimport {\n decodeCursor,\n getElasticsearchOperatorPluginsByLocale,\n applyWhere,\n createLimit,\n createSort\n} from \"@webiny/api-elasticsearch\";\nimport { ElasticsearchBoolQueryConfig } from \"@webiny/api-elasticsearch/types\";\nimport { FormElasticsearchFieldPlugin } from \"~/plugins/FormElasticsearchFieldPlugin\";\nimport { FormElasticsearchSortModifierPlugin } from \"~/plugins/FormElasticsearchSortModifierPlugin\";\nimport { FormElasticsearchBodyModifierPlugin } from \"~/plugins/FormElasticsearchBodyModifierPlugin\";\nimport { FormBuilderStorageOperationsListFormsParams } from \"@webiny/api-form-builder/types\";\nimport { FormElasticsearchQueryModifierPlugin } from \"~/plugins/FormElasticsearchQueryModifierPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\nexport const createFormElasticType = (): string => {\n return \"fb.form\";\n};\n\nconst createInitialQueryValue = (): ElasticsearchBoolQueryConfig => {\n return {\n must: [\n /**\n * We add the __type filtering in the initial query because it must be applied.\n */\n {\n term: {\n \"__type.keyword\": createFormElasticType()\n }\n }\n ],\n must_not: [],\n should: [],\n filter: []\n };\n};\n\ninterface CreateElasticsearchQueryParams extends CreateElasticsearchBodyParams {\n fieldPlugins: Record<string, FormElasticsearchFieldPlugin>;\n}\n\nconst createElasticsearchQuery = (params: CreateElasticsearchQueryParams) => {\n const { plugins, where: initialWhere, fieldPlugins } = params;\n const query = createInitialQueryValue();\n /**\n * Be aware that, if having more registered operator plugins of same type, the last one will be used.\n */\n const operatorPlugins = getElasticsearchOperatorPluginsByLocale(plugins, initialWhere.locale);\n\n const where: Partial<FormBuilderStorageOperationsListFormsParams[\"where\"]> = {\n ...initialWhere\n };\n /**\n * !!! IMPORTANT !!! There are few specific cases where we hardcode the query conditions.\n *\n * When ES index is shared between tenants, we need to filter records by tenant ID.\n * No need for the tenant filtering otherwise as each index is for single tenant.\n */\n const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === \"true\";\n if (sharedIndex && where.tenant) {\n query.must.push({\n term: {\n \"tenant.keyword\": where.tenant\n }\n });\n }\n /**\n * Remove tenant so it is not applied again later.\n * Possibly tenant is not defined, but just in case, remove it.\n */\n delete where.tenant;\n /**\n * Add the locale to filtering.\n */\n query.must.push({\n term: {\n \"locale.keyword\": where.locale as string\n }\n });\n delete where.locale;\n /**\n * We apply other conditions as they are passed via the where value.\n */\n applyWhere({\n query,\n where,\n fields: fieldPlugins,\n operators: operatorPlugins\n });\n\n return query;\n};\n\ninterface CreateElasticsearchBodyParams {\n plugins: PluginsContainer;\n where: FormBuilderStorageOperationsListFormsParams[\"where\"];\n limit: number;\n after?: string;\n sort: string[];\n}\n\nexport const createElasticsearchBody = (params: CreateElasticsearchBodyParams): esSearchBody => {\n const { plugins, where, limit: initialLimit, sort: initialSort, after } = params;\n\n const fieldPlugins = plugins\n .byType<FormElasticsearchFieldPlugin>(FormElasticsearchFieldPlugin.type)\n .reduce((acc, plugin) => {\n acc[plugin.field] = plugin;\n return acc;\n }, {} as Record<string, FormElasticsearchFieldPlugin>);\n\n const limit = createLimit(initialLimit, 100);\n\n const query = createElasticsearchQuery({\n ...params,\n fieldPlugins\n });\n\n const sort = createSort({\n sort: initialSort,\n fieldPlugins\n });\n\n const queryModifiers = plugins.byType<FormElasticsearchQueryModifierPlugin>(\n FormElasticsearchQueryModifierPlugin.type\n );\n\n for (const plugin of queryModifiers) {\n plugin.modifyQuery({\n query,\n where\n });\n }\n\n const sortModifiers = plugins.byType<FormElasticsearchSortModifierPlugin>(\n FormElasticsearchSortModifierPlugin.type\n );\n\n for (const plugin of sortModifiers) {\n plugin.modifySort({\n sort\n });\n }\n\n const body = {\n query: {\n constant_score: {\n filter: {\n bool: {\n ...query\n }\n }\n }\n },\n size: limit + 1,\n /**\n * Casting as any is required due to search_after is accepting an array of values.\n * Which is correct in some cases. In our case, it is not.\n * https://www.elastic.co/guide/en/elasticsearch/reference/7.13/paginate-search-results.html\n */\n search_after: decodeCursor(after) as any,\n sort\n };\n\n const bodyModifiers = plugins.byType<FormElasticsearchBodyModifierPlugin>(\n FormElasticsearchBodyModifierPlugin.type\n );\n\n for (const plugin of bodyModifiers) {\n plugin.modifyBody({\n body\n });\n }\n\n return body;\n};\n"],"mappings":";;;;;;;;AACA;AAQA;AACA;AACA;AAEA;AAGO,MAAMA,qBAAqB,GAAG,MAAc;EAC/C,OAAO,SAAS;AACpB,CAAC;AAAC;AAEF,MAAMC,uBAAuB,GAAG,MAAoC;EAChE,OAAO;IACHC,IAAI,EAAE;IACF;AACZ;AACA;IACY;MACIC,IAAI,EAAE;QACF,gBAAgB,EAAEH,qBAAqB;MAC3C;IACJ,CAAC,CAC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C3C;EAED,KAAK,MAAMG,MAAM,IAAIgB,aAAa,EAAE;IAChChB,MAAM,CAACkB,UAAU,CAAC;MACdR;IACJ,CAAC,CAAC;EACN;EAEA,OAAOA,IAAI;AACf,CAAC;AAAC"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _FormElasticsearchFieldPlugin = require("../../plugins/FormElasticsearchFieldPlugin");
9
-
10
8
  var _default = () => [new _FormElasticsearchFieldPlugin.FormElasticsearchFieldPlugin({
11
9
  field: "createdOn",
12
10
  unmappedType: "date"
@@ -29,5 +27,4 @@ var _default = () => [new _FormElasticsearchFieldPlugin.FormElasticsearchFieldPl
29
27
  new _FormElasticsearchFieldPlugin.FormElasticsearchFieldPlugin({
30
28
  field: _FormElasticsearchFieldPlugin.FormElasticsearchFieldPlugin.ALL
31
29
  })];
32
-
33
30
  exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FormElasticsearchFieldPlugin","field","unmappedType","path","ALL"],"sources":["elasticsearchFields.ts"],"sourcesContent":["import { FormElasticsearchFieldPlugin } from \"~/plugins/FormElasticsearchFieldPlugin\";\n\nexport default () => [\n new FormElasticsearchFieldPlugin({\n field: \"createdOn\",\n unmappedType: \"date\"\n }),\n new FormElasticsearchFieldPlugin({\n field: \"savedOn\",\n unmappedType: \"date\"\n }),\n new FormElasticsearchFieldPlugin({\n field: \"publishedOn\",\n unmappedType: \"date\"\n }),\n new FormElasticsearchFieldPlugin({\n field: \"ownedBy\",\n path: \"ownedBy.id\"\n }),\n new FormElasticsearchFieldPlugin({\n field: \"createdBy\",\n path: \"createdBy.id\"\n }),\n /**\n * Always add the ALL fields plugin because of the keyword/path build.\n */\n new FormElasticsearchFieldPlugin({\n field: FormElasticsearchFieldPlugin.ALL\n })\n];\n"],"mappings":";;;;;;AAAA;AAAsF,eAEvE,MAAM,CACjB,IAAIA,0DAA4B,CAAC;EAC7BC,KAAK,EAAE,WAAW;EAClBC,YAAY,EAAE;AAClB,CAAC,CAAC,EACF,IAAIF,0DAA4B,CAAC;EAC7BC,KAAK,EAAE,SAAS;EAChBC,YAAY,EAAE;AAClB,CAAC,CAAC,EACF,IAAIF,0DAA4B,CAAC;EAC7BC,KAAK,EAAE,aAAa;EACpBC,YAAY,EAAE;AAClB,CAAC,CAAC,EACF,IAAIF,0DAA4B,CAAC;EAC7BC,KAAK,EAAE,SAAS;EAChBE,IAAI,EAAE;AACV,CAAC,CAAC,EACF,IAAIH,0DAA4B,CAAC;EAC7BC,KAAK,EAAE,WAAW;EAClBE,IAAI,EAAE;AACV,CAAC,CAAC;AACF;AACJ;AACA;AACI,IAAIH,0DAA4B,CAAC;EAC7BC,KAAK,EAAED,0DAA4B,CAACI;AACxC,CAAC,CAAC,CACL;AAAA"}
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _FormDynamoDbFieldPlugin = require("../../plugins/FormDynamoDbFieldPlugin");
9
-
10
8
  var _default = () => [new _FormDynamoDbFieldPlugin.FormDynamoDbFieldPlugin({
11
9
  field: "publishedOn",
12
10
  type: "date"
13
11
  })];
14
-
15
12
  exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FormDynamoDbFieldPlugin","field","type"],"sources":["fields.ts"],"sourcesContent":["import { FormDynamoDbFieldPlugin } from \"~/plugins/FormDynamoDbFieldPlugin\";\n\nexport default () => [\n new FormDynamoDbFieldPlugin({\n field: \"publishedOn\",\n type: \"date\"\n })\n];\n"],"mappings":";;;;;;AAAA;AAA4E,eAE7D,MAAM,CACjB,IAAIA,gDAAuB,CAAC;EACxBC,KAAK,EAAE,aAAa;EACpBC,IAAI,EAAE;AACV,CAAC,CAAC,CACL;AAAA"}
@@ -7,11 +7,11 @@ export declare type DbRecord<T = any> = T & {
7
7
  SK: string;
8
8
  TYPE: string;
9
9
  };
10
- export interface Params {
10
+ export interface CreateFormStorageOperationsParams {
11
11
  entity: Entity<any>;
12
12
  esEntity: Entity<any>;
13
13
  table: Table;
14
14
  elasticsearch: Client;
15
15
  plugins: PluginsContainer;
16
16
  }
17
- export declare const createFormStorageOperations: (params: Params) => FormBuilderFormStorageOperations;
17
+ export declare const createFormStorageOperations: (params: CreateFormStorageOperationsParams) => FormBuilderFormStorageOperations;