@lokalise/node-core 9.19.0 → 9.20.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 +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/src/utils/hashUtils.d.ts +9 -0
- package/dist/src/utils/hashUtils.js +19 -0
- package/dist/src/utils/hashUtils.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -235,3 +235,7 @@ expect(someEventEmitter.emittedEvents.length).toBe(1)
|
|
|
235
235
|
## Encryption
|
|
236
236
|
|
|
237
237
|
- `EncryptionUtility` - small class for encrypting/decrypting using aes-256-gcm. Adapted from: https://github.com/MauriceButler/cryptr
|
|
238
|
+
|
|
239
|
+
## Hashing
|
|
240
|
+
|
|
241
|
+
- `HashUtils` - utils for hashing using sha256/sha512 algorithms
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { chunk, callChunked, removeFalsy, removeNullish } from './src/utils/arra
|
|
|
13
13
|
export { groupBy, groupByPath, groupByUnique, pick, pickWithoutUndefined, copyWithoutUndefined, copyWithoutEmpty, isEmptyObject, convertDateFieldsToIsoString, deepClone, } from './src/utils/objectUtils';
|
|
14
14
|
export { isError, isInternalError, isStandardizedError, isObject, isPublicNonRecoverableError, hasMessage, } from './src/utils/typeUtils';
|
|
15
15
|
export { type StandardizedError } from './src/utils/typeUtils';
|
|
16
|
+
export { generateHash, HashAlgorithm, HashEncoding } from './src/utils/hashUtils';
|
|
16
17
|
export { resolveLoggerConfiguration, resolveMonorepoLoggerConfiguration, } from './src/logging/loggerConfigResolver';
|
|
17
18
|
export type { AppLoggerConfig, MonorepoAppLoggerConfig } from './src/logging/loggerConfigResolver';
|
|
18
19
|
export type { CommonLogger } from './src/logging/commonLogger';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.waitAndRetry = exports.AuthFailedError = exports.EntityGoneError = exports.EntityNotFoundError = exports.AccessDeniedError = exports.RequestValidationError = void 0;
|
|
3
|
+
exports.executeAndHandleGlobalErrors = exports.executeAsyncAndHandleGlobalErrors = exports.resolveMonorepoLoggerConfiguration = exports.resolveLoggerConfiguration = exports.HashEncoding = exports.HashAlgorithm = exports.generateHash = exports.hasMessage = exports.isPublicNonRecoverableError = exports.isObject = exports.isStandardizedError = exports.isInternalError = 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.isResponseStatusError = exports.ResponseStatusError = exports.InternalError = exports.PublicNonRecoverableError = exports.JSON_HEADERS = exports.buildClient = exports.httpClient = exports.sendPostBinary = exports.sendPost = exports.sendGet = exports.sendPatch = exports.sendDelete = exports.sendPutBinary = exports.sendPut = void 0;
|
|
4
|
+
exports.waitAndRetry = exports.AuthFailedError = exports.EntityGoneError = exports.EntityNotFoundError = exports.AccessDeniedError = exports.RequestValidationError = exports.resolveGlobalErrorLogObject = exports.globalLogger = exports.executeSettleAllAndHandleGlobalErrors = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
var httpClient_1 = require("./src/http/httpClient");
|
|
7
7
|
Object.defineProperty(exports, "sendPut", { enumerable: true, get: function () { return httpClient_1.sendPut; } });
|
|
@@ -59,6 +59,10 @@ Object.defineProperty(exports, "isStandardizedError", { enumerable: true, get: f
|
|
|
59
59
|
Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return typeUtils_1.isObject; } });
|
|
60
60
|
Object.defineProperty(exports, "isPublicNonRecoverableError", { enumerable: true, get: function () { return typeUtils_1.isPublicNonRecoverableError; } });
|
|
61
61
|
Object.defineProperty(exports, "hasMessage", { enumerable: true, get: function () { return typeUtils_1.hasMessage; } });
|
|
62
|
+
var hashUtils_1 = require("./src/utils/hashUtils");
|
|
63
|
+
Object.defineProperty(exports, "generateHash", { enumerable: true, get: function () { return hashUtils_1.generateHash; } });
|
|
64
|
+
Object.defineProperty(exports, "HashAlgorithm", { enumerable: true, get: function () { return hashUtils_1.HashAlgorithm; } });
|
|
65
|
+
Object.defineProperty(exports, "HashEncoding", { enumerable: true, get: function () { return hashUtils_1.HashEncoding; } });
|
|
62
66
|
var loggerConfigResolver_1 = require("./src/logging/loggerConfigResolver");
|
|
63
67
|
Object.defineProperty(exports, "resolveLoggerConfiguration", { enumerable: true, get: function () { return loggerConfigResolver_1.resolveLoggerConfiguration; } });
|
|
64
68
|
Object.defineProperty(exports, "resolveMonorepoLoggerConfiguration", { enumerable: true, get: function () { return loggerConfigResolver_1.resolveMonorepoLoggerConfiguration; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;AAAA,oDAe8B;AAd5B,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;AAKX,0GAAA,YAAY,OAAA;AAGd,oFAG+C;AAF7C,sIAAA,yBAAyB,OAAA;AAI3B,4DAImC;AAHjC,8GAAA,aAAa,OAAA;AAIf,wEAAsE;AAA7D,0HAAA,mBAAmB,OAAA;AAC5B,gEAAuF;AAA9E,wHAAA,qBAAqB,OAAA;AA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AA;AACb,2HAAA,4BAA4B,OAAA;AAC5B,wGAAA,SAAS,OAAA;AAGX,mDAO8B;AAN5B,oGAAA,OAAO,OAAA;AACP,4GAAA,eAAe,OAAA;AACf,gHAAA,mBAAmB,OAAA;AACnB,qGAAA,QAAQ,OAAA;AACR,wHAAA,2BAA2B,OAAA;AAC3B,uGAAA,UAAU,OAAA;AAIZ,mDAAiF;AAAxE,yGAAA,YAAY,OAAA;AAAE,0GAAA,aAAa,OAAA;AAAE,yGAAA,YAAY,OAAA;AAElD,2EAG2C;AAFzC,kIAAA,0BAA0B,OAAA;AAC1B,0IAAA,kCAAkC,OAAA;AAUpC,sEAMwC;AALtC,uIAAA,iCAAiC,OAAA;AACjC,kIAAA,4BAA4B,OAAA;AAC5B,2IAAA,qCAAqC,OAAA;AACrC,kHAAA,YAAY,OAAA;AACZ,iIAAA,2BAA2B,OAAA;AAK7B,0DASkC;AALhC,sHAAA,sBAAsB,OAAA;AACtB,iHAAA,iBAAiB,OAAA;AACjB,mHAAA,mBAAmB,OAAA;AACnB,+GAAA,eAAe,OAAA;AACf,+GAAA,eAAe,OAAA;AAGjB,mDAAoD;AAA3C,yGAAA,YAAY,OAAA;AAErB,iFAAsD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare enum HashEncoding {
|
|
2
|
+
HEX = "hex",
|
|
3
|
+
BASE64 = "base64"
|
|
4
|
+
}
|
|
5
|
+
export declare enum HashAlgorithm {
|
|
6
|
+
SHA256 = "sha256",
|
|
7
|
+
SHA512 = "sha512"
|
|
8
|
+
}
|
|
9
|
+
export declare function generateHash(algorithm: HashAlgorithm, data: string, encoding?: HashEncoding): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateHash = exports.HashAlgorithm = exports.HashEncoding = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
var HashEncoding;
|
|
6
|
+
(function (HashEncoding) {
|
|
7
|
+
HashEncoding["HEX"] = "hex";
|
|
8
|
+
HashEncoding["BASE64"] = "base64";
|
|
9
|
+
})(HashEncoding || (exports.HashEncoding = HashEncoding = {}));
|
|
10
|
+
var HashAlgorithm;
|
|
11
|
+
(function (HashAlgorithm) {
|
|
12
|
+
HashAlgorithm["SHA256"] = "sha256";
|
|
13
|
+
HashAlgorithm["SHA512"] = "sha512";
|
|
14
|
+
})(HashAlgorithm || (exports.HashAlgorithm = HashAlgorithm = {}));
|
|
15
|
+
function generateHash(algorithm, data, encoding = HashEncoding.HEX) {
|
|
16
|
+
return (0, node_crypto_1.createHash)(algorithm).update(data).digest(encoding);
|
|
17
|
+
}
|
|
18
|
+
exports.generateHash = generateHash;
|
|
19
|
+
//# sourceMappingURL=hashUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashUtils.js","sourceRoot":"","sources":["../../../src/utils/hashUtils.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AAExC,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,2BAAW,CAAA;IACX,iCAAiB,CAAA;AACnB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,kCAAiB,CAAA;AACnB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,SAAgB,YAAY,CAC1B,SAAwB,EACxB,IAAY,EACZ,WAAyB,YAAY,CAAC,GAAG;IAEzC,OAAO,IAAA,wBAAU,EAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC5D,CAAC;AAND,oCAMC"}
|