@stryker-mutator/dashboard-data-access 0.14.4-pr-888.13 → 0.14.4-pr-888.15
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.
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _MutationTestingResultMapper_containerClient;
|
|
13
|
-
import {
|
|
13
|
+
import { hasErrorCode, toBlobName } from '../utils.js';
|
|
14
14
|
import { OptimisticConcurrencyError } from '../errors/index.js';
|
|
15
15
|
import { createBlobServiceClient } from '../services/BlobServiceClient.js';
|
|
16
16
|
const errCodes = Object.freeze({
|
|
@@ -40,7 +40,7 @@ export class MutationTestingResultMapper {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
catch (err) {
|
|
43
|
-
if (
|
|
43
|
+
if (hasErrorCode(err, errCodes.BLOB_HAS_BEEN_MODIFIED)) {
|
|
44
44
|
throw new OptimisticConcurrencyError(`Blob "${JSON.stringify(id)}" was modified by another process`);
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
@@ -55,7 +55,7 @@ export class MutationTestingResultMapper {
|
|
|
55
55
|
return result;
|
|
56
56
|
}
|
|
57
57
|
catch (error) {
|
|
58
|
-
if (
|
|
58
|
+
if (hasErrorCode(error, errCodes.BLOB_NOT_FOUND)) {
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
@@ -17,7 +17,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
17
17
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
18
18
|
};
|
|
19
19
|
var _TableStorageMapper_tableClient;
|
|
20
|
-
import { encodeKey, decodeKey,
|
|
20
|
+
import { encodeKey, decodeKey, hasErrorCode } from '../utils.js';
|
|
21
21
|
import { OptimisticConcurrencyError } from '../errors/index.js';
|
|
22
22
|
import { DashboardQuery } from './DashboardQuery.js';
|
|
23
23
|
import { createTableClient } from '../services/TableClient.js';
|
|
@@ -45,7 +45,7 @@ class TableStorageMapper {
|
|
|
45
45
|
return this.toModel(result);
|
|
46
46
|
}
|
|
47
47
|
catch (err) {
|
|
48
|
-
if (
|
|
48
|
+
if (hasErrorCode(err, errCodes.RESOURCE_NOT_FOUND)) {
|
|
49
49
|
return null;
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
@@ -89,9 +89,8 @@ class TableStorageMapper {
|
|
|
89
89
|
return { model, etag: result.etag };
|
|
90
90
|
}
|
|
91
91
|
catch (err) {
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
throw new OptimisticConcurrencyError(`Replace entity with etag ${etag} resulted in ${err.details.errorCode}`);
|
|
92
|
+
if (hasErrorCode(err, errCodes.UPDATE_CONDITION_NOT_SATISFIED)) {
|
|
93
|
+
throw new OptimisticConcurrencyError(`Replace entity with etag ${etag} resulted in ${errCodes.UPDATE_CONDITION_NOT_SATISFIED}`);
|
|
95
94
|
}
|
|
96
95
|
else {
|
|
97
96
|
throw err;
|
|
@@ -105,8 +104,8 @@ class TableStorageMapper {
|
|
|
105
104
|
return { model, etag: result.etag };
|
|
106
105
|
}
|
|
107
106
|
catch (err) {
|
|
108
|
-
if (
|
|
109
|
-
throw new OptimisticConcurrencyError(`Trying to insert "${entity.partitionKey}" "${entity.rowKey}" which already exists (${
|
|
107
|
+
if (hasErrorCode(err, errCodes.ENTITY_ALREADY_EXISTS)) {
|
|
108
|
+
throw new OptimisticConcurrencyError(`Trying to insert "${entity.partitionKey}" "${entity.rowKey}" which already exists (${errCodes.ENTITY_ALREADY_EXISTS})`);
|
|
110
109
|
}
|
|
111
110
|
else {
|
|
112
111
|
throw err;
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ import { RestError } from '@azure/storage-blob';
|
|
|
3
3
|
export declare function encodeKey(inputWithSlashes: string): string;
|
|
4
4
|
export declare function decodeKey(inputWithSemiColons: string): string;
|
|
5
5
|
export declare function isStorageError(maybeStorageError: unknown): maybeStorageError is RestError;
|
|
6
|
-
export declare function
|
|
7
|
-
errorCode: string;
|
|
8
|
-
};
|
|
6
|
+
export declare function hasErrorCode(err: unknown, code: string): boolean;
|
|
9
7
|
export declare function toBlobName({ projectName, version, moduleName, realTime }: ReportIdentifier): string;
|
|
10
8
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/src/utils.js
CHANGED
|
@@ -8,11 +8,14 @@ export function decodeKey(inputWithSemiColons) {
|
|
|
8
8
|
export function isStorageError(maybeStorageError) {
|
|
9
9
|
return maybeStorageError instanceof RestError;
|
|
10
10
|
}
|
|
11
|
-
export function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export function hasErrorCode(err, code) {
|
|
12
|
+
var _a;
|
|
13
|
+
if (!isStorageError(err))
|
|
14
|
+
return false;
|
|
15
|
+
const details = err.details;
|
|
16
|
+
return (typeof details === 'object' &&
|
|
17
|
+
details !== null &&
|
|
18
|
+
(details.errorCode === code || ((_a = details.odataError) === null || _a === void 0 ? void 0 : _a.code) === code));
|
|
16
19
|
}
|
|
17
20
|
export function toBlobName({ projectName, version, moduleName, realTime }) {
|
|
18
21
|
const slug = [projectName, version, moduleName, realTime ? 'real-time' : realTime]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryker-mutator/dashboard-data-access",
|
|
3
|
-
"version": "0.14.4-pr-888.
|
|
3
|
+
"version": "0.14.4-pr-888.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "This package contains the data access layer of the stryker dashboard application.",
|
|
6
6
|
"scripts": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"@azure/data-tables": "13.2.2",
|
|
26
26
|
"@azure/identity": "4.4.1",
|
|
27
27
|
"@azure/storage-blob": "12.24.0",
|
|
28
|
-
"@stryker-mutator/dashboard-common": "0.14.4-pr-888.
|
|
28
|
+
"@stryker-mutator/dashboard-common": "0.14.4-pr-888.15",
|
|
29
29
|
"mutation-testing-metrics": "3.2.0",
|
|
30
30
|
"mutation-testing-report-schema": "3.1.1"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "34a5169835904a07304b0cfa1f813f90426befde"
|
|
33
33
|
}
|