@webiny/api-headless-cms-ddb 0.0.0-unstable.bca7b3e350 → 0.0.0-unstable.c27f4d8a31

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 (169) hide show
  1. package/README.md +6 -20
  2. package/definitions/entry.d.ts +4 -5
  3. package/definitions/entry.js +6 -89
  4. package/definitions/entry.js.map +1 -1
  5. package/definitions/group.d.ts +4 -5
  6. package/definitions/group.js +6 -63
  7. package/definitions/group.js.map +1 -1
  8. package/definitions/model.d.ts +4 -5
  9. package/definitions/model.js +6 -90
  10. package/definitions/model.js.map +1 -1
  11. package/definitions/table.d.ts +4 -6
  12. package/definitions/table.js +7 -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 +8 -20
  19. package/dynamoDb/index.js.map +1 -1
  20. package/dynamoDb/path/locationFolderId.d.ts +2 -0
  21. package/dynamoDb/path/locationFolderId.js +34 -0
  22. package/dynamoDb/path/locationFolderId.js.map +1 -0
  23. package/dynamoDb/path/plainObject.d.ts +1 -1
  24. package/dynamoDb/path/plainObject.js +6 -20
  25. package/dynamoDb/path/plainObject.js.map +1 -1
  26. package/dynamoDb/storage/longText.js +13 -35
  27. package/dynamoDb/storage/longText.js.map +1 -1
  28. package/dynamoDb/storage/richText.js +27 -88
  29. package/dynamoDb/storage/richText.js.map +1 -1
  30. package/dynamoDb/transformValue/datetime.d.ts +1 -1
  31. package/dynamoDb/transformValue/datetime.js +7 -19
  32. package/dynamoDb/transformValue/datetime.js.map +1 -1
  33. package/index.d.ts +2 -2
  34. package/index.js +47 -111
  35. package/index.js.map +1 -1
  36. package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
  37. package/operations/entry/dataLoader/DataLoaderCache.js +31 -0
  38. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  39. package/operations/entry/dataLoader/constants.d.ts +1 -0
  40. package/operations/entry/dataLoader/constants.js +4 -0
  41. package/operations/entry/dataLoader/constants.js.map +1 -0
  42. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  43. package/operations/entry/dataLoader/createBatchScheduleFn.js +19 -0
  44. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  45. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  46. package/operations/entry/dataLoader/getAllEntryRevisions.js +35 -0
  47. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  48. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  49. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +50 -0
  50. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  51. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  52. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +50 -0
  53. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  54. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  55. package/operations/entry/dataLoader/getRevisionById.js +56 -0
  56. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  57. package/operations/entry/dataLoader/index.d.ts +8 -0
  58. package/operations/entry/dataLoader/index.js +19 -0
  59. package/operations/entry/dataLoader/index.js.map +1 -0
  60. package/operations/entry/dataLoader/types.d.ts +6 -0
  61. package/operations/entry/dataLoader/types.js +3 -0
  62. package/operations/entry/dataLoader/types.js.map +1 -0
  63. package/operations/entry/dataLoaders.d.ts +14 -30
  64. package/operations/entry/dataLoaders.js +58 -271
  65. package/operations/entry/dataLoaders.js.map +1 -1
  66. package/operations/entry/filtering/createExpressions.d.ts +5 -5
  67. package/operations/entry/filtering/createExpressions.js +30 -68
  68. package/operations/entry/filtering/createExpressions.js.map +1 -1
  69. package/operations/entry/filtering/createFields.d.ts +6 -4
  70. package/operations/entry/filtering/createFields.js +86 -103
  71. package/operations/entry/filtering/createFields.js.map +1 -1
  72. package/operations/entry/filtering/extractSort.d.ts +6 -6
  73. package/operations/entry/filtering/extractSort.js +39 -32
  74. package/operations/entry/filtering/extractSort.js.map +1 -1
  75. package/operations/entry/filtering/filter.d.ts +6 -6
  76. package/operations/entry/filtering/filter.js +36 -64
  77. package/operations/entry/filtering/filter.js.map +1 -1
  78. package/operations/entry/filtering/fullTextSearch.d.ts +3 -3
  79. package/operations/entry/filtering/fullTextSearch.js +6 -24
  80. package/operations/entry/filtering/fullTextSearch.js.map +1 -1
  81. package/operations/entry/filtering/getValue.js +5 -27
  82. package/operations/entry/filtering/getValue.js.map +1 -1
  83. package/operations/entry/filtering/index.d.ts +2 -2
  84. package/operations/entry/filtering/index.js +3 -20
  85. package/operations/entry/filtering/index.js.map +1 -1
  86. package/operations/entry/filtering/mapPlugins.d.ts +2 -2
  87. package/operations/entry/filtering/mapPlugins.js +4 -18
  88. package/operations/entry/filtering/mapPlugins.js.map +1 -1
  89. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -2
  90. package/operations/entry/filtering/plugins/defaultFilterCreate.js +9 -20
  91. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
  92. package/operations/entry/filtering/plugins/index.d.ts +1 -1
  93. package/operations/entry/filtering/plugins/index.js +7 -16
  94. package/operations/entry/filtering/plugins/index.js.map +1 -1
  95. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -2
  96. package/operations/entry/filtering/plugins/objectFilterCreate.js +16 -39
  97. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
  98. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +3 -2
  99. package/operations/entry/filtering/plugins/refFilterCreate.js +21 -36
  100. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
  101. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
  102. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +57 -0
  103. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
  104. package/operations/entry/filtering/sort.d.ts +6 -6
  105. package/operations/entry/filtering/sort.js +17 -34
  106. package/operations/entry/filtering/sort.js.map +1 -1
  107. package/operations/entry/filtering/systemFields.d.ts +2 -4
  108. package/operations/entry/filtering/systemFields.js +102 -43
  109. package/operations/entry/filtering/systemFields.js.map +1 -1
  110. package/operations/entry/filtering/transform.d.ts +1 -1
  111. package/operations/entry/filtering/transform.js +2 -10
  112. package/operations/entry/filtering/transform.js.map +1 -1
  113. package/operations/entry/filtering/types.d.ts +3 -3
  114. package/operations/entry/filtering/types.js +2 -4
  115. package/operations/entry/filtering/types.js.map +1 -1
  116. package/operations/entry/filtering/values.d.ts +1 -1
  117. package/operations/entry/filtering/values.js +5 -17
  118. package/operations/entry/filtering/values.js.map +1 -1
  119. package/operations/entry/filtering/where.js +5 -15
  120. package/operations/entry/filtering/where.js.map +1 -1
  121. package/operations/entry/index.d.ts +3 -4
  122. package/operations/entry/index.js +732 -410
  123. package/operations/entry/index.js.map +1 -1
  124. package/operations/entry/keys.d.ts +40 -2
  125. package/operations/entry/keys.js +54 -47
  126. package/operations/entry/keys.js.map +1 -1
  127. package/operations/group/index.d.ts +4 -4
  128. package/operations/group/index.js +44 -91
  129. package/operations/group/index.js.map +1 -1
  130. package/operations/model/index.d.ts +3 -3
  131. package/operations/model/index.js +36 -70
  132. package/operations/model/index.js.map +1 -1
  133. package/package.json +22 -29
  134. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +4 -3
  135. package/plugins/CmsEntryFieldFilterPathPlugin.js +14 -29
  136. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  137. package/plugins/CmsEntryFieldFilterPlugin.d.ts +10 -10
  138. package/plugins/CmsEntryFieldFilterPlugin.js +9 -19
  139. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
  140. package/plugins/CmsEntryFieldSortingPlugin.d.ts +2 -2
  141. package/plugins/CmsEntryFieldSortingPlugin.js +5 -24
  142. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
  143. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
  144. package/plugins/CmsFieldFilterValueTransformPlugin.js +16 -0
  145. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
  146. package/plugins/index.d.ts +4 -3
  147. package/plugins/index.js +5 -43
  148. package/plugins/index.js.map +1 -1
  149. package/types.d.ts +24 -19
  150. package/types.js +5 -13
  151. package/types.js.map +1 -1
  152. package/definitions/settings.d.ts +0 -9
  153. package/definitions/settings.js +0 -58
  154. package/definitions/settings.js.map +0 -1
  155. package/definitions/system.d.ts +0 -9
  156. package/definitions/system.js +0 -46
  157. package/definitions/system.js.map +0 -1
  158. package/dynamoDb/storage/date.d.ts +0 -3
  159. package/dynamoDb/storage/date.js +0 -109
  160. package/dynamoDb/storage/date.js.map +0 -1
  161. package/operations/entry/systemFields.d.ts +0 -2
  162. package/operations/entry/systemFields.js +0 -74
  163. package/operations/entry/systemFields.js.map +0 -1
  164. package/operations/settings/index.d.ts +0 -7
  165. package/operations/settings/index.js +0 -135
  166. package/operations/settings/index.js.map +0 -1
  167. package/operations/system/index.d.ts +0 -7
  168. package/operations/system/index.js +0 -99
  169. package/operations/system/index.js.map +0 -1
