@webiny/api-headless-cms-ddb 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7

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 (157) 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 +61 -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 +4 -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/transformValue/datetime.d.ts +1 -1
  27. package/dynamoDb/transformValue/datetime.js +5 -12
  28. package/dynamoDb/transformValue/datetime.js.map +1 -1
  29. package/index.d.ts +2 -3
  30. package/index.js +62 -92
  31. package/index.js.map +1 -1
  32. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -2
  33. package/operations/entry/dataLoader/DataLoaderCache.js +3 -13
  34. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  35. package/operations/entry/dataLoader/constants.js +1 -7
  36. package/operations/entry/dataLoader/constants.js.map +1 -1
  37. package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
  38. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  39. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  40. package/operations/entry/dataLoader/getAllEntryRevisions.js +16 -26
  41. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  42. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  43. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +27 -33
  44. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  45. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  46. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +27 -33
  47. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  48. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  49. package/operations/entry/dataLoader/getRevisionById.js +29 -35
  50. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  51. package/operations/entry/dataLoader/index.d.ts +3 -3
  52. package/operations/entry/dataLoader/index.js +10 -31
  53. package/operations/entry/dataLoader/index.js.map +1 -1
  54. package/operations/entry/dataLoader/types.d.ts +4 -4
  55. package/operations/entry/dataLoader/types.js +1 -5
  56. package/operations/entry/dataLoader/types.js.map +1 -1
  57. package/operations/entry/dataLoaders.d.ts +11 -12
  58. package/operations/entry/dataLoaders.js +16 -24
  59. package/operations/entry/dataLoaders.js.map +1 -1
  60. package/operations/entry/filtering/createExpressions.d.ts +7 -6
  61. package/operations/entry/filtering/createExpressions.js +29 -35
  62. package/operations/entry/filtering/createExpressions.js.map +1 -1
  63. package/operations/entry/filtering/createFields.d.ts +2 -2
  64. package/operations/entry/filtering/createFields.js +20 -22
  65. package/operations/entry/filtering/createFields.js.map +1 -1
  66. package/operations/entry/filtering/extractSort.d.ts +5 -5
  67. package/operations/entry/filtering/extractSort.js +38 -23
  68. package/operations/entry/filtering/extractSort.js.map +1 -1
  69. package/operations/entry/filtering/filter.d.ts +7 -6
  70. package/operations/entry/filtering/filter.js +22 -27
  71. package/operations/entry/filtering/filter.js.map +1 -1
  72. package/operations/entry/filtering/fullTextSearch.d.ts +4 -4
  73. package/operations/entry/filtering/fullTextSearch.js +7 -15
  74. package/operations/entry/filtering/fullTextSearch.js.map +1 -1
  75. package/operations/entry/filtering/getValue.js +1 -8
  76. package/operations/entry/filtering/getValue.js.map +1 -1
  77. package/operations/entry/filtering/index.d.ts +2 -2
  78. package/operations/entry/filtering/index.js +2 -19
  79. package/operations/entry/filtering/index.js.map +1 -1
  80. package/operations/entry/filtering/mapPlugins.d.ts +1 -1
  81. package/operations/entry/filtering/mapPlugins.js +3 -11
  82. package/operations/entry/filtering/mapPlugins.js.map +1 -1
  83. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +1 -1
  84. package/operations/entry/filtering/plugins/defaultFilterCreate.js +10 -18
  85. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
  86. package/operations/entry/filtering/plugins/index.d.ts +1 -1
  87. package/operations/entry/filtering/plugins/index.js +6 -13
  88. package/operations/entry/filtering/plugins/index.js.map +1 -1
  89. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +1 -1
  90. package/operations/entry/filtering/plugins/objectFilterCreate.js +15 -21
  91. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
  92. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +2 -2
  93. package/operations/entry/filtering/plugins/refFilterCreate.js +16 -22
  94. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
  95. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +1 -1
  96. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +14 -17
  97. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -1
  98. package/operations/entry/filtering/sort.d.ts +5 -5
  99. package/operations/entry/filtering/sort.js +15 -19
  100. package/operations/entry/filtering/sort.js.map +1 -1
  101. package/operations/entry/filtering/systemFields.d.ts +2 -4
  102. package/operations/entry/filtering/systemFields.js +70 -29
  103. package/operations/entry/filtering/systemFields.js.map +1 -1
  104. package/operations/entry/filtering/transform.d.ts +1 -1
  105. package/operations/entry/filtering/transform.js +1 -8
  106. package/operations/entry/filtering/transform.js.map +1 -1
  107. package/operations/entry/filtering/types.d.ts +4 -4
  108. package/operations/entry/filtering/types.js +1 -5
  109. package/operations/entry/filtering/types.js.map +1 -1
  110. package/operations/entry/filtering/values.d.ts +1 -1
  111. package/operations/entry/filtering/values.js +4 -12
  112. package/operations/entry/filtering/values.js.map +1 -1
  113. package/operations/entry/filtering/where.js +1 -8
  114. package/operations/entry/filtering/where.js.map +1 -1
  115. package/operations/entry/index.d.ts +4 -3
  116. package/operations/entry/index.js +279 -388
  117. package/operations/entry/index.js.map +1 -1
  118. package/operations/entry/keys.d.ts +40 -2
  119. package/operations/entry/keys.js +53 -30
  120. package/operations/entry/keys.js.map +1 -1
  121. package/operations/group/index.d.ts +4 -5
  122. package/operations/group/index.js +37 -69
  123. package/operations/group/index.js.map +1 -1
  124. package/operations/model/index.d.ts +3 -3
  125. package/operations/model/index.js +36 -59
  126. package/operations/model/index.js.map +1 -1
  127. package/package.json +24 -20
  128. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +2 -2
  129. package/plugins/CmsEntryFieldFilterPathPlugin.js +4 -12
  130. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  131. package/plugins/CmsEntryFieldFilterPlugin.d.ts +5 -5
  132. package/plugins/CmsEntryFieldFilterPlugin.js +2 -8
  133. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
  134. package/plugins/CmsEntryFieldSortingPlugin.d.ts +2 -2
  135. package/plugins/CmsEntryFieldSortingPlugin.js +3 -11
  136. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
  137. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +1 -1
  138. package/plugins/CmsFieldFilterValueTransformPlugin.js +2 -9
  139. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
  140. package/plugins/index.d.ts +4 -4
  141. package/plugins/index.js +4 -49
  142. package/plugins/index.js.map +1 -1
  143. package/types.d.ts +20 -20
  144. package/types.js +1 -8
  145. package/types.js.map +1 -1
  146. package/definitions/system.d.ts +0 -10
  147. package/definitions/system.js +0 -42
  148. package/definitions/system.js.map +0 -1
  149. package/dynamoDb/storage/longText.d.ts +0 -10
  150. package/dynamoDb/storage/longText.js +0 -94
  151. package/dynamoDb/storage/longText.js.map +0 -1
  152. package/dynamoDb/storage/richText.d.ts +0 -2
  153. package/dynamoDb/storage/richText.js +0 -61
  154. package/dynamoDb/storage/richText.js.map +0 -1
  155. package/operations/system/index.d.ts +0 -7
  156. package/operations/system/index.js +0 -94
  157. package/operations/system/index.js.map +0 -1
