@webiny/api-page-builder-so-ddb-es 0.0.0-mt-3 → 0.0.0-unstable.5e7233243f

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 (141) hide show
  1. package/configurations.d.ts +9 -0
  2. package/configurations.js +49 -0
  3. package/configurations.js.map +1 -0
  4. package/definitions/categoryEntity.d.ts +7 -4
  5. package/definitions/categoryEntity.js +8 -11
  6. package/definitions/categoryEntity.js.map +1 -0
  7. package/definitions/menuEntity.d.ts +7 -4
  8. package/definitions/menuEntity.js +8 -11
  9. package/definitions/menuEntity.js.map +1 -0
  10. package/definitions/pageElasticsearchEntity.d.ts +7 -4
  11. package/definitions/pageElasticsearchEntity.js +8 -11
  12. package/definitions/pageElasticsearchEntity.js.map +1 -0
  13. package/definitions/pageElementEntity.d.ts +7 -4
  14. package/definitions/pageElementEntity.js +8 -11
  15. package/definitions/pageElementEntity.js.map +1 -0
  16. package/definitions/pageEntity.d.ts +7 -4
  17. package/definitions/pageEntity.js +8 -20
  18. package/definitions/pageEntity.js.map +1 -0
  19. package/definitions/settingsEntity.d.ts +7 -4
  20. package/definitions/settingsEntity.js +13 -12
  21. package/definitions/settingsEntity.js.map +1 -0
  22. package/definitions/systemEntity.d.ts +7 -4
  23. package/definitions/systemEntity.js +11 -11
  24. package/definitions/systemEntity.js.map +1 -0
  25. package/definitions/table.d.ts +7 -4
  26. package/definitions/table.js +12 -18
  27. package/definitions/table.js.map +1 -0
  28. package/definitions/tableElasticsearch.d.ts +8 -4
  29. package/definitions/tableElasticsearch.js +12 -25
  30. package/definitions/tableElasticsearch.js.map +1 -0
  31. package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
  32. package/elasticsearch/createElasticsearchIndex.js +60 -0
  33. package/elasticsearch/createElasticsearchIndex.js.map +1 -0
  34. package/elasticsearch/indices/base.d.ts +2 -0
  35. package/elasticsearch/indices/base.js +23 -0
  36. package/elasticsearch/indices/base.js.map +1 -0
  37. package/elasticsearch/indices/index.d.ts +1 -0
  38. package/elasticsearch/indices/index.js +16 -0
  39. package/elasticsearch/indices/index.js.map +1 -0
  40. package/elasticsearch/indices/japanese.d.ts +2 -0
  41. package/elasticsearch/indices/japanese.js +24 -0
  42. package/elasticsearch/indices/japanese.js.map +1 -0
  43. package/index.d.ts +2 -8
  44. package/index.js +177 -8
  45. package/index.js.map +1 -0
  46. package/operations/category/{CategoryDataLoader.d.ts → dataLoader.d.ts} +4 -8
  47. package/operations/category/{CategoryDataLoader.js → dataLoader.js} +10 -8
  48. package/operations/category/dataLoader.js.map +1 -0
  49. package/operations/category/fields.d.ts +1 -2
  50. package/operations/category/fields.js +3 -3
  51. package/operations/category/fields.js.map +1 -0
  52. package/operations/category/index.d.ts +6 -3
  53. package/operations/category/index.js +198 -14
  54. package/operations/category/index.js.map +1 -0
  55. package/operations/category/keys.d.ts +9 -0
  56. package/operations/category/keys.js +25 -0
  57. package/operations/category/keys.js.map +1 -0
  58. package/operations/menu/fields.d.ts +1 -2
  59. package/operations/menu/fields.js +18 -16
  60. package/operations/menu/fields.js.map +1 -0
  61. package/operations/menu/index.d.ts +6 -3
  62. package/operations/menu/index.js +207 -14
  63. package/operations/menu/index.js.map +1 -0
  64. package/operations/pageElement/fields.d.ts +1 -2
  65. package/operations/pageElement/fields.js +3 -3
  66. package/operations/pageElement/fields.js.map +1 -0
  67. package/operations/pageElement/index.d.ts +6 -5
  68. package/operations/pageElement/index.js +197 -14
  69. package/operations/pageElement/index.js.map +1 -0
  70. package/operations/pages/elasticsearchQueryBody.d.ts +5 -11
  71. package/operations/pages/elasticsearchQueryBody.js +17 -37
  72. package/operations/pages/elasticsearchQueryBody.js.map +1 -0
  73. package/operations/pages/fields.d.ts +3 -2
  74. package/operations/pages/fields.js +15 -3
  75. package/operations/pages/fields.js.map +1 -0
  76. package/operations/pages/helpers.d.ts +6 -14
  77. package/operations/pages/helpers.js +12 -12
  78. package/operations/pages/helpers.js.map +1 -0
  79. package/operations/pages/index.d.ts +9 -3
  80. package/operations/pages/index.js +943 -16
  81. package/operations/pages/index.js.map +1 -0
  82. package/operations/pages/keys.d.ts +24 -0
  83. package/operations/pages/keys.js +79 -0
  84. package/operations/pages/keys.js.map +1 -0
  85. package/operations/settings/index.d.ts +4 -5
  86. package/operations/settings/index.js +171 -12
  87. package/operations/settings/index.js.map +1 -0
  88. package/operations/system/index.d.ts +4 -3
  89. package/operations/system/index.js +97 -18
  90. package/operations/system/index.js.map +1 -0
  91. package/package.json +27 -27
  92. package/plugins/definitions/CategoryDynamoDbElasticFieldPlugin.js.map +1 -0
  93. package/plugins/definitions/IndexPageDataPlugin.d.ts +3 -4
  94. package/plugins/definitions/IndexPageDataPlugin.js.map +1 -0
  95. package/plugins/definitions/MenuDynamoDbElasticFieldPlugin.js.map +1 -0
  96. package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.d.ts +4 -0
  97. package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.js +17 -0
  98. package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.js.map +1 -0
  99. package/plugins/definitions/PageElasticsearchBodyModifierPlugin.js.map +1 -0
  100. package/plugins/definitions/PageElasticsearchFieldPlugin.d.ts +1 -2
  101. package/plugins/definitions/PageElasticsearchFieldPlugin.js +1 -6
  102. package/plugins/definitions/PageElasticsearchFieldPlugin.js.map +1 -0
  103. package/plugins/definitions/PageElasticsearchIndexPlugin.d.ts +4 -0
  104. package/plugins/definitions/PageElasticsearchIndexPlugin.js +17 -0
  105. package/plugins/definitions/PageElasticsearchIndexPlugin.js.map +1 -0
  106. package/plugins/definitions/PageElasticsearchQueryModifierPlugin.js.map +1 -0
  107. package/plugins/definitions/PageElasticsearchSortModifierPlugin.js.map +1 -0
  108. package/plugins/definitions/PageElementDynamoDbElasticFieldPlugin.js.map +1 -0
  109. package/plugins/definitions/SearchLatestPagesPlugin.d.ts +1 -1
  110. package/plugins/definitions/SearchLatestPagesPlugin.js.map +1 -0
  111. package/plugins/definitions/SearchPagesPlugin.d.ts +3 -4
  112. package/plugins/definitions/SearchPagesPlugin.js.map +1 -0
  113. package/plugins/definitions/SearchPublishedPagesPlugin.d.ts +1 -1
  114. package/plugins/definitions/SearchPublishedPagesPlugin.js.map +1 -0
  115. package/types.d.ts +37 -0
  116. package/types.js +18 -0
  117. package/types.js.map +1 -0
  118. package/upgrades/index.js.map +1 -0
  119. package/upgrades/v5.15.0/category.js +4 -3
  120. package/upgrades/v5.15.0/category.js.map +1 -0
  121. package/upgrades/v5.15.0/index.js.map +1 -0
  122. package/upgrades/v5.15.0/menu.js +4 -3
  123. package/upgrades/v5.15.0/menu.js.map +1 -0
  124. package/upgrades/v5.15.0/pageElement.js +4 -3
  125. package/upgrades/v5.15.0/pageElement.js.map +1 -0
  126. package/operations/category/CategoryStorageOperations.d.ts +0 -29
  127. package/operations/category/CategoryStorageOperations.js +0 -243
  128. package/operations/configurations.d.ts +0 -36
  129. package/operations/configurations.js +0 -71
  130. package/operations/menu/MenuStorageOperations.d.ts +0 -23
  131. package/operations/menu/MenuStorageOperations.js +0 -235
  132. package/operations/pageElement/PageElementStorageOperations.d.ts +0 -23
  133. package/operations/pageElement/PageElementStorageOperations.js +0 -234
  134. package/operations/pages/PageStorageOperations.d.ts +0 -79
  135. package/operations/pages/PageStorageOperations.js +0 -1117
  136. package/operations/settings/SettingsStorageOperations.d.ts +0 -35
  137. package/operations/settings/SettingsStorageOperations.js +0 -191
  138. package/operations/system/InstallationDdbEsPlugin.d.ts +0 -2
  139. package/operations/system/InstallationDdbEsPlugin.js +0 -73
  140. package/operations/system/SystemStorageOperations.d.ts +0 -16
  141. package/operations/system/SystemStorageOperations.js +0 -114
