@sectester/core 0.36.0 → 0.36.2

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.
Files changed (83) hide show
  1. package/README.md +54 -67
  2. package/package.json +3 -6
  3. package/src/DefaultProjects.d.ts +7 -0
  4. package/src/DefaultProjects.js +28 -0
  5. package/src/DefaultProjects.js.map +1 -0
  6. package/src/Projects.d.ts +8 -0
  7. package/src/Projects.js +5 -0
  8. package/src/Projects.js.map +1 -0
  9. package/src/api/ApiClient.d.ts +4 -0
  10. package/src/api/ApiClient.js +5 -0
  11. package/src/api/ApiClient.js.map +1 -0
  12. package/src/api/FetchApiClient.d.ts +21 -0
  13. package/src/api/FetchApiClient.js +95 -0
  14. package/src/api/FetchApiClient.js.map +1 -0
  15. package/src/api/RateLimiter.d.ts +16 -0
  16. package/src/api/RateLimiter.js +72 -0
  17. package/src/api/RateLimiter.js.map +1 -0
  18. package/src/api/RetryHandler.d.ts +22 -0
  19. package/src/api/RetryHandler.js +74 -0
  20. package/src/api/RetryHandler.js.map +1 -0
  21. package/src/api/index.d.ts +4 -0
  22. package/src/api/index.js +8 -0
  23. package/src/api/index.js.map +1 -0
  24. package/src/configuration/Configuration.d.ts +10 -8
  25. package/src/configuration/Configuration.js +55 -19
  26. package/src/configuration/Configuration.js.map +1 -1
  27. package/src/exceptions/ApiError.d.ts +5 -0
  28. package/src/exceptions/ApiError.js +12 -0
  29. package/src/exceptions/ApiError.js.map +1 -0
  30. package/src/exceptions/RateLimitError.d.ts +5 -0
  31. package/src/exceptions/RateLimitError.js +12 -0
  32. package/src/exceptions/RateLimitError.js.map +1 -0
  33. package/src/exceptions/index.d.ts +2 -1
  34. package/src/exceptions/index.js +2 -1
  35. package/src/exceptions/index.js.map +1 -1
  36. package/src/index.d.ts +4 -4
  37. package/src/index.js +4 -5
  38. package/src/index.js.map +1 -1
  39. package/src/register.d.ts +1 -1
  40. package/src/register.js +8 -17
  41. package/src/register.js.map +1 -1
  42. package/src/utils/index.d.ts +0 -2
  43. package/src/utils/index.js +0 -2
  44. package/src/utils/index.js.map +1 -1
  45. package/src/commands/Command.d.ts +0 -14
  46. package/src/commands/Command.js +0 -23
  47. package/src/commands/Command.js.map +0 -1
  48. package/src/commands/CommandDispatcher.d.ts +0 -5
  49. package/src/commands/CommandDispatcher.js +0 -5
  50. package/src/commands/CommandDispatcher.js.map +0 -1
  51. package/src/commands/HttpRequest.d.ts +0 -19
  52. package/src/commands/HttpRequest.js +0 -20
  53. package/src/commands/HttpRequest.js.map +0 -1
  54. package/src/commands/Message.d.ts +0 -7
  55. package/src/commands/Message.js +0 -15
  56. package/src/commands/Message.js.map +0 -1
  57. package/src/commands/RetryStartegy.d.ts +0 -4
  58. package/src/commands/RetryStartegy.js +0 -5
  59. package/src/commands/RetryStartegy.js.map +0 -1
  60. package/src/commands/index.d.ts +0 -5
  61. package/src/commands/index.js +0 -9
  62. package/src/commands/index.js.map +0 -1
  63. package/src/dispatchers/ExponentialBackoffRetryStrategy.d.ts +0 -13
  64. package/src/dispatchers/ExponentialBackoffRetryStrategy.js +0 -65
  65. package/src/dispatchers/ExponentialBackoffRetryStrategy.js.map +0 -1
  66. package/src/dispatchers/HttpCommandDispatcher.d.ts +0 -14
  67. package/src/dispatchers/HttpCommandDispatcher.js +0 -95
  68. package/src/dispatchers/HttpCommandDispatcher.js.map +0 -1
  69. package/src/dispatchers/HttpCommandDispatcherConfig.d.ts +0 -12
  70. package/src/dispatchers/HttpCommandDispatcherConfig.js +0 -5
  71. package/src/dispatchers/HttpCommandDispatcherConfig.js.map +0 -1
  72. package/src/dispatchers/index.d.ts +0 -3
  73. package/src/dispatchers/index.js +0 -7
  74. package/src/dispatchers/index.js.map +0 -1
  75. package/src/exceptions/HttpCommandError.d.ts +0 -9
  76. package/src/exceptions/HttpCommandError.js +0 -17
  77. package/src/exceptions/HttpCommandError.js.map +0 -1
  78. package/src/utils/delay.d.ts +0 -1
  79. package/src/utils/delay.js +0 -7
  80. package/src/utils/delay.js.map +0 -1
  81. package/src/utils/get-type-name.d.ts +0 -6
  82. package/src/utils/get-type-name.js +0 -11
  83. package/src/utils/get-type-name.js.map +0 -1
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExponentialBackoffRetryStrategy = void 0;
4
- const tslib_1 = require("tslib");
5
- const utils_1 = require("../utils");
6
- const tsyringe_1 = require("tsyringe");
7
- let ExponentialBackoffRetryStrategy = class ExponentialBackoffRetryStrategy {
8
- constructor(options) {
9
- this.options = options;
10
- this.RETRYABLE_AMQP_CODES = new Set([
11
- 311, 312, 313, 320, 404, 405, 406, 502, 503, 504, 505, 506
12
- ]);
13
- this.RETRYABLE_HTTP_METHODS = new Set([
14
- 'get',
15
- 'head',
16
- 'options',
17
- 'put',
18
- 'delete'
19
- ]);
20
- this.RETRYABLE_CODES = new Set([
21
- 'ECONNRESET',
22
- 'ETIMEDOUT',
23
- 'ECONNREFUSED',
24
- 'ENETUNREACH',
25
- 'ENOTFOUND',
26
- 'EADDRINUSE',
27
- 'EHOSTUNREACH',
28
- 'EPIPE',
29
- 'EAI_AGAIN'
30
- ]);
31
- }
32
- async acquire(task) {
33
- let depth = 0;
34
- for (;;) {
35
- try {
36
- return (await task());
37
- }
38
- catch (e) {
39
- depth++;
40
- // eslint-disable-next-line max-depth
41
- if (!this.shouldRetry(e) || depth > this.options.maxDepth) {
42
- throw e;
43
- }
44
- await (0, utils_1.delay)(2 ** depth * 50);
45
- }
46
- }
47
- }
48
- shouldRetry(err) {
49
- const code = err.code;
50
- if (typeof code === 'string') {
51
- return this.RETRYABLE_CODES.has(code);
52
- }
53
- if (typeof code === 'number') {
54
- return this.RETRYABLE_AMQP_CODES.has(+code);
55
- }
56
- const { status = 200, method = 'get' } = err;
57
- return (status >= 500 && this.RETRYABLE_HTTP_METHODS.has(method.toLowerCase()));
58
- }
59
- };
60
- exports.ExponentialBackoffRetryStrategy = ExponentialBackoffRetryStrategy;
61
- exports.ExponentialBackoffRetryStrategy = ExponentialBackoffRetryStrategy = tslib_1.__decorate([
62
- (0, tsyringe_1.injectable)(),
63
- tslib_1.__metadata("design:paramtypes", [Object])
64
- ], ExponentialBackoffRetryStrategy);
65
- //# sourceMappingURL=ExponentialBackoffRetryStrategy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExponentialBackoffRetryStrategy.js","sourceRoot":"","sources":["../../../../../packages/core/src/dispatchers/ExponentialBackoffRetryStrategy.ts"],"names":[],"mappings":";;;;AAEA,oCAAiC;AACjC,uCAAsC;AAQ/B,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAuB1C,YAA6B,OAAkC;QAAlC,YAAO,GAAP,OAAO,CAA2B;QAtB9C,yBAAoB,GAAwB,IAAI,GAAG,CAAC;YACnE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;SAC3D,CAAC,CAAC;QACc,2BAAsB,GAAwB,IAAI,GAAG,CAAC;YACrE,KAAK;YACL,MAAM;YACN,SAAS;YACT,KAAK;YACL,QAAQ;SACT,CAAC,CAAC;QACc,oBAAe,GAAwB,IAAI,GAAG,CAAC;YAC9D,YAAY;YACZ,WAAW;YACX,cAAc;YACd,aAAa;YACb,WAAW;YACX,YAAY;YACZ,cAAc;YACd,OAAO;YACP,WAAW;SACZ,CAAC,CAAC;IAE+D,CAAC;IAE5D,KAAK,CAAC,OAAO,CAClB,IAAO;QAEP,IAAI,KAAK,GAAG,CAAC,CAAC;QAEd,SAAS,CAAC;YACR,IAAI,CAAC;gBACH,OAAO,CAAC,MAAM,IAAI,EAAE,CAAkB,CAAC;YACzC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,KAAK,EAAE,CAAC;gBAER,qCAAqC;gBACrC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;oBAC1D,MAAM,CAAC,CAAC;gBACV,CAAC;gBAED,MAAM,IAAA,aAAK,EAAC,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAEO,WAAW,CAAC,GAAY;QAC9B,MAAM,IAAI,GAAI,GAAyC,CAAC,IAAI,CAAC;QAE7D,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC;QAED,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,GAAuB,CAAC;QAEjE,OAAO,CACL,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CACvE,CAAC;IACJ,CAAC;CACF,CAAA;AA/DY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,qBAAU,GAAE;;GACA,+BAA+B,CA+D3C"}
@@ -1,14 +0,0 @@
1
- import { HttpCommandDispatcherConfig } from './HttpCommandDispatcherConfig';
2
- import { CommandDispatcher, RetryStrategy, HttpRequest } from '../commands';
3
- import { Logger } from '../logger';
4
- export declare class HttpCommandDispatcher implements CommandDispatcher {
5
- private readonly logger;
6
- private readonly retryStrategy;
7
- private readonly options;
8
- private readonly client;
9
- constructor(logger: Logger, retryStrategy: RetryStrategy, options: HttpCommandDispatcherConfig);
10
- execute<T, R>(command: HttpRequest<T, R>): Promise<R | undefined>;
11
- private performHttpRequest;
12
- private createHttpClient;
13
- private inferHeaders;
14
- }
@@ -1,95 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpCommandDispatcher = void 0;
4
- const tslib_1 = require("tslib");
5
- const HttpCommandDispatcherConfig_1 = require("./HttpCommandDispatcherConfig");
6
- const commands_1 = require("../commands");
7
- const exceptions_1 = require("../exceptions");
8
- const logger_1 = require("../logger");
9
- const tsyringe_1 = require("tsyringe");
10
- const axios_1 = tslib_1.__importDefault(require("axios"));
11
- const axios_rate_limit_1 = tslib_1.__importDefault(require("axios-rate-limit"));
12
- // eslint-disable-next-line @typescript-eslint/naming-convention
13
- const form_data_1 = tslib_1.__importDefault(require("form-data"));
14
- const stream_1 = require("stream");
15
- const util_1 = require("util");
16
- const http_1 = tslib_1.__importDefault(require("http"));
17
- const https_1 = tslib_1.__importDefault(require("https"));
18
- let HttpCommandDispatcher = class HttpCommandDispatcher {
19
- constructor(logger, retryStrategy, options) {
20
- this.logger = logger;
21
- this.retryStrategy = retryStrategy;
22
- this.options = options;
23
- this.client = this.createHttpClient();
24
- }
25
- async execute(command) {
26
- this.logger.debug('Executing an incoming command (%s): %j', command.correlationId, command);
27
- const response = await this.retryStrategy.acquire(() => this.performHttpRequest(command));
28
- if (!command.expectReply && response.data instanceof stream_1.Readable) {
29
- // drain readable stream to avoid memory leaks
30
- response.data.on('readable', response.data.read.bind(response.data));
31
- await (0, util_1.promisify)(stream_1.finished)(response.data);
32
- }
33
- else {
34
- this.logger.debug('Received a response to the command (%s): %j', command.correlationId, response.data);
35
- return response.data;
36
- }
37
- }
38
- async performHttpRequest({ correlationId, createdAt, expectReply, method, params, payload, ttl, url }) {
39
- try {
40
- return await this.client.request({
41
- url,
42
- method,
43
- params,
44
- data: payload,
45
- timeout: ttl,
46
- headers: {
47
- ...this.inferHeaders(payload),
48
- 'x-correlation-id': correlationId,
49
- 'date': createdAt.toISOString()
50
- },
51
- ...(!expectReply ? { responseType: 'stream' } : {})
52
- });
53
- }
54
- catch (e) {
55
- const httpError = new exceptions_1.HttpCommandError(e);
56
- this.logger.debug('Command (%s) has been failed:', correlationId, httpError);
57
- throw httpError;
58
- }
59
- }
60
- createHttpClient() {
61
- const { baseUrl, token, keepAlive = true, maxSockets = 50, timeout = 10000, rate = { limit: 10, window: 60 * 1000 } } = this.options;
62
- const options = {
63
- timeout,
64
- httpAgent: new http_1.default.Agent({ maxSockets, keepAlive }),
65
- httpsAgent: new https_1.default.Agent({ maxSockets, keepAlive }),
66
- baseURL: baseUrl,
67
- responseType: 'json',
68
- headers: {
69
- authorization: `api-key ${token}`
70
- },
71
- transitional: {
72
- clarifyTimeoutError: true
73
- }
74
- };
75
- return (0, axios_rate_limit_1.default)(axios_1.default.create(options), {
76
- maxRequests: rate.limit,
77
- perMilliseconds: rate.window
78
- });
79
- }
80
- inferHeaders(data) {
81
- let headers = {};
82
- if (data instanceof form_data_1.default) {
83
- headers = data.getHeaders();
84
- }
85
- return headers;
86
- }
87
- };
88
- exports.HttpCommandDispatcher = HttpCommandDispatcher;
89
- exports.HttpCommandDispatcher = HttpCommandDispatcher = tslib_1.__decorate([
90
- (0, tsyringe_1.injectable)(),
91
- tslib_1.__param(1, (0, tsyringe_1.inject)(commands_1.RetryStrategy)),
92
- tslib_1.__param(2, (0, tsyringe_1.inject)(HttpCommandDispatcherConfig_1.HttpCommandDispatcherConfig)),
93
- tslib_1.__metadata("design:paramtypes", [logger_1.Logger, Object, Object])
94
- ], HttpCommandDispatcher);
95
- //# sourceMappingURL=HttpCommandDispatcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HttpCommandDispatcher.js","sourceRoot":"","sources":["../../../../../packages/core/src/dispatchers/HttpCommandDispatcher.ts"],"names":[],"mappings":";;;;AAAA,+EAA4E;AAC5E,0CAA4E;AAC5E,8CAAiD;AACjD,sCAAmC;AACnC,uCAA8C;AAC9C,0DAAgF;AAChF,gFAAyC;AACzC,gEAAgE;AAChE,kEAAiC;AACjC,mCAA4C;AAC5C,+BAAiC;AACjC,wDAAwB;A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SACF,CAAC;QAEF,OAAO,IAAA,0BAAS,EAAC,eAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;YACtC,WAAW,EAAE,IAAI,CAAC,KAAK;YACvB,eAAe,EAAE,IAAI,CAAC,MAAM;SAC7B,CAAC,CAAC;IACL,CAAC;IAEO,YAAY,CAAI,IAAO;QAC7B,IAAI,OAAO,GAAsC,EAAE,CAAC;QAEpD,IAAI,IAAI,YAAY,mBAAQ,EAAE,CAAC;YAC7B,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC9B,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAA;AApHY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,qBAAU,GAAE;IAMR,mBAAA,IAAA,iBAAM,EAAC,wBAAa,CAAC,CAAA;IAErB,mBAAA,IAAA,iBAAM,EAAC,yDAA2B,CAAC,CAAA;6CAHX,eAAM;GAJtB,qBAAqB,CAoHjC"}
@@ -1,12 +0,0 @@
1
- export interface HttpCommandDispatcherConfig {
2
- baseUrl: string;
3
- token: string;
4
- timeout?: number;
5
- maxSockets?: number;
6
- keepAlive?: boolean;
7
- rate?: {
8
- window: number;
9
- limit: number;
10
- };
11
- }
12
- export declare const HttpCommandDispatcherConfig: unique symbol;
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpCommandDispatcherConfig = void 0;
4
- exports.HttpCommandDispatcherConfig = Symbol('HttpCommandDispatcherConfig');
5
- //# sourceMappingURL=HttpCommandDispatcherConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HttpCommandDispatcherConfig.js","sourceRoot":"","sources":["../../../../../packages/core/src/dispatchers/HttpCommandDispatcherConfig.ts"],"names":[],"mappings":";;;AAYa,QAAA,2BAA2B,GAAkB,MAAM,CAC9D,6BAA6B,CAC9B,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from './HttpCommandDispatcher';
2
- export * from './HttpCommandDispatcherConfig';
3
- export * from './ExponentialBackoffRetryStrategy';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./HttpCommandDispatcher"), exports);
5
- tslib_1.__exportStar(require("./HttpCommandDispatcherConfig"), exports);
6
- tslib_1.__exportStar(require("./ExponentialBackoffRetryStrategy"), exports);
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/src/dispatchers/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC;AACxC,wEAA8C;AAC9C,4EAAkD"}
@@ -1,9 +0,0 @@
1
- import { SecTesterError } from './SecTesterError';
2
- import { AxiosError } from 'axios';
3
- export declare class HttpCommandError extends SecTesterError {
4
- readonly cause: AxiosError;
5
- readonly status: number | undefined;
6
- readonly code: string | undefined;
7
- readonly method: string | undefined;
8
- constructor(cause: AxiosError);
9
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpCommandError = void 0;
4
- const SecTesterError_1 = require("./SecTesterError");
5
- class HttpCommandError extends SecTesterError_1.SecTesterError {
6
- constructor(cause) {
7
- super();
8
- this.cause = cause;
9
- const { message, code, config: { method } = {}, response: { data, status } = {} } = cause;
10
- this.method = method;
11
- this.message = data && typeof data === 'string' ? data : message;
12
- this.status = status;
13
- this.code = code;
14
- }
15
- }
16
- exports.HttpCommandError = HttpCommandError;
17
- //# sourceMappingURL=HttpCommandError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HttpCommandError.js","sourceRoot":"","sources":["../../../../../packages/core/src/exceptions/HttpCommandError.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAGlD,MAAa,gBAAiB,SAAQ,+BAAc;IAKlD,YAA4B,KAAiB;QAC3C,KAAK,EAAE,CAAC;QADkB,UAAK,GAAL,KAAK,CAAY;QAE3C,MAAM,EACJ,OAAO,EACP,IAAI,EACJ,MAAM,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,EACvB,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,EAChC,GAAG,KAAK,CAAC;QAEV,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;QACjE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAnBD,4CAmBC"}
@@ -1 +0,0 @@
1
- export declare const delay: (ms: number) => Promise<void>;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.delay = void 0;
4
- const util_1 = require("util");
5
- const delay = (ms) => (0, util_1.promisify)(setTimeout)(ms);
6
- exports.delay = delay;
7
- //# sourceMappingURL=delay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delay.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/delay.ts"],"names":[],"mappings":";;;AAAA,+BAAiC;AAE1B,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAA,gBAAS,EAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;AAAlD,QAAA,KAAK,SAA6C"}
@@ -1,6 +0,0 @@
1
- type GetTypeName = {
2
- (type: undefined | null): undefined;
3
- (type: NonNullable<unknown>): string;
4
- };
5
- export declare const getTypeName: GetTypeName;
6
- export {};
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTypeName = void 0;
4
- const getTypeName = (payload) => {
5
- if (payload !== null && payload !== undefined) {
6
- const { constructor } = Object.getPrototypeOf(payload);
7
- return constructor.name;
8
- }
9
- };
10
- exports.getTypeName = getTypeName;
11
- //# sourceMappingURL=get-type-name.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-type-name.js","sourceRoot":"","sources":["../../../../../packages/core/src/utils/get-type-name.ts"],"names":[],"mappings":";;;AAKO,MAAM,WAAW,GAAgB,CAAC,OAAgB,EAAE,EAAE;IAC3D,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC9C,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAEvD,OAAO,WAAW,CAAC,IAAI,CAAC;IAC1B,CAAC;AACH,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB"}