@webiny/api-headless-cms-ddb-es 5.41.1 → 5.41.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +10 -0
- package/index.js.map +1 -1
- package/package.json +23 -23
- package/types.d.ts +8 -7
- package/types.js.map +1 -1
package/index.js
CHANGED
|
@@ -124,6 +124,16 @@ const createStorageOperations = params => {
|
|
|
124
124
|
return {
|
|
125
125
|
name: "dynamodb:elasticsearch",
|
|
126
126
|
beforeInit: async context => {
|
|
127
|
+
context.db.registry.register({
|
|
128
|
+
item: entities.entries,
|
|
129
|
+
app: "cms",
|
|
130
|
+
tags: ["regular", entities.entries.name]
|
|
131
|
+
});
|
|
132
|
+
context.db.registry.register({
|
|
133
|
+
item: entities.entriesEs,
|
|
134
|
+
app: "cms",
|
|
135
|
+
tags: ["es", entities.entriesEs.name]
|
|
136
|
+
});
|
|
127
137
|
/**
|
|
128
138
|
* Attach the elasticsearch into context if it is not already attached.
|
|
129
139
|
*/
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_filters","_interopRequireDefault","require","_elasticsearch","_dynamoDb","_system","_model","_entry","_types","_table","_tableElasticsearch","_group","_model2","_entry2","_entryElasticsearch","_system2","_createElasticsearchIndex","_plugins","_group2","_apiElasticsearch","_indices","_deleteElasticsearchIndex","_plugins2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_plugins3","_CmsEntryFilterPlugin","_apiHeadlessCms","_indexes","_createIndexTaskPlugin","createStorageOperations","params","attributes","table","esTable","documentClient","elasticsearch","plugins","userPlugins","tableInstance","createTable","tableElasticsearchInstance","createElasticsearchTable","entities","system","createSystemEntity","entityName","ENTITIES","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","entriesEs","createEntryElasticsearchEntity","ENTRIES_ES","PluginsContainer","dynamoDbValueFilters","dynamoDbPlugins","elasticsearchPlugins","elasticsearchIndexPlugins","createFilterPlugins","createEntriesStorageOperations","entity","esEntity","name","beforeInit","context","register","createIndexTaskPluginTest","types","CompressionPlugin","type","ElasticsearchQueryBuilderOperatorPlugin","CmsEntryFilterPlugin","CmsEntryElasticsearchBodyModifierPlugin","CmsEntryElasticsearchFullTextSearchPlugin","CmsEntryElasticsearchIndexPlugin","CmsEntryElasticsearchQueryBuilderValueSearchPlugin","CmsEntryElasticsearchQueryModifierPlugin","CmsEntryElasticsearchSortModifierPlugin","CmsElasticsearchModelFieldPlugin","StorageOperationsCmsModelPlugin","StorageTransformPlugin","CmsEntryElasticsearchValuesModifier","mergeByType","dataLoaders","clearAll","init","createElasticsearchIndexesOnLocaleAfterCreate","client","cms","onModelBeforeCreate","subscribe","model","createElasticsearchIndex","onModelBeforeCreateFrom","onModelAfterDelete","deleteElasticsearchIndex","onModelInitialize","getEntities","getTable","getEsTable","createSystemStorageOperations","createGroupsStorageOperations","createModelsStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport elasticsearchPlugins from \"./elasticsearch\";\nimport dynamoDbPlugins from \"./dynamoDb\";\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 { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createGroupsStorageOperations } from \"~/operations/group\";\nimport {\n CompressionPlugin,\n ElasticsearchQueryBuilderOperatorPlugin\n} from \"@webiny/api-elasticsearch\";\nimport { elasticsearchIndexPlugins } from \"./elasticsearch/indices\";\nimport { deleteElasticsearchIndex } from \"./elasticsearch/deleteElasticsearchIndex\";\nimport {\n CmsElasticsearchModelFieldPlugin,\n CmsEntryElasticsearchBodyModifierPlugin,\n CmsEntryElasticsearchFullTextSearchPlugin,\n CmsEntryElasticsearchIndexPlugin,\n CmsEntryElasticsearchQueryBuilderValueSearchPlugin,\n CmsEntryElasticsearchQueryModifierPlugin,\n CmsEntryElasticsearchSortModifierPlugin,\n CmsEntryElasticsearchValuesModifier\n} from \"~/plugins\";\nimport { createFilterPlugins } from \"~/operations/entry/elasticsearch/filtering/plugins\";\nimport { CmsEntryFilterPlugin } from \"~/plugins/CmsEntryFilterPlugin\";\nimport { StorageOperationsCmsModelPlugin, StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { createElasticsearchIndexesOnLocaleAfterCreate } from \"~/operations/system/indexes\";\nimport { createIndexTaskPluginTest } from \"~/tasks/createIndexTaskPlugin\";\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 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 * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\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 const entries = createEntriesStorageOperations({\n entity: entities.entries,\n esEntity: entities.entriesEs,\n plugins,\n elasticsearch\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([\n dynamoDbPlugins(),\n createIndexTaskPluginTest(),\n elasticsearchIndexPlugins()\n ]);\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 // Elasticsearch\n CompressionPlugin.type,\n ElasticsearchQueryBuilderOperatorPlugin.type,\n // Headless CMS\n \"cms-model-field-to-graphql\",\n CmsEntryFilterPlugin.type,\n CmsEntryElasticsearchBodyModifierPlugin.type,\n CmsEntryElasticsearchFullTextSearchPlugin.type,\n CmsEntryElasticsearchIndexPlugin.type,\n CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type,\n CmsEntryElasticsearchQueryModifierPlugin.type,\n CmsEntryElasticsearchSortModifierPlugin.type,\n CmsElasticsearchModelFieldPlugin.type,\n StorageOperationsCmsModelPlugin.type,\n StorageTransformPlugin.type,\n CmsEntryElasticsearchValuesModifier.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n entries.dataLoaders.clearAll();\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 await createElasticsearchIndexesOnLocaleAfterCreate({\n context,\n client: elasticsearch,\n plugins\n });\n\n context.cms.onModelBeforeCreate.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n client: elasticsearch,\n model,\n plugins\n });\n });\n context.cms.onModelBeforeCreateFrom.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n client: elasticsearch,\n model,\n plugins\n });\n });\n context.cms.onModelAfterDelete.subscribe(async ({ model }) => {\n await deleteElasticsearchIndex({\n client: elasticsearch,\n model\n });\n });\n\n context.cms.onModelInitialize.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n client: 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 groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models,\n elasticsearch\n }),\n entries\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,mBAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,G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,EAAEA,CAAA,KAAMnE,aAAa;IAC7BoE,UAAU,EAAEA,CAAA,KAAMlE,0BAA0B;IAC5CG,MAAM,EAAE,IAAAgE,qCAA6B,EAAC;MAClCxC,MAAM,EAAEzB,QAAQ,CAACC;IACrB,CAAC,CAAC;IACFK,MAAM,EAAE,IAAA4D,qCAA6B,EAAC;MAClCzC,MAAM,EAAEzB,QAAQ,CAACM,MAAM;MACvBZ;IACJ,CAAC,CAAC;IACFe,MAAM,EAAE,IAAA0D,oCAA6B,EAAC;MAClC1C,MAAM,EAAEzB,QAAQ,CAACS,MAAM;MACvBhB;IACJ,CAAC,CAAC;IACFmB;EACJ,CAAC;AACL,CAAC;AAAClC,OAAA,CAAAS,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_filters","_interopRequireDefault","require","_elasticsearch","_dynamoDb","_system","_model","_entry","_types","_table","_tableElasticsearch","_group","_model2","_entry2","_entryElasticsearch","_system2","_createElasticsearchIndex","_plugins","_group2","_apiElasticsearch","_indices","_deleteElasticsearchIndex","_plugins2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_plugins3","_CmsEntryFilterPlugin","_apiHeadlessCms","_indexes","_createIndexTaskPlugin","createStorageOperations","params","attributes","table","esTable","documentClient","elasticsearch","plugins","userPlugins","tableInstance","createTable","tableElasticsearchInstance","createElasticsearchTable","entities","system","createSystemEntity","entityName","ENTITIES","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","entriesEs","createEntryElasticsearchEntity","ENTRIES_ES","PluginsContainer","dynamoDbValueFilters","dynamoDbPlugins","elasticsearchPlugins","elasticsearchIndexPlugins","createFilterPlugins","createEntriesStorageOperations","entity","esEntity","name","beforeInit","context","db","registry","register","item","app","tags","createIndexTaskPluginTest","types","CompressionPlugin","type","ElasticsearchQueryBuilderOperatorPlugin","CmsEntryFilterPlugin","CmsEntryElasticsearchBodyModifierPlugin","CmsEntryElasticsearchFullTextSearchPlugin","CmsEntryElasticsearchIndexPlugin","CmsEntryElasticsearchQueryBuilderValueSearchPlugin","CmsEntryElasticsearchQueryModifierPlugin","CmsEntryElasticsearchSortModifierPlugin","CmsElasticsearchModelFieldPlugin","StorageOperationsCmsModelPlugin","StorageTransformPlugin","CmsEntryElasticsearchValuesModifier","mergeByType","dataLoaders","clearAll","init","createElasticsearchIndexesOnLocaleAfterCreate","client","cms","onModelBeforeCreate","subscribe","model","createElasticsearchIndex","onModelBeforeCreateFrom","onModelAfterDelete","deleteElasticsearchIndex","onModelInitialize","getEntities","getTable","getEsTable","createSystemStorageOperations","createGroupsStorageOperations","createModelsStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport elasticsearchPlugins from \"./elasticsearch\";\nimport dynamoDbPlugins from \"./dynamoDb\";\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 { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createGroupsStorageOperations } from \"~/operations/group\";\nimport {\n CompressionPlugin,\n ElasticsearchQueryBuilderOperatorPlugin\n} from \"@webiny/api-elasticsearch\";\nimport { elasticsearchIndexPlugins } from \"./elasticsearch/indices\";\nimport { deleteElasticsearchIndex } from \"./elasticsearch/deleteElasticsearchIndex\";\nimport {\n CmsElasticsearchModelFieldPlugin,\n CmsEntryElasticsearchBodyModifierPlugin,\n CmsEntryElasticsearchFullTextSearchPlugin,\n CmsEntryElasticsearchIndexPlugin,\n CmsEntryElasticsearchQueryBuilderValueSearchPlugin,\n CmsEntryElasticsearchQueryModifierPlugin,\n CmsEntryElasticsearchSortModifierPlugin,\n CmsEntryElasticsearchValuesModifier\n} from \"~/plugins\";\nimport { createFilterPlugins } from \"~/operations/entry/elasticsearch/filtering/plugins\";\nimport { CmsEntryFilterPlugin } from \"~/plugins/CmsEntryFilterPlugin\";\nimport { StorageOperationsCmsModelPlugin, StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { createElasticsearchIndexesOnLocaleAfterCreate } from \"~/operations/system/indexes\";\nimport { createIndexTaskPluginTest } from \"~/tasks/createIndexTaskPlugin\";\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 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 * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\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 const entries = createEntriesStorageOperations({\n entity: entities.entries,\n esEntity: entities.entriesEs,\n plugins,\n elasticsearch\n });\n\n return {\n name: \"dynamodb:elasticsearch\",\n beforeInit: async context => {\n context.db.registry.register({\n item: entities.entries,\n app: \"cms\",\n tags: [\"regular\", entities.entries.name]\n });\n context.db.registry.register({\n item: entities.entriesEs,\n app: \"cms\",\n tags: [\"es\", entities.entriesEs.name]\n });\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([\n dynamoDbPlugins(),\n createIndexTaskPluginTest(),\n elasticsearchIndexPlugins()\n ]);\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 // Elasticsearch\n CompressionPlugin.type,\n ElasticsearchQueryBuilderOperatorPlugin.type,\n // Headless CMS\n \"cms-model-field-to-graphql\",\n CmsEntryFilterPlugin.type,\n CmsEntryElasticsearchBodyModifierPlugin.type,\n CmsEntryElasticsearchFullTextSearchPlugin.type,\n CmsEntryElasticsearchIndexPlugin.type,\n CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type,\n CmsEntryElasticsearchQueryModifierPlugin.type,\n CmsEntryElasticsearchSortModifierPlugin.type,\n CmsElasticsearchModelFieldPlugin.type,\n StorageOperationsCmsModelPlugin.type,\n StorageTransformPlugin.type,\n CmsEntryElasticsearchValuesModifier.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n entries.dataLoaders.clearAll();\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 await createElasticsearchIndexesOnLocaleAfterCreate({\n context,\n client: elasticsearch,\n plugins\n });\n\n context.cms.onModelBeforeCreate.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n client: elasticsearch,\n model,\n plugins\n });\n });\n context.cms.onModelBeforeCreateFrom.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n client: elasticsearch,\n model,\n plugins\n });\n });\n context.cms.onModelAfterDelete.subscribe(async ({ model }) => {\n await deleteElasticsearchIndex({\n client: elasticsearch,\n model\n });\n });\n\n context.cms.onModelInitialize.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n client: 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 groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models,\n elasticsearch\n }),\n entries\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,mBAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AACA,IAA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AM,IAAAI,kDAAwB,EAAC;UAC3BR,MAAM,EAAEhE,aAAa;UACrBoE;QACJ,CAAC,CAAC;MACN,CAAC,CAAC;MAEFhC,OAAO,CAAC6B,GAAG,CAACQ,iBAAiB,CAACN,SAAS,CAAC,OAAO;QAAEC;MAAM,CAAC,KAAK;QACzD,MAAM,IAAAC,kDAAwB,EAAC;UAC3BL,MAAM,EAAEhE,aAAa;UACrBoE,KAAK;UACLnE;QACJ,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC;IACDyE,WAAW,EAAEA,CAAA,KAAMnE,QAAQ;IAC3BoE,QAAQ,EAAEA,CAAA,KAAMxE,aAAa;IAC7ByE,UAAU,EAAEA,CAAA,KAAMvE,0BAA0B;IAC5CG,MAAM,EAAE,IAAAqE,qCAA6B,EAAC;MAClC7C,MAAM,EAAEzB,QAAQ,CAACC;IACrB,CAAC,CAAC;IACFK,MAAM,EAAE,IAAAiE,qCAA6B,EAAC;MAClC9C,MAAM,EAAEzB,QAAQ,CAACM,MAAM;MACvBZ;IACJ,CAAC,CAAC;IACFe,MAAM,EAAE,IAAA+D,oCAA6B,EAAC;MAClC/C,MAAM,EAAEzB,QAAQ,CAACS,MAAM;MACvBhB;IACJ,CAAC,CAAC;IACFmB;EACJ,CAAC;AACL,CAAC;AAAClC,OAAA,CAAAS,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-ddb-es",
|
|
3
|
-
"version": "5.41.1",
|
|
3
|
+
"version": "5.41.2-beta.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"@webiny/api-headless-cms",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "7.24.1",
|
|
30
|
-
"@webiny/api": "5.41.1",
|
|
31
|
-
"@webiny/api-elasticsearch": "5.41.1",
|
|
32
|
-
"@webiny/api-elasticsearch-tasks": "5.41.1",
|
|
33
|
-
"@webiny/api-headless-cms": "5.41.1",
|
|
34
|
-
"@webiny/aws-sdk": "5.41.1",
|
|
35
|
-
"@webiny/db-dynamodb": "5.41.1",
|
|
36
|
-
"@webiny/error": "5.41.1",
|
|
37
|
-
"@webiny/handler-db": "5.41.1",
|
|
38
|
-
"@webiny/plugins": "5.41.1",
|
|
39
|
-
"@webiny/utils": "5.41.1",
|
|
30
|
+
"@webiny/api": "5.41.2-beta.1",
|
|
31
|
+
"@webiny/api-elasticsearch": "5.41.2-beta.1",
|
|
32
|
+
"@webiny/api-elasticsearch-tasks": "5.41.2-beta.1",
|
|
33
|
+
"@webiny/api-headless-cms": "5.41.2-beta.1",
|
|
34
|
+
"@webiny/aws-sdk": "5.41.2-beta.1",
|
|
35
|
+
"@webiny/db-dynamodb": "5.41.2-beta.1",
|
|
36
|
+
"@webiny/error": "5.41.2-beta.1",
|
|
37
|
+
"@webiny/handler-db": "5.41.2-beta.1",
|
|
38
|
+
"@webiny/plugins": "5.41.2-beta.1",
|
|
39
|
+
"@webiny/utils": "5.41.2-beta.1",
|
|
40
40
|
"dataloader": "2.2.1",
|
|
41
41
|
"jsonpack": "1.1.5",
|
|
42
42
|
"lodash": "4.17.21"
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"@babel/preset-env": "7.24.3",
|
|
48
48
|
"@elastic/elasticsearch": "7.12.0",
|
|
49
49
|
"@types/jsonpack": "1.1.2",
|
|
50
|
-
"@webiny/api-dynamodb-to-elasticsearch": "5.41.1",
|
|
51
|
-
"@webiny/api-i18n": "5.41.1",
|
|
52
|
-
"@webiny/api-security": "5.41.1",
|
|
53
|
-
"@webiny/api-tenancy": "5.41.1",
|
|
54
|
-
"@webiny/api-wcp": "5.41.1",
|
|
55
|
-
"@webiny/cli": "5.41.1",
|
|
56
|
-
"@webiny/handler": "5.41.1",
|
|
57
|
-
"@webiny/handler-aws": "5.41.1",
|
|
58
|
-
"@webiny/handler-graphql": "5.41.1",
|
|
59
|
-
"@webiny/project-utils": "5.41.1",
|
|
60
|
-
"@webiny/tasks": "5.41.1",
|
|
50
|
+
"@webiny/api-dynamodb-to-elasticsearch": "5.41.2-beta.1",
|
|
51
|
+
"@webiny/api-i18n": "5.41.2-beta.1",
|
|
52
|
+
"@webiny/api-security": "5.41.2-beta.1",
|
|
53
|
+
"@webiny/api-tenancy": "5.41.2-beta.1",
|
|
54
|
+
"@webiny/api-wcp": "5.41.2-beta.1",
|
|
55
|
+
"@webiny/cli": "5.41.2-beta.1",
|
|
56
|
+
"@webiny/handler": "5.41.2-beta.1",
|
|
57
|
+
"@webiny/handler-aws": "5.41.2-beta.1",
|
|
58
|
+
"@webiny/handler-graphql": "5.41.2-beta.1",
|
|
59
|
+
"@webiny/project-utils": "5.41.2-beta.1",
|
|
60
|
+
"@webiny/tasks": "5.41.2-beta.1",
|
|
61
61
|
"jest": "29.7.0",
|
|
62
62
|
"jest-dynalite": "3.6.1",
|
|
63
63
|
"prettier": "2.8.8",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"build": "yarn webiny run build",
|
|
75
75
|
"watch": "yarn webiny run watch"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "69a78b382b4de30846edfc2a9d5f73ca223fcc10"
|
|
78
78
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Plugin, PluginCollection } from "@webiny/plugins/types";
|
|
2
|
-
import { CmsContext as BaseCmsContext, CmsEntry, CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, CmsModelFieldType, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
|
|
3
|
-
import { TableConstructor } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import { CmsContext as BaseCmsContext, CmsEntry, CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, CmsModelFieldType, HeadlessCms, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
|
|
3
|
+
import { AttributeDefinition, Entity, Table, TableConstructor } from "@webiny/db-dynamodb/toolbox";
|
|
4
4
|
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
5
|
-
import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
|
|
6
5
|
import { Client } from "@elastic/elasticsearch";
|
|
7
|
-
import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
|
|
8
6
|
import { PluginsContainer } from "@webiny/plugins";
|
|
7
|
+
import { ElasticsearchContext } from "@webiny/api-elasticsearch/types";
|
|
9
8
|
/**
|
|
10
9
|
* A definition of the entry that is being prepared for the Elasticsearch.
|
|
11
10
|
*
|
|
@@ -148,6 +147,11 @@ export interface StorageOperationsFactoryParams {
|
|
|
148
147
|
attributes?: Record<ENTITIES, Attributes>;
|
|
149
148
|
plugins?: PluginCollection;
|
|
150
149
|
}
|
|
150
|
+
export interface CmsContext extends BaseCmsContext, ElasticsearchContext {
|
|
151
|
+
cms: HeadlessCms & {
|
|
152
|
+
storageOperations: HeadlessCmsStorageOperations;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
151
155
|
export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {
|
|
152
156
|
getTable: () => Table<string, string, string>;
|
|
153
157
|
getEsTable: () => Table<string, string, string>;
|
|
@@ -156,9 +160,6 @@ export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOper
|
|
|
156
160
|
export interface StorageOperationsFactory {
|
|
157
161
|
(params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
|
|
158
162
|
}
|
|
159
|
-
export interface CmsContext extends BaseCmsContext {
|
|
160
|
-
[key: string]: any;
|
|
161
|
-
}
|
|
162
163
|
export interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {
|
|
163
164
|
dataLoaders: DataLoadersHandlerInterface;
|
|
164
165
|
}
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import { Plugin, PluginCollection } from \"@webiny/plugins/types\";\nimport {\n CmsContext as BaseCmsContext,\n CmsEntry,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n CmsModelFieldType,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport {
|
|
1
|
+
{"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import { Plugin, PluginCollection } from \"@webiny/plugins/types\";\nimport {\n CmsContext as BaseCmsContext,\n CmsEntry,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n CmsModelFieldType,\n HeadlessCms,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport { AttributeDefinition, Entity, Table, TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { ElasticsearchContext } from \"@webiny/api-elasticsearch/types\";\n\n/**\n * A definition of the entry that is being prepared for the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\nexport interface CmsIndexEntry extends CmsEntry {\n /**\n * Values that are not going to be indexed.\n */\n rawValues: Record<string, any>;\n /**\n * A first part of the ID, without the revision.\n * For example, we can search for all the revisions of the given entry.\n */\n primaryId: string;\n /**\n * Dev can add what ever keys they want and need. Just need to be careful not to break the entry.\n */\n [key: string]: any;\n}\n\n/**\n * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\nexport interface CmsModelFieldToElasticsearchToParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n /**\n * Raw value on the entry - before prepare for storage.\n */\n rawValue: any;\n /**\n * Value prepared for storage received from base api-headless-cms package.\n */\n value: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\n/**\n * Arguments for the method that is transforming content entry from Elasticsearch into the original one.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\nexport interface CmsModelFieldToElasticsearchFromParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n value: any;\n rawValue: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\ninterface ToIndexValue {\n /**\n * Use this key to store value for indexing.\n */\n value?: any;\n /**\n * Use this key to tell ES that this value should not be indexed.\n */\n rawValue?: any;\n}\n\n/**\n * A plugin defining transformation of entry for Elasticsearch.\n *\n * @category Plugin\n * @category ContentModelField\n * @category CmsEntry\n * @category Elasticsearch\n */\nexport interface CmsModelFieldToElasticsearchPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-to-elastic-search\";\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * fieldType: \"myField\"\n * ```\n */\n fieldType: CmsModelFieldType;\n /**\n * If you need to define a type when building an Elasticsearch query.\n * Check [dateTimeIndexing](https://github.com/webiny/webiny-js/blob/3074165701b8b45e5fc6ac2444caace7d04ada66/packages/api-headless-cms/src/content/plugins/es/indexing/dateTimeIndexing.ts) plugin for usage example.\n *\n * ```ts\n * unmappedType: \"date\"\n * ```\n */\n unmappedType?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">) => string;\n /**\n * This is meant to do some transformation of the entry, preferably only to fieldType it was defined for. Nothing is stopping you to do anything you want to other fields, but try to separate field transformations.\n * It returns `Partial<CmsContentIndexEntryType>`. Always return a top-level property of the entry since it is merged via spread operator.\n *\n * ```ts\n * toIndex({ value }) {\n * return {\n * value: value, // This will be stored and indexed\n * rawValue: JSON.stringify(value) // This will be stored but excluded from indexing\n * };\n * }\n * ```\n */\n toIndex?: (params: CmsModelFieldToElasticsearchToParams) => ToIndexValue;\n /**\n * This is meant to revert a transformation done in the `toIndex` method.\n * You have access to \"value\" or a \"rawValue\", depending on what you returned from `toIndex`.\n *\n * ```ts\n * fromIndex({ value, rawValue }) {\n * return JSON.parse(rawValue);\n * }\n * ```\n */\n fromIndex?: (params: CmsModelFieldToElasticsearchFromParams) => any;\n}\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"CmsSystem\",\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBDocument;\n elasticsearch: Client;\n table?: TableModifier;\n esTable?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: PluginCollection;\n}\n\nexport interface CmsContext extends BaseCmsContext, ElasticsearchContext {\n cms: HeadlessCms & {\n storageOperations: HeadlessCmsStorageOperations;\n };\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {\n getTable: () => Table<string, string, string>;\n getEsTable: () => Table<string, string, string>;\n getEntities: () => Record<\n \"system\" | \"groups\" | \"models\" | \"entries\" | \"entriesEs\",\n Entity<any>\n >;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {\n dataLoaders: DataLoadersHandlerInterface;\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n model: Pick<CmsModel, \"tenant\" | \"locale\">;\n}\nexport interface DataLoadersHandlerInterface {\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"mappings":";;;;;;AAkBA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IA2DYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA","ignoreList":[]}
|