@@ -0,0 +1,9 @@
1
+ export interface ElasticsearchParams {
2
+ tenant: string;
3
+ locale: string;
4
+ }
5
+ export declare const configurations: {
6
+ es: (params: ElasticsearchParams) => {
7
+ index: string;
8
+ };
9
+ };
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.configurations = void 0;
9
+
10
+ var _error = _interopRequireDefault(require("@webiny/error"));
11
+
12
+ const configurations = {
13
+ es: params => {
14
+ const {
15
+ tenant,
16
+ locale
17
+ } = params;
18
+
19
+ if (!tenant) {
20
+ throw new _error.default(`Missing "tenant" parameter when trying to create Elasticsearch index name.`, "TENANT_ERROR");
21
+ }
22
+
23
+ const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === "true";
24
+ const tenantId = sharedIndex ? "root" : tenant;
25
+ let localeCode = null;
26
+
27
+ if (process.env.WEBINY_ELASTICSEARCH_INDEX_LOCALE === "true") {
28
+ if (!locale) {
29
+ throw new _error.default(`Missing "locale" parameter when trying to create Elasticsearch index name.`, "LOCALE_ERROR");
30
+ }
31
+
32
+ localeCode = locale;
33
+ }
34
+
35
+ const index = [tenantId, localeCode, "page-builder"].filter(Boolean).join("-").toLowerCase();
36
+ const prefix = process.env.ELASTIC_SEARCH_INDEX_PREFIX;
37
+
38
+ if (!prefix) {
39
+ return {
40
+ index
41
+ };
42
+ }
43
+
44
+ return {
45
+ index: prefix + index
46
+ };
47
+ }
48
+ };
49
+ exports.configurations = configurations;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["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"],"sources":["configurations.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\n\nexport interface ElasticsearchParams {\n tenant: string;\n locale: string;\n}\n\nexport const configurations = {\n es: (params: ElasticsearchParams) => {\n const { tenant, locale } = params;\n if (!tenant) {\n throw new WebinyError(\n `Missing \"tenant\" parameter when trying to create Elasticsearch index name.`,\n \"TENANT_ERROR\"\n );\n }\n const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === \"true\";\n\n const tenantId = sharedIndex ? \"root\" : tenant;\n let localeCode: string | null = null;\n if (process.env.WEBINY_ELASTICSEARCH_INDEX_LOCALE === \"true\") {\n if (!locale) {\n throw new WebinyError(\n `Missing \"locale\" parameter when trying to create Elasticsearch index name.`,\n \"LOCALE_ERROR\"\n );\n }\n localeCode = locale;\n }\n\n const index = [tenantId, localeCode, \"page-builder\"]\n .filter(Boolean)\n .join(\"-\")\n .toLowerCase();\n\n const prefix = process.env.ELASTIC_SEARCH_INDEX_PREFIX;\n if (!prefix) {\n return {\n index\n };\n }\n return {\n index: prefix + index\n };\n }\n};\n"],"mappings":";;;;;;;;;AAAA;;AAOO,MAAMA,cAAc,GAAG;EAC1BC,EAAE,EAAGC,MAAD,IAAiC;IACjC,MAAM;MAAEC,MAAF;MAAUC;IAAV,IAAqBF,MAA3B;;IACA,IAAI,CAACC,MAAL,EAAa;MACT,MAAM,IAAIE,cAAJ,CACD,4EADC,EAEF,cAFE,CAAN;IAIH;;IACD,MAAMC,WAAW,GAAGC,OAAO,CAACC,GAAR,CAAYC,4BAAZ,KAA6C,MAAjE;IAEA,MAAMC,QAAQ,GAAGJ,WAAW,GAAG,MAAH,GAAYH,MAAxC;IACA,IAAIQ,UAAyB,GAAG,IAAhC;;IACA,IAAIJ,OAAO,CAACC,GAAR,CAAYI,iCAAZ,KAAkD,MAAtD,EAA8D;MAC1D,IAAI,CAACR,MAAL,EAAa;QACT,MAAM,IAAIC,cAAJ,CACD,4EADC,EAEF,cAFE,CAAN;MAIH;;MACDM,UAAU,GAAGP,MAAb;IACH;;IAED,MAAMS,KAAK,GAAG,CAACH,QAAD,EAAWC,UAAX,EAAuB,cAAvB,EACTG,MADS,CACFC,OADE,EAETC,IAFS,CAEJ,GAFI,EAGTC,WAHS,EAAd;IAKA,MAAMC,MAAM,GAAGX,OAAO,CAACC,GAAR,CAAYW,2BAA3B;;IACA,IAAI,CAACD,MAAL,EAAa;MACT,OAAO;QACHL;MADG,CAAP;IAGH;;IACD,OAAO;MACHA,KAAK,EAAEK,MAAM,GAAGL;IADb,CAAP;EAGH;AArCyB,CAAvB"}
@@ -1,6 +1,9 @@
1
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;
2
+ import { Attributes } from "../types";
3
+ interface Params {
5
4
  table: Table;
6
- }) => Entity<any>;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createCategoryEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -5,25 +5,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.defineCategoryEntity = void 0;
8
+ exports.createCategoryEntity = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
12
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
13
 
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
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; }
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
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 => {
18
+ const createCategoryEntity = params => {
21
19
  const {
22
- context,
20
+ entityName,
21
+ attributes,
23
22
  table
24
23
  } = params;
25
- const entityName = "PbCategory";
26
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
27
24
  return new _dynamodbToolbox.Entity({
28
25
  name: entityName,
29
26
  table,
@@ -61,8 +58,8 @@ const defineCategoryEntity = params => {
61
58
  locale: {
62
59
  type: "string"
63
60
  }
64
- }, attributes)
61
+ }, attributes || {})
65
62
  });
