@webiny/api-headless-cms-ddb-es 5.19.0-beta.4 → 5.19.1-beta.0
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/model/index.js +26 -5
- package/package.json +15 -15
|
@@ -126,7 +126,7 @@ const createModelsStorageOperations = params => {
|
|
|
126
126
|
}));
|
|
127
127
|
return model;
|
|
128
128
|
} catch (ex) {
|
|
129
|
-
throw new _error.default(ex.
|
|
129
|
+
throw new _error.default(ex.message || "Could not update model.", ex.code || "MODEL_UPDATE_ERROR", {
|
|
130
130
|
error: ex,
|
|
131
131
|
model,
|
|
132
132
|
original,
|
|
@@ -143,14 +143,35 @@ const createModelsStorageOperations = params => {
|
|
|
143
143
|
|
|
144
144
|
try {
|
|
145
145
|
await entity.delete(keys);
|
|
146
|
-
return model;
|
|
147
146
|
} catch (ex) {
|
|
148
|
-
throw new _error.default(ex.
|
|
147
|
+
throw new _error.default(ex.message || "Could not delete model.", ex.code || "MODEL_DELETE_ERROR", {
|
|
149
148
|
error: ex,
|
|
150
149
|
model,
|
|
151
150
|
keys
|
|
152
151
|
});
|
|
153
152
|
}
|
|
153
|
+
|
|
154
|
+
const {
|
|
155
|
+
index
|
|
156
|
+
} = _configurations.default.es({
|
|
157
|
+
model
|
|
158
|
+
});
|
|
159
|
+
/**
|
|
160
|
+
* In case of DynamoDB error we need to remove the index we created.
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
await elasticsearch.indices.delete({
|
|
166
|
+
index
|
|
167
|
+
});
|
|
168
|
+
} catch (ex) {
|
|
169
|
+
throw new _error.default(`Could not delete elasticsearch index "${index}" after model record was deleted.`, "DELETE_MODEL_INDICE_ERROR", {
|
|
170
|
+
error: ex
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return model;
|
|
154
175
|
};
|
|
155
176
|
|
|
156
177
|
const get = async params => {
|
|
@@ -163,7 +184,7 @@ const createModelsStorageOperations = params => {
|
|
|
163
184
|
});
|
|
164
185
|
return (0, _cleanup.cleanupItem)(entity, item);
|
|
165
186
|
} catch (ex) {
|
|
166
|
-
throw new _error.default(ex.
|
|
187
|
+
throw new _error.default(ex.message || "Could not get model.", ex.code || "MODEL_GET_ERROR", {
|
|
167
188
|
error: ex,
|
|
168
189
|
keys
|
|
169
190
|
});
|
|
@@ -186,7 +207,7 @@ const createModelsStorageOperations = params => {
|
|
|
186
207
|
const items = await (0, _query.queryAll)(queryAllParams);
|
|
187
208
|
return (0, _cleanup.cleanupItems)(entity, items);
|
|
188
209
|
} catch (ex) {
|
|
189
|
-
throw new _error.default(ex.
|
|
210
|
+
throw new _error.default(ex.message || "Could not list models.", ex.code || "MODEL_LIST_ERROR", {
|
|
190
211
|
error: ex,
|
|
191
212
|
partitionKey: queryAllParams.partitionKey
|
|
192
213
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-ddb-es",
|
|
3
|
-
"version": "5.19.
|
|
3
|
+
"version": "5.19.1-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"@webiny/api-headless-cms",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@babel/runtime": "7.16.3",
|
|
26
|
-
"@webiny/api-headless-cms": "5.19.
|
|
27
|
-
"@webiny/api-upgrade": "5.19.
|
|
28
|
-
"@webiny/db-dynamodb": "5.19.
|
|
29
|
-
"@webiny/error": "5.19.
|
|
30
|
-
"@webiny/handler": "5.19.
|
|
31
|
-
"@webiny/handler-aws": "5.19.
|
|
32
|
-
"@webiny/handler-db": "5.19.
|
|
33
|
-
"@webiny/plugins": "5.19.
|
|
34
|
-
"@webiny/utils": "5.19.
|
|
26
|
+
"@webiny/api-headless-cms": "5.19.1-beta.0",
|
|
27
|
+
"@webiny/api-upgrade": "5.19.1-beta.0",
|
|
28
|
+
"@webiny/db-dynamodb": "5.19.1-beta.0",
|
|
29
|
+
"@webiny/error": "5.19.1-beta.0",
|
|
30
|
+
"@webiny/handler": "5.19.1-beta.0",
|
|
31
|
+
"@webiny/handler-aws": "5.19.1-beta.0",
|
|
32
|
+
"@webiny/handler-db": "5.19.1-beta.0",
|
|
33
|
+
"@webiny/plugins": "5.19.1-beta.0",
|
|
34
|
+
"@webiny/utils": "5.19.1-beta.0",
|
|
35
35
|
"dataloader": "2.0.0",
|
|
36
36
|
"dynamodb-toolbox": "0.3.5",
|
|
37
37
|
"jsonpack": "1.1.5",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"@elastic/elasticsearch": "7.12.0",
|
|
48
48
|
"@shelf/jest-elasticsearch": "^1.0.0",
|
|
49
49
|
"@types/jsonpack": "^1.1.0",
|
|
50
|
-
"@webiny/api-dynamodb-to-elasticsearch": "^5.19.
|
|
51
|
-
"@webiny/api-elasticsearch": "^5.19.
|
|
52
|
-
"@webiny/cli": "^5.19.
|
|
53
|
-
"@webiny/project-utils": "^5.19.
|
|
50
|
+
"@webiny/api-dynamodb-to-elasticsearch": "^5.19.1-beta.0",
|
|
51
|
+
"@webiny/api-elasticsearch": "^5.19.1-beta.0",
|
|
52
|
+
"@webiny/cli": "^5.19.1-beta.0",
|
|
53
|
+
"@webiny/project-utils": "^5.19.1-beta.0",
|
|
54
54
|
"jest": "^26.6.3",
|
|
55
55
|
"jest-dynalite": "^3.2.0",
|
|
56
56
|
"jest-environment-node": "^26.6.2",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"build": "yarn webiny run build",
|
|
70
70
|
"watch": "yarn webiny run watch"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "c217ea1361f1d1536c6c4ee577579e1faca240eb"
|
|
73
73
|
}
|