@webiny/api-page-builder-so-ddb-es 0.0.0-mt-2 → 0.0.0-unstable.06b2ede40f

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.
Files changed (229) hide show
  1. package/configurations.d.ts +18 -0
  2. package/configurations.js +53 -0
  3. package/configurations.js.map +1 -0
  4. package/definitions/blockCategoryEntity.d.ts +10 -0
  5. package/definitions/blockCategoryEntity.js +57 -0
  6. package/definitions/blockCategoryEntity.js.map +1 -0
  7. package/definitions/categoryEntity.d.ts +10 -6
  8. package/definitions/categoryEntity.js +12 -23
  9. package/definitions/categoryEntity.js.map +1 -0
  10. package/definitions/menuEntity.d.ts +10 -6
  11. package/definitions/menuEntity.js +12 -23
  12. package/definitions/menuEntity.js.map +1 -0
  13. package/definitions/pageBlockEntity.d.ts +10 -0
  14. package/definitions/pageBlockEntity.js +74 -0
  15. package/definitions/pageBlockEntity.js.map +1 -0
  16. package/definitions/pageElasticsearchEntity.d.ts +10 -6
  17. package/definitions/pageElasticsearchEntity.js +15 -23
  18. package/definitions/pageElasticsearchEntity.js.map +1 -0
  19. package/definitions/pageElementEntity.d.ts +10 -6
  20. package/definitions/pageElementEntity.js +12 -23
  21. package/definitions/pageElementEntity.js.map +1 -0
  22. package/definitions/pageEntity.d.ts +10 -6
  23. package/definitions/pageEntity.js +20 -32
  24. package/definitions/pageEntity.js.map +1 -0
  25. package/definitions/pageTemplateEntity.d.ts +10 -0
  26. package/definitions/pageTemplateEntity.js +42 -0
  27. package/definitions/pageTemplateEntity.js.map +1 -0
  28. package/definitions/settingsEntity.d.ts +8 -6
  29. package/definitions/settingsEntity.js +11 -54
  30. package/definitions/settingsEntity.js.map +1 -0
  31. package/definitions/systemEntity.d.ts +10 -6
  32. package/definitions/systemEntity.js +15 -23
  33. package/definitions/systemEntity.js.map +1 -0
  34. package/definitions/table.d.ts +8 -5
  35. package/definitions/table.js +22 -21
  36. package/definitions/table.js.map +1 -0
  37. package/definitions/tableElasticsearch.d.ts +9 -5
  38. package/definitions/tableElasticsearch.js +16 -28
  39. package/definitions/tableElasticsearch.js.map +1 -0
  40. package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
  41. package/elasticsearch/createElasticsearchIndex.js +41 -0
  42. package/elasticsearch/createElasticsearchIndex.js.map +1 -0
  43. package/elasticsearch/indices/base.d.ts +2 -0
  44. package/elasticsearch/indices/base.js +14 -0
  45. package/elasticsearch/indices/base.js.map +1 -0
  46. package/elasticsearch/indices/index.d.ts +1 -0
  47. package/elasticsearch/indices/index.js +14 -0
  48. package/elasticsearch/indices/index.js.map +1 -0
  49. package/elasticsearch/indices/japanese.d.ts +2 -0
  50. package/elasticsearch/indices/japanese.js +15 -0
  51. package/elasticsearch/indices/japanese.js.map +1 -0
  52. package/index.d.ts +3 -8
  53. package/index.js +246 -16
  54. package/index.js.map +1 -0
  55. package/operations/blockCategory/dataLoader.d.ts +17 -0
  56. package/operations/blockCategory/dataLoader.js +63 -0
  57. package/operations/blockCategory/dataLoader.js.map +1 -0
  58. package/operations/blockCategory/fields.d.ts +2 -0
  59. package/operations/blockCategory/fields.js +27 -0
  60. package/operations/blockCategory/fields.js.map +1 -0
  61. package/operations/blockCategory/index.d.ts +8 -0
  62. package/operations/blockCategory/index.js +192 -0
  63. package/operations/blockCategory/index.js.map +1 -0
  64. package/operations/blockCategory/keys.d.ts +9 -0
  65. package/operations/blockCategory/keys.js +23 -0
  66. package/operations/blockCategory/keys.js.map +1 -0
  67. package/operations/category/dataLoader.d.ts +17 -0
  68. package/operations/category/{CategoryDataLoader.js → dataLoader.js} +13 -27
  69. package/operations/category/dataLoader.js.map +1 -0
  70. package/operations/category/fields.d.ts +1 -2
  71. package/operations/category/fields.js +4 -5
  72. package/operations/category/fields.js.map +1 -0
  73. package/operations/category/index.d.ts +7 -4
  74. package/operations/category/index.js +185 -21
  75. package/operations/category/index.js.map +1 -0
  76. package/operations/category/keys.d.ts +9 -0
  77. package/operations/category/keys.js +23 -0
  78. package/operations/category/keys.js.map +1 -0
  79. package/operations/menu/fields.d.ts +1 -2
  80. package/operations/menu/fields.js +19 -18
  81. package/operations/menu/fields.js.map +1 -0
  82. package/operations/menu/index.d.ts +7 -4
  83. package/operations/menu/index.js +193 -21
  84. package/operations/menu/index.js.map +1 -0
  85. package/operations/pageBlock/compression.d.ts +18 -0
  86. package/operations/pageBlock/compression.js +42 -0
  87. package/operations/pageBlock/compression.js.map +1 -0
  88. package/operations/pageBlock/dataLoader.d.ts +17 -0
  89. package/operations/pageBlock/dataLoader.js +63 -0
  90. package/operations/pageBlock/dataLoader.js.map +1 -0
  91. package/operations/pageBlock/fields.d.ts +2 -0
  92. package/operations/pageBlock/fields.js +24 -0
  93. package/operations/pageBlock/fields.js.map +1 -0
  94. package/operations/pageBlock/index.d.ts +8 -0
  95. package/operations/pageBlock/index.js +219 -0
  96. package/operations/pageBlock/index.js.map +1 -0
  97. package/operations/pageBlock/keys.d.ts +20 -0
  98. package/operations/pageBlock/keys.js +37 -0
  99. package/operations/pageBlock/keys.js.map +1 -0
  100. package/operations/pageElement/fields.d.ts +1 -2
  101. package/operations/pageElement/fields.js +4 -5
  102. package/operations/pageElement/fields.js.map +1 -0
  103. package/operations/pageElement/index.d.ts +7 -6
  104. package/operations/pageElement/index.js +182 -21
  105. package/operations/pageElement/index.js.map +1 -0
  106. package/operations/pageTemplate/dataLoader.d.ts +17 -0
  107. package/operations/pageTemplate/dataLoader.js +62 -0
  108. package/operations/pageTemplate/dataLoader.js.map +1 -0
  109. package/operations/pageTemplate/fields.d.ts +2 -0
  110. package/operations/pageTemplate/fields.js +24 -0
  111. package/operations/pageTemplate/fields.js.map +1 -0
  112. package/operations/pageTemplate/index.d.ts +8 -0
  113. package/operations/pageTemplate/index.js +204 -0
  114. package/operations/pageTemplate/index.js.map +1 -0
  115. package/operations/pageTemplate/keys.d.ts +5 -0
  116. package/operations/pageTemplate/keys.js +23 -0
  117. package/operations/pageTemplate/keys.js.map +1 -0
  118. package/operations/pages/elasticsearchQueryBody.d.ts +8 -12
  119. package/operations/pages/elasticsearchQueryBody.js +43 -101
  120. package/operations/pages/elasticsearchQueryBody.js.map +1 -0
  121. package/operations/pages/fields.d.ts +3 -2
  122. package/operations/pages/fields.js +18 -5
  123. package/operations/pages/fields.js.map +1 -0
  124. package/operations/pages/helpers.d.ts +10 -18
  125. package/operations/pages/helpers.js +34 -33
  126. package/operations/pages/helpers.js.map +1 -0
  127. package/operations/pages/index.d.ts +10 -4
  128. package/operations/pages/index.js +785 -18
  129. package/operations/pages/index.js.map +1 -0
  130. package/operations/pages/keys.d.ts +24 -0
  131. package/operations/pages/keys.js +59 -0
  132. package/operations/pages/keys.js.map +1 -0
  133. package/operations/pages/logIgnoredEsResponseError.d.ts +7 -0
  134. package/operations/pages/logIgnoredEsResponseError.js +28 -0
  135. package/operations/pages/logIgnoredEsResponseError.js.map +1 -0
  136. package/operations/pages/shouldIgnoreEsResponseError.d.ts +2 -0
  137. package/operations/pages/shouldIgnoreEsResponseError.js +13 -0
  138. package/operations/pages/shouldIgnoreEsResponseError.js.map +1 -0
  139. package/operations/settings/index.d.ts +11 -6
  140. package/operations/settings/index.js +140 -15
  141. package/operations/settings/index.js.map +1 -0
  142. package/operations/system/index.d.ts +5 -4
  143. package/operations/system/index.js +94 -23
  144. package/operations/system/index.js.map +1 -0
  145. package/package.json +44 -36
  146. package/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin.d.ts +4 -0
  147. package/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin.js +13 -0
  148. package/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin.js.map +1 -0
  149. package/plugins/definitions/CategoryDynamoDbElasticFieldPlugin.js +5 -9
  150. package/plugins/definitions/CategoryDynamoDbElasticFieldPlugin.js.map +1 -0
  151. package/plugins/definitions/IndexPageDataPlugin.d.ts +12 -11
  152. package/plugins/definitions/IndexPageDataPlugin.js +3 -12
  153. package/plugins/definitions/IndexPageDataPlugin.js.map +1 -0
  154. package/plugins/definitions/MenuDynamoDbElasticFieldPlugin.js +5 -9
  155. package/plugins/definitions/MenuDynamoDbElasticFieldPlugin.js.map +1 -0
  156. package/plugins/definitions/PageBlockDynamoDbFieldPlugin.d.ts +4 -0
  157. package/plugins/definitions/PageBlockDynamoDbFieldPlugin.js +13 -0
  158. package/plugins/definitions/PageBlockDynamoDbFieldPlugin.js.map +1 -0
  159. package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.d.ts +4 -0
  160. package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.js +13 -0
  161. package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.js.map +1 -0
  162. package/plugins/definitions/PageElasticsearchBodyModifierPlugin.d.ts +6 -2
  163. package/plugins/definitions/PageElasticsearchBodyModifierPlugin.js +6 -10
  164. package/plugins/definitions/PageElasticsearchBodyModifierPlugin.js.map +1 -0
  165. package/plugins/definitions/PageElasticsearchFieldPlugin.d.ts +1 -2
  166. package/plugins/definitions/PageElasticsearchFieldPlugin.js +5 -14
  167. package/plugins/definitions/PageElasticsearchFieldPlugin.js.map +1 -0
  168. package/plugins/definitions/PageElasticsearchIndexPlugin.d.ts +4 -0
  169. package/plugins/definitions/PageElasticsearchIndexPlugin.js +13 -0
  170. package/plugins/definitions/PageElasticsearchIndexPlugin.js.map +1 -0
  171. package/plugins/definitions/PageElasticsearchQueryModifierPlugin.d.ts +8 -2
  172. package/plugins/definitions/PageElasticsearchQueryModifierPlugin.js +6 -10
  173. package/plugins/definitions/PageElasticsearchQueryModifierPlugin.js.map +1 -0
  174. package/plugins/definitions/PageElasticsearchSortModifierPlugin.d.ts +6 -2
  175. package/plugins/definitions/PageElasticsearchSortModifierPlugin.js +6 -10
  176. package/plugins/definitions/PageElasticsearchSortModifierPlugin.js.map +1 -0
  177. package/plugins/definitions/PageElementDynamoDbElasticFieldPlugin.js +5 -9
  178. package/plugins/definitions/PageElementDynamoDbElasticFieldPlugin.js.map +1 -0
  179. package/plugins/definitions/PageTemplateDynamoDbElasticFieldPlugin.d.ts +4 -0
  180. package/plugins/definitions/PageTemplateDynamoDbElasticFieldPlugin.js +13 -0
  181. package/plugins/definitions/PageTemplateDynamoDbElasticFieldPlugin.js.map +1 -0
  182. package/plugins/definitions/SearchLatestPagesPlugin.d.ts +1 -1
  183. package/plugins/definitions/SearchLatestPagesPlugin.js +5 -9
  184. package/plugins/definitions/SearchLatestPagesPlugin.js.map +1 -0
  185. package/plugins/definitions/SearchPagesPlugin.d.ts +4 -4
  186. package/plugins/definitions/SearchPagesPlugin.js +2 -13
  187. package/plugins/definitions/SearchPagesPlugin.js.map +1 -0
  188. package/plugins/definitions/SearchPublishedPagesPlugin.d.ts +1 -1
  189. package/plugins/definitions/SearchPublishedPagesPlugin.js +5 -9
  190. package/plugins/definitions/SearchPublishedPagesPlugin.js.map +1 -0
  191. package/plugins/definitions/index.d.ts +15 -0
  192. package/plugins/definitions/index.js +172 -0
  193. package/plugins/definitions/index.js.map +1 -0
  194. package/plugins/index.d.ts +1 -0
  195. package/plugins/index.js +18 -0
  196. package/plugins/index.js.map +1 -0
  197. package/tasks/createIndexTaskPlugin.d.ts +2 -0
  198. package/tasks/createIndexTaskPlugin.js +36 -0
  199. package/tasks/createIndexTaskPlugin.js.map +1 -0
  200. package/types.d.ts +63 -0
  201. package/types.js +21 -0
  202. package/types.js.map +1 -0
  203. package/operations/category/CategoryDataLoader.d.ts +0 -20
  204. package/operations/category/CategoryStorageOperations.d.ts +0 -29
  205. package/operations/category/CategoryStorageOperations.js +0 -243
  206. package/operations/configurations.d.ts +0 -36
  207. package/operations/configurations.js +0 -71
  208. package/operations/menu/MenuStorageOperations.d.ts +0 -23
  209. package/operations/menu/MenuStorageOperations.js +0 -235
  210. package/operations/pageElement/PageElementStorageOperations.d.ts +0 -23
  211. package/operations/pageElement/PageElementStorageOperations.js +0 -234
  212. package/operations/pages/PageStorageOperations.d.ts +0 -79
  213. package/operations/pages/PageStorageOperations.js +0 -1117
  214. package/operations/settings/SettingsStorageOperations.d.ts +0 -35
  215. package/operations/settings/SettingsStorageOperations.js +0 -191
  216. package/operations/system/InstallationDdbEsPlugin.d.ts +0 -2
  217. package/operations/system/InstallationDdbEsPlugin.js +0 -73
  218. package/operations/system/SystemStorageOperations.d.ts +0 -16
  219. package/operations/system/SystemStorageOperations.js +0 -114
  220. package/upgrades/index.d.ts +0 -2
  221. package/upgrades/index.js +0 -14
  222. package/upgrades/v5.15.0/category.d.ts +0 -2
  223. package/upgrades/v5.15.0/category.js +0 -75
  224. package/upgrades/v5.15.0/index.d.ts +0 -4
  225. package/upgrades/v5.15.0/index.js +0 -52
  226. package/upgrades/v5.15.0/menu.d.ts +0 -2
  227. package/upgrades/v5.15.0/menu.js +0 -75
  228. package/upgrades/v5.15.0/pageElement.d.ts +0 -2
  229. package/upgrades/v5.15.0/pageElement.js +0 -75
