sm-utility 2.3.3 → 2.3.5
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/errors/index.js +2 -2
- package/excel/excel-creator/excelCreatorCustomizer.js +8 -8
- package/excel/interfaces.d.ts +4 -4
- package/general/index.js +1 -1
- package/index.js +5 -1
- package/infrastructure/aws/index.js +5 -1
- package/infrastructure/index.js +5 -1
- package/infrastructure/redis/cacheClient.d.ts +48 -4
- package/infrastructure/redis/cacheClient.js +1 -1
- package/infrastructure/redis/index.js +5 -1
- package/logger/index.js +4 -4
- package/package.json +2 -2
- package/request/axios/index.js +5 -1
- package/request/axios-custom-client.js +1 -1
- package/request/index.js +5 -1
- package/request/types.d.ts +2 -2
- package/stubs/index.d.ts +4 -4
package/errors/index.js
CHANGED
|
@@ -11,10 +11,10 @@ class ErrorModel {
|
|
|
11
11
|
return this.error;
|
|
12
12
|
}
|
|
13
13
|
isAxios() {
|
|
14
|
-
return axios_1.isAxiosError(this.error);
|
|
14
|
+
return (0, axios_1.isAxiosError)(this.error);
|
|
15
15
|
}
|
|
16
16
|
isTimeout() {
|
|
17
|
-
return axios_1.isAxiosError(this.error) && this.error.code === this.timeoutErrorCode;
|
|
17
|
+
return (0, axios_1.isAxiosError)(this.error) && this.error.code === this.timeoutErrorCode;
|
|
18
18
|
}
|
|
19
19
|
enrichMessage(message) {
|
|
20
20
|
this.error.message =
|
|
@@ -6,7 +6,7 @@ class ExcelCreatorCustomizer {
|
|
|
6
6
|
if (!structure)
|
|
7
7
|
return element;
|
|
8
8
|
let formattedValue = element;
|
|
9
|
-
if (structure.type === "options" /* OPTIONS */ && structure.options)
|
|
9
|
+
if (structure.type === "options" /* ExcelType.OPTIONS */ && structure.options)
|
|
10
10
|
this.validOptionsValue(element, structure.options);
|
|
11
11
|
if (structure.customFormat)
|
|
12
12
|
formattedValue = this.formatValue(element, structure.customFormat);
|
|
@@ -24,36 +24,36 @@ class ExcelCreatorCustomizer {
|
|
|
24
24
|
formatValue(value, customFormat) {
|
|
25
25
|
var _a;
|
|
26
26
|
switch (customFormat) {
|
|
27
|
-
case "123" /* NUMBER */:
|
|
27
|
+
case "123" /* ExcelFormat.NUMBER */:
|
|
28
28
|
return value.toString();
|
|
29
|
-
case "MM/YYYY" /* DATE */: {
|
|
29
|
+
case "MM/YYYY" /* ExcelFormat.DATE */: {
|
|
30
30
|
const date = new Date(value);
|
|
31
31
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
32
32
|
const year = date.getFullYear();
|
|
33
33
|
return `${month}/${year}`;
|
|
34
34
|
}
|
|
35
|
-
case "DD/MM/YYYY" /* FULL_DATE_BR */: {
|
|
35
|
+
case "DD/MM/YYYY" /* ExcelFormat.FULL_DATE_BR */: {
|
|
36
36
|
const date = new Date(value);
|
|
37
37
|
const day = date.getDate().toString().padStart(2, '0');
|
|
38
38
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
39
39
|
const year = date.getFullYear();
|
|
40
40
|
return `${day}/${month}/${year}`;
|
|
41
41
|
}
|
|
42
|
-
case "YYYY/MM/DD" /* FULL_DATE_EN */: {
|
|
42
|
+
case "YYYY/MM/DD" /* ExcelFormat.FULL_DATE_EN */: {
|
|
43
43
|
const date = new Date(value);
|
|
44
44
|
const day = date.getDate().toString().padStart(2, '0');
|
|
45
45
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
46
46
|
const year = date.getFullYear();
|
|
47
47
|
return `${year}-${month}/${day}`;
|
|
48
48
|
}
|
|
49
|
-
case "R$ 0.00" /* MONEY */:
|
|
49
|
+
case "R$ 0.00" /* ExcelFormat.MONEY */:
|
|
50
50
|
return parseFloat(value).toLocaleString("pt-BR", {
|
|
51
51
|
style: "currency",
|
|
52
52
|
currency: "BRL",
|
|
53
53
|
});
|
|
54
|
-
case "0%" /* PERCENTAGE */:
|
|
54
|
+
case "0%" /* ExcelFormat.PERCENTAGE */:
|
|
55
55
|
return `${value}%`;
|
|
56
|
-
case "0" /* ZERO_DEFAULT */:
|
|
56
|
+
case "0" /* ExcelFormat.ZERO_DEFAULT */:
|
|
57
57
|
return (_a = value.toString()) !== null && _a !== void 0 ? _a : "0";
|
|
58
58
|
default:
|
|
59
59
|
return value;
|
package/excel/interfaces.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface IFormatStructure {
|
|
|
20
20
|
options?: string[];
|
|
21
21
|
customFormatCallback?: string;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
type parseOptions = Parameters<typeof xlsx.parse>['1'];
|
|
24
24
|
export interface IExcelParserData {
|
|
25
25
|
filename: string;
|
|
26
26
|
uploadFolderPath: string;
|
|
@@ -30,11 +30,11 @@ export interface IExcelSheet {
|
|
|
30
30
|
name: string;
|
|
31
31
|
data: string[][];
|
|
32
32
|
}
|
|
33
|
-
export
|
|
34
|
-
export
|
|
33
|
+
export type IWorkerResult = IWorkerSuccessResult | IWorkerFailedResult;
|
|
34
|
+
export type IWorkerSuccessResult = {
|
|
35
35
|
file: Buffer;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type IWorkerFailedResult = {
|
|
38
38
|
error: Error;
|
|
39
39
|
};
|
|
40
40
|
export {};
|
package/general/index.js
CHANGED
|
@@ -39,7 +39,7 @@ function mergeDeep(target, source) {
|
|
|
39
39
|
exports.mergeDeep = mergeDeep;
|
|
40
40
|
function shortUniqueId() {
|
|
41
41
|
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
42
|
-
const nanoid = nanoid_1.customAlphabet(alphabet, 8);
|
|
42
|
+
const nanoid = (0, nanoid_1.customAlphabet)(alphabet, 8);
|
|
43
43
|
return nanoid();
|
|
44
44
|
}
|
|
45
45
|
exports.shortUniqueId = shortUniqueId;
|
package/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/infrastructure/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createClient } from 'redis';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type RedisClientType = ReturnType<typeof createClient>;
|
|
3
|
+
export type RedisClientOptions = Parameters<typeof createClient>[0];
|
|
4
4
|
export declare class CacheClient {
|
|
5
5
|
private static instance;
|
|
6
6
|
private client;
|
|
@@ -20,10 +20,10 @@ export declare class CacheClient {
|
|
|
20
20
|
list: typeof import("@redis/graph/dist/commands/LIST");
|
|
21
21
|
PROFILE: typeof import("@redis/graph/dist/commands/PROFILE");
|
|
22
22
|
profile: typeof import("@redis/graph/dist/commands/PROFILE");
|
|
23
|
-
QUERY_RO: typeof import("@redis/graph/dist/commands/QUERY_RO");
|
|
24
|
-
queryRo: typeof import("@redis/graph/dist/commands/QUERY_RO");
|
|
25
23
|
QUERY: typeof import("@redis/graph/dist/commands/QUERY");
|
|
26
24
|
query: typeof import("@redis/graph/dist/commands/QUERY");
|
|
25
|
+
RO_QUERY: typeof import("@redis/graph/dist/commands/RO_QUERY");
|
|
26
|
+
roQuery: typeof import("@redis/graph/dist/commands/RO_QUERY");
|
|
27
27
|
SLOWLOG: typeof import("@redis/graph/dist/commands/SLOWLOG");
|
|
28
28
|
slowLog: typeof import("@redis/graph/dist/commands/SLOWLOG");
|
|
29
29
|
};
|
|
@@ -48,8 +48,12 @@ export declare class CacheClient {
|
|
|
48
48
|
forget: typeof import("@redis/json/dist/commands/FORGET");
|
|
49
49
|
GET: typeof import("@redis/json/dist/commands/GET");
|
|
50
50
|
get: typeof import("@redis/json/dist/commands/GET");
|
|
51
|
+
MERGE: typeof import("@redis/json/dist/commands/MERGE");
|
|
52
|
+
merge: typeof import("@redis/json/dist/commands/MERGE");
|
|
51
53
|
MGET: typeof import("@redis/json/dist/commands/MGET");
|
|
52
54
|
mGet: typeof import("@redis/json/dist/commands/MGET");
|
|
55
|
+
MSET: typeof import("@redis/json/dist/commands/MSET");
|
|
56
|
+
mSet: typeof import("@redis/json/dist/commands/MSET");
|
|
53
57
|
NUMINCRBY: typeof import("@redis/json/dist/commands/NUMINCRBY");
|
|
54
58
|
numIncrBy: typeof import("@redis/json/dist/commands/NUMINCRBY");
|
|
55
59
|
NUMMULTBY: typeof import("@redis/json/dist/commands/NUMMULTBY");
|
|
@@ -74,6 +78,8 @@ export declare class CacheClient {
|
|
|
74
78
|
_list: typeof import("@redis/search/dist/commands/_LIST");
|
|
75
79
|
ALTER: typeof import("@redis/search/dist/commands/ALTER");
|
|
76
80
|
alter: typeof import("@redis/search/dist/commands/ALTER");
|
|
81
|
+
AGGREGATE_WITHCURSOR: typeof import("@redis/search/dist/commands/AGGREGATE_WITHCURSOR");
|
|
82
|
+
aggregateWithCursor: typeof import("@redis/search/dist/commands/AGGREGATE_WITHCURSOR");
|
|
77
83
|
AGGREGATE: typeof import("@redis/search/dist/commands/AGGREGATE");
|
|
78
84
|
aggregate: typeof import("@redis/search/dist/commands/AGGREGATE");
|
|
79
85
|
ALIASADD: typeof import("@redis/search/dist/commands/ALIASADD");
|
|
@@ -88,6 +94,10 @@ export declare class CacheClient {
|
|
|
88
94
|
configSet: typeof import("@redis/search/dist/commands/CONFIG_SET");
|
|
89
95
|
CREATE: typeof import("@redis/search/dist/commands/CREATE");
|
|
90
96
|
create: typeof import("@redis/search/dist/commands/CREATE");
|
|
97
|
+
CURSOR_DEL: typeof import("@redis/search/dist/commands/CURSOR_DEL");
|
|
98
|
+
cursorDel: typeof import("@redis/search/dist/commands/CURSOR_DEL");
|
|
99
|
+
CURSOR_READ: typeof import("@redis/search/dist/commands/CURSOR_READ");
|
|
100
|
+
cursorRead: typeof import("@redis/search/dist/commands/CURSOR_READ");
|
|
91
101
|
DICTADD: typeof import("@redis/search/dist/commands/DICTADD");
|
|
92
102
|
dictAdd: typeof import("@redis/search/dist/commands/DICTADD");
|
|
93
103
|
DICTDEL: typeof import("@redis/search/dist/commands/DICTDEL");
|
|
@@ -108,6 +118,8 @@ export declare class CacheClient {
|
|
|
108
118
|
profileAggregate: typeof import("@redis/search/dist/commands/PROFILE_AGGREGATE");
|
|
109
119
|
SEARCH: typeof import("@redis/search/dist/commands/SEARCH");
|
|
110
120
|
search: typeof import("@redis/search/dist/commands/SEARCH");
|
|
121
|
+
SEARCH_NOCONTENT: typeof import("@redis/search/dist/commands/SEARCH_NOCONTENT");
|
|
122
|
+
searchNoContent: typeof import("@redis/search/dist/commands/SEARCH_NOCONTENT");
|
|
111
123
|
SPELLCHECK: typeof import("@redis/search/dist/commands/SPELLCHECK");
|
|
112
124
|
spellCheck: typeof import("@redis/search/dist/commands/SPELLCHECK");
|
|
113
125
|
SUGADD: typeof import("@redis/search/dist/commands/SUGADD");
|
|
@@ -178,6 +190,8 @@ export declare class CacheClient {
|
|
|
178
190
|
bf: {
|
|
179
191
|
ADD: typeof import("@redis/bloom/dist/commands/bloom/ADD");
|
|
180
192
|
add: typeof import("@redis/bloom/dist/commands/bloom/ADD");
|
|
193
|
+
CARD: typeof import("@redis/bloom/dist/commands/bloom/CARD");
|
|
194
|
+
card: typeof import("@redis/bloom/dist/commands/bloom/CARD");
|
|
181
195
|
EXISTS: typeof import("@redis/bloom/dist/commands/bloom/EXISTS");
|
|
182
196
|
exists: typeof import("@redis/bloom/dist/commands/bloom/EXISTS");
|
|
183
197
|
INFO: typeof import("@redis/bloom/dist/commands/bloom/INFO");
|
|
@@ -233,6 +247,36 @@ export declare class CacheClient {
|
|
|
233
247
|
SCANDUMP: typeof import("@redis/bloom/dist/commands/cuckoo/SCANDUMP");
|
|
234
248
|
scanDump: typeof import("@redis/bloom/dist/commands/cuckoo/SCANDUMP");
|
|
235
249
|
};
|
|
250
|
+
tDigest: {
|
|
251
|
+
ADD: typeof import("@redis/bloom/dist/commands/t-digest/ADD");
|
|
252
|
+
add: typeof import("@redis/bloom/dist/commands/t-digest/ADD");
|
|
253
|
+
BYRANK: typeof import("@redis/bloom/dist/commands/t-digest/BYRANK");
|
|
254
|
+
byRank: typeof import("@redis/bloom/dist/commands/t-digest/BYRANK");
|
|
255
|
+
BYREVRANK: typeof import("@redis/bloom/dist/commands/t-digest/BYREVRANK");
|
|
256
|
+
byRevRank: typeof import("@redis/bloom/dist/commands/t-digest/BYREVRANK");
|
|
257
|
+
CDF: typeof import("@redis/bloom/dist/commands/t-digest/CDF");
|
|
258
|
+
cdf: typeof import("@redis/bloom/dist/commands/t-digest/CDF");
|
|
259
|
+
CREATE: typeof import("@redis/bloom/dist/commands/t-digest/CREATE");
|
|
260
|
+
create: typeof import("@redis/bloom/dist/commands/t-digest/CREATE");
|
|
261
|
+
INFO: typeof import("@redis/bloom/dist/commands/t-digest/INFO");
|
|
262
|
+
info: typeof import("@redis/bloom/dist/commands/t-digest/INFO");
|
|
263
|
+
MAX: typeof import("@redis/bloom/dist/commands/t-digest/MAX");
|
|
264
|
+
max: typeof import("@redis/bloom/dist/commands/t-digest/MAX");
|
|
265
|
+
MERGE: typeof import("@redis/bloom/dist/commands/t-digest/MERGE");
|
|
266
|
+
merge: typeof import("@redis/bloom/dist/commands/t-digest/MERGE");
|
|
267
|
+
MIN: typeof import("@redis/bloom/dist/commands/t-digest/MIN");
|
|
268
|
+
min: typeof import("@redis/bloom/dist/commands/t-digest/MIN");
|
|
269
|
+
QUANTILE: typeof import("@redis/bloom/dist/commands/t-digest/QUANTILE");
|
|
270
|
+
quantile: typeof import("@redis/bloom/dist/commands/t-digest/QUANTILE");
|
|
271
|
+
RANK: typeof import("@redis/bloom/dist/commands/t-digest/RANK");
|
|
272
|
+
rank: typeof import("@redis/bloom/dist/commands/t-digest/RANK");
|
|
273
|
+
RESET: typeof import("@redis/bloom/dist/commands/t-digest/RESET");
|
|
274
|
+
reset: typeof import("@redis/bloom/dist/commands/t-digest/RESET");
|
|
275
|
+
REVRANK: typeof import("@redis/bloom/dist/commands/t-digest/REVRANK");
|
|
276
|
+
revRank: typeof import("@redis/bloom/dist/commands/t-digest/REVRANK");
|
|
277
|
+
TRIMMED_MEAN: typeof import("@redis/bloom/dist/commands/t-digest/TRIMMED_MEAN");
|
|
278
|
+
trimmedMean: typeof import("@redis/bloom/dist/commands/t-digest/TRIMMED_MEAN");
|
|
279
|
+
};
|
|
236
280
|
topK: {
|
|
237
281
|
ADD: typeof import("@redis/bloom/dist/commands/top-k/ADD");
|
|
238
282
|
add: typeof import("@redis/bloom/dist/commands/top-k/ADD");
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getCacheClient = exports.CacheClient = void 0;
|
|
4
4
|
const redis_1 = require("redis");
|
|
5
5
|
const factory = (options) => {
|
|
6
|
-
return redis_1.createClient(options);
|
|
6
|
+
return (0, redis_1.createClient)(options);
|
|
7
7
|
};
|
|
8
8
|
class CacheClient {
|
|
9
9
|
static getInstance() {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/logger/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const express_winston_1 = __importDefault(require("express-winston"));
|
|
|
10
10
|
const ecs_winston_format_1 = __importDefault(require("@elastic/ecs-winston-format"));
|
|
11
11
|
let configs;
|
|
12
12
|
try {
|
|
13
|
-
configs = require(process_1.cwd() + '/logger.config');
|
|
13
|
+
configs = require((0, process_1.cwd)() + '/logger.config');
|
|
14
14
|
}
|
|
15
15
|
catch {
|
|
16
16
|
throw Error("Logger configs could not be found on app root's directory.");
|
|
@@ -106,12 +106,12 @@ function createLoggerMiddleware() {
|
|
|
106
106
|
transports: getTransports(),
|
|
107
107
|
requestFilter: filterRequestHeaders(configs.confidentialHeaders || []),
|
|
108
108
|
ignoreRoute: routeFilter,
|
|
109
|
-
format: winston_1.default.format.combine(formatBlacklistedBody(), ecs_winston_format_1.default({ convertReqRes: true })),
|
|
109
|
+
format: winston_1.default.format.combine(formatBlacklistedBody(), (0, ecs_winston_format_1.default)({ convertReqRes: true })),
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
function createErrorLoggerMiddleware() {
|
|
113
113
|
return express_winston_1.default.errorLogger({
|
|
114
|
-
format: ecs_winston_format_1.default({ convertReqRes: true }),
|
|
114
|
+
format: (0, ecs_winston_format_1.default)({ convertReqRes: true }),
|
|
115
115
|
transports: getTransports(),
|
|
116
116
|
requestFilter: filterRequestHeaders(configs.confidentialHeaders || []),
|
|
117
117
|
});
|
|
@@ -119,7 +119,7 @@ function createErrorLoggerMiddleware() {
|
|
|
119
119
|
exports.loggerMiddleware = createLoggerMiddleware();
|
|
120
120
|
exports.logError = createErrorLoggerMiddleware();
|
|
121
121
|
exports.logger = winston_1.default.createLogger({
|
|
122
|
-
format: ecs_winston_format_1.default({ convertReqRes: true }),
|
|
122
|
+
format: (0, ecs_winston_format_1.default)({ convertReqRes: true }),
|
|
123
123
|
transports: getTransports(),
|
|
124
124
|
exitOnError: false,
|
|
125
125
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sm-utility",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.5",
|
|
4
4
|
"description": "reusable utility codes for sm projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"axios": "^1.6.8",
|
|
32
32
|
"express-winston": "^4.1.0",
|
|
33
33
|
"nanoid": "^3.3.6",
|
|
34
|
-
"node-xlsx": "^0.
|
|
34
|
+
"node-xlsx": "^0.24.0",
|
|
35
35
|
"redis": "^4.1.0",
|
|
36
36
|
"ts-node": "^10.9.1",
|
|
37
37
|
"uuid": "^8.3.2",
|
package/request/axios/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -15,7 +15,7 @@ function createApi(axiosConfig) {
|
|
|
15
15
|
const { data, params, method } = request;
|
|
16
16
|
const fullUrl = getFullUrlFromConfig(request);
|
|
17
17
|
request.meta = request.meta || {};
|
|
18
|
-
request.meta.requestId = uuid_1.v4();
|
|
18
|
+
request.meta.requestId = (0, uuid_1.v4)();
|
|
19
19
|
request.meta.requestStartedAt = new Date().getTime();
|
|
20
20
|
logRequest(request.meta.requestId, method, fullUrl, data, params);
|
|
21
21
|
}
|
package/request/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/request/types.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ declare module 'axios' {
|
|
|
7
7
|
logResponse?: boolean;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export
|
|
11
|
-
export
|
|
10
|
+
export type CustomClientCreateApiParams = Omit<AxiosRequestConfig, 'meta'>;
|
|
11
|
+
export type SmAxiosInstance = ReturnType<typeof createApi>;
|
package/stubs/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
type GenericClass<T> = (new (...args: any[]) => T);
|
|
2
|
+
type UnwrapPromise<T> = T extends Promise<infer U> ? U : T;
|
|
3
|
+
type TypesByMethodNames<T> = {
|
|
4
4
|
[K in keyof T]?: T[K] extends (...args: any[]) => infer R ? R : never;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type ResolvedTypesByMethodNames<T> = {
|
|
7
7
|
[K in keyof T]?: T[K] extends (...args: any[]) => infer R ? UnwrapPromise<R> : never;
|
|
8
8
|
};
|
|
9
9
|
/**
|