@webiny/api-headless-cms-ddb-es 5.34.5 → 5.34.6-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/dynamoDb/storage/richText.js +12 -8
- package/dynamoDb/storage/richText.js.map +1 -1
- package/elasticsearch/indexing/defaultFieldIndexing.js +12 -1
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -1
- package/index.js +9 -26
- package/index.js.map +1 -1
- package/package.json +14 -14
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +1 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +8 -2
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -1
|
@@ -59,7 +59,7 @@ const createRichTextStorageTransformPlugin = () => {
|
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
if (storageValue
|
|
62
|
+
if (!storageValue["compression"]) {
|
|
63
63
|
return storageValue;
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -68,17 +68,19 @@ const createRichTextStorageTransformPlugin = () => {
|
|
|
68
68
|
value
|
|
69
69
|
} = storageValue;
|
|
70
70
|
|
|
71
|
-
if (!compression) {
|
|
72
|
-
throw new _error.default(`Missing compression in "fromStorage" function in field "${field.storageId}": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
|
|
73
|
-
value: storageValue
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
71
|
if (compression !== "jsonpack") {
|
|
78
72
|
throw new _error.default(`This plugin cannot transform something not packed with "jsonpack".`, "WRONG_COMPRESSION", {
|
|
79
73
|
compression
|
|
80
74
|
});
|
|
81
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* No point in going further if no value.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if (!value) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
82
84
|
|
|
83
85
|
try {
|
|
84
86
|
return _jsonpack.default.unpack(value);
|
|
@@ -95,11 +97,13 @@ const createRichTextStorageTransformPlugin = () => {
|
|
|
95
97
|
toStorage: async ({
|
|
96
98
|
value
|
|
97
99
|
}) => {
|
|
100
|
+
var _value;
|
|
101
|
+
|
|
98
102
|
/**
|
|
99
103
|
* There is a possibility that we are trying to compress already compressed value.
|
|
100
104
|
* Introduced a bug with 5.8.0 storage operations, so just return the value to correct it.
|
|
101
105
|
*/
|
|
102
|
-
if (value &&
|
|
106
|
+
if (!!((_value = value) !== null && _value !== void 0 && _value.compression)) {
|
|
103
107
|
return value;
|
|
104
108
|
}
|
|
105
109
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["transformArray","value","isArray","Array","shouldBeArray","from","k","createRichTextStorageTransformPlugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","WebinyError","storageId","
|
|
1
|
+
{"version":3,"names":["transformArray","value","isArray","Array","shouldBeArray","from","k","createRichTextStorageTransformPlugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","WebinyError","storageId","compression","jsonpack","unpack","ex","process","env","DEBUG","console","log","message","toStorage","jsonValue","pack"],"sources":["richText.ts"],"sourcesContent":["import jsonpack from \"jsonpack\";\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nexport type OriginalValue = Record<string, any> | any[];\n\nexport interface StorageValue {\n compression: string;\n value: any;\n}\n\n/**\n * Remove when jsonpack gets PR with a fix merged\n * https://github.com/rgcl/jsonpack/pull/25/files\n * NOTE 2021-07-28: it seems PR is not going to be merged so keep this.\n */\n// TODO @ts-refactor figure better type\nconst transformArray = (value: any) => {\n if (!value) {\n return value;\n }\n let isArray = Array.isArray(value);\n const shouldBeArray = value instanceof Array === false && isArray;\n if (shouldBeArray) {\n value = Array.from(value as any);\n isArray = true;\n }\n if (typeof value === \"object\" || isArray) {\n for (const k in value) {\n value[k] = transformArray(value[k]);\n }\n }\n return value;\n};\n\nexport const createRichTextStorageTransformPlugin = () => {\n return new StorageTransformPlugin({\n fieldType: \"rich-text\",\n fromStorage: async ({ field, value: storageValue }) => {\n if (!storageValue) {\n return storageValue;\n } else if (typeof storageValue !== \"object\") {\n throw new WebinyError(\n `RichText value received in \"fromStorage\" function is not an object in field \"${field.storageId}\".`\n );\n }\n /**\n * This is to circumvent a bug introduced with 5.8.0 storage operations.\n * Do not remove.\n */\n if (!storageValue[\"compression\"]) {\n return storageValue;\n }\n const { compression, value } = storageValue;\n if (compression !== \"jsonpack\") {\n throw new WebinyError(\n `This plugin cannot transform something not packed with \"jsonpack\".`,\n \"WRONG_COMPRESSION\",\n {\n compression\n }\n );\n }\n /**\n * No point in going further if no value.\n */\n if (!value) {\n return null;\n }\n try {\n return jsonpack.unpack(value);\n } catch (ex) {\n if (process.env.DEBUG !== \"true\") {\n return null;\n }\n console.log(\"Error while decompressing rich-text.\");\n console.log(ex.message);\n return null;\n }\n },\n toStorage: async ({ value }) => {\n /**\n * There is a possibility that we are trying to compress already compressed value.\n * Introduced a bug with 5.8.0 storage operations, so just return the value to correct it.\n */\n if (!!value?.compression) {\n return value as any;\n }\n value = transformArray(value);\n\n let jsonValue: string | null = null;\n try {\n jsonValue = jsonpack.pack(value);\n } catch (ex) {\n if (process.env.DEBUG !== \"true\") {\n return null;\n }\n console.log(\"Error while compressing rich-text.\");\n console.log(ex.message);\n }\n return {\n compression: \"jsonpack\",\n value: jsonValue\n };\n }\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,KAAD,IAAgB;EACnC,IAAI,CAACA,KAAL,EAAY;IACR,OAAOA,KAAP;EACH;;EACD,IAAIC,OAAO,GAAGC,KAAK,CAACD,OAAN,CAAcD,KAAd,CAAd;EACA,MAAMG,aAAa,GAAGH,KAAK,YAAYE,KAAjB,KAA2B,KAA3B,IAAoCD,OAA1D;;EACA,IA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AAP;QACH;;QACDC,OAAO,CAACC,GAAR,CAAY,sCAAZ;QACAD,OAAO,CAACC,GAAR,CAAYL,EAAE,CAACM,OAAf;QACA,OAAO,IAAP;MACH;IACJ,CA3C6B;IA4C9BC,SAAS,EAAE,OAAO;MAAExB;IAAF,CAAP,KAAqB;MAAA;;MAC5B;AACZ;AACA;AACA;MACY,IAAI,CAAC,YAACA,KAAD,mCAAC,OAAOc,WAAR,CAAL,EAA0B;QACtB,OAAOd,KAAP;MACH;;MACDA,KAAK,GAAGD,cAAc,CAACC,KAAD,CAAtB;MAEA,IAAIyB,SAAwB,GAAG,IAA/B;;MACA,IAAI;QACAA,SAAS,GAAGV,iBAAA,CAASW,IAAT,CAAc1B,KAAd,CAAZ;MACH,CAFD,CAEE,OAAOiB,EAAP,EAAW;QACT,IAAIC,OAAO,CAACC,GAAR,CAAYC,KAAZ,KAAsB,MAA1B,EAAkC;UAC9B,OAAO,IAAP;QACH;;QACDC,OAAO,CAACC,GAAR,CAAY,oCAAZ;QACAD,OAAO,CAACC,GAAR,CAAYL,EAAE,CAACM,OAAf;MACH;;MACD,OAAO;QACHT,WAAW,EAAE,UADV;QAEHd,KAAK,EAAEyB;MAFJ,CAAP;IAIH;EApE6B,CAA3B,CAAP;AAsEH,CAvEM"}
|
|
@@ -39,7 +39,18 @@ var _default = () => ({
|
|
|
39
39
|
const {
|
|
40
40
|
isSearchable
|
|
41
41
|
} = getFieldTypePlugin(field.type);
|
|
42
|
-
|
|
42
|
+
/**
|
|
43
|
+
* We will return the rawValue in case if not searchable and value in case of not searchable field.
|
|
44
|
+
* This is to make sure that changed isSearchable parameter does not make the data to be null / undefined.
|
|
45
|
+
*
|
|
46
|
+
* Users can change isSearchable parameter at any time on the GraphQL field - and that could create a problem for them.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
if (isSearchable) {
|
|
50
|
+
return value === undefined ? rawValue : value;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return rawValue === undefined ? value : rawValue;
|
|
43
54
|
}
|
|
44
55
|
|
|
45
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["type","name","fieldType","toIndex","field","getFieldTypePlugin","value","fieldTypePlugin","isSearchable","rawValue","fromIndex"],"sources":["defaultFieldIndexing.ts"],"sourcesContent":["import { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-default\",\n fieldType: \"*\",\n toIndex({ field, getFieldTypePlugin, value }) {\n const fieldTypePlugin = getFieldTypePlugin(field.type);\n\n // when field is searchable, assign it to `values`\n if (fieldTypePlugin.isSearchable === true) {\n return { value };\n }\n\n // when field is not searchable, move its value to `rawValues`.\n // `rawValues` is a field in ES index that's not being indexed.\n return { rawValue: value };\n },\n fromIndex({ field, getFieldTypePlugin, value, rawValue }) {\n const { isSearchable } = getFieldTypePlugin(field.type);\n\n return
|
|
1
|
+
{"version":3,"names":["type","name","fieldType","toIndex","field","getFieldTypePlugin","value","fieldTypePlugin","isSearchable","rawValue","fromIndex","undefined"],"sources":["defaultFieldIndexing.ts"],"sourcesContent":["import { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-default\",\n fieldType: \"*\",\n toIndex({ field, getFieldTypePlugin, value }) {\n const fieldTypePlugin = getFieldTypePlugin(field.type);\n\n // when field is searchable, assign it to `values`\n if (fieldTypePlugin.isSearchable === true) {\n return { value };\n }\n\n // when field is not searchable, move its value to `rawValues`.\n // `rawValues` is a field in ES index that's not being indexed.\n return { rawValue: value };\n },\n fromIndex({ field, getFieldTypePlugin, value, rawValue }) {\n const { isSearchable } = getFieldTypePlugin(field.type);\n /**\n * We will return the rawValue in case if not searchable and value in case of not searchable field.\n * This is to make sure that changed isSearchable parameter does not make the data to be null / undefined.\n *\n * Users can change isSearchable parameter at any time on the GraphQL field - and that could create a problem for them.\n */\n if (isSearchable) {\n return value === undefined ? rawValue : value;\n }\n return rawValue === undefined ? value : rawValue;\n }\n});\n"],"mappings":";;;;;;;eAEe,OAA2C;EACtDA,IAAI,EAAE,mCADgD;EAEtDC,IAAI,EAAE,2CAFgD;EAGtDC,SAAS,EAAE,GAH2C;;EAItDC,OAAO,CAAC;IAAEC,KAAF;IAASC,kBAAT;IAA6BC;EAA7B,CAAD,EAAuC;IAC1C,MAAMC,eAAe,GAAGF,kBAAkB,CAACD,KAAK,CAACJ,IAAP,CAA1C,CAD0C,CAG1C;;IACA,IAAIO,eAAe,CAACC,YAAhB,KAAiC,IAArC,EAA2C;MACvC,OAAO;QAAEF;MAAF,CAAP;IACH,CANyC,CAQ1C;IACA;;;IACA,OAAO;MAAEG,QAAQ,EAAEH;IAAZ,CAAP;EACH,CAfqD;;EAgBtDI,SAAS,CAAC;IAAEN,KAAF;IAASC,kBAAT;IAA6BC,KAA7B;IAAoCG;EAApC,CAAD,EAAiD;IACtD,MAAM;MAAED;IAAF,IAAmBH,kBAAkB,CAACD,KAAK,CAACJ,IAAP,CAA3C;IACA;AACR;AACA;AACA;AACA;AACA;;IACQ,IAAIQ,YAAJ,EAAkB;MACd,OAAOF,KAAK,KAAKK,SAAV,GAAsBF,QAAtB,GAAiCH,KAAxC;IACH;;IACD,OAAOG,QAAQ,KAAKE,SAAb,GAAyBL,KAAzB,GAAiCG,QAAxC;EACH;;AA5BqD,CAA3C,C"}
|
package/index.js
CHANGED
|
@@ -70,6 +70,8 @@ Object.keys(_plugins2).forEach(function (key) {
|
|
|
70
70
|
|
|
71
71
|
var _plugins3 = require("./operations/entry/elasticsearch/filtering/plugins");
|
|
72
72
|
|
|
73
|
+
var _CmsEntryFilterPlugin = require("./plugins/CmsEntryFilterPlugin");
|
|
74
|
+
|
|
73
75
|
const createStorageOperations = params => {
|
|
74
76
|
const {
|
|
75
77
|
attributes,
|
|
@@ -169,35 +171,16 @@ const createStorageOperations = params => {
|
|
|
169
171
|
|
|
170
172
|
context.plugins.register([(0, _dynamoDb.default)()]);
|
|
171
173
|
/**
|
|
172
|
-
*
|
|
174
|
+
* We need to fetch all the plugin types in the list from the main container.
|
|
175
|
+
* This way we do not need to register plugins in the storage plugins contains.
|
|
173
176
|
*/
|
|
174
177
|
|
|
175
|
-
const
|
|
176
|
-
plugins.register(fieldPlugins);
|
|
177
|
-
/**
|
|
178
|
-
* We need to get all the operator plugins from the main plugin container.
|
|
179
|
-
*/
|
|
178
|
+
const types = ["cms-model-field-to-graphql", _CmsEntryFilterPlugin.CmsEntryFilterPlugin.type, _apiElasticsearch.ElasticsearchQueryBuilderOperatorPlugin.type, _plugins2.CmsEntryElasticsearchBodyModifierPlugin.type, _plugins2.CmsEntryElasticsearchFullTextSearchPlugin.type, _plugins2.CmsEntryElasticsearchIndexPlugin.type, _plugins2.CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type, _plugins2.CmsEntryElasticsearchQueryModifierPlugin.type, _plugins2.CmsEntryElasticsearchSortModifierPlugin.type, _plugins2.CmsEntryElasticsearchFieldPlugin.type];
|
|
180
179
|
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
*/
|
|
186
|
-
|
|
187
|
-
const queryModifierPlugins = context.plugins.byType(_plugins2.CmsEntryElasticsearchQueryModifierPlugin.type);
|
|
188
|
-
plugins.register(queryModifierPlugins);
|
|
189
|
-
/**
|
|
190
|
-
* We need to get all the sort modifier plugins
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
const sortModifierPlugins = context.plugins.byType(_plugins2.CmsEntryElasticsearchSortModifierPlugin.type);
|
|
194
|
-
plugins.register(sortModifierPlugins);
|
|
195
|
-
/**
|
|
196
|
-
* We need to get all the body modifier plugins
|
|
197
|
-
*/
|
|
198
|
-
|
|
199
|
-
const bodyModifierPlugins = context.plugins.byType(_plugins2.CmsEntryElasticsearchBodyModifierPlugin.type);
|
|
200
|
-
plugins.register(bodyModifierPlugins);
|
|
180
|
+
for (const type of types) {
|
|
181
|
+
const contextPlugins = context.plugins.byType(type);
|
|
182
|
+
plugins.register(contextPlugins);
|
|
183
|
+
}
|
|
201
184
|
},
|
|
202
185
|
init: async context => {
|
|
203
186
|
/**
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createStorageOperations","params","attributes","table","esTable","documentClient","elasticsearch","plugins","userPlugins","tableInstance","createTable","tableElasticsearchInstance","createElasticsearchTable","entities","settings","createSettingsEntity","entityName","ENTITIES","SETTINGS","system","createSystemEntity","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","entriesEs","createEntryElasticsearchEntity","ENTRIES_ES","PluginsContainer","dynamoDbValueFilters","getElasticsearchOperators","dynamoDbPlugins","elasticsearchPlugins","elasticsearchIndexPlugins","createFilterPlugins","name","beforeInit","context","register","fieldPlugins","byType","elasticsearchOperatorPlugins","ElasticsearchQueryBuilderOperatorPlugin","type","queryModifierPlugins","CmsEntryElasticsearchQueryModifierPlugin","sortModifierPlugins","CmsEntryElasticsearchSortModifierPlugin","bodyModifierPlugins","CmsEntryElasticsearchBodyModifierPlugin","init","cms","onModelBeforeCreate","subscribe","model","createElasticsearchIndex","onModelBeforeCreateFrom","onModelAfterDelete","deleteElasticsearchIndex","onModelInitialize","getEntities","getTable","getEsTable","createSystemStorageOperations","entity","createSettingsStorageOperations","createGroupsStorageOperations","createModelsStorageOperations","createEntriesStorageOperations","esEntity"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport elasticsearchPlugins from \"./elasticsearch\";\nimport dynamoDbPlugins from \"./dynamoDb\";\nimport { createSettingsStorageOperations } from \"./operations/settings\";\nimport { createSystemStorageOperations } from \"./operations/system\";\nimport { createModelsStorageOperations } from \"./operations/model\";\nimport { createEntriesStorageOperations } from \"./operations/entry\";\nimport { ENTITIES, StorageOperationsFactory } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createElasticsearchTable } from \"~/definitions/tableElasticsearch\";\nimport { createGroupEntity } from \"~/definitions/group\";\nimport { createModelEntity } from \"~/definitions/model\";\nimport { createEntryEntity } from \"~/definitions/entry\";\nimport { createEntryElasticsearchEntity } from \"~/definitions/entryElasticsearch\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createGroupsStorageOperations } from \"~/operations/group\";\nimport {\n ElasticsearchQueryBuilderOperatorPlugin,\n getElasticsearchOperators\n} from \"@webiny/api-elasticsearch\";\nimport { elasticsearchIndexPlugins } from \"./elasticsearch/indices\";\nimport { deleteElasticsearchIndex } from \"./elasticsearch/deleteElasticsearchIndex\";\nimport { CmsModelFieldToGraphQLPlugin } from \"@webiny/api-headless-cms/types\";\nimport {\n CmsEntryElasticsearchBodyModifierPlugin,\n CmsEntryElasticsearchQueryModifierPlugin,\n CmsEntryElasticsearchSortModifierPlugin\n} from \"~/plugins\";\nimport { createFilterPlugins } from \"~/operations/entry/elasticsearch/filtering/plugins\";\n\nexport * from \"./plugins\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const {\n attributes,\n table,\n esTable,\n documentClient,\n elasticsearch,\n plugins: userPlugins\n } = params;\n\n const tableInstance = createTable({\n table,\n documentClient\n });\n const tableElasticsearchInstance = createElasticsearchTable({\n table: esTable,\n documentClient\n });\n\n const entities = {\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.GROUPS] : {}\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.MODELS] : {}\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.ENTRIES] : {}\n }),\n entriesEs: createEntryElasticsearchEntity({\n entityName: ENTITIES.ENTRIES_ES,\n table: tableElasticsearchInstance,\n attributes: attributes ? attributes[ENTITIES.ENTRIES_ES] : {}\n })\n };\n\n const plugins = new PluginsContainer([\n /**\n * Plugins of type CmsModelFieldToGraphQLPlugin.\n */\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Elasticsearch operators.\n */\n getElasticsearchOperators(),\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Field plugins for Elasticsearch.\n */\n elasticsearchPlugins(),\n /**\n * Built-in Elasticsearch index templates.\n */\n elasticsearchIndexPlugins(),\n /**\n * Filter plugins used to apply filtering from where conditions to Elasticsearch query.\n */\n createFilterPlugins(),\n /**\n * User defined custom plugins.\n * They are at the end because we can then override existing plugins.\n */\n ...(userPlugins || [])\n ]);\n\n return {\n name: \"dynamodb:elasticsearch\",\n beforeInit: async context => {\n /**\n * Attach the elasticsearch into context if it is not already attached.\n */\n if (!context.elasticsearch) {\n context.elasticsearch = elasticsearch;\n }\n /**\n * Pass the plugins to the parent context.\n */\n context.plugins.register([dynamoDbPlugins()]);\n /**\n * Collect all required plugins from parent context.\n */\n const fieldPlugins = context.plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n plugins.register(fieldPlugins);\n /**\n * We need to get all the operator plugins from the main plugin container.\n */\n const elasticsearchOperatorPlugins =\n context.plugins.byType<ElasticsearchQueryBuilderOperatorPlugin>(\n ElasticsearchQueryBuilderOperatorPlugin.type\n );\n plugins.register(elasticsearchOperatorPlugins);\n /**\n * We need to get all the query modifier plugins\n */\n const queryModifierPlugins =\n context.plugins.byType<CmsEntryElasticsearchQueryModifierPlugin>(\n CmsEntryElasticsearchQueryModifierPlugin.type\n );\n plugins.register(queryModifierPlugins);\n /**\n * We need to get all the sort modifier plugins\n */\n const sortModifierPlugins =\n context.plugins.byType<CmsEntryElasticsearchSortModifierPlugin>(\n CmsEntryElasticsearchSortModifierPlugin.type\n );\n plugins.register(sortModifierPlugins);\n /**\n * We need to get all the body modifier plugins\n */\n const bodyModifierPlugins =\n context.plugins.byType<CmsEntryElasticsearchBodyModifierPlugin>(\n CmsEntryElasticsearchBodyModifierPlugin.type\n );\n plugins.register(bodyModifierPlugins);\n },\n init: async context => {\n /**\n * We need to create indexes on before model create and on clone (create from).\n * Other apps create indexes on locale creation.\n */\n context.cms.onModelBeforeCreate.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n elasticsearch,\n model,\n plugins\n });\n });\n context.cms.onModelBeforeCreateFrom.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n elasticsearch,\n model,\n plugins\n });\n });\n context.cms.onModelAfterDelete.subscribe(async ({ model }) => {\n await deleteElasticsearchIndex({\n elasticsearch,\n model\n });\n });\n\n context.cms.onModelInitialize.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n elasticsearch,\n model,\n plugins\n });\n });\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n getEsTable: () => tableElasticsearchInstance,\n system: createSystemStorageOperations({\n entity: entities.system\n }),\n settings: createSettingsStorageOperations({\n entity: entities.settings\n }),\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models,\n elasticsearch\n }),\n entries: createEntriesStorageOperations({\n entity: entities.entries,\n esEntity: entities.entriesEs,\n plugins,\n elasticsearch\n })\n };\n};\n"],"mappings":";;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA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H,CAtMM"}
|
|
1
|
+
{"version":3,"names":["createStorageOperations","params","attributes","table","esTable","documentClient","elasticsearch","plugins","userPlugins","tableInstance","createTable","tableElasticsearchInstance","createElasticsearchTable","entities","settings","createSettingsEntity","entityName","ENTITIES","SETTINGS","system","createSystemEntity","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","entriesEs","createEntryElasticsearchEntity","ENTRIES_ES","PluginsContainer","dynamoDbValueFilters","getElasticsearchOperators","dynamoDbPlugins","elasticsearchPlugins","elasticsearchIndexPlugins","createFilterPlugins","name","beforeInit","context","register","types","CmsEntryFilterPlugin","type","ElasticsearchQueryBuilderOperatorPlugin","CmsEntryElasticsearchBodyModifierPlugin","CmsEntryElasticsearchFullTextSearchPlugin","CmsEntryElasticsearchIndexPlugin","CmsEntryElasticsearchQueryBuilderValueSearchPlugin","CmsEntryElasticsearchQueryModifierPlugin","CmsEntryElasticsearchSortModifierPlugin","CmsEntryElasticsearchFieldPlugin","contextPlugins","byType","init","cms","onModelBeforeCreate","subscribe","model","createElasticsearchIndex","onModelBeforeCreateFrom","onModelAfterDelete","deleteElasticsearchIndex","onModelInitialize","getEntities","getTable","getEsTable","createSystemStorageOperations","entity","createSettingsStorageOperations","createGroupsStorageOperations","createModelsStorageOperations","createEntriesStorageOperations","esEntity"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport elasticsearchPlugins from \"./elasticsearch\";\nimport dynamoDbPlugins from \"./dynamoDb\";\nimport { createSettingsStorageOperations } from \"./operations/settings\";\nimport { createSystemStorageOperations } from \"./operations/system\";\nimport { createModelsStorageOperations } from \"./operations/model\";\nimport { createEntriesStorageOperations } from \"./operations/entry\";\nimport { ENTITIES, StorageOperationsFactory } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createElasticsearchTable } from \"~/definitions/tableElasticsearch\";\nimport { createGroupEntity } from \"~/definitions/group\";\nimport { createModelEntity } from \"~/definitions/model\";\nimport { createEntryEntity } from \"~/definitions/entry\";\nimport { createEntryElasticsearchEntity } from \"~/definitions/entryElasticsearch\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createGroupsStorageOperations } from \"~/operations/group\";\nimport {\n ElasticsearchQueryBuilderOperatorPlugin,\n getElasticsearchOperators\n} from \"@webiny/api-elasticsearch\";\nimport { elasticsearchIndexPlugins } from \"./elasticsearch/indices\";\nimport { deleteElasticsearchIndex } from \"./elasticsearch/deleteElasticsearchIndex\";\nimport {\n CmsEntryElasticsearchBodyModifierPlugin,\n CmsEntryElasticsearchFullTextSearchPlugin,\n CmsEntryElasticsearchIndexPlugin,\n CmsEntryElasticsearchQueryBuilderValueSearchPlugin,\n CmsEntryElasticsearchQueryModifierPlugin,\n CmsEntryElasticsearchSortModifierPlugin,\n CmsEntryElasticsearchFieldPlugin\n} from \"~/plugins\";\nimport { createFilterPlugins } from \"~/operations/entry/elasticsearch/filtering/plugins\";\nimport { CmsEntryFilterPlugin } from \"~/plugins/CmsEntryFilterPlugin\";\n\nexport * from \"./plugins\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const {\n attributes,\n table,\n esTable,\n documentClient,\n elasticsearch,\n plugins: userPlugins\n } = params;\n\n const tableInstance = createTable({\n table,\n documentClient\n });\n const tableElasticsearchInstance = createElasticsearchTable({\n table: esTable,\n documentClient\n });\n\n const entities = {\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.GROUPS] : {}\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.MODELS] : {}\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.ENTRIES] : {}\n }),\n entriesEs: createEntryElasticsearchEntity({\n entityName: ENTITIES.ENTRIES_ES,\n table: tableElasticsearchInstance,\n attributes: attributes ? attributes[ENTITIES.ENTRIES_ES] : {}\n })\n };\n\n const plugins = new PluginsContainer([\n /**\n * Plugins of type CmsModelFieldToGraphQLPlugin.\n */\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Elasticsearch operators.\n */\n getElasticsearchOperators(),\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Field plugins for Elasticsearch.\n */\n elasticsearchPlugins(),\n /**\n * Built-in Elasticsearch index templates.\n */\n elasticsearchIndexPlugins(),\n /**\n * Filter plugins used to apply filtering from where conditions to Elasticsearch query.\n */\n createFilterPlugins(),\n /**\n * User defined custom plugins.\n * They are at the end because we can then override existing plugins.\n */\n ...(userPlugins || [])\n ]);\n\n return {\n name: \"dynamodb:elasticsearch\",\n beforeInit: async context => {\n /**\n * Attach the elasticsearch into context if it is not already attached.\n */\n if (!context.elasticsearch) {\n context.elasticsearch = elasticsearch;\n }\n /**\n * Pass the plugins to the parent context.\n */\n context.plugins.register([dynamoDbPlugins()]);\n /**\n * We need to fetch all the plugin types in the list from the main container.\n * This way we do not need to register plugins in the storage plugins contains.\n */\n const types: string[] = [\n \"cms-model-field-to-graphql\",\n CmsEntryFilterPlugin.type,\n ElasticsearchQueryBuilderOperatorPlugin.type,\n CmsEntryElasticsearchBodyModifierPlugin.type,\n CmsEntryElasticsearchFullTextSearchPlugin.type,\n CmsEntryElasticsearchIndexPlugin.type,\n CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type,\n CmsEntryElasticsearchQueryModifierPlugin.type,\n CmsEntryElasticsearchSortModifierPlugin.type,\n CmsEntryElasticsearchFieldPlugin.type\n ];\n for (const type of types) {\n const contextPlugins = context.plugins.byType(type);\n plugins.register(contextPlugins);\n }\n },\n init: async context => {\n /**\n * We need to create indexes on before model create and on clone (create from).\n * Other apps create indexes on locale creation.\n */\n context.cms.onModelBeforeCreate.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n elasticsearch,\n model,\n plugins\n });\n });\n context.cms.onModelBeforeCreateFrom.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n elasticsearch,\n model,\n plugins\n });\n });\n context.cms.onModelAfterDelete.subscribe(async ({ model }) => {\n await deleteElasticsearchIndex({\n elasticsearch,\n model\n });\n });\n\n context.cms.onModelInitialize.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n elasticsearch,\n model,\n plugins\n });\n });\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n getEsTable: () => tableElasticsearchInstance,\n system: createSystemStorageOperations({\n entity: entities.system\n }),\n settings: createSettingsStorageOperations({\n entity: entities.settings\n }),\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models,\n elasticsearch\n }),\n entries: createEntriesStorageOperations({\n entity: entities.entries,\n esEntity: entities.entriesEs,\n plugins,\n elasticsearch\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;;AAIA;;AACA;;AACA;;AAYA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAHA;;AACA;;AAIO,MAAMA,uBAAiD,GAAGC,MAAM,IAAI;EACvE,MAAM;IACFC,UADE;IAEFC,KAFE;IAGFC,OAHE;IAIFC,cAJE;IAKFC,aALE;IA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wD,QAAQ,EAAE,MAAM5D,aArEb;IAsEH6D,UAAU,EAAE,MAAM3D,0BAtEf;IAuEHQ,MAAM,EAAE,IAAAoD,qCAAA,EAA8B;MAClCC,MAAM,EAAE3D,QAAQ,CAACM;IADiB,CAA9B,CAvEL;IA0EHL,QAAQ,EAAE,IAAA2D,yCAAA,EAAgC;MACtCD,MAAM,EAAE3D,QAAQ,CAACC;IADqB,CAAhC,CA1EP;IA6EHQ,MAAM,EAAE,IAAAoD,qCAAA,EAA8B;MAClCF,MAAM,EAAE3D,QAAQ,CAACS,MADiB;MAElCf;IAFkC,CAA9B,CA7EL;IAiFHkB,MAAM,EAAE,IAAAkD,oCAAA,EAA8B;MAClCH,MAAM,EAAE3D,QAAQ,CAACY,MADiB;MAElCnB;IAFkC,CAA9B,CAjFL;IAqFHsB,OAAO,EAAE,IAAAgD,qCAAA,EAA+B;MACpCJ,MAAM,EAAE3D,QAAQ,CAACe,OADmB;MAEpCiD,QAAQ,EAAEhE,QAAQ,CAACkB,SAFiB;MAGpCxB,OAHoC;MAIpCD;IAJoC,CAA/B;EArFN,CAAP;AA4FH,CAnLM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-ddb-es",
|
|
3
|
-
"version": "5.34.
|
|
3
|
+
"version": "5.34.6-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"@webiny/api-headless-cms",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@babel/runtime": "7.19.0",
|
|
26
|
-
"@webiny/api": "5.34.
|
|
27
|
-
"@webiny/api-elasticsearch": "5.34.
|
|
28
|
-
"@webiny/api-headless-cms": "5.34.
|
|
29
|
-
"@webiny/db-dynamodb": "5.34.
|
|
30
|
-
"@webiny/error": "5.34.
|
|
31
|
-
"@webiny/handler-db": "5.34.
|
|
32
|
-
"@webiny/plugins": "5.34.
|
|
33
|
-
"@webiny/utils": "5.34.
|
|
26
|
+
"@webiny/api": "5.34.6-beta.0",
|
|
27
|
+
"@webiny/api-elasticsearch": "5.34.6-beta.0",
|
|
28
|
+
"@webiny/api-headless-cms": "5.34.6-beta.0",
|
|
29
|
+
"@webiny/db-dynamodb": "5.34.6-beta.0",
|
|
30
|
+
"@webiny/error": "5.34.6-beta.0",
|
|
31
|
+
"@webiny/handler-db": "5.34.6-beta.0",
|
|
32
|
+
"@webiny/plugins": "5.34.6-beta.0",
|
|
33
|
+
"@webiny/utils": "5.34.6-beta.0",
|
|
34
34
|
"dataloader": "2.1.0",
|
|
35
35
|
"dynamodb-toolbox": "0.3.5",
|
|
36
36
|
"jsonpack": "1.1.5",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"@babel/preset-env": "^7.19.4",
|
|
43
43
|
"@elastic/elasticsearch": "7.12.0",
|
|
44
44
|
"@types/jsonpack": "^1.1.0",
|
|
45
|
-
"@webiny/api-dynamodb-to-elasticsearch": "^5.34.
|
|
46
|
-
"@webiny/cli": "^5.34.
|
|
47
|
-
"@webiny/handler-aws": "^5.34.
|
|
48
|
-
"@webiny/project-utils": "^5.34.
|
|
45
|
+
"@webiny/api-dynamodb-to-elasticsearch": "^5.34.6-beta.0",
|
|
46
|
+
"@webiny/cli": "^5.34.6-beta.0",
|
|
47
|
+
"@webiny/handler-aws": "^5.34.6-beta.0",
|
|
48
|
+
"@webiny/project-utils": "^5.34.6-beta.0",
|
|
49
49
|
"jest": "^28.1.0",
|
|
50
50
|
"jest-dynalite": "^3.2.0",
|
|
51
51
|
"jest-environment-node": "^27.2.4",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"build": "yarn webiny run build",
|
|
65
65
|
"watch": "yarn webiny run watch"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "143093ae7993a5c0284d84a1ec12656bcc425515"
|
|
68
68
|
}
|
|
@@ -28,3 +28,4 @@ export declare class CmsEntryElasticsearchQueryBuilderValueSearchPlugin extends
|
|
|
28
28
|
transform(params: TransformCallableParams): any;
|
|
29
29
|
createPath(params: CreatePathCallableParams): string | null;
|
|
30
30
|
}
|
|
31
|
+
export declare const createCmsEntryElasticsearchQueryBuilderValueSearchPlugin: (params: CmsEntryElasticsearchQueryBuilderValueSearchPluginParams) => CmsEntryElasticsearchQueryBuilderValueSearchPlugin;
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.CmsEntryElasticsearchQueryBuilderValueSearchPlugin = void 0;
|
|
8
|
+
exports.createCmsEntryElasticsearchQueryBuilderValueSearchPlugin = exports.CmsEntryElasticsearchQueryBuilderValueSearchPlugin = void 0;
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
@@ -40,4 +40,10 @@ class CmsEntryElasticsearchQueryBuilderValueSearchPlugin extends _Plugin.Plugin
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
exports.CmsEntryElasticsearchQueryBuilderValueSearchPlugin = CmsEntryElasticsearchQueryBuilderValueSearchPlugin;
|
|
43
|
-
(0, _defineProperty2.default)(CmsEntryElasticsearchQueryBuilderValueSearchPlugin, "type", "cms-elastic-search-query-builder-value-search");
|
|
43
|
+
(0, _defineProperty2.default)(CmsEntryElasticsearchQueryBuilderValueSearchPlugin, "type", "cms-elastic-search-query-builder-value-search");
|
|
44
|
+
|
|
45
|
+
const createCmsEntryElasticsearchQueryBuilderValueSearchPlugin = params => {
|
|
46
|
+
return new CmsEntryElasticsearchQueryBuilderValueSearchPlugin(params);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
exports.createCmsEntryElasticsearchQueryBuilderValueSearchPlugin = createCmsEntryElasticsearchQueryBuilderValueSearchPlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CmsEntryElasticsearchQueryBuilderValueSearchPlugin","Plugin","fieldType","config","constructor","params","name","type","transform","createPath","path"],"sources":["CmsEntryElasticsearchQueryBuilderValueSearchPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nexport interface CreatePathCallableParams<T = any> {\n field: CmsModelField;\n key: string;\n value: T;\n}\n\nexport interface CreatePathCallable<T = any> {\n (params: CreatePathCallableParams<T>): string;\n}\n\nexport interface TransformCallableParams<T = any> {\n field: CmsModelField;\n value: T;\n}\nexport interface TransformCallable<T = any> {\n (params: TransformCallableParams<T>): string;\n}\n\nexport interface CmsEntryElasticsearchQueryBuilderValueSearchPluginParams {\n fieldType: string;\n path?: string | CreatePathCallable;\n transform: TransformCallable;\n}\nexport class CmsEntryElasticsearchQueryBuilderValueSearchPlugin extends Plugin {\n public static override readonly type: string = \"cms-elastic-search-query-builder-value-search\";\n\n private readonly config: CmsEntryElasticsearchQueryBuilderValueSearchPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public constructor(params: CmsEntryElasticsearchQueryBuilderValueSearchPluginParams) {\n super();\n\n this.config = params;\n this.name = `${(this.constructor as any).type}-${this.config.fieldType}`;\n }\n\n public transform(params: TransformCallableParams): any {\n return this.config.transform(params);\n }\n\n public createPath(params: CreatePathCallableParams): string | null {\n if (typeof this.config.path === \"function\") {\n return this.config.path(params);\n } else if (typeof this.config.path === \"string\") {\n return this.config.path;\n }\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AA0BO,MAAMA,kDAAN,SAAiEC,cAAjE,CAAwE;EAKvD,IAATC,SAAS,GAAW;IAC3B,OAAO,KAAKC,MAAL,CAAYD,SAAnB;EACH;;EAEME,WAAW,CAACC,MAAD,EAAmE;IACjF;IADiF;IAGjF,KAAKF,MAAL,GAAcE,MAAd;IACA,KAAKC,IAAL,GAAa,GAAG,KAAKF,WAAN,CAA0BG,IAAK,IAAG,KAAKJ,MAAL,CAAYD,SAAU,EAAvE;EACH;;EAEMM,SAAS,CAACH,MAAD,EAAuC;IACnD,OAAO,KAAKF,MAAL,CAAYK,SAAZ,CAAsBH,MAAtB,CAAP;EACH;;EAEMI,UAAU,CAACJ,MAAD,EAAkD;IAC/D,IAAI,OAAO,KAAKF,MAAL,CAAYO,IAAnB,KAA4B,UAAhC,EAA4C;MACxC,OAAO,KAAKP,MAAL,CAAYO,IAAZ,CAAiBL,MAAjB,CAAP;IACH,CAFD,MAEO,IAAI,OAAO,KAAKF,MAAL,CAAYO,IAAnB,KAA4B,QAAhC,EAA0C;MAC7C,OAAO,KAAKP,MAAL,CAAYO,IAAnB;IACH;;IACD,OAAO,IAAP;EACH;;AA3B0E;;;8BAAlEV,kD,UACsC,+C"}
|
|
1
|
+
{"version":3,"names":["CmsEntryElasticsearchQueryBuilderValueSearchPlugin","Plugin","fieldType","config","constructor","params","name","type","transform","createPath","path","createCmsEntryElasticsearchQueryBuilderValueSearchPlugin"],"sources":["CmsEntryElasticsearchQueryBuilderValueSearchPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nexport interface CreatePathCallableParams<T = any> {\n field: CmsModelField;\n key: string;\n value: T;\n}\n\nexport interface CreatePathCallable<T = any> {\n (params: CreatePathCallableParams<T>): string;\n}\n\nexport interface TransformCallableParams<T = any> {\n field: CmsModelField;\n value: T;\n}\nexport interface TransformCallable<T = any> {\n (params: TransformCallableParams<T>): string;\n}\n\nexport interface CmsEntryElasticsearchQueryBuilderValueSearchPluginParams {\n fieldType: string;\n path?: string | CreatePathCallable;\n transform: TransformCallable;\n}\nexport class CmsEntryElasticsearchQueryBuilderValueSearchPlugin extends Plugin {\n public static override readonly type: string = \"cms-elastic-search-query-builder-value-search\";\n\n private readonly config: CmsEntryElasticsearchQueryBuilderValueSearchPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public constructor(params: CmsEntryElasticsearchQueryBuilderValueSearchPluginParams) {\n super();\n\n this.config = params;\n this.name = `${(this.constructor as any).type}-${this.config.fieldType}`;\n }\n\n public transform(params: TransformCallableParams): any {\n return this.config.transform(params);\n }\n\n public createPath(params: CreatePathCallableParams): string | null {\n if (typeof this.config.path === \"function\") {\n return this.config.path(params);\n } else if (typeof this.config.path === \"string\") {\n return this.config.path;\n }\n return null;\n }\n}\n\nexport const createCmsEntryElasticsearchQueryBuilderValueSearchPlugin = (\n params: CmsEntryElasticsearchQueryBuilderValueSearchPluginParams\n) => {\n return new CmsEntryElasticsearchQueryBuilderValueSearchPlugin(params);\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AA0BO,MAAMA,kDAAN,SAAiEC,cAAjE,CAAwE;EAKvD,IAATC,SAAS,GAAW;IAC3B,OAAO,KAAKC,MAAL,CAAYD,SAAnB;EACH;;EAEME,WAAW,CAACC,MAAD,EAAmE;IACjF;IADiF;IAGjF,KAAKF,MAAL,GAAcE,MAAd;IACA,KAAKC,IAAL,GAAa,GAAG,KAAKF,WAAN,CAA0BG,IAAK,IAAG,KAAKJ,MAAL,CAAYD,SAAU,EAAvE;EACH;;EAEMM,SAAS,CAACH,MAAD,EAAuC;IACnD,OAAO,KAAKF,MAAL,CAAYK,SAAZ,CAAsBH,MAAtB,CAAP;EACH;;EAEMI,UAAU,CAACJ,MAAD,EAAkD;IAC/D,IAAI,OAAO,KAAKF,MAAL,CAAYO,IAAnB,KAA4B,UAAhC,EAA4C;MACxC,OAAO,KAAKP,MAAL,CAAYO,IAAZ,CAAiBL,MAAjB,CAAP;IACH,CAFD,MAEO,IAAI,OAAO,KAAKF,MAAL,CAAYO,IAAnB,KAA4B,QAAhC,EAA0C;MAC7C,OAAO,KAAKP,MAAL,CAAYO,IAAnB;IACH;;IACD,OAAO,IAAP;EACH;;AA3B0E;;;8BAAlEV,kD,UACsC,+C;;AA6B5C,MAAMW,wDAAwD,GACjEN,MADoE,IAEnE;EACD,OAAO,IAAIL,kDAAJ,CAAuDK,MAAvD,CAAP;AACH,CAJM"}
|