66
63
  };
67
64
 
68
- exports.defineCategoryEntity = defineCategoryEntity;
65
+ exports.createCategoryEntity = createCategoryEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createCategoryEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","slug","url","layout","createdOn","createdBy","tenant","locale"],"sources":["categoryEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\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;;;;;;AASO,MAAMA,oBAAoB,GAAIC,MAAD,IAAiC;EACjE,MAAM;IAAEC,UAAF;IAAcC,UAAd;IAA0BC;EAA1B,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdE,KAFc;IAGdD,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,IAAI,EAAE;QACFC,IAAI,EAAE;MADJ,CAPA;MAUNN,IAAI,EAAE;QACFM,IAAI,EAAE;MADJ,CAVA;MAaNC,IAAI,EAAE;QACFD,IAAI,EAAE;MADJ,CAbA;MAgBNE,GAAG,EAAE;QACDF,IAAI,EAAE;MADL,CAhBC;MAmBNG,MAAM,EAAE;QACJH,IAAI,EAAE;MADF,CAnBF;MAsBNI,SAAS,EAAE;QACPJ,IAAI,EAAE;MADC,CAtBL;MAyBNK,SAAS,EAAE;QACPL,IAAI,EAAE;MADC,CAzBL;MA4BNM,MAAM,EAAE;QACJN,IAAI,EAAE;MADF,CA5BF;MA+BNO,MAAM,EAAE;QACJP,IAAI,EAAE;MADF;IA/BF,GAkCFT,UAAU,IAAI,EAlCZ;EAHI,CAAX,CAAP;AAwCH,CA1CM"}
@@ -1,6 +1,9 @@
1
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;
2
+ import { Attributes } from "../types";
3
+ interface Params {
5
4
  table: Table;
6
- }) => Entity<any>;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createMenuEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -5,25 +5,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.defineMenuEntity = void 0;
8
+ exports.createMenuEntity = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
12
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
13
 
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
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; }
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
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 => {
18
+ const createMenuEntity = params => {
21
19
  const {
22
- context,
20
+ entityName,
21
+ attributes,
23
22
  table
24
23
  } = params;
25
- const entityName = "PbMenu";
26
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
27
24
  return new _dynamodbToolbox.Entity({
28
25
  name: entityName,
29
26
  table,
@@ -61,8 +58,8 @@ const defineMenuEntity = params => {
61
58
  locale: {
62
59
  type: "string"
63
60
  }
64
- }, attributes)
61
+ }, attributes || {})
65
62
  });
