ag-common 0.0.74 → 0.0.78
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.
|
@@ -11,11 +11,13 @@ export declare const batchWrite: <T extends {}>(tableName: string, itemsIn: T[],
|
|
|
11
11
|
} | {
|
|
12
12
|
error?: undefined;
|
|
13
13
|
}>;
|
|
14
|
-
export declare const batchDelete: ({ tableName, keys, breakOnError, pkName, }: {
|
|
14
|
+
export declare const batchDelete: ({ tableName, keys, breakOnError, pkName, rangeName, rangeValue, }: {
|
|
15
15
|
pkName: string;
|
|
16
16
|
breakOnError?: boolean | undefined;
|
|
17
17
|
tableName: string;
|
|
18
18
|
keys: string[];
|
|
19
|
+
rangeName?: string | undefined;
|
|
20
|
+
rangeValue?: string | undefined;
|
|
19
21
|
}) => Promise<{
|
|
20
22
|
error: string;
|
|
21
23
|
} | {
|
|
@@ -106,7 +106,7 @@ const batchWrite = (tableName, itemsIn, breakOnError = false) => __awaiter(void
|
|
|
106
106
|
return {};
|
|
107
107
|
});
|
|
108
108
|
exports.batchWrite = batchWrite;
|
|
109
|
-
const batchDelete = ({ tableName, keys, breakOnError = true, pkName, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
109
|
+
const batchDelete = ({ tableName, keys, breakOnError = true, pkName, rangeName, rangeValue, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
110
|
var _c, _d;
|
|
111
111
|
(0, log_1.info)(`wipe keys dynamo:${tableName} - count=${keys.length}`);
|
|
112
112
|
const error = [];
|
|
@@ -115,12 +115,14 @@ const batchDelete = ({ tableName, keys, breakOnError = true, pkName, }) => __awa
|
|
|
115
115
|
if (breakV) {
|
|
116
116
|
break;
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
.delete({
|
|
118
|
+
let params = {
|
|
120
119
|
TableName: tableName,
|
|
121
|
-
Key: { [
|
|
122
|
-
}
|
|
123
|
-
|
|
120
|
+
Key: { [pkName]: key },
|
|
121
|
+
};
|
|
122
|
+
if (rangeName) {
|
|
123
|
+
params.Key[rangeName] = rangeValue;
|
|
124
|
+
}
|
|
125
|
+
const res = yield exports.dynamoDb.delete(params).promise();
|
|
124
126
|
const newError = (_d = (_c = res.$response) === null || _c === void 0 ? void 0 : _c.error) !== null && _d !== void 0 ? _d : null;
|
|
125
127
|
if (newError) {
|
|
126
128
|
error.push(newError);
|
|
@@ -12,8 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.callOpenApi = void 0;
|
|
13
13
|
const cookie_1 = require("./cookie");
|
|
14
14
|
const sleep_1 = require("../../common/helpers/sleep");
|
|
15
|
+
const array_1 = require("../../common/helpers/array");
|
|
15
16
|
const callOpenApi = ({ func, apiUrl, overrideAuth, refreshToken, logout, newDefaultApi, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
var _a, _b, _c, _d, _e, _f;
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
17
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
19
|
let error;
|
|
19
20
|
let data;
|
|
@@ -49,11 +50,15 @@ const callOpenApi = ({ func, apiUrl, overrideAuth, refreshToken, logout, newDefa
|
|
|
49
50
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
51
|
const ae = e;
|
|
51
52
|
const status = (_c = ae.response) === null || _c === void 0 ? void 0 : _c.status;
|
|
52
|
-
const errorMessage =
|
|
53
|
-
((_e = ae.response) === null || _e === void 0 ? void 0 : _e.
|
|
54
|
-
((
|
|
55
|
-
ae.
|
|
56
|
-
'
|
|
53
|
+
const errorMessage = [
|
|
54
|
+
(_f = (_e = (_d = ae.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.toString()) !== null && _f !== void 0 ? _f : '',
|
|
55
|
+
(_j = (_h = (_g = ae.response) === null || _g === void 0 ? void 0 : _g.statusText) === null || _h === void 0 ? void 0 : _h.toString()) !== null && _j !== void 0 ? _j : '',
|
|
56
|
+
(_m = (_l = (_k = ae.response) === null || _k === void 0 ? void 0 : _k.status) === null || _l === void 0 ? void 0 : _l.toString()) !== null && _m !== void 0 ? _m : '',
|
|
57
|
+
(_p = (_o = ae.message) === null || _o === void 0 ? void 0 : _o.toString()) !== null && _p !== void 0 ? _p : '',
|
|
58
|
+
]
|
|
59
|
+
.filter(array_1.notEmpty)
|
|
60
|
+
.sort((a, b) => (a.length < b.length ? -1 : 1))
|
|
61
|
+
.join('\n');
|
|
57
62
|
if (status === 403 || status === 401) {
|
|
58
63
|
logout();
|
|
59
64
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.78",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Andrei Gec <@andreigec> (https://gec.dev/)",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"aws-cdk-lib": "2.8.0",
|
|
17
|
-
"aws-sdk": "2.
|
|
18
|
-
"axios": "0.
|
|
19
|
-
"constructs": "10.0.
|
|
17
|
+
"aws-sdk": "2.1060.0",
|
|
18
|
+
"axios": "0.25.0",
|
|
19
|
+
"constructs": "10.0.39",
|
|
20
20
|
"jsonwebtoken": "8.5.1",
|
|
21
21
|
"jwks-rsa": "2.0.5",
|
|
22
22
|
"openapi-request-validator": "10.0.0",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/jsonwebtoken": "8.5.8",
|
|
31
|
-
"@types/node": "17.0.
|
|
31
|
+
"@types/node": "17.0.10",
|
|
32
32
|
"@types/react": "17.0.38",
|
|
33
33
|
"@types/react-dom": "17.0.11",
|
|
34
34
|
"@types/styled-components": "5.1.20",
|
|
35
35
|
"@typescript-eslint/eslint-plugin": "5.9.1",
|
|
36
36
|
"@typescript-eslint/parser": "5.9.1",
|
|
37
|
-
"eslint": "8.
|
|
37
|
+
"eslint": "8.7.0",
|
|
38
38
|
"eslint-config-airbnb-typescript": "16.1.0",
|
|
39
39
|
"eslint-config-prettier": "8.3.0",
|
|
40
40
|
"eslint-config-react-app": "7.0.0",
|