@webiny/api-page-builder-so-ddb-es 5.40.0-beta.1 → 5.40.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configurations.js +1 -2
- package/configurations.js.map +1 -1
- package/definitions/blockCategoryEntity.js.map +1 -1
- package/definitions/categoryEntity.js.map +1 -1
- package/definitions/menuEntity.js.map +1 -1
- package/definitions/pageBlockEntity.js.map +1 -1
- package/definitions/pageElasticsearchEntity.js.map +1 -1
- package/definitions/pageElementEntity.js.map +1 -1
- package/definitions/pageEntity.js.map +1 -1
- package/definitions/pageTemplateEntity.js.map +1 -1
- package/definitions/settingsEntity.js.map +1 -1
- package/definitions/systemEntity.js.map +1 -1
- package/definitions/table.d.ts +2 -2
- package/definitions/table.js.map +1 -1
- package/definitions/tableElasticsearch.d.ts +2 -2
- package/definitions/tableElasticsearch.js.map +1 -1
- package/elasticsearch/createElasticsearchIndex.js +1 -1
- package/elasticsearch/createElasticsearchIndex.js.map +1 -1
- package/elasticsearch/indices/base.js +1 -2
- package/elasticsearch/indices/base.js.map +1 -1
- package/elasticsearch/indices/index.js.map +1 -1
- package/elasticsearch/indices/japanese.js +1 -2
- package/elasticsearch/indices/japanese.js.map +1 -1
- package/index.js.map +1 -1
- package/operations/blockCategory/dataLoader.js.map +1 -1
- package/operations/blockCategory/fields.js.map +1 -1
- package/operations/blockCategory/index.js.map +1 -1
- package/operations/blockCategory/keys.js.map +1 -1
- package/operations/category/dataLoader.js.map +1 -1
- package/operations/category/fields.js.map +1 -1
- package/operations/category/index.js.map +1 -1
- package/operations/category/keys.js.map +1 -1
- package/operations/menu/fields.js.map +1 -1
- package/operations/menu/index.js +0 -1
- package/operations/menu/index.js.map +1 -1
- package/operations/pageBlock/compression.js.map +1 -1
- package/operations/pageBlock/dataLoader.js.map +1 -1
- package/operations/pageBlock/fields.js.map +1 -1
- package/operations/pageBlock/index.js.map +1 -1
- package/operations/pageBlock/keys.js.map +1 -1
- package/operations/pageElement/fields.js.map +1 -1
- package/operations/pageElement/index.js.map +1 -1
- package/operations/pageTemplate/dataLoader.js.map +1 -1
- package/operations/pageTemplate/fields.js.map +1 -1
- package/operations/pageTemplate/index.js.map +1 -1
- package/operations/pageTemplate/keys.js.map +1 -1
- package/operations/pages/elasticsearchQueryBody.js.map +1 -1
- package/operations/pages/fields.js.map +1 -1
- package/operations/pages/helpers.js.map +1 -1
- package/operations/pages/index.js.map +1 -1
- package/operations/pages/keys.js.map +1 -1
- package/operations/settings/index.js.map +1 -1
- package/operations/system/index.js.map +1 -1
- package/package.json +37 -37
- package/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin.js.map +1 -1
- package/plugins/definitions/CategoryDynamoDbElasticFieldPlugin.js.map +1 -1
- package/plugins/definitions/IndexPageDataPlugin.js.map +1 -1
- package/plugins/definitions/MenuDynamoDbElasticFieldPlugin.js.map +1 -1
- package/plugins/definitions/PageBlockDynamoDbFieldPlugin.js.map +1 -1
- package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.js.map +1 -1
- package/plugins/definitions/PageElasticsearchBodyModifierPlugin.js.map +1 -1
- package/plugins/definitions/PageElasticsearchFieldPlugin.js.map +1 -1
- package/plugins/definitions/PageElasticsearchIndexPlugin.js.map +1 -1
- package/plugins/definitions/PageElasticsearchQueryModifierPlugin.js.map +1 -1
- package/plugins/definitions/PageElasticsearchSortModifierPlugin.js.map +1 -1
- package/plugins/definitions/PageElementDynamoDbElasticFieldPlugin.js.map +1 -1
- package/plugins/definitions/PageTemplateDynamoDbElasticFieldPlugin.js.map +1 -1
- package/plugins/definitions/SearchLatestPagesPlugin.js.map +1 -1
- package/plugins/definitions/SearchPagesPlugin.js.map +1 -1
- package/plugins/definitions/SearchPublishedPagesPlugin.js.map +1 -1
- package/plugins/definitions/index.js.map +1 -1
- package/plugins/index.js.map +1 -1
- package/tasks/createIndexTaskPlugin.js.map +1 -1
- package/types.d.ts +2 -2
- package/types.js +1 -2
- package/types.js.map +1 -1
package/configurations.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.configurations = void 0;
|
|
|
8
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
9
|
var _apiElasticsearch = require("@webiny/api-elasticsearch");
|
|
10
10
|
var _plugins = require("./plugins");
|
|
11
|
-
const configurations = {
|
|
11
|
+
const configurations = exports.configurations = {
|
|
12
12
|
es: params => {
|
|
13
13
|
const {
|
|
14
14
|
tenant,
|
|
@@ -49,6 +49,5 @@ const configurations = {
|
|
|
49
49
|
return plugin ? plugin.body : {};
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
exports.configurations = configurations;
|
|
53
52
|
|
|
54
53
|
//# sourceMappingURL=configurations.js.map
|
package/configurations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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"
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_apiElasticsearch","_plugins","configurations","exports","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"],"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,GAAAC,OAAA,CAAAD,cAAA,GAAG;EAC1CE,EAAE,EAAEC,MAAM,IA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oryEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","slug","icon","description","createdOn","createdBy","tenant","locale","exports"],"sources":["blockCategoryEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createBlockCategoryEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n icon: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,yBAAyB,GAAIC,MAAc,IAAkB;EACtE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,WAAW,EAAE;QACTH,IAAI,EAAE;MACV,CAAC;MACDI,SAAS,EAAE;QACPJ,IAAI,EAAE;MACV,CAAC;MACDK,SAAS,EAAE;QACPL,IAAI,EAAE;MACV,CAAC;MACDM,MAAM,EAAE;QACJN,IAAI,EAAE;MACV,CAAC;MACDO,MAAM,EAAE;QACJP,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACiB,OAAA,CAAApB,yBAAA,GAAAA,yBAAA"}
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createBlockCategoryEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","slug","icon","description","createdOn","createdBy","tenant","locale","exports"],"sources":["blockCategoryEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createBlockCategoryEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n icon: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,yBAAyB,GAAIC,MAAc,IAAkB;EACtE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,WAAW,EAAE;QACTH,IAAI,EAAE;MACV,CAAC;MACDI,SAAS,EAAE;QACPJ,IAAI,EAAE;MACV,CAAC;MACDK,SAAS,EAAE;QACPL,IAAI,EAAE;MACV,CAAC;MACDM,MAAM,EAAE;QACJN,IAAI,EAAE;MACV,CAAC;MACDO,MAAM,EAAE;QACJP,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACiB,OAAA,CAAApB,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createCategoryEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","slug","url","layout","createdOn","createdBy","tenant","locale","exports"],"sources":["categoryEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createCategoryEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n url: {\n type: \"string\"\n },\n layout: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,oBAAoB,GAAIC,MAAc,IAAkB;EACjE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACDE,GAAG,EAAE;QACDF,IAAI,EAAE;MACV,CAAC;MACDG,MAAM,EAAE;QACJH,IAAI,EAAE;MACV,CAAC;MACDI,SAAS,EAAE;QACPJ,IAAI,EAAE;MACV,CAAC;MACDK,SAAS,EAAE;QACPL,IAAI,EAAE;MACV,CAAC;MACDM,MAAM,EAAE;QACJN,IAAI,EAAE;MACV,CAAC;MACDO,MAAM,EAAE;QACJP,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACiB,OAAA,CAAApB,oBAAA,GAAAA,oBAAA"}
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createCategoryEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","slug","url","layout","createdOn","createdBy","tenant","locale","exports"],"sources":["categoryEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createCategoryEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n url: {\n type: \"string\"\n },\n layout: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,oBAAoB,GAAIC,MAAc,IAAkB;EACjE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACDE,GAAG,EAAE;QACDF,IAAI,EAAE;MACV,CAAC;MACDG,MAAM,EAAE;QACJH,IAAI,EAAE;MACV,CAAC;MACDI,SAAS,EAAE;QACPJ,IAAI,EAAE;MACV,CAAC;MACDK,SAAS,EAAE;QACPL,IAAI,EAAE;MACV,CAAC;MACDM,MAAM,EAAE;QACJN,IAAI,EAAE;MACV,CAAC;MACDO,MAAM,EAAE;QACJP,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACiB,OAAA,CAAApB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createMenuEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","title","slug","description","items","createdOn","createdBy","tenant","locale","exports"],"sources":["menuEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createMenuEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n title: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n items: {\n type: \"list\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,gBAAgB,GAAIC,MAAc,IAAkB;EAC7D,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,KAAK,EAAE;QACHD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,WAAW,EAAE;QACTH,IAAI,EAAE;MACV,CAAC;MACDI,KAAK,EAAE;QACHJ,IAAI,EAAE;MACV,CAAC;MACDK,SAAS,EAAE;QACPL,IAAI,EAAE;MACV,CAAC;MACDM,SAAS,EAAE;QACPN,IAAI,EAAE;MACV,CAAC;MACDO,MAAM,EAAE;QACJP,IAAI,EAAE;MACV,CAAC;MACDQ,MAAM,EAAE;QACJR,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACkB,OAAA,CAAArB,gBAAA,GAAAA,gBAAA"}
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createMenuEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","title","slug","description","items","createdOn","createdBy","tenant","locale","exports"],"sources":["menuEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createMenuEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n title: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n items: {\n type: \"list\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,gBAAgB,GAAIC,MAAc,IAAkB;EAC7D,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,KAAK,EAAE;QACHD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,WAAW,EAAE;QACTH,IAAI,EAAE;MACV,CAAC;MACDI,KAAK,EAAE;QACHJ,IAAI,EAAE;MACV,CAAC;MACDK,SAAS,EAAE;QACPL,IAAI,EAAE;MACV,CAAC;MACDM,SAAS,EAAE;QACPN,IAAI,EAAE;MACV,CAAC;MACDO,MAAM,EAAE;QACJP,IAAI,EAAE;MACV,CAAC;MACDQ,MAAM,EAAE;QACJR,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACkB,OAAA,CAAArB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createPageBlockEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","id","blockCategory","content","preview","createdOn","createdBy","tenant","locale","exports"],"sources":["pageBlockEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createPageBlockEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n blockCategory: {\n type: \"string\"\n },\n content: {\n type: \"map\"\n },\n preview: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,qBAAqB,GAAIC,MAAc,IAAkB;EAClE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,EAAE,EAAE;QACAH,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDI,aAAa,EAAE;QACXJ,IAAI,EAAE;MACV,CAAC;MACDK,OAAO,EAAE;QACLL,IAAI,EAAE;MACV,CAAC;MACDM,OAAO,EAAE;QACLN,IAAI,EAAE;MACV,CAAC;MACDO,SAAS,EAAE;QACPP,IAAI,EAAE;MACV,CAAC;MACDQ,SAAS,EAAE;QACPR,IAAI,EAAE;MACV,CAAC;MACDS,MAAM,EAAE;QACJT,IAAI,EAAE;MACV,CAAC;MACDU,MAAM,EAAE;QACJV,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACoB,OAAA,CAAAvB,qBAAA,GAAAA,qBAAA"}
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createPageBlockEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","id","blockCategory","content","preview","createdOn","createdBy","tenant","locale","exports"],"sources":["pageBlockEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createPageBlockEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n blockCategory: {\n type: \"string\"\n },\n content: {\n type: \"map\"\n },\n preview: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,qBAAqB,GAAIC,MAAc,IAAkB;EAClE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,EAAE,EAAE;QACAH,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDI,aAAa,EAAE;QACXJ,IAAI,EAAE;MACV,CAAC;MACDK,OAAO,EAAE;QACLL,IAAI,EAAE;MACV,CAAC;MACDM,OAAO,EAAE;QACLN,IAAI,EAAE;MACV,CAAC;MACDO,SAAS,EAAE;QACPP,IAAI,EAAE;MACV,CAAC;MACDQ,SAAS,EAAE;QACPR,IAAI,EAAE;MACV,CAAC;MACDS,MAAM,EAAE;QACJT,IAAI,EAAE;MACV,CAAC;MACDU,MAAM,EAAE;QACJV,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACoB,OAAA,CAAAvB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createPageElasticsearchEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","index","type","data","exports"],"sources":["pageElasticsearchEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createPageElasticsearchEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n index: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,6BAA6B,GAAIC,MAAc,IAAkB;EAC1E,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,KAAK,EAAE;QACHC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACW,OAAA,CAAAd,6BAAA,GAAAA,6BAAA"}
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createPageElasticsearchEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","index","type","data","exports"],"sources":["pageElasticsearchEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createPageElasticsearchEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n index: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,6BAA6B,GAAIC,MAAc,IAAkB;EAC1E,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,KAAK,EAAE;QACHC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACW,OAAA,CAAAd,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createPageElementEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","id","category","content","preview","createdOn","createdBy","tenant","locale","exports"],"sources":["pageElementEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createPageElementEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n type: {\n type: \"string\"\n },\n category: {\n type: \"string\"\n },\n content: {\n type: \"map\"\n },\n preview: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,uBAAuB,GAAIC,MAAc,IAAkB;EACpE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,EAAE,EAAE;QACAD,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDA,IAAI,EAAE;QACFA,IAAI,EAAE;MACV,CAAC;MACDE,QAAQ,EAAE;QACNF,IAAI,EAAE;MACV,CAAC;MACDG,OAAO,EAAE;QACLH,IAAI,EAAE;MACV,CAAC;MACDI,OAAO,EAAE;QACLJ,IAAI,EAAE;MACV,CAAC;MACDK,SAAS,EAAE;QACPL,IAAI,EAAE;MACV,CAAC;MACDM,SAAS,EAAE;QACPN,IAAI,EAAE;MACV,CAAC;MACDO,MAAM,EAAE;QACJP,IAAI,EAAE;MACV,CAAC;MACDQ,MAAM,EAAE;QACJR,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACkB,OAAA,CAAArB,uBAAA,GAAAA,uBAAA"}
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createPageElementEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","id","category","content","preview","createdOn","createdBy","tenant","locale","exports"],"sources":["pageElementEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createPageElementEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n type: {\n type: \"string\"\n },\n category: {\n type: \"string\"\n },\n content: {\n type: \"map\"\n },\n preview: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,uBAAuB,GAAIC,MAAc,IAAkB;EACpE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,EAAE,EAAE;QACAD,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDA,IAAI,EAAE;QACFA,IAAI,EAAE;MACV,CAAC;MACDE,QAAQ,EAAE;QACNF,IAAI,EAAE;MACV,CAAC;MACDG,OAAO,EAAE;QACLH,IAAI,EAAE;MACV,CAAC;MACDI,OAAO,EAAE;QACLJ,IAAI,EAAE;MACV,CAAC;MACDK,SAAS,EAAE;QACPL,IAAI,EAAE;MACV,CAAC;MACDM,SAAS,EAAE;QACPN,IAAI,EAAE;MACV,CAAC;MACDO,MAAM,EAAE;QACJP,IAAI,EAAE;MACV,CAAC;MACDQ,MAAM,EAAE;QACJR,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACkB,OAAA,CAAArB,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createPageEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","id","pid","tenant","locale","title","editor","createdFrom","path","category","content","publishedOn","version","settings","locked","status","createdOn","savedOn","createdBy","ownedBy","webinyVersion","exports"],"sources":["pageEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createPageEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n pid: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n title: {\n type: \"string\"\n },\n editor: {\n type: \"string\"\n },\n createdFrom: {\n type: \"string\"\n },\n path: {\n type: \"string\"\n },\n category: {\n type: \"string\"\n },\n content: {\n type: \"map\"\n },\n publishedOn: {\n type: \"string\"\n },\n version: {\n type: \"number\"\n },\n settings: {\n type: \"map\"\n },\n locked: {\n type: \"boolean\"\n },\n status: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n ownedBy: {\n type: \"map\"\n },\n webinyVersion: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,gBAAgB,GAAIC,MAAc,IAAkB;EAC7D,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,EAAE,EAAE;QACAD,IAAI,EAAE;MACV,CAAC;MACDE,GAAG,EAAE;QACDF,IAAI,EAAE;MACV,CAAC;MACDG,MAAM,EAAE;QACJH,IAAI,EAAE;MACV,CAAC;MACDI,MAAM,EAAE;QACJJ,IAAI,EAAE;MACV,CAAC;MACDK,KAAK,EAAE;QACHL,IAAI,EAAE;MACV,CAAC;MACDM,MAAM,EAAE;QACJN,IAAI,EAAE;MACV,CAAC;MACDO,WAAW,EAAE;QACTP,IAAI,EAAE;MACV,CAAC;MACDQ,IAAI,EAAE;QACFR,IAAI,EAAE;MACV,CAAC;MACDS,QAAQ,EAAE;QACNT,IAAI,EAAE;MACV,CAAC;MACDU,OAAO,EAAE;QACLV,IAAI,EAAE;MACV,CAAC;MACDW,WAAW,EAAE;QACTX,IAAI,EAAE;MACV,CAAC;MACDY,OAAO,EAAE;QACLZ,IAAI,EAAE;MACV,CAAC;MACDa,QAAQ,EAAE;QACNb,IAAI,EAAE;MACV,CAAC;MACDc,MAAM,EAAE;QACJd,IAAI,EAAE;MACV,CAAC;MACDe,MAAM,EAAE;QACJf,IAAI,EAAE;MACV,CAAC;MACDgB,SAAS,EAAE;QACPhB,IAAI,EAAE;MACV,CAAC;MACDiB,OAAO,EAAE;QACLjB,IAAI,EAAE;MACV,CAAC;MACDkB,SAAS,EAAE;QACPlB,IAAI,EAAE;MACV,CAAC;MACDmB,OAAO,EAAE;QACLnB,IAAI,EAAE;MACV,CAAC;MACDoB,aAAa,EAAE;QACXpB,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAAC8B,OAAA,CAAAjC,gBAAA,GAAAA,gBAAA"}
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createPageEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","id","pid","tenant","locale","title","editor","createdFrom","path","category","content","publishedOn","version","settings","locked","status","createdOn","savedOn","createdBy","ownedBy","webinyVersion","exports"],"sources":["pageEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createPageEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n pid: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n title: {\n type: \"string\"\n },\n editor: {\n type: \"string\"\n },\n createdFrom: {\n type: \"string\"\n },\n path: {\n type: \"string\"\n },\n category: {\n type: \"string\"\n },\n content: {\n type: \"map\"\n },\n publishedOn: {\n type: \"string\"\n },\n version: {\n type: \"number\"\n },\n settings: {\n type: \"map\"\n },\n locked: {\n type: \"boolean\"\n },\n status: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n ownedBy: {\n type: \"map\"\n },\n webinyVersion: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,gBAAgB,GAAIC,MAAc,IAAkB;EAC7D,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,EAAE,EAAE;QACAD,IAAI,EAAE;MACV,CAAC;MACDE,GAAG,EAAE;QACDF,IAAI,EAAE;MACV,CAAC;MACDG,MAAM,EAAE;QACJH,IAAI,EAAE;MACV,CAAC;MACDI,MAAM,EAAE;QACJJ,IAAI,EAAE;MACV,CAAC;MACDK,KAAK,EAAE;QACHL,IAAI,EAAE;MACV,CAAC;MACDM,MAAM,EAAE;QACJN,IAAI,EAAE;MACV,CAAC;MACDO,WAAW,EAAE;QACTP,IAAI,EAAE;MACV,CAAC;MACDQ,IAAI,EAAE;QACFR,IAAI,EAAE;MACV,CAAC;MACDS,QAAQ,EAAE;QACNT,IAAI,EAAE;MACV,CAAC;MACDU,OAAO,EAAE;QACLV,IAAI,EAAE;MACV,CAAC;MACDW,WAAW,EAAE;QACTX,IAAI,EAAE;MACV,CAAC;MACDY,OAAO,EAAE;QACLZ,IAAI,EAAE;MACV,CAAC;MACDa,QAAQ,EAAE;QACNb,IAAI,EAAE;MACV,CAAC;MACDc,MAAM,EAAE;QACJd,IAAI,EAAE;MACV,CAAC;MACDe,MAAM,EAAE;QACJf,IAAI,EAAE;MACV,CAAC;MACDgB,SAAS,EAAE;QACPhB,IAAI,EAAE;MACV,CAAC;MACDiB,OAAO,EAAE;QACLjB,IAAI,EAAE;MACV,CAAC;MACDkB,SAAS,EAAE;QACPlB,IAAI,EAAE;MACV,CAAC;MACDmB,OAAO,EAAE;QACLnB,IAAI,EAAE;MACV,CAAC;MACDoB,aAAa,EAAE;QACXpB,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAAC8B,OAAA,CAAAjC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createPageTemplateEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","data","exports"],"sources":["pageTemplateEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createPageTemplateEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,wBAAwB,GAAIC,MAAc,IAAkB;EACrE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAhB,wBAAA,GAAAA,wBAAA"}
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createPageTemplateEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","TYPE","data","exports"],"sources":["pageTemplateEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createPageTemplateEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,wBAAwB,GAAIC,MAAc,IAAkB;EACrE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,OAAO,EAAE;QACLD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAhB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createSettingsEntity","params","entityName","table","Entity","name","attributes","PK","partitionKey","SK","sortKey","TYPE","type","data","exports"],"sources":["settingsEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n}\n\nexport const createSettingsEntity = (params: Params): Entity<any> => {\n const { entityName, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n }\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,oBAAoB,GAAIC,MAAc,IAAkB;EACjE,MAAM;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGF,MAAM;EACpC,OAAO,IAAIG,eAAM,CAAC;IACdC,IAAI,EAAEH,UAAU;IAChBC,KAAK;IACLG,UAAU,EAAE;MACRC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACE,OAAA,CAAAd,oBAAA,GAAAA,oBAAA"}
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createSettingsEntity","params","entityName","table","Entity","name","attributes","PK","partitionKey","SK","sortKey","TYPE","type","data","exports"],"sources":["settingsEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n}\n\nexport const createSettingsEntity = (params: Params): Entity<any> => {\n const { entityName, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n }\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,oBAAoB,GAAIC,MAAc,IAAkB;EACjE,MAAM;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGF,MAAM;EACpC,OAAO,IAAIG,eAAM,CAAC;IACdC,IAAI,EAAEH,UAAU;IAChBC,KAAK;IACLG,UAAU,EAAE;MACRC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACE,OAAA,CAAAd,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","tenant","exports"],"sources":["systemEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSystemEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n version: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,kBAAkB,GAAIC,MAAc,IAAkB;EAC/D,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,MAAM,EAAE;QACJD,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACW,OAAA,CAAAd,kBAAA,GAAAA,kBAAA"}
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","tenant","exports"],"sources":["systemEntity.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSystemEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n version: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,kBAAkB,GAAIC,MAAc,IAAkB;EAC/D,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,MAAM,EAAE;QACJD,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACW,OAAA,CAAAd,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/definitions/table.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
-
import {
|
|
2
|
+
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
3
3
|
import { TableModifier } from "../types";
|
|
4
4
|
interface Params {
|
|
5
5
|
table?: TableModifier;
|
|
6
|
-
documentClient:
|
|
6
|
+
documentClient: DynamoDBDocument;
|
|
7
7
|
}
|
|
8
8
|
export declare const createTable: ({ table, documentClient }: Params) => Table<string, string, string>;
|
|
9
9
|
export {};
|
package/definitions/table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createTable","table","documentClient","tableConfig","name","process","env","DB_PAGE_BUILDER","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","autoExecute","autoParse","config","Table","exports"],"sources":["table.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport {
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createTable","table","documentClient","tableConfig","name","process","env","DB_PAGE_BUILDER","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","autoExecute","autoParse","config","Table","exports"],"sources":["table.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport { TableModifier } from \"~/types\";\n\ninterface Params {\n table?: TableModifier;\n documentClient: DynamoDBDocument;\n}\nexport const createTable = ({ table, documentClient }: Params): Table<string, string, string> => {\n const tableConfig: TableConstructor<string, string, string> = {\n name: process.env.DB_PAGE_BUILDER || (process.env.DB_TABLE as string),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n },\n autoExecute: true,\n autoParse: true\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,WAAW,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAuB,CAAC,KAAoC;EAC7F,MAAMC,WAAqD,GAAG;IAC1DC,IAAI,EAAEC,OAAO,CAACC,GAAG,CAACC,eAAe,IAAKF,OAAO,CAACC,GAAG,CAACE,QAAmB;IACrEC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAET,cAAc;IAC9BU,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;IACJ,CAAC;IACDI,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC;EAED,MAAMC,MAAM,GAAG,OAAOf,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIc,cAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAlB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TableModifier } from "../types";
|
|
2
|
-
import {
|
|
2
|
+
import { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
|
|
3
3
|
import { Table } from "@webiny/db-dynamodb/toolbox";
|
|
4
4
|
interface Params {
|
|
5
5
|
table?: TableModifier;
|
|
6
|
-
documentClient:
|
|
6
|
+
documentClient: DynamoDBDocument;
|
|
7
7
|
}
|
|
8
8
|
export declare const createElasticsearchTable: ({ table, documentClient }: Params) => Table<string, string, string>;
|
|
9
9
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_toolbox","require","createElasticsearchTable","table","documentClient","tableConfig","name","process","env","DB_TABLE_ELASTICSEARCH","partitionKey","sortKey","DocumentClient","autoExecute","autoParse","config","Table","exports"],"sources":["tableElasticsearch.ts"],"sourcesContent":["import { TableModifier } from \"~/types\";\nimport {
|
|
1
|
+
{"version":3,"names":["_toolbox","require","createElasticsearchTable","table","documentClient","tableConfig","name","process","env","DB_TABLE_ELASTICSEARCH","partitionKey","sortKey","DocumentClient","autoExecute","autoParse","config","Table","exports"],"sources":["tableElasticsearch.ts"],"sourcesContent":["import { TableModifier } from \"~/types\";\nimport { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface Params {\n table?: TableModifier;\n documentClient: DynamoDBDocument;\n}\nexport const createElasticsearchTable = ({\n table,\n documentClient\n}: Params): Table<string, string, string> => {\n const tableConfig: TableConstructor<string, string, string> = {\n name: process.env.DB_TABLE_ELASTICSEARCH as string,\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n autoExecute: true,\n autoParse: true\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,wBAAwB,GAAGA,CAAC;EACrCC,KAAK;EACLC;AACI,CAAC,KAAoC;EACzC,MAAMC,WAAqD,GAAG;IAC1DC,IAAI,EAAEC,OAAO,CAACC,GAAG,CAACC,sBAAgC;IAClDC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAER,cAAc;IAC9BS,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC;EAED,MAAMC,MAAM,GAAG,OAAOZ,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIW,cAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAf,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -31,7 +31,7 @@ const createElasticsearchIndex = async params => {
|
|
|
31
31
|
console.log(`Elasticsearch index "${index}" for the Page Builder Pages already exists.`);
|
|
32
32
|
},
|
|
33
33
|
onError: ex => {
|
|
34
|
-
console.error(`Could not create the Page Builder Pages Elasticsearch index "${index}"
|
|
34
|
+
console.error(`Could not create the Page Builder Pages Elasticsearch index "${index}".`, ex);
|
|
35
35
|
return ex;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_apiElasticsearch","require","_PageElasticsearchIndexPlugin","_configurations","createElasticsearchIndex","params","elasticsearch","plugins","locale","tenant","index","configurations","es","createIndex","client","type","PageElasticsearchIndexPlugin","onExists","console","log","onError","ex","error","exports"],"sources":["createElasticsearchIndex.ts"],"sourcesContent":["import { Client } from \"@elastic/elasticsearch\";\nimport { createIndex } from \"@webiny/api-elasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { PageElasticsearchIndexPlugin } from \"~/plugins/definitions/PageElasticsearchIndexPlugin\";\nimport { configurations } from \"~/configurations\";\n\nexport interface ExecOnBeforeInstallParams {\n elasticsearch: Client;\n plugins: PluginsContainer;\n tenant: string;\n locale: string;\n}\n\nexport const createElasticsearchIndex = async (\n params: ExecOnBeforeInstallParams\n): Promise<void> => {\n const { elasticsearch, plugins, locale, tenant } = params;\n\n const { index } = configurations.es({\n locale,\n tenant\n });\n await createIndex({\n plugins,\n client: elasticsearch,\n type: PageElasticsearchIndexPlugin.type,\n index,\n tenant,\n locale,\n onExists: () => {\n console.log(\n `Elasticsearch index \"${index}\" for the Page Builder Pages already exists.`\n );\n },\n onError: (ex: Error) => {\n console.error(\n `Could not create the Page Builder Pages Elasticsearch index \"${index}\"
|
|
1
|
+
{"version":3,"names":["_apiElasticsearch","require","_PageElasticsearchIndexPlugin","_configurations","createElasticsearchIndex","params","elasticsearch","plugins","locale","tenant","index","configurations","es","createIndex","client","type","PageElasticsearchIndexPlugin","onExists","console","log","onError","ex","error","exports"],"sources":["createElasticsearchIndex.ts"],"sourcesContent":["import { Client } from \"@elastic/elasticsearch\";\nimport { createIndex } from \"@webiny/api-elasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { PageElasticsearchIndexPlugin } from \"~/plugins/definitions/PageElasticsearchIndexPlugin\";\nimport { configurations } from \"~/configurations\";\n\nexport interface ExecOnBeforeInstallParams {\n elasticsearch: Client;\n plugins: PluginsContainer;\n tenant: string;\n locale: string;\n}\n\nexport const createElasticsearchIndex = async (\n params: ExecOnBeforeInstallParams\n): Promise<void> => {\n const { elasticsearch, plugins, locale, tenant } = params;\n\n const { index } = configurations.es({\n locale,\n tenant\n });\n await createIndex({\n plugins,\n client: elasticsearch,\n type: PageElasticsearchIndexPlugin.type,\n index,\n tenant,\n locale,\n onExists: () => {\n console.log(\n `Elasticsearch index \"${index}\" for the Page Builder Pages already exists.`\n );\n },\n onError: (ex: Error) => {\n console.error(\n `Could not create the Page Builder Pages Elasticsearch index \"${index}\".`,\n ex\n );\n return ex;\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,6BAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AASO,MAAMG,wBAAwB,GAAG,MACpCC,MAAiC,IACjB;EAChB,MAAM;IAAEC,aAAa;IAAEC,OAAO;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,MAAM;EAEzD,MAAM;IAAEK;EAAM,CAAC,GAAGC,8BAAc,CAACC,EAAE,CAAC;IAChCJ,MAAM;IACNC;EACJ,CAAC,CAAC;EACF,MAAM,IAAAI,6BAAW,EAAC;IACdN,OAAO;IACPO,MAAM,EAAER,aAAa;IACrBS,IAAI,EAAEC,0DAA4B,CAACD,IAAI;IACvCL,KAAK;IACLD,MAAM;IACND,MAAM;IACNS,QAAQ,EAAEA,CAAA,KAAM;MACZC,OAAO,CAACC,GAAG,CACN,wBAAuBT,KAAM,8CAClC,CAAC;IACL,CAAC;IACDU,OAAO,EAAGC,EAAS,IAAK;MACpBH,OAAO,CAACI,KAAK,CACR,gEAA+DZ,KAAM,IAAG,EACzEW,EACJ,CAAC;MACD,OAAOA,EAAE;IACb;EACJ,CAAC,CAAC;AACN,CAAC;AAACE,OAAA,CAAAnB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.base = void 0;
|
|
7
7
|
var _apiElasticsearch = require("@webiny/api-elasticsearch");
|
|
8
8
|
var _PageElasticsearchIndexPlugin = require("../../plugins/definitions/PageElasticsearchIndexPlugin");
|
|
9
|
-
const base = new _PageElasticsearchIndexPlugin.PageElasticsearchIndexPlugin({
|
|
9
|
+
const base = exports.base = new _PageElasticsearchIndexPlugin.PageElasticsearchIndexPlugin({
|
|
10
10
|
body: (0, _apiElasticsearch.getBaseConfiguration)()
|
|
11
11
|
});
|
|
12
|
-
exports.base = base;
|
|
13
12
|
base.name = "pageBuilder.elasticsearch.index.page.default";
|
|
14
13
|
|
|
15
14
|
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_apiElasticsearch","require","_PageElasticsearchIndexPlugin","base","PageElasticsearchIndexPlugin","body","getBaseConfiguration","
|
|
1
|
+
{"version":3,"names":["_apiElasticsearch","require","_PageElasticsearchIndexPlugin","base","exports","PageElasticsearchIndexPlugin","body","getBaseConfiguration","name"],"sources":["base.ts"],"sourcesContent":["import { getBaseConfiguration } from \"@webiny/api-elasticsearch\";\nimport { PageElasticsearchIndexPlugin } from \"~/plugins/definitions/PageElasticsearchIndexPlugin\";\n\nexport const base = new PageElasticsearchIndexPlugin({\n body: getBaseConfiguration()\n});\n\nbase.name = \"pageBuilder.elasticsearch.index.page.default\";\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,6BAAA,GAAAD,OAAA;AAEO,MAAME,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAG,IAAIE,0DAA4B,CAAC;EACjDC,IAAI,EAAE,IAAAC,sCAAoB,EAAC;AAC/B,CAAC,CAAC;AAEFJ,IAAI,CAACK,IAAI,GAAG,8CAA8C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_base","require","_japanese","elasticsearchIndexPlugins","base","japanese","exports"],"sources":["index.ts"],"sourcesContent":["import { base } from \"./base\";\nimport { japanese } from \"./japanese\";\n\nexport const elasticsearchIndexPlugins = () => {\n return [base, japanese];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEO,MAAME,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,OAAO,CAACC,UAAI,EAAEC,kBAAQ,CAAC;AAC3B,CAAC;AAACC,OAAA,CAAAH,yBAAA,GAAAA,yBAAA"}
|
|
1
|
+
{"version":3,"names":["_base","require","_japanese","elasticsearchIndexPlugins","base","japanese","exports"],"sources":["index.ts"],"sourcesContent":["import { base } from \"./base\";\nimport { japanese } from \"./japanese\";\n\nexport const elasticsearchIndexPlugins = () => {\n return [base, japanese];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEO,MAAME,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,OAAO,CAACC,UAAI,EAAEC,kBAAQ,CAAC;AAC3B,CAAC;AAACC,OAAA,CAAAH,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.japanese = void 0;
|
|
7
7
|
var _apiElasticsearch = require("@webiny/api-elasticsearch");
|
|
8
8
|
var _PageElasticsearchIndexPlugin = require("../../plugins/definitions/PageElasticsearchIndexPlugin");
|
|
9
|
-
const japanese = new _PageElasticsearchIndexPlugin.PageElasticsearchIndexPlugin({
|
|
9
|
+
const japanese = exports.japanese = new _PageElasticsearchIndexPlugin.PageElasticsearchIndexPlugin({
|
|
10
10
|
body: (0, _apiElasticsearch.getJapaneseConfiguration)(),
|
|
11
11
|
locales: ["ja", "ja-jp"]
|
|
12
12
|
});
|
|
13
|
-
exports.japanese = japanese;
|
|
14
13
|
japanese.name = "pageBuilder.elasticsearch.index.page.ja-jp";
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=japanese.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_apiElasticsearch","require","_PageElasticsearchIndexPlugin","japanese","PageElasticsearchIndexPlugin","body","getJapaneseConfiguration","locales","
|
|
1
|
+
{"version":3,"names":["_apiElasticsearch","require","_PageElasticsearchIndexPlugin","japanese","exports","PageElasticsearchIndexPlugin","body","getJapaneseConfiguration","locales","name"],"sources":["japanese.ts"],"sourcesContent":["import { getJapaneseConfiguration } from \"@webiny/api-elasticsearch\";\nimport { PageElasticsearchIndexPlugin } from \"~/plugins/definitions/PageElasticsearchIndexPlugin\";\n\nexport const japanese = new PageElasticsearchIndexPlugin({\n body: getJapaneseConfiguration(),\n locales: [\"ja\", \"ja-jp\"]\n});\n\njapanese.name = \"pageBuilder.elasticsearch.index.page.ja-jp\";\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,6BAAA,GAAAD,OAAA;AAEO,MAAME,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,IAAIE,0DAA4B,CAAC;EACrDC,IAAI,EAAE,IAAAC,0CAAwB,EAAC,CAAC;EAChCC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO;AAC3B,CAAC,CAAC;AAEFL,QAAQ,CAACM,IAAI,GAAG,4CAA4C","ignoreList":[]}
|
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","_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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AA,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,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;AACA,IAAAoB,OAAA,GAAApB,OAAA;AAEA,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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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_batchRead","_cleanup","_keys","BlockCategoryDataLoader","_getDataLoader","undefined","constructor","params","entity","getOne","item","getDataLoader","load","getAll","items","loadMany","clear","clearAll","cacheKeyFn","key","tenant","locale","slug","DataLoader","batched","map","getBatch","PK","createPartitionKey","SK","createSortKey","records","batchReadAll","table","results","reduce","collection","result","cleanupItem","exports"],"sources":["dataLoader.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb/utils/batchRead\";\nimport { BlockCategory } from \"@webiny/api-page-builder/types\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { createPartitionKey, createSortKey } from \"./keys\";\nimport { DataLoaderInterface } from \"~/types\";\n\ninterface Params {\n entity: Entity<any>;\n}\n\ntype DataLoaderGetItem = Pick<BlockCategory, \"slug\" | \"tenant\" | \"locale\">;\n\nexport class BlockCategoryDataLoader implements DataLoaderInterface {\n private _getDataLoader: DataLoader<any, any> | undefined = undefined;\n\n private readonly entity: Entity<any>;\n\n constructor(params: Params) {\n this.entity = params.entity;\n }\n\n public async getOne(item: DataLoaderGetItem): Promise<BlockCategory> {\n return await this.getDataLoader().load(item);\n }\n\n public async getAll(items: DataLoaderGetItem[]): Promise<BlockCategory[]> {\n return await this.getDataLoader().loadMany(items);\n }\n\n public clear(): void {\n this.getDataLoader().clearAll();\n }\n\n private getDataLoader(): DataLoader<any, any> {\n if (!this._getDataLoader) {\n const cacheKeyFn = (key: DataLoaderGetItem) => {\n return `T#${key.tenant}#L#${key.locale}#${key.slug}`;\n };\n this._getDataLoader = new DataLoader(\n async items => {\n const batched = items.map(item => {\n return this.entity.getBatch({\n PK: createPartitionKey(item),\n SK: createSortKey(item)\n });\n });\n\n const records = await batchReadAll<BlockCategory>({\n table: this.entity.table,\n items: batched\n });\n\n const results = records.reduce((collection, result) => {\n if (!result) {\n return collection;\n }\n const key = cacheKeyFn(result);\n collection[key] = cleanupItem(this.entity, result) as BlockCategory;\n return collection;\n }, {} as Record<string, BlockCategory>);\n return items.map(item => {\n const key = cacheKeyFn(item);\n return results[key] || null;\n });\n },\n {\n cacheKeyFn\n }\n );\n }\n return this._getDataLoader;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AASO,MAAMI,uBAAuB,CAAgC;EACxDC,cAAc,GAAqCC,SAAS;EAIpEC,WAAWA,CAACC,MAAc,EAAE;IACxB,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EAEA,MAAaC,MAAMA,CAACC,IAAuB,EAA0B;IACjE,OAAO,MAAM,IAAI,CAACC,aAAa,CAAC,CAAC,CAACC,IAAI,CAACF,IAAI,CAAC;EAChD;EAEA,MAAaG,MAAMA,CAACC,KAA0B,EAA4B;IACtE,OAAO,MAAM,IAAI,CAACH,aAAa,CAAC,CAAC,CAACI,QAAQ,CAACD,KAA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IAAI,CAAC;UAC5B,OAAOwB,OAAO,CAACf,GAAG,CAAC,IAAI,IAAI;QAC/B,CAAC,CAAC;MACN,CAAC,EACD;QACID;MACJ,CACJ,CAAC;IACL;IACA,OAAO,IAAI,CAACd,cAAc;EAC9B;AACJ;AAACmC,OAAA,CAAApC,uBAAA,GAAAA,uBAAA"}
|
|
1
|
+
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_batchRead","_cleanup","_keys","BlockCategoryDataLoader","_getDataLoader","undefined","constructor","params","entity","getOne","item","getDataLoader","load","getAll","items","loadMany","clear","clearAll","cacheKeyFn","key","tenant","locale","slug","DataLoader","batched","map","getBatch","PK","createPartitionKey","SK","createSortKey","records","batchReadAll","table","results","reduce","collection","result","cleanupItem","exports"],"sources":["dataLoader.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb/utils/batchRead\";\nimport { BlockCategory } from \"@webiny/api-page-builder/types\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { createPartitionKey, createSortKey } from \"./keys\";\nimport { DataLoaderInterface } from \"~/types\";\n\ninterface Params {\n entity: Entity<any>;\n}\n\ntype DataLoaderGetItem = Pick<BlockCategory, \"slug\" | \"tenant\" | \"locale\">;\n\nexport class BlockCategoryDataLoader implements DataLoaderInterface {\n private _getDataLoader: DataLoader<any, any> | undefined = undefined;\n\n private readonly entity: Entity<any>;\n\n constructor(params: Params) {\n this.entity = params.entity;\n }\n\n public async getOne(item: DataLoaderGetItem): Promise<BlockCategory> {\n return await this.getDataLoader().load(item);\n }\n\n public async getAll(items: DataLoaderGetItem[]): Promise<BlockCategory[]> {\n return await this.getDataLoader().loadMany(items);\n }\n\n public clear(): void {\n this.getDataLoader().clearAll();\n }\n\n private getDataLoader(): DataLoader<any, any> {\n if (!this._getDataLoader) {\n const cacheKeyFn = (key: DataLoaderGetItem) => {\n return `T#${key.tenant}#L#${key.locale}#${key.slug}`;\n };\n this._getDataLoader = new DataLoader(\n async items => {\n const batched = items.map(item => {\n return this.entity.getBatch({\n PK: createPartitionKey(item),\n SK: createSortKey(item)\n });\n });\n\n const records = await batchReadAll<BlockCategory>({\n table: this.entity.table,\n items: batched\n });\n\n const results = records.reduce((collection, result) => {\n if (!result) {\n return collection;\n }\n const key = cacheKeyFn(result);\n collection[key] = cleanupItem(this.entity, result) as BlockCategory;\n return collection;\n }, {} as Record<string, BlockCategory>);\n return items.map(item => {\n const key = cacheKeyFn(item);\n return results[key] || null;\n });\n },\n {\n cacheKeyFn\n }\n );\n }\n return this._getDataLoader;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AASO,MAAMI,uBAAuB,CAAgC;EACxDC,cAAc,GAAqCC,SAAS;EAIpEC,WAAWA,CAACC,MAAc,EAAE;IACxB,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EAEA,MAAaC,MAAMA,CAACC,IAAuB,EAA0B;IACjE,OAAO,MAAM,IAAI,CAACC,aAAa,CAAC,CAAC,CAACC,IAAI,CAACF,IAAI,CAAC;EAChD;EAEA,MAAaG,MAAMA,CAACC,KAA0B,EAA4B;IACtE,OAAO,MAAM,IAAI,CAACH,aAAa,CAAC,CAAC,CAACI,QAAQ,CAACD,KAAK,CAAC;EACrD;EAEOE,KAAKA,CAAA,EAAS;IACjB,IAAI,CAACL,aAAa,CAAC,CAAC,CAACM,QAAQ,CAAC,CAAC;EACnC;EAEQN,aAAaA,CAAA,EAAyB;IAC1C,IAAI,CAAC,IAAI,CAACP,cAAc,EAAE;MACtB,MAAMc,UAAU,GAAIC,GAAsB,IAAK;QAC3C,OAAQ,KAAIA,GAAG,CAACC,MAAO,MAAKD,GAAG,CAACE,MA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amoDbElasticFieldPlugin","require","createBlockCategoryDynamoDbFields","BlockCategoryDynamoDbElasticFieldPlugin","field","type","path","exports"],"sources":["fields.ts"],"sourcesContent":["import { BlockCategoryDynamoDbElasticFieldPlugin } from \"~/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin\";\n\nexport const createBlockCategoryDynamoDbFields = (): BlockCategoryDynamoDbElasticFieldPlugin[] => {\n return [\n new BlockCategoryDynamoDbElasticFieldPlugin({\n field: \"id\"\n }),\n new BlockCategoryDynamoDbElasticFieldPlugin({\n field: \"createdOn\",\n type: \"date\"\n }),\n new BlockCategoryDynamoDbElasticFieldPlugin({\n field: \"savedOn\",\n type: \"date\"\n }),\n new BlockCategoryDynamoDbElasticFieldPlugin({\n field: \"publishedOn\",\n type: \"date\"\n }),\n new BlockCategoryDynamoDbElasticFieldPlugin({\n field: \"createdBy\",\n path: \"createdBy.id\"\n })\n ];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,wCAAA,GAAAC,OAAA;AAEO,MAAMC,iCAAiC,GAAGA,CAAA,KAAiD;EAC9F,OAAO,CACH,IAAIC,gFAAuC,CAAC;IACxCC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAID,gFAAuC,CAAC;IACxCC,KAAK,EAAE,WAAW;IAClBC,IAAI,EAAE;EACV,CAAC,CAAC,EACF,IAAIF,gFAAuC,CAAC;IACxCC,KAAK,EAAE,SAAS;IAChBC,IAAI,EAAE;EACV,CAAC,CAAC,EACF,IAAIF,gFAAuC,CAAC;IACxCC,KAAK,EAAE,aAAa;IACpBC,IAAI,EAAE;EACV,CAAC,CAAC,EACF,IAAIF,gFAAuC,CAAC;IACxCC,KAAK,EAAE,WAAW;IAClBE,IAAI,EAAE;EACV,CAAC,CAAC,CACL;AACL,CAAC;AAACC,OAAA,CAAAL,iCAAA,GAAAA,iCAAA"}
|
|
1
|
+
{"version":3,"names":["_BlockCategoryDynamoDbElasticFieldPlugin","require","createBlockCategoryDynamoDbFields","BlockCategoryDynamoDbElasticFieldPlugin","field","type","path","exports"],"sources":["fields.ts"],"sourcesContent":["import { BlockCategoryDynamoDbElasticFieldPlugin } from \"~/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin\";\n\nexport const createBlockCategoryDynamoDbFields = (): BlockCategoryDynamoDbElasticFieldPlugin[] => {\n return [\n new BlockCategoryDynamoDbElasticFieldPlugin({\n field: \"id\"\n }),\n new BlockCategoryDynamoDbElasticFieldPlugin({\n field: \"createdOn\",\n type: \"date\"\n }),\n new BlockCategoryDynamoDbElasticFieldPlugin({\n field: \"savedOn\",\n type: \"date\"\n }),\n new BlockCategoryDynamoDbElasticFieldPlugin({\n field: \"publishedOn\",\n type: \"date\"\n }),\n new BlockCategoryDynamoDbElasticFieldPlugin({\n field: \"createdBy\",\n path: \"createdBy.id\"\n })\n ];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,wCAAA,GAAAC,OAAA;AAEO,MAAMC,iCAAiC,GAAGA,CAAA,KAAiD;EAC9F,OAAO,CACH,IAAIC,gFAAuC,CAAC;IACxCC,KAAK,EAAE;EACX,CAAC,CAAC,EACF,IAAID,gFAAuC,CAAC;IACxCC,KAAK,EAAE,WAAW;IAClBC,IAAI,EAAE;EACV,CAAC,CAAC,EACF,IAAIF,gFAAuC,CAAC;IACxCC,KAAK,EAAE,SAAS;IAChBC,IAAI,EAAE;EACV,CAAC,CAAC,EACF,IAAIF,gFAAuC,CAAC;IACxCC,KAAK,EAAE,aAAa;IACpBC,IAAI,EAAE;EACV,CAAC,CAAC,EACF,IAAIF,gFAAuC,CAAC;IACxCC,KAAK,EAAE,WAAW;IAClBE,IAAI,EAAE;EACV,CAAC,CAAC,CACL;AACL,CAAC;AAACC,OAAA,CAAAL,iCAAA,GAAAA,iCAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_query","_sort","_filter","_dataLoader","_listResponse","_BlockCategoryDynamoDbElasticFieldPlugin","_keys","_dbDynamodb","createType","createBlockCategoryStorageOperations","entity","plugins","dataLoader","BlockCategoryDataLoader","get","params","where","getOne","ex","WebinyError","message","code","create","blockCategory","keys","PK","createPartitionKey","tenant","locale","SK","createSortKey","put","item","TYPE","clear","update","original","category","deleteBlockCategory","deleteItem","list","sort","limit","restWhere","queryAllParams","partitionKey","options","gt","items","queryAll","fields","byType","BlockCategoryDynamoDbElasticFieldPlugin","type","filteredItems","filterItems","sortedItems","sortItems","createListResponse","totalCount","length","after","delete","exports"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n BlockCategory,\n BlockCategoryStorageOperationsCreateParams,\n BlockCategoryStorageOperationsDeleteParams,\n BlockCategoryStorageOperationsGetParams,\n BlockCategoryStorageOperationsListParams,\n BlockCategoryStorageOperationsUpdateParams\n} from \"@webiny/api-page-builder/types\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { queryAll, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { sortItems } from \"@webiny/db-dynamodb/utils/sort\";\nimport { filterItems } from \"@webiny/db-dynamodb/utils/filter\";\nimport { BlockCategoryDataLoader } from \"./dataLoader\";\nimport { createListResponse } from \"@webiny/db-dynamodb/utils/listResponse\";\nimport { BlockCategoryDynamoDbElasticFieldPlugin } from \"~/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createPartitionKey, createSortKey } from \"~/operations/blockCategory/keys\";\nimport { BlockCategoryStorageOperations } from \"~/types\";\nimport { deleteItem, put } from \"@webiny/db-dynamodb\";\n\nconst createType = (): string => {\n return \"pb.blockCategory\";\n};\n\nexport interface CreateBlockCategoryStorageOperationsParams {\n entity: Entity<any>;\n plugins: PluginsContainer;\n}\nexport const createBlockCategoryStorageOperations = ({\n entity,\n plugins\n}: CreateBlockCategoryStorageOperationsParams): BlockCategoryStorageOperations => {\n const dataLoader = new BlockCategoryDataLoader({\n entity\n });\n\n const get = async (params: BlockCategoryStorageOperationsGetParams) => {\n const { where } = params;\n\n try {\n return await dataLoader.getOne(where);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load block category by given parameters.\",\n ex.code || \"BLOCK_CATEGORY_GET_ERROR\",\n {\n where\n }\n );\n }\n };\n\n const create = async (params: BlockCategoryStorageOperationsCreateParams) => {\n const { blockCategory } = params;\n\n const keys = {\n PK: createPartitionKey({\n tenant: blockCategory.tenant,\n locale: blockCategory.locale\n }),\n SK: createSortKey(blockCategory)\n };\n\n try {\n await put({\n entity,\n item: {\n ...blockCategory,\n TYPE: createType(),\n ...keys\n }\n });\n /**\n * Always clear data loader cache when modifying the records.\n */\n dataLoader.clear();\n\n return blockCategory;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create block category.\",\n ex.code || \"BLOCK_CATEGORY_CREATE_ERROR\",\n {\n keys\n }\n );\n }\n };\n\n const update = async (params: BlockCategoryStorageOperationsUpdateParams) => {\n const { original, blockCategory } = params;\n const keys = {\n PK: createPartitionKey({\n tenant: original.tenant,\n locale: original.locale\n }),\n SK: createSortKey(blockCategory)\n };\n\n try {\n await put({\n entity,\n item: {\n ...blockCategory,\n TYPE: createType(),\n ...keys\n }\n });\n /**\n * Always clear data loader cache when modifying the records.\n */\n dataLoader.clear();\n\n return blockCategory;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update block category.\",\n ex.code || \"BLOCK_CATEGORY_UPDATE_ERROR\",\n {\n keys,\n original,\n category: blockCategory\n }\n );\n }\n };\n\n const deleteBlockCategory = async (params: BlockCategoryStorageOperationsDeleteParams) => {\n const { blockCategory } = params;\n const keys = {\n PK: createPartitionKey({\n tenant: blockCategory.tenant,\n locale: blockCategory.locale\n }),\n SK: createSortKey(blockCategory)\n };\n\n try {\n await deleteItem({\n entity,\n keys\n });\n /**\n * Always clear data loader cache when modifying the records.\n */\n dataLoader.clear();\n\n return blockCategory;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete block category.\",\n ex.code || \"BLOCK_CATEGORY_DELETE_ERROR\",\n {\n keys,\n blockCategory\n }\n );\n }\n };\n\n const list = async (params: BlockCategoryStorageOperationsListParams) => {\n const { where, sort, limit } = params;\n\n const { tenant, locale, ...restWhere } = where;\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey({ tenant, locale }),\n options: {\n gt: \" \"\n }\n };\n\n let items: BlockCategory[] = [];\n\n try {\n items = await queryAll<BlockCategory>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list block categories by given parameters.\",\n ex.code || \"BLOCK_CATEGORIES_LIST_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n\n const fields = plugins.byType<BlockCategoryDynamoDbElasticFieldPlugin>(\n BlockCategoryDynamoDbElasticFieldPlugin.type\n );\n\n const filteredItems = filterItems<BlockCategory>({\n plugins,\n where: restWhere,\n items,\n fields\n });\n\n const sortedItems = sortItems<BlockCategory>({\n items: filteredItems,\n sort,\n fields\n });\n\n return createListResponse({\n items: sortedItems,\n limit: limit || 100000,\n totalCount: filteredItems.length,\n after: null\n });\n };\n\n return {\n dataLoader,\n get,\n create,\n update,\n delete: deleteBlockCategory,\n list\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAUA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,wCAAA,GAAAN,OAAA;AAEA,IAAAO,KAAA,GAAAP,OAAA;AAEA,IAAAQ,WAAA,GAAAR,OAAA;AAEA,MAAMS,UAAU,GAAGA,CAAA,KAAc;EAC7B,OAAO,kBAAkB;AAC7B,CAAC;AAMM,MAAMC,oCAAoC,GAAGA,CAAC;EACjDC,MAAM;EACN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AAC;MACtBV,KAAK,EAAEQ,WAAW;MAClBd,KAAK,EAAEA,KAAK,IAAI,MAAM;MACtBiB,UAAU,EAAEL,aAAa,CAACM,MAAM;MAChCC,KAAK,EAAE;IACX,CAAC,CAAC;EACN,CAAC;EAED,OAAO;IACHjD,UAAU;IACVE,GAAG;IACHQ,MAAM;IACNa,MAAM;IACN2B,MAAM,EAAExB,mBAAmB;IAC3BE;EACJ,CAAC;AACL,CAAC;AAACuB,OAAA,CAAAtD,oCAAA,GAAAA,oCAAA"}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_query","_sort","_filter","_dataLoader","_listResponse","_BlockCategoryDynamoDbElasticFieldPlugin","_keys","_dbDynamodb","createType","createBlockCategoryStorageOperations","entity","plugins","dataLoader","BlockCategoryDataLoader","get","params","where","getOne","ex","WebinyError","message","code","create","blockCategory","keys","PK","createPartitionKey","tenant","locale","SK","createSortKey","put","item","TYPE","clear","update","original","category","deleteBlockCategory","deleteItem","list","sort","limit","restWhere","queryAllParams","partitionKey","options","gt","items","queryAll","fields","byType","BlockCategoryDynamoDbElasticFieldPlugin","type","filteredItems","filterItems","sortedItems","sortItems","createListResponse","totalCount","length","after","delete","exports"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n BlockCategory,\n BlockCategoryStorageOperationsCreateParams,\n BlockCategoryStorageOperationsDeleteParams,\n BlockCategoryStorageOperationsGetParams,\n BlockCategoryStorageOperationsListParams,\n BlockCategoryStorageOperationsUpdateParams\n} from \"@webiny/api-page-builder/types\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { queryAll, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { sortItems } from \"@webiny/db-dynamodb/utils/sort\";\nimport { filterItems } from \"@webiny/db-dynamodb/utils/filter\";\nimport { BlockCategoryDataLoader } from \"./dataLoader\";\nimport { createListResponse } from \"@webiny/db-dynamodb/utils/listResponse\";\nimport { BlockCategoryDynamoDbElasticFieldPlugin } from \"~/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createPartitionKey, createSortKey } from \"~/operations/blockCategory/keys\";\nimport { BlockCategoryStorageOperations } from \"~/types\";\nimport { deleteItem, put } from \"@webiny/db-dynamodb\";\n\nconst createType = (): string => {\n return \"pb.blockCategory\";\n};\n\nexport interface CreateBlockCategoryStorageOperationsParams {\n entity: Entity<any>;\n plugins: PluginsContainer;\n}\nexport const createBlockCategoryStorageOperations = ({\n entity,\n plugins\n}: CreateBlockCategoryStorageOperationsParams): BlockCategoryStorageOperations => {\n const dataLoader = new BlockCategoryDataLoader({\n entity\n });\n\n const get = async (params: BlockCategoryStorageOperationsGetParams) => {\n const { where } = params;\n\n try {\n return await dataLoader.getOne(where);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load block category by given parameters.\",\n ex.code || \"BLOCK_CATEGORY_GET_ERROR\",\n {\n where\n }\n );\n }\n };\n\n const create = async (params: BlockCategoryStorageOperationsCreateParams) => {\n const { blockCategory } = params;\n\n const keys = {\n PK: createPartitionKey({\n tenant: blockCategory.tenant,\n locale: blockCategory.locale\n }),\n SK: createSortKey(blockCategory)\n };\n\n try {\n await put({\n entity,\n item: {\n ...blockCategory,\n TYPE: createType(),\n ...keys\n }\n });\n /**\n * Always clear data loader cache when modifying the records.\n */\n dataLoader.clear();\n\n return blockCategory;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create block category.\",\n ex.code || \"BLOCK_CATEGORY_CREATE_ERROR\",\n {\n keys\n }\n );\n }\n };\n\n const update = async (params: BlockCategoryStorageOperationsUpdateParams) => {\n const { original, blockCategory } = params;\n const keys = {\n PK: createPartitionKey({\n tenant: original.tenant,\n locale: original.locale\n }),\n SK: createSortKey(blockCategory)\n };\n\n try {\n await put({\n entity,\n item: {\n ...blockCategory,\n TYPE: createType(),\n ...keys\n }\n });\n /**\n * Always clear data loader cache when modifying the records.\n */\n dataLoader.clear();\n\n return blockCategory;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update block category.\",\n ex.code || \"BLOCK_CATEGORY_UPDATE_ERROR\",\n {\n keys,\n original,\n category: blockCategory\n }\n );\n }\n };\n\n const deleteBlockCategory = async (params: BlockCategoryStorageOperationsDeleteParams) => {\n const { blockCategory } = params;\n const keys = {\n PK: createPartitionKey({\n tenant: blockCategory.tenant,\n locale: blockCategory.locale\n }),\n SK: createSortKey(blockCategory)\n };\n\n try {\n await deleteItem({\n entity,\n keys\n });\n /**\n * Always clear data loader cache when modifying the records.\n */\n dataLoader.clear();\n\n return blockCategory;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete block category.\",\n ex.code || \"BLOCK_CATEGORY_DELETE_ERROR\",\n {\n keys,\n blockCategory\n }\n );\n }\n };\n\n const list = async (params: BlockCategoryStorageOperationsListParams) => {\n const { where, sort, limit } = params;\n\n const { tenant, locale, ...restWhere } = where;\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey({ tenant, locale }),\n options: {\n gt: \" \"\n }\n };\n\n let items: BlockCategory[] = [];\n\n try {\n items = await queryAll<BlockCategory>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list block categories by given parameters.\",\n ex.code || \"BLOCK_CATEGORIES_LIST_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n\n const fields = plugins.byType<BlockCategoryDynamoDbElasticFieldPlugin>(\n BlockCategoryDynamoDbElasticFieldPlugin.type\n );\n\n const filteredItems = filterItems<BlockCategory>({\n plugins,\n where: restWhere,\n items,\n fields\n });\n\n const sortedItems = sortItems<BlockCategory>({\n items: filteredItems,\n sort,\n fields\n });\n\n return createListResponse({\n items: sortedItems,\n limit: limit || 100000,\n totalCount: filteredItems.length,\n after: null\n });\n };\n\n return {\n dataLoader,\n get,\n create,\n update,\n delete: deleteBlockCategory,\n list\n };\n};\n"],"mappings":";;;;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YAAY,EAAED,cAAc,CAACC,YAAY;QACzCC,OAAO,EAAEF,cAAc,CAACE;MAC5B,CACJ,CAAC;IACL;IAEA,MAAMI,MAAM,GAAGvC,OAAO,CAACwC,MAAM,CACzBC,gFAAuC,CAACC,IAC5C,CAAC;IAED,MAAMC,aAAa,GAAG,IAAAC,mBAAW,EAAgB;MAC7C5C,OAAO;MACPK,KAAK,EAAE2B,SAAS;MAChBK,KAAK;MACLE;IACJ,CAAC,CAAC;IAEF,MAAMM,WAAW,GAAG,IAAAC,eAAS,EAAgB;MACzCT,KAAK,EAAEM,aAAa;MACpBb,IAAI;MACJS;IACJ,CAAC,CAAC;IAEF,OAAO,IAAAQ,gCAAkB,EAAC;MACtBV,KAAK,EAAEQ,WAAW;MAClBd,KAAK,EAAEA,KAAK,IAAI,MAAM;MACtBiB,UAAU,EAAEL,aAAa,CAACM,MAAM;MAChCC,KAAK,EAAE;IACX,CAAC,CAAC;EACN,CAAC;EAED,OAAO;IACHjD,UAAU;IACVE,GAAG;IACHQ,MAAM;IACNa,MAAM;IACN2B,MAAM,EAAExB,mBAAmB;IAC3BE;EACJ,CAAC;AACL,CAAC;AAACuB,OAAA,CAAAtD,oCAAA,GAAAA,oCAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createPartitionKey","params","tenant","locale","exports","createSortKey","slug"],"sources":["keys.ts"],"sourcesContent":["export interface PartitionKeyParams {\n tenant: string;\n locale: string;\n}\nexport const createPartitionKey = (params: PartitionKeyParams): string => {\n const { tenant, locale } = params;\n return `T#${tenant}#L#${locale}#PB#BC`;\n};\n\nexport interface SortKeyParams {\n slug: string;\n}\nexport const createSortKey = (params: SortKeyParams): string => {\n const { slug } = params;\n return slug;\n};\n"],"mappings":";;;;;;AAIO,MAAMA,kBAAkB,GAAIC,MAA0B,IAAa;EACtE,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGF,MAAM;EACjC,OAAQ,KAAIC,MAAO,MAAKC,MAAO,QAAO;AAC1C,CAAC;AAACC,OAAA,CAAAJ,kBAAA,GAAAA,kBAAA;AAKK,MAAMK,aAAa,GAAIJ,MAAqB,IAAa;EAC5D,MAAM;IAAEK;EAAK,CAAC,GAAGL,MAAM;EACvB,OAAOK,IAAI;AACf,CAAC;AAACF,OAAA,CAAAC,aAAA,GAAAA,aAAA"}
|
|
1
|
+
{"version":3,"names":["createPartitionKey","params","tenant","locale","exports","createSortKey","slug"],"sources":["keys.ts"],"sourcesContent":["export interface PartitionKeyParams {\n tenant: string;\n locale: string;\n}\nexport const createPartitionKey = (params: PartitionKeyParams): string => {\n const { tenant, locale } = params;\n return `T#${tenant}#L#${locale}#PB#BC`;\n};\n\nexport interface SortKeyParams {\n slug: string;\n}\nexport const createSortKey = (params: SortKeyParams): string => {\n const { slug } = params;\n return slug;\n};\n"],"mappings":";;;;;;AAIO,MAAMA,kBAAkB,GAAIC,MAA0B,IAAa;EACtE,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGF,MAAM;EACjC,OAAQ,KAAIC,MAAO,MAAKC,MAAO,QAAO;AAC1C,CAAC;AAACC,OAAA,CAAAJ,kBAAA,GAAAA,kBAAA;AAKK,MAAMK,aAAa,GAAIJ,MAAqB,IAAa;EAC5D,MAAM;IAAEK;EAAK,CAAC,GAAGL,MAAM;EACvB,OAAOK,IAAI;AACf,CAAC;AAACF,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_batchRead","_cleanup","_keys","CategoryDataLoader","_getDataLoader","undefined","constructor","params","entity","getOne","item","getDataLoader","load","getAll","items","loadMany","clear","clearAll","cacheKeyFn","key","tenant","locale","slug","DataLoader","batched","map","getBatch","PK","createPartitionKey","SK","createSortKey","records","batchReadAll","table","results","reduce","collection","result","cleanupItem","exports"],"sources":["dataLoader.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb/utils/batchRead\";\nimport { Category } from \"@webiny/api-page-builder/types\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { createPartitionKey, createSortKey } from \"./keys\";\nimport { DataLoaderInterface } from \"~/types\";\n\ninterface Params {\n entity: Entity<any>;\n}\n\ntype DataLoaderGetItem = Pick<Category, \"slug\" | \"tenant\" | \"locale\">;\n\nexport class CategoryDataLoader implements DataLoaderInterface {\n private _getDataLoader: DataLoader<any, any> | undefined = undefined;\n\n private readonly entity: Entity<any>;\n\n constructor(params: Params) {\n this.entity = params.entity;\n }\n\n public async getOne(item: DataLoaderGetItem): Promise<Category> {\n return await this.getDataLoader().load(item);\n }\n\n public async getAll(items: DataLoaderGetItem[]): Promise<Category[]> {\n return await this.getDataLoader().loadMany(items);\n }\n\n public clear(): void {\n this.getDataLoader().clearAll();\n }\n\n private getDataLoader(): DataLoader<any, any> {\n if (!this._getDataLoader) {\n const cacheKeyFn = (key: DataLoaderGetItem) => {\n return `T#${key.tenant}#L#${key.locale}#${key.slug}`;\n };\n this._getDataLoader = new DataLoader(\n async items => {\n const batched = items.map(item => {\n return this.entity.getBatch({\n PK: createPartitionKey(item),\n SK: createSortKey(item)\n });\n });\n\n const records = await batchReadAll<Category>({\n table: this.entity.table,\n items: batched\n });\n\n const results = records.reduce((collection, result) => {\n if (!result) {\n return collection;\n }\n const key = cacheKeyFn(result);\n collection[key] = cleanupItem(this.entity, result) as Category;\n return collection;\n }, {} as Record<string, Category>);\n return items.map(item => {\n const key = cacheKeyFn(item);\n return results[key] || null;\n });\n },\n {\n cacheKeyFn\n }\n );\n }\n return this._getDataLoader;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,G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,CAAC,CAACC,UAAU,EAAEC,MAAM,KAAK;UACnD,IAAI,CAACA,MAAM,EAAE;YACT,OAAOD,UAAU;UACrB;UACA,MAAMjB,GAAG,GAAGD,UAAU,CAACmB,MAAM,CAAC;UAC9BD,UAAU,CAACjB,GAAG,CAAC,GAAG,IAAAmB,oBAAW,EAAC,IAAI,CAAC9B,MAAM,EAAE6B,MAAM,CAAa;UAC9D,OAAOD,UAAU;QACrB,CAAC,EAAE,CAAC,CAA6B,CAAC;QAClC,OAAOtB,KAAK,CAACW,GAAG,CAACf,IAAI,IAAI;UACrB,MAAMS,GAAG,GAAGD,UAAU,CAACR,IAAI,CAAC;UAC5B,OAAOwB,OAAO,CAACf,GAAG,CAAC,IAAI,IAAI;QAC/B,CAAC,CAAC;MACN,CAAC,EACD;QACID;MACJ,CACJ,CAAC;IACL;IACA,OAAO,IAAI,CAACd,cAAc;EAC9B;AACJ;AAACmC,OAAA,CAAApC,kBAAA,GAAAA,kBAAA"}
|
|
1
|
+
{"version":3,"names":["_dataloader","_interopRequireDefault","require","_batchRead","_cleanup","_keys","CategoryDataLoader","_getDataLoader","undefined","constructor","params","entity","getOne","item","getDataLoader","load","getAll","items","loadMany","clear","clearAll","cacheKeyFn","key","tenant","locale","slug","DataLoader","batched","map","getBatch","PK","createPartitionKey","SK","createSortKey","records","batchReadAll","table","results","reduce","collection","result","cleanupItem","exports"],"sources":["dataLoader.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb/utils/batchRead\";\nimport { Category } from \"@webiny/api-page-builder/types\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { createPartitionKey, createSortKey } from \"./keys\";\nimport { DataLoaderInterface } from \"~/types\";\n\ninterface Params {\n entity: Entity<any>;\n}\n\ntype DataLoaderGetItem = Pick<Category, \"slug\" | \"tenant\" | \"locale\">;\n\nexport class CategoryDataLoader implements DataLoaderInterface {\n private _getDataLoader: DataLoader<any, any> | undefined = undefined;\n\n private readonly entity: Entity<any>;\n\n constructor(params: Params) {\n this.entity = params.entity;\n }\n\n public async getOne(item: DataLoaderGetItem): Promise<Category> {\n return await this.getDataLoader().load(item);\n }\n\n public async getAll(items: DataLoaderGetItem[]): Promise<Category[]> {\n return await this.getDataLoader().loadMany(items);\n }\n\n public clear(): void {\n this.getDataLoader().clearAll();\n }\n\n private getDataLoader(): DataLoader<any, any> {\n if (!this._getDataLoader) {\n const cacheKeyFn = (key: DataLoaderGetItem) => {\n return `T#${key.tenant}#L#${key.locale}#${key.slug}`;\n };\n this._getDataLoader = new DataLoader(\n async items => {\n const batched = items.map(item => {\n return this.entity.getBatch({\n PK: createPartitionKey(item),\n SK: createSortKey(item)\n });\n });\n\n const records = await batchReadAll<Category>({\n table: this.entity.table,\n items: batched\n });\n\n const results = records.reduce((collection, result) => {\n if (!result) {\n return collection;\n }\n const key = cacheKeyFn(result);\n collection[key] = cleanupItem(this.entity, result) as Category;\n return collection;\n }, {} as Record<string, Category>);\n return items.map(item => {\n const key = cacheKeyFn(item);\n return results[key] || null;\n });\n },\n {\n cacheKeyFn\n }\n );\n }\n return this._getDataLoader;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AASO,MAAMI,kBAAkB,CAAgC;EACnDC,cAAc,GAAqCC,SAAS;EAIpEC,WAAWA,CAACC,MAAc,EAAE;IACxB,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EAEA,MAAaC,MAAMA,CAACC,IAAuB,EAAqB;IAC5D,OAAO,MAAM,IAAI,CAACC,aAAa,CAAC,CAAC,CAACC,IAAI,CAACF,IAAI,CAAC;EAChD;EAEA,MAAaG,MAAMA,CAACC,KAA0B,EAAu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