66
63
  };
67
64
 
68
- exports.defineMenuEntity = defineMenuEntity;
65
+ exports.createMenuEntity = createMenuEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createMenuEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","title","slug","description","items","createdOn","createdBy","tenant","locale"],"sources":["menuEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\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;;;;;;AASO,MAAMA,gBAAgB,GAAIC,MAAD,IAAiC;EAC7D,MAAM;IAAEC,UAAF;IAAcC,UAAd;IAA0BC;EAA1B,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdE,KAFc;IAGdD,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,IAAI,EAAE;QACFC,IAAI,EAAE;MADJ,CAPA;MAUNC,KAAK,EAAE;QACHD,IAAI,EAAE;MADH,CAVD;MAaNE,IAAI,EAAE;QACFF,IAAI,EAAE;MADJ,CAbA;MAgBNG,WAAW,EAAE;QACTH,IAAI,EAAE;MADG,CAhBP;MAmBNI,KAAK,EAAE;QACHJ,IAAI,EAAE;MADH,CAnBD;MAsBNK,SAAS,EAAE;QACPL,IAAI,EAAE;MADC,CAtBL;MAyBNM,SAAS,EAAE;QACPN,IAAI,EAAE;MADC,CAzBL;MA4BNO,MAAM,EAAE;QACJP,IAAI,EAAE;MADF,CA5BF;MA+BNQ,MAAM,EAAE;QACJR,IAAI,EAAE;MADF;IA/BF,GAkCFT,UAAU,IAAI,EAlCZ;EAHI,CAAX,CAAP;AAwCH,CA1CM"}
@@ -1,6 +1,9 @@
1
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;
2
+ import { Attributes } from "../types";
3
+ interface Params {
5
4
  table: Table;
6
- }) => Entity<any>;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createPageElasticsearchEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -5,25 +5,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.definePageElasticsearchEntity = void 0;
8
+ exports.createPageElasticsearchEntity = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
12
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
13
 
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
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; }
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
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 => {
18
+ const createPageElasticsearchEntity = params => {
21
19
  const {
22
- context,
20
+ entityName,
21
+ attributes,
23
22
  table
24
23
  } = params;
25
- const entityName = "PbPageElasticsearch";
26
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
27
24
  return new _dynamodbToolbox.Entity({
28
25
  name: entityName,
29
26
  table,
@@ -40,8 +37,8 @@ const definePageElasticsearchEntity = params => {
40
37
  data: {
41
38
  type: "map"
42
39
  }
43
- }, attributes)
40
+ }, attributes || {})
44
41
  });