package/index.js CHANGED
@@ -1,156 +1,92 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- var _exportNames = {
9
- createStorageOperations: true
10
- };
11
- exports.createStorageOperations = void 0;
12
-
13
- var _filters = _interopRequireDefault(require("@webiny/db-dynamodb/plugins/filters"));
14
-
15
- var _dynamoDb = _interopRequireDefault(require("./dynamoDb"));
16
-
17
- var _types = require("./types");
18
-
19
- var _table = require("./definitions/table");
20
-
21
- var _settings = require("./definitions/settings");
22
-
23
- var _system = require("./definitions/system");
24
-
25
- var _group = require("./definitions/group");
26
-
27
- var _model = require("./definitions/model");
28
-
29
- var _entry = require("./definitions/entry");
30
-
31
- var _plugins = require("@webiny/plugins");
32
-
33
- var _system2 = require("./operations/system");
34
-
35
- var _settings2 = require("./operations/settings");
36
-
37
- var _group2 = require("./operations/group");
38
-
39
- var _model2 = require("./operations/model");
40
-
41
- var _entry2 = require("./operations/entry");
42
-
43
- var _plugins2 = require("./operations/entry/filtering/plugins");
44
-
45
- var _plugins3 = require("./plugins");
46
-
47
- Object.keys(_plugins3).forEach(function (key) {
48
- if (key === "default" || key === "__esModule") return;
49
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
50
- if (key in exports && exports[key] === _plugins3[key]) return;
51
- Object.defineProperty(exports, key, {
52
- enumerable: true,
53
- get: function () {
54
- return _plugins3[key];
55
- }
56
- });
57
- });
58
-
59
- const createStorageOperations = params => {
1
+ import dynamoDbValueFilters from "@webiny/db-dynamodb/plugins/filters/index.js";
2
+ import dynamoDbPlugins from "./dynamoDb/index.js";
3
+ import { ENTITIES } from "./types.js";
4
+ import { createGroupEntity } from "./definitions/group.js";
5
+ import { createModelEntity } from "./definitions/model.js";
6
+ import { createEntryEntity } from "./definitions/entry.js";
7
+ import { PluginsContainer } from "@webiny/plugins";
8
+ import { createGroupsStorageOperations } from "./operations/group/index.js";
9
+ import { createModelsStorageOperations } from "./operations/model/index.js";
10
+ import { createEntriesStorageOperations } from "./operations/entry/index.js";
11
+ import { createFilterCreatePlugins } from "./operations/entry/filtering/plugins/index.js";
12
+ import { CmsEntryFieldFilterPathPlugin, CmsEntryFieldFilterPlugin, CmsEntryFieldSortingPlugin, CmsFieldFilterValueTransformPlugin } from "./plugins/index.js";
13
+ import { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin.js";
14
+ import { StorageOperationsCmsModelPlugin, StorageTransformPlugin } from "@webiny/api-headless-cms";
15
+ import { CompressorPlugin } from "@webiny/api";
16
+ import { createTable } from "./definitions/table.js";
17
+ export * from "./plugins/index.js";
18
+ export const createStorageOperations = params => {
60
19
  const {
61
- attributes,
62
20
  table,
63
21
  documentClient,
64
22
  plugins: userPlugins
65
23
  } = params;
66
- const tableInstance = (0, _table.createTable)({
67
- table,
24
+ const tableInstance = createTable({
25
+ name: table,
68
26
  documentClient
69
27
  });
70
28
  const entities = {
71
- settings: (0, _settings.createSettingsEntity)({
72
- entityName: _types.ENTITIES.SETTINGS,
73
- table: tableInstance,
74
- attributes: attributes ? attributes[_types.ENTITIES.SETTINGS] : {}
29
+ groups: createGroupEntity({
30
+ entityName: ENTITIES.GROUPS,
31
+ table: tableInstance
75
32
  }),
76
- system: (0, _system.createSystemEntity)({
77
- entityName: _types.ENTITIES.SYSTEM,
78
- table: tableInstance,
79
- attributes: attributes ? attributes[_types.ENTITIES.SYSTEM] : {}
33
+ models: createModelEntity({
34
+ entityName: ENTITIES.MODELS,
35
+ table: tableInstance
80
36
  }),
81
- groups: (0, _group.createGroupEntity)({
82
- entityName: _types.ENTITIES.GROUPS,
83
- table: tableInstance,
84
- attributes: attributes ? attributes[_types.ENTITIES.GROUPS] : {}
85
- }),
86
- models: (0, _model.createModelEntity)({
87
- entityName: _types.ENTITIES.MODELS,
88
- table: tableInstance,
89
- attributes: attributes ? attributes[_types.ENTITIES.MODELS] : {}
90
- }),
91
- entries: (0, _entry.createEntryEntity)({
92
- entityName: _types.ENTITIES.ENTRIES,
93
- table: tableInstance,
94
- attributes: attributes ? attributes[_types.ENTITIES.ENTRIES] : {}
37
+ entries: createEntryEntity({
38
+ entityName: ENTITIES.ENTRIES,
39
+ table: tableInstance
95
40
  })
96
41
  };
97
- const plugins = new _plugins.PluginsContainer([
42
+ const plugins = new PluginsContainer([
98
43
  /**
99
44
  * DynamoDB filter plugins for the where conditions.
100
45
  */
101
- (0, _filters.default)(),
46
+ dynamoDbValueFilters(),
102
47
  /**
103
48
  * Field plugins for DynamoDB.
104
49
  */
105
- (0, _dynamoDb.default)(),
50
+ dynamoDbPlugins(),
106
51
  /**
107
52
  * Filter create plugins.
108
53
  */
109
- (0, _plugins2.createFilterCreatePlugins)(),
54
+ createFilterCreatePlugins(),
110
55
  /**
111
56
  * User defined custom plugins.
112
57
  */
113
58
  ...(userPlugins || [])]);
59
+ const entries = createEntriesStorageOperations({
60
+ entity: entities.entries,
61
+ plugins
62
+ });
114
63
  return {
115
64
  name: "dynamodb",
116
65
  beforeInit: async context => {
66
+ const types = ["cms-model-field-to-graphql", CmsEntryFieldFilterPathPlugin.type, CmsFieldFilterValueTransformPlugin.type, CmsEntryFieldFilterPlugin.type, CmsEntryFieldSortingPlugin.type, ValueFilterPlugin.type, StorageOperationsCmsModelPlugin.type, StorageTransformPlugin.type, CompressorPlugin.type];
117
67
  /**
118
68
  * Collect all required plugins from parent context.
119
69
  */
120
- const fieldPlugins = context.plugins.byType("cms-model-field-to-graphql");
121
- plugins.register(fieldPlugins);
122
- const filterPathPlugins = context.plugins.byType(_plugins3.CmsEntryFieldFilterPathPlugin.type);
123
- plugins.register(filterPathPlugins);
124
- const filterPlugins = context.plugins.byType(_plugins3.CmsEntryFieldFilterPlugin.type);
125
- plugins.register(filterPlugins);
126
- const sortingPlugins = context.plugins.byType(_plugins3.CmsEntryFieldSortingPlugin.type);
127
- plugins.register(sortingPlugins);
70
+ for (const type of types) {
71
+ plugins.mergeByType(context.plugins, type);
72
+ }
128
73
  /**
129
74
  * Pass the plugins to the parent context.
130
75
  */
131
-
132
- context.plugins.register([(0, _dynamoDb.default)()]);
76
+ context.plugins.register([dynamoDbPlugins()]);
77
+ entries.dataLoaders.clearAll();
133
78
  },
134
79
  getEntities: () => entities,
135
80
  getTable: () => tableInstance,
136
- system: (0, _system2.createSystemStorageOperations)({
137
- entity: entities.system
138
- }),
139
- settings: (0, _settings2.createSettingsStorageOperations)({
140
- entity: entities.settings
141
- }),
142
- groups: (0, _group2.createGroupsStorageOperations)({
81
+ groups: createGroupsStorageOperations({
143
82
  entity: entities.groups,
144
83
  plugins
145
84
  }),
146
- models: (0, _model2.createModelsStorageOperations)({
85
+ models: createModelsStorageOperations({
147
86
  entity: entities.models
148
87
  }),
149
- entries: (0, _entry2.createEntriesStorageOperations)({
150
- entity: entities.entries,
151
- plugins
152
- })
88
+ entries
153
89
  };
154
90
  };
155
91
 
156
- exports.createStorageOperations = createStorageOperations;
92
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createStorageOperations","params","attributes","table","documentClient","plugins","userPlugins","tableInstance","createTable","entities","settings","createSettingsEntity","entityName","ENTITIES","SETTINGS","system","createSystemEntity","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","PluginsContainer","dynamoDbValueFilters","dynamoDbPlugins","createFilterCreatePlugins","name","beforeInit","context","fieldPlugins","byType","register","filterPathPlugins","CmsEntryFieldFilterPathPlugin","type","filterPlugins","CmsEntryFieldFilterPlugin","sortingPlugins","CmsEntryFieldSortingPlugin","getEntities","getTable","createSystemStorageOperations","entity","createSettingsStorageOperations","createGroupsStorageOperations","createModelsStorageOperations","createEntriesStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport dynamoDbPlugins from \"./dynamoDb\";\nimport { ENTITIES, StorageOperationsFactory } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createGroupEntity } from \"~/definitions/group\";\nimport { createModelEntity } from \"~/definitions/model\";\nimport { createEntryEntity } from \"~/definitions/entry\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\nimport { createGroupsStorageOperations } from \"~/operations/group\";\nimport { createModelsStorageOperations } from \"~/operations/model\";\nimport { createEntriesStorageOperations } from \"./operations/entry\";\nimport { CmsModelFieldToGraphQLPlugin } from \"@webiny/api-headless-cms/types\";\n\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins\";\nimport {\n CmsEntryFieldFilterPathPlugin,\n CmsEntryFieldFilterPlugin,\n CmsEntryFieldSortingPlugin\n} from \"~/plugins\";\n\nexport * from \"./plugins\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const { attributes, table, documentClient, plugins: userPlugins } = params;\n\n const tableInstance = createTable({\n table,\n documentClient\n });\n\n const entities = {\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.GROUPS] : {}\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.MODELS] : {}\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.ENTRIES] : {}\n })\n };\n\n const plugins = new PluginsContainer([\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins(),\n /**\n * User defined custom plugins.\n */\n ...(userPlugins || [])\n ]);\n\n return {\n name: \"dynamodb\",\n beforeInit: async context => {\n /**\n * Collect all required plugins from parent context.\n */\n const fieldPlugins = context.plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n plugins.register(fieldPlugins);\n\n const filterPathPlugins = context.plugins.byType<CmsEntryFieldFilterPathPlugin>(\n CmsEntryFieldFilterPathPlugin.type\n );\n plugins.register(filterPathPlugins);\n\n const filterPlugins = context.plugins.byType<CmsEntryFieldFilterPlugin>(\n CmsEntryFieldFilterPlugin.type\n );\n plugins.register(filterPlugins);\n\n const sortingPlugins = context.plugins.byType<CmsEntryFieldSortingPlugin>(\n CmsEntryFieldSortingPlugin.type\n );\n plugins.register(sortingPlugins);\n /**\n * Pass the plugins to the parent context.\n */\n context.plugins.register([dynamoDbPlugins()]);\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n system: createSystemStorageOperations({\n entity: entities.system\n }),\n settings: createSettingsStorageOperations({\n entity: entities.settings\n }),\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries: createEntriesStorageOperations({\n entity: entities.entries,\n plugins\n })\n };\n};\n"],"mappings":";;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;AAMA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEO,MAAMA,uBAAiD,GAAGC,MAAM,IAAI;EACvE,MAAM;IAAEC,UAAF;IAAcC,KAAd;IAAqBC,cAArB;IAAqCC,OAAO,EAAEC;EAA9C,IAA8DL,MAApE;EAEA,MAAMM,aAAa,GAAG,IAAAC,kBAAA,EAAY;IAC9BL,KAD8B;IAE9BC;EAF8B,CAAZ,CAAtB;EAKA,MAAMK,QAAQ,GAAG;IACbC,QAAQ,EAAE,IAAAC,8BAAA,EAAqB;MAC3BC,UAAU,EAAEC,eAAA,CAASC,QADM;MAE3BX,KAAK,EAAEI,aAFoB;MAG3BL,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACW,eAAA,CAASC,QAAV,CAAb,GAAmC;IAH9B,CAArB,CADG;IAMbC,MAAM,EAAE,IAAAC,0BAAA,EAAmB;MACvBJ,UAAU,EAAEC,eAAA,CAASI,MADE;MAEvBd,KAAK,EAAEI,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ity","PluginsContainer","createGroupsStorageOperations","createModelsStorageOperations","createEntriesStorageOperations","createFilterCreatePlugins","CmsEntryFieldFilterPathPlugin","CmsEntryFieldFilterPlugin","CmsEntryFieldSortingPlugin","CmsFieldFilterValueTransformPlugin","ValueFilterPlugin","StorageOperationsCmsModelPlugin","StorageTransformPlugin","CompressorPlugin","createTable","createStorageOperations","params","table","documentClient","plugins","userPlugins","tableInstance","name","entities","groups","entityName","GROUPS","models","MODELS","entries","ENTRIES","entity","beforeInit","context","types","type","mergeByType","register","dataLoaders","clearAll","getEntities","getTable"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters/index.js\";\nimport dynamoDbPlugins from \"./dynamoDb/index.js\";\nimport type { StorageOperationsFactory } from \"~/types.js\";\nimport { ENTITIES } from \"~/types.js\";\nimport { createGroupEntity } from \"~/definitions/group.js\";\nimport { createModelEntity } from \"~/definitions/model.js\";\nimport { createEntryEntity } from \"~/definitions/entry.js\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createGroupsStorageOperations } from \"~/operations/group/index.js\";\nimport { createModelsStorageOperations } from \"~/operations/model/index.js\";\nimport { createEntriesStorageOperations } from \"./operations/entry/index.js\";\n\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins/index.js\";\nimport {\n CmsEntryFieldFilterPathPlugin,\n CmsEntryFieldFilterPlugin,\n CmsEntryFieldSortingPlugin,\n CmsFieldFilterValueTransformPlugin\n} from \"~/plugins/index.js\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin.js\";\nimport { StorageOperationsCmsModelPlugin, StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CompressorPlugin } from \"@webiny/api\";\nimport { createTable } from \"~/definitions/table.js\";\n\nexport * from \"./plugins/index.js\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const { table, documentClient, plugins: userPlugins } = params;\n\n const tableInstance = createTable({\n name: table,\n documentClient\n });\n\n const entities = {\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance\n })\n };\n\n const plugins = new PluginsContainer([\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins(),\n /**\n * User defined custom plugins.\n */\n ...(userPlugins || [])\n ]);\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n plugins\n });\n\n return {\n name: \"dynamodb\",\n beforeInit: async context => {\n const types: string[] = [\n \"cms-model-field-to-graphql\",\n CmsEntryFieldFilterPathPlugin.type,\n CmsFieldFilterValueTransformPlugin.type,\n CmsEntryFieldFilterPlugin.type,\n CmsEntryFieldSortingPlugin.type,\n ValueFilterPlugin.type,\n StorageOperationsCmsModelPlugin.type,\n StorageTransformPlugin.type,\n CompressorPlugin.type\n ];\n /**\n * Collect all required plugins from parent context.\n */\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n /**\n * Pass the plugins to the parent context.\n */\n context.plugins.register([dynamoDbPlugins()]);\n\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries\n };\n};\n"],"mappings":"AAAA,OAAOA,oBAAoB,MAAM,8CAA8C;AAC/E,OAAOC,eAAe;AAEtB,SAASC,QAAQ;AACjB,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,6BAA6B;AACtC,SAASC,6BAA6B;AACtC,SAASC,8BAA8B;AAEvC,SAASC,yBAA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,MAAMC,OAAO,IAAI;MACzB,MAAMC,KAAe,GAAG,CACpB,4BAA4B,EAC5B5B,6BAA6B,CAAC6B,IAAI,EAClC1B,kCAAkC,CAAC0B,IAAI,EACvC5B,yBAAyB,CAAC4B,IAAI,EAC9B3B,0BAA0B,CAAC2B,IAAI,EAC/BzB,iBAAiB,CAACyB,IAAI,EACtBxB,+BAA+B,CAACwB,IAAI,EACpCvB,sBAAsB,CAACuB,IAAI,EAC3BtB,gBAAgB,CAACsB,IAAI,CACxB;MACD;AACZ;AACA;MACY,KAAK,MAAMA,IAAI,IAAID,KAAK,EAAE;QACtBf,OAAO,CAACiB,WAAW,CAACH,OAAO,CAACd,OAAO,EAAEgB,IAAI,CAAC;MAC9C;MACA;AACZ;AACA;MACYF,OAAO,CAACd,OAAO,CAACkB,QAAQ,CAAC,CAACzC,eAAe,CAAC,CAAC,CAAC,CAAC;MAE7CiC,OAAO,CAACS,WAAW,CAACC,QAAQ,CAAC,CAAC;IAClC,CAAC;IACDC,WAAW,EAAEA,CAAA,KAAMjB,QAAQ;IAC3BkB,QAAQ,EAAEA,CAAA,KAAMpB,aAAa;IAC7BG,MAAM,EAAEtB,6BAA6B,CAAC;MAClC6B,MAAM,EAAER,QAAQ,CAACC,MAAM;MACvBL;IACJ,CAAC,CAAC;IACFQ,MAAM,EAAExB,6BAA6B,CAAC;MAClC4B,MAAM,EAAER,QAAQ,CAACI;IACrB,CAAC,CAAC;IACFE;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ import type DataLoader from "dataloader";
2
+ export interface CacheKeyParams {
3
+ name: string;
4
+ tenant: string;
5
+ modelId: string;
6
+ }
7
+ export interface ClearAllParams {
8
+ tenant: string;
9
+ }
10
+ export declare class DataLoaderCache {
11
+ private readonly cache;
12
+ getDataLoader<I = any, R = any>(params: CacheKeyParams): DataLoader<I, R> | null;
13
+ setDataLoader(params: CacheKeyParams, dataLoader: DataLoader<any, any>): void;
14
+ clearAll(params?: ClearAllParams): void;
15
+ private createKey;
16
+ }
@@ -0,0 +1,31 @@
1
+ export class DataLoaderCache {
2
+ cache = {};
3
+ getDataLoader(params) {
4
+ const key = this.createKey(params);
5
+ return this.cache[key] || null;
6
+ }
7
+ setDataLoader(params, dataLoader) {
8
+ const key = this.createKey(params);
9
+ this.cache[key] = dataLoader;
10
+ }
11
+ clearAll(params) {
12
+ if (!params) {
13
+ for (const current in this.cache) {
14
+ this.cache[current].clearAll();
15
+ }
16
+ return;
17
+ }
18
+ const key = `${params.tenant}_`;
19
+ for (const current in this.cache) {
20
+ if (current.startsWith(key) === false) {
21
+ continue;
22
+ }
23
+ this.cache[current].clearAll();
24
+ }
25
+ }
26
+ createKey(params) {
27
+ return `${params.tenant}_${params.modelId}_${params.name}`;
28
+ }
29
+ }
30
+
31
+ //# sourceMappingURL=DataLoaderCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DataLoaderCache","cache","getDataLoader","params","key","createKey","setDataLoader","dataLoader","clearAll","current","tenant","startsWith","modelId","name"],"sources":["DataLoaderCache.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\n\nexport interface CacheKeyParams {\n name: string;\n tenant: string;\n modelId: string;\n}\n\nexport interface ClearAllParams {\n tenant: string;\n}\n\nexport class DataLoaderCache {\n private readonly cache: Record<string, DataLoader<any, any>> = {};\n\n public getDataLoader<I = any, R = any>(params: CacheKeyParams): DataLoader<I, R> | null {\n const key = this.createKey(params);\n\n return this.cache[key] || null;\n }\n\n public setDataLoader(params: CacheKeyParams, dataLoader: DataLoader<any, any>): void {\n const key = this.createKey(params);\n this.cache[key] = dataLoader;\n }\n\n public clearAll(params?: ClearAllParams): void {\n if (!params) {\n for (const current in this.cache) {\n this.cache[current].clearAll();\n }\n return;\n }\n const key = `${params.tenant}_`;\n for (const current in this.cache) {\n if (current.startsWith(key) === false) {\n continue;\n }\n this.cache[current].clearAll();\n }\n }\n\n private createKey(params: CacheKeyParams): string {\n return `${params.tenant}_${params.modelId}_${params.name}`;\n }\n}\n"],"mappings":"AAYA,OAAO,MAAMA,eAAe,CAAC;EACRC,KAAK,GAAyC,CAAC,CAAC;EAE1DC,aAAaA,CAAmBC,MAAsB,EAA2B;IACpF,MAAMC,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAElC,OAAO,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,IAAI,IAAI;EAClC;EAEOE,aAAaA,CAACH,MAAsB,EAAEI,UAAgC,EAAQ;IACjF,MAAMH,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAClC,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,GAAGG,UAAU;EAChC;EAEOC,QAAQA,CAACL,MAAuB,EAAQ;IAC3C,IAAI,CAACA,MAAM,EAAE;MACT,KAAK,MAAMM,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;QAC9B,IAAI,CAACA,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;MAClC;MACA;IACJ;IACA,MAAMJ,GAAG,GAAG,GAAGD,MAAM,CAACO,MAAM,GAAG;IAC/B,KAAK,MAAMD,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;MAC9B,IAAIQ,OAAO,CAACE,UAAU,CAACP,GAAG,CAAC,KAAK,KAAK,EAAE;QACnC;MACJ;MACA,IAAI,CAACH,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;IAClC;EACJ;EAEQH,SAASA,CAACF,MAAsB,EAAU;IAC9C,OAAO,GAAGA,MAAM,CAACO,MAAM,IAAIP,MAAM,CAACS,OAAO,IAAIT,MAAM,CAACU,IAAI,EAAE;EAC9D;AACJ","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const CMS_ENTRY_BATCH_SCHEDULE_WAIT: number;
@@ -0,0 +1,4 @@
1
+ const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || "0");
2
+ export const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;
3
+
4
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["batchScheduleWaitEnv","Number","process","env","WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT","CMS_ENTRY_BATCH_SCHEDULE_WAIT","isNaN"],"sources":["constants.ts"],"sourcesContent":["const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || \"0\");\nexport const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;\n"],"mappings":"AAAA,MAAMA,oBAAoB,GAAGC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,wCAAwC,IAAI,GAAG,CAAC;AAChG,OAAO,MAAMC,6BAA6B,GAAGC,KAAK,CAACN,oBAAoB,CAAC,GAAG,CAAC,GAAGA,oBAAoB","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.
3
+ * Intended to be used internally or for a specific user case.
4
+ * Not to be documented and exposed to publish as it can slow the data loading a lot.
5
+ *
6
+ * https://github.com/graphql/dataloader#batch-scheduling
7
+ */
8
+ export declare const createBatchScheduleFn: () => ((callback: () => void) => void) | undefined;
@@ -0,0 +1,19 @@
1
+ import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from "./constants.js";
2
+
3
+ /**
4
+ * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.
5
+ * Intended to be used internally or for a specific user case.
6
+ * Not to be documented and exposed to publish as it can slow the data loading a lot.
7
+ *
8
+ * https://github.com/graphql/dataloader#batch-scheduling
9
+ */
10
+ export const createBatchScheduleFn = () => {
11
+ if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {
12
+ return undefined;
13
+ }
14
+ return callback => {
15
+ setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);
16
+ };
17
+ };
18
+
19
+ //# sourceMappingURL=createBatchScheduleFn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CMS_ENTRY_BATCH_SCHEDULE_WAIT","createBatchScheduleFn","undefined","callback","setTimeout"],"sources":["createBatchScheduleFn.ts"],"sourcesContent":["import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from \"./constants.js\";\n\n/**\n * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.\n * Intended to be used internally or for a specific user case.\n * Not to be documented and exposed to publish as it can slow the data loading a lot.\n *\n * https://github.com/graphql/dataloader#batch-scheduling\n */\nexport const createBatchScheduleFn = () => {\n if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {\n return undefined;\n }\n return (callback: () => void) => {\n setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);\n };\n};\n"],"mappings":"AAAA,SAASA,6BAA6B;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,IAAID,6BAA6B,IAAI,CAAC,EAAE;IACpC,OAAOE,SAAS;EACpB;EACA,OAAQC,QAAoB,IAAK;IAC7BC,UAAU,CAACD,QAAQ,EAAEH,6BAA6B,CAAC;EACvD,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import DataLoader from "dataloader";
2
+ import type { CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
3
+ import type { IDataLoaderParams } from "./types.js";
4
+ export declare const createGetAllEntryRevisions: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
@@ -0,0 +1,35 @@
1
+ import DataLoader from "dataloader";
2
+ import { createPartitionKey } from "../keys.js";
3
+ import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
4
+ export const createGetAllEntryRevisions = params => {
5
+ const {
6
+ entity,
7
+ tenant,
8
+ modelId
9
+ } = params;
10
+ return new DataLoader(async ids => {
11
+ const results = {};
12
+ for (const id of ids) {
13
+ results[id] = (await entity.queryAllClean({
14
+ partitionKey: createPartitionKey({
15
+ tenant,
16
+ id
17
+ }),
18
+ options: {
19
+ beginsWith: "REV#"
20
+ }
21
+ })).map(result => {
22
+ return result.data;
23
+ });
24
+ }
25
+ return ids.map(id => {
26
+ return (results[id] || []).filter(item => {
27
+ return item.modelId === modelId;
28
+ });
29
+ });
30
+ }, {
31
+ batchScheduleFn: createBatchScheduleFn()
32
+ });
33
+ };
34
+
35
+ //# sourceMappingURL=getAllEntryRevisions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DataLoader","createPartitionKey","createBatchScheduleFn","createGetAllEntryRevisions","params","entity","tenant","modelId","ids","results","id","queryAllClean","partitionKey","options","beginsWith","map","result","data","filter","item","batchScheduleFn"],"sources":["getAllEntryRevisions.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createPartitionKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\n\nexport const createGetAllEntryRevisions = (params: IDataLoaderParams) => {\n const { entity, tenant, modelId } = params;\n return new DataLoader<string, CmsStorageEntry[]>(\n async ids => {\n const results: Record<string, CmsStorageEntry[]> = {};\n\n for (const id of ids) {\n results[id] = (\n await entity.queryAllClean({\n partitionKey: createPartitionKey({\n tenant,\n id\n }),\n options: {\n beginsWith: \"REV#\"\n }\n })\n ).map(result => {\n return result.data;\n });\n }\n\n return ids.map(id => {\n return (results[id] || []).filter(item => {\n return item.modelId === modelId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AAEnC,SAASC,kBAAkB;AAE3B,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,0BAA0B,GAAIC,MAAyB,IAAK;EACrE,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAC1C,OAAO,IAAIJ,UAAU,CACjB,MAAMQ,GAAG,IAAI;IACT,MAAMC,OAA0C,GAAG,CAAC,CAAC;IAErD,KAAK,MAAMC,EAAE,IAAIF,GAAG,EAAE;MAClBC,OAAO,CAACC,EAAE,CAAC,GAAG,CACV,MAAML,MAAM,CAACM,aAAa,CAAC;QACvBC,YAAY,EAAEX,kBAAkB,CAAC;UAC7BK,MAAM;UACNI;QACJ,CAAC,CAAC;QACFG,OAAO,EAAE;UACLC,UAAU,EAAE;QAChB;MACJ,CAAC,CAAC,EACJC,GAAG,CAACC,MAAM,IAAI;QACZ,OAAOA,MAAM,CAACC,IAAI;MACtB,CAAC,CAAC;IACN;IAEA,OAAOT,GAAG,CAACO,GAAG,CAACL,EAAE,IAAI;MACjB,OAAO,CAACD,OAAO,CAACC,EAAE,CAAC,IAAI,EAAE,EAAEQ,MAAM,CAACC,IAAI,IAAI;QACtC,OAAOA,IAAI,CAACZ,OAAO,KAAKA,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIa,eAAe,EAAElB,qBAAqB,CAAC;EAC3C,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import DataLoader from "dataloader";
2
+ import type { CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
3
+ import type { IDataLoaderParams } from "./types.js";
4
+ export declare const createGetLatestRevisionByEntryId: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
@@ -0,0 +1,50 @@
1
+ import DataLoader from "dataloader";
2
+ import { cleanupItems } from "@webiny/db-dynamodb/utils/cleanup.js";
3
+ import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
4
+ import { createLatestSortKey, createPartitionKey } from "../keys.js";
5
+ import { parseIdentifier } from "@webiny/utils";
6
+ export const createGetLatestRevisionByEntryId = params => {
7
+ const {
8
+ entity,
9
+ tenant,
10
+ modelId
11
+ } = params;
12
+ const latestKey = createLatestSortKey();
13
+ return new DataLoader(async ids => {
14
+ const reader = entity.createEntityReader();
15
+ const keys = new Set();
16
+ for (const id of ids) {
17
+ const partitionKey = createPartitionKey({
18
+ tenant,
19
+ id
20
+ });
21
+ if (keys.has(partitionKey)) {
22
+ continue;
23
+ }
24
+ keys.add(partitionKey);
25
+ reader.get({
26
+ PK: partitionKey,
27
+ SK: latestKey
28
+ });
29
+ }
30
+ const records = await reader.execute();
31
+ const items = cleanupItems(entity.entity, records).map(item => {
32
+ return item.data;
33
+ });
34
+ return ids.map(id => {
35
+ const {
36
+ id: entryId
37
+ } = parseIdentifier(id);
38
+ return items.filter(item => {
39
+ if (item.modelId !== modelId) {
40
+ return false;
41
+ }
42
+ return entryId === item.entryId;
43
+ });
44
+ });
45
+ }, {
46
+ batchScheduleFn: createBatchScheduleFn()
47
+ });
48
+ };
49
+
50
+ //# sourceMappingURL=getLatestRevisionByEntryId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DataLoader","cleanupItems","createBatchScheduleFn","createLatestSortKey","createPartitionKey","parseIdentifier","createGetLatestRevisionByEntryId","params","entity","tenant","modelId","latestKey","ids","reader","createEntityReader","keys","Set","id","partitionKey","has","add","get","PK","SK","records","execute","items","map","item","data","entryId","filter","batchScheduleFn"],"sources":["getLatestRevisionByEntryId.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup.js\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\nimport { createLatestSortKey, createPartitionKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\nexport const createGetLatestRevisionByEntryId = (params: IDataLoaderParams) => {\n const { entity, tenant, modelId } = params;\n\n const latestKey = createLatestSortKey();\n\n return new DataLoader<string, CmsStorageEntry[]>(\n async ids => {\n const reader = entity.createEntityReader();\n\n const keys = new Set<string>();\n\n for (const id of ids) {\n const partitionKey = createPartitionKey({\n tenant,\n id\n });\n if (keys.has(partitionKey)) {\n continue;\n }\n keys.add(partitionKey);\n\n reader.get({\n PK: partitionKey,\n SK: latestKey\n });\n }\n\n const records = await reader.execute();\n const items = cleanupItems(entity.entity, records).map(item => {\n return item.data;\n });\n\n return ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return items.filter(item => {\n if (item.modelId !== modelId) {\n return false;\n }\n return entryId === item.entryId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AACnC,SAASC,YAAY,QAAQ,sCAAsC;AAEnE,SAASC,qBAAqB;AAC9B,SAASC,mBAAmB,EAAEC,kBAAkB;AAEhD,SAASC,eAAe,QAAQ,eAAe;AAE/C,OAAO,MAAMC,gCAAgC,GAAIC,MAAyB,IAAK;EAC3E,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAE1C,MAAMI,SAAS,GAAGR,mBAAmB,CAAC,CAAC;EAEvC,OAAO,IAAIH,UAAU,CACjB,MAAMY,GAAG,IAAI;IACT,MAAMC,MAAM,GAAGL,MAAM,CAACM,kBAAkB,CAAC,CAAC;IAE1C,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAS,CAAC;IAE9B,KAAK,MAAMC,EAAE,IAAIL,GAAG,EAAE;MAClB,MAAMM,YAAY,GAAGd,kBAAkB,CAAC;QACpCK,MAAM;QACNQ;MACJ,CAAC,CAAC;MACF,IAAIF,IAAI,CAACI,GAAG,CAACD,YAAY,CAAC,EAAE;QACxB;MACJ;MACAH,IAAI,CAACK,GAAG,CAACF,YAAY,CAAC;MAEtBL,MAAM,CAACQ,GAAG,CAAC;QACPC,EAAE,EAAEJ,YAAY;QAChBK,EAAE,EAAEZ;MACR,CAAC,CAAC;IACN;IAEA,MAAMa,OAAO,GAAG,MAAMX,MAAM,CAACY,OAAO,CAAC,CAAC;IACtC,MAAMC,KAAK,GAAGzB,YAAY,CAACO,MAAM,CAACA,MAAM,EAAEgB,OAAO,CAAC,CAACG,GAAG,CAACC,IAAI,IAAI;MAC3D,OAAOA,IAAI,CAACC,IAAI;IACpB,CAAC,CAAC;IAEF,OAAOjB,GAAG,CAACe,GAAG,CAACV,EAAE,IAAI;MACjB,MAAM;QAAEA,EAAE,EAAEa;MAAQ,CAAC,GAAGzB,eAAe,CAACY,EAAE,CAAC;MAC3C,OAAOS,KAAK,CAACK,MAAM,CAACH,IAAI,IAAI;QACxB,IAAIA,IAAI,CAAClB,OAAO,KAAKA,OAAO,EAAE;UAC1B,OAAO,KAAK;QAChB;QACA,OAAOoB,OAAO,KAAKF,IAAI,CAACE,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIE,eAAe,EAAE9B,qBAAqB,CAAC;EAC3C,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import DataLoader from "dataloader";
2
+ import type { CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
3
+ import type { IDataLoaderParams } from "./types.js";
4
+ export declare const createGetPublishedRevisionByEntryId: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
@@ -0,0 +1,50 @@
1
+ import DataLoader from "dataloader";
2
+ import { cleanupItems } from "@webiny/db-dynamodb/utils/cleanup.js";
3
+ import { createPartitionKey, createPublishedSortKey } from "../keys.js";
4
+ import { parseIdentifier } from "@webiny/utils";
5
+ import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
6
+ export const createGetPublishedRevisionByEntryId = params => {
7
+ const {
8
+ entity,
9
+ tenant,
10
+ modelId
11
+ } = params;
12
+ const publishedKey = createPublishedSortKey();
13
+ return new DataLoader(async ids => {
14
+ const reader = entity.createEntityReader();
15
+ const keys = new Set();
16
+ for (const id of ids) {
17
+ const partitionKey = createPartitionKey({
18
+ tenant,
19
+ id
20
+ });
21
+ if (keys.has(partitionKey)) {
22
+ continue;
23
+ }
24
+ keys.add(partitionKey);
25
+ reader.get({
26
+ PK: partitionKey,
27
+ SK: publishedKey
28
+ });
29
+ }
30
+ const records = await reader.execute();
31
+ const items = cleanupItems(entity.entity, records).map(item => {
32
+ return item.data;
33
+ });
34
+ return ids.map(id => {
35
+ const {
36
+ id: entryId
37
+ } = parseIdentifier(id);
38
+ return items.filter(item => {
39
+ if (item.modelId !== modelId) {
40
+ return false;
41
+ }
42
+ return entryId === item.entryId;
43
+ });
44
+ });
45
+ }, {
46
+ batchScheduleFn: createBatchScheduleFn()
47
+ });
48
+ };
49
+
50
+ //# sourceMappingURL=getPublishedRevisionByEntryId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DataLoader","cleanupItems","createPartitionKey","createPublishedSortKey","parseIdentifier","createBatchScheduleFn","createGetPublishedRevisionByEntryId","params","entity","tenant","modelId","publishedKey","ids","reader","createEntityReader","keys","Set","id","partitionKey","has","add","get","PK","SK","records","execute","items","map","item","data","entryId","filter","batchScheduleFn"],"sources":["getPublishedRevisionByEntryId.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup.js\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createPartitionKey, createPublishedSortKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\n\nexport const createGetPublishedRevisionByEntryId = (params: IDataLoaderParams) => {\n const { entity, tenant, modelId } = params;\n\n const publishedKey = createPublishedSortKey();\n return new DataLoader<string, CmsStorageEntry[]>(\n async ids => {\n const reader = entity.createEntityReader();\n\n const keys = new Set<string>();\n\n for (const id of ids) {\n const partitionKey = createPartitionKey({\n tenant,\n id\n });\n if (keys.has(partitionKey)) {\n continue;\n }\n keys.add(partitionKey);\n reader.get({\n PK: partitionKey,\n SK: publishedKey\n });\n }\n\n const records = await reader.execute();\n const items = cleanupItems(entity.entity, records).map(item => {\n return item.data;\n });\n\n return ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return items.filter(item => {\n if (item.modelId !== modelId) {\n return false;\n }\n return entryId === item.entryId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AACnC,SAASC,YAAY,QAAQ,sCAAsC;AAEnE,SAASC,kBAAkB,EAAEC,sBAAsB;AAEnD,SAASC,eAAe,QAAQ,eAAe;AAC/C,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,mCAAmC,GAAIC,MAAyB,IAAK;EAC9E,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAE1C,MAAMI,YAAY,GAAGR,sBAAsB,CAAC,CAAC;EAC7C,OAAO,IAAIH,UAAU,CACjB,MAAMY,GAAG,IAAI;IACT,MAAMC,MAAM,GAAGL,MAAM,CAACM,kBAAkB,CAAC,CAAC;IAE1C,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAS,CAAC;IAE9B,KAAK,MAAMC,EAAE,IAAIL,GAAG,EAAE;MAClB,MAAMM,YAAY,GAAGhB,kBAAkB,CAAC;QACpCO,MAAM;QACNQ;MACJ,CAAC,CAAC;MACF,IAAIF,IAAI,CAACI,GAAG,CAACD,YAAY,CAAC,EAAE;QACxB;MACJ;MACAH,IAAI,CAACK,GAAG,CAACF,YAAY,CAAC;MACtBL,MAAM,CAACQ,GAAG,CAAC;QACPC,EAAE,EAAEJ,YAAY;QAChBK,EAAE,EAAEZ;MACR,CAAC,CAAC;IACN;IAEA,MAAMa,OAAO,GAAG,MAAMX,MAAM,CAACY,OAAO,CAAC,CAAC;IACtC,MAAMC,KAAK,GAAGzB,YAAY,CAACO,MAAM,CAACA,MAAM,EAAEgB,OAAO,CAAC,CAACG,GAAG,CAACC,IAAI,IAAI;MAC3D,OAAOA,IAAI,CAACC,IAAI;IACpB,CAAC,CAAC;IAEF,OAAOjB,GAAG,CAACe,GAAG,CAACV,EAAE,IAAI;MACjB,MAAM;QAAEA,EAAE,EAAEa;MAAQ,CAAC,GAAG1B,eAAe,CAACa,EAAE,CAAC;MAC3C,OAAOS,KAAK,CAACK,MAAM,CAACH,IAAI,IAAI;QACxB,IAAIA,IAAI,CAAClB,OAAO,KAAKA,OAAO,EAAE;UAC1B,OAAO,KAAK;QAChB;QACA,OAAOoB,OAAO,KAAKF,IAAI,CAACE,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIE,eAAe,EAAE3B,qBAAqB,CAAC;EAC3C,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import DataLoader from "dataloader";
2
+ import type { CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
3
+ import type { IDataLoaderParams } from "./types.js";
4
+ export declare const createGetRevisionById: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
@@ -0,0 +1,56 @@
1
+ import DataLoader from "dataloader";
2
+ import { cleanupItems } from "@webiny/db-dynamodb/utils/cleanup.js";
3
+ import { createPartitionKey, createRevisionSortKey } from "../keys.js";
4
+ import { parseIdentifier } from "@webiny/utils";
5
+ import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
6
+ export const createGetRevisionById = params => {
7
+ const {
8
+ entity,
9
+ tenant,
10
+ modelId
11
+ } = params;
12
+ return new DataLoader(async ids => {
13
+ const reader = entity.createEntityReader();
14
+ const keys = new Set();
15
+ for (const id of ids) {
16
+ const partitionKey = createPartitionKey({
17
+ tenant,
18
+ id
19
+ });
20
+ const {
21
+ version
22
+ } = parseIdentifier(id);
23
+ if (version === null) {
24
+ continue;
25
+ }
26
+ const sortKey = createRevisionSortKey({
27
+ version
28
+ });
29
+ const key = `${partitionKey}__${sortKey}`;
30
+ if (keys.has(key)) {
31
+ continue;
32
+ }
33
+ keys.add(key);
34
+ reader.get({
35
+ PK: partitionKey,
36
+ SK: sortKey
37
+ });
38
+ }
39
+ const records = await reader.execute();
40
+ const items = cleanupItems(entity.entity, records).map(item => {
41
+ return item.data;
42
+ });
43
+ return ids.map(id => {
44
+ return items.filter(item => {
45
+ if (item.modelId !== modelId) {
46
+ return false;
47
+ }
48
+ return id === item.id;
49
+ });
50
+ });
51
+ }, {
52
+ batchScheduleFn: createBatchScheduleFn()
53
+ });
54
+ };
55
+
56
+ //# sourceMappingURL=getRevisionById.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DataLoader","cleanupItems","createPartitionKey","createRevisionSortKey","parseIdentifier","createBatchScheduleFn","createGetRevisionById","params","entity","tenant","modelId","ids","reader","createEntityReader","keys","Set","id","partitionKey","version","sortKey","key","has","add","get","PK","SK","records","execute","items","map","item","data","filter","batchScheduleFn"],"sources":["getRevisionById.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup.js\";\nimport { createPartitionKey, createRevisionSortKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\n\nexport const createGetRevisionById = (params: IDataLoaderParams) => {\n const { entity, tenant, modelId } = params;\n\n return new DataLoader<string, CmsStorageEntry[]>(\n async ids => {\n const reader = entity.createEntityReader();\n\n const keys = new Set<string>();\n\n for (const id of ids) {\n const partitionKey = createPartitionKey({\n tenant,\n id\n });\n const { version } = parseIdentifier(id);\n if (version === null) {\n continue;\n }\n const sortKey = createRevisionSortKey({\n version\n });\n const key = `${partitionKey}__${sortKey}`;\n if (keys.has(key)) {\n continue;\n }\n keys.add(key);\n\n reader.get({\n PK: partitionKey,\n SK: sortKey\n });\n }\n\n const records = await reader.execute();\n const items = cleanupItems(entity.entity, records).map(item => {\n return item.data;\n });\n\n return ids.map(id => {\n return items.filter(item => {\n if (item.modelId !== modelId) {\n return false;\n }\n return id === item.id;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AAEnC,SAASC,YAAY,QAAQ,sCAAsC;AACnE,SAASC,kBAAkB,EAAEC,qBAAqB;AAElD,SAASC,eAAe,QAAQ,eAAe;AAC/C,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,qBAAqB,GAAIC,MAAyB,IAAK;EAChE,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAE1C,OAAO,IAAIP,UAAU,CACjB,MAAMW,GAAG,IAAI;IACT,MAAMC,MAAM,GAAGJ,MAAM,CAACK,kBAAkB,CAAC,CAAC;IAE1C,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAS,CAAC;IAE9B,KAAK,MAAMC,EAAE,IAAIL,GAAG,EAAE;MAClB,MAAMM,YAAY,GAAGf,kBAAkB,CAAC;QACpCO,MAAM;QACNO;MACJ,CAAC,CAAC;MACF,MAAM;QAAEE;MAAQ,CAAC,GAAGd,eAAe,CAACY,EAAE,CAAC;MACvC,IAAIE,OAAO,KAAK,IAAI,EAAE;QAClB;MACJ;MACA,MAAMC,OAAO,GAAGhB,qBAAqB,CAAC;QAClCe;MACJ,CAAC,CAAC;MACF,MAAME,GAAG,GAAG,GAAGH,YAAY,KAAKE,OAAO,EAAE;MACzC,IAAIL,IAAI,CAACO,GAAG,CAAC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