@map-colonies/mc-utils 1.4.1 → 1.4.3
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/CHANGELOG.md +64 -0
- package/dist/arrays/index.d.ts +1 -1
- package/dist/arrays/index.js +13 -13
- package/dist/arrays/subGroups.d.ts +8 -8
- package/dist/arrays/subGroups.js +138 -138
- package/dist/communication/http/httpClient.d.ts +26 -26
- package/dist/communication/http/httpClient.js +333 -333
- package/dist/communication/http/index.d.ts +1 -1
- package/dist/communication/http/index.js +13 -13
- package/dist/communication/index.d.ts +1 -1
- package/dist/communication/index.js +13 -13
- package/dist/geo/bboxUtils.d.ts +23 -23
- package/dist/geo/bboxUtils.js +84 -84
- package/dist/geo/geoConvertor.d.ts +18 -18
- package/dist/geo/geoConvertor.js +51 -51
- package/dist/geo/geoHash.d.ts +24 -24
- package/dist/geo/geoHash.js +242 -242
- package/dist/geo/geoIntersection.d.ts +12 -12
- package/dist/geo/geoIntersection.js +27 -27
- package/dist/geo/index.d.ts +8 -8
- package/dist/geo/index.js +20 -20
- package/dist/geo/tileBatcher.d.ts +8 -8
- package/dist/geo/tileBatcher.js +167 -167
- package/dist/geo/tileRanger.d.ts +39 -39
- package/dist/geo/tileRanger.js +254 -254
- package/dist/geo/tiles.d.ts +32 -32
- package/dist/geo/tiles.js +65 -65
- package/dist/geo/tiles.js.map +1 -1
- package/dist/geo/tilesGenerator.d.ts +2 -2
- package/dist/geo/tilesGenerator.js +94 -94
- package/dist/index.d.ts +4 -4
- package/dist/index.js +16 -16
- package/dist/models/enums/geo/index.d.ts +1 -1
- package/dist/models/enums/geo/index.js +13 -13
- package/dist/models/enums/geo/tileOrigin.d.ts +7 -7
- package/dist/models/enums/geo/tileOrigin.js +11 -11
- package/dist/models/enums/index.d.ts +1 -1
- package/dist/models/enums/index.js +13 -13
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.js +14 -14
- package/dist/models/interfaces/geo/iPoint.d.ts +7 -7
- package/dist/models/interfaces/geo/iPoint.js +2 -2
- package/dist/models/interfaces/geo/iTile.d.ts +15 -15
- package/dist/models/interfaces/geo/iTile.js +2 -2
- package/dist/models/interfaces/geo/index.d.ts +2 -2
- package/dist/models/interfaces/geo/index.js +14 -14
- package/dist/models/interfaces/iLogger.d.ts +6 -6
- package/dist/models/interfaces/iLogger.js +2 -2
- package/dist/models/interfaces/index.d.ts +2 -2
- package/dist/models/interfaces/index.js +14 -14
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### [1.4.3](https://github.com/MapColonies/mc-utils/compare/v1.4.1...v1.4.3) (2022-03-23)
|
|
6
|
+
|
|
7
|
+
### [1.4.2](https://github.com/MapColonies/mc-utils/compare/v1.4.1...v1.4.2) (2022-03-23)
|
|
8
|
+
|
|
9
|
+
### [1.4.1](https://github.com/MapColonies/mc-utils/compare/v1.4.0...v1.4.1) (2022-02-17)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* http client global config ([#10](https://github.com/MapColonies/mc-utils/issues/10)) ([55a94bc](https://github.com/MapColonies/mc-utils/commit/55a94bc38ebefaface019d8e2535728386734e88))
|
|
15
|
+
|
|
16
|
+
## [1.4.0](https://github.com/MapColonies/mc-utils/compare/v1.3.0...v1.4.0) (2022-01-17)
|
|
17
|
+
|
|
18
|
+
### [1.3.1](https://github.com/MapColonies/mc-utils/compare/v1.3.0...v1.3.1) (2022-01-17)
|
|
19
|
+
|
|
20
|
+
## [1.3.0](https://github.com/MapColonies/mc-utils/compare/v1.1.2...v1.3.0) (2021-12-30)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* support basic auth and external headers ([#7](https://github.com/MapColonies/mc-utils/issues/7)) ([26b0c5d](https://github.com/MapColonies/mc-utils/commit/26b0c5d79ab38c6346de611dd415cf9e64bf1123))
|
|
26
|
+
|
|
27
|
+
## [1.2.0](https://github.com/MapColonies/mc-utils/compare/v1.1.2...v1.2.0) (2021-12-01)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* support basic auth and external headers ([#7](https://github.com/MapColonies/mc-utils/issues/7)) ([26b0c5d](https://github.com/MapColonies/mc-utils/commit/26b0c5d79ab38c6346de611dd415cf9e64bf1123))
|
|
33
|
+
|
|
34
|
+
### [1.1.2](https://github.com/MapColonies/mc-utils/compare/v1.1.0...v1.1.2) (2021-08-31)
|
|
35
|
+
|
|
36
|
+
### [1.1.1](https://github.com/MapColonies/mc-utils/compare/v1.1.0...v1.1.1) (2021-08-31)
|
|
37
|
+
|
|
38
|
+
## [1.1.0](https://github.com/MapColonies/mc-utils/compare/v1.0.2...v1.1.0) (2021-08-12)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* Tile calculations ([#5](https://github.com/MapColonies/mc-utils/issues/5)) ([ea4c5ac](https://github.com/MapColonies/mc-utils/commit/ea4c5ac0941c7ee3d7c999e4034c0c44339db643))
|
|
44
|
+
|
|
45
|
+
### [1.0.2](https://github.com/MapColonies/mc-utils/compare/v1.0.1...v1.0.2) (2021-08-05)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Bug Fixes
|
|
49
|
+
|
|
50
|
+
* prepublish for npm v7 ([#4](https://github.com/MapColonies/mc-utils/issues/4)) ([382bf72](https://github.com/MapColonies/mc-utils/commit/382bf7236622668fd213bfa86911288d33cb24da))
|
|
51
|
+
|
|
52
|
+
### [1.0.1](https://github.com/MapColonies/mc-utils/compare/v1.0.0...v1.0.1) (2021-08-05)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* release command ([#2](https://github.com/MapColonies/mc-utils/issues/2)) ([8bad6a9](https://github.com/MapColonies/mc-utils/commit/8bad6a98de6359aa94ca22723a5ab7968e8b22a1))
|
|
58
|
+
|
|
59
|
+
## 1.0.0 (2021-07-28)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
* added http client ([#1](https://github.com/MapColonies/mc-utils/issues/1)) ([48ebf45](https://github.com/MapColonies/mc-utils/commit/48ebf45a62f07ae71cb1b23e8a6ad662da56590f))
|
package/dist/arrays/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './subGroups';
|
|
1
|
+
export * from './subGroups';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/arrays/index.js
CHANGED
|
@@ -1,14 +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);
|
|
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
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +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 };
|
|
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
9
|
//# sourceMappingURL=subGroups.d.ts.map
|
package/dist/arrays/subGroups.js
CHANGED
|
@@ -1,139 +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;
|
|
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
139
|
//# sourceMappingURL=subGroups.js.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { AxiosBasicCredentials, AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { IAxiosRetryConfig } from 'axios-retry';
|
|
3
|
-
import { ILogger } from '../../models/interfaces/iLogger';
|
|
4
|
-
export interface IHttpRetryConfig {
|
|
5
|
-
attempts: number;
|
|
6
|
-
delay: number | 'exponential';
|
|
7
|
-
shouldResetTimeout: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare abstract class HttpClient {
|
|
10
|
-
protected readonly logger: ILogger;
|
|
11
|
-
private readonly targetService;
|
|
12
|
-
private readonly disableDebugLogs;
|
|
13
|
-
protected axiosOptions: AxiosRequestConfig;
|
|
14
|
-
private readonly axiosClient;
|
|
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?: Record<string, unknown>): Promise<T>;
|
|
17
|
-
protected post<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
18
|
-
protected put<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
19
|
-
protected delete<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
20
|
-
protected head<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
21
|
-
protected options<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
22
|
-
protected patch<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
23
|
-
protected getRequestConfig(retryConfig: IAxiosRetryConfig | undefined, queryParams: Record<string, unknown> | undefined, auth: AxiosBasicCredentials | undefined, headers: Record<string, unknown> | undefined): AxiosRequestConfig;
|
|
24
|
-
private wrapError;
|
|
25
|
-
private parseConfig;
|
|
26
|
-
}
|
|
1
|
+
import { AxiosBasicCredentials, AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { IAxiosRetryConfig } from 'axios-retry';
|
|
3
|
+
import { ILogger } from '../../models/interfaces/iLogger';
|
|
4
|
+
export interface IHttpRetryConfig {
|
|
5
|
+
attempts: number;
|
|
6
|
+
delay: number | 'exponential';
|
|
7
|
+
shouldResetTimeout: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class HttpClient {
|
|
10
|
+
protected readonly logger: ILogger;
|
|
11
|
+
private readonly targetService;
|
|
12
|
+
private readonly disableDebugLogs;
|
|
13
|
+
protected axiosOptions: AxiosRequestConfig;
|
|
14
|
+
private readonly axiosClient;
|
|
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?: Record<string, unknown>): Promise<T>;
|
|
17
|
+
protected post<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
18
|
+
protected put<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
19
|
+
protected delete<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
20
|
+
protected head<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
21
|
+
protected options<T>(url: string, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
22
|
+
protected patch<T>(url: string, body?: unknown, queryParams?: Record<string, unknown>, retryConfig?: IAxiosRetryConfig, auth?: AxiosBasicCredentials, headers?: Record<string, unknown>): Promise<T>;
|
|
23
|
+
protected getRequestConfig(retryConfig: IAxiosRetryConfig | undefined, queryParams: Record<string, unknown> | undefined, auth: AxiosBasicCredentials | undefined, headers: Record<string, unknown> | undefined): AxiosRequestConfig;
|
|
24
|
+
private wrapError;
|
|
25
|
+
private parseConfig;
|
|
26
|
+
}
|
|
27
27
|
//# sourceMappingURL=httpClient.d.ts.map
|