45
42
  };
46
43
 
47
- exports.definePageElasticsearchEntity = definePageElasticsearchEntity;
44
+ exports.createPageElasticsearchEntity = createPageElasticsearchEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createPageElasticsearchEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","index","type","data"],"sources":["pageElasticsearchEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\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;;;;;;AASO,MAAMA,6BAA6B,GAAIC,MAAD,IAAiC;EAC1E,MAAM;IAAEC,UAAF;IAAcC,UAAd;IAA0BC;EAA1B,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdE,KAFc;IAGdD,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,KAAK,EAAE;QACHC,IAAI,EAAE;MADH,CAPD;MAUNC,IAAI,EAAE;QACFD,IAAI,EAAE;MADJ;IAVA,GAaFT,UAAU,IAAI,EAbZ;EAHI,CAAX,CAAP;AAmBH,CArBM"}
@@ -1,6 +1,9 @@
1
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;
2
+ import { Attributes } from "../types";
3
+ interface Params {
5
4
  table: Table;
6
- }) => Entity<any>;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createPageElementEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -5,25 +5,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.definePageElementEntity = void 0;
8
+ exports.createPageElementEntity = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
12
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
13
 
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
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; }
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
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 => {
18
+ const createPageElementEntity = params => {
21
19
  const {
22
- context,
20
+ entityName,
21
+ attributes,
23
22
  table
24
23
  } = params;
25
- const entityName = "PbPageElement";
26
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
27
24
  return new _dynamodbToolbox.Entity({
28
25
  name: entityName,
29
26
  table,
@@ -67,8 +64,8 @@ const definePageElementEntity = params => {
67
64
  locale: {
68
65
  type: "string"
69
66
  }
70
- }, attributes)
67
+ }, attributes || {})
71
68
  });
