@webiny/api-headless-cms-ddb 5.17.4-beta.1 → 5.18.0-beta.2
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.
- package/definitions/entry.d.ts +6 -4
- package/definitions/entry.js +19 -8
- package/definitions/group.d.ts +8 -0
- package/definitions/group.js +74 -0
- package/definitions/model.d.ts +8 -0
- package/definitions/model.js +96 -0
- package/definitions/settings.d.ts +8 -0
- package/definitions/settings.js +62 -0
- package/definitions/system.d.ts +8 -0
- package/definitions/system.js +50 -0
- package/definitions/table.d.ts +6 -12
- package/definitions/table.js +15 -15
- package/dynamoDb/index.d.ts +1 -1
- package/dynamoDb/index.js +4 -3
- package/dynamoDb/path/plainObject.js +1 -2
- package/dynamoDb/path/ref.js +1 -2
- package/dynamoDb/storage/date.d.ts +2 -2
- package/dynamoDb/storage/date.js +17 -21
- package/dynamoDb/storage/longText.d.ts +7 -0
- package/dynamoDb/storage/longText.js +83 -0
- package/dynamoDb/storage/richText.d.ts +2 -2
- package/dynamoDb/storage/richText.js +69 -67
- package/dynamoDb/transformValue/datetime.d.ts +1 -1
- package/dynamoDb/transformValue/datetime.js +1 -2
- package/index.d.ts +2 -6
- package/index.js +108 -13
- package/operations/entry/dataLoaders.d.ts +34 -19
- package/operations/entry/dataLoaders.js +158 -138
- package/operations/entry/index.d.ts +8 -4
- package/operations/entry/index.js +812 -16
- package/operations/entry/keys.d.ts +25 -0
- package/operations/entry/keys.js +62 -0
- package/operations/entry/systemFields.d.ts +2 -2
- package/operations/entry/systemFields.js +1 -2
- package/operations/entry/utils.d.ts +13 -9
- package/operations/entry/utils.js +62 -18
- package/operations/group/index.d.ts +8 -0
- package/operations/group/index.js +198 -0
- package/operations/model/index.d.ts +6 -3
- package/operations/model/index.js +153 -18
- package/operations/settings/index.d.ts +6 -3
- package/operations/settings/index.js +132 -16
- package/operations/system/index.d.ts +6 -3
- package/operations/system/index.js +94 -14
- package/package.json +11 -11
- package/types.d.ts +38 -8
- package/types.js +11 -1
- package/configurations.d.ts +0 -18
- package/configurations.js +0 -24
- package/configurations.js.map +0 -1
- package/definitions/entry.js.map +0 -1
- package/definitions/table.js.map +0 -1
- package/dynamoDb/index.js.map +0 -1
- package/dynamoDb/path/plainObject.js.map +0 -1
- package/dynamoDb/path/ref.js.map +0 -1
- package/dynamoDb/storage/date.js.map +0 -1
- package/dynamoDb/storage/richText.js.map +0 -1
- package/dynamoDb/transformValue/datetime.js.map +0 -1
- package/index.js.map +0 -1
- package/operations/entry/CmsContentEntryDynamo.d.ts +0 -86
- package/operations/entry/CmsContentEntryDynamo.js +0 -972
- package/operations/entry/CmsContentEntryDynamo.js.map +0 -1
- package/operations/entry/dataLoaders.js.map +0 -1
- package/operations/entry/index.js.map +0 -1
- package/operations/entry/systemFields.js.map +0 -1
- package/operations/entry/utils.js.map +0 -1
- package/operations/helpers.d.ts +0 -5
- package/operations/helpers.js +0 -96
- package/operations/helpers.js.map +0 -1
- package/operations/model/CmsContentModelDynamo.d.ts +0 -18
- package/operations/model/CmsContentModelDynamo.js +0 -234
- package/operations/model/CmsContentModelDynamo.js.map +0 -1
- package/operations/model/index.js.map +0 -1
- package/operations/modelGroup/CmsContentModelGroupDynamo.d.ts +0 -42
- package/operations/modelGroup/CmsContentModelGroupDynamo.js +0 -230
- package/operations/modelGroup/CmsContentModelGroupDynamo.js.map +0 -1
- package/operations/modelGroup/index.d.ts +0 -3
- package/operations/modelGroup/index.js +0 -26
- package/operations/modelGroup/index.js.map +0 -1
- package/operations/settings/CmsSettingsDynamo.d.ts +0 -16
- package/operations/settings/CmsSettingsDynamo.js +0 -145
- package/operations/settings/CmsSettingsDynamo.js.map +0 -1
- package/operations/settings/index.js.map +0 -1
- package/operations/system/CmsSystemDynamo.d.ts +0 -16
- package/operations/system/CmsSystemDynamo.js +0 -126
- package/operations/system/CmsSystemDynamo.js.map +0 -1
- package/operations/system/index.js.map +0 -1
- package/types.js.map +0 -1
- package/utils.d.ts +0 -5
- package/utils.js +0 -62
- package/utils.js.map +0 -1
package/definitions/entry.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Entity, Table } from "dynamodb-toolbox";
|
|
2
|
+
import { Attributes } from "../types";
|
|
3
|
+
export interface Params {
|
|
3
4
|
table: Table;
|
|
5
|
+
entityName: string;
|
|
6
|
+
attributes: Attributes;
|
|
4
7
|
}
|
|
5
|
-
export declare const createEntryEntity: (
|
|
6
|
-
export {};
|
|
8
|
+
export declare const createEntryEntity: (params: Params) => Entity<any>;
|
package/definitions/entry.js
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.createEntryEntity = void 0;
|
|
7
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
8
12
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
11
17
|
|
|
12
|
-
const createEntryEntity =
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
const createEntryEntity = params => {
|
|
19
|
+
const {
|
|
20
|
+
table,
|
|
21
|
+
entityName,
|
|
22
|
+
attributes
|
|
23
|
+
} = params;
|
|
15
24
|
return new _dynamodbToolbox.Entity({
|
|
16
25
|
name: entityName,
|
|
17
26
|
table,
|
|
18
|
-
attributes: {
|
|
27
|
+
attributes: _objectSpread({
|
|
19
28
|
PK: {
|
|
20
29
|
type: "string",
|
|
21
30
|
partitionKey: true
|
|
@@ -33,6 +42,9 @@ const createEntryEntity = ({
|
|
|
33
42
|
TYPE: {
|
|
34
43
|
type: "string"
|
|
35
44
|
},
|
|
45
|
+
__type: {
|
|
46
|
+
type: "string"
|
|
47
|
+
},
|
|
36
48
|
webinyVersion: {
|
|
37
49
|
type: "string"
|
|
38
50
|
},
|
|
@@ -78,9 +90,8 @@ const createEntryEntity = ({
|
|
|
78
90
|
values: {
|
|
79
91
|
type: "map"
|
|
80
92
|
}
|
|
81
|
-
}
|
|
93
|
+
}, attributes || {})
|
|
82
94
|
});
|
|
83
95
|
};
|
|
84
96
|
|
|
85
|
-
exports.createEntryEntity = createEntryEntity;
|
|
86
|
-
//# sourceMappingURL=entry.js.map
|
|
97
|
+
exports.createEntryEntity = createEntryEntity;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createGroupEntity = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
const createGroupEntity = params => {
|
|
19
|
+
const {
|
|
20
|
+
table,
|
|
21
|
+
attributes,
|
|
22
|
+
entityName
|
|
23
|
+
} = params;
|
|
24
|
+
return new _dynamodbToolbox.Entity({
|
|
25
|
+
name: entityName,
|
|
26
|
+
table,
|
|
27
|
+
attributes: _objectSpread({
|
|
28
|
+
PK: {
|
|
29
|
+
partitionKey: true
|
|
30
|
+
},
|
|
31
|
+
SK: {
|
|
32
|
+
sortKey: true
|
|
33
|
+
},
|
|
34
|
+
TYPE: {
|
|
35
|
+
type: "string"
|
|
36
|
+
},
|
|
37
|
+
webinyVersion: {
|
|
38
|
+
type: "string"
|
|
39
|
+
},
|
|
40
|
+
id: {
|
|
41
|
+
type: "string"
|
|
42
|
+
},
|
|
43
|
+
name: {
|
|
44
|
+
type: "string"
|
|
45
|
+
},
|
|
46
|
+
slug: {
|
|
47
|
+
type: "string"
|
|
48
|
+
},
|
|
49
|
+
locale: {
|
|
50
|
+
type: "string"
|
|
51
|
+
},
|
|
52
|
+
description: {
|
|
53
|
+
type: "string"
|
|
54
|
+
},
|
|
55
|
+
icon: {
|
|
56
|
+
type: "string"
|
|
57
|
+
},
|
|
58
|
+
createdBy: {
|
|
59
|
+
type: "map"
|
|
60
|
+
},
|
|
61
|
+
createdOn: {
|
|
62
|
+
type: "string"
|
|
63
|
+
},
|
|
64
|
+
savedOn: {
|
|
65
|
+
type: "string"
|
|
66
|
+
},
|
|
67
|
+
tenant: {
|
|
68
|
+
type: "string"
|
|
69
|
+
}
|
|
70
|
+
}, attributes || {})
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
exports.createGroupEntity = createGroupEntity;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createModelEntity = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
const createModelEntity = params => {
|
|
19
|
+
const {
|
|
20
|
+
table,
|
|
21
|
+
attributes,
|
|
22
|
+
entityName
|
|
23
|
+
} = params;
|
|
24
|
+
return new _dynamodbToolbox.Entity({
|
|
25
|
+
name: entityName,
|
|
26
|
+
table,
|
|
27
|
+
attributes: _objectSpread({
|
|
28
|
+
PK: {
|
|
29
|
+
partitionKey: true
|
|
30
|
+
},
|
|
31
|
+
SK: {
|
|
32
|
+
sortKey: true
|
|
33
|
+
},
|
|
34
|
+
TYPE: {
|
|
35
|
+
type: "string",
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
webinyVersion: {
|
|
39
|
+
type: "string",
|
|
40
|
+
required: true
|
|
41
|
+
},
|
|
42
|
+
name: {
|
|
43
|
+
type: "string",
|
|
44
|
+
required: true
|
|
45
|
+
},
|
|
46
|
+
modelId: {
|
|
47
|
+
type: "string",
|
|
48
|
+
required: true
|
|
49
|
+
},
|
|
50
|
+
locale: {
|
|
51
|
+
type: "string",
|
|
52
|
+
required: true
|
|
53
|
+
},
|
|
54
|
+
group: {
|
|
55
|
+
type: "map",
|
|
56
|
+
required: true
|
|
57
|
+
},
|
|
58
|
+
description: {
|
|
59
|
+
type: "string"
|
|
60
|
+
},
|
|
61
|
+
createdOn: {
|
|
62
|
+
type: "string",
|
|
63
|
+
required: true
|
|
64
|
+
},
|
|
65
|
+
savedOn: {
|
|
66
|
+
type: "string",
|
|
67
|
+
required: true
|
|
68
|
+
},
|
|
69
|
+
createdBy: {
|
|
70
|
+
type: "map",
|
|
71
|
+
required: true
|
|
72
|
+
},
|
|
73
|
+
fields: {
|
|
74
|
+
type: "list",
|
|
75
|
+
required: true
|
|
76
|
+
},
|
|
77
|
+
layout: {
|
|
78
|
+
type: "list",
|
|
79
|
+
required: true
|
|
80
|
+
},
|
|
81
|
+
lockedFields: {
|
|
82
|
+
type: "list",
|
|
83
|
+
required: true
|
|
84
|
+
},
|
|
85
|
+
titleFieldId: {
|
|
86
|
+
type: "string"
|
|
87
|
+
},
|
|
88
|
+
tenant: {
|
|
89
|
+
type: "string",
|
|
90
|
+
required: true
|
|
91
|
+
}
|
|
92
|
+
}, attributes || {})
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
exports.createModelEntity = createModelEntity;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createSettingsEntity = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
const createSettingsEntity = params => {
|
|
19
|
+
const {
|
|
20
|
+
entityName,
|
|
21
|
+
table,
|
|
22
|
+
attributes
|
|
23
|
+
} = params;
|
|
24
|
+
return new _dynamodbToolbox.Entity({
|
|
25
|
+
name: entityName,
|
|
26
|
+
table,
|
|
27
|
+
attributes: _objectSpread({
|
|
28
|
+
PK: {
|
|
29
|
+
partitionKey: true
|
|
30
|
+
},
|
|
31
|
+
SK: {
|
|
32
|
+
sortKey: true
|
|
33
|
+
},
|
|
34
|
+
TYPE: {
|
|
35
|
+
type: "string"
|
|
36
|
+
},
|
|
37
|
+
key: {
|
|
38
|
+
type: "string"
|
|
39
|
+
},
|
|
40
|
+
uploadMinFileSize: {
|
|
41
|
+
type: "number"
|
|
42
|
+
},
|
|
43
|
+
uploadMaxFileSize: {
|
|
44
|
+
type: "number"
|
|
45
|
+
},
|
|
46
|
+
srcPrefix: {
|
|
47
|
+
type: "string"
|
|
48
|
+
},
|
|
49
|
+
contentModelLastChange: {
|
|
50
|
+
type: "string"
|
|
51
|
+
},
|
|
52
|
+
tenant: {
|
|
53
|
+
type: "string"
|
|
54
|
+
},
|
|
55
|
+
locale: {
|
|
56
|
+
type: "string"
|
|
57
|
+
}
|
|
58
|
+
}, attributes || {})
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
exports.createSettingsEntity = createSettingsEntity;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createSystemEntity = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
const createSystemEntity = params => {
|
|
19
|
+
const {
|
|
20
|
+
entityName,
|
|
21
|
+
attributes,
|
|
22
|
+
table
|
|
23
|
+
} = params;
|
|
24
|
+
return new _dynamodbToolbox.Entity({
|
|
25
|
+
name: entityName,
|
|
26
|
+
table,
|
|
27
|
+
attributes: _objectSpread({
|
|
28
|
+
PK: {
|
|
29
|
+
partitionKey: true
|
|
30
|
+
},
|
|
31
|
+
SK: {
|
|
32
|
+
sortKey: true
|
|
33
|
+
},
|
|
34
|
+
version: {
|
|
35
|
+
type: "string"
|
|
36
|
+
},
|
|
37
|
+
locale: {
|
|
38
|
+
type: "string"
|
|
39
|
+
},
|
|
40
|
+
tenant: {
|
|
41
|
+
type: "string"
|
|
42
|
+
},
|
|
43
|
+
readAPIKey: {
|
|
44
|
+
type: "string"
|
|
45
|
+
}
|
|
46
|
+
}, attributes || {})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.createSystemEntity = createSystemEntity;
|
package/definitions/table.d.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableModifier } from "../types";
|
|
2
|
+
import { DocumentClient } from "aws-sdk/clients/dynamodb";
|
|
2
3
|
import { Table } from "dynamodb-toolbox";
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export interface Params {
|
|
5
|
+
table?: TableModifier;
|
|
6
|
+
documentClient: DocumentClient;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
context: CmsContext;
|
|
9
|
-
indexes: {
|
|
10
|
-
[key: string]: IndexParams;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export declare const createTable: ({ context, indexes }: Params) => Table;
|
|
14
|
-
export {};
|
|
8
|
+
export declare const createTable: ({ table, documentClient }: Params) => Table;
|
package/definitions/table.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -9,22 +7,24 @@ exports.createTable = void 0;
|
|
|
9
7
|
|
|
10
8
|
var _dynamodbToolbox = require("dynamodb-toolbox");
|
|
11
9
|
|
|
12
|
-
var _configurations = _interopRequireDefault(require("../configurations"));
|
|
13
|
-
|
|
14
|
-
var _helpers = require("../operations/helpers");
|
|
15
|
-
|
|
16
10
|
const createTable = ({
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
table,
|
|
12
|
+
documentClient
|
|
19
13
|
}) => {
|
|
20
|
-
|
|
21
|
-
name:
|
|
14
|
+
const tableConfig = {
|
|
15
|
+
name: process.env.DB_TABLE_HEADLESS_CMS || process.env.DB_TABLE,
|
|
22
16
|
partitionKey: "PK",
|
|
23
17
|
sortKey: "SK",
|
|
24
|
-
DocumentClient:
|
|
25
|
-
indexes
|
|
26
|
-
|
|
18
|
+
DocumentClient: documentClient,
|
|
19
|
+
indexes: {
|
|
20
|
+
GSI1: {
|
|
21
|
+
partitionKey: "GSI1_PK",
|
|
22
|
+
sortKey: "GSI1_SK"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const config = typeof table === "function" ? table(tableConfig) : tableConfig;
|
|
27
|
+
return new _dynamodbToolbox.Table(config);
|
|
27
28
|
};
|
|
28
29
|
|
|
29
|
-
exports.createTable = createTable;
|
|
30
|
-
//# sourceMappingURL=table.js.map
|
|
30
|
+
exports.createTable = createTable;
|
package/dynamoDb/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: () => (import("
|
|
1
|
+
declare const _default: () => (import("@webiny/api-headless-cms").StorageTransformPlugin<any, any> | import("../types").CmsFieldFilterValueTransformPlugin | import("../types").CmsFieldFilterPathPlugin)[];
|
|
2
2
|
export default _default;
|
package/dynamoDb/index.js
CHANGED
|
@@ -9,6 +9,8 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _richText = _interopRequireDefault(require("./storage/richText"));
|
|
11
11
|
|
|
12
|
+
var _longText = _interopRequireDefault(require("./storage/longText"));
|
|
13
|
+
|
|
12
14
|
var _date = _interopRequireDefault(require("./storage/date"));
|
|
13
15
|
|
|
14
16
|
var _plainObject = _interopRequireDefault(require("./path/plainObject"));
|
|
@@ -17,7 +19,6 @@ var _ref = _interopRequireDefault(require("./path/ref"));
|
|
|
17
19
|
|
|
18
20
|
var _datetime = _interopRequireDefault(require("./transformValue/datetime"));
|
|
19
21
|
|
|
20
|
-
var _default = () => [(0, _richText.default)(), (0, _date.default)(), (0, _plainObject.default)(), (0, _ref.default)(), (0, _datetime.default)()];
|
|
22
|
+
var _default = () => [(0, _richText.default)(), (0, _longText.default)(), (0, _date.default)(), (0, _plainObject.default)(), (0, _ref.default)(), (0, _datetime.default)()];
|
|
21
23
|
|
|
22
|
-
exports.default = _default;
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
24
|
+
exports.default = _default;
|
package/dynamoDb/path/ref.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const _default: () =>
|
|
1
|
+
import { StorageTransformPlugin } from "@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin";
|
|
2
|
+
declare const _default: () => StorageTransformPlugin<any, any>;
|
|
3
3
|
export default _default;
|
package/dynamoDb/storage/date.js
CHANGED
|
@@ -9,20 +9,18 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
var _StorageTransformPlugin = require("@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin");
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
name: "cms-model-field-to-storage-datetime",
|
|
14
|
+
const excludeTypes = ["time", "dateTimeWithTimezone"];
|
|
15
|
+
const plugin = new _StorageTransformPlugin.StorageTransformPlugin({
|
|
17
16
|
fieldType: "datetime",
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
field
|
|
21
|
-
|
|
22
|
-
}) {
|
|
17
|
+
fromStorage: async ({
|
|
18
|
+
value,
|
|
19
|
+
field
|
|
20
|
+
}) => {
|
|
23
21
|
const {
|
|
24
22
|
type
|
|
25
|
-
} = field.settings;
|
|
23
|
+
} = field.settings || {};
|
|
26
24
|
|
|
27
25
|
if (!value || !type || excludeTypes.includes(type)) {
|
|
28
26
|
return value;
|
|
@@ -31,23 +29,19 @@ var _default = () => ({
|
|
|
31
29
|
try {
|
|
32
30
|
return new Date(value);
|
|
33
31
|
} catch {
|
|
32
|
+
console.log(`Could not transform from storage for field type`);
|
|
34
33
|
return value;
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
|
-
|
|
38
|
-
async toStorage({
|
|
36
|
+
toStorage: async ({
|
|
39
37
|
value,
|
|
40
38
|
field
|
|
41
|
-
}) {
|
|
39
|
+
}) => {
|
|
42
40
|
const {
|
|
43
41
|
type
|
|
44
|
-
} = field.settings;
|
|
42
|
+
} = field.settings || {};
|
|
45
43
|
|
|
46
44
|
if (!value || !type || excludeTypes.includes(type)) {
|
|
47
|
-
if (value && value.toISOString) {
|
|
48
|
-
return value.toISOString();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
45
|
return value;
|
|
52
46
|
}
|
|
53
47
|
|
|
@@ -62,8 +56,10 @@ var _default = () => ({
|
|
|
62
56
|
fieldId: field.fieldId
|
|
63
57
|
});
|
|
64
58
|
}
|
|
65
|
-
|
|
66
59
|
});
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
var _default = () => {
|
|
62
|
+
return plugin;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
exports.default = _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StorageTransformPlugin } from "@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin";
|
|
2
|
+
export interface StorageValue {
|
|
3
|
+
compression: string;
|
|
4
|
+
value: any;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: () => StorageTransformPlugin<string, StorageValue>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
+
|
|
12
|
+
var _gzip = require("@webiny/utils/compression/gzip");
|
|
13
|
+
|
|
14
|
+
var _StorageTransformPlugin = require("@webiny/api-headless-cms/content/plugins/storage/StorageTransformPlugin");
|
|
15
|
+
|
|
16
|
+
const GZIP = "gzip";
|
|
17
|
+
const TO_STORAGE_ENCODING = "base64";
|
|
18
|
+
const FROM_STORAGE_ENCODING = "utf8";
|
|
19
|
+
|
|
20
|
+
const convertToBuffer = value => {
|
|
21
|
+
if (typeof value === "string") {
|
|
22
|
+
return Buffer.from(value, TO_STORAGE_ENCODING);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return value;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const plugin = new _StorageTransformPlugin.StorageTransformPlugin({
|
|
29
|
+
fieldType: "long-text",
|
|
30
|
+
fromStorage: async ({
|
|
31
|
+
field,
|
|
32
|
+
value: storageValue
|
|
33
|
+
}) => {
|
|
34
|
+
const typeOf = typeof storageValue;
|
|
35
|
+
|
|
36
|
+
if (!storageValue || typeOf === "string" || typeOf === "number") {
|
|
37
|
+
return storageValue;
|
|
38
|
+
} else if (typeof storageValue !== "object") {
|
|
39
|
+
throw new _error.default(`LongText value received in "fromStorage" function is not an object in field "${field.fieldId}".`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
compression,
|
|
44
|
+
value
|
|
45
|
+
} = storageValue;
|
|
46
|
+
/**
|
|
47
|
+
* Check if possibly undefined, null, empty...
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
if (!compression) {
|
|
51
|
+
throw new _error.default(`Missing compression in "fromStorage" function in field "${field.fieldId}": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
|
|
52
|
+
value: storageValue
|
|
53
|
+
});
|
|
54
|
+
} else if (compression !== GZIP) {
|
|
55
|
+
throw new _error.default(`This plugin cannot transform something not compressed with "GZIP".`, "WRONG_COMPRESSION", {
|
|
56
|
+
compression
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const buf = await (0, _gzip.decompress)(convertToBuffer(value));
|
|
62
|
+
return buf.toString(FROM_STORAGE_ENCODING);
|
|
63
|
+
} catch (ex) {
|
|
64
|
+
console.log(ex.message);
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
toStorage: async ({
|
|
69
|
+
value
|
|
70
|
+
}) => {
|
|
71
|
+
const compressedValue = await (0, _gzip.compress)(value);
|
|
72
|
+
return {
|
|
73
|
+
compression: GZIP,
|
|
74
|
+
value: compressedValue.toString(TO_STORAGE_ENCODING)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
var _default = () => {
|
|
80
|
+
return plugin;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.default = _default;
|