@webiny/api-form-builder-so-ddb-es 0.0.0-mt-3 → 0.0.0-unstable.2af142b57e
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/configurations.d.ts +7 -5
- package/configurations.js +23 -12
- package/configurations.js.map +1 -0
- package/definitions/elasticsearch.d.ts +2 -1
- package/definitions/elasticsearch.js +3 -12
- package/definitions/elasticsearch.js.map +1 -0
- package/definitions/form.d.ts +2 -1
- package/definitions/form.js +3 -12
- package/definitions/form.js.map +1 -0
- package/definitions/settings.d.ts +2 -1
- package/definitions/settings.js +3 -12
- package/definitions/settings.js.map +1 -0
- package/definitions/submission.d.ts +2 -1
- package/definitions/submission.js +3 -12
- package/definitions/submission.js.map +1 -0
- package/definitions/system.d.ts +2 -1
- package/definitions/system.js +3 -12
- package/definitions/system.js.map +1 -0
- package/definitions/table.d.ts +3 -2
- package/definitions/table.js +0 -3
- package/definitions/table.js.map +1 -0
- package/definitions/tableElasticsearch.d.ts +2 -1
- package/definitions/tableElasticsearch.js +0 -3
- package/definitions/tableElasticsearch.js.map +1 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +10 -0
- package/elasticsearch/createElasticsearchIndex.js +52 -0
- package/elasticsearch/createElasticsearchIndex.js.map +1 -0
- package/elasticsearch/indices/base.d.ts +2 -0
- package/elasticsearch/indices/base.js +12 -0
- package/elasticsearch/indices/base.js.map +1 -0
- package/elasticsearch/indices/index.d.ts +1 -0
- package/elasticsearch/indices/index.js +12 -0
- package/elasticsearch/indices/index.js.map +1 -0
- package/elasticsearch/indices/japanese.d.ts +2 -0
- package/elasticsearch/indices/japanese.js +13 -0
- package/elasticsearch/indices/japanese.js.map +1 -0
- package/index.js +33 -60
- package/index.js.map +1 -0
- package/operations/form/elasticsearchBody.js +12 -56
- package/operations/form/elasticsearchBody.js.map +1 -0
- package/operations/form/elasticsearchFields.js +0 -3
- package/operations/form/elasticsearchFields.js.map +1 -0
- package/operations/form/fields.js +0 -3
- package/operations/form/fields.js.map +1 -0
- package/operations/form/index.d.ts +2 -2
- package/operations/form/index.js +53 -153
- package/operations/form/index.js.map +1 -0
- package/operations/settings/index.d.ts +2 -2
- package/operations/settings/index.js +4 -28
- package/operations/settings/index.js.map +1 -0
- package/operations/submission/elasticsearchBody.js +15 -54
- package/operations/submission/elasticsearchBody.js.map +1 -0
- package/operations/submission/elasticsearchFields.js +0 -3
- package/operations/submission/elasticsearchFields.js.map +1 -0
- package/operations/submission/index.d.ts +2 -2
- package/operations/submission/index.js +23 -76
- package/operations/submission/index.js.map +1 -0
- package/operations/system/index.d.ts +2 -2
- package/operations/system/index.js +4 -26
- package/operations/system/index.js.map +1 -0
- package/package.json +23 -27
- package/plugins/FormDynamoDbFieldPlugin.js +1 -6
- package/plugins/FormDynamoDbFieldPlugin.js.map +1 -0
- package/plugins/FormElasticsearchBodyModifierPlugin.d.ts +1 -1
- package/plugins/FormElasticsearchBodyModifierPlugin.js +3 -8
- package/plugins/FormElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/FormElasticsearchFieldPlugin.d.ts +1 -1
- package/plugins/FormElasticsearchFieldPlugin.js +3 -8
- package/plugins/FormElasticsearchFieldPlugin.js.map +1 -0
- package/plugins/FormElasticsearchIndexPlugin.d.ts +4 -0
- package/plugins/FormElasticsearchIndexPlugin.js +12 -0
- package/plugins/FormElasticsearchIndexPlugin.js.map +1 -0
- package/plugins/FormElasticsearchQueryModifierPlugin.d.ts +1 -1
- package/plugins/FormElasticsearchQueryModifierPlugin.js +3 -8
- package/plugins/FormElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/FormElasticsearchSortModifierPlugin.d.ts +1 -1
- package/plugins/FormElasticsearchSortModifierPlugin.js +3 -8
- package/plugins/FormElasticsearchSortModifierPlugin.js.map +1 -0
- package/plugins/SubmissionElasticsearchBodyModifierPlugin.d.ts +1 -1
- package/plugins/SubmissionElasticsearchBodyModifierPlugin.js +3 -8
- package/plugins/SubmissionElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/SubmissionElasticsearchFieldPlugin.d.ts +1 -1
- package/plugins/SubmissionElasticsearchFieldPlugin.js +3 -8
- package/plugins/SubmissionElasticsearchFieldPlugin.js.map +1 -0
- package/plugins/SubmissionElasticsearchQueryModifierPlugin.d.ts +1 -1
- package/plugins/SubmissionElasticsearchQueryModifierPlugin.js +3 -8
- package/plugins/SubmissionElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/SubmissionElasticsearchSortModifierPlugin.d.ts +1 -1
- package/plugins/SubmissionElasticsearchSortModifierPlugin.js +3 -8
- package/plugins/SubmissionElasticsearchSortModifierPlugin.js.map +1 -0
- package/types.d.ts +2 -2
- package/types.js +0 -1
- package/types.js.map +1 -0
- package/operations/system/createElasticsearchIndex.d.ts +0 -6
- package/operations/system/createElasticsearchIndex.js +0 -70
- package/upgrades/5.16.0/index.d.ts +0 -8
- package/upgrades/5.16.0/index.js +0 -141
package/index.js
CHANGED
|
@@ -1,99 +1,67 @@
|
|
|
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.createFormBuilderStorageOperations = void 0;
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _filters = _interopRequireDefault(require("@webiny/db-dynamodb/plugins/filters"));
|
|
10
|
+
var _elasticsearchFields = _interopRequireDefault(require("./operations/form/elasticsearchFields"));
|
|
11
|
+
var _elasticsearchFields2 = _interopRequireDefault(require("./operations/submission/elasticsearchFields"));
|
|
14
12
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
15
|
-
|
|
13
|
+
var _types = require("./types");
|
|
16
14
|
var _table = require("./definitions/table");
|
|
17
|
-
|
|
18
15
|
var _form = require("./definitions/form");
|
|
19
|
-
|
|
20
16
|
var _submission = require("./definitions/submission");
|
|
21
|
-
|
|
22
17
|
var _system = require("./definitions/system");
|
|
23
|
-
|
|
24
18
|
var _settings = require("./definitions/settings");
|
|
25
|
-
|
|
26
19
|
var _system2 = require("./operations/system");
|
|
27
|
-
|
|
28
20
|
var _submission2 = require("./operations/submission");
|
|
29
|
-
|
|
30
21
|
var _settings2 = require("./operations/settings");
|
|
31
|
-
|
|
32
22
|
var _form2 = require("./operations/form");
|
|
33
|
-
|
|
34
|
-
var _createElasticsearchIndex = require("./operations/system/createElasticsearchIndex");
|
|
35
|
-
|
|
36
23
|
var _tableElasticsearch = require("./definitions/tableElasticsearch");
|
|
37
|
-
|
|
38
24
|
var _plugins = require("@webiny/plugins");
|
|
39
|
-
|
|
40
25
|
var _elasticsearch = require("./definitions/elasticsearch");
|
|
41
|
-
|
|
42
|
-
var
|
|
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
|
-
|
|
26
|
+
var _apiElasticsearch = require("@webiny/api-elasticsearch");
|
|
27
|
+
var _indices = require("./elasticsearch/indices");
|
|
28
|
+
var _createElasticsearchIndex = require("./elasticsearch/createElasticsearchIndex");
|
|
56
29
|
const reservedFields = ["PK", "SK", "index", "data", "TYPE", "__type", "GSI1_PK", "GSI1_SK"];
|
|
57
|
-
|
|
58
30
|
const isReserved = name => {
|
|
59
31
|
if (reservedFields.includes(name) === false) {
|
|
60
32
|
return;
|
|
61
33
|
}
|
|
62
|
-
|
|
63
34
|
throw new _error.default(`Attribute name "${name}" is not allowed.`, "ATTRIBUTE_NOT_ALLOWED", {
|
|
64
35
|
name
|
|
65
36
|
});
|
|
66
37
|
};
|
|
67
|
-
|
|
68
38
|
const createFormBuilderStorageOperations = params => {
|
|
69
39
|
const {
|
|
70
|
-
attributes
|
|
40
|
+
attributes,
|
|
71
41
|
table: tableName,
|
|
72
42
|
esTable: esTableName,
|
|
73
43
|
documentClient,
|
|
74
44
|
elasticsearch,
|
|
75
|
-
plugins:
|
|
45
|
+
plugins: userPlugins
|
|
76
46
|
} = params;
|
|
77
|
-
|
|
78
47
|
if (attributes) {
|
|
79
48
|
Object.values(attributes).forEach(attrs => {
|
|
80
49
|
Object.keys(attrs).forEach(isReserved);
|
|
81
50
|
});
|
|
82
51
|
}
|
|
83
|
-
|
|
84
52
|
const plugins = new _plugins.PluginsContainer([
|
|
85
53
|
/**
|
|
86
54
|
* User defined plugins.
|
|
87
55
|
*/
|
|
88
|
-
|
|
56
|
+
userPlugins || [],
|
|
89
57
|
/**
|
|
90
58
|
* Elasticsearch field definitions for the submission record.
|
|
91
59
|
*/
|
|
92
|
-
(0,
|
|
60
|
+
(0, _elasticsearchFields2.default)(),
|
|
93
61
|
/**
|
|
94
62
|
* Elasticsearch field definitions for the form record.
|
|
95
63
|
*/
|
|
96
|
-
(0,
|
|
64
|
+
(0, _elasticsearchFields.default)(),
|
|
97
65
|
/**
|
|
98
66
|
* DynamoDB filter plugins for the where conditions.
|
|
99
67
|
*/
|
|
@@ -101,7 +69,11 @@ const createFormBuilderStorageOperations = params => {
|
|
|
101
69
|
/**
|
|
102
70
|
* Elasticsearch operators.
|
|
103
71
|
*/
|
|
104
|
-
(0,
|
|
72
|
+
(0, _apiElasticsearch.getElasticsearchOperators)(),
|
|
73
|
+
/**
|
|
74
|
+
* Built-in Elasticsearch index plugins
|
|
75
|
+
*/
|
|
76
|
+
(0, _indices.elasticsearchIndexPlugins)()]);
|
|
105
77
|
const table = (0, _table.createTable)({
|
|
106
78
|
tableName,
|
|
107
79
|
documentClient
|
|
@@ -117,50 +89,52 @@ const createFormBuilderStorageOperations = params => {
|
|
|
117
89
|
form: (0, _form.createFormEntity)({
|
|
118
90
|
entityName: _types.ENTITIES.FORM,
|
|
119
91
|
table,
|
|
120
|
-
attributes: attributes[_types.ENTITIES.FORM]
|
|
92
|
+
attributes: attributes ? attributes[_types.ENTITIES.FORM] : {}
|
|
121
93
|
}),
|
|
122
94
|
submission: (0, _submission.createSubmissionEntity)({
|
|
123
95
|
entityName: _types.ENTITIES.SUBMISSION,
|
|
124
96
|
table,
|
|
125
|
-
attributes: attributes[_types.ENTITIES.SUBMISSION]
|
|
97
|
+
attributes: attributes ? attributes[_types.ENTITIES.SUBMISSION] : {}
|
|
126
98
|
}),
|
|
127
99
|
system: (0, _system.createSystemEntity)({
|
|
128
100
|
entityName: _types.ENTITIES.SYSTEM,
|
|
129
101
|
table,
|
|
130
|
-
attributes: attributes[_types.ENTITIES.SYSTEM]
|
|
102
|
+
attributes: attributes ? attributes[_types.ENTITIES.SYSTEM] : {}
|
|
131
103
|
}),
|
|
132
104
|
settings: (0, _settings.createSettingsEntity)({
|
|
133
105
|
entityName: _types.ENTITIES.SETTINGS,
|
|
134
106
|
table,
|
|
135
|
-
attributes: attributes[_types.ENTITIES.SETTINGS]
|
|
107
|
+
attributes: attributes ? attributes[_types.ENTITIES.SETTINGS] : {}
|
|
136
108
|
}),
|
|
137
|
-
|
|
138
109
|
/**
|
|
139
110
|
* Elasticsearch entities.
|
|
140
111
|
*/
|
|
141
112
|
esForm: (0, _elasticsearch.createElasticsearchEntity)({
|
|
142
113
|
entityName: _types.ENTITIES.ES_FORM,
|
|
143
114
|
table: esTable,
|
|
144
|
-
attributes: attributes[_types.ENTITIES.ES_FORM]
|
|
115
|
+
attributes: attributes ? attributes[_types.ENTITIES.ES_FORM] : {}
|
|
145
116
|
}),
|
|
146
117
|
esSubmission: (0, _elasticsearch.createElasticsearchEntity)({
|
|
147
118
|
entityName: _types.ENTITIES.ES_SUBMISSION,
|
|
148
119
|
table: esTable,
|
|
149
|
-
attributes: attributes[_types.ENTITIES.ES_SUBMISSION]
|
|
120
|
+
attributes: attributes ? attributes[_types.ENTITIES.ES_SUBMISSION] : {}
|
|
150
121
|
})
|
|
151
122
|
};
|
|
152
|
-
return
|
|
153
|
-
init: async
|
|
154
|
-
|
|
123
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
124
|
+
init: async context => {
|
|
125
|
+
context.i18n.locales.onLocaleBeforeCreate.subscribe(async ({
|
|
126
|
+
locale,
|
|
155
127
|
tenant
|
|
156
128
|
}) => {
|
|
157
129
|
await (0, _createElasticsearchIndex.createElasticsearchIndex)({
|
|
158
130
|
elasticsearch,
|
|
159
|
-
|
|
131
|
+
plugins,
|
|
132
|
+
tenant,
|
|
133
|
+
locale: locale.code
|
|
160
134
|
});
|
|
161
135
|
});
|
|
162
136
|
},
|
|
163
|
-
upgrade:
|
|
137
|
+
upgrade: null,
|
|
164
138
|
getTable: () => table,
|
|
165
139
|
getEsTable: () => esTable,
|
|
166
140
|
getEntities: () => entities
|
|
@@ -184,5 +158,4 @@ const createFormBuilderStorageOperations = params => {
|
|
|
184
158
|
plugins
|
|
185
159
|
}));
|
|
186
160
|
};
|
|
187
|
-
|
|
188
161
|
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","getElasticsearchOperators","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","init","context","i18n","locales","onLocaleBeforeCreate","subscribe","locale","tenant","createElasticsearchIndex","code","upgrade","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 { getElasticsearchOperators } from \"@webiny/api-elasticsearch\";\nimport { elasticsearchIndexPlugins } from \"~/elasticsearch/indices\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\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 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 * Elasticsearch operators.\n */\n getElasticsearchOperators(),\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 init: async context => {\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 upgrade: null,\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;AACA;AACA;AAEA,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;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C,kDAAwB,EAAC;UAC3B5C,aAAa;UACbC,OAAO;UACP0C,MAAM;UACND,MAAM,EAAEA,MAAM,CAACG;QACnB,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC;IACDC,OAAO,EAAE,IAAI;IACbC,QAAQ,EAAE,MAAMpD,KAAK;IACrBqD,UAAU,EAAE,MAAMnD,OAAO;IACzBoD,WAAW,EAAE,MAAMjC;EAAQ,GACxB,IAAAkC,sCAA6B,EAAC;IAC7BvD,KAAK;IACLwD,MAAM,EAAEnC,QAAQ,CAACS;EACrB,CAAC,CAAC,GACC,IAAA2B,0CAA+B,EAAC;IAC/BzD,KAAK;IACLwD,MAAM,EAAEnC,QAAQ,CAACY;EACrB,CAAC,CAAC,GACC,IAAAyB,kCAA2B,EAAC;IAC3BrD,aAAa;IACbL,KAAK;IACLwD,MAAM,EAAEnC,QAAQ,CAACC,IAAI;IACrBqC,QAAQ,EAAEtC,QAAQ,CAACe,MAAM;IACzB9B;EACJ,CAAC,CAAC,GACC,IAAAsD,8CAAiC,EAAC;IACjCvD,aAAa;IACbL,KAAK;IACLwD,MAAM,EAAEnC,QAAQ,CAACM,UAAU;IAC3BgC,QAAQ,EAAEtC,QAAQ,CAACkB,YAAY;IAC/BjC;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
|
|
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
|
|
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,
|
|
134
|
-
const query = createElasticsearchQuery(
|
|
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,
|
|
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:
|
|
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,
|
|
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,CACJ;IACDI,QAAQ,EAAE,EAAE;IACZC,MAAM,EAAE,EAAE;IACVC,MAAM,EAAE;EACZ,CAAC;AACL,CAAC;AAMD,MAAMC,wBAAwB,GAAIC,MAAsC,IAAK;EACzE,MAAM;IAAEC,OAAO;IAAEC,KAAK,EAAEC,YAAY;IAAEC;EAAa,CAAC,GAAGJ,MAAM;EAC7D,MAAMK,KAAK,GAAGZ,uBAAuB,EAAE;EACvC;AACJ;AACA;EACI,MAAMa,eAAe,GAAG,IAAAC,yDAAuC,EAACN,OAAO,EAAEE,YAAY,CAACK,MAAM,CAAC;EAE7F,MAAMN,KAAoE,mCACnEC,YAAY,CAClB;EACD;AACJ;AACA;AACA;AACA;AACA;EACI,MAAMM,WAAW,GAAGC,OAAO,CAACC,GAAG,CAACC,4BAA4B,KAAK,MAAM;EACvE,IAAIH,WAAW,IAAIP,KAAK,CAACW,MAAM,EAAE;IAC7BR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CAC5C;EAED,KAAK,MAAMG,MAAM,IAAII,cAAc,EAAE;IACjCJ,MAAM,CAACM,WAAW,CAAC;MACf9B,KAAK;MACLH;IACJ,CAAC,CAAC;EACN;EAEA,MAAMkC,aAAa,GAAGnC,OAAO,CAACuB,MAAM,CAChCa,wEAAmC,CAACX,IAAI,CAC3C;EAED,KAAK,MAAMG,MAAM,IAAIO,aAAa,EAAE;IAChCP,MAAM,CAACS,UAAU,CAAC;MACdjB;IACJ,CAAC,CAAC;EACN;EAEA,MAAMkB,IAAI,GAAG;IACTlC,KAAK,EAAE;MACHmC,cAAc,EAAE;QACZ1C,MAAM,EAAE;UACJ2C,IAAI,kCACGpC,KAAK;QAEhB;MACJ;IACJ,CAAC;IACDqC,IAAI,EAAEvB,KAAK,GAAG,CAAC;IACf;AACR;AACA;AACA;AACA;IACQwB,YAAY,EAAE,IAAAC,8BAAY,EAACrB,KAAK,CAAQ;IACxCF;EACJ,CAAC;EAED,MAAMwB,aAAa,GAAG5C,OAAO,CAACuB,MAAM,CAChCsB,wEAAmC,CAACpB,IAAI,CAC3C;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
|
|
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:
|
|
17
|
+
export declare const createFormStorageOperations: (params: CreateFormStorageOperationsParams) => FormBuilderFormStorageOperations;
|