72
69
  };
73
70
 
74
- exports.definePageElementEntity = definePageElementEntity;
71
+ exports.createPageElementEntity = createPageElementEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createPageElementEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","id","category","content","preview","createdOn","createdBy","tenant","locale"],"sources":["pageElementEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\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;;;;;;AASO,MAAMA,uBAAuB,GAAIC,MAAD,IAAiC;EACpE,MAAM;IAAEC,UAAF;IAAcC,UAAd;IAA0BC;EAA1B,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdE,KAFc;IAGdD,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,IAAI,EAAE;QACFC,IAAI,EAAE;MADJ,CAPA;MAUNC,EAAE,EAAE;QACAD,IAAI,EAAE;MADN,CAVE;MAaNN,IAAI,EAAE;QACFM,IAAI,EAAE;MADJ,CAbA;MAgBNA,IAAI,EAAE;QACFA,IAAI,EAAE;MADJ,CAhBA;MAmBNE,QAAQ,EAAE;QACNF,IAAI,EAAE;MADA,CAnBJ;MAsBNG,OAAO,EAAE;QACLH,IAAI,EAAE;MADD,CAtBH;MAyBNI,OAAO,EAAE;QACLJ,IAAI,EAAE;MADD,CAzBH;MA4BNK,SAAS,EAAE;QACPL,IAAI,EAAE;MADC,CA5BL;MA+BNM,SAAS,EAAE;QACPN,IAAI,EAAE;MADC,CA/BL;MAkCNO,MAAM,EAAE;QACJP,IAAI,EAAE;MADF,CAlCF;MAqCNQ,MAAM,EAAE;QACJR,IAAI,EAAE;MADF;IArCF,GAwCFT,UAAU,IAAI,EAxCZ;EAHI,CAAX,CAAP;AA8CH,CAhDM"}
@@ -1,6 +1,9 @@
1
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;
2
+ import { Attributes } from "../types";
3
+ interface Params {
5
4
  table: Table;
6
- }) => Entity<any>;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createPageEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -5,25 +5,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.definePageEntity = void 0;
8
+ exports.createPageEntity = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
12
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
13
 
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
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; }
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
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 definePageEntity = params => {
18
+ const createPageEntity = params => {
21
19
  const {
22
- context,
20
+ entityName,
21
+ attributes,
23
22
  table
24
23
  } = params;
25
- const entityName = "PbPage";
26
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
27
24
  return new _dynamodbToolbox.Entity({
28
25
  name: entityName,
29
26
  table,
@@ -82,15 +79,6 @@ const definePageEntity = params => {
82
79
  status: {
83
80
  type: "string"
84
81
  },
85
- visibility: {
86
- type: "map"
87
- },
88
- home: {
89
- type: "boolean"
90
- },
91
- notFound: {
92
- type: "boolean"
93
- },
94
82
  createdOn: {
95
83
  type: "string"
96
84
  },
@@ -106,8 +94,8 @@ const definePageEntity = params => {
106
94
  webinyVersion: {
107
95
  type: "string"
108
96
  }
109
- }, attributes)
97
+ }, attributes || {})
110
98
  });
111
99
  };
112
100
 
