@webiny/api-headless-cms-ddb 5.17.4 → 5.18.0-beta.3

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 (91) hide show
  1. package/definitions/entry.d.ts +6 -4
  2. package/definitions/entry.js +19 -8
  3. package/definitions/group.d.ts +8 -0
  4. package/definitions/group.js +74 -0
  5. package/definitions/model.d.ts +8 -0
  6. package/definitions/model.js +96 -0
  7. package/definitions/settings.d.ts +8 -0
  8. package/definitions/settings.js +62 -0
  9. package/definitions/system.d.ts +8 -0
  10. package/definitions/system.js +50 -0
  11. package/definitions/table.d.ts +6 -12
  12. package/definitions/table.js +15 -15
  13. package/dynamoDb/index.d.ts +1 -1
  14. package/dynamoDb/index.js +4 -3
  15. package/dynamoDb/path/plainObject.js +1 -2
  16. package/dynamoDb/path/ref.js +1 -2
  17. package/dynamoDb/storage/date.d.ts +2 -2
  18. package/dynamoDb/storage/date.js +17 -21
  19. package/dynamoDb/storage/longText.d.ts +7 -0
  20. package/dynamoDb/storage/longText.js +83 -0
  21. package/dynamoDb/storage/richText.d.ts +2 -2
  22. package/dynamoDb/storage/richText.js +69 -67
  23. package/dynamoDb/transformValue/datetime.d.ts +1 -1
  24. package/dynamoDb/transformValue/datetime.js +1 -2
  25. package/index.d.ts +2 -6
  26. package/index.js +108 -13
  27. package/operations/entry/dataLoaders.d.ts +34 -19
  28. package/operations/entry/dataLoaders.js +158 -138
  29. package/operations/entry/index.d.ts +8 -4
  30. package/operations/entry/index.js +812 -16
  31. package/operations/entry/keys.d.ts +25 -0
  32. package/operations/entry/keys.js +62 -0
  33. package/operations/entry/systemFields.d.ts +2 -2
  34. package/operations/entry/systemFields.js +1 -2
  35. package/operations/entry/utils.d.ts +13 -9
  36. package/operations/entry/utils.js +62 -18
  37. package/operations/group/index.d.ts +8 -0
  38. package/operations/group/index.js +198 -0
  39. package/operations/model/index.d.ts +6 -3
  40. package/operations/model/index.js +153 -18
  41. package/operations/settings/index.d.ts +6 -3
  42. package/operations/settings/index.js +132 -16
  43. package/operations/system/index.d.ts +6 -3
  44. package/operations/system/index.js +94 -14
  45. package/package.json +11 -11
  46. package/types.d.ts +38 -8
  47. package/types.js +11 -1
  48. package/configurations.d.ts +0 -18
  49. package/configurations.js +0 -24
  50. package/configurations.js.map +0 -1
  51. package/definitions/entry.js.map +0 -1
  52. package/definitions/table.js.map +0 -1
  53. package/dynamoDb/index.js.map +0 -1
  54. package/dynamoDb/path/plainObject.js.map +0 -1
  55. package/dynamoDb/path/ref.js.map +0 -1
  56. package/dynamoDb/storage/date.js.map +0 -1
  57. package/dynamoDb/storage/richText.js.map +0 -1
  58. package/dynamoDb/transformValue/datetime.js.map +0 -1
  59. package/index.js.map +0 -1
  60. package/operations/entry/CmsContentEntryDynamo.d.ts +0 -86
  61. package/operations/entry/CmsContentEntryDynamo.js +0 -972
  62. package/operations/entry/CmsContentEntryDynamo.js.map +0 -1
  63. package/operations/entry/dataLoaders.js.map +0 -1
  64. package/operations/entry/index.js.map +0 -1
  65. package/operations/entry/systemFields.js.map +0 -1
  66. package/operations/entry/utils.js.map +0 -1
  67. package/operations/helpers.d.ts +0 -5
  68. package/operations/helpers.js +0 -96
  69. package/operations/helpers.js.map +0 -1
  70. package/operations/model/CmsContentModelDynamo.d.ts +0 -18
  71. package/operations/model/CmsContentModelDynamo.js +0 -234
  72. package/operations/model/CmsContentModelDynamo.js.map +0 -1
  73. package/operations/model/index.js.map +0 -1
  74. package/operations/modelGroup/CmsContentModelGroupDynamo.d.ts +0 -42
  75. package/operations/modelGroup/CmsContentModelGroupDynamo.js +0 -230
  76. package/operations/modelGroup/CmsContentModelGroupDynamo.js.map +0 -1
  77. package/operations/modelGroup/index.d.ts +0 -3
  78. package/operations/modelGroup/index.js +0 -26
  79. package/operations/modelGroup/index.js.map +0 -1
  80. package/operations/settings/CmsSettingsDynamo.d.ts +0 -16
  81. package/operations/settings/CmsSettingsDynamo.js +0 -145
  82. package/operations/settings/CmsSettingsDynamo.js.map +0 -1
  83. package/operations/settings/index.js.map +0 -1
  84. package/operations/system/CmsSystemDynamo.d.ts +0 -16
  85. package/operations/system/CmsSystemDynamo.js +0 -126
  86. package/operations/system/CmsSystemDynamo.js.map +0 -1
  87. package/operations/system/index.js.map +0 -1
  88. package/types.js.map +0 -1
  89. package/utils.d.ts +0 -5
  90. package/utils.js +0 -62
  91. package/utils.js.map +0 -1
