@lokalise/node-core 2.0.0 → 2.1.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/dist/index.d.ts +7 -0
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/src/config/ConfigScope.d.ts +21 -0
- package/dist/src/config/ConfigScope.js +102 -0
- package/dist/src/config/ConfigScope.js.map +1 -0
- package/dist/src/config/ConfigScope.spec.d.ts +1 -0
- package/dist/src/config/ConfigScope.spec.js +223 -0
- package/dist/src/config/ConfigScope.spec.js.map +1 -0
- package/dist/src/config/configTransformers.d.ts +2 -0
- package/dist/src/config/configTransformers.js +15 -0
- package/dist/src/config/configTransformers.js.map +1 -0
- package/dist/src/config/configTransformers.spec.d.ts +1 -0
- package/dist/src/config/configTransformers.spec.js +28 -0
- package/dist/src/config/configTransformers.spec.js.map +1 -0
- package/dist/src/config/configTypes.d.ts +20 -0
- package/dist/src/config/configTypes.js +3 -0
- package/dist/src/config/configTypes.js.map +1 -0
- package/dist/src/errors/InternalError.d.ts +11 -0
- package/dist/src/errors/InternalError.js +15 -0
- package/dist/src/errors/InternalError.js.map +1 -0
- package/dist/src/errors/PublicNonRecoverableError.d.ts +16 -0
- package/dist/src/errors/PublicNonRecoverableError.js +20 -0
- package/dist/src/errors/PublicNonRecoverableError.js.map +1 -0
- package/dist/src/errors/PublicNonRecoverableError.spec.d.ts +1 -0
- package/dist/src/errors/PublicNonRecoverableError.spec.js +13 -0
- package/dist/src/errors/PublicNonRecoverableError.spec.js.map +1 -0
- package/package.json +7 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export { sendPut, sendPutBinary, sendDelete, sendPatch, sendGet, sendPost, httpClient, } from './src/http/httpClient';
|
|
2
2
|
export type { GetRequestOptions, DeleteRequestOptions, RequestOptions, Response, HttpRequestContext, } from './src/http/httpClient';
|
|
3
|
+
export { PublicNonRecoverableError } from './src/errors/PublicNonRecoverableError';
|
|
4
|
+
export type { PublicNonRecoverableErrorParams } from './src/errors/PublicNonRecoverableError';
|
|
5
|
+
export { InternalError } from './src/errors/InternalError';
|
|
6
|
+
export type { ErrorDetails, InternalErrorParams } from './src/errors/InternalError';
|
|
7
|
+
export { ConfigScope } from './src/config/ConfigScope';
|
|
8
|
+
export { ensureClosingSlashTransformer } from './src/config/configTransformers';
|
|
9
|
+
export type { EnvValueValidator, EnvValueTransformer, AppConfig, RedisConfig, } from './src/config/configTypes';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.httpClient = exports.sendPost = exports.sendGet = exports.sendPatch = exports.sendDelete = exports.sendPutBinary = exports.sendPut = void 0;
|
|
3
|
+
exports.ensureClosingSlashTransformer = exports.ConfigScope = exports.InternalError = exports.PublicNonRecoverableError = exports.httpClient = 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; } });
|
|
@@ -9,4 +9,12 @@ Object.defineProperty(exports, "sendPatch", { enumerable: true, get: function ()
|
|
|
9
9
|
Object.defineProperty(exports, "sendGet", { enumerable: true, get: function () { return httpClient_1.sendGet; } });
|
|
10
10
|
Object.defineProperty(exports, "sendPost", { enumerable: true, get: function () { return httpClient_1.sendPost; } });
|
|
11
11
|
Object.defineProperty(exports, "httpClient", { enumerable: true, get: function () { return httpClient_1.httpClient; } });
|
|
12
|
+
var PublicNonRecoverableError_1 = require("./src/errors/PublicNonRecoverableError");
|
|
13
|
+
Object.defineProperty(exports, "PublicNonRecoverableError", { enumerable: true, get: function () { return PublicNonRecoverableError_1.PublicNonRecoverableError; } });
|
|
14
|
+
var InternalError_1 = require("./src/errors/InternalError");
|
|
15
|
+
Object.defineProperty(exports, "InternalError", { enumerable: true, get: function () { return InternalError_1.InternalError; } });
|
|
16
|
+
var ConfigScope_1 = require("./src/config/ConfigScope");
|
|
17
|
+
Object.defineProperty(exports, "ConfigScope", { enumerable: true, get: function () { return ConfigScope_1.ConfigScope; } });
|
|
18
|
+
var configTransformers_1 = require("./src/config/configTransformers");
|
|
19
|
+
Object.defineProperty(exports, "ensureClosingSlashTransformer", { enumerable: true, get: function () { return configTransformers_1.ensureClosingSlashTransformer; } });
|
|
12
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,oDAQ8B;AAP5B,qGAAA,OAAO,OAAA;AACP,2GAAA,aAAa,OAAA;AACb,wGAAA,UAAU,OAAA;AACV,uGAAA,SAAS,OAAA;AACT,qGAAA,OAAO,OAAA;AACP,sGAAA,QAAQ,OAAA;AACR,wGAAA,UAAU,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,oDAQ8B;AAP5B,qGAAA,OAAO,OAAA;AACP,2GAAA,aAAa,OAAA;AACb,wGAAA,UAAU,OAAA;AACV,uGAAA,SAAS,OAAA;AACT,qGAAA,OAAO,OAAA;AACP,sGAAA,QAAQ,OAAA;AACR,wGAAA,UAAU,OAAA;AAUZ,oFAAkF;AAAzE,sIAAA,yBAAyB,OAAA;AAGlC,4DAA0D;AAAjD,8GAAA,aAAa,OAAA;AAGtB,wDAAsD;AAA7C,0GAAA,WAAW,OAAA;AACpB,sEAA+E;AAAtE,mIAAA,6BAA6B,OAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type EnvType = {
|
|
2
|
+
[key: string]: string | undefined;
|
|
3
|
+
};
|
|
4
|
+
export declare class ConfigScope {
|
|
5
|
+
private env;
|
|
6
|
+
constructor(envOverride?: EnvType);
|
|
7
|
+
updateEnv(): void;
|
|
8
|
+
getMandatoryInteger(param: string): number;
|
|
9
|
+
getMandatory(param: string): string;
|
|
10
|
+
getMandatoryOneOf<T>(param: string, supportedValues: T[]): T;
|
|
11
|
+
getOptionalNullable<T extends string | null | undefined>(param: string, defaultValue: T): T | string;
|
|
12
|
+
getOptionalValidated(param: string, defaultValue: string, validator: (value: string) => boolean): string;
|
|
13
|
+
getOptionalTransformed(param: string, defaultValue: string, transformer: (value: string) => string): string;
|
|
14
|
+
getMandatoryTransformed(param: string, transformer: (value: string) => string): string;
|
|
15
|
+
getOptionalBoolean(param: string, defaultValue: boolean): boolean;
|
|
16
|
+
isProduction(): boolean;
|
|
17
|
+
isDevelopment(): boolean;
|
|
18
|
+
isTest(): boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function validateOneOf<T>(validatedEntity: unknown, expectedOneOfEntities: T[], errorText?: string): T;
|
|
21
|
+
export declare function validateNumber(validatedObject: unknown, errorText: string): number;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateNumber = exports.validateOneOf = exports.ConfigScope = void 0;
|
|
4
|
+
const InternalError_1 = require("../errors/InternalError");
|
|
5
|
+
class ConfigScope {
|
|
6
|
+
env;
|
|
7
|
+
constructor(envOverride) {
|
|
8
|
+
this.env = envOverride ?? { ...process.env };
|
|
9
|
+
}
|
|
10
|
+
updateEnv() {
|
|
11
|
+
// Accessing process.env values is slow, so we cache them
|
|
12
|
+
this.env = { ...process.env };
|
|
13
|
+
}
|
|
14
|
+
getMandatoryInteger(param) {
|
|
15
|
+
const rawValue = this.env[param];
|
|
16
|
+
if (!rawValue) {
|
|
17
|
+
throw new InternalError_1.InternalError({
|
|
18
|
+
message: `Missing mandatory configuration parameter: ${param}`,
|
|
19
|
+
errorCode: 'CONFIGURATION_ERROR',
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return validateNumber(Number.parseInt(rawValue), `Configuration parameter ${param}\` must be a number, but was ${rawValue}`);
|
|
23
|
+
}
|
|
24
|
+
getMandatory(param) {
|
|
25
|
+
const result = this.env[param];
|
|
26
|
+
if (!result) {
|
|
27
|
+
throw new InternalError_1.InternalError({
|
|
28
|
+
message: `Missing mandatory configuration parameter: ${param}`,
|
|
29
|
+
errorCode: 'CONFIGURATION_ERROR',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
getMandatoryOneOf(param, supportedValues) {
|
|
35
|
+
const result = this.getMandatory(param);
|
|
36
|
+
return validateOneOf(result, supportedValues, `Unsupported ${param}: ${result}. Supported values: ${supportedValues.toString()}`);
|
|
37
|
+
}
|
|
38
|
+
getOptionalNullable(param, defaultValue) {
|
|
39
|
+
return this.env[param] ?? defaultValue;
|
|
40
|
+
}
|
|
41
|
+
getOptionalValidated(param, defaultValue, validator) {
|
|
42
|
+
const value = this.env[param] ?? defaultValue;
|
|
43
|
+
if (!validator(value)) {
|
|
44
|
+
throw new InternalError_1.InternalError({
|
|
45
|
+
message: `Value ${value} is invalid for parameter ${param}`,
|
|
46
|
+
errorCode: 'CONFIGURATION_ERROR',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
getOptionalTransformed(param, defaultValue, transformer) {
|
|
52
|
+
const value = this.env[param] ?? defaultValue;
|
|
53
|
+
return transformer(value);
|
|
54
|
+
}
|
|
55
|
+
getMandatoryTransformed(param, transformer) {
|
|
56
|
+
const value = this.getMandatory(param);
|
|
57
|
+
return transformer(value);
|
|
58
|
+
}
|
|
59
|
+
getOptionalBoolean(param, defaultValue) {
|
|
60
|
+
const rawValue = this.env[param]?.toLowerCase();
|
|
61
|
+
if (rawValue === undefined || rawValue === '') {
|
|
62
|
+
return defaultValue;
|
|
63
|
+
}
|
|
64
|
+
validateOneOf(rawValue, ['true', 'false']);
|
|
65
|
+
return rawValue === 'true';
|
|
66
|
+
}
|
|
67
|
+
isProduction() {
|
|
68
|
+
return this.env.NODE_ENV === 'production';
|
|
69
|
+
}
|
|
70
|
+
isDevelopment() {
|
|
71
|
+
return this.env.NODE_ENV !== 'production';
|
|
72
|
+
}
|
|
73
|
+
isTest() {
|
|
74
|
+
return this.env.NODE_ENV === 'test';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.ConfigScope = ConfigScope;
|
|
78
|
+
function validateOneOf(validatedEntity, expectedOneOfEntities, errorText) {
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
80
|
+
if (!expectedOneOfEntities.includes(validatedEntity)) {
|
|
81
|
+
throw new InternalError_1.InternalError({
|
|
82
|
+
message: errorText ||
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
84
|
+
`Validated entity ${validatedEntity} is not one of: ${expectedOneOfEntities.toString()}`,
|
|
85
|
+
errorCode: 'CONFIGURATION_ERROR',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
89
|
+
return validatedEntity;
|
|
90
|
+
}
|
|
91
|
+
exports.validateOneOf = validateOneOf;
|
|
92
|
+
function validateNumber(validatedObject, errorText) {
|
|
93
|
+
if (!Number.isFinite(validatedObject)) {
|
|
94
|
+
throw new InternalError_1.InternalError({
|
|
95
|
+
message: errorText,
|
|
96
|
+
errorCode: 'CONFIGURATION_ERROR',
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return validatedObject;
|
|
100
|
+
}
|
|
101
|
+
exports.validateNumber = validateNumber;
|
|
102
|
+
//# sourceMappingURL=ConfigScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigScope.js","sourceRoot":"","sources":["../../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,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAA;IAC3C,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAA;IACrC,CAAC;CACF;AAzGD,kCAyGC;AAED,SAAgB,aAAa,CAC3B,eAAwB,EACxB,qBAA0B,EAC1B,SAAkB;IAElB,iEAAiE;IACjE,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,eAAoB,CAAC,EAAE;QACzD,MAAM,IAAI,6BAAa,CAAC;YACtB,OAAO,EACL,SAAS;gBACT,4EAA4E;gBAC5E,oBAAoB,eAAe,mBAAmB,qBAAqB,CAAC,QAAQ,EAAE,EAAE;YAC1F,SAAS,EAAE,qBAAqB;SACjC,CAAC,CAAA;KACH;IACD,+DAA+D;IAC/D,OAAO,eAAoB,CAAA;AAC7B,CAAC;AAjBD,sCAiBC;AAED,SAAgB,cAAc,CAAC,eAAwB,EAAE,SAAiB;IACxE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;QACrC,MAAM,IAAI,6BAAa,CAAC;YACtB,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,qBAAqB;SACjC,CAAC,CAAA;KACH;IACD,OAAO,eAAyB,CAAA;AAClC,CAAC;AARD,wCAQC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const process = tslib_1.__importStar(require("process"));
|
|
5
|
+
const ConfigScope_1 = require("./ConfigScope");
|
|
6
|
+
const configTransformers_1 = require("./configTransformers");
|
|
7
|
+
describe('ConfigScope', () => {
|
|
8
|
+
describe('getMandatoryInteger', () => {
|
|
9
|
+
it('accepts an integer', () => {
|
|
10
|
+
process.env.value = '123';
|
|
11
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
12
|
+
const resolvedValue = configScope.getMandatoryInteger('value');
|
|
13
|
+
expect(resolvedValue).toBe(123);
|
|
14
|
+
});
|
|
15
|
+
it('throws an error on non-number', () => {
|
|
16
|
+
process.env.value = 'abc';
|
|
17
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
18
|
+
expect(() => configScope.getMandatoryInteger('value')).toThrow(/must be a number/);
|
|
19
|
+
});
|
|
20
|
+
it('throws an error on missing value', () => {
|
|
21
|
+
delete process.env.value;
|
|
22
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
23
|
+
expect(() => configScope.getMandatoryInteger('value')).toThrow(/Missing mandatory configuration parameter/);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe('getMandatory', () => {
|
|
27
|
+
it('accepts an integer', () => {
|
|
28
|
+
process.env.value = '123';
|
|
29
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
30
|
+
const resolvedValue = configScope.getMandatory('value');
|
|
31
|
+
expect(resolvedValue).toBe('123');
|
|
32
|
+
});
|
|
33
|
+
it('throws an error on missing value', () => {
|
|
34
|
+
delete process.env.value;
|
|
35
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
36
|
+
expect(() => configScope.getMandatory('value')).toThrow(/Missing mandatory configuration parameter/);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
describe('getMandatoryOneOf', () => {
|
|
40
|
+
it('accepts item from given list', () => {
|
|
41
|
+
process.env.value = 'g';
|
|
42
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
43
|
+
const resolvedValue = configScope.getMandatoryOneOf('value', ['a', 'g', 'b']);
|
|
44
|
+
expect(resolvedValue).toBe('g');
|
|
45
|
+
});
|
|
46
|
+
it('throws an error on item not from list', () => {
|
|
47
|
+
process.env.value = 'c';
|
|
48
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
49
|
+
expect(() => configScope.getMandatoryOneOf('value', ['a', 'g', 'b'])).toThrow(/Unsupported value/);
|
|
50
|
+
});
|
|
51
|
+
it('throws an error on missing value', () => {
|
|
52
|
+
delete process.env.value;
|
|
53
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
54
|
+
expect(() => configScope.getMandatoryOneOf('value', ['a'])).toThrow(/Missing mandatory configuration parameter/);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
describe('getOptionalNullable', () => {
|
|
58
|
+
it('accepts value', () => {
|
|
59
|
+
process.env.value = 'val';
|
|
60
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
61
|
+
const resolvedValue = configScope.getOptionalNullable('value', 'def');
|
|
62
|
+
expect(resolvedValue).toBe('val');
|
|
63
|
+
});
|
|
64
|
+
it('uses default value if not set', () => {
|
|
65
|
+
delete process.env.value;
|
|
66
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
67
|
+
const resolvedValue = configScope.getOptionalNullable('value', 'def');
|
|
68
|
+
expect(resolvedValue).toBe('def');
|
|
69
|
+
});
|
|
70
|
+
it('keeps null if preferred', () => {
|
|
71
|
+
delete process.env.value;
|
|
72
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
73
|
+
const resolvedValue = configScope.getOptionalNullable('value', null);
|
|
74
|
+
expect(resolvedValue).toBeNull();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
describe('getOptionalValidated', () => {
|
|
78
|
+
const validator = (val) => {
|
|
79
|
+
return (val && val.length < 5) || false;
|
|
80
|
+
};
|
|
81
|
+
it('accepts valid value', () => {
|
|
82
|
+
process.env.value = 'val';
|
|
83
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
84
|
+
const resolvedValue = configScope.getOptionalValidated('value', 'def', validator);
|
|
85
|
+
expect(resolvedValue).toBe('val');
|
|
86
|
+
});
|
|
87
|
+
it('uses default value if not set', () => {
|
|
88
|
+
delete process.env.value;
|
|
89
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
90
|
+
const resolvedValue = configScope.getOptionalValidated('value', 'def', validator);
|
|
91
|
+
expect(resolvedValue).toBe('def');
|
|
92
|
+
});
|
|
93
|
+
it('throws an error if failing validation', () => {
|
|
94
|
+
process.env.value = '12345678900';
|
|
95
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
96
|
+
expect(() => configScope.getOptionalValidated('value', 'a', validator)).toThrow(/is invalid for parameter/);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe('getOptionalTransformed', () => {
|
|
100
|
+
it('transforms value', () => {
|
|
101
|
+
process.env.value = 'val';
|
|
102
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
103
|
+
const resolvedValue = configScope.getOptionalTransformed('value', 'def/', configTransformers_1.ensureClosingSlashTransformer);
|
|
104
|
+
expect(resolvedValue).toBe('val/');
|
|
105
|
+
});
|
|
106
|
+
it('uses default value if not set', () => {
|
|
107
|
+
delete process.env.value;
|
|
108
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
109
|
+
const resolvedValue = configScope.getOptionalTransformed('value', 'def', configTransformers_1.ensureClosingSlashTransformer);
|
|
110
|
+
expect(resolvedValue).toBe('def/');
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
describe('getMandatoryTransformed', () => {
|
|
114
|
+
it('transforms value', () => {
|
|
115
|
+
process.env.value = 'val';
|
|
116
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
117
|
+
const resolvedValue = configScope.getMandatoryTransformed('value', configTransformers_1.ensureClosingSlashTransformer);
|
|
118
|
+
expect(resolvedValue).toBe('val/');
|
|
119
|
+
});
|
|
120
|
+
it('throws an error if not set', () => {
|
|
121
|
+
delete process.env.value;
|
|
122
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
123
|
+
expect(() => configScope.getMandatoryTransformed('value', configTransformers_1.ensureClosingSlashTransformer)).toThrow(/Missing mandatory configuration parameter/);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe('getOptionalBoolean', () => {
|
|
127
|
+
it('accepts true', () => {
|
|
128
|
+
process.env.value = 'true';
|
|
129
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
130
|
+
const resolvedValue = configScope.getOptionalBoolean('value', false);
|
|
131
|
+
expect(resolvedValue).toBe(true);
|
|
132
|
+
});
|
|
133
|
+
it('accepts false', () => {
|
|
134
|
+
process.env.value = 'false';
|
|
135
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
136
|
+
const resolvedValue = configScope.getOptionalBoolean('value', true);
|
|
137
|
+
expect(resolvedValue).toBe(false);
|
|
138
|
+
});
|
|
139
|
+
it('uses default value if not set', () => {
|
|
140
|
+
delete process.env.value;
|
|
141
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
142
|
+
const resolvedValue = configScope.getOptionalBoolean('value', true);
|
|
143
|
+
expect(resolvedValue).toBe(true);
|
|
144
|
+
});
|
|
145
|
+
it('uses default value if empty string', () => {
|
|
146
|
+
process.env.value = '';
|
|
147
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
148
|
+
const resolvedValue = configScope.getOptionalBoolean('value', true);
|
|
149
|
+
expect(resolvedValue).toBe(true);
|
|
150
|
+
});
|
|
151
|
+
it('throws an error if not a boolean', () => {
|
|
152
|
+
process.env.value = '1';
|
|
153
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
154
|
+
expect(() => configScope.getOptionalBoolean('value', false)).toThrow(/Validated entity 1 is not one of: true,false/);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
describe('updateEnv', () => {
|
|
158
|
+
it('updates cached env', () => {
|
|
159
|
+
process.env.value = '123';
|
|
160
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
161
|
+
const resolvedValue = configScope.getMandatory('value');
|
|
162
|
+
expect(resolvedValue).toBe('123');
|
|
163
|
+
process.env.value = '456';
|
|
164
|
+
const resolvedValue2 = configScope.getMandatory('value');
|
|
165
|
+
expect(resolvedValue2).toBe('123');
|
|
166
|
+
configScope.updateEnv();
|
|
167
|
+
const resolvedValue3 = configScope.getMandatory('value');
|
|
168
|
+
expect(resolvedValue3).toBe('456');
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
describe('isProduction', () => {
|
|
172
|
+
it('returns true if set to production', () => {
|
|
173
|
+
process.env.NODE_ENV = 'production';
|
|
174
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
175
|
+
expect(configScope.isProduction()).toBe(true);
|
|
176
|
+
});
|
|
177
|
+
it('returns true if set to development', () => {
|
|
178
|
+
process.env.NODE_ENV = 'development';
|
|
179
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
180
|
+
expect(configScope.isProduction()).toBe(false);
|
|
181
|
+
});
|
|
182
|
+
it('returns true if set to test', () => {
|
|
183
|
+
process.env.NODE_ENV = 'test';
|
|
184
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
185
|
+
expect(configScope.isProduction()).toBe(false);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
describe('isDevelopment', () => {
|
|
189
|
+
it('returns true if set to production', () => {
|
|
190
|
+
process.env.NODE_ENV = 'production';
|
|
191
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
192
|
+
expect(configScope.isDevelopment()).toBe(false);
|
|
193
|
+
});
|
|
194
|
+
it('returns true if set to development', () => {
|
|
195
|
+
process.env.NODE_ENV = 'development';
|
|
196
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
197
|
+
expect(configScope.isDevelopment()).toBe(true);
|
|
198
|
+
});
|
|
199
|
+
it('returns true if set to test', () => {
|
|
200
|
+
process.env.NODE_ENV = 'test';
|
|
201
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
202
|
+
expect(configScope.isDevelopment()).toBe(true);
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
describe('isTest', () => {
|
|
206
|
+
it('returns true if set to production', () => {
|
|
207
|
+
process.env.NODE_ENV = 'production';
|
|
208
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
209
|
+
expect(configScope.isTest()).toBe(false);
|
|
210
|
+
});
|
|
211
|
+
it('returns true if set to development', () => {
|
|
212
|
+
process.env.NODE_ENV = 'development';
|
|
213
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
214
|
+
expect(configScope.isTest()).toBe(false);
|
|
215
|
+
});
|
|
216
|
+
it('returns true if set to test', () => {
|
|
217
|
+
process.env.NODE_ENV = 'test';
|
|
218
|
+
const configScope = new ConfigScope_1.ConfigScope();
|
|
219
|
+
expect(configScope.isTest()).toBe(true);
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
//# sourceMappingURL=ConfigScope.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigScope.spec.js","sourceRoot":"","sources":["../../../src/config/ConfigScope.spec.ts"],"names":[],"mappings":";;;AAAA,yDAAkC;AAElC,+CAA2C;AAC3C,6DAAoE;AAGpE,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACnC,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;YAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAA;YACzB,MAAM,WAAW,GAAG,IAAI,yBAAW,EAAE,CAAA;YAErC,MAAM,aAAa,GAAG,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAA;YAE9D,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACjC,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;YACvC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAA;YACzB,MAAM,WAAW,GAAG,IAAI,yBAAW,EAAE,CAAA;YAErC,MAAM,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;QACpF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AC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAA;YACnC,MAAM,WAAW,GAAG,IAAI,yBAAW,EAAE,CAAA;YAErC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC1C,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,aAAa,CAAA;YACpC,MAAM,WAAW,GAAG,IAAI,yBAAW,EAAE,CAAA;YAErC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC1C,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAA;YAC7B,MAAM,WAAW,GAAG,IAAI,yBAAW,EAAE,CAAA;YAErC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACzC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureClosingSlashTransformer = void 0;
|
|
4
|
+
const ensureClosingSlashTransformer = (value) => {
|
|
5
|
+
if (!value) {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
const lastChar = value.at(-1);
|
|
9
|
+
if (lastChar !== '/') {
|
|
10
|
+
return `${value}/`;
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
exports.ensureClosingSlashTransformer = ensureClosingSlashTransformer;
|
|
15
|
+
//# sourceMappingURL=configTransformers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configTransformers.js","sourceRoot":"","sources":["../../../src/config/configTransformers.ts"],"names":[],"mappings":";;;AAEO,MAAM,6BAA6B,GAGtC,CAAC,KAAK,EAAE,EAAE;IACZ,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,EAAE,CAAA;KACV;IAED,MAAM,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7B,IAAI,QAAQ,KAAK,GAAG,EAAE;QACpB,OAAO,GAAG,KAAK,GAAG,CAAA;KACnB;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAbY,QAAA,6BAA6B,iCAazC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const configTransformers_1 = require("./configTransformers");
|
|
4
|
+
describe('configTransformers', () => {
|
|
5
|
+
describe('ensureClosingSlashTransformer', () => {
|
|
6
|
+
it('adds missing slash', () => {
|
|
7
|
+
const resolveValue = (0, configTransformers_1.ensureClosingSlashTransformer)('main');
|
|
8
|
+
expect(resolveValue).toBe('main/');
|
|
9
|
+
});
|
|
10
|
+
it('returns empty string for null', () => {
|
|
11
|
+
const resolveValue = (0, configTransformers_1.ensureClosingSlashTransformer)(null);
|
|
12
|
+
expect(resolveValue).toBe('');
|
|
13
|
+
});
|
|
14
|
+
it('returns empty string for undefined', () => {
|
|
15
|
+
const resolveValue = (0, configTransformers_1.ensureClosingSlashTransformer)(undefined);
|
|
16
|
+
expect(resolveValue).toBe('');
|
|
17
|
+
});
|
|
18
|
+
it('returns empty string for empty string', () => {
|
|
19
|
+
const resolveValue = (0, configTransformers_1.ensureClosingSlashTransformer)('');
|
|
20
|
+
expect(resolveValue).toBe('');
|
|
21
|
+
});
|
|
22
|
+
it('keeps existing slash', () => {
|
|
23
|
+
const resolveValue = (0, configTransformers_1.ensureClosingSlashTransformer)('pre-1/');
|
|
24
|
+
expect(resolveValue).toBe('pre-1/');
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=configTransformers.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configTransformers.spec.js","sourceRoot":"","sources":["../../../src/config/configTransformers.spec.ts"],"names":[],"mappings":";;AAAA,6DAAoE;AAEpE,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;QAC7C,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;YAC5B,MAAM,YAAY,GAAG,IAAA,kDAA6B,EAAC,MAAM,CAAC,CAAA;YAE1D,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACpC,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;YACvC,MAAM,YAAY,GAAG,IAAA,kDAA6B,EAAC,IAAI,CAAC,CAAA;YAExD,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,YAAY,GAAG,IAAA,kDAA6B,EAAC,SAAS,CAAC,CAAA;YAE7D,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC/C,MAAM,YAAY,GAAG,IAAA,kDAA6B,EAAC,EAAE,CAAC,CAAA;YAEtD,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;YAC9B,MAAM,YAAY,GAAG,IAAA,kDAA6B,EAAC,QAAQ,CAAC,CAAA;YAE5D,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type EnvValueValidator = (value: string | undefined | null) => boolean;
|
|
2
|
+
export type EnvValueTransformer<InputType, OutputType> = (value: InputType) => OutputType;
|
|
3
|
+
export type RedisConfig = {
|
|
4
|
+
host: string;
|
|
5
|
+
/**
|
|
6
|
+
* An integer from 0 to 15, inclusive
|
|
7
|
+
*/
|
|
8
|
+
db: number;
|
|
9
|
+
port: number;
|
|
10
|
+
username?: string;
|
|
11
|
+
password?: string;
|
|
12
|
+
useTls: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type AppConfig = {
|
|
15
|
+
port: number;
|
|
16
|
+
bindAddress: string;
|
|
17
|
+
logLevel: string;
|
|
18
|
+
nodeEnv: 'production' | 'development' | 'test';
|
|
19
|
+
appEnv: 'production' | 'development' | 'staging';
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configTypes.js","sourceRoot":"","sources":["../../../src/config/configTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ErrorDetails = Record<string, unknown>;
|
|
2
|
+
export type InternalErrorParams = {
|
|
3
|
+
message: string;
|
|
4
|
+
errorCode: string;
|
|
5
|
+
details?: ErrorDetails;
|
|
6
|
+
};
|
|
7
|
+
export declare class InternalError extends Error {
|
|
8
|
+
readonly details?: ErrorDetails;
|
|
9
|
+
readonly errorCode: string;
|
|
10
|
+
constructor(params: InternalErrorParams);
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InternalError = void 0;
|
|
4
|
+
class InternalError extends Error {
|
|
5
|
+
details;
|
|
6
|
+
errorCode;
|
|
7
|
+
constructor(params) {
|
|
8
|
+
super(params.message);
|
|
9
|
+
this.name = 'InternalError';
|
|
10
|
+
this.details = params.details;
|
|
11
|
+
this.errorCode = params.errorCode;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.InternalError = InternalError;
|
|
15
|
+
//# sourceMappingURL=InternalError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InternalError.js","sourceRoot":"","sources":["../../../src/errors/InternalError.ts"],"names":[],"mappings":";;;AAQA,MAAa,aAAc,SAAQ,KAAK;IACtB,OAAO,CAAe;IACtB,SAAS,CAAQ;IAEjC,YAAY,MAA2B;QACrC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QACrB,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;AAVD,sCAUC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ErrorDetails } from './InternalError';
|
|
2
|
+
export type PublicNonRecoverableErrorParams = {
|
|
3
|
+
message: string;
|
|
4
|
+
errorCode: string;
|
|
5
|
+
details?: ErrorDetails;
|
|
6
|
+
httpStatusCode?: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* This error is returned to the consumer of API
|
|
10
|
+
*/
|
|
11
|
+
export declare class PublicNonRecoverableError extends Error {
|
|
12
|
+
readonly details?: ErrorDetails;
|
|
13
|
+
readonly errorCode: string;
|
|
14
|
+
readonly httpStatusCode: number;
|
|
15
|
+
constructor(params: PublicNonRecoverableErrorParams);
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublicNonRecoverableError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This error is returned to the consumer of API
|
|
6
|
+
*/
|
|
7
|
+
class PublicNonRecoverableError extends Error {
|
|
8
|
+
details;
|
|
9
|
+
errorCode;
|
|
10
|
+
httpStatusCode;
|
|
11
|
+
constructor(params) {
|
|
12
|
+
super(params.message);
|
|
13
|
+
this.name = 'PublicNonRecoverableError';
|
|
14
|
+
this.details = params.details;
|
|
15
|
+
this.errorCode = params.errorCode;
|
|
16
|
+
this.httpStatusCode = params.httpStatusCode ?? 500;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.PublicNonRecoverableError = PublicNonRecoverableError;
|
|
20
|
+
//# sourceMappingURL=PublicNonRecoverableError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublicNonRecoverableError.js","sourceRoot":"","sources":["../../../src/errors/PublicNonRecoverableError.ts"],"names":[],"mappings":";;;AASA;;GAEG;AACH,MAAa,yBAA0B,SAAQ,KAAK;IAClC,OAAO,CAAe;IACtB,SAAS,CAAQ;IACjB,cAAc,CAAQ;IAEtC,YAAY,MAAuC;QACjD,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QACrB,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;AAZD,8DAYC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const PublicNonRecoverableError_1 = require("./PublicNonRecoverableError");
|
|
4
|
+
describe('PublicNonRecoverableError', () => {
|
|
5
|
+
it('sets http status code to 500 by default', () => {
|
|
6
|
+
const error = new PublicNonRecoverableError_1.PublicNonRecoverableError({
|
|
7
|
+
message: 'error',
|
|
8
|
+
errorCode: 'PUBLIC_ERROR',
|
|
9
|
+
});
|
|
10
|
+
expect(error.httpStatusCode).toBe(500);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=PublicNonRecoverableError.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublicNonRecoverableError.spec.js","sourceRoot":"","sources":["../../../src/errors/PublicNonRecoverableError.spec.ts"],"names":[],"mappings":";;AAAA,2EAAuE;AAEvE,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,KAAK,GAAG,IAAI,qDAAyB,CAAC;YAC1C,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,cAAc;SAC1B,CAAC,CAAA;QAEF,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACxC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/node-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Lokalise",
|
|
6
6
|
"url": "https://lokalise.com/"
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"LICENSE",
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
|
+
"main": "dist/index.js",
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
|
+
"type": "commonjs",
|
|
19
22
|
"publishConfig": {
|
|
20
23
|
"access": "public"
|
|
21
24
|
},
|
|
@@ -36,11 +39,11 @@
|
|
|
36
39
|
"devDependencies": {
|
|
37
40
|
"@types/jest": "^29.2.5",
|
|
38
41
|
"@types/node": "^18.11.18",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
40
|
-
"@typescript-eslint/parser": "^5.
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
43
|
+
"@typescript-eslint/parser": "^5.48.0",
|
|
41
44
|
"auto-changelog": "^2.4.0",
|
|
42
45
|
"eslint": "^8.31.0",
|
|
43
|
-
"eslint-config-prettier": "^8.
|
|
46
|
+
"eslint-config-prettier": "^8.6.0",
|
|
44
47
|
"eslint-plugin-import": "^2.26.0",
|
|
45
48
|
"eslint-plugin-jest": "^27.2.0",
|
|
46
49
|
"eslint-plugin-prettier": "^4.2.1",
|