@@ -1,94 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createSystemStorageOperations = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _get = require("@webiny/db-dynamodb/utils/get");
10
- var _dbDynamodb = require("@webiny/db-dynamodb");
11
- const createPartitionKey = ({
12
- tenant
13
- }) => {
14
- return `T#${tenant.toLowerCase()}#SYSTEM`;
15
- };
16
- const createSortKey = () => {
17
- return "CMS";
18
- };
19
- const createKeys = params => {
20
- return {
21
- PK: createPartitionKey(params),
22
- SK: createSortKey()
23
- };
24
- };
25
- const createSystemStorageOperations = params => {
26
- const {
27
- entity
28
- } = params;
29
- const create = async ({
30
- system
31
- }) => {
32
- const keys = createKeys(system);
33
- try {
34
- await (0, _dbDynamodb.put)({
35
- entity,
36
- item: {
37
- ...system,
38
- ...keys
39
- }
40
- });
41
- return system;
42
- } catch (ex) {
43
- throw new _error.default(ex.message || "Could not create system.", ex.code || "CREATE_SYSTEM_ERROR", {
44
- error: ex,
45
- system,
46
- keys
47
- });
48
- }
49
- };
50
- const update = async params => {
51
- const {
52
- system
53
- } = params;
54
- const keys = createKeys(system);
55
- try {
56
- await (0, _dbDynamodb.put)({
57
- entity,
58
- item: {
59
- ...system,
60
- ...keys
61
- }
62
- });
63
- return system;
64
- } catch (ex) {
65
- throw new _error.default(ex.message || "Could not update system.", ex.code || "UPDATE_SYSTEM_ERROR", {
66
- error: ex,
67
- system,
68
- keys
69
- });
70
- }
71
- };
72
- const get = async params => {
73
- const keys = createKeys(params);
74
- try {
75
- return await (0, _get.getClean)({
76
- entity,
77
- keys
78
- });
79
- } catch (ex) {
80
- throw new _error.default(ex.message || "Could not get system.", ex.code || "GET_SYSTEM_ERROR", {
81
- error: ex,
82
- keys
83
- });
84
- }
85
- };
86
- return {
87
- create,
88
- update,
89
- get
90
- };
91
- };
92
- exports.createSystemStorageOperations = createSystemStorageOperations;
93
-
94
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_get","_dbDynamodb","createPartitionKey","tenant","toLowerCase","createSortKey","createKeys","params","PK","SK","createSystemStorageOperations","entity","create","system","keys","put","item","ex","WebinyError","message","code","error","update","get","getClean","exports"],"sources":["index.ts"],"sourcesContent":["import type {\n CmsSystem,\n CmsSystemStorageOperations,\n CmsSystemStorageOperationsCreateParams,\n CmsSystemStorageOperationsGetParams,\n CmsSystemStorageOperationsUpdateParams\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 { put } from \"@webiny/db-dynamodb\";\n\ninterface CreateSystemStorageOperationsParams {\n entity: Entity<any>;\n}\n\ninterface PartitionKeyParams {\n tenant: string;\n}\nconst createPartitionKey = ({ tenant }: PartitionKeyParams): string => {\n return `T#${tenant.toLowerCase()}#SYSTEM`;\n};\nconst createSortKey = (): string => {\n return \"CMS\";\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey()\n };\n};\n\nexport const createSystemStorageOperations = (\n params: CreateSystemStorageOperationsParams\n): CmsSystemStorageOperations => {\n const { entity } = params;\n\n const create = async ({ system }: CmsSystemStorageOperationsCreateParams) => {\n const keys = createKeys(system);\n try {\n await put({\n entity,\n item: {\n ...system,\n ...keys\n }\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create system.\",\n ex.code || \"CREATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const update = async (params: CmsSystemStorageOperationsUpdateParams) => {\n const { system } = params;\n\n const keys = createKeys(system);\n\n try {\n await put({\n entity,\n item: {\n ...system,\n ...keys\n }\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update system.\",\n ex.code || \"UPDATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsSystemStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n return await getClean<CmsSystem>({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get system.\",\n ex.code || \"GET_SYSTEM_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n return {\n create,\n update,\n get\n };\n};\n"],"mappings":";;;;;;;AAQA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,MAAMG,kBAAkB,GAAGA,CAAC;EAAEC;AAA2B,CAAC,KAAa;EACnE,OAAO,KAAKA,MAAM,CAACC,WAAW,CAAC,CAAC,SAAS;AAC7C,CAAC;AACD,MAAMC,aAAa,GAAGA,CAAA,KAAc;EAChC,OAAO,KAAK;AAChB,CAAC;AAMD,MAAMC,UAAU,GAAIC,MAA0B,IAAW;EACrD,OAAO;IACHC,EAAE,EAAEN,kBAAkB,CAACK,MAAM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