@@ -1,3 +1,6 @@
1
- import { CmsSettingsStorageOperationsProviderPlugin } from "@webiny/api-headless-cms/types";
2
- declare const _default: () => CmsSettingsStorageOperationsProviderPlugin;
3
- export default _default;
1
+ import { CmsSettingsStorageOperations } from "@webiny/api-headless-cms/types";
2
+ import { Entity } from "dynamodb-toolbox";
3
+ export interface Params {
4
+ entity: Entity<any>;
5
+ }
6
+ export declare const createSettingsStorageOperations: (params: Params) => CmsSettingsStorageOperations;
@@ -5,21 +5,137 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
9
-
10
- var _CmsSettingsDynamo = _interopRequireDefault(require("./CmsSettingsDynamo"));
11
-
12
- var _default = () => ({
13
- type: "cms-settings-storage-operations-provider",
14
- name: "cms-settings-storage-operations-ddb-crud",
15
- provide: async ({
16
- context
17
- }) => {
18
- return new _CmsSettingsDynamo.default({
19
- context
20
- });
8
+ exports.createSettingsStorageOperations = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _get = require("@webiny/db-dynamodb/utils/get");
13
+
14
+ var _error = _interopRequireDefault(require("@webiny/error"));
15
+
16
+ var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
17
+
18
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
19
+
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
21
+
22
+ const convertToDbData = settings => {
23
+ return _objectSpread(_objectSpread({}, settings), {}, {
24
+ contentModelLastChange: settings.contentModelLastChange.toISOString()
25
+ });
26
+ };
27
+
28
+ const convertFromDbData = settings => {
29
+ if (!settings) {
30
+ return null;
21
31
  }
22
- });
23
32
 
24
- exports.default = _default;
25
- //# sourceMappingURL=index.js.map
33
+ let contentModelLastChange;
34
+
35
+ try {
36
+ contentModelLastChange = new Date(settings.contentModelLastChange);
37
+ } catch {
38
+ contentModelLastChange = new Date();
39
+ }
40
+
41
+ return _objectSpread(_objectSpread({}, settings), {}, {
42
+ contentModelLastChange
43
+ });
44
+ };
45
+
46
+ const createPartitionKey = ({
47
+ tenant,
48
+ locale
49
+ }) => {
50
+ return `T#${tenant}#L#${locale}#CMS#SETTINGS`;
51
+ };
52
+
53
+ const createSortKey = () => {
54
+ return "settings";
55
+ };
56
+
57
+ const createKeys = params => {
58
+ return {
59
+ PK: createPartitionKey(params),
60
+ SK: createSortKey()
61
+ };
62
+ };
63
+
64
+ const createSettingsStorageOperations = params => {
65
+ const {
66
+ entity
67
+ } = params;
68
+
69
+ const create = async params => {
70
+ const {
71
+ settings
72
+ } = params;
73
+ const keys = createKeys(settings);
74
+ const dbSettings = convertToDbData(settings);
75
+
76
+ try {
77
+ await entity.put(_objectSpread(_objectSpread({}, dbSettings), keys));
78
+ return settings;
79
+ } catch (ex) {
80
+ throw new _error.default(ex.message || "Could not create settings.", ex.code || "CREATE_SETTINGS_ERROR", {
81
+ error: ex,
82
+ settings,
83
+ dbSettings,
84
+ keys
85
+ });
86
+ }
87
+ };
88
+
89
+ const update = async params => {
90
+ const {
91
+ settings,
92
+ original
93
+ } = params;
94
+ const keys = createKeys(settings);
95
+ const dbSettings = convertToDbData(settings);
96
+
97
+ try {
98
+ await entity.put(_objectSpread(_objectSpread({}, dbSettings), keys));
99
+ return settings;
100
+ } catch (ex) {
101
+ throw new _error.default(ex.message || "Could not update settings.", ex.code || "UPDATE_SETTINGS_ERROR", {
102
+ error: ex,
103
+ settings,
104
+ dbSettings,
105
+ original,
106
+ keys
107
+ });
108
+ }
109
+ };
110
+
111
+ const get = async params => {
112
+ const keys = createKeys(params);
113
+
114
+ try {
115
+ const record = await (0, _get.get)({
116
+ entity,
117
+ keys
118
+ });
119
+
120
+ if (!record) {
121
+ return null;
122
+ }
123
+
124
+ const settings = (0, _cleanup.cleanupItem)(entity, record);
125
+ return convertFromDbData(settings);
126
+ } catch (ex) {
127
+ throw new _error.default(ex.message || "Could not get settings.", ex.code || "GET_SETTINGS_ERROR", {
128
+ error: ex,
129
+ keys
130
+ });
131
+ }
132
+ };
133
+
134
+ return {
135
+ create,
136
+ get,
137
+ update
138
+ };
139
+ };
140
+
141
+ exports.createSettingsStorageOperations = createSettingsStorageOperations;
@@ -1,3 +1,6 @@
1
- import { CmsSystemStorageOperationsProviderPlugin } from "@webiny/api-headless-cms/types";
2
- declare const _default: () => CmsSystemStorageOperationsProviderPlugin;
3
- export default _default;
1
+ import { CmsSystemStorageOperations } from "@webiny/api-headless-cms/types";
2
+ import { Entity } from "dynamodb-toolbox";
3
+ export interface Params {
4
+ entity: Entity<any>;
5
+ }
6
+ export declare const createSystemStorageOperations: (params: Params) => CmsSystemStorageOperations;
@@ -5,21 +5,101 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.createSystemStorageOperations = void 0;
9
9
 
10
- var _CmsSystemDynamo = _interopRequireDefault(require("./CmsSystemDynamo"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
- var _default = () => ({
13
- type: "cms-system-storage-operations-provider",
14
- name: "cms-system-storage-operations-ddb-crud",
15
- provide: async ({
16
- context
12
+ var _error = _interopRequireDefault(require("@webiny/error"));
13
+
14
+ var _get = require("@webiny/db-dynamodb/utils/get");
15
+
16
+ var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
17
+
18
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
19
+
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
21
+
22
+ const createPartitionKey = ({
23
+ tenant
24
+ }) => {
25
+ return `T#${tenant.toLowerCase()}#SYSTEM`;
26
+ };
27
+
28
+ const createSortKey = () => {
29
+ return "CMS";
30
+ };
31
+
32
+ const createKeys = params => {
33
+ return {
34
+ PK: createPartitionKey(params),
35
+ SK: createSortKey()
36
+ };
37
+ };
38
+
39
+ const createSystemStorageOperations = params => {
40
+ const {
41
+ entity
42
+ } = params;
43
+
44
+ const create = async ({
45
+ system
17
46
  }) => {
18
- return new _CmsSystemDynamo.default({
19
- context
20
- });
21
- }
22
- });
47
+ const keys = createKeys(system);
48
+
49
+ try {
50
+ await entity.put(_objectSpread(_objectSpread({}, system), keys));
51
+ return system;
52
+ } catch (ex) {
53
+ throw new _error.default(ex.message || "Could not create system.", ex.code || "CREATE_SYSTEM_ERROR", {
54
+ error: ex,
55
+ system,
56
+ keys
57
+ });
58
+ }
59
+ };
60
+
61
+ const update = async params => {
62
+ const {
63
+ system,
64
+ original
65
+ } = params;
66
+ const keys = createKeys(system);
67
+
68
+ try {
69
+ await entity.put(_objectSpread(_objectSpread({}, system), keys));
70
+ return system;
71
+ } catch (ex) {
72
+ throw new _error.default(ex.message || "Could not update system.", ex.code || "UPDATE_SYSTEM_ERROR", {
73
+ error: ex,
74
+ system,
75
+ original,
76
+ keys
77
+ });
78
+ }
79
+ };
80
+
81
+ const get = async params => {
82
+ const keys = createKeys(params);
83
+
84
+ try {
85
+ const system = await (0, _get.get)({
86
+ entity,
87
+ keys
88
+ });
89
+ return (0, _cleanup.cleanupItem)(entity, system);
90
+ } catch (ex) {
91
+ throw new _error.default(ex.message || "Could not get system.", ex.code || "GET_SYSTEM_ERROR", {
92
+ error: ex,
93
+ keys
94
+ });
95
+ }
96
+ };
97
+
98
+ return {
99
+ create,
100
+ update,
101
+ get
102
+ };
103
+ };
23
104
 
24
- exports.default = _default;
25
- //# sourceMappingURL=index.js.map
105
+ exports.createSystemStorageOperations = createSystemStorageOperations;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb",
3
- "version": "5.17.4",
3
+ "version": "5.18.0-beta.3",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-headless-cms",
@@ -22,16 +22,16 @@
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
24
  "@babel/runtime": "7.16.3",
25
- "@webiny/api-headless-cms": "5.17.4",
26
- "@webiny/db-dynamodb": "5.17.4",
27
- "@webiny/error": "5.17.4",
28
- "@webiny/handler-db": "5.17.4",
29
- "aws-sdk": "2.868.0",
25
+ "@webiny/api-headless-cms": "5.18.0-beta.3",
26
+ "@webiny/db-dynamodb": "5.18.0-beta.3",
27
+ "@webiny/error": "5.18.0-beta.3",
28
+ "@webiny/handler-db": "5.18.0-beta.3",
29
+ "@webiny/utils": "5.18.0-beta.3",
30
+ "aws-sdk": "2.1032.0",
30
31
  "dataloader": "2.0.0",
31
32
  "dot-prop": "5.3.0",
32
33
  "dynamodb-toolbox": "0.3.5",
33
34
  "jsonpack": "1.1.5",
34
- "lodash.clonedeep": "4.5.0",
35
35
  "lodash.sortby": "4.7.0"
36
36
  },
37
37
  "devDependencies": {
@@ -40,9 +40,9 @@
40
40
  "@babel/preset-env": "^7.5.5",
41
41
  "@babel/preset-flow": "^7.0.0",
42
42
  "@types/jsonpack": "^1.1.0",
43
- "@webiny/cli": "^5.17.4",
44
- "@webiny/plugins": "^5.17.4",
45
- "@webiny/project-utils": "^5.17.4",
43
+ "@webiny/cli": "^5.18.0-beta.3",
44
+ "@webiny/plugins": "^5.18.0-beta.3",
45
+ "@webiny/project-utils": "^5.18.0-beta.3",
46
46
  "jest": "^26.6.3",
47
47
  "jest-dynalite": "^3.2.0",
48
48
  "jest-environment-node": "^26.6.2",
@@ -57,5 +57,5 @@
57
57
  "build": "yarn webiny run build",
58
58
  "watch": "yarn webiny run watch"
59
59
  },
60
- "gitHead": "bdfaa377704bf7f51d73561b4c6129f682bf24d2"
60
+ "gitHead": "9c86670476a62348ce391b091bf768e425ab6ee9"
61
61
  }
package/types.d.ts CHANGED
@@ -1,13 +1,17 @@
1
1
  import { Plugin } from "@webiny/plugins/types";
2
- import { CmsContentModelField } from "@webiny/api-headless-cms/types";
3
- interface CmsFieldFilterValueTransformArgs<T> {
2
+ import { CmsModelField, CmsModelFieldToGraphQLPlugin, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
+ import { DynamoDBTypes, TableConstructor } from "dynamodb-toolbox/dist/classes/Table";
4
+ import { EntityAttributeConfig, EntityCompositeAttributes } from "dynamodb-toolbox/dist/classes/Entity";
5
+ import { DocumentClient } from "aws-sdk/clients/dynamodb";
6
+ import { Entity, Table } from "dynamodb-toolbox";
7
+ interface CmsFieldFilterValueTransformParams {
4
8
  /**
5
9
  * A field which value we are transforming.
6
10
  */
7
- field: CmsContentModelField;
11
+ field: CmsModelField;
8
12
  value: any;
9
13
  }
10
- export interface CmsFieldFilterValueTransformPlugin<T = any, R = any> extends Plugin {
14
+ export interface CmsFieldFilterValueTransformPlugin extends Plugin {
11
15
  /**
12
16
  * A plugin type.
13
17
  */
@@ -19,13 +23,13 @@ export interface CmsFieldFilterValueTransformPlugin<T = any, R = any> extends Pl
19
23
  /**
20
24
  * Transform method which expect field definition and value to transform.
21
25
  */
22
- transform: (args: CmsFieldFilterValueTransformArgs<T>) => R;
26
+ transform: (params: CmsFieldFilterValueTransformParams) => any;
23
27
  }
24
- interface CmsFieldFilterPathArgs {
28
+ interface CmsFieldFilterPathParams {
25
29
  /**
26
30
  * A field for which we are creating the value path.
27
31
  */
28
- field: CmsContentModelField;
32
+ field: CmsModelField;
29
33
  /**
30
34
  * If value is an array we will need index position.
31
35
  * It is up to the developer to add.
@@ -49,6 +53,32 @@ export interface CmsFieldFilterPathPlugin extends Plugin {
49
53
  /**
50
54
  * Get a path for given field.
51
55
  */
52
- createPath: (args: CmsFieldFilterPathArgs) => string;
56
+ createPath: (params: CmsFieldFilterPathParams) => string;
57
+ }
58
+ export declare type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;
59
+ export declare type Attributes = Record<string, AttributeDefinition>;
60
+ export declare enum ENTITIES {
61
+ SYSTEM = "CmsSystem",
62
+ SETTINGS = "CmsSettings",
63
+ GROUPS = "CmsGroups",
64
+ MODELS = "CmsModels",
65
+ ENTRIES = "CmsEntries"
66
+ }
67
+ export interface TableModifier {
68
+ (table: TableConstructor): TableConstructor;
69
+ }
70
+ export interface StorageOperationsFactoryParams {
71
+ documentClient: DocumentClient;
72
+ table?: TableModifier;
73
+ modelFieldToGraphQLPlugins: CmsModelFieldToGraphQLPlugin[];
74
+ attributes?: Record<ENTITIES, Attributes>;
75
+ plugins?: Plugin[] | Plugin[][];
76
+ }
77
+ export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {
78
+ getTable: () => Table;
79
+ getEntities: () => Record<"system" | "settings" | "groups" | "models" | "entries", Entity<any>>;
80
+ }
81
+ export interface StorageOperationsFactory {
82
+ (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
53
83
  }
54
84
  export {};
package/types.js CHANGED
@@ -3,4 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- //# sourceMappingURL=types.js.map
6
+ exports.ENTITIES = void 0;
7
+ let ENTITIES;
8
+ exports.ENTITIES = ENTITIES;
9
+
10
+ (function (ENTITIES) {
11
+ ENTITIES["SYSTEM"] = "CmsSystem";
12
+ ENTITIES["SETTINGS"] = "CmsSettings";
13
+ ENTITIES["GROUPS"] = "CmsGroups";
14
+ ENTITIES["MODELS"] = "CmsModels";
15
+ ENTITIES["ENTRIES"] = "CmsEntries";
16
+ })(ENTITIES || (exports.ENTITIES = ENTITIES = {}));
@@ -1,18 +0,0 @@
1
- interface DatabaseConfigKeyFields {
2
- name: string;
3
- }
4
- interface DatabaseConfigKeys {
5
- primary: boolean;
6
- unique: boolean;
7
- name: string;
8
- fields: DatabaseConfigKeyFields[];
9
- }
10
- export interface CmsDatabaseConfig {
11
- table: string;
12
- keys: DatabaseConfigKeys[];
13
- }
14
- interface Configurations {
15
- db: () => CmsDatabaseConfig;
16
- }
17
- declare const configurations: Configurations;
18
- export default configurations;
package/configurations.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- const configurations = {
8
- db: () => ({
9
- table: process.env.DB_TABLE_HEADLESS_CMS || process.env.DB_TABLE,
10
- keys: [{
11
- primary: true,
12
- unique: true,
13
- name: "primary",
14
- fields: [{
15
- name: "PK"
16
- }, {
17
- name: "SK"
18
- }]
19
- }]
20
- })
21
- };
22
- var _default = configurations;
23
- exports.default = _default;
24
- //# sourceMappingURL=configurations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/configurations.ts"],"names":["configurations","db","table","process","env","DB_TABLE_HEADLESS_CMS","DB_TABLE","keys","primary","unique","name","fields"],"mappings":";;;;;;AAoBA,MAAMA,cAA8B,GAAG;AACnCC,EAAAA,EAAE,EAAE,OAAO;AACPC,IAAAA,KAAK,EAAEC,OAAO,CAACC,GAAR,CAAYC,qBAAZ,IAAqCF,OAAO,CAACC,GAAR,CAAYE,QADjD;AAEPC,IAAAA,IAAI,EAAE,CACF;AACIC,MAAAA,OAAO,EAAE,IADb;AAEIC,MAAAA,MAAM,EAAE,IAFZ;AAGIC,MAAAA,IAAI,EAAE,SAHV;AAIIC,MAAAA,MAAM,EAAE,CAAC;AAAED,QAAAA,IAAI,EAAE;AAAR,OAAD,EAAiB;AAAEA,QAAAA,IAAI,EAAE;AAAR,OAAjB;AAJZ,KADE;AAFC,GAAP;AAD+B,CAAvC;eAceV,c","sourcesContent":["interface DatabaseConfigKeyFields {\n name: string;\n}\n\ninterface DatabaseConfigKeys {\n primary: boolean;\n unique: boolean;\n name: string;\n fields: DatabaseConfigKeyFields[];\n}\n\nexport interface CmsDatabaseConfig {\n table: string;\n keys: DatabaseConfigKeys[];\n}\n\ninterface Configurations {\n db: () => CmsDatabaseConfig;\n}\n\nconst configurations: Configurations = {\n db: () => ({\n table: process.env.DB_TABLE_HEADLESS_CMS || process.env.DB_TABLE,\n keys: [\n {\n primary: true,\n unique: true,\n name: \"primary\",\n fields: [{ name: \"PK\" }, { name: \"SK\" }]\n }\n ]\n })\n};\n\nexport default configurations;\n"],"file":"configurations.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/definitions/entry.ts"],"names":["entityName","createEntryEntity","table","Entity","name","attributes","PK","type","partitionKey","SK","sortKey","GSI1_PK","GSI1_SK","TYPE","webinyVersion","tenant","entryId","id","createdBy","ownedBy","createdOn","savedOn","modelId","locale","publishedOn","version","locked","status","values"],"mappings":";;;;;;;AAAA;;AAMA,MAAMA,UAAU,GAAG,cAAnB;;AAEO,MAAMC,iBAAiB,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAuB;AACpD,SAAO,IAAIC,uBAAJ,CAAW;AACdC,IAAAA,IAAI,EAAEJ,UADQ;AAEdE,IAAAA,KAFc;AAGdG,IAAAA,UAAU,EAAE;AACRC,MAAAA,EAAE,EAAE;AACAC,QAAAA,IAAI,EAAE,QADN;AAEAC,QAAAA,YAAY,EAAE;AAFd,OADI;AAKRC,MAAAA,EAAE,EAAE;AACAF,QAAAA,IAAI,EAAE,QADN;AAEAG,QAAAA,OAAO,EAAE;AAFT,OALI;AASRC,MAAAA,OAAO,EAAE;AACLJ,QAAAA,IAAI,EAAE;AADD,OATD;AAYRK,MAAAA,OAAO,EAAE;AACLL,QAAAA,IAAI,EAAE;AADD,OAZD;AAeRM,MAAAA,IAAI,EAAE;AACFN,QAAAA,IAAI,EAAE;AADJ,OAfE;AAkBRO,MAAAA,aAAa,EAAE;AACXP,QAAAA,IAAI,EAAE;AADK,OAlBP;AAqBRQ,MAAAA,MAAM,EAAE;AACJR,QAAAA,IAAI,EAAE;AADF,OArBA;AAwBRS,MAAAA,OAAO,EAAE;AACLT,QAAAA,IAAI,EAAE;AADD,OAxBD;AA2BRU,MAAAA,EAAE,EAAE;AACAV,QAAAA,IAAI,EAAE;AADN,OA3BI;AA8BRW,MAAAA,SAAS,EAAE;AACPX,QAAAA,IAAI,EAAE;AADC,OA9BH;AAiCRY,MAAAA,OAAO,EAAE;AACLZ,QAAAA,IAAI,EAAE;AADD,OAjCD;AAoCRa,MAAAA,SAAS,EAAE;AACPb,QAAAA,IAAI,EAAE;AADC,OApCH;AAuCRc,MAAAA,OAAO,EAAE;AACLd,QAAAA,IAAI,EAAE;AADD,OAvCD;AA0CRe,MAAAA,OAAO,EAAE;AACLf,QAAAA,IAAI,EAAE;AADD,OA1CD;AA6CRgB,MAAAA,MAAM,EAAE;AACJhB,QAAAA,IAAI,EAAE;AADF,OA7CA;AAgDRiB,MAAAA,WAAW,EAAE;AACTjB,QAAAA,IAAI,EAAE;AADG,OAhDL;AAmDRkB,MAAAA,OAAO,EAAE;AACLlB,QAAAA,IAAI,EAAE;AADD,OAnDD;AAsDRmB,MAAAA,MAAM,EAAE;AACJnB,QAAAA,IAAI,EAAE;AADF,OAtDA;AAyDRoB,MAAAA,MAAM,EAAE;AACJpB,QAAAA,IAAI,EAAE;AADF,OAzDA;AA4DRqB,MAAAA,MAAM,EAAE;AACJrB,QAAAA,IAAI,EAAE;AADF;AA5DA;AAHE,GAAX,CAAP;AAoEH,CArEM","sourcesContent":["import { Table, Entity } from \"dynamodb-toolbox\";\n\ninterface Params {\n table: Table;\n}\n\nconst entityName = \"ContentEntry\";\n\nexport const createEntryEntity = ({ table }: Params) => {\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n type: \"string\",\n partitionKey: true\n },\n SK: {\n type: \"string\",\n sortKey: true\n },\n GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n entryId: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n ownedBy: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n modelId: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n publishedOn: {\n type: \"string\"\n },\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n status: {\n type: \"string\"\n },\n values: {\n type: \"map\"\n }\n }\n });\n};\n"],"file":"entry.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/definitions/table.ts"],"names":["createTable","context","indexes","Table","name","configurations","db","table","partitionKey","sortKey","DocumentClient"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;AAcO,MAAMA,WAAW,GAAG,CAAC;AAAEC,EAAAA,OAAF;AAAWC,EAAAA;AAAX,CAAD,KAAkC;AACzD,SAAO,IAAIC,sBAAJ,CAAU;AACbC,IAAAA,IAAI,EAAEC,wBAAeC,EAAf,GAAoBC,KAApB,IAA6B,uBAASN,OAAT,CADtB;AAEbO,IAAAA,YAAY,EAAE,IAFD;AAGbC,IAAAA,OAAO,EAAE,IAHI;AAIbC,IAAAA,cAAc,EAAE,gCAAkBT,OAAlB,CAJH;AAKbC,IAAAA;AALa,GAAV,CAAP;AAOH,CARM","sourcesContent":["import { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { Table } from \"dynamodb-toolbox\";\nimport configurations from \"~/configurations\";\nimport { getDocumentClient, getTable } from \"~/operations/helpers\";\n\ninterface IndexParams {\n partitionKey: string;\n sortKey: string;\n}\n\ninterface Params {\n context: CmsContext;\n indexes: {\n [key: string]: IndexParams;\n };\n}\n\nexport const createTable = ({ context, indexes }: Params) => {\n return new Table({\n name: configurations.db().table || getTable(context),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: getDocumentClient(context),\n indexes\n });\n};\n"],"file":"table.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/dynamoDb/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;eAEe,MAAM,CACjB,wBADiB,EAEjB,oBAFiB,EAGjB,2BAHiB,EAIjB,mBAJiB,EAKjB,wBALiB,C","sourcesContent":["import richTextStorage from \"./storage/richText\";\nimport dateStorage from \"./storage/date\";\nimport plainObjectPath from \"./path/plainObject\";\nimport refPath from \"./path/ref\";\nimport datetimeTransformValue from \"./transformValue/datetime\";\n\nexport default () => [\n richTextStorage(),\n dateStorage(),\n plainObjectPath(),\n refPath(),\n datetimeTransformValue()\n];\n"],"file":"index.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/dynamoDb/path/plainObject.ts"],"names":["type","name","fieldType","createPath","field","path","settings","WebinyError"],"mappings":";;;;;;;;;AACA;;eAEe,OAAiC;AAC5CA,EAAAA,IAAI,EAAE,uBADsC;AAE5CC,EAAAA,IAAI,EAAE,oCAFsC;AAG5CC,EAAAA,SAAS,EAAE,aAHiC;AAI5CC,EAAAA,UAAU,EAAE,CAAC;AAAEC,IAAAA;AAAF,GAAD,KAAe;AACvB,UAAM;AAAEC,MAAAA;AAAF,QAAWD,KAAK,CAACE,QAAN,IAAkB,EAAnC;;AACA,QAAI,CAACD,IAAL,EAAW;AACP,YAAM,IAAIE,cAAJ,CAAgB,8BAAhB,EAAgD,sBAAhD,EAAwE;AAC1EH,QAAAA;AAD0E,OAAxE,CAAN;AAGH;;AACD,WAAOC,IAAP;AACH;AAZ2C,CAAjC,C","sourcesContent":["import { CmsFieldFilterPathPlugin } from \"../../types\";\nimport WebinyError from \"@webiny/error\";\n\nexport default (): CmsFieldFilterPathPlugin => ({\n type: \"cms-field-filter-path\",\n name: \"cms-field-filter-path-plain-object\",\n fieldType: \"plainObject\",\n createPath: ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n }\n});\n"],"file":"plainObject.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/dynamoDb/path/ref.ts"],"names":["type","name","fieldType","createPath","field","index","paths","fieldId","undefined","push","String","join"],"mappings":";;;;;;;eAEe,OAAiC;AAC5CA,EAAAA,IAAI,EAAE,uBADsC;AAE5CC,EAAAA,IAAI,EAAE,2BAFsC;AAG5CC,EAAAA,SAAS,EAAE,KAHiC;AAI5CC,EAAAA,UAAU,EAAE,CAAC;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAD,KAAsB;AAC9B,UAAMC,KAAe,GAAG,CAACF,KAAK,CAACG,OAAP,CAAxB;;AACA,QAAIF,KAAK,KAAKG,SAAd,EAAyB;AACrBF,MAAAA,KAAK,CAACG,IAAN,CAAWC,MAAM,CAACL,KAAD,CAAjB;AACH;;AACDC,IAAAA,KAAK,CAACG,IAAN,CAAW,SAAX;AACA,WAAOH,KAAK,CAACK,IAAN,CAAW,GAAX,CAAP;AACH;AAX2C,CAAjC,C","sourcesContent":["import { CmsFieldFilterPathPlugin } from \"~/types\";\n\nexport default (): CmsFieldFilterPathPlugin => ({\n type: \"cms-field-filter-path\",\n name: \"cms-field-filter-path-ref\",\n fieldType: \"ref\",\n createPath: ({ field, index }) => {\n const paths: string[] = [field.fieldId];\n if (index !== undefined) {\n paths.push(String(index));\n }\n paths.push(\"entryId\");\n return paths.join(\".\");\n }\n});\n"],"file":"ref.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/dynamoDb/storage/date.ts"],"names":["excludeTypes","type","name","fieldType","fromStorage","field","value","settings","includes","Date","toStorage","toISOString","WebinyError","fieldId"],"mappings":";;;;;;;;;AAAA;;AAMA,MAAMA,YAAY,GAAG,CAAC,MAAD,EAAS,sBAAT,CAArB;;eAEe,OAA4D;AACvEC,EAAAA,IAAI,EAAE,4BADiE;AAEvEC,EAAAA,IAAI,EAAE,qCAFiE;AAGvEC,EAAAA,SAAS,EAAE,UAH4D;;AAIvE,QAAMC,WAAN,CAAkB;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAlB,EAAoC;AAChC,UAAM;AAAEL,MAAAA;AAAF,QAAYI,KAAD,CAAwCE,QAAzD;;AACA,QAAI,CAACD,KAAD,IAAU,CAACL,IAAX,IAAmBD,YAAY,CAACQ,QAAb,CAAsBP,IAAtB,CAAvB,EAAoD;AAChD,aAAOK,KAAP;AACH;;AACD,QAAI;AACA,aAAO,IAAIG,IAAJ,CAASH,KAAT,CAAP;AACH,KAFD,CAEE,MAAM;AACJ,aAAOA,KAAP;AACH;AACJ,GAdsE;;AAevE,QAAMI,SAAN,CAAgB;AAAEJ,IAAAA,KAAF;AAASD,IAAAA;AAAT,GAAhB,EAAkC;AAC9B,UAAM;AAAEJ,MAAAA;AAAF,QAAYI,KAAD,CAAwCE,QAAzD;;AACA,QAAI,CAACD,KAAD,IAAU,CAACL,IAAX,IAAmBD,YAAY,CAACQ,QAAb,CAAsBP,IAAtB,CAAvB,EAAoD;AAChD,UAAIK,KAAK,IAAKA,KAAD,CAAgBK,WAA7B,EAA0C;AACtC,eAAQL,KAAD,CAAgBK,WAAhB,EAAP;AACH;;AACD,aAAOL,KAAP;AACH;;AACD,QAAKA,KAAD,CAAeK,WAAnB,EAAgC;AAC5B,aAAQL,KAAD,CAAgBK,WAAhB,EAAP;AACH,KAFD,MAEO,IAAI,OAAOL,KAAP,KAAiB,QAArB,EAA+B;AAClC,aAAOA,KAAP;AACH;;AACD,UAAM,IAAIM,cAAJ,CAAgB,2CAAhB,EAA6D,kBAA7D,EAAiF;AACnFN,MAAAA,KADmF;AAEnFO,MAAAA,OAAO,EAAER,KAAK,CAACQ;AAFoE,KAAjF,CAAN;AAIH;;AAhCsE,CAA5D,C","sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n CmsContentModelDateTimeField,\n CmsModelFieldToStoragePlugin\n} from \"@webiny/api-headless-cms/types\";\n\nconst excludeTypes = [\"time\", \"dateTimeWithTimezone\"];\n\nexport default (): CmsModelFieldToStoragePlugin<Date | string, string> => ({\n type: \"cms-model-field-to-storage\",\n name: \"cms-model-field-to-storage-datetime\",\n fieldType: \"datetime\",\n async fromStorage({ field, value }) {\n const { type } = (field as CmsContentModelDateTimeField).settings;\n if (!value || !type || excludeTypes.includes(type)) {\n return value;\n }\n try {\n return new Date(value);\n } catch {\n return value;\n }\n },\n async toStorage({ value, field }) {\n const { type } = (field as CmsContentModelDateTimeField).settings;\n if (!value || !type || excludeTypes.includes(type)) {\n if (value && (value as Date).toISOString) {\n return (value as Date).toISOString();\n }\n return value as string;\n }\n if ((value as any).toISOString) {\n return (value as Date).toISOString();\n } else if (typeof value === \"string\") {\n return value as string;\n }\n throw new WebinyError(\"Error converting value to a storage type.\", \"TO_STORAGE_ERROR\", {\n value,\n fieldId: field.fieldId\n });\n }\n});\n"],"file":"date.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/dynamoDb/storage/richText.ts"],"names":["transformArray","value","isArray","Array","shouldBeArray","from","k","type","name","fieldType","fromStorage","field","storageValue","WebinyError","fieldId","hasOwnProperty","compression","JSON","stringify","jsonpack","unpack","toStorage","pack"],"mappings":";;;;;;;;;AAAA;;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,KAAD,IAAwC;AAC3D,MAAIC,OAAO,GAAGC,KAAK,CAACD,OAAN,CAAcD,KAAd,CAAd;AACA,QAAMG,aAAa,GAAGH,KAAK,YAAYE,KAAjB,KAA2B,KAA3B,IAAoCD,OAA1D;;AACA,MAAIE,aAAJ,EAAmB;AACfH,IAAAA,KAAK,GAAGE,KAAK,CAACE,IAAN,CAAWJ,KAAX,CAAR;AACAC,IAAAA,OAAO,GAAG,IAAV;AACH;;AACD,MAAI,OAAOD,KAAP,KAAiB,QAAjB,IAA6BC,OAAjC,EAA0C;AACtC,SAAK,MAAMI,CAAX,IAAgBL,KAAhB,EAAuB;AACnBA,MAAAA,KAAK,CAACK,CAAD,CAAL,GAAWN,cAAc,CAACC,KAAK,CAACK,CAAD,CAAN,CAAzB;AACH;AACJ;;AACD,SAAOL,KAAP;AACH,CAbD;;eAee,MAAiE;AAC5E,SAAO;AACHM,IAAAA,IAAI,EAAE,4BADH;AAEHC,IAAAA,IAAI,EAAE,sCAFH;AAGHC,IAAAA,SAAS,EAAE,WAHR;;AAIH,UAAMC,WAAN,CAAkB;AAAEC,MAAAA,KAAF;AAASV,MAAAA,KAAK,EAAEW;AAAhB,KAAlB,EAAkD;AAC9C,UAAI,CAACA,YAAL,EAAmB;AACf,eAAOA,YAAP;AACH,OAFD,MAEO,IAAI,OAAOA,YAAP,KAAwB,QAA5B,EAAsC;AACzC,cAAM,IAAIC,cAAJ,CACD,uEAAsEF,KAAK,CAACG,OAAQ,IADnF,CAAN;AAGH;AACD;AACZ;AACA;AACA;;;AACY,UAAIF,YAAY,CAACG,cAAb,CAA4B,aAA5B,MAA+C,KAAnD,EAA0D;AACtD,eAAOH,YAAP;AACH;;AACD,YAAM;AAAEI,QAAAA,WAAF;AAAef,QAAAA;AAAf,UAAyBW,YAA/B;;AACA,UAAI,CAACI,WAAL,EAAkB;AACd,cAAM,IAAIH,cAAJ,CACD,2DACGF,KAAK,CAACG,OACT,MAAKG,IAAI,CAACC,SAAL,CAAeN,YAAf,CAA6B,GAHjC,EAIF,qBAJE,EAKF;AACIX,UAAAA,KAAK,EAAEW;AADX,SALE,CAAN;AASH;;AACD,UAAII,WAAW,KAAK,UAApB,EAAgC;AAC5B,cAAM,IAAIH,cAAJ,CACD,oEADC,EAEF,mBAFE,EAGF;AACIG,UAAAA;AADJ,SAHE,CAAN;AAOH;;AACD,UAAI;AACA,eAAOG,kBAASC,MAAT,CAAgBnB,KAAhB,CAAP;AACH,OAFD,CAEE,MAAM;AACJ,eAAO,IAAP;AACH;AACJ,KA7CE;;AA8CH,UAAMoB,SAAN,CAAgB;AAAEpB,MAAAA;AAAF,KAAhB,EAA2B;AACvB;AACZ;AACA;AACA;AACY,UAAIA,KAAK,IAAIA,KAAK,CAACc,cAAN,CAAqB,aAArB,MAAwC,IAArD,EAA2D;AACvD,eAAOd,KAAP;AACH;;AACDA,MAAAA,KAAK,GAAGD,cAAc,CAACC,KAAD,CAAtB;AACA,aAAO;AACHe,QAAAA,WAAW,EAAE,UADV;AAEHf,QAAAA,KAAK,EAAEA,KAAK,GAAGkB,kBAASG,IAAT,CAAcrB,KAAd,CAAH,GAA0BA;AAFnC,OAAP;AAIH;;AA3DE,GAAP;AA6DH,C","sourcesContent":["import jsonpack from \"jsonpack\";\nimport WebinyError from \"@webiny/error\";\nimport { CmsModelFieldToStoragePlugin } from \"@webiny/api-headless-cms/types\";\n\nexport type OriginalValue = Record<string, any> | any[];\n\nexport interface StorageValue {\n compression: string;\n value: any;\n}\n\n/**\n * Remove when jsonpack gets PR with a fix merged\n * https://github.com/rgcl/jsonpack/pull/25/files\n * NOTE 2021-07-28: it seems PR is not going to be merged so keep this.\n */\nconst transformArray = (value: Record<string, any> | any[]) => {\n let isArray = Array.isArray(value);\n const shouldBeArray = value instanceof Array === false && isArray;\n if (shouldBeArray) {\n value = Array.from(value as any);\n isArray = true;\n }\n if (typeof value === \"object\" || isArray) {\n for (const k in value) {\n value[k] = transformArray(value[k]);\n }\n }\n return value;\n};\n\nexport default (): CmsModelFieldToStoragePlugin<OriginalValue, StorageValue> => {\n return {\n type: \"cms-model-field-to-storage\",\n name: \"cms-model-field-to-storage-rich-text\",\n fieldType: \"rich-text\",\n async fromStorage({ field, value: storageValue }) {\n if (!storageValue) {\n return storageValue;\n } else if (typeof storageValue !== \"object\") {\n throw new WebinyError(\n `Value received in \"fromStorage\" function is not an object in field \"${field.fieldId}\".`\n );\n }\n /**\n * This is to circumvent a bug introduced with 5.8.0 storage operations.\n * Do not remove.\n */\n if (storageValue.hasOwnProperty(\"compression\") === false) {\n return storageValue;\n }\n const { compression, value } = storageValue;\n if (!compression) {\n throw new WebinyError(\n `Missing compression in \"fromStorage\" function in field \"${\n field.fieldId\n }\": ${JSON.stringify(storageValue)}.`,\n \"MISSING_COMPRESSION\",\n {\n value: storageValue\n }\n );\n }\n if (compression !== \"jsonpack\") {\n throw new WebinyError(\n `This plugin cannot transform something not packed with \"jsonpack\".`,\n \"WRONG_COMPRESSION\",\n {\n compression\n }\n );\n }\n try {\n return jsonpack.unpack(value);\n } catch {\n return null;\n }\n },\n async toStorage({ value }) {\n /**\n * There is a possibility that we are trying to compress already compressed value.\n * Introduced a bug with 5.8.0 storage operations, so just return the value to correct it.\n */\n if (value && value.hasOwnProperty(\"compression\") === true) {\n return value as any;\n }\n value = transformArray(value);\n return {\n compression: \"jsonpack\",\n value: value ? jsonpack.pack(value) : value\n };\n }\n };\n};\n"],"file":"richText.js"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/dynamoDb/transformValue/datetime.ts"],"names":["timeTransformer","TimeTransformPlugin","fields","dateTimeTransformer","DateTimeTransformPlugin","type","name","fieldType","transform","field","value","settings"],"mappings":";;;;;;;AACA;;AACA;;AAEA,MAAMA,eAAe,GAAG,IAAIC,wCAAJ,CAAwB;AAC5CC,EAAAA,MAAM,EAAE,CAAC,GAAD;AADoC,CAAxB,CAAxB;AAGA,MAAMC,mBAAmB,GAAG,IAAIC,gDAAJ,CAA4B;AACpDF,EAAAA,MAAM,EAAE,CAAC,GAAD;AAD4C,CAA5B,CAA5B;;eAIe,OAA2E;AACtFG,EAAAA,IAAI,EAAE,kCADgF;AAEtFC,EAAAA,IAAI,EAAE,2CAFgF;AAGtFC,EAAAA,SAAS,EAAE,UAH2E;;AAItF;AACJ;AACA;AACIC,EAAAA,SAAS,EAAE,CAAC;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAD,KAAsB;AAC7B,UAAM;AAAEL,MAAAA;AAAF,QAAWI,KAAK,CAACE,QAAN,IAAkB,EAAnC;;AACA,QAAIN,IAAI,KAAK,MAAb,EAAqB;AACjB,aAAOL,eAAe,CAACQ,SAAhB,CAA0B;AAC7BE,QAAAA;AAD6B,OAA1B,CAAP;AAGH;;AACD,WAAOP,mBAAmB,CAACK,SAApB,CAA8B;AACjCE,MAAAA;AADiC,KAA9B,CAAP;AAGH;AAjBqF,CAA3E,C","sourcesContent":["import { CmsFieldFilterValueTransformPlugin } from \"~/types\";\nimport { TimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin\";\nimport { DateTimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin\";\n\nconst timeTransformer = new TimeTransformPlugin({\n fields: [\"*\"]\n});\nconst dateTimeTransformer = new DateTimeTransformPlugin({\n fields: [\"*\"]\n});\n\nexport default (): CmsFieldFilterValueTransformPlugin<Date | string | number, number> => ({\n type: \"cms-field-filter-value-transform\",\n name: \"cms-field-value-filter-transform-datetime\",\n fieldType: \"datetime\",\n /**\n * Always transform into the milliseconds.\n */\n transform: ({ field, value }) => {\n const { type } = field.settings || {};\n if (type === \"time\") {\n return timeTransformer.transform({\n value\n });\n }\n return dateTimeTransformer.transform({\n value\n });\n }\n});\n"],"file":"datetime.js"}
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["configuration","entry"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;eAMgBA,aAAD,IAAmC;AAC9C,QAAM;AAAEC,IAAAA;AAAF,MAAYD,aAAa,IAAI,EAAnC;AACA,SAAO,CACH,wBADG,EAEH,sBAFG,EAGH,0BAHG,EAIH,qBAJG,EAKH,oBAAsCC,KAAtC,CALG,EAMH,wBANG,CAAP;AAQH,C","sourcesContent":["import settingsOperationsProvider from \"./operations/settings\";\nimport systemOperationsProvider from \"./operations/system\";\nimport contentModelGroupStorageOperationsProvider from \"./operations/modelGroup\";\nimport contentModelStorageOperationsProvider from \"./operations/model\";\nimport contentEntryStorageOperationsProvider from \"./operations/entry\";\nimport dynamoDbPlugins from \"./dynamoDb\";\nimport { CmsContentEntryConfiguration } from \"./operations/entry/CmsContentEntryDynamo\";\n\ninterface Configuration {\n entry?: CmsContentEntryConfiguration;\n}\nexport default (configuration?: Configuration) => {\n const { entry } = configuration || {};\n return [\n settingsOperationsProvider(),\n systemOperationsProvider(),\n contentModelGroupStorageOperationsProvider(),\n contentModelStorageOperationsProvider(),\n contentEntryStorageOperationsProvider(entry),\n dynamoDbPlugins()\n ];\n};\n"],"file":"index.js"}
@@ -1,86 +0,0 @@
1
- import { CmsContentEntry, CmsContentEntryStorageOperations, CmsContentEntryStorageOperationsCreateArgs, CmsContentEntryStorageOperationsCreateRevisionFromArgs, CmsContentEntryStorageOperationsDeleteArgs, CmsContentEntryStorageOperationsDeleteRevisionArgs, CmsContentEntryStorageOperationsGetArgs, CmsContentEntryStorageOperationsListArgs, CmsContentEntryStorageOperationsListResponse, CmsContentEntryStorageOperationsPublishArgs, CmsContentEntryStorageOperationsRequestChangesArgs, CmsContentEntryStorageOperationsRequestReviewArgs, CmsContentEntryStorageOperationsUnpublishArgs, CmsContentEntryStorageOperationsUpdateArgs, CmsContentModel, CmsContext } from "@webiny/api-headless-cms/types";
2
- import { Entity, Table } from "dynamodb-toolbox";
3
- import { queryOptions as DynamoDBToolboxQueryOptions } from "dynamodb-toolbox/dist/classes/Table";
4
- export declare const TYPE_ENTRY = "cms.entry";
5
- export declare const TYPE_ENTRY_LATEST: string;
6
- export declare const TYPE_ENTRY_PUBLISHED: string;
7
- export interface CmsContentEntryConfiguration {
8
- defaultLimit?: number;
9
- maxLimit?: number;
10
- }
11
- interface ConstructorArgs {
12
- context: CmsContext;
13
- configuration: CmsContentEntryConfiguration;
14
- }
15
- interface RunQueryArgs {
16
- options?: DynamoDBToolboxQueryOptions;
17
- partitionKey: string;
18
- }
19
- /**
20
- * We do not use transactions in this storage operations implementation due to their cost.
21
- */
22
- export declare class CmsContentEntryDynamo implements CmsContentEntryStorageOperations {
23
- private readonly _context;
24
- private readonly _configuration;
25
- private readonly _modelPartitionKey;
26
- private readonly _dataLoaders;
27
- private readonly _table;
28
- private readonly _entity;
29
- private get context();
30
- private get configuration();
31
- get table(): Table;
32
- get entity(): Entity<any>;
33
- constructor({ context, configuration }: ConstructorArgs);
34
- create(model: CmsContentModel, args: CmsContentEntryStorageOperationsCreateArgs): Promise<CmsContentEntry>;
35
- createRevisionFrom(model: CmsContentModel, args: CmsContentEntryStorageOperationsCreateRevisionFromArgs): Promise<import("@webiny/api-headless-cms/types").CmsStorageContentEntry>;
36
- delete(model: CmsContentModel, args: CmsContentEntryStorageOperationsDeleteArgs): Promise<void>;
37
- deleteRevision(model: CmsContentModel, args: CmsContentEntryStorageOperationsDeleteRevisionArgs): Promise<void>;
38
- get(model: CmsContentModel, args: CmsContentEntryStorageOperationsGetArgs): Promise<CmsContentEntry | null>;
39
- list(model: CmsContentModel, args: CmsContentEntryStorageOperationsListArgs): Promise<CmsContentEntryStorageOperationsListResponse>;
40
- update(model: CmsContentModel, args: CmsContentEntryStorageOperationsUpdateArgs): Promise<CmsContentEntry>;
41
- publish(model: CmsContentModel, args: CmsContentEntryStorageOperationsPublishArgs): Promise<CmsContentEntry>;
42
- unpublish(model: CmsContentModel, args: CmsContentEntryStorageOperationsUnpublishArgs): Promise<CmsContentEntry>;
43
- requestChanges(model: CmsContentModel, args: CmsContentEntryStorageOperationsRequestChangesArgs): Promise<CmsContentEntry>;
44
- requestReview(model: CmsContentModel, args: CmsContentEntryStorageOperationsRequestReviewArgs): Promise<CmsContentEntry>;
45
- getAllRevisionsByIds(model: CmsContentModel, ids: readonly string[]): Promise<CmsContentEntry[]>;
46
- getByIds(model: CmsContentModel, ids: readonly string[]): Promise<CmsContentEntry[]>;
47
- getPublishedByIds(model: CmsContentModel, ids: readonly string[]): Promise<CmsContentEntry[]>;
48
- getLatestByIds(model: CmsContentModel, ids: readonly string[]): Promise<CmsContentEntry[]>;
49
- getRevisions(model: CmsContentModel, id: string): Promise<CmsContentEntry[]>;
50
- getRevisionById(model: CmsContentModel, id: string): Promise<CmsContentEntry | null>;
51
- getPublishedRevisionByEntryId(model: CmsContentModel, entryId: string): Promise<CmsContentEntry | null>;
52
- getLatestRevisionByEntryId(model: CmsContentModel, entryId: string): Promise<CmsContentEntry | null>;
53
- getPreviousRevision(model: CmsContentModel, entryId: string, version: number): Promise<CmsContentEntry | null>;
54
- private getSingleDynamoDbItem;
55
- getPartitionKey(id: string): string;
56
- private get partitionKey();
57
- private getGSIPartitionKey;
58
- private getGSIEntryPartitionKey;
59
- private getGSILatestPartitionKey;
60
- private getGSIPublishedPartitionKey;
61
- private getGSISortKey;
62
- /**
63
- * Gets a secondary key in form of REV#version from:
64
- * id#0003
65
- * 0003
66
- * 3
67
- */
68
- getSortKeyRevision(version: string | number): string;
69
- getSortKeyLatest(): string;
70
- getSortKeyPublished(): string;
71
- /**
72
- * Method to build the query partition keys, always an array, and create the target index:
73
- * - if undefined then it is primary
74
- * - if populated then it is that given one (and partition keys are reflecting that)
75
- */
76
- private createQueryOptions;
77
- /**
78
- * A method to query the database at the given partition key with the built query options.
79
- * Method runs in the loop until it reads everything it needs to.
80
- * We could impose the limit on the records read but there is no point since we MUST read everything to be able
81
- * to filter and sort the data.
82
- */
83
- runQuery(args: RunQueryArgs): Promise<CmsContentEntry[]>;
84
- private query;
85
- }
86
- export {};