113
- exports.definePageEntity = definePageEntity;
101
+ exports.createPageEntity = createPageEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["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"],"sources":["pageEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\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;;;;;;AASO,MAAMA,gBAAgB,GAAIC,MAAD,IAAiC;EAC7D,MAAM;IAAEC,UAAF;IAAcC,UAAd;IAA0BC;EAA1B,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdE,KAFc;IAGdD,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,IAAI,EAAE;QACFC,IAAI,EAAE;MADJ,CAPA;MAUNC,EAAE,EAAE;QACAD,IAAI,EAAE;MADN,CAVE;MAaNE,GAAG,EAAE;QACDF,IAAI,EAAE;MADL,CAbC;MAgBNG,MAAM,EAAE;QACJH,IAAI,EAAE;MADF,CAhBF;MAmBNI,MAAM,EAAE;QACJJ,IAAI,EAAE;MADF,CAnBF;MAsBNK,KAAK,EAAE;QACHL,IAAI,EAAE;MADH,CAtBD;MAyBNM,MAAM,EAAE;QACJN,IAAI,EAAE;MADF,CAzBF;MA4BNO,WAAW,EAAE;QACTP,IAAI,EAAE;MADG,CA5BP;MA+BNQ,IAAI,EAAE;QACFR,IAAI,EAAE;MADJ,CA/BA;MAkCNS,QAAQ,EAAE;QACNT,IAAI,EAAE;MADA,CAlCJ;MAqCNU,OAAO,EAAE;QACLV,IAAI,EAAE;MADD,CArCH;MAwCNW,WAAW,EAAE;QACTX,IAAI,EAAE;MADG,CAxCP;MA2CNY,OAAO,EAAE;QACLZ,IAAI,EAAE;MADD,CA3CH;MA8CNa,QAAQ,EAAE;QACNb,IAAI,EAAE;MADA,CA9CJ;MAiDNc,MAAM,EAAE;QACJd,IAAI,EAAE;MADF,CAjDF;MAoDNe,MAAM,EAAE;QACJf,IAAI,EAAE;MADF,CApDF;MAuDNgB,SAAS,EAAE;QACPhB,IAAI,EAAE;MADC,CAvDL;MA0DNiB,OAAO,EAAE;QACLjB,IAAI,EAAE;MADD,CA1DH;MA6DNkB,SAAS,EAAE;QACPlB,IAAI,EAAE;MADC,CA7DL;MAgENmB,OAAO,EAAE;QACLnB,IAAI,EAAE;MADD,CAhEH;MAmENoB,aAAa,EAAE;QACXpB,IAAI,EAAE;MADK;IAnET,GAsEFT,UAAU,IAAI,EAtEZ;EAHI,CAAX,CAAP;AA4EH,CA9EM"}
@@ -1,6 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
- import { PbContext } from "@webiny/api-page-builder/graphql/types";
3
- export declare const defineSettingsEntity: (params: {
4
- context: PbContext;
2
+ import { Attributes } from "../types";
3
+ interface Params {
5
4
  table: Table;
6
- }) => Entity<any>;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createSettingsEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -5,25 +5,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.defineSettingsEntity = void 0;
8
+ exports.createSettingsEntity = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
12
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
13
 
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
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; }
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
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 defineSettingsEntity = params => {
18
+ const createSettingsEntity = params => {
21
19
  const {
22
- context,
23
- table
20
+ entityName,
21
+ table,
22
+ attributes
24
23
  } = params;
25
- const entityName = "PbSettings";
26
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
27
24
  return new _dynamodbToolbox.Entity({
28
25
  name: entityName,
29
26
  table,
@@ -69,9 +66,13 @@ const defineSettingsEntity = params => {
69
66
  },
70
67
  TYPE: {
71
68
  type: "string"
69
+ },
70
+ // TODO: implement this via a plugin when https://github.com/webiny/webiny-js/issues/2169 is resolved.
71
+ theme: {
72
+ type: "string"
72
73
  }
73
- }, attributes)
74
+ }, attributes || {})
74
75
  });
75
76
  };
76
77
 
