@webiny/api-page-builder-so-ddb-es 5.39.0 → 5.39.1-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.
@@ -1,9 +1,18 @@
1
- export interface ElasticsearchParams {
1
+ import { PbContext } from "./types";
2
+ import { ElasticsearchIndexRequestBody } from "@webiny/api-elasticsearch/types";
3
+ export interface ConfigurationsElasticsearch {
4
+ index: string;
5
+ }
6
+ export interface ConfigurationsElasticsearchParams {
2
7
  tenant: string;
3
8
  locale: string;
4
9
  }
5
- export declare const configurations: {
6
- es: (params: ElasticsearchParams) => {
7
- index: string;
8
- };
9
- };
10
+ export interface ConfigurationsIndexSettingsParams {
11
+ context: PbContext;
12
+ locale: string;
13
+ }
14
+ export interface Configurations {
15
+ es: (params: ConfigurationsElasticsearchParams) => ConfigurationsElasticsearch;
16
+ indexSettings: (params: ConfigurationsIndexSettingsParams) => Partial<ElasticsearchIndexRequestBody>;
17
+ }
18
+ export declare const configurations: Configurations;
package/configurations.js CHANGED
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.configurations = void 0;
8
8
  var _error = _interopRequireDefault(require("@webiny/error"));
9
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
10
+ var _plugins = require("./plugins");
9
11
  const configurations = {
10
12
  es: params => {
11
13
  const {
@@ -34,6 +36,17 @@ const configurations = {
34
36
  return {
35
37
  index: prefix + index
36
38
  };
39
+ },
40
+ indexSettings: ({
41
+ context,
42
+ locale
43
+ }) => {
44
+ const plugin = (0, _apiElasticsearch.getLastAddedIndexPlugin)({
45
+ container: context.plugins,
46
+ type: _plugins.PageElasticsearchIndexPlugin.type,
47
+ locale
48
+ });
49
+ return plugin ? plugin.body : {};
37
50
  }
38
51
  };
39
52
  exports.configurations = configurations;
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","configurations","es","params","tenant","locale","WebinyError","sharedIndex","process","env","ELASTICSEARCH_SHARED_INDEXES","tenantId","localeCode","WEBINY_ELASTICSEARCH_INDEX_LOCALE","index","filter","Boolean","join","toLowerCase","prefix","ELASTIC_SEARCH_INDEX_PREFIX","exports"],"sources":["configurations.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nexport interface ElasticsearchParams {\n tenant: string;\n locale: string;\n}\n\nexport const configurations = {\n es: (params: ElasticsearchParams) => {\n const { tenant, locale } = params;\n if (!tenant) {\n throw new WebinyError(\n `Missing \"tenant\" parameter when trying to create Elasticsearch index name.`,\n \"TENANT_ERROR\"\n );\n }\n const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === \"true\";\n\n const tenantId = sharedIndex ? \"root\" : tenant;\n let localeCode: string | null = null;\n if (process.env.WEBINY_ELASTICSEARCH_INDEX_LOCALE === \"true\") {\n if (!locale) {\n throw new WebinyError(\n `Missing \"locale\" parameter when trying to create Elasticsearch index name.`,\n \"LOCALE_ERROR\"\n );\n }\n localeCode = locale;\n }\n\n const index = [tenantId, localeCode, \"page-builder\"]\n .filter(Boolean)\n .join(\"-\")\n .toLowerCase();\n\n const prefix = process.env.ELASTIC_SEARCH_INDEX_PREFIX;\n if (!prefix) {\n return {\n index\n };\n }\n return {\n index: prefix + index\n };\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAOO,MAAMC,cAAc,GAAG;EAC1BC,EAAE,EAAGC,MAA2B,IAAK;IACjC,MAAM;MAAEC,MAAM;MAAEC;IAAO,CAAC,GAAGF,MAAM;IACjC,IAAI,CAACC,MAAM,EAAE;MACT,MAAM,IAAIE,cAAW,CAChB,4EAA2E,EAC5E,cACJ,CAAC;IACL;IACA,MAAMC,WAAW,GAAGC,OAAO,CAACC,GAAG,CAACC,4BAA4B,KAAK,MAAM;IAEvE,MAAMC,QAAQ,GAAGJ,WAAW,GAAG,MAAM,GAAGH,MAAM;IAC9C,IAAIQ,UAAyB,GAAG,IAAI;IACpC,IAAIJ,OAAO,CAACC,GAAG,CAACI,iCAAiC,KAAK,MAAM,EAAE;MAC1D,IAAI,CAACR,MAAM,EAAE;QACT,MAAM,IAAIC,cAAW,CAChB,4EAA2E,EAC5E,cACJ,CAAC;MACL;MACAM,UAAU,GAAGP,MAAM;IACvB;IAEA,MAAMS,KAAK,GAAG,CAACH,QAAQ,EAAEC,UAAU,EAAE,cAAc,CAAC,CAC/CG,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC,CACTC,WAAW,CAAC,CAAC;IAElB,MAAMC,MAAM,GAAGX,OAAO,CAACC,GAAG,CAACW,2BAA2B;IACtD,IAAI,CAACD,MAAM,EAAE;MACT,OAAO;QACHL;MACJ,CAAC;IACL;IACA,OAAO;MACHA,KAAK,EAAEK,MAAM,GAAGL;IACpB,CAAC;EACL;AACJ,CAAC;AAACO,OAAA,CAAApB,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_apiElasticsearch","_plugins","configurations","es","params","tenant","locale","WebinyError","sharedIndex","process","env","ELASTICSEARCH_SHARED_INDEXES","tenantId","localeCode","WEBINY_ELASTICSEARCH_INDEX_LOCALE","index","filter","Boolean","join","toLowerCase","prefix","ELASTIC_SEARCH_INDEX_PREFIX","indexSettings","context","plugin","getLastAddedIndexPlugin","container","plugins","type","PageElasticsearchIndexPlugin","body","exports"],"sources":["configurations.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { getLastAddedIndexPlugin } from \"@webiny/api-elasticsearch\";\nimport { PageElasticsearchIndexPlugin } from \"~/plugins\";\nimport { PbContext } from \"~/types\";\nimport { ElasticsearchIndexRequestBody } from \"@webiny/api-elasticsearch/types\";\n\nexport interface ConfigurationsElasticsearch {\n index: string;\n}\n\nexport interface ConfigurationsElasticsearchParams {\n tenant: string;\n locale: string;\n}\n\nexport interface ConfigurationsIndexSettingsParams {\n context: PbContext;\n locale: string;\n}\n\nexport interface Configurations {\n es: (params: ConfigurationsElasticsearchParams) => ConfigurationsElasticsearch;\n indexSettings: (\n params: ConfigurationsIndexSettingsParams\n ) => Partial<ElasticsearchIndexRequestBody>;\n}\n\nexport const configurations: Configurations = {\n es: params => {\n const { tenant, locale } = params;\n if (!tenant) {\n throw new WebinyError(\n `Missing \"tenant\" parameter when trying to create Elasticsearch index name.`,\n \"TENANT_ERROR\"\n );\n }\n const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === \"true\";\n\n const tenantId = sharedIndex ? \"root\" : tenant;\n let localeCode: string | null = null;\n if (process.env.WEBINY_ELASTICSEARCH_INDEX_LOCALE === \"true\") {\n if (!locale) {\n throw new WebinyError(\n `Missing \"locale\" parameter when trying to create Elasticsearch index name.`,\n \"LOCALE_ERROR\"\n );\n }\n localeCode = locale;\n }\n\n const index = [tenantId, localeCode, \"page-builder\"]\n .filter(Boolean)\n .join(\"-\")\n .toLowerCase();\n\n const prefix = process.env.ELASTIC_SEARCH_INDEX_PREFIX;\n if (!prefix) {\n return {\n index\n };\n }\n return {\n index: prefix + index\n };\n },\n indexSettings: ({ context, locale }) => {\n const plugin = getLastAddedIndexPlugin<PageElasticsearchIndexPlugin>({\n container: context.plugins,\n type: PageElasticsearchIndexPlugin.type,\n locale\n });\n\n return plugin ? plugin.body : {};\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAyBO,MAAMG,cAA8B,GAAG;EAC1CC,EAAE,EAAEC,MAAM,IAAI;IACV,MAAM;MAAEC,MAAM;MAAEC;IAAO,CAAC,GAAGF,MAAM;IACjC,IAAI,CAACC,MAAM,EAAE;MACT,MAAM,IAAIE,cAAW,CAChB,4EAA2E,EAC5E,cACJ,CAAC;IACL;IACA,MAAMC,WAAW,GAAGC,OAAO,CAACC,GAAG,CAACC,4BAA4B,KAAK,MAAM;IAEvE,MAAMC,QAAQ,GAAGJ,WAAW,GAAG,MAAM,GAAGH,MAAM;IAC9C,IAAIQ,UAAyB,GAAG,IAAI;IACpC,IAAIJ,OAAO,CAACC,GAAG,CAACI,iCAAiC,KAAK,MAAM,EAAE;MAC1D,IAAI,CAACR,MAAM,EAAE;QACT,MAAM,IAAIC,cAAW,CAChB,4EAA2E,EAC5E,cACJ,CAAC;MACL;MACAM,UAAU,GAAGP,MAAM;IACvB;IAEA,MAAMS,KAAK,GAAG,CAACH,QAAQ,EAAEC,UAAU,EAAE,cAAc,CAAC,CAC/CG,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC,CACTC,WAAW,CAAC,CAAC;IAElB,MAAMC,MAAM,GAAGX,OAAO,CAACC,GAAG,CAACW,2BAA2B;IACtD,IAAI,CAACD,MAAM,EAAE;MACT,OAAO;QACHL;MACJ,CAAC;IACL;IACA,OAAO;MACHA,KAAK,EAAEK,MAAM,GAAGL;IACpB,CAAC;EACL,CAAC;EACDO,aAAa,EAAEA,CAAC;IAAEC,OAAO;IAAEjB;EAAO,CAAC,KAAK;IACpC,MAAMkB,MAAM,GAAG,IAAAC,yCAAuB,EAA+B;MACjEC,SAAS,EAAEH,OAAO,CAACI,OAAO;MAC1BC,IAAI,EAAEC,qCAA4B,CAACD,IAAI;MACvCtB;IACJ,CAAC,CAAC;IAEF,OAAOkB,MAAM,GAAGA,MAAM,CAACM,IAAI,GAAG,CAAC,CAAC;EACpC;AACJ,CAAC;AAACC,OAAA,CAAA7B,cAAA,GAAAA,cAAA"}
package/index.js CHANGED
@@ -54,6 +54,7 @@ Object.keys(_plugins2).forEach(function (key) {
54
54
  }
55
55
  });
56
56
  });
57
+ var _createIndexTaskPlugin = require("./tasks/createIndexTaskPlugin");
57
58
  const createStorageOperations = params => {
58
59
  const {
59
60
  documentClient,
@@ -197,6 +198,7 @@ const createStorageOperations = params => {
197
198
  pageBlocks.dataLoader.clear();
198
199
  blockCategories.dataLoader.clear();
199
200
  categories.dataLoader.clear();
201
+ context.plugins.register([(0, _createIndexTaskPlugin.createIndexTaskPlugin)(), (0, _indices.elasticsearchIndexPlugins)()]);
200
202
  },
201
203
  init: async context => {
202
204
  context.i18n.locales.onLocaleBeforeCreate.subscribe(async ({
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_filters","_interopRequireDefault","require","_plugins","_apiElasticsearch","_types","_table","_tableElasticsearch","_indices","_createElasticsearchIndex","_categoryEntity","_fields","_category","_menuEntity","_fields2","_menu","_pageElementEntity","_fields3","_pageElement","_settingsEntity","_settings","_systemEntity","_system","_pageEntity","_fields4","_pages","_pageElasticsearchEntity","_blockCategoryEntity","_fields5","_blockCategory","_pageBlockEntity","_fields6","_pageBlock","_pageTemplateEntity","_fields7","_pageTemplate","_plugins2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","createStorageOperations","params","documentClient","elasticsearch","table","esTable","attributes","plugins","userPlugins","tableInstance","createTable","tableElasticsearchInstance","createElasticsearchTable","PluginsContainer","dynamoDbValueFilters","createCategoryDynamoDbFields","createMenuDynamoDbFields","createPageElementDynamoDbFields","createPagesElasticsearchFields","createPagesDynamoDbFields","elasticsearchIndexPlugins","createBlockCategoryDynamoDbFields","createPageBlockDynamoDbFields","createPageTemplateDynamoDbFields","entities","settings","createSettingsEntity","entityName","ENTITIES","SETTINGS","system","createSystemEntity","SYSTEM","categories","createCategoryEntity","CATEGORIES","menus","createMenuEntity","MENUS","pageElements","createPageElementEntity","PAGE_ELEMENTS","pages","createPageEntity","PAGES","pagesEs","createPageElasticsearchEntity","PAGES_ES","blockCategories","createBlockCategoryEntity","BLOCK_CATEGORIES","pageBlocks","createPageBlockEntity","PAGE_BLOCKS","pageTemplates","createPageTemplateEntity","PAGE_TEMPLATES","createCategoryStorageOperations","entity","createBlockCategoryStorageOperations","createPageBlockStorageOperations","createPageTemplateStorageOperations","beforeInit","context","types","CompressionPlugin","type","ElasticsearchQueryBuilderOperatorPlugin","BlockCategoryDynamoDbElasticFieldPlugin","CategoryDynamoDbElasticFieldPlugin","IndexPageDataPlugin","MenuDynamoDbElasticFieldPlugin","PageBlockDynamoDbFieldPlugin","PageDynamoDbElasticsearchFieldPlugin","PageElasticsearchBodyModifierPlugin","PageElasticsearchFieldPlugin","PageElasticsearchIndexPlugin","PageElasticsearchQueryModifierPlugin","PageElasticsearchSortModifierPlugin","PageElementDynamoDbElasticFieldPlugin","SearchLatestPagesPlugin","SearchPagesPlugin","SearchPublishedPagesPlugin","mergeByType","dataLoader","clear","init","i18n","locales","onLocaleBeforeCreate","subscribe","locale","tenant","createElasticsearchIndex","code","getEntities","getTable","getEsTable","createSystemStorageOperations","createSettingsStorageOperations","createMenuStorageOperations","createPageElementStorageOperations","createPageStorageOperations","esEntity"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport {\n CompressionPlugin,\n ElasticsearchQueryBuilderOperatorPlugin\n} from \"@webiny/api-elasticsearch\";\n\nimport { ENTITIES, StorageOperationsFactory } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createElasticsearchTable } from \"~/definitions/tableElasticsearch\";\nimport { elasticsearchIndexPlugins } from \"~/elasticsearch/indices\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\n\nimport { createCategoryEntity } from \"~/definitions/categoryEntity\";\nimport { createCategoryDynamoDbFields } from \"~/operations/category/fields\";\nimport { createCategoryStorageOperations } from \"~/operations/category\";\n\nimport { createMenuEntity } from \"~/definitions/menuEntity\";\nimport { createMenuDynamoDbFields } from \"~/operations/menu/fields\";\nimport { createMenuStorageOperations } from \"~/operations/menu\";\n\nimport { createPageElementEntity } from \"~/definitions/pageElementEntity\";\nimport { createPageElementDynamoDbFields } from \"~/operations/pageElement/fields\";\nimport { createPageElementStorageOperations } from \"~/operations/pageElement\";\n\nimport { createSettingsEntity } from \"~/definitions/settingsEntity\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\n\nimport { createSystemEntity } from \"~/definitions/systemEntity\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\n\nimport { createPageEntity } from \"~/definitions/pageEntity\";\nimport {\n createPagesDynamoDbFields,\n createPagesElasticsearchFields\n} from \"~/operations/pages/fields\";\nimport { createPageStorageOperations } from \"~/operations/pages\";\nimport { createPageElasticsearchEntity } from \"~/definitions/pageElasticsearchEntity\";\n\nimport { createBlockCategoryEntity } from \"~/definitions/blockCategoryEntity\";\nimport { createBlockCategoryDynamoDbFields } from \"~/operations/blockCategory/fields\";\nimport { createBlockCategoryStorageOperations } from \"~/operations/blockCategory\";\n\nimport { createPageBlockEntity } from \"~/definitions/pageBlockEntity\";\nimport { createPageBlockDynamoDbFields } from \"~/operations/pageBlock/fields\";\nimport { createPageBlockStorageOperations } from \"~/operations/pageBlock\";\n\nimport { createPageTemplateEntity } from \"~/definitions/pageTemplateEntity\";\nimport { createPageTemplateDynamoDbFields } from \"~/operations/pageTemplate/fields\";\nimport { createPageTemplateStorageOperations } from \"~/operations/pageTemplate\";\n\nimport { PbContext } from \"@webiny/api-page-builder/types\";\nimport {\n BlockCategoryDynamoDbElasticFieldPlugin,\n CategoryDynamoDbElasticFieldPlugin,\n IndexPageDataPlugin,\n MenuDynamoDbElasticFieldPlugin,\n PageBlockDynamoDbFieldPlugin,\n PageDynamoDbElasticsearchFieldPlugin,\n PageElasticsearchBodyModifierPlugin,\n PageElasticsearchFieldPlugin,\n PageElasticsearchIndexPlugin,\n PageElasticsearchQueryModifierPlugin,\n PageElasticsearchSortModifierPlugin,\n PageElementDynamoDbElasticFieldPlugin,\n SearchLatestPagesPlugin,\n SearchPagesPlugin,\n SearchPublishedPagesPlugin\n} from \"./plugins\";\n\nexport * from \"./plugins\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const {\n documentClient,\n elasticsearch,\n table,\n esTable,\n attributes,\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 plugins = new PluginsContainer([\n /**\n * User defined custom plugins.\n */\n ...(userPlugins || []),\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Category fields required for filtering/sorting.\n */\n createCategoryDynamoDbFields(),\n /**\n * Menu fields required for filtering/sorting.\n */\n createMenuDynamoDbFields(),\n /**\n * Page element fields required for filtering/sorting.\n */\n createPageElementDynamoDbFields(),\n /**\n * Page fields required for filtering/sorting.\n */\n createPagesElasticsearchFields(),\n /**\n * Page fields required for filtering/sorting when using dynamodb.\n */\n createPagesDynamoDbFields(),\n /**\n * Built-in Elasticsearch index templates\n */\n elasticsearchIndexPlugins(),\n /**\n * Block Category fields required for filtering/sorting.\n */\n createBlockCategoryDynamoDbFields(),\n /**\n * Page Block fields required for filtering/sorting.\n */\n createPageBlockDynamoDbFields(),\n /**\n * Page Template fields required for filtering/sorting.\n */\n createPageTemplateDynamoDbFields()\n ]);\n\n const entities = {\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table: tableInstance\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n categories: createCategoryEntity({\n entityName: ENTITIES.CATEGORIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.CATEGORIES] : {}\n }),\n menus: createMenuEntity({\n entityName: ENTITIES.MENUS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.MENUS] : {}\n }),\n pageElements: createPageElementEntity({\n entityName: ENTITIES.PAGE_ELEMENTS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.PAGE_ELEMENTS] : {}\n }),\n pages: createPageEntity({\n entityName: ENTITIES.PAGES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.PAGES] : {}\n }),\n pagesEs: createPageElasticsearchEntity({\n entityName: ENTITIES.PAGES_ES,\n table: tableElasticsearchInstance,\n attributes: attributes ? attributes[ENTITIES.PAGES_ES] : {}\n }),\n blockCategories: createBlockCategoryEntity({\n entityName: ENTITIES.BLOCK_CATEGORIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.BLOCK_CATEGORIES] : {}\n }),\n pageBlocks: createPageBlockEntity({\n entityName: ENTITIES.PAGE_BLOCKS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.PAGE_BLOCKS] : {}\n }),\n pageTemplates: createPageTemplateEntity({\n entityName: ENTITIES.PAGE_TEMPLATES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.PAGE_TEMPLATES] : {}\n })\n };\n\n const categories = createCategoryStorageOperations({\n entity: entities.categories,\n plugins\n });\n const blockCategories = createBlockCategoryStorageOperations({\n entity: entities.blockCategories,\n plugins\n });\n const pageBlocks = createPageBlockStorageOperations({\n entity: entities.pageBlocks,\n plugins\n });\n const pageTemplates = createPageTemplateStorageOperations({\n entity: entities.pageTemplates,\n plugins\n });\n\n return {\n beforeInit: async (context: PbContext) => {\n const types: string[] = [\n // Elasticsearch\n CompressionPlugin.type,\n ElasticsearchQueryBuilderOperatorPlugin.type,\n // Page Builder\n BlockCategoryDynamoDbElasticFieldPlugin.type,\n CategoryDynamoDbElasticFieldPlugin.type,\n IndexPageDataPlugin.type,\n MenuDynamoDbElasticFieldPlugin.type,\n PageBlockDynamoDbFieldPlugin.type,\n PageDynamoDbElasticsearchFieldPlugin.type,\n PageElasticsearchBodyModifierPlugin.type,\n PageElasticsearchFieldPlugin.type,\n PageElasticsearchIndexPlugin.type,\n PageElasticsearchQueryModifierPlugin.type,\n PageElasticsearchSortModifierPlugin.type,\n PageElementDynamoDbElasticFieldPlugin.type,\n SearchLatestPagesPlugin.type,\n SearchPagesPlugin.type,\n SearchPublishedPagesPlugin.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n pageTemplates.dataLoader.clear();\n pageBlocks.dataLoader.clear();\n blockCategories.dataLoader.clear();\n categories.dataLoader.clear();\n },\n init: async (context: PbContext) => {\n context.i18n.locales.onLocaleBeforeCreate.subscribe(async ({ locale, tenant }) => {\n await createElasticsearchIndex({\n elasticsearch,\n plugins,\n locale: locale.code,\n tenant\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 menus: createMenuStorageOperations({\n entity: entities.menus,\n plugins\n }),\n pageElements: createPageElementStorageOperations({\n entity: entities.pageElements,\n plugins\n }),\n pages: createPageStorageOperations({\n entity: entities.pages,\n esEntity: entities.pagesEs,\n elasticsearch,\n plugins\n }),\n categories,\n blockCategories,\n pageBlocks,\n pageTemplates\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,yBAAA,GAAAP,OAAA;AAEA,IAAAQ,eAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAEA,IAAAW,WAAA,GAAAX,OAAA;AACA,IAAAY,QAAA,GAAAZ,OAAA;AACA,IAAAa,KAAA,GAAAb,OAAA;AAEA,IAAAc,kBAAA,GAAAd,OAAA;AACA,IAAAe,QAAA,GAAAf,OAAA;AACA,IAAAgB,YAAA,GAAAhB,OAAA;AAEA,IAAAiB,eAAA,GAAAjB,OAAA;AACA,IAAAkB,SAAA,GAAAlB,OAAA;AAEA,IAAAmB,aAAA,GAAAnB,OAAA;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C,QAAQ,CAACe,YAAY;MAC7BhC;IACJ,CAAC,CAAC;IACFmC,KAAK,EAAE,IAAA4D,kCAA2B,EAAC;MAC/B5C,MAAM,EAAElC,QAAQ,CAACkB,KAAK;MACtB6D,QAAQ,EAAE/E,QAAQ,CAACqB,OAAO;MAC1B1C,aAAa;MACbI;IACJ,CAAC,CAAC;IACF0B,UAAU;IACVe,eAAe;IACfG,UAAU;IACVG;EACJ,CAAC;AACL,CAAC;AAAC1D,OAAA,CAAAI,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_filters","_interopRequireDefault","require","_plugins","_apiElasticsearch","_types","_table","_tableElasticsearch","_indices","_createElasticsearchIndex","_categoryEntity","_fields","_category","_menuEntity","_fields2","_menu","_pageElementEntity","_fields3","_pageElement","_settingsEntity","_settings","_systemEntity","_system","_pageEntity","_fields4","_pages","_pageElasticsearchEntity","_blockCategoryEntity","_fields5","_blockCategory","_pageBlockEntity","_fields6","_pageBlock","_pageTemplateEntity","_fields7","_pageTemplate","_plugins2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_createIndexTaskPlugin","createStorageOperations","params","documentClient","elasticsearch","table","esTable","attributes","plugins","userPlugins","tableInstance","createTable","tableElasticsearchInstance","createElasticsearchTable","PluginsContainer","dynamoDbValueFilters","createCategoryDynamoDbFields","createMenuDynamoDbFields","createPageElementDynamoDbFields","createPagesElasticsearchFields","createPagesDynamoDbFields","elasticsearchIndexPlugins","createBlockCategoryDynamoDbFields","createPageBlockDynamoDbFields","createPageTemplateDynamoDbFields","entities","settings","createSettingsEntity","entityName","ENTITIES","SETTINGS","system","createSystemEntity","SYSTEM","categories","createCategoryEntity","CATEGORIES","menus","createMenuEntity","MENUS","pageElements","createPageElementEntity","PAGE_ELEMENTS","pages","createPageEntity","PAGES","pagesEs","createPageElasticsearchEntity","PAGES_ES","blockCategories","createBlockCategoryEntity","BLOCK_CATEGORIES","pageBlocks","createPageBlockEntity","PAGE_BLOCKS","pageTemplates","createPageTemplateEntity","PAGE_TEMPLATES","createCategoryStorageOperations","entity","createBlockCategoryStorageOperations","createPageBlockStorageOperations","createPageTemplateStorageOperations","beforeInit","context","types","CompressionPlugin","type","ElasticsearchQueryBuilderOperatorPlugin","BlockCategoryDynamoDbElasticFieldPlugin","CategoryDynamoDbElasticFieldPlugin","IndexPageDataPlugin","MenuDynamoDbElasticFieldPlugin","PageBlockDynamoDbFieldPlugin","PageDynamoDbElasticsearchFieldPlugin","PageElasticsearchBodyModifierPlugin","PageElasticsearchFieldPlugin","PageElasticsearchIndexPlugin","PageElasticsearchQueryModifierPlugin","PageElasticsearchSortModifierPlugin","PageElementDynamoDbElasticFieldPlugin","SearchLatestPagesPlugin","SearchPagesPlugin","SearchPublishedPagesPlugin","mergeByType","dataLoader","clear","register","createIndexTaskPlugin","init","i18n","locales","onLocaleBeforeCreate","subscribe","locale","tenant","createElasticsearchIndex","code","getEntities","getTable","getEsTable","createSystemStorageOperations","createSettingsStorageOperations","createMenuStorageOperations","createPageElementStorageOperations","createPageStorageOperations","esEntity"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport {\n CompressionPlugin,\n ElasticsearchQueryBuilderOperatorPlugin\n} from \"@webiny/api-elasticsearch\";\n\nimport { ENTITIES, StorageOperationsFactory } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createElasticsearchTable } from \"~/definitions/tableElasticsearch\";\nimport { elasticsearchIndexPlugins } from \"~/elasticsearch/indices\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\n\nimport { createCategoryEntity } from \"~/definitions/categoryEntity\";\nimport { createCategoryDynamoDbFields } from \"~/operations/category/fields\";\nimport { createCategoryStorageOperations } from \"~/operations/category\";\n\nimport { createMenuEntity } from \"~/definitions/menuEntity\";\nimport { createMenuDynamoDbFields } from \"~/operations/menu/fields\";\nimport { createMenuStorageOperations } from \"~/operations/menu\";\n\nimport { createPageElementEntity } from \"~/definitions/pageElementEntity\";\nimport { createPageElementDynamoDbFields } from \"~/operations/pageElement/fields\";\nimport { createPageElementStorageOperations } from \"~/operations/pageElement\";\n\nimport { createSettingsEntity } from \"~/definitions/settingsEntity\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\n\nimport { createSystemEntity } from \"~/definitions/systemEntity\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\n\nimport { createPageEntity } from \"~/definitions/pageEntity\";\nimport {\n createPagesDynamoDbFields,\n createPagesElasticsearchFields\n} from \"~/operations/pages/fields\";\nimport { createPageStorageOperations } from \"~/operations/pages\";\nimport { createPageElasticsearchEntity } from \"~/definitions/pageElasticsearchEntity\";\n\nimport { createBlockCategoryEntity } from \"~/definitions/blockCategoryEntity\";\nimport { createBlockCategoryDynamoDbFields } from \"~/operations/blockCategory/fields\";\nimport { createBlockCategoryStorageOperations } from \"~/operations/blockCategory\";\n\nimport { createPageBlockEntity } from \"~/definitions/pageBlockEntity\";\nimport { createPageBlockDynamoDbFields } from \"~/operations/pageBlock/fields\";\nimport { createPageBlockStorageOperations } from \"~/operations/pageBlock\";\n\nimport { createPageTemplateEntity } from \"~/definitions/pageTemplateEntity\";\nimport { createPageTemplateDynamoDbFields } from \"~/operations/pageTemplate/fields\";\nimport { createPageTemplateStorageOperations } from \"~/operations/pageTemplate\";\n\nimport { PbContext } from \"@webiny/api-page-builder/types\";\nimport {\n BlockCategoryDynamoDbElasticFieldPlugin,\n CategoryDynamoDbElasticFieldPlugin,\n IndexPageDataPlugin,\n MenuDynamoDbElasticFieldPlugin,\n PageBlockDynamoDbFieldPlugin,\n PageDynamoDbElasticsearchFieldPlugin,\n PageElasticsearchBodyModifierPlugin,\n PageElasticsearchFieldPlugin,\n PageElasticsearchIndexPlugin,\n PageElasticsearchQueryModifierPlugin,\n PageElasticsearchSortModifierPlugin,\n PageElementDynamoDbElasticFieldPlugin,\n SearchLatestPagesPlugin,\n SearchPagesPlugin,\n SearchPublishedPagesPlugin\n} from \"./plugins\";\nimport { createIndexTaskPlugin } from \"~/tasks/createIndexTaskPlugin\";\n\nexport * from \"./plugins\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const {\n documentClient,\n elasticsearch,\n table,\n esTable,\n attributes,\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 plugins = new PluginsContainer([\n /**\n * User defined custom plugins.\n */\n ...(userPlugins || []),\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Category fields required for filtering/sorting.\n */\n createCategoryDynamoDbFields(),\n /**\n * Menu fields required for filtering/sorting.\n */\n createMenuDynamoDbFields(),\n /**\n * Page element fields required for filtering/sorting.\n */\n createPageElementDynamoDbFields(),\n /**\n * Page fields required for filtering/sorting.\n */\n createPagesElasticsearchFields(),\n /**\n * Page fields required for filtering/sorting when using dynamodb.\n */\n createPagesDynamoDbFields(),\n /**\n * Built-in Elasticsearch index templates\n */\n elasticsearchIndexPlugins(),\n /**\n * Block Category fields required for filtering/sorting.\n */\n createBlockCategoryDynamoDbFields(),\n /**\n * Page Block fields required for filtering/sorting.\n */\n createPageBlockDynamoDbFields(),\n /**\n * Page Template fields required for filtering/sorting.\n */\n createPageTemplateDynamoDbFields()\n ]);\n\n const entities = {\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table: tableInstance\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n categories: createCategoryEntity({\n entityName: ENTITIES.CATEGORIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.CATEGORIES] : {}\n }),\n menus: createMenuEntity({\n entityName: ENTITIES.MENUS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.MENUS] : {}\n }),\n pageElements: createPageElementEntity({\n entityName: ENTITIES.PAGE_ELEMENTS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.PAGE_ELEMENTS] : {}\n }),\n pages: createPageEntity({\n entityName: ENTITIES.PAGES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.PAGES] : {}\n }),\n pagesEs: createPageElasticsearchEntity({\n entityName: ENTITIES.PAGES_ES,\n table: tableElasticsearchInstance,\n attributes: attributes ? attributes[ENTITIES.PAGES_ES] : {}\n }),\n blockCategories: createBlockCategoryEntity({\n entityName: ENTITIES.BLOCK_CATEGORIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.BLOCK_CATEGORIES] : {}\n }),\n pageBlocks: createPageBlockEntity({\n entityName: ENTITIES.PAGE_BLOCKS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.PAGE_BLOCKS] : {}\n }),\n pageTemplates: createPageTemplateEntity({\n entityName: ENTITIES.PAGE_TEMPLATES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.PAGE_TEMPLATES] : {}\n })\n };\n\n const categories = createCategoryStorageOperations({\n entity: entities.categories,\n plugins\n });\n const blockCategories = createBlockCategoryStorageOperations({\n entity: entities.blockCategories,\n plugins\n });\n const pageBlocks = createPageBlockStorageOperations({\n entity: entities.pageBlocks,\n plugins\n });\n const pageTemplates = createPageTemplateStorageOperations({\n entity: entities.pageTemplates,\n plugins\n });\n\n return {\n beforeInit: async (context: PbContext) => {\n const types: string[] = [\n // Elasticsearch\n CompressionPlugin.type,\n ElasticsearchQueryBuilderOperatorPlugin.type,\n // Page Builder\n BlockCategoryDynamoDbElasticFieldPlugin.type,\n CategoryDynamoDbElasticFieldPlugin.type,\n IndexPageDataPlugin.type,\n MenuDynamoDbElasticFieldPlugin.type,\n PageBlockDynamoDbFieldPlugin.type,\n PageDynamoDbElasticsearchFieldPlugin.type,\n PageElasticsearchBodyModifierPlugin.type,\n PageElasticsearchFieldPlugin.type,\n PageElasticsearchIndexPlugin.type,\n PageElasticsearchQueryModifierPlugin.type,\n PageElasticsearchSortModifierPlugin.type,\n PageElementDynamoDbElasticFieldPlugin.type,\n SearchLatestPagesPlugin.type,\n SearchPagesPlugin.type,\n SearchPublishedPagesPlugin.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n pageTemplates.dataLoader.clear();\n pageBlocks.dataLoader.clear();\n blockCategories.dataLoader.clear();\n categories.dataLoader.clear();\n\n context.plugins.register([createIndexTaskPlugin(), elasticsearchIndexPlugins()]);\n },\n init: async (context: PbContext) => {\n context.i18n.locales.onLocaleBeforeCreate.subscribe(async ({ locale, tenant }) => {\n await createElasticsearchIndex({\n elasticsearch,\n plugins,\n locale: locale.code,\n tenant\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 menus: createMenuStorageOperations({\n entity: entities.menus,\n plugins\n }),\n pageElements: createPageElementStorageOperations({\n entity: entities.pageElements,\n plugins\n }),\n pages: createPageStorageOperations({\n entity: entities.pages,\n esEntity: entities.pagesEs,\n elasticsearch,\n plugins\n }),\n categories,\n blockCategories,\n pageBlocks,\n pageTemplates\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,yBAAA,GAAAP,OAAA;AAEA,IAAAQ,eAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAEA,IAAAW,WAAA,GAAAX,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Q,EAAEA,CAAA,KAAMzF,aAAa;IAC7B0F,UAAU,EAAEA,CAAA,KAAMxF,0BAA0B;IAC5CmB,MAAM,EAAE,IAAAsE,qCAA6B,EAAC;MAClC1C,MAAM,EAAElC,QAAQ,CAACM;IACrB,CAAC,CAAC;IACFL,QAAQ,EAAE,IAAA4E,yCAA+B,EAAC;MACtC3C,MAAM,EAAElC,QAAQ,CAACC;IACrB,CAAC,CAAC;IACFW,KAAK,EAAE,IAAAkE,iCAA2B,EAAC;MAC/B5C,MAAM,EAAElC,QAAQ,CAACY,KAAK;MACtB7B;IACJ,CAAC,CAAC;IACFgC,YAAY,EAAE,IAAAgE,+CAAkC,EAAC;MAC7C7C,MAAM,EAAElC,QAAQ,CAACe,YAAY;MAC7BhC;IACJ,CAAC,CAAC;IACFmC,KAAK,EAAE,IAAA8D,kCAA2B,EAAC;MAC/B9C,MAAM,EAAElC,QAAQ,CAACkB,KAAK;MACtB+D,QAAQ,EAAEjF,QAAQ,CAACqB,OAAO;MAC1B1C,aAAa;MACbI;IACJ,CAAC,CAAC;IACF0B,UAAU;IACVe,eAAe;IACfG,UAAU;IACVG;EACJ,CAAC;AACL,CAAC;AAAC3D,OAAA,CAAAK,uBAAA,GAAAA,uBAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-page-builder-so-ddb-es",
3
- "version": "5.39.0",
3
+ "version": "5.39.1-beta.1",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-page-builder",
@@ -23,14 +23,15 @@
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
25
  "@babel/runtime": "7.22.6",
26
- "@webiny/api-elasticsearch": "5.39.0",
27
- "@webiny/api-page-builder": "5.39.0",
28
- "@webiny/aws-sdk": "5.39.0",
29
- "@webiny/db-dynamodb": "5.39.0",
30
- "@webiny/error": "5.39.0",
31
- "@webiny/handler-db": "5.39.0",
32
- "@webiny/plugins": "5.39.0",
33
- "@webiny/utils": "5.39.0",
26
+ "@webiny/api-elasticsearch": "5.39.1-beta.1",
27
+ "@webiny/api-elasticsearch-tasks": "5.39.1-beta.1",
28
+ "@webiny/api-page-builder": "5.39.1-beta.1",
29
+ "@webiny/aws-sdk": "5.39.1-beta.1",
30
+ "@webiny/db-dynamodb": "5.39.1-beta.1",
31
+ "@webiny/error": "5.39.1-beta.1",
32
+ "@webiny/handler-db": "5.39.1-beta.1",
33
+ "@webiny/plugins": "5.39.1-beta.1",
34
+ "@webiny/utils": "5.39.1-beta.1",
34
35
  "dataloader": "2.2.1",
35
36
  "elastic-ts": "0.8.0",
36
37
  "lodash": "4.17.21"
@@ -42,25 +43,25 @@
42
43
  "@babel/preset-typescript": "7.22.5",
43
44
  "@elastic/elasticsearch": "7.12.0",
44
45
  "@elastic/elasticsearch-mock": "0.3.0",
45
- "@webiny/api": "5.39.0",
46
- "@webiny/api-aco": "5.39.0",
47
- "@webiny/api-dynamodb-to-elasticsearch": "5.39.0",
48
- "@webiny/api-headless-cms": "5.39.0",
49
- "@webiny/api-headless-cms-ddb-es": "5.39.0",
50
- "@webiny/api-i18n": "5.39.0",
51
- "@webiny/api-i18n-ddb": "5.39.0",
52
- "@webiny/api-page-builder-aco": "5.39.0",
53
- "@webiny/api-prerendering-service": "5.39.0",
54
- "@webiny/api-security": "5.39.0",
55
- "@webiny/api-security-so-ddb": "5.39.0",
56
- "@webiny/api-tenancy": "5.39.0",
57
- "@webiny/api-tenancy-so-ddb": "5.39.0",
58
- "@webiny/api-wcp": "5.39.0",
59
- "@webiny/cli": "5.39.0",
60
- "@webiny/handler": "5.39.0",
61
- "@webiny/handler-aws": "5.39.0",
62
- "@webiny/handler-graphql": "5.39.0",
63
- "@webiny/project-utils": "5.39.0",
46
+ "@webiny/api": "5.39.1-beta.1",
47
+ "@webiny/api-aco": "5.39.1-beta.1",
48
+ "@webiny/api-dynamodb-to-elasticsearch": "5.39.1-beta.1",
49
+ "@webiny/api-headless-cms": "5.39.1-beta.1",
50
+ "@webiny/api-headless-cms-ddb-es": "5.39.1-beta.1",
51
+ "@webiny/api-i18n": "5.39.1-beta.1",
52
+ "@webiny/api-i18n-ddb": "5.39.1-beta.1",
53
+ "@webiny/api-page-builder-aco": "5.39.1-beta.1",
54
+ "@webiny/api-prerendering-service": "5.39.1-beta.1",
55
+ "@webiny/api-security": "5.39.1-beta.1",
56
+ "@webiny/api-security-so-ddb": "5.39.1-beta.1",
57
+ "@webiny/api-tenancy": "5.39.1-beta.1",
58
+ "@webiny/api-tenancy-so-ddb": "5.39.1-beta.1",
59
+ "@webiny/api-wcp": "5.39.1-beta.1",
60
+ "@webiny/cli": "5.39.1-beta.1",
61
+ "@webiny/handler": "5.39.1-beta.1",
62
+ "@webiny/handler-aws": "5.39.1-beta.1",
63
+ "@webiny/handler-graphql": "5.39.1-beta.1",
64
+ "@webiny/project-utils": "5.39.1-beta.1",
64
65
  "graphql": "15.8.0",
65
66
  "jest": "29.5.0",
66
67
  "jest-dynalite": "3.6.1",
@@ -76,5 +77,5 @@
76
77
  "build": "yarn webiny run build",
77
78
  "watch": "yarn webiny run watch"
78
79
  },
79
- "gitHead": "3846541fd9c1764e6a8041f0b4208d720eb9c314"
80
+ "gitHead": "6fc74b45740bd4123dcf9b5890bfacee594208bf"
80
81
  }
@@ -0,0 +1,2 @@
1
+ import { PbContext } from "../types";
2
+ export declare const createIndexTaskPlugin: () => import("@webiny/api-elasticsearch-tasks").CreateElasticsearchIndexTaskPlugin<PbContext>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createIndexTaskPlugin = void 0;
7
+ var _apiElasticsearchTasks = require("@webiny/api-elasticsearch-tasks");
8
+ var _configurations = require("../configurations");
9
+ const createIndexTaskPlugin = () => {
10
+ return (0, _apiElasticsearchTasks.createElasticsearchIndexTaskPlugin)({
11
+ name: "elasticsearch.pageBuilder.createIndexTaskPlugin",
12
+ getIndexList: async params => {
13
+ const {
14
+ context,
15
+ tenant,
16
+ locale
17
+ } = params;
18
+ const {
19
+ index
20
+ } = _configurations.configurations.es({
21
+ tenant,
22
+ locale
23
+ });
24
+ return [{
25
+ index,
26
+ settings: _configurations.configurations.indexSettings({
27
+ context,
28
+ locale
29
+ })
30
+ }];
31
+ }
32
+ });
33
+ };
34
+ exports.createIndexTaskPlugin = createIndexTaskPlugin;
35
+
36
+ //# sourceMappingURL=createIndexTaskPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_apiElasticsearchTasks","require","_configurations","createIndexTaskPlugin","createElasticsearchIndexTaskPlugin","name","getIndexList","params","context","tenant","locale","index","configurations","es","settings","indexSettings","exports"],"sources":["createIndexTaskPlugin.ts"],"sourcesContent":["import { createElasticsearchIndexTaskPlugin } from \"@webiny/api-elasticsearch-tasks\";\nimport { configurations } from \"~/configurations\";\nimport { PbContext } from \"~/types\";\n\nexport const createIndexTaskPlugin = () => {\n return createElasticsearchIndexTaskPlugin<PbContext>({\n name: \"elasticsearch.pageBuilder.createIndexTaskPlugin\",\n getIndexList: async params => {\n const { context, tenant, locale } = params;\n\n const { index } = configurations.es({\n tenant,\n locale\n });\n return [\n {\n index,\n settings: configurations.indexSettings({\n context,\n locale\n })\n }\n ];\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAGO,MAAME,qBAAqB,GAAGA,CAAA,KAAM;EACvC,OAAO,IAAAC,yDAAkC,EAAY;IACjDC,IAAI,EAAE,iDAAiD;IACvDC,YAAY,EAAE,MAAMC,MAAM,IAAI;MAC1B,MAAM;QAAEC,OAAO;QAAEC,MAAM;QAAEC;MAAO,CAAC,GAAGH,MAAM;MAE1C,MAAM;QAAEI;MAAM,CAAC,GAAGC,8BAAc,CAACC,EAAE,CAAC;QAChCJ,MAAM;QACNC;MACJ,CAAC,CAAC;MACF,OAAO,CACH;QACIC,KAAK;QACLG,QAAQ,EAAEF,8BAAc,CAACG,aAAa,CAAC;UACnCP,OAAO;UACPE;QACJ,CAAC;MACL,CAAC,CACJ;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAACM,OAAA,CAAAb,qBAAA,GAAAA,qBAAA"}
package/types.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { BlockCategoryStorageOperations as BaseBlockCategoryStorageOperations, CategoryStorageOperations as BaseCategoryStorageOperations, PageBlockStorageOperations as BasePageBlockStorageOperations, PageBuilderStorageOperations as BasePageBuilderStorageOperations, PageTemplateStorageOperations as BasePageTemplateStorageOperations } from "@webiny/api-page-builder/types";
1
+ import { BlockCategoryStorageOperations as BaseBlockCategoryStorageOperations, CategoryStorageOperations as BaseCategoryStorageOperations, PageBlockStorageOperations as BasePageBlockStorageOperations, PageBuilderStorageOperations as BasePageBuilderStorageOperations, PageTemplateStorageOperations as BasePageTemplateStorageOperations, PbContext } from "@webiny/api-page-builder/types";
2
2
  import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
3
3
  import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
4
4
  import { Client } from "@elastic/elasticsearch";
5
5
  import { PluginCollection } from "@webiny/plugins/types";
6
6
  import { TableConstructor } from "@webiny/db-dynamodb/toolbox";
7
7
  import { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
8
+ export { PbContext };
8
9
  export declare type Attributes = Record<string, AttributeDefinition>;
9
10
  export declare enum ENTITIES {
10
11
  SYSTEM = "PbSystem",
package/types.js CHANGED
@@ -4,6 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ENTITIES = void 0;
7
+ Object.defineProperty(exports, "PbContext", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _types.PbContext;
11
+ }
12
+ });
13
+ var _types = require("@webiny/api-page-builder/types");
7
14
  let ENTITIES = /*#__PURE__*/function (ENTITIES) {
8
15
  ENTITIES["SYSTEM"] = "PbSystem";
9
16
  ENTITIES["SETTINGS"] = "PbSettings";
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import {\n BlockCategoryStorageOperations as BaseBlockCategoryStorageOperations,\n CategoryStorageOperations as BaseCategoryStorageOperations,\n PageBlockStorageOperations as BasePageBlockStorageOperations,\n PageBuilderStorageOperations as BasePageBuilderStorageOperations,\n PageTemplateStorageOperations as BasePageTemplateStorageOperations\n} from \"@webiny/api-page-builder/types\";\nimport { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { DynamoDBClient } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { PluginCollection } from \"@webiny/plugins/types\";\nimport { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport { AttributeDefinition } from \"@webiny/db-dynamodb/toolbox\";\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"PbSystem\",\n SETTINGS = \"PbSettings\",\n CATEGORIES = \"PbCategories\",\n MENUS = \"PbMenus\",\n PAGE_ELEMENTS = \"PbPageElements\",\n PAGES = \"PbPages\",\n PAGES_ES = \"PbPagesEs\",\n BLOCK_CATEGORIES = \"PbBlockCategories\",\n PAGE_BLOCKS = \"PbPageBlocks\",\n PAGE_TEMPLATES = \"PbPageTemplates\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;\n}\n\nexport interface PageBuilderStorageOperations extends BasePageBuilderStorageOperations {\n getTable: () => Table<string, string, string>;\n getEsTable: () => Table<string, string, string>;\n getEntities: () => Record<\n | \"system\"\n | \"settings\"\n | \"categories\"\n | \"menus\"\n | \"pageElements\"\n | \"pages\"\n | \"pagesEs\"\n | \"blockCategories\"\n | \"pageBlocks\"\n | \"pageTemplates\",\n Entity<any>\n >;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBClient;\n elasticsearch: Client;\n table?: TableModifier;\n esTable?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: PluginCollection;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): PageBuilderStorageOperations;\n}\n\nexport interface DataContainer<T> {\n PK: string;\n SK: string;\n TYPE: string;\n data: T;\n}\n\nexport interface DataLoaderInterface {\n clear: () => void;\n}\n\nexport interface PageTemplateStorageOperations extends BasePageTemplateStorageOperations {\n dataLoader: DataLoaderInterface;\n}\n\nexport interface BlockCategoryStorageOperations extends BaseBlockCategoryStorageOperations {\n dataLoader: DataLoaderInterface;\n}\n\nexport interface CategoryStorageOperations extends BaseCategoryStorageOperations {\n dataLoader: DataLoaderInterface;\n}\n\nexport interface PageBlockStorageOperations extends BasePageBlockStorageOperations {\n dataLoader: DataLoaderInterface;\n}\n"],"mappings":";;;;;;IAgBYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAAAC,OAAA,CAAAD,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"names":["_types","require","ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import {\n BlockCategoryStorageOperations as BaseBlockCategoryStorageOperations,\n CategoryStorageOperations as BaseCategoryStorageOperations,\n PageBlockStorageOperations as BasePageBlockStorageOperations,\n PageBuilderStorageOperations as BasePageBuilderStorageOperations,\n PageTemplateStorageOperations as BasePageTemplateStorageOperations,\n PbContext\n} from \"@webiny/api-page-builder/types\";\nimport { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { DynamoDBClient } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport { PluginCollection } from \"@webiny/plugins/types\";\nimport { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport { AttributeDefinition } from \"@webiny/db-dynamodb/toolbox\";\n\nexport { PbContext };\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"PbSystem\",\n SETTINGS = \"PbSettings\",\n CATEGORIES = \"PbCategories\",\n MENUS = \"PbMenus\",\n PAGE_ELEMENTS = \"PbPageElements\",\n PAGES = \"PbPages\",\n PAGES_ES = \"PbPagesEs\",\n BLOCK_CATEGORIES = \"PbBlockCategories\",\n PAGE_BLOCKS = \"PbPageBlocks\",\n PAGE_TEMPLATES = \"PbPageTemplates\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;\n}\n\nexport interface PageBuilderStorageOperations extends BasePageBuilderStorageOperations {\n getTable: () => Table<string, string, string>;\n getEsTable: () => Table<string, string, string>;\n getEntities: () => Record<\n | \"system\"\n | \"settings\"\n | \"categories\"\n | \"menus\"\n | \"pageElements\"\n | \"pages\"\n | \"pagesEs\"\n | \"blockCategories\"\n | \"pageBlocks\"\n | \"pageTemplates\",\n Entity<any>\n >;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBClient;\n elasticsearch: Client;\n table?: TableModifier;\n esTable?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: PluginCollection;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): PageBuilderStorageOperations;\n}\n\nexport interface DataContainer<T> {\n PK: string;\n SK: string;\n TYPE: string;\n data: T;\n}\n\nexport interface DataLoaderInterface {\n clear: () => void;\n}\n\nexport interface PageTemplateStorageOperations extends BasePageTemplateStorageOperations {\n dataLoader: DataLoaderInterface;\n}\n\nexport interface BlockCategoryStorageOperations extends BaseBlockCategoryStorageOperations {\n dataLoader: DataLoaderInterface;\n}\n\nexport interface CategoryStorageOperations extends BaseCategoryStorageOperations {\n dataLoader: DataLoaderInterface;\n}\n\nexport interface PageBlockStorageOperations extends BasePageBlockStorageOperations {\n dataLoader: DataLoaderInterface;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAOwC,IAY5BC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAAAC,OAAA,CAAAD,QAAA,GAAAA,QAAA"}