@boostercloud/framework-provider-azure 1.16.1 → 1.18.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.
|
@@ -33,17 +33,17 @@ async function insertReadModel(readModel, db, config, readModelName) {
|
|
|
33
33
|
...readModel,
|
|
34
34
|
id: (_a = readModel === null || readModel === void 0 ? void 0 : readModel.id) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
35
35
|
};
|
|
36
|
-
await db
|
|
36
|
+
const { resource } = await db
|
|
37
37
|
.database(config.resourceNames.applicationStack)
|
|
38
38
|
.container(config.resourceNames.forReadModel(readModelName))
|
|
39
39
|
.items.create(itemModel);
|
|
40
|
-
logger.debug(
|
|
40
|
+
logger.debug(`Read model ${readModelName} inserted with id ${readModel.id} and metadata ${JSON.stringify(resource === null || resource === void 0 ? void 0 : resource.boosterMetadata)}`);
|
|
41
41
|
}
|
|
42
42
|
catch (err) {
|
|
43
43
|
const error = err;
|
|
44
44
|
// In case of conflict (The ID provided for a resource on a PUT or POST operation has been taken by an existing resource) we should retry it
|
|
45
45
|
if ((error === null || error === void 0 ? void 0 : error.code) == constants_1.AZURE_CONFLICT_ERROR_CODE) {
|
|
46
|
-
logger.
|
|
46
|
+
logger.warn(`Read model ${readModelName} insert failed with a conflict failure with id ${readModel.id} and metadata ${JSON.stringify(readModel.boosterMetadata)}`);
|
|
47
47
|
throw new framework_types_1.OptimisticConcurrencyUnexpectedVersionError(error === null || error === void 0 ? void 0 : error.message);
|
|
48
48
|
}
|
|
49
49
|
logger.error('[ReadModelAdapter#insertReadModel] Read model insert failed without a conflict failure');
|
|
@@ -58,17 +58,17 @@ async function updateReadModel(readModel, db, config, readModelName) {
|
|
|
58
58
|
accessCondition: { condition: ((_a = readModel.boosterMetadata) === null || _a === void 0 ? void 0 : _a.optimisticConcurrencyValue) || '*', type: 'IfMatch' },
|
|
59
59
|
};
|
|
60
60
|
try {
|
|
61
|
-
await db
|
|
61
|
+
const { resource } = await db
|
|
62
62
|
.database(config.resourceNames.applicationStack)
|
|
63
63
|
.container(config.resourceNames.forReadModel(readModelName))
|
|
64
64
|
.items.upsert(readModel, options);
|
|
65
|
-
logger.debug(
|
|
65
|
+
logger.debug(`Read model ${readModelName} updated with id ${readModel.id} and metadata ${JSON.stringify(resource === null || resource === void 0 ? void 0 : resource.boosterMetadata)}`);
|
|
66
66
|
}
|
|
67
67
|
catch (err) {
|
|
68
68
|
const error = err;
|
|
69
69
|
// If there is a precondition failure then we should retry it
|
|
70
70
|
if ((error === null || error === void 0 ? void 0 : error.code) == constants_1.AZURE_PRECONDITION_FAILED_ERROR) {
|
|
71
|
-
logger.
|
|
71
|
+
logger.warn(`Read model ${readModelName} update failed with a pre-condition failure with id ${readModel.id} and metadata ${JSON.stringify(readModel.boosterMetadata)}`);
|
|
72
72
|
throw new framework_types_1.OptimisticConcurrencyUnexpectedVersionError(error === null || error === void 0 ? void 0 : error.message);
|
|
73
73
|
}
|
|
74
74
|
logger.error('[ReadModelAdapter#updateReadModel] Read model update failed without a pre-condition failure');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boostercloud/framework-provider-azure",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Handle Booster's integration with Azure",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework-provider-azure"
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"@azure/cosmos": "^3.17.0",
|
|
24
24
|
"@azure/functions": "^1.2.2",
|
|
25
25
|
"@azure/identity": "~2.1.0",
|
|
26
|
-
"@boostercloud/framework-common-helpers": "^1.
|
|
27
|
-
"@boostercloud/framework-types": "^1.
|
|
26
|
+
"@boostercloud/framework-common-helpers": "^1.18.0",
|
|
27
|
+
"@boostercloud/framework-types": "^1.18.0",
|
|
28
28
|
"tslib": "^2.4.0",
|
|
29
29
|
"@effect-ts/core": "^0.60.4",
|
|
30
30
|
"@azure/web-pubsub": "~1.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@boostercloud/eslint-config": "^1.
|
|
33
|
+
"@boostercloud/eslint-config": "^1.18.0",
|
|
34
34
|
"@types/chai": "4.2.18",
|
|
35
35
|
"@types/chai-as-promised": "7.1.4",
|
|
36
36
|
"@types/faker": "5.1.5",
|