77
- exports.defineSettingsEntity = defineSettingsEntity;
78
+ exports.createSettingsEntity = createSettingsEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createSettingsEntity","params","entityName","table","attributes","Entity","name","PK","partitionKey","SK","sortKey","type","websiteUrl","websitePreviewUrl","favicon","logo","prerendering","social","pages","tenant","locale","TYPE","theme"],"sources":["settingsEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSettingsEntity = (params: Params): Entity<any> => {\n const { entityName, table, attributes } = 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 name: {\n type: \"string\"\n },\n websiteUrl: {\n type: \"string\"\n },\n websitePreviewUrl: {\n type: \"string\"\n },\n favicon: {\n type: \"map\"\n },\n logo: {\n type: \"map\"\n },\n prerendering: {\n type: \"map\"\n },\n social: {\n type: \"map\"\n },\n pages: {\n type: \"map\"\n },\n type: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n // TODO: implement this via a plugin when https://github.com/webiny/webiny-js/issues/2169 is resolved.\n theme: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;;;;;AASO,MAAMA,oBAAoB,GAAIC,MAAD,IAAiC;EACjE,MAAM;IAAEC,UAAF;IAAcC,KAAd;IAAqBC;EAArB,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdC,KAFc;IAGdC,UAAU;MACNG,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONJ,IAAI,EAAE;QACFK,IAAI,EAAE;MADJ,CAPA;MAUNC,UAAU,EAAE;QACRD,IAAI,EAAE;MADE,CAVN;MAaNE,iBAAiB,EAAE;QACfF,IAAI,EAAE;MADS,CAbb;MAgBNG,OAAO,EAAE;QACLH,IAAI,EAAE;MADD,CAhBH;MAmBNI,IAAI,EAAE;QACFJ,IAAI,EAAE;MADJ,CAnBA;MAsBNK,YAAY,EAAE;QACVL,IAAI,EAAE;MADI,CAtBR;MAyBNM,MAAM,EAAE;QACJN,IAAI,EAAE;MADF,CAzBF;MA4BNO,KAAK,EAAE;QACHP,IAAI,EAAE;MADH,CA5BD;MA+BNA,IAAI,EAAE;QACFA,IAAI,EAAE;MADJ,CA/BA;MAkCNQ,MAAM,EAAE;QACJR,IAAI,EAAE;MADF,CAlCF;MAqCNS,MAAM,EAAE;QACJT,IAAI,EAAE;MADF,CArCF;MAwCNU,IAAI,EAAE;QACFV,IAAI,EAAE;MADJ,CAxCA;MA2CN;MACAW,KAAK,EAAE;QACHX,IAAI,EAAE;MADH;IA5CD,GA+CFP,UAAU,IAAI,EA/CZ;EAHI,CAAX,CAAP;AAqDH,CAvDM"}
@@ -1,6 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
- import { PbContext } from "@webiny/api-page-builder/graphql/types";
3
- export declare const defineSystemEntity: (params: {
4
- context: PbContext;
2
+ import { Attributes } from "../types";
3
+ interface Params {
5
4
  table: Table;
6
- }) => Entity<any>;
5
+ entityName: string;
6
+ attributes: Attributes;
7
+ }
8
+ export declare const createSystemEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -5,25 +5,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.defineSystemEntity = void 0;
8
+ exports.createSystemEntity = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
12
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
13
 
14
- var _attributes = require("@webiny/db-dynamodb/utils/attributes");
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
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; }
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
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 defineSystemEntity = params => {
18
+ const createSystemEntity = params => {
21
19
  const {
22
- context,
20
+ entityName,
21
+ attributes,
23
22
  table
24
23
  } = params;
25
- const entityName = "PbSystem";
26
- const attributes = (0, _attributes.getExtraAttributes)(context, entityName);
27
24
  return new _dynamodbToolbox.Entity({
28
25
  name: entityName,
29
26
  table,
@@ -36,9 +33,12 @@ const defineSystemEntity = params => {
36
33
  },
37
34
  version: {
38
35
  type: "string"
36
+ },
37
+ tenant: {
38
+ type: "string"
39
39
  }
40
- }, attributes)
40
+ }, attributes || {})
41
41
  });
42
42
  };
43
43
 
44
- exports.defineSystemEntity = defineSystemEntity;
44
+ exports.createSystemEntity = createSystemEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","tenant"],"sources":["systemEntity.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\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;;;;;;AASO,MAAMA,kBAAkB,GAAIC,MAAD,IAAiC;EAC/D,MAAM;IAAEC,UAAF;IAAcC,UAAd;IAA0BC;EAA1B,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdE,KAFc;IAGdD,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,OAAO,EAAE;QACLC,IAAI,EAAE;MADD,CAPH;MAUNC,MAAM,EAAE;QACJD,IAAI,EAAE;MADF;IAVF,GAaFT,UAAU,IAAI,EAbZ;EAHI,CAAX,CAAP;AAmBH,CArBM"}
@@ -1,6 +1,9 @@
1
+ import { TableModifier } from "../types";
2
+ import { DocumentClient } from "aws-sdk/clients/dynamodb";
1
3
  import { Table } from "dynamodb-toolbox";
2
- import { PbContext } from "@webiny/api-page-builder/graphql/types";
3
- export interface Params {
4
- context: PbContext;
4
+ interface Params {
5
+ table?: TableModifier;
6
+ documentClient: DocumentClient;
5
7
  }
6
- export declare const defineTable: (params: Params) => Table;
8
+ export declare const createTable: ({ table, documentClient }: Params) => Table;
9
+ export {};