@lokalise/node-core 9.0.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +9 -12
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/src/errors/either.d.ts +4 -0
- package/dist/src/errors/either.js +13 -0
- package/dist/src/errors/either.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -196,7 +196,7 @@ It's up to the caller of the function to handle the received error or throw an e
|
|
|
196
196
|
|
|
197
197
|
Read [this article](https://antman-does-software.com/stop-catching-errors-in-typescript-use-the-either-type-to-make-your-code-predictable) for more information on how `Either` works and its benefits.
|
|
198
198
|
|
|
199
|
-
Additionally, `
|
|
199
|
+
Additionally, `DefiniteEither` is also provided. It is a variation of the aforementioned `Either`, which may or may not have `error` set, but always has `result`.
|
|
200
200
|
|
|
201
201
|
### waitAndRetry
|
|
202
202
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
export { sendPut, sendPutBinary, sendDelete, sendPatch, sendGet, sendPost, sendPostBinary, httpClient, buildClient, } from './src/http/httpClient';
|
|
2
|
-
export
|
|
3
|
-
export {
|
|
4
|
-
export type { PublicNonRecoverableErrorParams } from './src/errors/PublicNonRecoverableError';
|
|
5
|
-
export { InternalError } from './src/errors/InternalError';
|
|
1
|
+
export { sendPut, sendPutBinary, sendDelete, sendPatch, sendGet, sendPost, sendPostBinary, httpClient, buildClient, type RequestOptions, type Response, type HttpRequestContext, type ResponseSchema, } from './src/http/httpClient';
|
|
2
|
+
export { PublicNonRecoverableError, type PublicNonRecoverableErrorParams, } from './src/errors/PublicNonRecoverableError';
|
|
3
|
+
export { InternalError, type ErrorDetails, type InternalErrorParams, } from './src/errors/InternalError';
|
|
6
4
|
export { ResponseStatusError } from './src/errors/ResponseStatusError';
|
|
7
|
-
export type { ErrorDetails, InternalErrorParams } from './src/errors/InternalError';
|
|
8
5
|
export { ConfigScope } from './src/config/ConfigScope';
|
|
9
6
|
export { ensureClosingSlashTransformer } from './src/config/configTransformers';
|
|
10
7
|
export { createRangeValidator } from './src/config/configValidators';
|
|
11
|
-
export type
|
|
12
|
-
export type
|
|
8
|
+
export { type EnvValueValidator, type EnvValueTransformer, type AppConfig, type RedisConfig, } from './src/config/configTypes';
|
|
9
|
+
export { type Either, success, failure, isSuccess, isFailure } from './src/errors/either';
|
|
13
10
|
export { chunk, callChunked, removeFalsy, removeNullish } from './src/utils/arrayUtils';
|
|
14
11
|
export { groupBy, groupByUnique, pick, pickWithoutUndefined, copyWithoutUndefined, isEmptyObject, convertDateFieldsToIsoString, deepClone, } from './src/utils/objectUtils';
|
|
15
12
|
export { isInternalError, isStandardizedError, isObject, isPublicNonRecoverableError, hasMessage, } from './src/utils/typeUtils';
|
|
16
|
-
export type
|
|
13
|
+
export { type StandardizedError } from './src/utils/typeUtils';
|
|
17
14
|
export { resolveLoggerConfiguration } from './src/logging/loggerConfigResolver';
|
|
18
|
-
export type
|
|
19
|
-
export type
|
|
15
|
+
export { type AppLoggerConfig } from './src/logging/loggerConfigResolver';
|
|
16
|
+
export { type ErrorReport, type ErrorReporter, type ErrorResolver, } from './src/errors/errorReporterTypes';
|
|
20
17
|
export { executeAsyncAndHandleGlobalErrors, executeAndHandleGlobalErrors, executeSettleAllAndHandleGlobalErrors, globalLogger, resolveGlobalErrorLogObject, } from './src/errors/globalErrorHandler';
|
|
21
|
-
export type
|
|
18
|
+
export { type MayOmit } from './src/common/may-omit';
|
|
22
19
|
export { waitAndRetry } from './src/utils/waitUtils';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.waitAndRetry = exports.resolveGlobalErrorLogObject = exports.globalLogger = exports.executeSettleAllAndHandleGlobalErrors = exports.executeAndHandleGlobalErrors = exports.executeAsyncAndHandleGlobalErrors = exports.resolveLoggerConfiguration = exports.hasMessage = exports.isPublicNonRecoverableError = exports.isObject = exports.isStandardizedError = exports.isInternalError = exports.deepClone = exports.convertDateFieldsToIsoString = exports.isEmptyObject = exports.copyWithoutUndefined = exports.pickWithoutUndefined = exports.pick = exports.groupByUnique = exports.groupBy = exports.removeNullish = exports.removeFalsy = exports.callChunked = exports.chunk = exports.createRangeValidator = exports.ensureClosingSlashTransformer = exports.ConfigScope = exports.ResponseStatusError = exports.InternalError = exports.PublicNonRecoverableError = exports.buildClient = exports.httpClient = exports.sendPostBinary = exports.sendPost = exports.sendGet = exports.sendPatch = exports.sendDelete = exports.sendPutBinary = exports.sendPut = void 0;
|
|
3
|
+
exports.waitAndRetry = exports.resolveGlobalErrorLogObject = exports.globalLogger = exports.executeSettleAllAndHandleGlobalErrors = exports.executeAndHandleGlobalErrors = exports.executeAsyncAndHandleGlobalErrors = exports.resolveLoggerConfiguration = exports.hasMessage = exports.isPublicNonRecoverableError = exports.isObject = exports.isStandardizedError = exports.isInternalError = exports.deepClone = exports.convertDateFieldsToIsoString = exports.isEmptyObject = exports.copyWithoutUndefined = exports.pickWithoutUndefined = exports.pick = exports.groupByUnique = exports.groupBy = exports.removeNullish = exports.removeFalsy = exports.callChunked = exports.chunk = exports.isFailure = exports.isSuccess = exports.failure = exports.success = exports.createRangeValidator = exports.ensureClosingSlashTransformer = exports.ConfigScope = exports.ResponseStatusError = exports.InternalError = exports.PublicNonRecoverableError = exports.buildClient = exports.httpClient = exports.sendPostBinary = exports.sendPost = exports.sendGet = exports.sendPatch = exports.sendDelete = exports.sendPutBinary = exports.sendPut = void 0;
|
|
4
4
|
var httpClient_1 = require("./src/http/httpClient");
|
|
5
5
|
Object.defineProperty(exports, "sendPut", { enumerable: true, get: function () { return httpClient_1.sendPut; } });
|
|
6
6
|
Object.defineProperty(exports, "sendPutBinary", { enumerable: true, get: function () { return httpClient_1.sendPutBinary; } });
|
|
@@ -23,6 +23,11 @@ var configTransformers_1 = require("./src/config/configTransformers");
|
|
|
23
23
|
Object.defineProperty(exports, "ensureClosingSlashTransformer", { enumerable: true, get: function () { return configTransformers_1.ensureClosingSlashTransformer; } });
|
|
24
24
|
var configValidators_1 = require("./src/config/configValidators");
|
|
25
25
|
Object.defineProperty(exports, "createRangeValidator", { enumerable: true, get: function () { return configValidators_1.createRangeValidator; } });
|
|
26
|
+
var either_1 = require("./src/errors/either");
|
|
27
|
+
Object.defineProperty(exports, "success", { enumerable: true, get: function () { return either_1.success; } });
|
|
28
|
+
Object.defineProperty(exports, "failure", { enumerable: true, get: function () { return either_1.failure; } });
|
|
29
|
+
Object.defineProperty(exports, "isSuccess", { enumerable: true, get: function () { return either_1.isSuccess; } });
|
|
30
|
+
Object.defineProperty(exports, "isFailure", { enumerable: true, get: function () { return either_1.isFailure; } });
|
|
26
31
|
var arrayUtils_1 = require("./src/utils/arrayUtils");
|
|
27
32
|
Object.defineProperty(exports, "chunk", { enumerable: true, get: function () { return arrayUtils_1.chunk; } });
|
|
28
33
|
Object.defineProperty(exports, "callChunked", { enumerable: true, get: function () { return arrayUtils_1.callChunked; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,oDAc8B;AAb5B,qGAAA,OAAO,OAAA;AACP,2GAAA,aAAa,OAAA;AACb,wGAAA,UAAU,OAAA;AACV,uGAAA,SAAS,OAAA;AACT,qGAAA,OAAO,OAAA;AACP,sGAAA,QAAQ,OAAA;AACR,4GAAA,cAAc,OAAA;AACd,wGAAA,UAAU,OAAA;AACV,yGAAA,WAAW,OAAA;AAOb,oFAG+C;AAF7C,sIAAA,yBAAyB,OAAA;AAI3B,4DAImC;AAHjC,8GAAA,aAAa,OAAA;AAIf,wEAAsE;AAA7D,0HAAA,mBAAmB,OAAA;AAE5B,wDAAsD;AAA7C,0GAAA,WAAW,OAAA;AACpB,sEAA+E;AAAtE,mIAAA,6BAA6B,OAAA;AACtC,kEAAoE;AAA3D,wHAAA,oBAAoB,OAAA;AAQ7B,8CAAyF;AAAnE,iGAAA,OAAO,OAAA;AAAE,iGAAA,OAAO,OAAA;AAAE,mGAAA,SAAS,OAAA;AAAE,mGAAA,SAAS,OAAA;AAE5D,qDAAuF;AAA9E,mGAAA,KAAK,OAAA;AAAE,yGAAA,WAAW,OAAA;AAAE,yGAAA,WAAW,OAAA;AAAE,2GAAA,aAAa,OAAA;AACvD,uDASgC;AAR9B,sGAAA,OAAO,OAAA;AACP,4GAAA,aAAa,OAAA;AACb,mGAAA,IAAI,OAAA;AACJ,mHAAA,oBAAoB,OAAA;AACpB,mHAAA,oBAAoB,OAAA;AACpB,4GAAA,aAAa,OAAA;AACb,2HAAA,4BAA4B,OAAA;AAC5B,wGAAA,SAAS,OAAA;AAGX,mDAM8B;AAL5B,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,qGAAA,QAAQ,OAAA;AACR,wHAAA,2BAA2B,OAAA;AAC3B,uGAAA,UAAU,OAAA;AAIZ,2EAA+E;AAAtE,kIAAA,0BAA0B,OAAA;AAQnC,sEAMwC;AALtC,uIAAA,iCAAiC,OAAA;AACjC,kIAAA,4BAA4B,OAAA;AAC5B,2IAAA,qCAAqC,OAAA;AACrC,kHAAA,YAAY,OAAA;AACZ,iIAAA,2BAA2B,OAAA;AAK7B,mDAAoD;AAA3C,yGAAA,YAAY,OAAA"}
|
|
@@ -21,4 +21,8 @@ export type DefiniteEither<T, U> = {
|
|
|
21
21
|
error?: T;
|
|
22
22
|
result: U;
|
|
23
23
|
};
|
|
24
|
+
export declare const isFailure: <T, U>(e: Either<T, U>) => e is Left<T>;
|
|
25
|
+
export declare const isSuccess: <T, U>(e: Either<T, U>) => e is Right<U>;
|
|
26
|
+
export declare const failure: <T>(error: T) => Left<T>;
|
|
27
|
+
export declare const success: <U>(result: U) => Right<U>;
|
|
24
28
|
export {};
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.success = exports.failure = exports.isSuccess = exports.isFailure = void 0;
|
|
4
|
+
const isFailure = (e) => {
|
|
5
|
+
return e.error !== undefined;
|
|
6
|
+
};
|
|
7
|
+
exports.isFailure = isFailure;
|
|
8
|
+
const isSuccess = (e) => {
|
|
9
|
+
return e.result !== undefined;
|
|
10
|
+
};
|
|
11
|
+
exports.isSuccess = isSuccess;
|
|
12
|
+
const failure = (error) => ({ error });
|
|
13
|
+
exports.failure = failure;
|
|
14
|
+
const success = (result) => ({ result });
|
|
15
|
+
exports.success = success;
|
|
3
16
|
//# sourceMappingURL=either.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"either.js","sourceRoot":"","sources":["../../../src/errors/either.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"either.js","sourceRoot":"","sources":["../../../src/errors/either.ts"],"names":[],"mappings":";;;AA2BO,MAAM,SAAS,GAAG,CAAO,CAAe,EAAgB,EAAE;IAC/D,OAAO,CAAC,CAAC,KAAK,KAAK,SAAS,CAAA;AAC9B,CAAC,CAAA;AAFY,QAAA,SAAS,aAErB;AAEM,MAAM,SAAS,GAAG,CAAO,CAAe,EAAiB,EAAE;IAChE,OAAO,CAAC,CAAC,MAAM,KAAK,SAAS,CAAA;AAC/B,CAAC,CAAA;AAFY,QAAA,SAAS,aAErB;AAEM,MAAM,OAAO,GAAG,CAAI,KAAQ,EAAW,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;AAA/C,QAAA,OAAO,WAAwC;AAErD,MAAM,OAAO,GAAG,CAAI,MAAS,EAAY,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;AAAlD,QAAA,OAAO,WAA2C"}
|