@webiny/api-headless-cms-ddb 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.f6dc066313

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 (155) hide show
  1. package/README.md +6 -20
  2. package/definitions/entry.d.ts +4 -6
  3. package/definitions/entry.js +5 -180
  4. package/definitions/entry.js.map +1 -1
  5. package/definitions/group.d.ts +4 -6
  6. package/definitions/group.js +5 -58
  7. package/definitions/group.js.map +1 -1
  8. package/definitions/model.d.ts +4 -6
  9. package/definitions/model.js +5 -102
  10. package/definitions/model.js.map +1 -1
  11. package/definitions/table.d.ts +3 -5
  12. package/definitions/table.js +6 -28
  13. package/definitions/table.js.map +1 -1
  14. package/definitions/types.d.ts +60 -0
  15. package/definitions/types.js +3 -0
  16. package/definitions/types.js.map +1 -0
  17. package/dynamoDb/index.d.ts +1 -1
  18. package/dynamoDb/index.js +6 -13
  19. package/dynamoDb/index.js.map +1 -1
  20. package/dynamoDb/path/locationFolderId.d.ts +1 -1
  21. package/dynamoDb/path/locationFolderId.js +5 -14
  22. package/dynamoDb/path/locationFolderId.js.map +1 -1
  23. package/dynamoDb/path/plainObject.d.ts +1 -1
  24. package/dynamoDb/path/plainObject.js +5 -14
  25. package/dynamoDb/path/plainObject.js.map +1 -1
  26. package/dynamoDb/storage/longText.js +10 -18
  27. package/dynamoDb/storage/longText.js.map +1 -1
  28. package/dynamoDb/storage/richText.js +10 -19
  29. package/dynamoDb/storage/richText.js.map +1 -1
  30. package/dynamoDb/transformValue/datetime.d.ts +1 -1
  31. package/dynamoDb/transformValue/datetime.js +5 -12
  32. package/dynamoDb/transformValue/datetime.js.map +1 -1
  33. package/index.d.ts +2 -2
  34. package/index.js +38 -73
  35. package/index.js.map +1 -1
  36. package/operations/entry/dataLoader/DataLoaderCache.d.ts +0 -2
  37. package/operations/entry/dataLoader/DataLoaderCache.js +2 -9
  38. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  39. package/operations/entry/dataLoader/constants.js +1 -7
  40. package/operations/entry/dataLoader/constants.js.map +1 -1
  41. package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
  42. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  43. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  44. package/operations/entry/dataLoader/getAllEntryRevisions.js +11 -24
  45. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  46. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  47. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +22 -32
  48. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  49. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  50. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +22 -32
  51. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  52. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  53. package/operations/entry/dataLoader/getRevisionById.js +24 -34
  54. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  55. package/operations/entry/dataLoader/index.d.ts +3 -3
  56. package/operations/entry/dataLoader/index.js +10 -31
  57. package/operations/entry/dataLoader/index.js.map +1 -1
  58. package/operations/entry/dataLoader/types.d.ts +3 -4
  59. package/operations/entry/dataLoader/types.js +1 -5
  60. package/operations/entry/dataLoader/types.js.map +1 -1
  61. package/operations/entry/dataLoaders.d.ts +11 -12
  62. package/operations/entry/dataLoaders.js +15 -25
  63. package/operations/entry/dataLoaders.js.map +1 -1
  64. package/operations/entry/filtering/createExpressions.d.ts +3 -3
  65. package/operations/entry/filtering/createExpressions.js +27 -30
  66. package/operations/entry/filtering/createExpressions.js.map +1 -1
  67. package/operations/entry/filtering/createFields.d.ts +2 -2
  68. package/operations/entry/filtering/createFields.js +20 -22
  69. package/operations/entry/filtering/createFields.js.map +1 -1
  70. package/operations/entry/filtering/extractSort.d.ts +5 -5
  71. package/operations/entry/filtering/extractSort.js +38 -23
  72. package/operations/entry/filtering/extractSort.js.map +1 -1
  73. package/operations/entry/filtering/filter.d.ts +5 -5
  74. package/operations/entry/filtering/filter.js +13 -21
  75. package/operations/entry/filtering/filter.js.map +1 -1
  76. package/operations/entry/filtering/fullTextSearch.d.ts +3 -3
  77. package/operations/entry/filtering/fullTextSearch.js +5 -13
  78. package/operations/entry/filtering/fullTextSearch.js.map +1 -1
  79. package/operations/entry/filtering/getValue.js +1 -8
  80. package/operations/entry/filtering/getValue.js.map +1 -1
  81. package/operations/entry/filtering/index.d.ts +2 -2
  82. package/operations/entry/filtering/index.js +2 -19
  83. package/operations/entry/filtering/index.js.map +1 -1
  84. package/operations/entry/filtering/mapPlugins.d.ts +1 -1
  85. package/operations/entry/filtering/mapPlugins.js +3 -11
  86. package/operations/entry/filtering/mapPlugins.js.map +1 -1
  87. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +1 -1
  88. package/operations/entry/filtering/plugins/defaultFilterCreate.js +6 -14
  89. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
  90. package/operations/entry/filtering/plugins/index.d.ts +1 -1
  91. package/operations/entry/filtering/plugins/index.js +6 -13
  92. package/operations/entry/filtering/plugins/index.js.map +1 -1
  93. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +1 -1
  94. package/operations/entry/filtering/plugins/objectFilterCreate.js +13 -19
  95. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
  96. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +2 -2
  97. package/operations/entry/filtering/plugins/refFilterCreate.js +12 -18
  98. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
  99. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +1 -1
  100. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +7 -15
  101. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -1
  102. package/operations/entry/filtering/sort.d.ts +5 -5
  103. package/operations/entry/filtering/sort.js +15 -19
  104. package/operations/entry/filtering/sort.js.map +1 -1
  105. package/operations/entry/filtering/systemFields.d.ts +2 -4
  106. package/operations/entry/filtering/systemFields.js +70 -29
  107. package/operations/entry/filtering/systemFields.js.map +1 -1
  108. package/operations/entry/filtering/transform.d.ts +1 -1
  109. package/operations/entry/filtering/transform.js +1 -8
  110. package/operations/entry/filtering/transform.js.map +1 -1
  111. package/operations/entry/filtering/types.d.ts +3 -3
  112. package/operations/entry/filtering/types.js +1 -5
  113. package/operations/entry/filtering/types.js.map +1 -1
  114. package/operations/entry/filtering/values.d.ts +1 -1
  115. package/operations/entry/filtering/values.js +4 -12
  116. package/operations/entry/filtering/values.js.map +1 -1
  117. package/operations/entry/filtering/where.js +1 -8
  118. package/operations/entry/filtering/where.js.map +1 -1
  119. package/operations/entry/index.d.ts +2 -3
  120. package/operations/entry/index.js +267 -377
  121. package/operations/entry/index.js.map +1 -1
  122. package/operations/entry/keys.d.ts +40 -2
  123. package/operations/entry/keys.js +53 -30
  124. package/operations/entry/keys.js.map +1 -1
  125. package/operations/group/index.d.ts +3 -3
  126. package/operations/group/index.js +35 -64
  127. package/operations/group/index.js.map +1 -1
  128. package/operations/model/index.d.ts +3 -3
  129. package/operations/model/index.js +36 -58
  130. package/operations/model/index.js.map +1 -1
  131. package/package.json +16 -18
  132. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +2 -2
  133. package/plugins/CmsEntryFieldFilterPathPlugin.js +4 -12
  134. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  135. package/plugins/CmsEntryFieldFilterPlugin.d.ts +3 -3
  136. package/plugins/CmsEntryFieldFilterPlugin.js +2 -8
  137. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
  138. package/plugins/CmsEntryFieldSortingPlugin.d.ts +2 -2
  139. package/plugins/CmsEntryFieldSortingPlugin.js +3 -11
  140. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
  141. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +1 -1
  142. package/plugins/CmsFieldFilterValueTransformPlugin.js +2 -9
  143. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
  144. package/plugins/index.d.ts +4 -4
  145. package/plugins/index.js +4 -49
  146. package/plugins/index.js.map +1 -1
  147. package/types.d.ts +17 -19
  148. package/types.js +1 -8
  149. package/types.js.map +1 -1
  150. package/definitions/system.d.ts +0 -10
  151. package/definitions/system.js +0 -42
  152. package/definitions/system.js.map +0 -1
  153. package/operations/system/index.d.ts +0 -7
  154. package/operations/system/index.js +0 -94
  155. package/operations/system/index.js.map +0 -1
