@map-colonies/mc-utils 1.1.0 → 1.4.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/README.md +67 -65
- package/dist/arrays/index.d.ts +2 -0
- package/dist/arrays/index.d.ts.map +1 -0
- package/dist/arrays/index.js +14 -0
- package/dist/arrays/index.js.map +1 -0
- package/dist/arrays/subGroups.d.ts +9 -0
- package/dist/arrays/subGroups.d.ts.map +1 -0
- package/dist/arrays/subGroups.js +139 -0
- package/dist/arrays/subGroups.js.map +1 -0
- package/dist/communication/http/httpClient.d.ts +10 -9
- package/dist/communication/http/httpClient.d.ts.map +1 -1
- package/dist/communication/http/httpClient.js +46 -20
- package/dist/communication/http/httpClient.js.map +1 -1
- package/dist/geo/bboxUtils.js +6 -6
- package/dist/geo/bboxUtils.js.map +1 -1
- package/dist/geo/geoConvertor.js +2 -2
- package/dist/geo/geoConvertor.js.map +1 -1
- package/dist/geo/geoHash.js +11 -11
- package/dist/geo/geoHash.js.map +1 -1
- package/dist/geo/geoIntersection.d.ts +13 -0
- package/dist/geo/geoIntersection.d.ts.map +1 -0
- package/dist/geo/geoIntersection.js +28 -0
- package/dist/geo/geoIntersection.js.map +1 -0
- package/dist/geo/index.d.ts +4 -1
- package/dist/geo/index.d.ts.map +1 -1
- package/dist/geo/index.js +4 -1
- package/dist/geo/index.js.map +1 -1
- package/dist/geo/tileBatcher.d.ts +9 -0
- package/dist/geo/tileBatcher.d.ts.map +1 -0
- package/dist/geo/tileBatcher.js +168 -0
- package/dist/geo/tileBatcher.js.map +1 -0
- package/dist/geo/tileRanger.d.ts +0 -1
- package/dist/geo/tileRanger.d.ts.map +1 -1
- package/dist/geo/tileRanger.js +20 -71
- package/dist/geo/tileRanger.js.map +1 -1
- package/dist/geo/tiles.js +2 -2
- package/dist/geo/tiles.js.map +1 -1
- package/dist/geo/tilesGenerator.d.ts +3 -0
- package/dist/geo/tilesGenerator.d.ts.map +1 -0
- package/dist/geo/tilesGenerator.js +95 -0
- package/dist/geo/tilesGenerator.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +76 -76
package/README.md
CHANGED
|
@@ -1,65 +1,67 @@
|
|
|
1
|
-
# mc-utils
|
|
2
|
-
this is general utilities for usage in Map Colonies project.
|
|
3
|
-
|
|
4
|
-
# included components
|
|
5
|
-
- [http client](#http-client)
|
|
6
|
-
|
|
7
|
-
# usage
|
|
8
|
-
## http client
|
|
9
|
-
this is abstract base class for sending http request with logging and request retries.
|
|
10
|
-
|
|
11
|
-
this class constructor requires the following parameters:
|
|
12
|
-
- [ILogger](#ilogger) instance.
|
|
13
|
-
- base url to use for all requests.
|
|
14
|
-
- optional name for target service to be used in logs.
|
|
15
|
-
- optional [retry configuration](#ihttpretryconfig).
|
|
16
|
-
|
|
17
|
-
the class have the following protected attributes
|
|
18
|
-
-```axiosOptions``` the options used by axios when sending requests
|
|
19
|
-
|
|
20
|
-
the class have the protected methods for sending http requests:
|
|
21
|
-
- ```protected async get<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>```
|
|
22
|
-
- ```protected async post<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>```
|
|
23
|
-
- ```protected async put<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>```
|
|
24
|
-
- ```protected async delete<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>```
|
|
25
|
-
- ```protected async head<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>```
|
|
26
|
-
- ```protected async options<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>```
|
|
27
|
-
- ```protected async patch<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>```
|
|
28
|
-
|
|
29
|
-
function parameters list:
|
|
30
|
-
- `url`: url path to send the request to (not including the base url).
|
|
31
|
-
- `body`: optional object to be used as request body (in relevant request types).
|
|
32
|
-
- `queryParams`: optional dictionary with query parameters and value.
|
|
33
|
-
- `retryConfig`: optional override to the class retry configuration.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- ```
|
|
59
|
-
- ```
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- ```
|
|
1
|
+
# mc-utils
|
|
2
|
+
this is general utilities for usage in Map Colonies project.
|
|
3
|
+
|
|
4
|
+
# included components
|
|
5
|
+
- [http client](#http-client)
|
|
6
|
+
|
|
7
|
+
# usage
|
|
8
|
+
## http client
|
|
9
|
+
this is abstract base class for sending http request with logging and request retries.
|
|
10
|
+
|
|
11
|
+
this class constructor requires the following parameters:
|
|
12
|
+
- [ILogger](#ilogger) instance.
|
|
13
|
+
- base url to use for all requests.
|
|
14
|
+
- optional name for target service to be used in logs.
|
|
15
|
+
- optional [retry configuration](#ihttpretryconfig).
|
|
16
|
+
|
|
17
|
+
the class have the following protected attributes
|
|
18
|
+
-```axiosOptions``` the options used by axios when sending requests
|
|
19
|
+
|
|
20
|
+
the class have the protected methods for sending http requests:
|
|
21
|
+
- ```protected async get<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>```
|
|
22
|
+
- ```protected async post<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>```
|
|
23
|
+
- ```protected async put<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>```
|
|
24
|
+
- ```protected async delete<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>```
|
|
25
|
+
- ```protected async head<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>```
|
|
26
|
+
- ```protected async options<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>```
|
|
27
|
+
- ```protected async patch<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>```
|
|
28
|
+
|
|
29
|
+
function parameters list:
|
|
30
|
+
- `url`: url path to send the request to (not including the base url).
|
|
31
|
+
- `body`: optional object to be used as request body (in relevant request types).
|
|
32
|
+
- `queryParams`: optional dictionary with query parameters and value.
|
|
33
|
+
- `retryConfig`: optional override to the class retry configuration.
|
|
34
|
+
- `auth`: optional basic authentication object (username, password).
|
|
35
|
+
- `headers`: optional headers to proceed to the request.
|
|
36
|
+
|
|
37
|
+
usage example:
|
|
38
|
+
```typescript
|
|
39
|
+
class myServiceClient extends HttpClient {
|
|
40
|
+
public constructor(logger: ILogger){
|
|
41
|
+
super(logger,'https://myService.com','myService',{
|
|
42
|
+
attempts: 3,
|
|
43
|
+
delay: 'exponential',
|
|
44
|
+
shouldResetTimeout: true
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public async getName(): string {
|
|
49
|
+
const name = await this.get<string>('api/name',{queryParam1: 'name'});
|
|
50
|
+
return name;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
# models
|
|
55
|
+
## ILogger
|
|
56
|
+
logger interface
|
|
57
|
+
with the flowing log methods
|
|
58
|
+
- ``` error(message:string) ```
|
|
59
|
+
- ```warn(message:string)```
|
|
60
|
+
- ```info(message: string)```
|
|
61
|
+
- ```debug(message: string)```
|
|
62
|
+
|
|
63
|
+
## IHttpRetryConfig
|
|
64
|
+
http requests retry configuration interface with the following attributes:
|
|
65
|
+
- ```attempts``` - the number of request to send until valid response (not 500+ status code). this value must be integer and greater then 0.
|
|
66
|
+
- ```delay``` - the amount of time in ms to wait between attempts (for constant delay) or ```'exponential'``` for exponential backoff.
|
|
67
|
+
- ```shouldResetTimeout``` boolean value to indicate if the request timeout should be for each request (true) or global for all attempts (false)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/arrays/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./subGroups"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/arrays/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA4B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* split group into unique sub groups ordered by size from largest to smallest
|
|
3
|
+
* @param group input group
|
|
4
|
+
* @param maxLength length of the largest sub group return. must be <= group.length
|
|
5
|
+
* @param includeOnlyMaxLength indicates if function will return only sub groups in the specified "maxLength" or smaller groups as well. default: false
|
|
6
|
+
*/
|
|
7
|
+
declare function subGroupsGen<T>(group: T[], maxLength: number, includeOnlyMaxLength?: boolean): Generator<T[]>;
|
|
8
|
+
export { subGroupsGen };
|
|
9
|
+
//# sourceMappingURL=subGroups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subGroups.d.ts","sourceRoot":"","sources":["../../src/arrays/subGroups.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,iBAAU,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,oBAAoB,UAAQ,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAoBrG;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
3
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
4
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
5
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
6
|
+
function step(op) {
|
|
7
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
8
|
+
while (_) try {
|
|
9
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
10
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
11
|
+
switch (op[0]) {
|
|
12
|
+
case 0: case 1: t = op; break;
|
|
13
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
14
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
15
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
16
|
+
default:
|
|
17
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
18
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
19
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
20
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
21
|
+
if (t[2]) _.ops.pop();
|
|
22
|
+
_.trys.pop(); continue;
|
|
23
|
+
}
|
|
24
|
+
op = body.call(thisArg, _);
|
|
25
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
26
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var __values = (this && this.__values) || function(o) {
|
|
30
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
31
|
+
if (m) return m.call(o);
|
|
32
|
+
if (o && typeof o.length === "number") return {
|
|
33
|
+
next: function () {
|
|
34
|
+
if (o && i >= o.length) o = void 0;
|
|
35
|
+
return { value: o && o[i++], done: !o };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
39
|
+
};
|
|
40
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
41
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
42
|
+
if (!m) return o;
|
|
43
|
+
var i = m.call(o), r, ar = [], e;
|
|
44
|
+
try {
|
|
45
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
46
|
+
}
|
|
47
|
+
catch (error) { e = { error: error }; }
|
|
48
|
+
finally {
|
|
49
|
+
try {
|
|
50
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
51
|
+
}
|
|
52
|
+
finally { if (e) throw e.error; }
|
|
53
|
+
}
|
|
54
|
+
return ar;
|
|
55
|
+
};
|
|
56
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
57
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
58
|
+
if (ar || !(i in from)) {
|
|
59
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
60
|
+
ar[i] = from[i];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
64
|
+
};
|
|
65
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
+
exports.subGroupsGen = void 0;
|
|
67
|
+
/**
|
|
68
|
+
* split group into unique sub groups ordered by size from largest to smallest
|
|
69
|
+
* @param group input group
|
|
70
|
+
* @param maxLength length of the largest sub group return. must be <= group.length
|
|
71
|
+
* @param includeOnlyMaxLength indicates if function will return only sub groups in the specified "maxLength" or smaller groups as well. default: false
|
|
72
|
+
*/
|
|
73
|
+
function subGroupsGen(group, maxLength, includeOnlyMaxLength) {
|
|
74
|
+
var lengthDif, i, subLayers, subPermutations, subPermutations_1, subPermutations_1_1, subPermutation, e_1_1;
|
|
75
|
+
var e_1, _a;
|
|
76
|
+
if (includeOnlyMaxLength === void 0) { includeOnlyMaxLength = false; }
|
|
77
|
+
return __generator(this, function (_b) {
|
|
78
|
+
switch (_b.label) {
|
|
79
|
+
case 0:
|
|
80
|
+
if (!(maxLength === 0)) return [3 /*break*/, 2];
|
|
81
|
+
return [4 /*yield*/, []];
|
|
82
|
+
case 1:
|
|
83
|
+
_b.sent();
|
|
84
|
+
return [3 /*break*/, 16];
|
|
85
|
+
case 2:
|
|
86
|
+
if (!(group.length === maxLength)) return [3 /*break*/, 4];
|
|
87
|
+
return [4 /*yield*/, group];
|
|
88
|
+
case 3:
|
|
89
|
+
_b.sent();
|
|
90
|
+
return [3 /*break*/, 14];
|
|
91
|
+
case 4:
|
|
92
|
+
lengthDif = group.length - maxLength;
|
|
93
|
+
i = 0;
|
|
94
|
+
_b.label = 5;
|
|
95
|
+
case 5:
|
|
96
|
+
if (!(i <= lengthDif)) return [3 /*break*/, 14];
|
|
97
|
+
subLayers = group.slice(i + 1);
|
|
98
|
+
subPermutations = subGroupsGen(subLayers, maxLength - 1);
|
|
99
|
+
_b.label = 6;
|
|
100
|
+
case 6:
|
|
101
|
+
_b.trys.push([6, 11, 12, 13]);
|
|
102
|
+
subPermutations_1 = (e_1 = void 0, __values(subPermutations)), subPermutations_1_1 = subPermutations_1.next();
|
|
103
|
+
_b.label = 7;
|
|
104
|
+
case 7:
|
|
105
|
+
if (!!subPermutations_1_1.done) return [3 /*break*/, 10];
|
|
106
|
+
subPermutation = subPermutations_1_1.value;
|
|
107
|
+
return [4 /*yield*/, __spreadArray([group[i]], __read(subPermutation), false)];
|
|
108
|
+
case 8:
|
|
109
|
+
_b.sent();
|
|
110
|
+
_b.label = 9;
|
|
111
|
+
case 9:
|
|
112
|
+
subPermutations_1_1 = subPermutations_1.next();
|
|
113
|
+
return [3 /*break*/, 7];
|
|
114
|
+
case 10: return [3 /*break*/, 13];
|
|
115
|
+
case 11:
|
|
116
|
+
e_1_1 = _b.sent();
|
|
117
|
+
e_1 = { error: e_1_1 };
|
|
118
|
+
return [3 /*break*/, 13];
|
|
119
|
+
case 12:
|
|
120
|
+
try {
|
|
121
|
+
if (subPermutations_1_1 && !subPermutations_1_1.done && (_a = subPermutations_1.return)) _a.call(subPermutations_1);
|
|
122
|
+
}
|
|
123
|
+
finally { if (e_1) throw e_1.error; }
|
|
124
|
+
return [7 /*endfinally*/];
|
|
125
|
+
case 13:
|
|
126
|
+
i++;
|
|
127
|
+
return [3 /*break*/, 5];
|
|
128
|
+
case 14:
|
|
129
|
+
if (!(maxLength > 1 && !includeOnlyMaxLength)) return [3 /*break*/, 16];
|
|
130
|
+
return [5 /*yield**/, __values(subGroupsGen(group, maxLength - 1))];
|
|
131
|
+
case 15:
|
|
132
|
+
_b.sent();
|
|
133
|
+
_b.label = 16;
|
|
134
|
+
case 16: return [2 /*return*/];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
exports.subGroupsGen = subGroupsGen;
|
|
139
|
+
//# sourceMappingURL=subGroups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subGroups.js","sourceRoot":"","sources":["../../src/arrays/subGroups.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,SAAU,YAAY,CAAI,KAAU,EAAE,SAAiB,EAAE,oBAA4B;;;IAA5B,qCAAA,EAAA,4BAA4B;;;;qBAC/E,CAAA,SAAS,KAAK,CAAC,CAAA,EAAf,wBAAe;gBACjB,qBAAM,EAAE,EAAA;;gBAAR,SAAQ,CAAC;;;qBAEL,CAAA,KAAK,CAAC,MAAM,KAAK,SAAS,CAAA,EAA1B,wBAA0B;gBAC5B,qBAAM,KAAK,EAAA;;gBAAX,SAAW,CAAC;;;gBAEN,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;gBAClC,CAAC,GAAG,CAAC;;;qBAAE,CAAA,CAAC,IAAI,SAAS,CAAA;gBACtB,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC/B,eAAe,GAAG,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC;;;;gBAClC,mCAAA,SAAA,eAAe,CAAA,CAAA;;;;gBAAjC,cAAc;gBACvB,oCAAO,KAAK,CAAC,CAAC,CAAC,UAAK,cAAc,WAAC;;gBAAnC,SAAmC,CAAC;;;;;;;;;;;;;;;;;gBAJR,CAAC,EAAE,CAAA;;;qBAQjC,CAAA,SAAS,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAA,EAAtC,yBAAsC;gBACxC,sBAAA,SAAO,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,CAAC,CAAC,CAAA,EAAA;;gBAAzC,SAAyC,CAAC;;;;;CAG/C;AAEQ,oCAAY"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
1
|
+
import { AxiosBasicCredentials, AxiosRequestConfig } from 'axios';
|
|
2
2
|
import { IAxiosRetryConfig } from 'axios-retry';
|
|
3
3
|
import { ILogger } from '../../models/interfaces/iLogger';
|
|
4
4
|
export interface IHttpRetryConfig {
|
|
@@ -9,16 +9,17 @@ export interface IHttpRetryConfig {
|
|
|
9
9
|
export declare abstract class HttpClient {
|
|
10
10
|
protected readonly logger: ILogger;
|
|
11
11
|
private readonly targetService;
|
|
12
|
+
private readonly disableDebugLogs;
|
|
12
13
|
protected axiosOptions: AxiosRequestConfig;
|
|
13
14
|
private readonly axiosClient;
|
|
14
|
-
constructor(logger: ILogger, baseUrl: string, targetService?: string, retryConfig?: IHttpRetryConfig);
|
|
15
|
-
protected get<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>;
|
|
16
|
-
protected post<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>;
|
|
17
|
-
protected put<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>;
|
|
18
|
-
protected delete<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>;
|
|
19
|
-
protected head<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>;
|
|
20
|
-
protected options<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>;
|
|
21
|
-
protected patch<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig): Promise<T>;
|
|
15
|
+
constructor(logger: ILogger, baseUrl: string, targetService?: string, retryConfig?: IHttpRetryConfig, disableDebugLogs?: boolean);
|
|
16
|
+
protected get<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>;
|
|
17
|
+
protected post<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>;
|
|
18
|
+
protected put<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>;
|
|
19
|
+
protected delete<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>;
|
|
20
|
+
protected head<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>;
|
|
21
|
+
protected options<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>;
|
|
22
|
+
protected patch<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: unknown): Promise<T>;
|
|
22
23
|
private wrapError;
|
|
23
24
|
private parseConfig;
|
|
24
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpClient.d.ts","sourceRoot":"","sources":["../../../src/communication/http/httpClient.ts"],"names":[],"mappings":"AAAA,OAAc,EAA6B,kBAAkB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"httpClient.d.ts","sourceRoot":"","sources":["../../../src/communication/http/httpClient.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,qBAAqB,EAA6B,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAEpG,OAAmB,EAAoB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAW9E,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAED,8BAAsB,UAAU;IAK5B,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO;IAElC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IARnC,SAAS,CAAC,YAAY,EAAE,kBAAkB,CAAM;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgB;gBAGvB,MAAM,EAAE,OAAO,EAClC,OAAO,EAAE,MAAM,EACE,aAAa,SAAK,EACnC,WAAW,CAAC,EAAE,gBAAgB,EACb,gBAAgB,UAAQ;cAmB3B,GAAG,CAAC,CAAC,EACnB,GAAG,EAAE,MAAM,EACX,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,WAAW,CAAC,EAAE,iBAAiB,EAC/B,IAAI,CAAC,EAAE,qBAAqB,EAC5B,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,CAAC,CAAC;cAcG,IAAI,CAAC,CAAC,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,OAAO,EACd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CA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C,EACrC,WAAW,CAAC,EAAE,iBAAiB,EAC/B,IAAI,CAAC,EAAE,qBAAqB,EAC5B,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,CAAC,CAAC;IAcb,OAAO,CAAC,SAAS;IA4CjB,OAAO,CAAC,WAAW;CAqBpB"}
|
|
@@ -76,12 +76,14 @@ var axios_retry_1 = __importStar(require("axios-retry"));
|
|
|
76
76
|
var lodash_1 = require("lodash");
|
|
77
77
|
var error_types_1 = require("@map-colonies/error-types");
|
|
78
78
|
var HttpClient = /** @class */ (function () {
|
|
79
|
-
function HttpClient(logger, baseUrl, targetService, retryConfig) {
|
|
79
|
+
function HttpClient(logger, baseUrl, targetService, retryConfig, disableDebugLogs) {
|
|
80
80
|
var _this = this;
|
|
81
81
|
if (targetService === void 0) { targetService = ''; }
|
|
82
|
+
if (disableDebugLogs === void 0) { disableDebugLogs = false; }
|
|
82
83
|
var _a;
|
|
83
84
|
this.logger = logger;
|
|
84
85
|
this.targetService = targetService;
|
|
86
|
+
this.disableDebugLogs = disableDebugLogs;
|
|
85
87
|
this.axiosOptions = {};
|
|
86
88
|
this.axiosClient = axios_1.default.create();
|
|
87
89
|
this.axiosOptions.baseURL = baseUrl;
|
|
@@ -92,12 +94,12 @@ var HttpClient = /** @class */ (function () {
|
|
|
92
94
|
};
|
|
93
95
|
var delayFunc = (_a = axiosRetryConfig.retryDelay) !== null && _a !== void 0 ? _a : (function () { return 0; });
|
|
94
96
|
axiosRetryConfig.retryDelay = function (retryCount, error) {
|
|
95
|
-
_this.logger.error("error from "
|
|
97
|
+
_this.logger.error("error from ".concat(_this.targetService, ". retries: ").concat(retryCount, ". error: ").concat(error.message));
|
|
96
98
|
return delayFunc(retryCount, error);
|
|
97
99
|
};
|
|
98
|
-
axios_retry_1.default(this.axiosClient, axiosRetryConfig);
|
|
100
|
+
(0, axios_retry_1.default)(this.axiosClient, axiosRetryConfig);
|
|
99
101
|
}
|
|
100
|
-
HttpClient.prototype.get = function (url, queryParams, retryConfig) {
|
|
102
|
+
HttpClient.prototype.get = function (url, queryParams, retryConfig, auth, headers) {
|
|
101
103
|
return __awaiter(this, void 0, void 0, function () {
|
|
102
104
|
var reqConfig, res, err_1, error;
|
|
103
105
|
return __generator(this, function (_a) {
|
|
@@ -106,6 +108,8 @@ var HttpClient = /** @class */ (function () {
|
|
|
106
108
|
_a.trys.push([0, 2, , 3]);
|
|
107
109
|
reqConfig = retryConfig ? __assign(__assign({}, this.axiosOptions), { 'axios-retry': retryConfig }) : __assign({}, this.axiosOptions);
|
|
108
110
|
reqConfig.params = queryParams;
|
|
111
|
+
reqConfig.auth = auth;
|
|
112
|
+
reqConfig.headers = headers;
|
|
109
113
|
return [4 /*yield*/, this.axiosClient.get(url, reqConfig)];
|
|
110
114
|
case 1:
|
|
111
115
|
res = _a.sent();
|
|
@@ -119,7 +123,7 @@ var HttpClient = /** @class */ (function () {
|
|
|
119
123
|
});
|
|
120
124
|
});
|
|
121
125
|
};
|
|
122
|
-
HttpClient.prototype.post = function (url, body, queryParams, retryConfig) {
|
|
126
|
+
HttpClient.prototype.post = function (url, body, queryParams, retryConfig, auth, headers) {
|
|
123
127
|
return __awaiter(this, void 0, void 0, function () {
|
|
124
128
|
var reqConfig, res, err_2, error;
|
|
125
129
|
return __generator(this, function (_a) {
|
|
@@ -128,6 +132,8 @@ var HttpClient = /** @class */ (function () {
|
|
|
128
132
|
_a.trys.push([0, 2, , 3]);
|
|
129
133
|
reqConfig = retryConfig ? __assign(__assign({}, this.axiosOptions), { 'axios-retry': retryConfig }) : this.axiosOptions;
|
|
130
134
|
reqConfig.params = queryParams;
|
|
135
|
+
reqConfig.auth = auth;
|
|
136
|
+
reqConfig.headers = headers;
|
|
131
137
|
return [4 /*yield*/, this.axiosClient.post(url, body, reqConfig)];
|
|
132
138
|
case 1:
|
|
133
139
|
res = _a.sent();
|
|
@@ -141,7 +147,7 @@ var HttpClient = /** @class */ (function () {
|
|
|
141
147
|
});
|
|
142
148
|
});
|
|
143
149
|
};
|
|
144
|
-
HttpClient.prototype.put = function (url, body, queryParams, retryConfig) {
|
|
150
|
+
HttpClient.prototype.put = function (url, body, queryParams, retryConfig, auth, headers) {
|
|
145
151
|
return __awaiter(this, void 0, void 0, function () {
|
|
146
152
|
var reqConfig, res, err_3, error;
|
|
147
153
|
return __generator(this, function (_a) {
|
|
@@ -150,6 +156,8 @@ var HttpClient = /** @class */ (function () {
|
|
|
150
156
|
_a.trys.push([0, 2, , 3]);
|
|
151
157
|
reqConfig = retryConfig ? __assign(__assign({}, this.axiosOptions), { 'axios-retry': retryConfig }) : this.axiosOptions;
|
|
152
158
|
reqConfig.params = queryParams;
|
|
159
|
+
reqConfig.auth = auth;
|
|
160
|
+
reqConfig.headers = headers;
|
|
153
161
|
return [4 /*yield*/, this.axiosClient.put(url, body, reqConfig)];
|
|
154
162
|
case 1:
|
|
155
163
|
res = _a.sent();
|
|
@@ -163,7 +171,7 @@ var HttpClient = /** @class */ (function () {
|
|
|
163
171
|
});
|
|
164
172
|
});
|
|
165
173
|
};
|
|
166
|
-
HttpClient.prototype.delete = function (url, queryParams, retryConfig) {
|
|
174
|
+
HttpClient.prototype.delete = function (url, queryParams, retryConfig, auth, headers) {
|
|
167
175
|
return __awaiter(this, void 0, void 0, function () {
|
|
168
176
|
var reqConfig, res, err_4, error;
|
|
169
177
|
return __generator(this, function (_a) {
|
|
@@ -172,6 +180,8 @@ var HttpClient = /** @class */ (function () {
|
|
|
172
180
|
_a.trys.push([0, 2, , 3]);
|
|
173
181
|
reqConfig = retryConfig ? __assign(__assign({}, this.axiosOptions), { 'axios-retry': retryConfig }) : this.axiosOptions;
|
|
174
182
|
reqConfig.params = queryParams;
|
|
183
|
+
reqConfig.auth = auth;
|
|
184
|
+
reqConfig.headers = headers;
|
|
175
185
|
return [4 /*yield*/, this.axiosClient.delete(url, reqConfig)];
|
|
176
186
|
case 1:
|
|
177
187
|
res = _a.sent();
|
|
@@ -185,7 +195,7 @@ var HttpClient = /** @class */ (function () {
|
|
|
185
195
|
});
|
|
186
196
|
});
|
|
187
197
|
};
|
|
188
|
-
HttpClient.prototype.head = function (url, queryParams, retryConfig) {
|
|
198
|
+
HttpClient.prototype.head = function (url, queryParams, retryConfig, auth, headers) {
|
|
189
199
|
return __awaiter(this, void 0, void 0, function () {
|
|
190
200
|
var reqConfig, res, err_5, error;
|
|
191
201
|
return __generator(this, function (_a) {
|
|
@@ -194,6 +204,8 @@ var HttpClient = /** @class */ (function () {
|
|
|
194
204
|
_a.trys.push([0, 2, , 3]);
|
|
195
205
|
reqConfig = retryConfig ? __assign(__assign({}, this.axiosOptions), { 'axios-retry': retryConfig }) : this.axiosOptions;
|
|
196
206
|
reqConfig.params = queryParams;
|
|
207
|
+
reqConfig.auth = auth;
|
|
208
|
+
reqConfig.headers = headers;
|
|
197
209
|
return [4 /*yield*/, this.axiosClient.head(url, reqConfig)];
|
|
198
210
|
case 1:
|
|
199
211
|
res = _a.sent();
|
|
@@ -207,7 +219,7 @@ var HttpClient = /** @class */ (function () {
|
|
|
207
219
|
});
|
|
208
220
|
});
|
|
209
221
|
};
|
|
210
|
-
HttpClient.prototype.options = function (url, queryParams, retryConfig) {
|
|
222
|
+
HttpClient.prototype.options = function (url, queryParams, retryConfig, auth, headers) {
|
|
211
223
|
return __awaiter(this, void 0, void 0, function () {
|
|
212
224
|
var reqConfig, res, err_6, error;
|
|
213
225
|
return __generator(this, function (_a) {
|
|
@@ -216,6 +228,8 @@ var HttpClient = /** @class */ (function () {
|
|
|
216
228
|
_a.trys.push([0, 2, , 3]);
|
|
217
229
|
reqConfig = retryConfig ? __assign(__assign({}, this.axiosOptions), { 'axios-retry': retryConfig }) : this.axiosOptions;
|
|
218
230
|
reqConfig.params = queryParams;
|
|
231
|
+
reqConfig.auth = auth;
|
|
232
|
+
reqConfig.headers = headers;
|
|
219
233
|
return [4 /*yield*/, this.axiosClient.options(url, reqConfig)];
|
|
220
234
|
case 1:
|
|
221
235
|
res = _a.sent();
|
|
@@ -229,7 +243,7 @@ var HttpClient = /** @class */ (function () {
|
|
|
229
243
|
});
|
|
230
244
|
});
|
|
231
245
|
};
|
|
232
|
-
HttpClient.prototype.patch = function (url, body, queryParams, retryConfig) {
|
|
246
|
+
HttpClient.prototype.patch = function (url, body, queryParams, retryConfig, auth, headers) {
|
|
233
247
|
return __awaiter(this, void 0, void 0, function () {
|
|
234
248
|
var reqConfig, res, err_7, error;
|
|
235
249
|
return __generator(this, function (_a) {
|
|
@@ -238,6 +252,8 @@ var HttpClient = /** @class */ (function () {
|
|
|
238
252
|
_a.trys.push([0, 2, , 3]);
|
|
239
253
|
reqConfig = retryConfig ? __assign(__assign({}, this.axiosOptions), { 'axios-retry': retryConfig }) : this.axiosOptions;
|
|
240
254
|
reqConfig.params = queryParams;
|
|
255
|
+
reqConfig.auth = auth;
|
|
256
|
+
reqConfig.headers = headers;
|
|
241
257
|
return [4 /*yield*/, this.axiosClient.patch(url, body, reqConfig)];
|
|
242
258
|
case 1:
|
|
243
259
|
res = _a.sent();
|
|
@@ -253,36 +269,46 @@ var HttpClient = /** @class */ (function () {
|
|
|
253
269
|
};
|
|
254
270
|
HttpClient.prototype.wrapError = function (url, err, body) {
|
|
255
271
|
var _a;
|
|
256
|
-
var message = lodash_1.get(err, 'response.data.message', undefined);
|
|
272
|
+
var message = (0, lodash_1.get)(err, 'response.data.message', undefined);
|
|
257
273
|
switch ((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) {
|
|
258
274
|
case http_status_codes_1.default.BAD_REQUEST:
|
|
259
275
|
if (body !== undefined) {
|
|
260
276
|
body = JSON.stringify(body);
|
|
261
|
-
|
|
277
|
+
if (!this.disableDebugLogs) {
|
|
278
|
+
this.logger.debug("invalid request sent to ".concat(this.targetService, " at ").concat(url, ". body: ").concat(body, ". error: ").concat(err.message));
|
|
279
|
+
}
|
|
262
280
|
}
|
|
263
|
-
else {
|
|
264
|
-
this.logger.debug("invalid request sent to "
|
|
281
|
+
else if (!this.disableDebugLogs) {
|
|
282
|
+
this.logger.debug("invalid request sent to ".concat(this.targetService, " at ").concat(url, ". error: ").concat(err.message));
|
|
265
283
|
}
|
|
266
284
|
return new error_types_1.BadRequestError(err, message);
|
|
267
285
|
case http_status_codes_1.default.NOT_FOUND:
|
|
268
|
-
|
|
286
|
+
if (!this.disableDebugLogs) {
|
|
287
|
+
this.logger.debug("request url not found for service ".concat(this.targetService, ", target url: ").concat(url, ", error: ").concat(err.message));
|
|
288
|
+
}
|
|
269
289
|
return new error_types_1.NotFoundError(err, message);
|
|
270
290
|
case http_status_codes_1.default.CONFLICT:
|
|
271
|
-
|
|
291
|
+
if (!this.disableDebugLogs) {
|
|
292
|
+
this.logger.debug("request url conflicted, for service ".concat(this.targetService, ", target url: ").concat(url, ", error: ").concat(err.message));
|
|
293
|
+
}
|
|
272
294
|
return new error_types_1.ConflictError(err, message);
|
|
273
295
|
case http_status_codes_1.default.FORBIDDEN:
|
|
274
|
-
|
|
296
|
+
if (!this.disableDebugLogs) {
|
|
297
|
+
this.logger.debug("forbidden request sent service ".concat(this.targetService, ", target url: ").concat(url, ", error: ").concat(err.message));
|
|
298
|
+
}
|
|
275
299
|
throw new error_types_1.ForbiddenError(err, message);
|
|
276
300
|
case http_status_codes_1.default.UNAUTHORIZED:
|
|
277
|
-
|
|
301
|
+
if (!this.disableDebugLogs) {
|
|
302
|
+
this.logger.debug("unauthorized request sent service ".concat(this.targetService, ", target url: ").concat(url, ", error: ").concat(err.message));
|
|
303
|
+
}
|
|
278
304
|
throw new error_types_1.UnauthorizedError(err, message);
|
|
279
305
|
default:
|
|
280
306
|
if (body !== undefined) {
|
|
281
307
|
body = JSON.stringify(body);
|
|
282
|
-
this.logger.error("error from "
|
|
308
|
+
this.logger.error("error from ".concat(this.targetService, " at ").concat(url, ". body: ").concat(body, ". error: ").concat(err.message));
|
|
283
309
|
}
|
|
284
310
|
else {
|
|
285
|
-
this.logger.error("error from "
|
|
311
|
+
this.logger.error("error from ".concat(this.targetService, " at ").concat(url, ". error: ").concat(err.message));
|
|
286
312
|
}
|
|
287
313
|
return new error_types_1.InternalServerError(err);
|
|
288
314
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpClient.js","sourceRoot":"","sources":["../../../src/communication/http/httpClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"httpClient.js","sourceRoot":"","sources":["../../../src/communication/http/httpClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAoG;AACpG,wEAA2C;AAC3C,yDAA8E;AAC9E,iCAA6C;AAC7C,yDAQmC;AASnC;IAIE,oBACqB,MAAe,EAClC,OAAe,EACE,aAAkB,EACnC,WAA8B,EACb,gBAAwB;QAL3C,iBAsBC;QAnBkB,8BAAA,EAAA,kBAAkB;QAElB,iCAAA,EAAA,wBAAwB;;QAJtB,WAAM,GAAN,MAAM,CAAS;QAEjB,kBAAa,GAAb,aAAa,CAAK;QAElB,qBAAgB,GAAhB,gBAAgB,CAAQ;QARjC,iBAAY,GAAuB,EAAE,CAAC;QAU9C,IAAI,CAAC,WAAW,GAAG,eAAK,CAAC,MAAM,EAAE,CAAC;QAElC,IAAI,CAAC,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;QACpC,IAAM,gBAAgB,GAAsB,WAAW;YACrD,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;YAC/B,CAAC,CAAC;gBACE,OAAO,EAAE,CAAC;aACX,CAAC;QAEN,IAAM,SAAS,GAAG,MAAA,gBAAgB,CAAC,UAAU,mCAAI,CAAC,cAAc,OAAA,CAAC,EAAD,CAAC,CAAC,CAAC;QACnE,gBAAgB,CAAC,UAAU,GAAG,UAAC,UAAkB,EAAE,KAAiB;YAClE,KA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