@lokalise/node-core 12.0.0 → 12.0.1-test-realms2
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/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/src/errors/InternalError.d.ts +4 -0
- package/dist/src/errors/InternalError.js +9 -0
- package/dist/src/errors/InternalError.js.map +1 -1
- package/dist/src/errors/InternalError2.d.ts +15 -0
- package/dist/src/errors/InternalError2.js +20 -0
- package/dist/src/errors/InternalError2.js.map +1 -0
- package/dist/src/errors/PublicNonRecoverableError.d.ts +4 -0
- package/dist/src/errors/PublicNonRecoverableError.js +10 -0
- package/dist/src/errors/PublicNonRecoverableError.js.map +1 -1
- package/dist/src/errors/ResponseStatusError.d.ts +7 -0
- package/dist/src/errors/ResponseStatusError.js +27 -0
- package/dist/src/errors/ResponseStatusError.js.map +1 -0
- package/dist/src/errors/errorTypeGuards.js +2 -2
- package/dist/src/errors/errorTypeGuards.js.map +1 -1
- package/dist/src/http/httpClient.d.ts +53 -0
- package/dist/src/http/httpClient.js +190 -0
- package/dist/src/http/httpClient.js.map +1 -0
- package/dist/src/utils/typeUtils.d.ts +0 -4
- package/dist/src/utils/typeUtils.js +0 -8
- package/dist/src/utils/typeUtils.js.map +1 -1
- package/package.json +2 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { ErrorDetails } from './src/errors/types';
|
|
2
|
-
export { PublicNonRecoverableError, type PublicNonRecoverableErrorParams, } from './src/errors/PublicNonRecoverableError';
|
|
3
|
-
export { InternalError, type InternalErrorParams, } from './src/errors/InternalError';
|
|
2
|
+
export { PublicNonRecoverableError, isPublicNonRecoverableError, type PublicNonRecoverableErrorParams, } from './src/errors/PublicNonRecoverableError';
|
|
3
|
+
export { InternalError, isInternalError, type InternalErrorParams, } from './src/errors/InternalError';
|
|
4
4
|
export { isEntityGoneError } from './src/errors/errorTypeGuards';
|
|
5
5
|
export { ConfigScope } from './src/config/ConfigScope';
|
|
6
6
|
export { ensureClosingSlashTransformer } from './src/config/configTransformers';
|
|
@@ -10,7 +10,7 @@ export { type Either, type DefiniteEither, success, failure, isSuccess, isFailur
|
|
|
10
10
|
export { EncryptionUtility } from './src/utils/encryptionUtility';
|
|
11
11
|
export { chunk, callChunked, removeFalsy, removeNullish } from './src/utils/arrayUtils';
|
|
12
12
|
export { groupBy, groupByPath, groupByUnique, pick, pickWithoutUndefined, copyWithoutUndefined, copyWithoutEmpty, isEmptyObject, convertDateFieldsToIsoString, deepClone, } from './src/utils/objectUtils';
|
|
13
|
-
export { isError,
|
|
13
|
+
export { isError, isStandardizedError, isObject, hasMessage, } from './src/utils/typeUtils';
|
|
14
14
|
export { type StandardizedError } from './src/utils/typeUtils';
|
|
15
15
|
export { generateHash, HashAlgorithm, HashEncoding } from './src/utils/hashUtils';
|
|
16
16
|
export { resolveLoggerConfiguration, resolveMonorepoLoggerConfiguration, } from './src/logging/loggerConfigResolver';
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateChecksumForBufferOrString = exports.generateChecksumForObject = exports.generateChecksumForReadable = exports.waitAndRetry = exports.AuthFailedError = exports.EntityGoneError = exports.EntityNotFoundError = exports.AccessDeniedError = exports.RequestValidationError = exports.resolveGlobalErrorLogObject = exports.globalLogger = exports.executeSettleAllAndHandleGlobalErrors = exports.executeAndHandleGlobalErrors = exports.executeAsyncAndHandleGlobalErrors = exports.resolveMonorepoLoggerConfiguration = exports.resolveLoggerConfiguration = exports.HashEncoding = exports.HashAlgorithm = exports.generateHash = exports.hasMessage = exports.
|
|
3
|
+
exports.generateChecksumForBufferOrString = exports.generateChecksumForObject = exports.generateChecksumForReadable = exports.waitAndRetry = exports.AuthFailedError = exports.EntityGoneError = exports.EntityNotFoundError = exports.AccessDeniedError = exports.RequestValidationError = exports.resolveGlobalErrorLogObject = exports.globalLogger = exports.executeSettleAllAndHandleGlobalErrors = exports.executeAndHandleGlobalErrors = exports.executeAsyncAndHandleGlobalErrors = exports.resolveMonorepoLoggerConfiguration = exports.resolveLoggerConfiguration = exports.HashEncoding = exports.HashAlgorithm = exports.generateHash = exports.hasMessage = exports.isObject = exports.isStandardizedError = exports.isError = exports.deepClone = exports.convertDateFieldsToIsoString = exports.isEmptyObject = exports.copyWithoutEmpty = exports.copyWithoutUndefined = exports.pickWithoutUndefined = exports.pick = exports.groupByUnique = exports.groupByPath = exports.groupBy = exports.removeNullish = exports.removeFalsy = exports.callChunked = exports.chunk = exports.EncryptionUtility = exports.isFailure = exports.isSuccess = exports.failure = exports.success = exports.createRangeValidator = exports.ensureClosingSlashTransformer = exports.ConfigScope = exports.isEntityGoneError = exports.isInternalError = exports.InternalError = exports.isPublicNonRecoverableError = exports.PublicNonRecoverableError = void 0;
|
|
4
4
|
exports.FsReadableProvider = void 0;
|
|
5
5
|
var PublicNonRecoverableError_1 = require("./src/errors/PublicNonRecoverableError");
|
|
6
6
|
Object.defineProperty(exports, "PublicNonRecoverableError", { enumerable: true, get: function () { return PublicNonRecoverableError_1.PublicNonRecoverableError; } });
|
|
7
|
+
Object.defineProperty(exports, "isPublicNonRecoverableError", { enumerable: true, get: function () { return PublicNonRecoverableError_1.isPublicNonRecoverableError; } });
|
|
7
8
|
var InternalError_1 = require("./src/errors/InternalError");
|
|
8
9
|
Object.defineProperty(exports, "InternalError", { enumerable: true, get: function () { return InternalError_1.InternalError; } });
|
|
10
|
+
Object.defineProperty(exports, "isInternalError", { enumerable: true, get: function () { return InternalError_1.isInternalError; } });
|
|
9
11
|
var errorTypeGuards_1 = require("./src/errors/errorTypeGuards");
|
|
10
12
|
Object.defineProperty(exports, "isEntityGoneError", { enumerable: true, get: function () { return errorTypeGuards_1.isEntityGoneError; } });
|
|
11
13
|
var ConfigScope_1 = require("./src/config/ConfigScope");
|
|
@@ -39,10 +41,8 @@ Object.defineProperty(exports, "convertDateFieldsToIsoString", { enumerable: tru
|
|
|
39
41
|
Object.defineProperty(exports, "deepClone", { enumerable: true, get: function () { return objectUtils_1.deepClone; } });
|
|
40
42
|
var typeUtils_1 = require("./src/utils/typeUtils");
|
|
41
43
|
Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return typeUtils_1.isError; } });
|
|
42
|
-
Object.defineProperty(exports, "isInternalError", { enumerable: true, get: function () { return typeUtils_1.isInternalError; } });
|
|
43
44
|
Object.defineProperty(exports, "isStandardizedError", { enumerable: true, get: function () { return typeUtils_1.isStandardizedError; } });
|
|
44
45
|
Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return typeUtils_1.isObject; } });
|
|
45
|
-
Object.defineProperty(exports, "isPublicNonRecoverableError", { enumerable: true, get: function () { return typeUtils_1.isPublicNonRecoverableError; } });
|
|
46
46
|
Object.defineProperty(exports, "hasMessage", { enumerable: true, get: function () { return typeUtils_1.hasMessage; } });
|
|
47
47
|
var hashUtils_1 = require("./src/utils/hashUtils");
|
|
48
48
|
Object.defineProperty(exports, "generateHash", { enumerable: true, get: function () { return hashUtils_1.generateHash; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;AAEA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;AAEA,oFAI+C;AAH7C,sIAAA,yBAAyB,OAAA;AACzB,wIAAA,2BAA2B,OAAA;AAI7B,4DAImC;AAHjC,8GAAA,aAAa,OAAA;AACb,gHAAA,eAAe,OAAA;AAGjB,gEAAgE;AAAvD,oHAAA,iBAAiB,OAAA;AAE1B,wDAAsD;AAA7C,0GAAA,WAAW,OAAA;AACpB,sEAA+E;AAAtE,mIAAA,6BAA6B,OAAA;AACtC,kEAAoE;AAA3D,wHAAA,oBAAoB,OAAA;AAQ7B,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AyB,OAAA;AACzB,kIAAA,iCAAiC,OAAA;AAEnC,uDAA4D;AAAnD,iHAAA,kBAAkB,OAAA"}
|
|
@@ -5,8 +5,12 @@ export type InternalErrorParams<T = ErrorDetails> = {
|
|
|
5
5
|
details?: T;
|
|
6
6
|
cause?: unknown;
|
|
7
7
|
};
|
|
8
|
+
declare const internalErrorSymbol: unique symbol;
|
|
8
9
|
export declare class InternalError<T = ErrorDetails> extends Error {
|
|
10
|
+
readonly [internalErrorSymbol] = true;
|
|
9
11
|
readonly details?: T;
|
|
10
12
|
readonly errorCode: string;
|
|
11
13
|
constructor(params: InternalErrorParams<T>);
|
|
12
14
|
}
|
|
15
|
+
export declare function isInternalError(error: unknown): error is InternalError;
|
|
16
|
+
export {};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InternalError = void 0;
|
|
4
|
+
exports.isInternalError = isInternalError;
|
|
5
|
+
const typeUtils_1 = require("../utils/typeUtils");
|
|
6
|
+
const INTERNAL_ERROR_SYMBOL_KEY = 'INTERNAL_ERROR_KEY';
|
|
7
|
+
const internalErrorSymbol = Symbol.for(INTERNAL_ERROR_SYMBOL_KEY);
|
|
4
8
|
class InternalError extends Error {
|
|
9
|
+
[internalErrorSymbol] = true;
|
|
5
10
|
details;
|
|
6
11
|
errorCode;
|
|
7
12
|
constructor(params) {
|
|
@@ -14,4 +19,8 @@ class InternalError extends Error {
|
|
|
14
19
|
}
|
|
15
20
|
}
|
|
16
21
|
exports.InternalError = InternalError;
|
|
22
|
+
function isInternalError(error) {
|
|
23
|
+
// biome-ignore lint/suspicious/noExplicitAny: checking for existence of prop outside or Error interface
|
|
24
|
+
return (0, typeUtils_1.isError)(error) && error[Symbol.for(INTERNAL_ERROR_SYMBOL_KEY)] === true;
|
|
25
|
+
}
|
|
17
26
|
//# sourceMappingURL=InternalError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalError.js","sourceRoot":"","sources":["../../../src/errors/InternalError.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"InternalError.js","sourceRoot":"","sources":["../../../src/errors/InternalError.ts"],"names":[],"mappings":";;;AA4BA,0CAGC;AA/BD,kDAA4C;AAU5C,MAAM,yBAAyB,GAAG,oBAAoB,CAAA;AACtD,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;AAEjE,MAAa,aAAgC,SAAQ,KAAK;IAC/C,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAA;IACrB,OAAO,CAAI;IACX,SAAS,CAAQ;IAEjC,YAAY,MAA8B;QACxC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;YACpB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;IACnC,CAAC;CACF;AAbD,sCAaC;AAED,SAAgB,eAAe,CAAC,KAAc;IAC5C,wGAAwG;IACxG,OAAO,IAAA,mBAAO,EAAC,KAAK,CAAC,IAAK,KAAa,CAAC,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,KAAK,IAAI,CAAA;AACzF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ErrorDetails } from './types';
|
|
2
|
+
export type InternalErrorParams<T = ErrorDetails> = {
|
|
3
|
+
message: string;
|
|
4
|
+
errorCode: string;
|
|
5
|
+
details?: T;
|
|
6
|
+
cause?: unknown;
|
|
7
|
+
};
|
|
8
|
+
declare const internalErrorSymbol: unique symbol;
|
|
9
|
+
export declare class InternalError2<T = ErrorDetails> extends Error {
|
|
10
|
+
readonly [internalErrorSymbol] = true;
|
|
11
|
+
readonly details?: T;
|
|
12
|
+
readonly errorCode: string;
|
|
13
|
+
constructor(params: InternalErrorParams<T>);
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InternalError2 = void 0;
|
|
4
|
+
const INTERNAL_ERROR_SYMBOL_KEY = 'INTERNAL_ERROR_KEY';
|
|
5
|
+
const internalErrorSymbol = Symbol.for(INTERNAL_ERROR_SYMBOL_KEY);
|
|
6
|
+
class InternalError2 extends Error {
|
|
7
|
+
[internalErrorSymbol] = true;
|
|
8
|
+
details;
|
|
9
|
+
errorCode;
|
|
10
|
+
constructor(params) {
|
|
11
|
+
super(params.message, {
|
|
12
|
+
cause: params.cause,
|
|
13
|
+
});
|
|
14
|
+
this.name = 'InternalError';
|
|
15
|
+
this.details = params.details;
|
|
16
|
+
this.errorCode = params.errorCode;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.InternalError2 = InternalError2;
|
|
20
|
+
//# sourceMappingURL=InternalError2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InternalError2.js","sourceRoot":"","sources":["../../../src/errors/InternalError2.ts"],"names":[],"mappings":";;;AAUA,MAAM,yBAAyB,GAAG,oBAAoB,CAAA;AACtD,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;AAEjE,MAAa,cAAiC,SAAQ,KAAK;IAChD,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAA;IACrB,OAAO,CAAI;IACX,SAAS,CAAQ;IAEjC,YAAY,MAA8B;QACxC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;YACpB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;IACnC,CAAC;CACF;AAbD,wCAaC"}
|
|
@@ -6,12 +6,16 @@ export type PublicNonRecoverableErrorParams<T = ErrorDetails> = {
|
|
|
6
6
|
httpStatusCode?: number;
|
|
7
7
|
cause?: unknown;
|
|
8
8
|
};
|
|
9
|
+
declare const publicNonRecoverableErrorSymbol: unique symbol;
|
|
9
10
|
/**
|
|
10
11
|
* This error is returned to the consumer of API
|
|
11
12
|
*/
|
|
12
13
|
export declare class PublicNonRecoverableError<T = ErrorDetails> extends Error {
|
|
14
|
+
readonly [publicNonRecoverableErrorSymbol] = true;
|
|
13
15
|
readonly details?: T;
|
|
14
16
|
readonly errorCode: string;
|
|
15
17
|
readonly httpStatusCode: number;
|
|
16
18
|
constructor(params: PublicNonRecoverableErrorParams<T>);
|
|
17
19
|
}
|
|
20
|
+
export declare function isPublicNonRecoverableError(error: unknown): error is PublicNonRecoverableError;
|
|
21
|
+
export {};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PublicNonRecoverableError = void 0;
|
|
4
|
+
exports.isPublicNonRecoverableError = isPublicNonRecoverableError;
|
|
5
|
+
const typeUtils_1 = require("../utils/typeUtils");
|
|
6
|
+
const PUBLIC_NON_RECOVERABLE_ERROR_SYMBOL_KEY = 'PUBLIC_NON_RECOVERABLE_ERROR_KEY';
|
|
7
|
+
const publicNonRecoverableErrorSymbol = Symbol.for(PUBLIC_NON_RECOVERABLE_ERROR_SYMBOL_KEY);
|
|
4
8
|
/**
|
|
5
9
|
* This error is returned to the consumer of API
|
|
6
10
|
*/
|
|
7
11
|
class PublicNonRecoverableError extends Error {
|
|
12
|
+
[publicNonRecoverableErrorSymbol] = true;
|
|
8
13
|
details;
|
|
9
14
|
errorCode;
|
|
10
15
|
httpStatusCode;
|
|
@@ -19,4 +24,9 @@ class PublicNonRecoverableError extends Error {
|
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
26
|
exports.PublicNonRecoverableError = PublicNonRecoverableError;
|
|
27
|
+
function isPublicNonRecoverableError(error) {
|
|
28
|
+
return (
|
|
29
|
+
// biome-ignore lint/suspicious/noExplicitAny: checking for existence of prop outside or Error interface
|
|
30
|
+
(0, typeUtils_1.isError)(error) && error[Symbol.for(PUBLIC_NON_RECOVERABLE_ERROR_SYMBOL_KEY)] === true);
|
|
31
|
+
}
|
|
22
32
|
//# sourceMappingURL=PublicNonRecoverableError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicNonRecoverableError.js","sourceRoot":"","sources":["../../../src/errors/PublicNonRecoverableError.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"PublicNonRecoverableError.js","sourceRoot":"","sources":["../../../src/errors/PublicNonRecoverableError.ts"],"names":[],"mappings":";;;AAkCA,kEAKC;AAvCD,kDAA4C;AAW5C,MAAM,uCAAuC,GAAG,kCAAkC,CAAA;AAClF,MAAM,+BAA+B,GAAG,MAAM,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAA;AAE3F;;GAEG;AACH,MAAa,yBAA4C,SAAQ,KAAK;IAC3D,CAAC,+BAA+B,CAAC,GAAG,IAAI,CAAA;IACjC,OAAO,CAAI;IACX,SAAS,CAAQ;IACjB,cAAc,CAAQ;IAEtC,YAAY,MAA0C;QACpD,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;YACpB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;QACvC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;QACjC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,GAAG,CAAA;IACpD,CAAC;CACF;AAfD,8DAeC;AAED,SAAgB,2BAA2B,CAAC,KAAc;IACxD,OAAO;IACL,wGAAwG;IACxG,IAAA,mBAAO,EAAC,KAAK,CAAC,IAAK,KAAa,CAAC,MAAM,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC,KAAK,IAAI,CAC/F,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RequestResult } from 'undici-retry';
|
|
2
|
+
import { InternalError } from './InternalError';
|
|
3
|
+
export declare class ResponseStatusError extends InternalError {
|
|
4
|
+
readonly response: RequestResult<any>;
|
|
5
|
+
readonly isResponseStatusError = true;
|
|
6
|
+
constructor(requestResult: RequestResult<any>, requestLabel?: string);
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResponseStatusError = void 0;
|
|
4
|
+
const InternalError_1 = require("./InternalError");
|
|
5
|
+
class ResponseStatusError extends InternalError_1.InternalError {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
response;
|
|
8
|
+
isResponseStatusError = true;
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
constructor(requestResult, requestLabel = 'N/A') {
|
|
11
|
+
super({
|
|
12
|
+
message: `Response status code ${requestResult.statusCode}`,
|
|
13
|
+
details: {
|
|
14
|
+
requestLabel,
|
|
15
|
+
response: {
|
|
16
|
+
statusCode: requestResult.statusCode,
|
|
17
|
+
body: requestResult.body,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
errorCode: 'REQUEST_ERROR',
|
|
21
|
+
});
|
|
22
|
+
this.response = requestResult;
|
|
23
|
+
this.name = 'ResponseStatusError';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ResponseStatusError = ResponseStatusError;
|
|
27
|
+
//# sourceMappingURL=ResponseStatusError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponseStatusError.js","sourceRoot":"","sources":["../../../src/errors/ResponseStatusError.ts"],"names":[],"mappings":";;;AAEA,mDAA+C;AAE/C,MAAa,mBAAoB,SAAQ,6BAAa;IACpD,8DAA8D;IAC9C,QAAQ,CAAoB;IAC5B,qBAAqB,GAAG,IAAI,CAAA;IAE5C,8DAA8D;IAC9D,YAAY,aAAiC,EAAE,YAAY,GAAG,KAAK;QACjE,KAAK,CAAC;YACJ,OAAO,EAAE,wBAAwB,aAAa,CAAC,UAAU,EAAE;YAC3D,OAAO,EAAE;gBACP,YAAY;gBACZ,QAAQ,EAAE;oBACR,UAAU,EAAE,aAAa,CAAC,UAAU;oBACpC,IAAI,EAAE,aAAa,CAAC,IAAI;iBACzB;aACF;YACD,SAAS,EAAE,eAAe;SAC3B,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAA;QAC7B,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AArBD,kDAqBC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isEntityGoneError = isEntityGoneError;
|
|
4
|
-
const
|
|
4
|
+
const PublicNonRecoverableError_1 = require("../errors/PublicNonRecoverableError");
|
|
5
5
|
function isEntityGoneError(entity) {
|
|
6
|
-
return (0,
|
|
6
|
+
return (0, PublicNonRecoverableError_1.isPublicNonRecoverableError)(entity) && entity.httpStatusCode === 410;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=errorTypeGuards.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorTypeGuards.js","sourceRoot":"","sources":["../../../src/errors/errorTypeGuards.ts"],"names":[],"mappings":";;AAIA,8CAEC;AAND,
|
|
1
|
+
{"version":3,"file":"errorTypeGuards.js","sourceRoot":"","sources":["../../../src/errors/errorTypeGuards.ts"],"names":[],"mappings":";;AAIA,8CAEC;AAND,mFAAiF;AAIjF,SAAgB,iBAAiB,CAAC,MAAe;IAC/C,OAAO,IAAA,uDAA2B,EAAC,MAAM,CAAC,IAAI,MAAM,CAAC,cAAc,KAAK,GAAG,CAAA;AAC7E,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { Readable } from 'stream';
|
|
4
|
+
import { Client } from 'undici';
|
|
5
|
+
import type { FormData } from 'undici';
|
|
6
|
+
import type { RequestResult, RetryConfig } from 'undici-retry';
|
|
7
|
+
import type { DefiniteEither } from '../errors/either';
|
|
8
|
+
type RecordObject = Record<string, any>;
|
|
9
|
+
export type HttpRequestContext = {
|
|
10
|
+
reqId: string;
|
|
11
|
+
};
|
|
12
|
+
export type ResponseSchema<Output = any> = {
|
|
13
|
+
parse(data: unknown): Output;
|
|
14
|
+
};
|
|
15
|
+
export type RequestOptions<T> = {
|
|
16
|
+
headers?: RecordObject;
|
|
17
|
+
query?: RecordObject;
|
|
18
|
+
timeout: number | undefined;
|
|
19
|
+
throwOnError?: boolean;
|
|
20
|
+
reqContext?: HttpRequestContext;
|
|
21
|
+
safeParseJson?: boolean;
|
|
22
|
+
blobResponseBody?: boolean;
|
|
23
|
+
requestLabel: string;
|
|
24
|
+
disableKeepAlive?: boolean;
|
|
25
|
+
retryConfig?: RetryConfig;
|
|
26
|
+
clientOptions?: Client.Options;
|
|
27
|
+
responseSchema?: ResponseSchema<T>;
|
|
28
|
+
validateResponse: boolean;
|
|
29
|
+
};
|
|
30
|
+
export type Response<T> = {
|
|
31
|
+
body: T;
|
|
32
|
+
headers: RecordObject;
|
|
33
|
+
statusCode: number;
|
|
34
|
+
};
|
|
35
|
+
export declare function sendGet<T>(client: Client, path: string, options?: Partial<RequestOptions<T>>): Promise<DefiniteEither<RequestResult<unknown>, RequestResult<T>>>;
|
|
36
|
+
export declare function sendDelete<T>(client: Client, path: string, options?: Partial<RequestOptions<T>>): Promise<DefiniteEither<RequestResult<unknown>, RequestResult<T>>>;
|
|
37
|
+
export declare function sendPost<T>(client: Client, path: string, body: RecordObject | undefined, options?: Partial<RequestOptions<T>>): Promise<DefiniteEither<RequestResult<unknown>, RequestResult<T>>>;
|
|
38
|
+
export declare function sendPostBinary<T>(client: Client, path: string, body: Buffer | Uint8Array | Readable | FormData | null, options?: Partial<RequestOptions<T>>): Promise<DefiniteEither<RequestResult<unknown>, RequestResult<T>>>;
|
|
39
|
+
export declare function sendPut<T>(client: Client, path: string, body: RecordObject | undefined, options?: Partial<RequestOptions<T>>): Promise<DefiniteEither<RequestResult<unknown>, RequestResult<T>>>;
|
|
40
|
+
export declare function sendPutBinary<T>(client: Client, path: string, body: Buffer | Uint8Array | Readable | FormData | null, options?: Partial<RequestOptions<T>>): Promise<DefiniteEither<RequestResult<unknown>, RequestResult<T>>>;
|
|
41
|
+
export declare function sendPatch<T>(client: Client, path: string, body: RecordObject | undefined, options?: Partial<RequestOptions<T>>): Promise<DefiniteEither<RequestResult<unknown>, RequestResult<T>>>;
|
|
42
|
+
export declare function buildClient(baseUrl: string, clientOptions?: Client.Options): Client;
|
|
43
|
+
export declare const httpClient: {
|
|
44
|
+
get: typeof sendGet;
|
|
45
|
+
post: typeof sendPost;
|
|
46
|
+
put: typeof sendPut;
|
|
47
|
+
patch: typeof sendPatch;
|
|
48
|
+
del: typeof sendDelete;
|
|
49
|
+
};
|
|
50
|
+
export declare const JSON_HEADERS: {
|
|
51
|
+
'Content-Type': string;
|
|
52
|
+
};
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JSON_HEADERS = exports.httpClient = exports.buildClient = exports.sendPatch = exports.sendPutBinary = exports.sendPut = exports.sendPostBinary = exports.sendPost = exports.sendDelete = exports.sendGet = void 0;
|
|
4
|
+
const undici_1 = require("undici");
|
|
5
|
+
const undici_retry_1 = require("undici-retry");
|
|
6
|
+
const ResponseStatusError_1 = require("../errors/ResponseStatusError");
|
|
7
|
+
const objectUtils_1 = require("../utils/objectUtils");
|
|
8
|
+
const DEFAULT_OPTIONS = {
|
|
9
|
+
validateResponse: true,
|
|
10
|
+
throwOnError: true,
|
|
11
|
+
timeout: 30000,
|
|
12
|
+
};
|
|
13
|
+
const defaultClientOptions = {
|
|
14
|
+
keepAliveMaxTimeout: 300_000,
|
|
15
|
+
keepAliveTimeout: 4000,
|
|
16
|
+
};
|
|
17
|
+
async function sendGet(client, path, options = {}) {
|
|
18
|
+
const result = await (0, undici_retry_1.sendWithRetry)(client, {
|
|
19
|
+
...DEFAULT_OPTIONS,
|
|
20
|
+
path: path,
|
|
21
|
+
method: 'GET',
|
|
22
|
+
query: options.query,
|
|
23
|
+
headers: (0, objectUtils_1.copyWithoutUndefined)({
|
|
24
|
+
'x-request-id': options.reqContext?.reqId,
|
|
25
|
+
...options.headers,
|
|
26
|
+
}),
|
|
27
|
+
reset: options.disableKeepAlive ?? false,
|
|
28
|
+
bodyTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
29
|
+
headersTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
30
|
+
throwOnError: false,
|
|
31
|
+
}, resolveRetryConfig(options), resolveRequestConfig(options));
|
|
32
|
+
return resolveResult(result, options.throwOnError ?? DEFAULT_OPTIONS.throwOnError, options.validateResponse ?? DEFAULT_OPTIONS.validateResponse, options.responseSchema, options.requestLabel);
|
|
33
|
+
}
|
|
34
|
+
exports.sendGet = sendGet;
|
|
35
|
+
async function sendDelete(client, path, options = {}) {
|
|
36
|
+
const result = await (0, undici_retry_1.sendWithRetry)(client, {
|
|
37
|
+
...DEFAULT_OPTIONS,
|
|
38
|
+
path,
|
|
39
|
+
method: 'DELETE',
|
|
40
|
+
query: options.query,
|
|
41
|
+
headers: (0, objectUtils_1.copyWithoutUndefined)({
|
|
42
|
+
'x-request-id': options.reqContext?.reqId,
|
|
43
|
+
...options.headers,
|
|
44
|
+
}),
|
|
45
|
+
reset: options.disableKeepAlive ?? false,
|
|
46
|
+
bodyTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
47
|
+
headersTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
48
|
+
throwOnError: false,
|
|
49
|
+
}, resolveRetryConfig(options), resolveRequestConfig(options));
|
|
50
|
+
return resolveResult(result, options.throwOnError ?? DEFAULT_OPTIONS.throwOnError, options.validateResponse ?? DEFAULT_OPTIONS.validateResponse, options.responseSchema, options.requestLabel);
|
|
51
|
+
}
|
|
52
|
+
exports.sendDelete = sendDelete;
|
|
53
|
+
async function sendPost(client, path, body, options = {}) {
|
|
54
|
+
const result = await (0, undici_retry_1.sendWithRetry)(client, {
|
|
55
|
+
...DEFAULT_OPTIONS,
|
|
56
|
+
path: path,
|
|
57
|
+
method: 'POST',
|
|
58
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
59
|
+
query: options.query,
|
|
60
|
+
headers: (0, objectUtils_1.copyWithoutUndefined)({
|
|
61
|
+
'x-request-id': options.reqContext?.reqId,
|
|
62
|
+
...options.headers,
|
|
63
|
+
}),
|
|
64
|
+
reset: options.disableKeepAlive ?? false,
|
|
65
|
+
bodyTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
66
|
+
headersTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
67
|
+
throwOnError: false,
|
|
68
|
+
}, resolveRetryConfig(options), resolveRequestConfig(options));
|
|
69
|
+
return resolveResult(result, options.throwOnError ?? DEFAULT_OPTIONS.throwOnError, options.validateResponse ?? DEFAULT_OPTIONS.validateResponse, options.responseSchema, options.requestLabel);
|
|
70
|
+
}
|
|
71
|
+
exports.sendPost = sendPost;
|
|
72
|
+
async function sendPostBinary(client, path, body, options = {}) {
|
|
73
|
+
const result = await (0, undici_retry_1.sendWithRetry)(client, {
|
|
74
|
+
...DEFAULT_OPTIONS,
|
|
75
|
+
path: path,
|
|
76
|
+
method: 'POST',
|
|
77
|
+
body,
|
|
78
|
+
query: options.query,
|
|
79
|
+
headers: (0, objectUtils_1.copyWithoutUndefined)({
|
|
80
|
+
'x-request-id': options.reqContext?.reqId,
|
|
81
|
+
...options.headers,
|
|
82
|
+
}),
|
|
83
|
+
reset: options.disableKeepAlive ?? false,
|
|
84
|
+
bodyTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
85
|
+
headersTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
86
|
+
throwOnError: false,
|
|
87
|
+
}, resolveRetryConfig(options), resolveRequestConfig(options));
|
|
88
|
+
return resolveResult(result, options.throwOnError ?? DEFAULT_OPTIONS.throwOnError, options.validateResponse ?? DEFAULT_OPTIONS.validateResponse, options.responseSchema, options.requestLabel);
|
|
89
|
+
}
|
|
90
|
+
exports.sendPostBinary = sendPostBinary;
|
|
91
|
+
async function sendPut(client, path, body, options = {}) {
|
|
92
|
+
const result = await (0, undici_retry_1.sendWithRetry)(client, {
|
|
93
|
+
...DEFAULT_OPTIONS,
|
|
94
|
+
path: path,
|
|
95
|
+
method: 'PUT',
|
|
96
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
97
|
+
query: options.query,
|
|
98
|
+
headers: (0, objectUtils_1.copyWithoutUndefined)({
|
|
99
|
+
'x-request-id': options.reqContext?.reqId,
|
|
100
|
+
...options.headers,
|
|
101
|
+
}),
|
|
102
|
+
reset: options.disableKeepAlive ?? false,
|
|
103
|
+
bodyTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
104
|
+
headersTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
105
|
+
throwOnError: false,
|
|
106
|
+
}, resolveRetryConfig(options), resolveRequestConfig(options));
|
|
107
|
+
return resolveResult(result, options.throwOnError ?? DEFAULT_OPTIONS.throwOnError, options.validateResponse ?? DEFAULT_OPTIONS.validateResponse, options.responseSchema, options.requestLabel);
|
|
108
|
+
}
|
|
109
|
+
exports.sendPut = sendPut;
|
|
110
|
+
async function sendPutBinary(client, path, body, options = {}) {
|
|
111
|
+
const result = await (0, undici_retry_1.sendWithRetry)(client, {
|
|
112
|
+
...DEFAULT_OPTIONS,
|
|
113
|
+
path: path,
|
|
114
|
+
method: 'PUT',
|
|
115
|
+
body,
|
|
116
|
+
query: options.query,
|
|
117
|
+
headers: (0, objectUtils_1.copyWithoutUndefined)({
|
|
118
|
+
'x-request-id': options.reqContext?.reqId,
|
|
119
|
+
...options.headers,
|
|
120
|
+
}),
|
|
121
|
+
reset: options.disableKeepAlive ?? false,
|
|
122
|
+
bodyTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
123
|
+
headersTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
124
|
+
throwOnError: false,
|
|
125
|
+
}, resolveRetryConfig(options), resolveRequestConfig(options));
|
|
126
|
+
return resolveResult(result, options.throwOnError ?? DEFAULT_OPTIONS.throwOnError, options.validateResponse ?? DEFAULT_OPTIONS.validateResponse, options.responseSchema, options.requestLabel);
|
|
127
|
+
}
|
|
128
|
+
exports.sendPutBinary = sendPutBinary;
|
|
129
|
+
async function sendPatch(client, path, body, options = {}) {
|
|
130
|
+
const result = await (0, undici_retry_1.sendWithRetry)(client, {
|
|
131
|
+
...DEFAULT_OPTIONS,
|
|
132
|
+
path: path,
|
|
133
|
+
method: 'PATCH',
|
|
134
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
135
|
+
query: options.query,
|
|
136
|
+
headers: (0, objectUtils_1.copyWithoutUndefined)({
|
|
137
|
+
'x-request-id': options.reqContext?.reqId,
|
|
138
|
+
...options.headers,
|
|
139
|
+
}),
|
|
140
|
+
reset: options.disableKeepAlive ?? false,
|
|
141
|
+
bodyTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
142
|
+
headersTimeout: Object.hasOwn(options, 'timeout') ? options.timeout : DEFAULT_OPTIONS.timeout,
|
|
143
|
+
throwOnError: false,
|
|
144
|
+
}, resolveRetryConfig(options), resolveRequestConfig(options));
|
|
145
|
+
return resolveResult(result, options.throwOnError ?? DEFAULT_OPTIONS.throwOnError, options.validateResponse ?? DEFAULT_OPTIONS.validateResponse, options.responseSchema, options.requestLabel);
|
|
146
|
+
}
|
|
147
|
+
exports.sendPatch = sendPatch;
|
|
148
|
+
function resolveRequestConfig(options) {
|
|
149
|
+
return {
|
|
150
|
+
safeParseJson: options.safeParseJson ?? false,
|
|
151
|
+
blobBody: options.blobResponseBody ?? false,
|
|
152
|
+
throwOnInternalError: false,
|
|
153
|
+
requestLabel: options.requestLabel,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function resolveRetryConfig(options) {
|
|
157
|
+
return options.retryConfig ?? undici_retry_1.NO_RETRY_CONFIG;
|
|
158
|
+
}
|
|
159
|
+
function buildClient(baseUrl, clientOptions) {
|
|
160
|
+
const newClient = new undici_1.Client(baseUrl, {
|
|
161
|
+
...defaultClientOptions,
|
|
162
|
+
...clientOptions,
|
|
163
|
+
});
|
|
164
|
+
return newClient;
|
|
165
|
+
}
|
|
166
|
+
exports.buildClient = buildClient;
|
|
167
|
+
function resolveResult(requestResult, throwOnError, validateResponse, validationSchema, requestLabel) {
|
|
168
|
+
// Throw response error
|
|
169
|
+
if (requestResult.error && throwOnError) {
|
|
170
|
+
if ((0, undici_retry_1.isRequestResult)(requestResult.error)) {
|
|
171
|
+
throw new ResponseStatusError_1.ResponseStatusError(requestResult.error, requestLabel);
|
|
172
|
+
}
|
|
173
|
+
throw requestResult.error;
|
|
174
|
+
}
|
|
175
|
+
if (requestResult.result && validateResponse && validationSchema) {
|
|
176
|
+
requestResult.result.body = validationSchema.parse(requestResult.result.body);
|
|
177
|
+
}
|
|
178
|
+
return requestResult;
|
|
179
|
+
}
|
|
180
|
+
exports.httpClient = {
|
|
181
|
+
get: sendGet,
|
|
182
|
+
post: sendPost,
|
|
183
|
+
put: sendPut,
|
|
184
|
+
patch: sendPatch,
|
|
185
|
+
del: sendDelete,
|
|
186
|
+
};
|
|
187
|
+
exports.JSON_HEADERS = {
|
|
188
|
+
'Content-Type': 'application/json',
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=httpClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpClient.js","sourceRoot":"","sources":["../../../src/http/httpClient.ts"],"names":[],"mappings":";;;AAEA,mCAA+B;AAE/B,+CAA8E;AAI9E,uEAAmE;AAEnE,sDAA2D;AAgC3D,MAAM,eAAe,GAAG;IACtB,gBAAgB,EAAE,IAAI;IACtB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,KAAK;CAC4C,CAAA;AAE5D,MAAM,oBAAoB,GAA4B;IACpD,mBAAmB,EAAE,OAAO;IAC5B,gBAAgB,EAAE,IAAI;CACvB,CAAA;AAQM,KAAK,UAAU,OAAO,CAC3B,MAAc,EACd,IAAY,EACZ,UAAsC,EAAE;IAExC,MAAM,MAAM,GAAG,MAAM,IAAA,4BAAa,EAChC,MAAM,EACN;QACE,GAAG,eAAe;QAClB,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,IAAA,kCAAoB,EAAC;YAC5B,cAAc,EAAE,OAAO,CAAC,UAAU,EAAE,KAAK;YACzC,GAAG,OAAO,CAAC,OAAO;SACnB,CAAC;QACF,KAAK,EAAE,OAAO,CAAC,gBAAgB,IAAI,KAAK;QACxC,WAAW,EAAE,MAAM,CA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aAA8B;IACzE,MAAM,SAAS,GAAG,IAAI,eAAM,CAAC,OAAO,EAAE;QACpC,GAAG,oBAAoB;QACvB,GAAG,aAAa;KACjB,CAAC,CAAA;IACF,OAAO,SAAS,CAAA;AAClB,CAAC;AAND,kCAMC;AAED,SAAS,aAAa,CACpB,aAAsF,EACtF,YAAqB,EACrB,gBAAyB,EACzB,gBAAiC,EACjC,YAAqB;IAErB,uBAAuB;IACvB,IAAI,aAAa,CAAC,KAAK,IAAI,YAAY,EAAE,CAAC;QACxC,IAAI,IAAA,8BAAe,EAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,yCAAmB,CAAC,aAAa,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;QAClE,CAAC;QACD,MAAM,aAAa,CAAC,KAAK,CAAA;IAC3B,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,IAAI,gBAAgB,IAAI,gBAAgB,EAAE,CAAC;QACjE,aAAa,CAAC,MAAM,CAAC,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC/E,CAAC;IAED,OAAO,aAAyE,CAAA;AAClF,CAAC;AAEY,QAAA,UAAU,GAAG;IACxB,GAAG,EAAE,OAAO;IACZ,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE,OAAO;IACZ,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,UAAU;CAChB,CAAA;AAEY,QAAA,YAAY,GAAG;IAC1B,cAAc,EAAE,kBAAkB;CACnC,CAAA"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { InternalError } from '../errors/InternalError';
|
|
2
|
-
import type { PublicNonRecoverableError } from '../errors/PublicNonRecoverableError';
|
|
3
1
|
export type StandardizedError = {
|
|
4
2
|
code: string;
|
|
5
3
|
message: string;
|
|
@@ -9,6 +7,4 @@ export declare function hasMessage(maybe: unknown): maybe is {
|
|
|
9
7
|
};
|
|
10
8
|
export declare function isObject(maybeObject: unknown): maybeObject is Record<PropertyKey, unknown>;
|
|
11
9
|
export declare function isStandardizedError(error: unknown): error is StandardizedError;
|
|
12
|
-
export declare function isInternalError(error: unknown): error is InternalError;
|
|
13
10
|
export declare function isError(maybeError: unknown): maybeError is Error;
|
|
14
|
-
export declare function isPublicNonRecoverableError(error: unknown): error is PublicNonRecoverableError;
|
|
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.hasMessage = hasMessage;
|
|
4
4
|
exports.isObject = isObject;
|
|
5
5
|
exports.isStandardizedError = isStandardizedError;
|
|
6
|
-
exports.isInternalError = isInternalError;
|
|
7
6
|
exports.isError = isError;
|
|
8
|
-
exports.isPublicNonRecoverableError = isPublicNonRecoverableError;
|
|
9
7
|
function hasMessage(maybe) {
|
|
10
8
|
return isObject(maybe) && typeof maybe.message === 'string';
|
|
11
9
|
}
|
|
@@ -15,13 +13,7 @@ function isObject(maybeObject) {
|
|
|
15
13
|
function isStandardizedError(error) {
|
|
16
14
|
return isObject(error) && typeof error.code === 'string' && typeof error.message === 'string';
|
|
17
15
|
}
|
|
18
|
-
function isInternalError(error) {
|
|
19
|
-
return isObject(error) && error.name === 'InternalError';
|
|
20
|
-
}
|
|
21
16
|
function isError(maybeError) {
|
|
22
17
|
return (maybeError instanceof Error || Object.prototype.toString.call(maybeError) === '[object Error]');
|
|
23
18
|
}
|
|
24
|
-
function isPublicNonRecoverableError(error) {
|
|
25
|
-
return isObject(error) && error.name === 'PublicNonRecoverableError';
|
|
26
|
-
}
|
|
27
19
|
//# sourceMappingURL=typeUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeUtils.js","sourceRoot":"","sources":["../../../src/utils/typeUtils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"typeUtils.js","sourceRoot":"","sources":["../../../src/utils/typeUtils.ts"],"names":[],"mappings":";;AAMA,gCAEC;AAED,4BAEC;AAED,kDAEC;AAED,0BAIC;AAhBD,SAAgB,UAAU,CAAC,KAAc;IACvC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAA;AAC7D,CAAC;AAED,SAAgB,QAAQ,CAAC,WAAoB;IAC3C,OAAO,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI,CAAA;AAChE,CAAC;AAED,SAAgB,mBAAmB,CAAC,KAAc;IAChD,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAA;AAC/F,CAAC;AAED,SAAgB,OAAO,CAAC,UAAmB;IACzC,OAAO,CACL,UAAU,YAAY,KAAK,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,gBAAgB,CAC/F,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/node-core",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.1-test-realms2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Lokalise",
|
|
6
6
|
"url": "https://lokalise.com/"
|
|
@@ -11,11 +11,7 @@
|
|
|
11
11
|
"url": "git://github.com/lokalise/node-core.git"
|
|
12
12
|
},
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
|
-
"files": [
|
|
15
|
-
"dist/**",
|
|
16
|
-
"LICENSE",
|
|
17
|
-
"README.md"
|
|
18
|
-
],
|
|
14
|
+
"files": ["dist/**", "LICENSE", "README.md"],
|
|
19
15
|
"main": "dist/index.js",
|
|
20
16
|
"types": "dist/index.d.ts",
|
|
21
17
|
"type": "commonjs",
|