@@ -1,23 +1,10 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createGroupsStorageOperations = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _get = require("@webiny/db-dynamodb/utils/get");
10
- var _query = require("@webiny/db-dynamodb/utils/query");
11
- var _filter = require("@webiny/db-dynamodb/utils/filter");
12
- var _ValueFilterPlugin = require("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin");
13
- var _sort = require("@webiny/db-dynamodb/utils/sort");
14
- var _dbDynamodb = require("@webiny/db-dynamodb");
1
+ import WebinyError from "@webiny/error";
2
+ import { filterItems, sortItems, ValueFilterPlugin } from "@webiny/db-dynamodb";
15
3
  const createPartitionKey = params => {
16
4
  const {
17
- tenant,
18
- locale
5
+ tenant
19
6
  } = params;
20
- return `T#${tenant}#L#${locale}#CMS#CMG`;
7
+ return `T#${tenant}#CMS#CMG`;
21
8
  };
22
9
  const createSortKeys = params => {
23
10
  const {
@@ -28,20 +15,21 @@ const createSortKeys = params => {
28
15
  const createKeys = params => {
29
16
  return {
30
17
  PK: createPartitionKey(params),
31
- SK: createSortKeys(params)
18
+ SK: createSortKeys(params),
19
+ GSI_TENANT: params.tenant
32
20
  };
33
21
  };
34
22
  const createType = () => {
35
23
  return "cms.group";
36
24
  };
37
- const createGroupsStorageOperations = params => {
25
+ export const createGroupsStorageOperations = params => {
38
26
  const {
39
27
  entity,
40
28
  plugins
41
29
  } = params;
42
- const filteringPlugins = plugins.byType(_ValueFilterPlugin.ValueFilterPlugin.type);
30
+ const filteringPlugins = plugins.byType(ValueFilterPlugin.type);
43
31
  if (filteringPlugins.length === 0) {
44
- throw new _error.default("DynamoDB filtering plugins not loaded.", "MISSING_DYNAMODB_FILTERING_PLUGINS");
32
+ throw new WebinyError("DynamoDB filtering plugins not loaded.", "MISSING_DYNAMODB_FILTERING_PLUGINS");
45
33
  }
46
34
  const create = async params => {
47
35
  const {
@@ -49,17 +37,13 @@ const createGroupsStorageOperations = params => {
49
37
  } = params;
50
38
  const keys = createKeys(group);
51
39
  try {
52
- await (0, _dbDynamodb.put)({
53
- entity,
54
- item: {
55
- ...group,
56
- TYPE: createType(),
57
- ...keys
58
- }
40
+ await entity.put({
41
+ data: group,
42
+ TYPE: createType(),
43
+ ...keys
59
44
  });
60
- return group;
61
45
  } catch (ex) {
62
- throw new _error.default(ex.message || "Could not create group.", ex.code || "CREATE_GROUP_ERROR", {
46
+ throw new WebinyError(ex.message || "Could not create group.", ex.code || "CREATE_GROUP_ERROR", {
63
47
  error: ex,
64
48
  group,
65
49
  keys
@@ -72,17 +56,13 @@ const createGroupsStorageOperations = params => {
72
56
  } = params;
73
57
  const keys = createKeys(group);
74
58
  try {
75
- await (0, _dbDynamodb.put)({
76
- entity,
77
- item: {
78
- ...group,
79
- TYPE: createType(),
80
- ...keys
81
- }
59
+ await entity.put({
60
+ data: group,
61
+ TYPE: createType(),
62
+ ...keys
82
63
  });
83
- return group;
84
64
  } catch (ex) {
85
- throw new _error.default(ex.message || "Could not update group.", ex.code || "UPDATE_GROUP_ERROR", {
65
+ throw new WebinyError(ex.message || "Could not update group.", ex.code || "UPDATE_GROUP_ERROR", {
86
66
  error: ex,
87
67
  group,
88
68
  keys
@@ -95,13 +75,9 @@ const createGroupsStorageOperations = params => {
95
75
  } = params;
96
76
  const keys = createKeys(group);
97
77
  try {
98
- await (0, _dbDynamodb.deleteItem)({
99
- entity,
100
- keys
101
- });
102
- return group;
78
+ await entity.delete(keys);
103
79
  } catch (ex) {
104
- throw new _error.default(ex.message || "Could not delete group.", ex.code || "DELETE_GROUP_ERROR", {
80
+ throw new WebinyError(ex.message || "Could not delete group.", ex.code || "DELETE_GROUP_ERROR", {
105
81
  error: ex,
106
82
  group,
107
83
  keys
@@ -111,12 +87,10 @@ const createGroupsStorageOperations = params => {
111
87
  const get = async params => {
112
88
  const keys = createKeys(params);
113
89
  try {
114
- return await (0, _get.getClean)({
115
- entity,
116
- keys
117
- });
90
+ const result = await entity.get(keys);
91
+ return result?.data || null;
118
92
  } catch (ex) {
119
- throw new _error.default(ex.message || "Could not get group.", ex.code || "GET_GROUP_ERROR", {
93
+ throw new WebinyError(ex.message || "Could not get group.", ex.code || "GET_GROUP_ERROR", {
120
94
  error: ex,
121
95
  ...params,
122
96
  keys
@@ -128,25 +102,24 @@ const createGroupsStorageOperations = params => {
128
102
  sort,
129
103
  where
130
104
  } = params;
131
- const queryAllParams = {
132
- entity,
133
- partitionKey: createPartitionKey(where),
134
- options: {
135
- gte: " "
136
- }
137
- };
138
105
  let records = [];
139
106
  try {
140
- records = await (0, _query.queryAll)(queryAllParams);
107
+ const ddbRecords = await entity.queryAll({
108
+ partitionKey: createPartitionKey(where),
109
+ options: {
110
+ gte: " "
111
+ }
112
+ });
113
+ records = ddbRecords.map(item => item.data);
141
114
  } catch (ex) {
142
- throw new _error.default(ex.message || "Could not list groups.", ex.code || "LIST_GROUP_ERROR", {
115
+ throw new WebinyError(ex.message || "Could not list groups.", ex.code || "LIST_GROUP_ERROR", {
143
116
  error: ex,
144
117
  ...params,
145
118
  sort,
146
119
  where
147
120
  });
148
121
  }
149
- const filteredItems = (0, _filter.filterItems)({
122
+ const filteredItems = filterItems({
150
123
  items: records,
151
124
  where,
152
125
  fields: [],
@@ -155,10 +128,9 @@ const createGroupsStorageOperations = params => {
155
128
  if (!sort || sort.length === 0) {
156
129
  return filteredItems;
157
130
  }
158
- return (0, _sort.sortItems)({
131
+ return sortItems({
159
132
  items: filteredItems,
160
- sort,
161
- fields: []
133
+ sort
162
134
  });
163
135
  };
164
136
  return {
@@ -169,6 +141,5 @@ const createGroupsStorageOperations = params => {
169
141
  list
170
142
  };
171
143
  };
172
- exports.createGroupsStorageOperations = createGroupsStorageOperations;
173
144
 
174
145
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_get","_query","_filter","_ValueFilterPlugin","_sort","_dbDynamodb","createPartitionKey","params","tenant","locale","createSortKeys","id","createKeys","PK","SK","createType","createGroupsStorageOperations","entity","plugins","filteringPlugins","byType","ValueFilterPlugin","type","length","WebinyError","create","group","keys","put","item","TYPE","ex","message","code","error","update","deleteGroup","deleteItem","get","getClean","list","sort","where","queryAllParams","partitionKey","options","gte","records","queryAll","filteredItems","filterItems","items","fields","sortItems","delete","exports"],"sources":["index.ts"],"sourcesContent":["import type {\n CmsGroup,\n CmsGroupStorageOperations,\n CmsGroupStorageOperationsCreateParams,\n CmsGroupStorageOperationsDeleteParams,\n CmsGroupStorageOperationsGetParams,\n CmsGroupStorageOperationsListParams,\n CmsGroupStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types\";\nimport type { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport WebinyError from \"@webiny/error\";\nimport { getClean } from \"@webiny/db-dynamodb/utils/get\";\nimport type { QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { queryAll } from \"@webiny/db-dynamodb/utils/query\";\nimport { filterItems } from \"@webiny/db-dynamodb/utils/filter\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport { sortItems } from \"@webiny/db-dynamodb/utils/sort\";\nimport { deleteItem, put } from \"@webiny/db-dynamodb\";\n\ninterface PartitionKeyParams {\n tenant: string;\n locale: string;\n}\nconst createPartitionKey = (params: PartitionKeyParams): string => {\n const { tenant, locale } = params;\n return `T#${tenant}#L#${locale}#CMS#CMG`;\n};\n\ninterface SortKeyParams {\n id: string;\n}\nconst createSortKeys = (params: SortKeyParams): string => {\n const { id } = params;\n return id;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeyParams & SortKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKeys(params)\n };\n};\n\nconst createType = (): string => {\n return \"cms.group\";\n};\n\ninterface CreateGroupsStorageOperationsParams {\n entity: Entity<any>;\n plugins: PluginsContainer;\n}\nexport const createGroupsStorageOperations = (\n params: CreateGroupsStorageOperationsParams\n): CmsGroupStorageOperations => {\n const { entity, plugins } = params;\n\n const filteringPlugins = plugins.byType<ValueFilterPlugin>(ValueFilterPlugin.type);\n if (filteringPlugins.length === 0) {\n throw new WebinyError(\n \"DynamoDB filtering plugins not loaded.\",\n \"MISSING_DYNAMODB_FILTERING_PLUGINS\"\n );\n }\n\n const create = async (params: CmsGroupStorageOperationsCreateParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await put({\n entity,\n item: {\n ...group,\n TYPE: createType(),\n ...keys\n }\n });\n return group;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create group.\",\n ex.code || \"CREATE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const update = async (params: CmsGroupStorageOperationsUpdateParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await put({\n entity,\n item: {\n ...group,\n TYPE: createType(),\n ...keys\n }\n });\n return group;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update group.\",\n ex.code || \"UPDATE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const deleteGroup = async (params: CmsGroupStorageOperationsDeleteParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await deleteItem({\n entity,\n keys\n });\n return group;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete group.\",\n ex.code || \"DELETE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const get = async (params: CmsGroupStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n return await getClean<CmsGroup>({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get group.\",\n ex.code || \"GET_GROUP_ERROR\",\n {\n error: ex,\n ...params,\n keys\n }\n );\n }\n };\n const list = async (params: CmsGroupStorageOperationsListParams) => {\n const { sort, where } = params;\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey(where),\n options: {\n gte: \" \"\n }\n };\n\n let records: CmsGroup[] = [];\n try {\n records = await queryAll(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list groups.\",\n ex.code || \"LIST_GROUP_ERROR\",\n {\n error: ex,\n ...params,\n sort,\n where\n }\n );\n }\n\n const filteredItems = filterItems({\n items: records,\n where,\n fields: [],\n plugins\n });\n if (!sort || sort.length === 0) {\n return filteredItems;\n }\n return sortItems({\n items: filteredItems,\n sort,\n fields: []\n });\n };\n\n return {\n create,\n update,\n delete: deleteGroup,\n get,\n list\n };\n};\n"],"mappings":";;;;;;;AAUA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAMA,MAAMO,kBAAkB,GAAIC,MAA0B,IAAa;EAC/D,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGF,MAAM;EACjC,OAAO,KAAKC,MAAM,MAAMC,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ACJ,CAAC;AACL,CAAC;AAACe,OAAA,CAAAvC,6BAAA,GAAAA,6BAAA","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","filterItems","sortItems","ValueFilterPlugin","createPartitionKey","params","tenant","createSortKeys","id","createKeys","PK","SK","GSI_TENANT","createType","createGroupsStorageOperations","entity","plugins","filteringPlugins","byType","type","length","create","group","keys","put","data","TYPE","ex","message","code","error","update","deleteGroup","delete","get","result","list","sort","where","records","ddbRecords","queryAll","partitionKey","options","gte","map","item","filteredItems","items","fields"],"sources":["index.ts"],"sourcesContent":["import type {\n CmsGroup,\n CmsGroupStorageOperations,\n CmsGroupStorageOperationsCreateParams,\n CmsGroupStorageOperationsDeleteParams,\n CmsGroupStorageOperationsGetParams,\n CmsGroupStorageOperationsListParams,\n CmsGroupStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { filterItems, sortItems, ValueFilterPlugin } from \"@webiny/db-dynamodb\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { IGroupEntity } from \"~/definitions/types.js\";\n\ninterface PartitionKeyParams {\n tenant: string;\n}\nconst createPartitionKey = (params: PartitionKeyParams): string => {\n const { tenant } = params;\n return `T#${tenant}#CMS#CMG`;\n};\n\ninterface SortKeyParams {\n id: string;\n}\nconst createSortKeys = (params: SortKeyParams): string => {\n const { id } = params;\n return id;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n GSI_TENANT: string;\n}\nconst createKeys = (params: PartitionKeyParams & SortKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKeys(params),\n GSI_TENANT: params.tenant\n };\n};\n\nconst createType = (): string => {\n return \"cms.group\";\n};\n\ninterface CreateGroupsStorageOperationsParams {\n entity: IGroupEntity;\n plugins: PluginsContainer;\n}\nexport const createGroupsStorageOperations = (\n params: CreateGroupsStorageOperationsParams\n): CmsGroupStorageOperations => {\n const { entity, plugins } = params;\n\n const filteringPlugins = plugins.byType<ValueFilterPlugin>(ValueFilterPlugin.type);\n if (filteringPlugins.length === 0) {\n throw new WebinyError(\n \"DynamoDB filtering plugins not loaded.\",\n \"MISSING_DYNAMODB_FILTERING_PLUGINS\"\n );\n }\n\n const create = async (params: CmsGroupStorageOperationsCreateParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await entity.put({\n data: group,\n TYPE: createType(),\n ...keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create group.\",\n ex.code || \"CREATE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const update = async (params: CmsGroupStorageOperationsUpdateParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await entity.put({\n data: group,\n TYPE: createType(),\n ...keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update group.\",\n ex.code || \"UPDATE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const deleteGroup = async (params: CmsGroupStorageOperationsDeleteParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await entity.delete(keys);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete group.\",\n ex.code || \"DELETE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const get = async (params: CmsGroupStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n const result = await entity.get(keys);\n\n return result?.data || null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get group.\",\n ex.code || \"GET_GROUP_ERROR\",\n {\n error: ex,\n ...params,\n keys\n }\n );\n }\n };\n const list = async (params: CmsGroupStorageOperationsListParams) => {\n const { sort, where } = params;\n\n let records: CmsGroup[] = [];\n try {\n const ddbRecords = await entity.queryAll({\n partitionKey: createPartitionKey(where),\n options: {\n gte: \" \"\n }\n });\n records = ddbRecords.map(item => item.data);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list groups.\",\n ex.code || \"LIST_GROUP_ERROR\",\n {\n error: ex,\n ...params,\n sort,\n where\n }\n );\n }\n\n const filteredItems = filterItems({\n items: records,\n where,\n fields: [],\n plugins\n });\n if (!sort || sort.length === 0) {\n return filteredItems;\n }\n\n return sortItems({\n items: filteredItems,\n sort\n });\n };\n\n return {\n create,\n update,\n delete: deleteGroup,\n get,\n list\n };\n};\n"],"mappings":"AASA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,WAAW,EAAEC,SAAS,EAAEC,iBAAiB,QAAQ,qBAAqB;AAO/E,MAAMC,kBAAkB,GAAIC,MAA0B,IAAa;EAC/D,MAAM;IAAEC;EAAO,CAAC,GAAGD,MAAM;EACzB,OAAO,KAAKC,MAAM,UAAU;AAChC,CAAC;AAKD,MAAMC,cAAc,GAAIF,MAAqB,IAAa;EACtD,MAAM;IAAEG;EAAG,CAAC,GAAGH,MAAM;EACrB,OAAOG,EAAE;AACb,CAAC;AAOD,MAAMC,UAAU,GAAIJ,MAA0C,IAAW;EACrE,OAAO;IACHK,EAAE,EAAEN,kBAAkB,CAACC,MAAM,CAAC;IAC9BM,EAAE,EAAEJ,cAAc,CAACF,MAAM,CAAC;IAC1BO,UAAU,EAAEP,MAAM,CAACC;EACvB,CAAC;AACL,CAAC;AAED,MAAMO,UAAU,GAAGA,CAAA,KAAc;EAC7B,OAAO,WAAW;AACtB,CAAC;AAMD,OAAO,MAAMC,6BAA6B,GACtCT,MAA2C,IACf;EAC5B,MAAM;IAAEU,MAAM;IAAEC;EAAQ,CAAC,GAAGX,MAAM;EAElC,MAAMY,gBAAgB,GAAGD,OAAO,CAACE,MAAM,CAAoBf,iBAAiB,CAACgB,IAAI,CAAC;EAClF,IAAIF,gBAAgB,CAACG,MAAM,KAAK,CAAC,EAAE;IAC/B,MAAM,IAAIpB,WAAW,CACjB,wCAAwC,EACxC,oCACJ,CAAC;EACL;EAEA,MAAMqB,MAAM,GAAG,MAAOhB,MAA6C,IAAK;IACpE,MAAM;MAAEiB;IAAM,CAAC,GAAGjB,MAAM;IAC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CACJ,CAAC;IACL;IAEA,MAAMS,aAAa,GAAG9C,WAAW,CAAC;MAC9B+C,KAAK,EAAET,OAAO;MACdD,KAAK;MACLW,MAAM,EAAE,EAAE;MACVjC;IACJ,CAAC,CAAC;IACF,IAAI,CAACqB,IAAI,IAAIA,IAAI,CAACjB,MAAM,KAAK,CAAC,EAAE;MAC5B,OAAO2B,aAAa;IACxB;IAEA,OAAO7C,SAAS,CAAC;MACb8C,KAAK,EAAED,aAAa;MACpBV;IACJ,CAAC,CAAC;EACN,CAAC;EAED,OAAO;IACHhB,MAAM;IACNU,MAAM;IACNE,MAAM,EAAED,WAAW;IACnBE,GAAG;IACHE;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
- import type { CmsModelStorageOperations } from "@webiny/api-headless-cms/types";
2
- import type { Entity } from "@webiny/db-dynamodb/toolbox";
1
+ import type { CmsModelStorageOperations } from "@webiny/api-headless-cms/types/index.js";
2
+ import type { IModelEntity } from "../../definitions/types.js";
3
3
  interface CreateModelsStorageOperationsParams {
4
- entity: Entity<any>;
4
+ entity: IModelEntity;
5
5
  }
6
6
  export declare const createModelsStorageOperations: (params: CreateModelsStorageOperationsParams) => CmsModelStorageOperations;
7
7
  export {};
@@ -1,26 +1,13 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createModelsStorageOperations = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _get = require("@webiny/db-dynamodb/utils/get");
10
- var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
11
- var _query = require("@webiny/db-dynamodb/utils/query");
12
- var _dbDynamodb = require("@webiny/db-dynamodb");
1
+ import WebinyError from "@webiny/error";
2
+ import { convertException } from "@webiny/utils";
13
3
  const createPartitionKey = params => {
14
4
  const {
15
- tenant,
16
- locale
5
+ tenant
17
6
  } = params;
18
7
  if (!tenant) {
19
- throw new _error.default(`Missing tenant variable when creating model partitionKey.`);
20
- } else if (!locale) {
21
- throw new _error.default(`Missing locale variable when creating model partitionKey.`);
8
+ throw new WebinyError(`Missing tenant variable when creating model partitionKey.`);
22
9
  }
23
- return `T#${tenant}#L#${locale}#CMS#CM`;
10
+ return `T#${tenant}#CMS#CM`;
24
11
  };
25
12
  const createSortKey = params => {
26
13
  return params.modelId;
@@ -28,13 +15,14 @@ const createSortKey = params => {
28
15
  const createKeys = params => {
29
16
  return {
30
17
  PK: createPartitionKey(params),
31
- SK: createSortKey(params)
18
+ SK: createSortKey(params),
19
+ GSI_TENANT: params.tenant
32
20
  };
33
21
  };
34
22
  const createType = () => {
35
23
  return "cms.model";
36
24
  };
37
- const createModelsStorageOperations = params => {
25
+ export const createModelsStorageOperations = params => {
38
26
  const {
39
27
  entity
40
28
  } = params;
@@ -44,18 +32,15 @@ const createModelsStorageOperations = params => {
44
32
  } = params;
45
33
  const keys = createKeys(model);
46
34
  try {
47
- await (0, _dbDynamodb.put)({
48
- entity,
49
- item: {
50
- ...(0, _cleanup.cleanupItem)(entity, model),
51
- ...keys,
52
- TYPE: createType()
53
- }
35
+ await entity.put({
36
+ data: model,
37
+ ...keys,
38
+ TYPE: createType()
54
39
  });
55
40
  return model;
56
41
  } catch (ex) {
57
- throw new _error.default(`Could not create CMS Content Model.`, "CREATE_MODEL_ERROR", {
58
- error: ex,
42
+ throw new WebinyError(`Could not create CMS Content Model.`, "CREATE_MODEL_ERROR", {
43
+ error: convertException(ex),
59
44
  model,
60
45
  keys
61
46
  });
@@ -67,17 +52,14 @@ const createModelsStorageOperations = params => {
67
52
  } = params;
68
53
  const keys = createKeys(model);
69
54
  try {
70
- await (0, _dbDynamodb.put)({
71
- entity,
72
- item: {
73
- ...(0, _cleanup.cleanupItem)(entity, model),
74
- ...keys,
75
- TYPE: createType()
76
- }
55
+ await entity.put({
56
+ data: model,
57
+ ...keys,
58
+ TYPE: createType()
77
59
  });
78
60
  return model;
79
61
  } catch (ex) {
80
- throw new _error.default(ex.message || "Could not update model.", ex.code || "MODEL_UPDATE_ERROR", {
62
+ throw new WebinyError(ex.message || "Could not update model.", ex.code || "MODEL_UPDATE_ERROR", {
81
63
  error: ex,
82
64
  model,
83
65
  keys
@@ -90,13 +72,10 @@ const createModelsStorageOperations = params => {
90
72
  } = params;
91
73
  const keys = createKeys(model);
92
74
  try {
93
- await (0, _dbDynamodb.deleteItem)({
94
- entity,
95
- keys
96
- });
75
+ await entity.delete(keys);
97
76
  return model;
98
77
  } catch (ex) {
99
- throw new _error.default(ex.message || "Could not delete model.", ex.code || "MODEL_DELETE_ERROR", {
78
+ throw new WebinyError(ex.message || "Could not delete model.", ex.code || "MODEL_DELETE_ERROR", {
100
79
  error: ex,
101
80
  model,
102
81
  keys
@@ -106,12 +85,10 @@ const createModelsStorageOperations = params => {
106
85
  const get = async params => {
107
86
  const keys = createKeys(params);
108
87
  try {
109
- return await (0, _get.getClean)({
110
- entity,
111
- keys
112
- });
88
+ const result = await entity.get(keys);
89
+ return result?.data || null;
113
90
  } catch (ex) {
114
- throw new _error.default(ex.message || "Could not get model.", ex.code || "MODEL_GET_ERROR", {
91
+ throw new WebinyError(ex.message || "Could not get model.", ex.code || "MODEL_GET_ERROR", {
115
92
  error: ex,
116
93
  keys
117
94
  });
@@ -121,19 +98,21 @@ const createModelsStorageOperations = params => {
121
98
  const {
122
99
  where
123
100
  } = params;
124
- const queryAllParams = {
125
- entity,
126
- partitionKey: createPartitionKey(where),
127
- options: {
128
- gte: " "
129
- }
130
- };
101
+ const partitionKey = createPartitionKey(where);
131
102
  try {
132
- return await (0, _query.queryAllClean)(queryAllParams);
103
+ const result = await entity.queryAll({
104
+ partitionKey,
105
+ options: {
106
+ gte: " "
107
+ }
108
+ });
109
+ return result.map(item => {
110
+ return item.data;
111
+ });
133
112
  } catch (ex) {
134
- throw new _error.default(ex.message || "Could not list models.", ex.code || "MODEL_LIST_ERROR", {
113
+ throw new WebinyError(ex.message || "Could not list models.", ex.code || "MODEL_LIST_ERROR", {
135
114
  error: ex,
136
- partitionKey: queryAllParams.partitionKey
115
+ partitionKey
137
116
  });
138
117
  }
139
118
  };
@@ -145,6 +124,5 @@ const createModelsStorageOperations = params => {
145
124
  list
146
125
  };
147
126
  };
148
- exports.createModelsStorageOperations = createModelsStorageOperations;
149
127
 
150
128
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_get","_cleanup","_query","_dbDynamodb","createPartitionKey","params","tenant","locale","WebinyError","createSortKey","modelId","createKeys","PK","SK","createType","createModelsStorageOperations","entity","create","model","keys","put","item","cleanupItem","TYPE","ex","error","update","message","code","deleteModel","deleteItem","get","getClean","list","where","queryAllParams","partitionKey","options","gte","queryAllClean","delete","exports"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsModelStorageOperations,\n CmsModelStorageOperationsCreateParams,\n CmsModelStorageOperationsDeleteParams,\n CmsModelStorageOperationsGetParams,\n CmsModelStorageOperationsListParams,\n CmsModelStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types\";\nimport type { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport { getClean } from \"@webiny/db-dynamodb/utils/get\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport type { QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { queryAllClean } from \"@webiny/db-dynamodb/utils/query\";\nimport { deleteItem, put } from \"@webiny/db-dynamodb\";\n\ninterface PartitionKeysParams {\n tenant: string;\n locale: string;\n}\nconst createPartitionKey = (params: PartitionKeysParams): string => {\n const { tenant, locale } = params;\n if (!tenant) {\n throw new WebinyError(`Missing tenant variable when creating model partitionKey.`);\n } else if (!locale) {\n throw new WebinyError(`Missing locale variable when creating model partitionKey.`);\n }\n return `T#${tenant}#L#${locale}#CMS#CM`;\n};\n\ninterface SortKeyParams {\n modelId: string;\n}\nconst createSortKey = (params: SortKeyParams): string => {\n return params.modelId;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeysParams & SortKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey(params)\n };\n};\n\nconst createType = (): string => {\n return \"cms.model\";\n};\n\ninterface CreateModelsStorageOperationsParams {\n entity: Entity<any>;\n}\nexport const createModelsStorageOperations = (\n params: CreateModelsStorageOperationsParams\n): CmsModelStorageOperations => {\n const { entity } = params;\n\n const create = async (params: CmsModelStorageOperationsCreateParams) => {\n const { model } = params;\n\n const keys = createKeys(model);\n\n try {\n await put({\n entity,\n item: {\n ...cleanupItem(entity, model),\n ...keys,\n TYPE: createType()\n }\n });\n return model;\n } catch (ex) {\n throw new WebinyError(`Could not create CMS Content Model.`, \"CREATE_MODEL_ERROR\", {\n error: ex,\n model,\n keys\n });\n }\n };\n\n const update = async (params: CmsModelStorageOperationsUpdateParams) => {\n const { model } = params;\n\n const keys = createKeys(model);\n\n try {\n await put({\n entity,\n item: {\n ...cleanupItem(entity, model),\n ...keys,\n TYPE: createType()\n }\n });\n return model;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update model.\",\n ex.code || \"MODEL_UPDATE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n };\n\n const deleteModel = async (params: CmsModelStorageOperationsDeleteParams) => {\n const { model } = params;\n const keys = createKeys(model);\n\n try {\n await deleteItem({\n entity,\n keys\n });\n return model;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete model.\",\n ex.code || \"MODEL_DELETE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsModelStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n return await getClean<CmsModel>({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get model.\",\n ex.code || \"MODEL_GET_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n const list = async (params: CmsModelStorageOperationsListParams) => {\n const { where } = params;\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey(where),\n options: {\n gte: \" \"\n }\n };\n try {\n return await queryAllClean<CmsModel>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list models.\",\n ex.code || \"MODEL_LIST_ERROR\",\n {\n error: ex,\n partitionKey: queryAllParams.partitionKey\n }\n );\n }\n };\n\n return {\n create,\n update,\n delete: deleteModel,\n get,\n list\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAWA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAMA,MAAMK,kBAAkB,GAAIC,MAA2B,IAAa;EAChE,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGF,MAAM;EACjC,IAAI,CAACC,MAAM,EAAE;IACT,MAAM,IAAIE,cAAW,CAAC,2DAA2D,CAAC;EACtF,CAAC,MAAM,IAAI,CAACD,MAAM,EAAE;IAChB,MAAM,IAAIC,cAAW,CAAC,2DAA2D,CAAC;EACtF;EACA,OAAO,KAAKF,MAAM,MAAMC,MAAM,SAAS;AAC3C,CAAC;AAKD,MAAME,aAAa,GAAIJ,MAAqB,IAAa;EACrD,OAAOA,MAAM,CAACK,OAAO;AACzB,CAAC;AAMD,MAAMC,UAAU,GAAIN,MAA2C,IAAW;EACtE,OAAO;IACHO,EAAE,EAAER,kBAAkB,CAACC,MAAM,CAAC;IAC9BQ,EAAE,EAAEJ,aAAa,CAACJ,MAAM;EAC5B,CAAC;AACL,CAAC;AAED,MAAMS,UAAU,GAAGA,CAAA,KAAc;EAC7B,OAAO,WAAW;AACtB,CAAC;AAKM,MAAMC,6BAA6B,GACtCV,MAA2C,IACf;EAC5B,MAAM;IAAEW;EAAO,CAAC,GAAG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7B;QACIH,KAAK,EAAED,EAAE;QACTY,YAAY,EAAED,cAAc,CAACC;MACjC,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHnB,MAAM;IACNS,MAAM;IACNc,MAAM,EAAEX,WAAW;IACnBE,GAAG;IACHE;EACJ,CAAC;AACL,CAAC;AAACQ,OAAA,CAAA1B,6BAAA,GAAAA,6BAAA","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","convertException","createPartitionKey","params","tenant","createSortKey","modelId","createKeys","PK","SK","GSI_TENANT","createType","createModelsStorageOperations","entity","create","model","keys","put","data","TYPE","ex","error","update","message","code","deleteModel","delete","get","result","list","where","partitionKey","queryAll","options","gte","map","item"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModelStorageOperations,\n CmsModelStorageOperationsCreateParams,\n CmsModelStorageOperationsDeleteParams,\n CmsModelStorageOperationsGetParams,\n CmsModelStorageOperationsListParams,\n CmsModelStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { IModelEntity } from \"~/definitions/types.js\";\n\ninterface PartitionKeysParams {\n tenant: string;\n}\nconst createPartitionKey = (params: PartitionKeysParams): string => {\n const { tenant } = params;\n if (!tenant) {\n throw new WebinyError(`Missing tenant variable when creating model partitionKey.`);\n }\n return `T#${tenant}#CMS#CM`;\n};\n\ninterface SortKeyParams {\n modelId: string;\n}\nconst createSortKey = (params: SortKeyParams): string => {\n return params.modelId;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n GSI_TENANT: string;\n}\nconst createKeys = (params: PartitionKeysParams & SortKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey(params),\n GSI_TENANT: params.tenant\n };\n};\n\nconst createType = (): string => {\n return \"cms.model\";\n};\n\ninterface CreateModelsStorageOperationsParams {\n entity: IModelEntity;\n}\nexport const createModelsStorageOperations = (\n params: CreateModelsStorageOperationsParams\n): CmsModelStorageOperations => {\n const { entity } = params;\n\n const create = async (params: CmsModelStorageOperationsCreateParams) => {\n const { model } = params;\n\n const keys = createKeys(model);\n\n try {\n await entity.put({\n data: model,\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n throw new WebinyError(`Could not create CMS Content Model.`, \"CREATE_MODEL_ERROR\", {\n error: convertException(ex),\n model,\n keys\n });\n }\n };\n\n const update = async (params: CmsModelStorageOperationsUpdateParams) => {\n const { model } = params;\n\n const keys = createKeys(model);\n\n try {\n await entity.put({\n data: model,\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update model.\",\n ex.code || \"MODEL_UPDATE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n };\n\n const deleteModel = async (params: CmsModelStorageOperationsDeleteParams) => {\n const { model } = params;\n const keys = createKeys(model);\n\n try {\n await entity.delete(keys);\n return model;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete model.\",\n ex.code || \"MODEL_DELETE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsModelStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n const result = await entity.get(keys);\n return result?.data || null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get model.\",\n ex.code || \"MODEL_GET_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n const list = async (params: CmsModelStorageOperationsListParams) => {\n const { where } = params;\n\n const partitionKey = createPartitionKey(where);\n\n try {\n const result = await entity.queryAll({\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n return result.map(item => {\n return item.data;\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list models.\",\n ex.code || \"MODEL_LIST_ERROR\",\n {\n error: ex,\n partitionKey\n }\n );\n }\n };\n\n return {\n create,\n update,\n delete: deleteModel,\n get,\n list\n };\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;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AAW,CACjBoB,EAAE,CAACG,OAAO,IAAI,sBAAsB,EACpCH,EAAE,CAACI,IAAI,IAAI,iBAAiB,EAC5B;QACIH,KAAK,EAAED,EAAE;QACTJ;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMa,IAAI,GAAG,MAAO1B,MAA2C,IAAK;IAChE,MAAM;MAAE2B;IAAM,CAAC,GAAG3B,MAAM;IAExB,MAAM4B,YAAY,GAAG7B,kBAAkB,CAAC4B,KAAK,CAAC;IAE9C,IAAI;MACA,MAAMF,MAAM,GAAG,MAAMf,MAAM,CAACmB,QAAQ,CAAC;QACjCD,YAAY;QACZE,OAAO,EAAE;UACLC,GAAG,EAAE;QACT;MACJ,CAAC,CAAC;MACF,OAAON,MAAM,CAACO,GAAG,CAACC,IAAI,IAAI;QACtB,OAAOA,IAAI,CAAClB,IAAI;MACpB,CAAC,CAAC;IACN,CAAC,CAAC,OAAOE,EAAE,EAAE;MACT,MAAM,IAAIpB,WAAW,CACjBoB,EAAE,CAACG,OAAO,IAAI,wBAAwB,EACtCH,EAAE,CAACI,IAAI,IAAI,kBAAkB,EAC7B;QACIH,KAAK,EAAED,EAAE;QACTW;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHjB,MAAM;IACNQ,MAAM;IACNI,MAAM,EAAED,WAAW;IACnBE,GAAG;IACHE;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb",
3
- "version": "0.0.0-unstable.eb196ccd2f",
3
+ "version": "0.0.0-unstable.f6dc066313",
4
+ "type": "module",
4
5
  "main": "index.js",
5
6
  "keywords": [
6
7
  "@webiny/api-headless-cms",
@@ -22,34 +23,31 @@
22
23
  ],
23
24
  "license": "MIT",
24
25
  "dependencies": {
25
- "@webiny/api": "0.0.0-unstable.eb196ccd2f",
26
- "@webiny/api-headless-cms": "0.0.0-unstable.eb196ccd2f",
27
- "@webiny/aws-sdk": "0.0.0-unstable.eb196ccd2f",
28
- "@webiny/db-dynamodb": "0.0.0-unstable.eb196ccd2f",
29
- "@webiny/error": "0.0.0-unstable.eb196ccd2f",
30
- "@webiny/handler-db": "0.0.0-unstable.eb196ccd2f",
31
- "@webiny/utils": "0.0.0-unstable.eb196ccd2f",
26
+ "@webiny/api": "0.0.0-unstable.f6dc066313",
27
+ "@webiny/api-headless-cms": "0.0.0-unstable.f6dc066313",
28
+ "@webiny/aws-sdk": "0.0.0-unstable.f6dc066313",
29
+ "@webiny/db-dynamodb": "0.0.0-unstable.f6dc066313",
30
+ "@webiny/error": "0.0.0-unstable.f6dc066313",
31
+ "@webiny/handler-db": "0.0.0-unstable.f6dc066313",
32
+ "@webiny/utils": "0.0.0-unstable.f6dc066313",
32
33
  "dataloader": "2.2.3",
33
34
  "dot-object": "2.1.5",
34
35
  "dot-prop": "6.0.1",
35
- "lodash": "4.17.21"
36
+ "lodash": "4.17.23"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@types/dot-object": "2.1.6",
39
40
  "@types/jsonpack": "1.1.6",
40
- "@webiny/plugins": "0.0.0-unstable.eb196ccd2f",
41
- "@webiny/project-utils": "0.0.0-unstable.eb196ccd2f",
42
- "jest": "29.7.0",
41
+ "@webiny/build-tools": "0.0.0-unstable.f6dc066313",
42
+ "@webiny/plugins": "0.0.0-unstable.f6dc066313",
43
+ "@webiny/project-utils": "0.0.0-unstable.f6dc066313",
43
44
  "jest-dynalite": "3.6.1",
44
- "typescript": "5.3.3"
45
+ "typescript": "5.9.3",
46
+ "vitest": "4.0.18"
45
47
  },
46
48
  "publishConfig": {
47
49
  "access": "public",
48
50
  "directory": "dist"
49
51
  },
50
- "scripts": {
51
- "build": "node ../cli/bin.js run build",
52
- "watch": "node ../cli/bin.js run watch"
53
- },
54
- "gitHead": "eb196ccd2f32296e10f7add6dd7220d4e3abece4"
52
+ "gitHead": "f6dc066313ddce5339d2aacec3aa84e61232689b"
55
53
  }
@@ -1,5 +1,5 @@
1
- import { Plugin } from "@webiny/plugins/Plugin";
2
- import type { CmsModelField } from "@webiny/api-headless-cms/types";
1
+ import { Plugin } from "@webiny/plugins/Plugin.js";
2
+ import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
3
3
  export interface CreatePathCallableParams {
4
4
  field: Partial<CmsModelField> & Pick<CmsModelField, "fieldId" | "storageId" | "id">;
5
5
  index?: number;
@@ -1,13 +1,6 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.CmsEntryFieldFilterPathPlugin = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _Plugin = require("@webiny/plugins/Plugin");
10
- class CmsEntryFieldFilterPathPlugin extends _Plugin.Plugin {
1
+ import WebinyError from "@webiny/error";
2
+ import { Plugin } from "@webiny/plugins/Plugin.js";
3
+ export class CmsEntryFieldFilterPathPlugin extends Plugin {
11
4
  static type = "cms-field-filter-path";
12
5
  get fieldType() {
13
6
  return this.config.fieldType;
@@ -40,9 +33,8 @@ class CmsEntryFieldFilterPathPlugin extends _Plugin.Plugin {
40
33
  } else if (typeof this.config.path === "string") {
41
34
  return this.config.path;
42
35
  }
43
- throw new _error.default(`Missing path in "${this.name}" plugin.`);
36
+ throw new WebinyError(`Missing path in "${this.name}" plugin.`);
44
37
  }
45
38
  }
46
- exports.CmsEntryFieldFilterPathPlugin = CmsEntryFieldFilterPathPlugin;
47
39
 
48
40
  //# sourceMappingURL=CmsEntryFieldFilterPathPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_Plugin","CmsEntryFieldFilterPathPlugin","Plugin","type","fieldType","config","constructor","name","canUse","field","parents","fieldId","Array","isArray","length","includes","createPath","params","path","WebinyError","exports"],"sources":["CmsEntryFieldFilterPathPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins/Plugin\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nexport interface CreatePathCallableParams {\n field: Partial<CmsModelField> & Pick<CmsModelField, \"fieldId\" | \"storageId\" | \"id\">;\n index?: number;\n}\nexport interface CreatePathCallable {\n (params: CreatePathCallableParams): string;\n}\nexport interface CmsEntryFieldFilterPathPluginParams {\n fieldType: string;\n fieldId?: string[];\n path: string | CreatePathCallable;\n canUse?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">, parents?: string[]) => boolean;\n}\nexport class CmsEntryFieldFilterPathPlugin extends Plugin {\n public static override readonly type: string = \"cms-field-filter-path\";\n\n private readonly config: CmsEntryFieldFilterPathPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public constructor(config: CmsEntryFieldFilterPathPluginParams) {\n super();\n\n this.config = config;\n\n /**\n * We expect error here because we know that `this.constructor.type` is defined, but TS does not.\n */\n // @ts-expect-error\n this.name = `${this.constructor.type}-${this.config.fieldType}`;\n }\n\n public canUse(field: Pick<CmsModelField, \"fieldId\" | \"type\">, parents: string[]): boolean {\n if (field.type !== this.config.fieldType) {\n return false;\n } else if (this.config.canUse) {\n return this.config.canUse(field, parents);\n }\n const fieldId = this.config.fieldId;\n if (!fieldId || Array.isArray(fieldId) === false || fieldId.length === 0) {\n return true;\n }\n return fieldId.includes(field.fieldId);\n }\n\n public createPath(params: CreatePathCallableParams): string {\n if (typeof this.config.path === \"function\") {\n return this.config.path(params);\n } else if (typeof this.config.path === \"string\") {\n return this.config.path;\n }\n throw new WebinyError(`Missing path in \"${this.name}\" plugin.`);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAgBO,MAAME,6BAA6B,SAASC,cAAM,CAAC;EACtD,OAAgCC,IAAI,GAAW,uBAAuB;EAItE,IAAWC,SAASA,CAAA,EAAW;IAC3B,OAAO,IAAI,CA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":[]}
1
+ {"version":3,"names":["WebinyError","Plugin","CmsEntryFieldFilterPathPlugin","type","fieldType","config","constructor","name","canUse","field","parents","fieldId","Array","isArray","length","includes","createPath","params","path"],"sources":["CmsEntryFieldFilterPathPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport interface CreatePathCallableParams {\n field: Partial<CmsModelField> & Pick<CmsModelField, \"fieldId\" | \"storageId\" | \"id\">;\n index?: number;\n}\nexport interface CreatePathCallable {\n (params: CreatePathCallableParams): string;\n}\nexport interface CmsEntryFieldFilterPathPluginParams {\n fieldType: string;\n fieldId?: string[];\n path: string | CreatePathCallable;\n canUse?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">, parents?: string[]) => boolean;\n}\nexport class CmsEntryFieldFilterPathPlugin extends Plugin {\n public static override readonly type: string = \"cms-field-filter-path\";\n\n private readonly config: CmsEntryFieldFilterPathPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public constructor(config: CmsEntryFieldFilterPathPluginParams) {\n super();\n\n this.config = config;\n\n /**\n * We expect error here because we know that `this.constructor.type` is defined, but TS does not.\n */\n // @ts-expect-error\n this.name = `${this.constructor.type}-${this.config.fieldType}`;\n }\n\n public canUse(field: Pick<CmsModelField, \"fieldId\" | \"type\">, parents: string[]): boolean {\n if (field.type !== this.config.fieldType) {\n return false;\n } else if (this.config.canUse) {\n return this.config.canUse(field, parents);\n }\n const fieldId = this.config.fieldId;\n if (!fieldId || Array.isArray(fieldId) === false || fieldId.length === 0) {\n return true;\n }\n return fieldId.includes(field.fieldId);\n }\n\n public createPath(params: CreatePathCallableParams): string {\n if (typeof this.config.path === \"function\") {\n return this.config.path(params);\n } else if (typeof this.config.path === \"string\") {\n return this.config.path;\n }\n throw new WebinyError(`Missing path in \"${this.name}\" plugin.`);\n }\n}\n"],"mappings":"AAAA,OAAOA,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,EAAE;MAC7C,OAAO,IAAI,CAACb,MAAM,CAACa,IAAI;IAC3B;IACA,MAAM,IAAIlB,WAAW,CAAC,oBAAoB,IAAI,CAACO,IAAI,WAAW,CAAC;EACnE;AACJ","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import { Plugin } from "@webiny/plugins";
2
- import type { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin";
3
- import type { Field } from "../operations/entry/filtering/types";
4
- import type { CmsFieldFilterValueTransformPlugin } from "../types";
2
+ import type { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin.js";
3
+ import type { Field } from "../operations/entry/filtering/types.js";
4
+ import type { CmsFieldFilterValueTransformPlugin } from "../types.js";
5
5
  /**
6
6
  * This plugin is used to create the filter.
7
7
  * Internally we have default one + the one for the reference field - because it is actually an object when filtering.
@@ -1,16 +1,11 @@
1
- "use strict";
1
+ import { Plugin } from "@webiny/plugins";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CmsEntryFieldFilterPlugin = void 0;
7
- var _plugins = require("@webiny/plugins");
8
3
  /**
9
4
  * This plugin is used to create the filter.
10
5
  * Internally we have default one + the one for the reference field - because it is actually an object when filtering.
11
6
  */
12
7
 
13
- class CmsEntryFieldFilterPlugin extends _plugins.Plugin {
8
+ export class CmsEntryFieldFilterPlugin extends Plugin {
14
9
  static type = "cms.dynamodb.entry.field.filter";
15
10
  static ALL = "*";
16
11
  constructor(config) {
@@ -22,6 +17,5 @@ class CmsEntryFieldFilterPlugin extends _plugins.Plugin {
22
17
  return this.config.create(params);
23
18
  }
24
19
  }
25
- exports.CmsEntryFieldFilterPlugin = CmsEntryFieldFilterPlugin;
26
20
 
27
21
  //# sourceMappingURL=CmsEntryFieldFilterPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","CmsEntryFieldFilterPlugin","Plugin","type","ALL","constructor","config","fieldType","create","params","exports"],"sources":["CmsEntryFieldFilterPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport type { Field } from \"~/operations/entry/filtering/types\";\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types\";\n\n/**\n * This plugin is used to create the filter.\n * Internally we have default one + the one for the reference field - because it is actually an object when filtering.\n */\n\ninterface CmsEntryFieldFilterPluginParams<T = any> {\n fieldType: string;\n create: (\n params: CmsEntryFieldFilterPluginCreateParams<T>\n ) => null | CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[];\n}\n\ninterface CmsEntryFieldFilterPluginCreateParams<T = any> {\n key: string;\n value: T;\n field: Field;\n fields: Record<string, Field>;\n operation: string;\n valueFilterPlugins: Record<string, ValueFilterPlugin>;\n transformValuePlugins: Record<string, CmsFieldFilterValueTransformPlugin>;\n getFilterCreatePlugin: (type: string) => CmsEntryFieldFilterPlugin;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport interface CmsEntryFieldFilterPluginCreateResponse {\n field: Field;\n path: string;\n fieldPathId: string;\n plugin: ValueFilterPlugin;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport class CmsEntryFieldFilterPlugin<T = any> extends Plugin {\n public static override readonly type: string = \"cms.dynamodb.entry.field.filter\";\n public static readonly ALL: string = \"*\";\n\n private readonly config: CmsEntryFieldFilterPluginParams<T>;\n\n public readonly fieldType: string;\n\n public constructor(config: CmsEntryFieldFilterPluginParams<T>) {\n super();\n this.config = config;\n this.fieldType = this.config.fieldType;\n }\n\n public create(params: CmsEntryFieldFilterPluginCreateParams<T>) {\n return this.config.create(params);\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAKA;AACA;AACA;AACA;;AAiCO,MAAMC,yBAAyB,SAAkBC,eAAM,CAAC;EAC3D,OAAgCC,IAAI,GAAW,iCAAiC;EAChF,OAAuBC,GAAG,GAAW,GAAG;EAMjCC,WAAWA,CAACC,MAA0C,EAAE;IAC3D,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,SAAS,GAAG,IAAI,CAACD,MAAM,CAACC,SAAS;EAC1C;EAEOC,MAAMA,CAACC,MAAgD,EAAE;IAC5D,OAAO,IAAI,CAACH,MAAM,CAACE,MAAM,CAACC,MAAM,CAAC;EACrC;AACJ;AAACC,OAAA,CAAAT,yBAAA,GAAAA,yBAAA","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","CmsEntryFieldFilterPlugin","type","ALL","constructor","config","fieldType","create","params"],"sources":["CmsEntryFieldFilterPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin.js\";\nimport type { Field } from \"~/operations/entry/filtering/types.js\";\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types.js\";\n\n/**\n * This plugin is used to create the filter.\n * Internally we have default one + the one for the reference field - because it is actually an object when filtering.\n */\n\ninterface CmsEntryFieldFilterPluginParams<T = any> {\n fieldType: string;\n create: (\n params: CmsEntryFieldFilterPluginCreateParams<T>\n ) => null | CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[];\n}\n\ninterface CmsEntryFieldFilterPluginCreateParams<T = any> {\n key: string;\n value: T;\n field: Field;\n fields: Record<string, Field>;\n operation: string;\n valueFilterPlugins: Record<string, ValueFilterPlugin>;\n transformValuePlugins: Record<string, CmsFieldFilterValueTransformPlugin>;\n getFilterCreatePlugin: (type: string) => CmsEntryFieldFilterPlugin;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport interface CmsEntryFieldFilterPluginCreateResponse {\n field: Field;\n path: string;\n fieldPathId: string;\n plugin: ValueFilterPlugin;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport class CmsEntryFieldFilterPlugin<T = any> extends Plugin {\n public static override readonly type: string = \"cms.dynamodb.entry.field.filter\";\n public static readonly ALL: string = \"*\";\n\n private readonly config: CmsEntryFieldFilterPluginParams<T>;\n\n public readonly fieldType: string;\n\n public constructor(config: CmsEntryFieldFilterPluginParams<T>) {\n super();\n this.config = config;\n this.fieldType = this.config.fieldType;\n }\n\n public create(params: CmsEntryFieldFilterPluginCreateParams<T>) {\n return this.config.create(params);\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;;AAKxC;AACA;AACA;AACA;;AAiCA,OAAO,MAAMC,yBAAyB,SAAkBD,MAAM,CAAC;EAC3D,OAAgCE,IAAI,GAAW,iCAAiC;EAChF,OAAuBC,GAAG,GAAW,GAAG;EAMjCC,WAAWA,CAACC,MAA0C,EAAE;IAC3D,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,SAAS,GAAG,IAAI,CAACD,MAAM,CAACC,SAAS;EAC1C;EAEOC,MAAMA,CAACC,MAAgD,EAAE;IAC5D,OAAO,IAAI,CAACH,MAAM,CAACE,MAAM,CAACC,MAAM,CAAC;EACrC;AACJ","ignoreList":[]}