@webiny/api-headless-cms-ddb 5.19.0-beta.2 → 5.19.0-beta.6
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/operations/entry/index.js +1 -1
- package/operations/entry/keys.js +11 -0
- package/operations/model/index.js +11 -4
- package/package.json +10 -10
|
@@ -704,7 +704,7 @@ const createEntriesStorageOperations = params => {
|
|
|
704
704
|
})));
|
|
705
705
|
}
|
|
706
706
|
|
|
707
|
-
if (publishedStorageEntry) {
|
|
707
|
+
if (publishedStorageEntry && publishedStorageEntry.id !== entry.id) {
|
|
708
708
|
items.push(entity.putBatch(_objectSpread(_objectSpread({}, publishedStorageEntry), {}, {
|
|
709
709
|
PK: partitionKey,
|
|
710
710
|
SK: (0, _keys.createRevisionSortKey)(publishedStorageEntry),
|
package/operations/entry/keys.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
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
|
});
|
|
@@ -7,11 +9,20 @@ exports.createRevisionSortKey = exports.createPublishedSortKey = exports.createP
|
|
|
7
9
|
|
|
8
10
|
var _utils = require("@webiny/utils");
|
|
9
11
|
|
|
12
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
+
|
|
10
14
|
const createBasePartitionKey = params => {
|
|
11
15
|
const {
|
|
12
16
|
tenant,
|
|
13
17
|
locale
|
|
14
18
|
} = params;
|
|
19
|
+
|
|
20
|
+
if (!tenant) {
|
|
21
|
+
throw new _error.default(`Missing tenant variable when creating entry basePartitionKey`);
|
|
22
|
+
} else if (!locale) {
|
|
23
|
+
throw new _error.default(`Missing tenant variable when creating entry basePartitionKey`);
|
|
24
|
+
}
|
|
25
|
+
|
|
15
26
|
return `T#${tenant}#L#${locale}#CMS#CME`;
|
|
16
27
|
};
|
|
17
28
|
|
|
@@ -26,6 +26,13 @@ const createPartitionKey = params => {
|
|
|
26
26
|
tenant,
|
|
27
27
|
locale
|
|
28
28
|
} = params;
|
|
29
|
+
|
|
30
|
+
if (!tenant) {
|
|
31
|
+
throw new _error.default(`Missing tenant variable when creating model partitionKey.`);
|
|
32
|
+
} else if (!locale) {
|
|
33
|
+
throw new _error.default(`Missing locale variable when creating model partitionKey.`);
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
return `T#${tenant}#L#${locale}#CMS#CM`;
|
|
30
37
|
};
|
|
31
38
|
|
|
@@ -82,7 +89,7 @@ const createModelsStorageOperations = params => {
|
|
|
82
89
|
}));
|
|
83
90
|
return model;
|
|
84
91
|
} catch (ex) {
|
|
85
|
-
throw new _error.default(ex.
|
|
92
|
+
throw new _error.default(ex.message || "Could not update model.", ex.code || "MODEL_UPDATE_ERROR", {
|
|
86
93
|
error: ex,
|
|
87
94
|
model,
|
|
88
95
|
original,
|
|
@@ -101,7 +108,7 @@ const createModelsStorageOperations = params => {
|
|
|
101
108
|
await entity.delete(keys);
|
|
102
109
|
return model;
|
|
103
110
|
} catch (ex) {
|
|
104
|
-
throw new _error.default(ex.
|
|
111
|
+
throw new _error.default(ex.message || "Could not delete model.", ex.code || "MODEL_DELETE_ERROR", {
|
|
105
112
|
error: ex,
|
|
106
113
|
model,
|
|
107
114
|
keys
|
|
@@ -119,7 +126,7 @@ const createModelsStorageOperations = params => {
|
|
|
119
126
|
});
|
|
120
127
|
return (0, _cleanup.cleanupItem)(entity, item);
|
|
121
128
|
} catch (ex) {
|
|
122
|
-
throw new _error.default(ex.
|
|
129
|
+
throw new _error.default(ex.message || "Could not get model.", ex.code || "MODEL_GET_ERROR", {
|
|
123
130
|
error: ex,
|
|
124
131
|
keys
|
|
125
132
|
});
|
|
@@ -142,7 +149,7 @@ const createModelsStorageOperations = params => {
|
|
|
142
149
|
const items = await (0, _query.queryAll)(queryAllParams);
|
|
143
150
|
return (0, _cleanup.cleanupItems)(entity, items);
|
|
144
151
|
} catch (ex) {
|
|
145
|
-
throw new _error.default(ex.
|
|
152
|
+
throw new _error.default(ex.message || "Could not list models.", ex.code || "MODEL_LIST_ERROR", {
|
|
146
153
|
error: ex,
|
|
147
154
|
partitionKey: queryAllParams.partitionKey
|
|
148
155
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-ddb",
|
|
3
|
-
"version": "5.19.0-beta.
|
|
3
|
+
"version": "5.19.0-beta.6",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"@webiny/api-headless-cms",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@babel/runtime": "7.16.3",
|
|
25
|
-
"@webiny/api-headless-cms": "5.19.0-beta.
|
|
26
|
-
"@webiny/db-dynamodb": "5.19.0-beta.
|
|
27
|
-
"@webiny/error": "5.19.0-beta.
|
|
28
|
-
"@webiny/handler-db": "5.19.0-beta.
|
|
29
|
-
"@webiny/utils": "5.19.0-beta.
|
|
25
|
+
"@webiny/api-headless-cms": "5.19.0-beta.6",
|
|
26
|
+
"@webiny/db-dynamodb": "5.19.0-beta.6",
|
|
27
|
+
"@webiny/error": "5.19.0-beta.6",
|
|
28
|
+
"@webiny/handler-db": "5.19.0-beta.6",
|
|
29
|
+
"@webiny/utils": "5.19.0-beta.6",
|
|
30
30
|
"aws-sdk": "2.1032.0",
|
|
31
31
|
"dataloader": "2.0.0",
|
|
32
32
|
"dot-prop": "5.3.0",
|
|
@@ -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.19.0-beta.
|
|
44
|
-
"@webiny/plugins": "^5.19.0-beta.
|
|
45
|
-
"@webiny/project-utils": "^5.19.0-beta.
|
|
43
|
+
"@webiny/cli": "^5.19.0-beta.6",
|
|
44
|
+
"@webiny/plugins": "^5.19.0-beta.6",
|
|
45
|
+
"@webiny/project-utils": "^5.19.0-beta.6",
|
|
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": "
|
|
60
|
+
"gitHead": "703856f6067cde3dd2894023f5bba3aaedbf7937"
|
|
61
61
|
}
|