@@ -0,0 +1,18 @@
1
+ import type { PbContext } from "./types";
2
+ import type { ElasticsearchIndexRequestBody } from "@webiny/api-elasticsearch/types";
3
+ export interface ConfigurationsElasticsearch {
4
+ index: string;
5
+ }
6
+ export interface ConfigurationsElasticsearchParams {
7
+ tenant: string;
8
+ locale: string;
9
+ }
10
+ export interface ConfigurationsIndexSettingsParams {
11
+ context: PbContext;
12
+ locale: string;
13
+ }
14
+ export interface Configurations {
15
+ es: (params: ConfigurationsElasticsearchParams) => ConfigurationsElasticsearch;
16
+ indexSettings: (params: ConfigurationsIndexSettingsParams) => Partial<ElasticsearchIndexRequestBody>;
17
+ }
18
+ export declare const configurations: Configurations;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.configurations = void 0;
8
+ var _error = _interopRequireDefault(require("@webiny/error"));
9
+ var _apiElasticsearch = require("@webiny/api-elasticsearch");
10
+ var _plugins = require("./plugins");
11
+ const configurations = exports.configurations = {
12
+ es: params => {
13
+ const {
14
+ tenant,
15
+ locale
16
+ } = params;
17
+ if (!tenant) {
18
+ throw new _error.default(`Missing "tenant" parameter when trying to create Elasticsearch index name.`, "TENANT_ERROR");
19
+ }
20
+ const sharedIndex = (0, _apiElasticsearch.isSharedElasticsearchIndex)();
21
+ const tenantId = sharedIndex ? "root" : tenant;
22
+ let localeCode = null;
23
+ if (process.env.WEBINY_ELASTICSEARCH_INDEX_LOCALE === "true") {
24
+ if (!locale) {
25
+ throw new _error.default(`Missing "locale" parameter when trying to create Elasticsearch index name.`, "LOCALE_ERROR");
26
+ }
27
+ localeCode = locale;
28
+ }
29
+ const index = [tenantId, localeCode, "page-builder"].filter(Boolean).join("-").toLowerCase();
30
+ const prefix = (0, _apiElasticsearch.getElasticsearchIndexPrefix)();
31
+ if (!prefix) {
32
+ return {
33
+ index
34
+ };
35
+ }
36
+ return {
37
+ index: prefix + index
38
+ };
39
+ },
40
+ indexSettings: ({
41
+ context,
42
+ locale
43
+ }) => {
44
+ const plugin = (0, _apiElasticsearch.getLastAddedIndexPlugin)({
45
+ container: context.plugins,
46
+ type: _plugins.PageElasticsearchIndexPlugin.type,
47
+ locale
48
+ });
49
+ return plugin ? plugin.body : {};
50
+ }
51
+ };
52
+
53
+ //# sourceMappingURL=configurations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_apiElasticsearch","_plugins","configurations","exports","es","params","tenant","locale","WebinyError","sharedIndex","isSharedElasticsearchIndex","tenantId","localeCode","process","env","WEBINY_ELASTICSEARCH_INDEX_LOCALE","index","filter","Boolean","join","toLowerCase","prefix","getElasticsearchIndexPrefix","indexSettings","context","plugin","getLastAddedIndexPlugin","container","plugins","type","PageElasticsearchIndexPlugin","body"],"sources":["configurations.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n getElasticsearchIndexPrefix,\n getLastAddedIndexPlugin,\n isSharedElasticsearchIndex\n} from \"@webiny/api-elasticsearch\";\nimport { PageElasticsearchIndexPlugin } from \"~/plugins\";\nimport type { PbContext } from \"~/types\";\nimport type { 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 = isSharedElasticsearchIndex();\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 = getElasticsearchIndexPrefix();\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;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAyBO,MAAMG,cAA8B,GAAAC,OAAA,CAAAD,cAAA,GAAG;EAC1CE,EAAE,EAAEC,MAAM,IAAI;IACV,MAAM;MAAEC,MAAM;MAAEC;IAAO,CAAC,GAAGF,MAAM;IACjC,IAAI,CAACC,MAAM,EAAE;MACT,MAAM,IAAIE,cAAW,CACjB,4EAA4E,EAC5E,cACJ,CAAC;IACL;IACA,MAAMC,WAAW,GAAG,IAAAC,4CAA0B,EAAC,CAAC;IAEhD,MAAMC,QAAQ,GAAGF,WAAW,GAAG,MAAM,GAAGH,MAAM;IAC9C,IAAIM,UAAyB,GAAG,IAAI;IACpC,IAAIC,OAAO,CAACC,GAAG,CAACC,iCAAiC,KAAK,MAAM,EAAE;MAC1D,IAAI,CAACR,MAAM,EAAE;QACT,MAAM,IAAIC,cAAW,CACjB,4EAA4E,EAC5E,cACJ,CAAC;MACL;MACAI,UAAU,GAAGL,MAAM;IACvB;IAEA,MAAMS,KAAK,GAAG,CAACL,QAAQ,EAAEC,UAAU,EAAE,cAAc,CAAC,CAC/CK,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC,CACTC,WAAW,CAAC,CAAC;IAElB,MAAMC,MAAM,GAAG,IAAAC,6CAA2B,EAAC,CAAC;IAC5C,IAAI,CAACD,MAAM,EAAE;MACT,OAAO;QACHL;MACJ,CAAC;IACL;IACA,OAAO;MACHA,KAAK,EAAEK,MAAM,GAAGL;IACpB,CAAC;EACL,CAAC;EACDO,aAAa,EAAEA,CAAC;IAAEC,OAAO;IAAEjB;EAAO,CAAC,KAAK;IACpC,MAAMkB,MAAM,GAAG,IAAAC,yCAAuB,EAA+B;MACjEC,SAAS,EAAEH,OAAO,CAACI,OAAO;MAC1BC,IAAI,EAAEC,qCAA4B,CAACD,IAAI;MACvCtB;IACJ,CAAC,CAAC;IAEF,OAAOkB,MAAM,GAAGA,MAAM,CAACM,IAAI,GAAG,CAAC,CAAC;EACpC;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
4
+ interface Params {
5
+ table: Table<string, string, string>;
6
+ entityName: string;
7
+ attributes: Attributes;
8
+ }
9
+ export declare const createBlockCategoryEntity: (params: Params) => Entity<any>;
10
+ export {};
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createBlockCategoryEntity = void 0;
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
+ const createBlockCategoryEntity = params => {
9
+ const {
10
+ entityName,
11
+ attributes,
12
+ table
13
+ } = params;
14
+ return new _toolbox.Entity({
15
+ name: entityName,
16
+ table,
17
+ attributes: {
18
+ PK: {
19
+ partitionKey: true
20
+ },
21
+ SK: {
22
+ sortKey: true
23
+ },
24
+ TYPE: {
25
+ type: "string"
26
+ },
27
+ name: {
28
+ type: "string"
29
+ },
30
+ slug: {
31
+ type: "string"
32
+ },
33
+ icon: {
34
+ type: "string"
35
+ },
36
+ description: {
37
+ type: "string"
38
+ },
39
+ createdOn: {
40
+ type: "string"
41
+ },
42
+ createdBy: {
43
+ type: "map"
44
+ },
45
+ tenant: {
46
+ type: "string"
47
+ },
48
+ locale: {
49
+ type: "string"
50
+ },
51
+ ...(attributes || {})
52
+ }
53
+ });
54
+ };
55
+ exports.createBlockCategoryEntity = createBlockCategoryEntity;
56
+
57
+ //# sourceMappingURL=blockCategoryEntity.js.map
@@ -0,0 +1 @@
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 type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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":";;;;;;AACA,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,6 +1,10 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
2
- import { PbContext } from "@webiny/api-page-builder/graphql/types";
3
- export declare const defineCategoryEntity: (params: {
4
- context: PbContext;
5
- table: Table;
6
- }) => Entity<any>;
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
4
+ interface Params {
5
+ table: Table<string, string, string>;
6
+ entityName: string;
7
+ attributes: Attributes;
8
+ }
9
+ export declare const createCategoryEntity: (params: Params) => Entity<any>;
10
+ export {};
@@ -1,33 +1,20 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports.defineCategoryEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
-
20
- const defineCategoryEntity = params => {
6
+ exports.createCategoryEntity = void 0;
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
+ const createCategoryEntity = params => {
21
9
  const {
22
- context,
10
+ entityName,
11
+ attributes,
23
12
  table
24
13
  } = params;
25
- const entityName = "PbCategory";
26
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
27
- return new _dynamodbToolbox.Entity({
14
+ return new _toolbox.Entity({
28
15
  name: entityName,
29
16
  table,
30
- attributes: _objectSpread({
17
+ attributes: {
31
18
  PK: {
32
19
  partitionKey: true
33
20
  },
@@ -60,9 +47,11 @@ const defineCategoryEntity = params => {
60
47
  },
61
48
  locale: {
62
49
  type: "string"
63
- }
64
- }, attributes)
50
+ },
51
+ ...(attributes || {})
52
+ }
65
53
  });
66
54
  };
55
+ exports.createCategoryEntity = createCategoryEntity;
67
56
 
68
- exports.defineCategoryEntity = defineCategoryEntity;
57
+ //# sourceMappingURL=categoryEntity.js.map
@@ -0,0 +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 type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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":";;;;;;AACA,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,6 +1,10 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
2
- import { PbContext } from "@webiny/api-page-builder/graphql/types";
3
- export declare const defineMenuEntity: (params: {
4
- context: PbContext;
5
- table: Table;
6
- }) => Entity<any>;
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
4
+ interface Params {
5
+ table: Table<string, string, string>;
6
+ entityName: string;
7
+ attributes: Attributes;
8
+ }
9
+ export declare const createMenuEntity: (params: Params) => Entity<any>;
10
+ export {};
@@ -1,33 +1,20 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports.defineMenuEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
-
20
- const defineMenuEntity = params => {
6
+ exports.createMenuEntity = void 0;
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
+ const createMenuEntity = params => {
21
9
  const {
22
- context,
10
+ entityName,
11
+ attributes,
23
12
  table
24
13
  } = params;
25
- const entityName = "PbMenu";
26
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
27
- return new _dynamodbToolbox.Entity({
14
+ return new _toolbox.Entity({
28
15
  name: entityName,
29
16
  table,
30
- attributes: _objectSpread({
17
+ attributes: {
31
18
  PK: {
32
19
  partitionKey: true
33
20
  },
@@ -60,9 +47,11 @@ const defineMenuEntity = params => {
60
47
  },
61
48
  locale: {
62
49
  type: "string"
63
- }
64
- }, attributes)
50
+ },
51
+ ...(attributes || {})
52
+ }
65
53
  });
66
54
  };
55
+ exports.createMenuEntity = createMenuEntity;
67
56
 
68
- exports.defineMenuEntity = defineMenuEntity;
57
+ //# sourceMappingURL=menuEntity.js.map
@@ -0,0 +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 type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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":";;;;;;AACA,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":[]}
@@ -0,0 +1,10 @@
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
4
+ interface Params {
5
+ table: Table<string, string, string>;
6
+ entityName: string;
7
+ attributes: Attributes;
8
+ }
9
+ export declare const createPageBlockEntity: (params: Params) => Entity<any>;
10
+ export {};
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createPageBlockEntity = void 0;
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
+ const createPageBlockEntity = params => {
9
+ const {
10
+ entityName,
11
+ attributes,
12
+ table
13
+ } = params;
14
+ return new _toolbox.Entity({
15
+ name: entityName,
16
+ table,
17
+ attributes: {
18
+ PK: {
19
+ partitionKey: true
20
+ },
21
+ SK: {
22
+ sortKey: true
23
+ },
24
+ GSI1_PK: {
25
+ type: "string"
26
+ },
27
+ GSI1_SK: {
28
+ type: "string"
29
+ },
30
+ TYPE: {
31
+ type: "string"
32
+ },
33
+ id: {
34
+ type: "string"
35
+ },
36
+ name: {
37
+ type: "string"
38
+ },
39
+ blockCategory: {
40
+ type: "string"
41
+ },
42
+ content: {
43
+ type: "map"
44
+ },
45
+ preview: {
46
+ type: "map"
47
+ },
48
+ createdOn: {
49
+ type: "string"
50
+ },
51
+ createdBy: {
52
+ type: "map"
53
+ },
54
+ tenant: {
55
+ type: "string"
56
+ },
57
+ locale: {
58
+ type: "string"
59
+ },
60
+ dataSources: {
61
+ type: "list",
62
+ default: []
63
+ },
64
+ dataBindings: {
65
+ type: "list",
66
+ default: []
67
+ },
68
+ ...(attributes || {})
69
+ }
70
+ });
71
+ };
72
+ exports.createPageBlockEntity = createPageBlockEntity;
73
+
74
+ //# sourceMappingURL=pageBlockEntity.js.map
@@ -0,0 +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","dataSources","default","dataBindings","exports"],"sources":["pageBlockEntity.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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 dataSources: {\n type: \"list\",\n default: []\n },\n dataBindings: {\n type: \"list\",\n default: []\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AACA,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;MACDW,WAAW,EAAE;QACTX,IAAI,EAAE,MAAM;QACZY,OAAO,EAAE;MACb,CAAC;MACDC,YAAY,EAAE;QACVb,IAAI,EAAE,MAAM;QACZY,OAAO,EAAE;MACb,CAAC;MACD,IAAIrB,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACuB,OAAA,CAAA1B,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -1,6 +1,10 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
2
- import { PbContext } from "@webiny/api-page-builder/graphql/types";
3
- export declare const definePageElasticsearchEntity: (params: {
4
- context: PbContext;
5
- table: Table;
6
- }) => Entity<any>;
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
4
+ interface Params {
5
+ table: Table<string, string, string>;
6
+ entityName: string;
7
+ attributes: Attributes;
8
+ }
9
+ export declare const createPageElasticsearchEntity: (params: Params) => Entity<any>;
10
+ export {};
@@ -1,33 +1,20 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports.definePageElasticsearchEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
-
20
- const definePageElasticsearchEntity = params => {
6
+ exports.createPageElasticsearchEntity = void 0;
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
+ const createPageElasticsearchEntity = params => {
21
9
  const {
22
- context,
10
+ entityName,
11
+ attributes,
23
12
  table
24
13
  } = params;
25
- const entityName = "PbPageElasticsearch";
26
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
27
- return new _dynamodbToolbox.Entity({
14
+ return new _toolbox.Entity({
28
15
  name: entityName,
29
16
  table,
30
- attributes: _objectSpread({
17
+ attributes: {
31
18
  PK: {
32
19
  partitionKey: true
33
20
  },
@@ -39,9 +26,14 @@ const definePageElasticsearchEntity = params => {
39
26
  },
40
27
  data: {
41
28
  type: "map"
42
- }
43
- }, attributes)
29
+ },
30
+ TYPE: {
31
+ type: "string"
32
+ },
33
+ ...(attributes || {})
34
+ }
44
35
  });
45
36
  };
37
+ exports.createPageElasticsearchEntity = createPageElasticsearchEntity;
46
38
 
47
- exports.definePageElasticsearchEntity = definePageElasticsearchEntity;
39
+ //# sourceMappingURL=pageElasticsearchEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_toolbox","require","createPageElasticsearchEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","index","type","data","TYPE","exports"],"sources":["pageElasticsearchEntity.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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 TYPE: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AACA,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;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACY,OAAA,CAAAf,6BAAA,GAAAA,6BAAA","ignoreList":[]}
@@ -1,6 +1,10 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
2
- import { PbContext } from "@webiny/api-page-builder/graphql/types";
3
- export declare const definePageElementEntity: (params: {
4
- context: PbContext;
5
- table: Table;
6
- }) => Entity<any>;
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
4
+ interface Params {
5
+ table: Table<string, string, string>;
6
+ entityName: string;
7
+ attributes: Attributes;
8
+ }
9
+ export declare const createPageElementEntity: (params: Params) => Entity<any>;
10
+ export {};
@@ -1,33 +1,20 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports.definePageElementEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
-
20
- const definePageElementEntity = params => {
6
+ exports.createPageElementEntity = void 0;
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
+ const createPageElementEntity = params => {
21
9
  const {
22
- context,
10
+ entityName,
11
+ attributes,
23
12
  table
24
13
  } = params;
25
- const entityName = "PbPageElement";
26
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
27
- return new _dynamodbToolbox.Entity({
14
+ return new _toolbox.Entity({
28
15
  name: entityName,
29
16
  table,
30
- attributes: _objectSpread({
17
+ attributes: {
31
18
  PK: {
32
19
  partitionKey: true
33
20
  },
@@ -66,9 +53,11 @@ const definePageElementEntity = params => {
66
53
  },
67
54
  locale: {
68
55
  type: "string"
69
- }
70
- }, attributes)
56
+ },
57
+ ...(attributes || {})
58
+ }
71
59
  });
72
60
  };
61
+ exports.createPageElementEntity = createPageElementEntity;
73
62
 
74
- exports.definePageElementEntity = definePageElementEntity;
63
+ //# sourceMappingURL=pageElementEntity.js.map
@@ -0,0 +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 type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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":";;;;;;AACA,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,6 +1,10 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
2
- import { PbContext } from "@webiny/api-page-builder/graphql/types";
3
- export declare const definePageEntity: (params: {
4
- context: PbContext;
5
- table: Table;
6
- }) => Entity<any>;
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
4
+ interface Params {
5
+ table: Table<string, string, string>;
6
+ entityName: string;
7
+ attributes: Attributes;
8
+ }
9
+ export declare const createPageEntity: (params: Params) => Entity<any>;
10
+ export {};