@lokalise/node-core 12.5.0 → 13.0.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.
Files changed (85) hide show
  1. package/dist/index.cjs +985 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +404 -0
  4. package/dist/index.d.ts +404 -29
  5. package/dist/index.js +893 -77
  6. package/dist/index.js.map +1 -1
  7. package/package.json +13 -7
  8. package/dist/src/common/commonTypes.d.ts +0 -1
  9. package/dist/src/common/commonTypes.js +0 -3
  10. package/dist/src/common/commonTypes.js.map +0 -1
  11. package/dist/src/common/may-omit.d.ts +0 -1
  12. package/dist/src/common/may-omit.js +0 -3
  13. package/dist/src/common/may-omit.js.map +0 -1
  14. package/dist/src/config/ConfigScope.d.ts +0 -34
  15. package/dist/src/config/ConfigScope.js +0 -173
  16. package/dist/src/config/ConfigScope.js.map +0 -1
  17. package/dist/src/config/configTransformers.d.ts +0 -2
  18. package/dist/src/config/configTransformers.js +0 -15
  19. package/dist/src/config/configTransformers.js.map +0 -1
  20. package/dist/src/config/configTypes.d.ts +0 -30
  21. package/dist/src/config/configTypes.js +0 -3
  22. package/dist/src/config/configTypes.js.map +0 -1
  23. package/dist/src/config/configValidators.d.ts +0 -2
  24. package/dist/src/config/configValidators.js +0 -10
  25. package/dist/src/config/configValidators.js.map +0 -1
  26. package/dist/src/errors/InternalError.d.ts +0 -16
  27. package/dist/src/errors/InternalError.js +0 -29
  28. package/dist/src/errors/InternalError.js.map +0 -1
  29. package/dist/src/errors/PublicNonRecoverableError.d.ts +0 -21
  30. package/dist/src/errors/PublicNonRecoverableError.js +0 -34
  31. package/dist/src/errors/PublicNonRecoverableError.js.map +0 -1
  32. package/dist/src/errors/either.d.ts +0 -28
  33. package/dist/src/errors/either.js +0 -16
  34. package/dist/src/errors/either.js.map +0 -1
  35. package/dist/src/errors/errorReporterTypes.d.ts +0 -14
  36. package/dist/src/errors/errorReporterTypes.js +0 -3
  37. package/dist/src/errors/errorReporterTypes.js.map +0 -1
  38. package/dist/src/errors/errorTypeGuards.d.ts +0 -2
  39. package/dist/src/errors/errorTypeGuards.js +0 -8
  40. package/dist/src/errors/errorTypeGuards.js.map +0 -1
  41. package/dist/src/errors/globalErrorHandler.d.ts +0 -13
  42. package/dist/src/errors/globalErrorHandler.js +0 -77
  43. package/dist/src/errors/globalErrorHandler.js.map +0 -1
  44. package/dist/src/errors/publicErrors.d.ts +0 -27
  45. package/dist/src/errors/publicErrors.js +0 -66
  46. package/dist/src/errors/publicErrors.js.map +0 -1
  47. package/dist/src/errors/types.d.ts +0 -1
  48. package/dist/src/errors/types.js +0 -3
  49. package/dist/src/errors/types.js.map +0 -1
  50. package/dist/src/logging/commonLogger.d.ts +0 -17
  51. package/dist/src/logging/commonLogger.js +0 -3
  52. package/dist/src/logging/commonLogger.js.map +0 -1
  53. package/dist/src/logging/loggerConfigResolver.d.ts +0 -15
  54. package/dist/src/logging/loggerConfigResolver.js +0 -70
  55. package/dist/src/logging/loggerConfigResolver.js.map +0 -1
  56. package/dist/src/observability/MultiTransactionObservabilityManager.d.ts +0 -12
  57. package/dist/src/observability/MultiTransactionObservabilityManager.js +0 -30
  58. package/dist/src/observability/MultiTransactionObservabilityManager.js.map +0 -1
  59. package/dist/src/observability/observabilityTypes.d.ts +0 -23
  60. package/dist/src/observability/observabilityTypes.js +0 -3
  61. package/dist/src/observability/observabilityTypes.js.map +0 -1
  62. package/dist/src/utils/arrayUtils.d.ts +0 -14
  63. package/dist/src/utils/arrayUtils.js +0 -47
  64. package/dist/src/utils/arrayUtils.js.map +0 -1
  65. package/dist/src/utils/checksumUtils.d.ts +0 -5
  66. package/dist/src/utils/checksumUtils.js +0 -37
  67. package/dist/src/utils/checksumUtils.js.map +0 -1
  68. package/dist/src/utils/encryptionUtility.d.ts +0 -20
  69. package/dist/src/utils/encryptionUtility.js +0 -58
  70. package/dist/src/utils/encryptionUtility.js.map +0 -1
  71. package/dist/src/utils/hashUtils.d.ts +0 -9
  72. package/dist/src/utils/hashUtils.js +0 -19
  73. package/dist/src/utils/hashUtils.js.map +0 -1
  74. package/dist/src/utils/objectUtils.d.ts +0 -55
  75. package/dist/src/utils/objectUtils.js +0 -195
  76. package/dist/src/utils/objectUtils.js.map +0 -1
  77. package/dist/src/utils/streamUtils.d.ts +0 -37
  78. package/dist/src/utils/streamUtils.js +0 -85
  79. package/dist/src/utils/streamUtils.js.map +0 -1
  80. package/dist/src/utils/typeUtils.d.ts +0 -10
  81. package/dist/src/utils/typeUtils.js +0 -19
  82. package/dist/src/utils/typeUtils.js.map +0 -1
  83. package/dist/src/utils/waitUtils.d.ts +0 -1
  84. package/dist/src/utils/waitUtils.js +0 -34
  85. package/dist/src/utils/waitUtils.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"PublicNonRecoverableError.js","sourceRoot":"","sources":["../../../src/errors/PublicNonRecoverableError.ts"],"names":[],"mappings":";;;AAmCA,kEAOC;AA1CD,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,wFAAwF;QACxF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;QACjC,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;AAhBD,8DAgBC;AAED,SAAgB,2BAA2B,CAAC,KAAc;IACxD,OAAO,CACL,IAAA,mBAAO,EAAC,KAAK,CAAC;QACd,wGAAwG;QACxG,CAAE,KAAa,CAAC,MAAM,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC,KAAK,IAAI;YAC3E,KAAK,CAAC,IAAI,KAAK,2BAA2B,CAAC,CAC9C,CAAA;AACH,CAAC"}
@@ -1,28 +0,0 @@
1
- type Left<T> = {
2
- error: T;
3
- result?: never;
4
- };
5
- type Right<U> = {
6
- error?: never;
7
- result: U;
8
- };
9
- /**
10
- * Either is a functional programming type which is used to communicate errors happening in potentially recoverable scenarios.
11
- * It can return either an error (Left side) or a resolved result (Right side), but not both.
12
- * It is up to caller of the function to handle received error or throw (Public)NonRecoverableError if it cannot.
13
- *
14
- * @see {@link https://antman-does-software.com/stop-catching-errors-in-typescript-use-the-either-type-to-make-your-code-predictable Further reading on motivation for Either type}
15
- */
16
- export type Either<T, U> = NonNullable<Left<T> | Right<U>>;
17
- /***
18
- * Variation of Either, which may or may not have Error set, but always has Result
19
- */
20
- export type DefiniteEither<T, U> = {
21
- error?: T;
22
- result: U;
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>;
28
- export {};
@@ -1,16 +0,0 @@
1
- "use strict";
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;
16
- //# sourceMappingURL=either.js.map
@@ -1 +0,0 @@
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"}
@@ -1,14 +0,0 @@
1
- import type { InternalError } from './InternalError';
2
- /**
3
- * Generic interface for resolving specific kind of errors based on something that was thrown during execution
4
- */
5
- export type ErrorResolver = {
6
- processError: (thrownError: unknown) => InternalError;
7
- };
8
- export interface ErrorReport {
9
- error: Error;
10
- context?: Record<string, unknown>;
11
- }
12
- export type ErrorReporter = {
13
- report: (errorReport: ErrorReport) => void;
14
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=errorReporterTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errorReporterTypes.js","sourceRoot":"","sources":["../../../src/errors/errorReporterTypes.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import type { EntityGoneError } from './publicErrors';
2
- export declare function isEntityGoneError(entity: unknown): entity is EntityGoneError;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isEntityGoneError = isEntityGoneError;
4
- const PublicNonRecoverableError_1 = require("../errors/PublicNonRecoverableError");
5
- function isEntityGoneError(entity) {
6
- return (0, PublicNonRecoverableError_1.isPublicNonRecoverableError)(entity) && entity.httpStatusCode === 410;
7
- }
8
- //# sourceMappingURL=errorTypeGuards.js.map
@@ -1 +0,0 @@
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"}
@@ -1,13 +0,0 @@
1
- import type { SerializedError } from 'pino';
2
- import type { CommonLogger } from '../logging/commonLogger';
3
- type LogObject = {
4
- message: string;
5
- 'x-request-id'?: string;
6
- error?: SerializedError;
7
- };
8
- export declare const globalLogger: CommonLogger;
9
- export declare function resolveGlobalErrorLogObject(err: unknown, correlationId?: string): LogObject;
10
- export declare function executeAndHandleGlobalErrors<T>(operation: () => T): T;
11
- export declare function executeAsyncAndHandleGlobalErrors<T>(operation: () => Promise<T>, stopOnError?: boolean): Promise<T | undefined>;
12
- export declare function executeSettleAllAndHandleGlobalErrors(promises: Promise<unknown>[], stopOnError?: boolean): Promise<PromiseSettledResult<unknown>[]>;
13
- export {};
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.globalLogger = void 0;
4
- exports.resolveGlobalErrorLogObject = resolveGlobalErrorLogObject;
5
- exports.executeAndHandleGlobalErrors = executeAndHandleGlobalErrors;
6
- exports.executeAsyncAndHandleGlobalErrors = executeAsyncAndHandleGlobalErrors;
7
- exports.executeSettleAllAndHandleGlobalErrors = executeSettleAllAndHandleGlobalErrors;
8
- const node_util_1 = require("node:util");
9
- const pino_1 = require("pino");
10
- const typeUtils_1 = require("../utils/typeUtils");
11
- exports.globalLogger = (0, pino_1.pino)({
12
- formatters: {
13
- level: (_label, numericLevel) => {
14
- const level = pino_1.levels.labels[numericLevel] || 'unknown';
15
- return { level };
16
- },
17
- },
18
- });
19
- function resolveGlobalErrorLogObject(err, correlationId) {
20
- if (node_util_1.types.isNativeError(err)) {
21
- return {
22
- message: err.message,
23
- error: pino_1.stdSerializers.err(err),
24
- 'x-request-id': correlationId,
25
- };
26
- }
27
- if ((0, typeUtils_1.hasMessage)(err)) {
28
- return {
29
- message: err.message,
30
- 'x-request-id': correlationId,
31
- };
32
- }
33
- return {
34
- message: 'Unknown error',
35
- 'x-request-id': correlationId,
36
- };
37
- }
38
- function executeAndHandleGlobalErrors(operation) {
39
- try {
40
- const result = operation();
41
- return result;
42
- }
43
- catch (err) {
44
- const logObject = resolveGlobalErrorLogObject(err);
45
- exports.globalLogger.error(logObject, logObject.message);
46
- process.exit(1);
47
- }
48
- }
49
- async function executeAsyncAndHandleGlobalErrors(operation, stopOnError = true) {
50
- try {
51
- const result = await operation();
52
- return result;
53
- }
54
- catch (err) {
55
- const logObject = resolveGlobalErrorLogObject(err);
56
- exports.globalLogger.error(logObject, logObject.message);
57
- if (stopOnError) {
58
- process.exit(1);
59
- }
60
- }
61
- }
62
- async function executeSettleAllAndHandleGlobalErrors(promises, stopOnError = true) {
63
- const result = await Promise.allSettled(promises);
64
- let errorsHappened;
65
- for (const entry of result) {
66
- if (entry.status === 'rejected') {
67
- const logObject = resolveGlobalErrorLogObject(entry.reason);
68
- exports.globalLogger.error(logObject, logObject.message);
69
- errorsHappened = true;
70
- }
71
- }
72
- if (stopOnError && errorsHappened) {
73
- process.exit(1);
74
- }
75
- return result;
76
- }
77
- //# sourceMappingURL=globalErrorHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"globalErrorHandler.js","sourceRoot":"","sources":["../../../src/errors/globalErrorHandler.ts"],"names":[],"mappings":";;;AAuBA,kEAoBC;AAED,oEASC;AAED,8EAcC;AA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G,IAAI;IAElB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAA;QAChC,OAAO,MAAM,CAAA;IACf,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,SAAS,GAAG,2BAA2B,CAAC,GAAG,CAAC,CAAA;QAClD,oBAAY,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;QAChD,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;IACH,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,qCAAqC,CACzD,QAA4B,EAC5B,WAAW,GAAG,IAAI;IAElB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;IAEjD,IAAI,cAAmC,CAAA;IACvC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YAChC,MAAM,SAAS,GAAG,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YAC3D,oBAAY,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;YAChD,cAAc,GAAG,IAAI,CAAA;QACvB,CAAC;IACH,CAAC;IAED,IAAI,WAAW,IAAI,cAAc,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -1,27 +0,0 @@
1
- import type { FreeformRecord } from '../common/commonTypes';
2
- import { PublicNonRecoverableError } from './PublicNonRecoverableError';
3
- export type CommonErrorParams = {
4
- message: string;
5
- details?: FreeformRecord;
6
- cause?: Error;
7
- };
8
- export type OptionalMessageErrorParams = Partial<CommonErrorParams>;
9
- export type ValidationError = {
10
- message: string;
11
- path: string[];
12
- };
13
- export declare class RequestValidationError extends PublicNonRecoverableError {
14
- constructor(errors: ValidationError[]);
15
- }
16
- export declare class AccessDeniedError extends PublicNonRecoverableError {
17
- constructor(params: CommonErrorParams);
18
- }
19
- export declare class EntityNotFoundError extends PublicNonRecoverableError {
20
- constructor(params: CommonErrorParams);
21
- }
22
- export declare class EntityGoneError extends PublicNonRecoverableError {
23
- constructor(params: CommonErrorParams);
24
- }
25
- export declare class AuthFailedError extends PublicNonRecoverableError {
26
- constructor(params?: OptionalMessageErrorParams);
27
- }
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthFailedError = exports.EntityGoneError = exports.EntityNotFoundError = exports.AccessDeniedError = exports.RequestValidationError = void 0;
4
- const node_http2_1 = require("node:http2");
5
- const PublicNonRecoverableError_1 = require("./PublicNonRecoverableError");
6
- class RequestValidationError extends PublicNonRecoverableError_1.PublicNonRecoverableError {
7
- constructor(errors) {
8
- super({
9
- message: 'Invalid params',
10
- errorCode: 'VALIDATION_ERROR',
11
- httpStatusCode: node_http2_1.constants.HTTP_STATUS_BAD_REQUEST,
12
- details: {
13
- error: errors,
14
- },
15
- });
16
- }
17
- }
18
- exports.RequestValidationError = RequestValidationError;
19
- class AccessDeniedError extends PublicNonRecoverableError_1.PublicNonRecoverableError {
20
- constructor(params) {
21
- super({
22
- message: params.message,
23
- errorCode: 'ACCESS_DENIED',
24
- httpStatusCode: node_http2_1.constants.HTTP_STATUS_FORBIDDEN,
25
- details: params.details,
26
- cause: params.cause,
27
- });
28
- }
29
- }
30
- exports.AccessDeniedError = AccessDeniedError;
31
- class EntityNotFoundError extends PublicNonRecoverableError_1.PublicNonRecoverableError {
32
- constructor(params) {
33
- super({
34
- message: params.message,
35
- errorCode: 'ENTITY_NOT_FOUND',
36
- httpStatusCode: node_http2_1.constants.HTTP_STATUS_NOT_FOUND,
37
- details: params.details,
38
- cause: params.cause,
39
- });
40
- }
41
- }
42
- exports.EntityNotFoundError = EntityNotFoundError;
43
- class EntityGoneError extends PublicNonRecoverableError_1.PublicNonRecoverableError {
44
- constructor(params) {
45
- super({
46
- message: params.message,
47
- errorCode: 'ENTITY_GONE',
48
- httpStatusCode: 410,
49
- details: params.details,
50
- });
51
- }
52
- }
53
- exports.EntityGoneError = EntityGoneError;
54
- class AuthFailedError extends PublicNonRecoverableError_1.PublicNonRecoverableError {
55
- constructor(params = {}) {
56
- super({
57
- message: params.message ?? 'Authentication failed',
58
- errorCode: 'AUTH_FAILED',
59
- httpStatusCode: node_http2_1.constants.HTTP_STATUS_UNAUTHORIZED,
60
- details: params.details,
61
- cause: params.cause,
62
- });
63
- }
64
- }
65
- exports.AuthFailedError = AuthFailedError;
66
- //# sourceMappingURL=publicErrors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"publicErrors.js","sourceRoot":"","sources":["../../../src/errors/publicErrors.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AAIvD,2EAAuE;AAevE,MAAa,sBAAuB,SAAQ,qDAAyB;IACnE,YAAY,MAAyB;QACnC,KAAK,CAAC;YACJ,OAAO,EAAE,gBAAgB;YACzB,SAAS,EAAE,kBAAkB;YAC7B,cAAc,EAAE,sBAAa,CAAC,uBAAuB;YACrD,OAAO,EAAE;gBACP,KAAK,EAAE,MAAM;aACd;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AAXD,wDAWC;AAED,MAAa,iBAAkB,SAAQ,qDAAyB;IAC9D,YAAY,MAAyB;QACnC,KAAK,CAAC;YACJ,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,eAAe;YAC1B,cAAc,EAAE,sBAAa,CAAC,qBAAqB;YACnD,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;IACJ,CAAC;CACF;AAVD,8CAUC;AAED,MAAa,mBAAoB,SAAQ,qDAAyB;IAChE,YAAY,MAAyB;QACnC,KAAK,CAAC;YACJ,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,kBAAkB;YAC7B,cAAc,EAAE,sBAAa,CAAC,qBAAqB;YACnD,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;IACJ,CAAC;CACF;AAVD,kDAUC;AAED,MAAa,eAAgB,SAAQ,qDAAyB;IAC5D,YAAY,MAAyB;QACnC,KAAK,CAAC;YACJ,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,aAAa;YACxB,cAAc,EAAE,GAAG;YACnB,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAA;IACJ,CAAC;CACF;AATD,0CASC;AAED,MAAa,eAAgB,SAAQ,qDAAyB;IAC5D,YAAY,SAAqC,EAAE;QACjD,KAAK,CAAC;YACJ,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,uBAAuB;YAClD,SAAS,EAAE,aAAa;YACxB,cAAc,EAAE,sBAAa,CAAC,wBAAwB;YACtD,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;IACJ,CAAC;CACF;AAVD,0CAUC"}
@@ -1 +0,0 @@
1
- export type ErrorDetails = Record<string, unknown>;
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/errors/types.ts"],"names":[],"mappings":""}
@@ -1,17 +0,0 @@
1
- import type { BaseLogger, Bindings, ChildLoggerOptions } from 'pino';
2
- export type CommonLogger = BaseLogger & {
3
- /**
4
- * Creates a child logger, setting all key-value pairs in `bindings` as properties in the log lines. All serializers will be applied to the given pair.
5
- * Child loggers use the same output stream as the parent and inherit the current log level of the parent at the time they are spawned.
6
- * If a `level` property is present in the object passed to `child` it will override the child logger level.
7
- *
8
- * @param bindings: an object of key-value pairs to include in log lines as properties.
9
- * @param options: an options object that will override child logger inherited options.
10
- * @returns a child logger instance.
11
- */
12
- child(bindings: Bindings, options?: ChildLoggerOptions): CommonLogger;
13
- /**
14
- * A utility method for determining if a given log level will write to the destination.
15
- */
16
- isLevelEnabled(level: string): boolean;
17
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=commonLogger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commonLogger.js","sourceRoot":"","sources":["../../../src/logging/commonLogger.ts"],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- import type { Logger, LoggerOptions, redactOptions } from 'pino';
2
- export type AppLoggerConfig = {
3
- logLevel: 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'silent';
4
- nodeEnv: 'production' | 'development' | 'test';
5
- base?: Record<string, unknown>;
6
- redact?: redactOptions;
7
- };
8
- export type MonorepoAppLoggerConfig = AppLoggerConfig & {
9
- targetFile?: string;
10
- append?: boolean;
11
- };
12
- export declare function resolveMonorepoLogger(appConfig: MonorepoAppLoggerConfig): Logger;
13
- export declare function resolveMonorepoLoggerConfiguration(appConfig: MonorepoAppLoggerConfig): LoggerOptions | Logger;
14
- export declare function resolveLogger(appConfig: AppLoggerConfig): Logger;
15
- export declare function resolveLoggerConfiguration(appConfig: AppLoggerConfig): LoggerOptions | Logger;
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveMonorepoLogger = resolveMonorepoLogger;
4
- exports.resolveMonorepoLoggerConfiguration = resolveMonorepoLoggerConfiguration;
5
- exports.resolveLogger = resolveLogger;
6
- exports.resolveLoggerConfiguration = resolveLoggerConfiguration;
7
- const tslib_1 = require("tslib");
8
- const pino_1 = require("pino");
9
- const pino_pretty_1 = tslib_1.__importDefault(require("pino-pretty"));
10
- /* c8 ignore next 8 */
11
- function resolveMonorepoLogger(appConfig) {
12
- if (appConfig.nodeEnv !== 'development') {
13
- return resolveLogger(appConfig);
14
- }
15
- const configuration = resolveMonorepoLoggerConfiguration(appConfig);
16
- return (0, pino_1.pino)(configuration);
17
- }
18
- // Note that transports do not work in vitest, likely because pino attempts to run them in a separate worker
19
- /* c8 ignore next 25 */
20
- function resolveMonorepoLoggerConfiguration(appConfig) {
21
- if (appConfig.nodeEnv !== 'development') {
22
- return resolveLoggerConfiguration(appConfig);
23
- }
24
- return {
25
- level: appConfig.logLevel,
26
- formatters: {
27
- level: (label) => {
28
- return { level: label };
29
- },
30
- },
31
- redact: appConfig.redact,
32
- transport: {
33
- target: 'pino/file',
34
- options: {
35
- destination: appConfig.targetFile ?? './service.log',
36
- mkdir: true,
37
- append: appConfig.append ?? false,
38
- },
39
- },
40
- };
41
- }
42
- function resolveLogger(appConfig) {
43
- if (appConfig.nodeEnv !== 'production') {
44
- return resolveLoggerConfiguration(appConfig);
45
- }
46
- const configuration = resolveLoggerConfiguration(appConfig);
47
- return (0, pino_1.pino)(configuration);
48
- }
49
- function resolveLoggerConfiguration(appConfig) {
50
- if (appConfig.nodeEnv !== 'production') {
51
- return (0, pino_1.pino)((0, pino_pretty_1.default)({
52
- sync: true,
53
- minimumLevel: appConfig.logLevel,
54
- colorize: true,
55
- translateTime: 'SYS:standard',
56
- ignore: 'hostname,pid',
57
- }));
58
- }
59
- return {
60
- level: appConfig.logLevel,
61
- formatters: {
62
- level: (_label, numericLevel) => {
63
- const level = pino_1.levels.labels[numericLevel] || 'unknown';
64
- return { level };
65
- },
66
- },
67
- redact: appConfig.redact,
68
- };
69
- }
70
- //# sourceMappingURL=loggerConfigResolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loggerConfigResolver.js","sourceRoot":"","sources":["../../../src/logging/loggerConfigResolver.ts"],"names":[],"mappings":";;AAiBA,sDAOC;AAID,gFAwBC;AAED,sCAOC;AAED,gEAuBC;;AArFD,+BAAmC;AACnC,sEAAgC;AAchC,sBAAsB;AACt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AA,qBAAM,EAAC;YACL,IAAI,EAAE,IAAI;YACV,YAAY,EAAE,SAAS,CAAC,QAAiB;YACzC,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,cAAc;YAC7B,MAAM,EAAE,cAAc;SACvB,CAAC,CACH,CAAA;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,SAAS,CAAC,QAAQ;QACzB,UAAU,EAAE;YACV,KAAK,EAAE,CAAC,MAAM,EAAE,YAAY,EAAqB,EAAE;gBACjD,MAAM,KAAK,GAAG,aAAM,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,SAAS,CAAA;gBACtD,OAAO,EAAE,KAAK,EAAE,CAAA;YAClB,CAAC;SACF;QACD,MAAM,EAAE,SAAS,CAAC,MAAM;KACD,CAAA;AAC3B,CAAC"}
@@ -1,12 +0,0 @@
1
- import type { TransactionObservabilityManager } from './observabilityTypes';
2
- /**
3
- * Groups different TransactionObservabilityManager instances into one
4
- * to facilitate tracking transactions across multiple observability tools.
5
- */
6
- export declare class MultiTransactionObservabilityManager implements TransactionObservabilityManager {
7
- private readonly managers;
8
- constructor(managers: TransactionObservabilityManager[]);
9
- start(transactionName: string, uniqueTransactionKey: string): void;
10
- startWithGroup(transactionName: string, uniqueTransactionKey: string, transactionGroup: string): void;
11
- stop(uniqueTransactionKey: string, wasSuccessful?: boolean): void;
12
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MultiTransactionObservabilityManager = void 0;
4
- /**
5
- * Groups different TransactionObservabilityManager instances into one
6
- * to facilitate tracking transactions across multiple observability tools.
7
- */
8
- class MultiTransactionObservabilityManager {
9
- managers;
10
- constructor(managers) {
11
- this.managers = managers;
12
- }
13
- start(transactionName, uniqueTransactionKey) {
14
- for (const manager of this.managers) {
15
- manager.start(transactionName, uniqueTransactionKey);
16
- }
17
- }
18
- startWithGroup(transactionName, uniqueTransactionKey, transactionGroup) {
19
- for (const manager of this.managers) {
20
- manager.startWithGroup(transactionName, uniqueTransactionKey, transactionGroup);
21
- }
22
- }
23
- stop(uniqueTransactionKey, wasSuccessful) {
24
- for (const manager of this.managers) {
25
- manager.stop(uniqueTransactionKey, wasSuccessful);
26
- }
27
- }
28
- }
29
- exports.MultiTransactionObservabilityManager = MultiTransactionObservabilityManager;
30
- //# sourceMappingURL=MultiTransactionObservabilityManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MultiTransactionObservabilityManager.js","sourceRoot":"","sources":["../../../src/observability/MultiTransactionObservabilityManager.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,MAAa,oCAAoC;IAC9B,QAAQ,CAAmC;IAE5D,YAAY,QAA2C;QACrD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,KAAK,CAAC,eAAuB,EAAE,oBAA4B;QACzD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAA;QACtD,CAAC;IACH,CAAC;IAED,cAAc,CACZ,eAAuB,EACvB,oBAA4B,EAC5B,gBAAwB;QAExB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,OAAO,CAAC,cAAc,CAAC,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,CAAC,CAAA;QACjF,CAAC;IACH,CAAC;IAED,IAAI,CAAC,oBAA4B,EAAE,aAAuB;QACxD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAA;QACnD,CAAC;IACH,CAAC;CACF;AA5BD,oFA4BC"}
@@ -1,23 +0,0 @@
1
- export type TransactionObservabilityManager = {
2
- /**
3
- * Creates and starts a background transaction to record work done
4
- *
5
- * @param transactionName - used for grouping similar transactions together
6
- * @param uniqueTransactionKey - used for identifying specific ongoing transaction. Must be reasonably unique to reduce possibility of collisions
7
- */
8
- start: (transactionName: string, uniqueTransactionKey: string) => unknown;
9
- /**
10
- * Creates and starts a background transaction to record work done, and relates it to a specified group
11
- *
12
- * @param transactionName - used for grouping similar transactions together
13
- * @param uniqueTransactionKey - used for identifying specific ongoing transaction. Must be reasonably unique to reduce possibility of collisions *
14
- * @param transactionGroup - group is used for grouping related transactions with different names
15
- */
16
- startWithGroup: (transactionName: string, uniqueTransactionKey: string, transactionGroup: string) => void;
17
- /**
18
- * Ends the transaction
19
- * @param uniqueTransactionKey - used for identifying specific ongoing transaction. Must be reasonably unique to reduce possibility of collisions
20
- * @param wasSuccessful - indicates if the transaction was successful or not
21
- */
22
- stop: (uniqueTransactionKey: string, wasSuccessful?: boolean) => unknown;
23
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=observabilityTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"observabilityTypes.js","sourceRoot":"","sources":["../../../src/observability/observabilityTypes.ts"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- export declare function chunk<T>(array: T[], chunkSize: number): T[][];
2
- export declare function callChunked<Item>(chunkSize: number, array: readonly Item[], processFn: (arrayChunk: Item[]) => Promise<unknown>): Promise<void>;
3
- /**
4
- * Return a copy of the given array without null or undefined values
5
- */
6
- export declare function removeNullish<const T>(array: readonly (T | null | undefined)[]): T[];
7
- /**
8
- * Return a copy of the given array without falsy values (eg: false, 0, '', null, undefined)
9
- */
10
- export declare function removeFalsy<const T>(array: readonly (T | null | undefined | 0 | '' | false)[]): T[];
11
- /**
12
- * Return a copy of the given array without duplicates.
13
- */
14
- export declare function removeDuplicates<const T>(array: readonly T[]): T[];
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.chunk = chunk;
4
- exports.callChunked = callChunked;
5
- exports.removeNullish = removeNullish;
6
- exports.removeFalsy = removeFalsy;
7
- exports.removeDuplicates = removeDuplicates;
8
- function chunk(array, chunkSize) {
9
- const length = array.length;
10
- if (!length || chunkSize < 1) {
11
- return [];
12
- }
13
- let index = 0;
14
- let resIndex = 0;
15
- const result = new Array(Math.ceil(length / chunkSize));
16
- while (index < length) {
17
- // biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
18
- result[resIndex++] = array.slice(index, (index += chunkSize));
19
- }
20
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
21
- return result;
22
- }
23
- async function callChunked(chunkSize, array, processFn) {
24
- for (let i = 0; i < array.length; i += chunkSize) {
25
- const arrayChunk = array.slice(i, i + chunkSize);
26
- await processFn(arrayChunk);
27
- }
28
- }
29
- /**
30
- * Return a copy of the given array without null or undefined values
31
- */
32
- function removeNullish(array) {
33
- return array.filter((e) => e !== undefined && e !== null);
34
- }
35
- /**
36
- * Return a copy of the given array without falsy values (eg: false, 0, '', null, undefined)
37
- */
38
- function removeFalsy(array) {
39
- return array.filter((e) => e);
40
- }
41
- /**
42
- * Return a copy of the given array without duplicates.
43
- */
44
- function removeDuplicates(array) {
45
- return [...new Set(array)];
46
- }
47
- //# sourceMappingURL=arrayUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrayUtils.js","sourceRoot":"","sources":["../../../src/utils/arrayUtils.ts"],"names":[],"mappings":";;AAAA,sBAgBC;AAED,kCASC;AAKD,sCAEC;AAKD,kCAIC;AAKD,4CAEC;AAlDD,SAAgB,KAAK,CAAI,KAAU,EAAE,SAAiB;IACpD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;IAC3B,IAAI,CAAC,MAAM,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAA;IACX,CAAC;IACD,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,IAAI,QAAQ,GAAG,CAAC,CAAA;IAChB,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;IAEvD,OAAO,KAAK,GAAG,MAAM,EAAE,CAAC;QACtB,oEAAoE;QACpE,MAAM,CAAC,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,CAAA;IAC/D,CAAC;IAED,+DAA+D;IAC/D,OAAO,MAAM,CAAA;AACf,CAAC;AAEM,KAAK,UAAU,WAAW,CAC/B,SAAiB,EACjB,KAAsB,EACtB,SAAmD;IAEnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;QACjD,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAA;QAChD,MAAM,SAAS,CAAC,UAAU,CAAC,CAAA;IAC7B,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAU,KAAwC;IAC7E,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAQ,CAAA;AAClE,CAAC;AAED;;GAEG;AACH,SAAgB,WAAW,CACzB,KAAyD;IAEzD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAQ,CAAA;AACtC,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAU,KAAmB;IAC3D,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;AAC5B,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { BinaryLike } from 'node:crypto';
2
- import type { Readable } from 'node:stream';
3
- export declare function generateChecksumForBufferOrString(data: BinaryLike): string;
4
- export declare function generateChecksumForObject(object: object): string;
5
- export declare function generateChecksumForReadable(readable: Readable): Promise<string>;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateChecksumForBufferOrString = generateChecksumForBufferOrString;
4
- exports.generateChecksumForObject = generateChecksumForObject;
5
- exports.generateChecksumForReadable = generateChecksumForReadable;
6
- const node_crypto_1 = require("node:crypto");
7
- const HASH_ALGORITHM = 'md5';
8
- function generateChecksumForBufferOrString(data) {
9
- return (0, node_crypto_1.createHash)(HASH_ALGORITHM).update(data).digest('hex');
10
- }
11
- function generateChecksumForObject(object) {
12
- const objectAsString = JSON.stringify(object);
13
- return generateChecksumForBufferOrString(objectAsString);
14
- }
15
- function generateChecksumForReadable(readable) {
16
- return new Promise((resolve, reject) => {
17
- const hashCreator = (0, node_crypto_1.createHash)(HASH_ALGORITHM);
18
- readable.on('data', (data) => {
19
- if (Buffer.isBuffer(data)) {
20
- hashCreator.update(data);
21
- }
22
- else {
23
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
24
- hashCreator.update(Buffer.from(data));
25
- }
26
- });
27
- readable.on('end', () => {
28
- const hash = hashCreator.digest('hex');
29
- resolve(hash);
30
- });
31
- readable.on('error', (err) => {
32
- /* c8 ignore next 1 */
33
- reject(err);
34
- });
35
- });
36
- }
37
- //# sourceMappingURL=checksumUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checksumUtils.js","sourceRoot":"","sources":["../../../src/utils/checksumUtils.ts"],"names":[],"mappings":";;AAMA,8EAEC;AAED,8DAGC;AAED,kEAqBC;AAnCD,6CAAwC;AAGxC,MAAM,cAAc,GAAG,KAAK,CAAA;AAE5B,SAAgB,iCAAiC,CAAC,IAAgB;IAChE,OAAO,IAAA,wBAAU,EAAC,cAAc,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC9D,CAAC;AAED,SAAgB,yBAAyB,CAAC,MAAc;IACtD,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CA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