@lokalise/node-core 11.2.0 → 12.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.
package/README.md CHANGED
@@ -2,16 +2,12 @@
2
2
 
3
3
  Core libraries for Node.js backend services.
4
4
 
5
- - [Overview](#overview)
6
- - [HTTP Client](#http-client)
7
5
  - [Default Logging Configuration](#default-logging-configuration)
8
6
  - [ConfigScope](#configscope)
9
7
  - [Error Handling](#error-handling)
10
8
 
11
9
  See [docs](/docs) for further instructions on how to use.
12
10
 
13
- ## Overview
14
-
15
11
  ## Default Logging Configuration
16
12
 
17
13
  The library provides methods to resolve the default logging configuration. Public methods available are:
@@ -136,11 +132,13 @@ The library exposes classes for the following errors:
136
132
  - `InternalError`, which issues a `500` status code and is not exposed in the global error handler. It expects the following parameters:
137
133
  - `message`;
138
134
  - `errorCode`;
139
- - `details` – (optional).
135
+ - `details` – (optional);
136
+ - `cause` – (optional).
140
137
  - `PublicNonRecoverableError`, which issues the HTTP status code provided and signals that the user did something wrong, hence the error is returned to the consumer of the API. It expects the following parameters:
141
138
  - `message`;
142
139
  - `errorCode`;
143
140
  - `details` – (optional);
141
+ - `cause` – (optional);
144
142
  - `httpStatusCode` – (optional). Defaults to `500`;
145
143
 
146
144
  ### Either
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ export type { ErrorDetails } from './src/errors/types';
1
2
  export { PublicNonRecoverableError, type PublicNonRecoverableErrorParams, } from './src/errors/PublicNonRecoverableError';
2
- export { InternalError, type ErrorDetails, type InternalErrorParams, } from './src/errors/InternalError';
3
+ export { InternalError, type InternalErrorParams, } from './src/errors/InternalError';
3
4
  export { isEntityGoneError } from './src/errors/errorTypeGuards';
4
5
  export { ConfigScope } from './src/config/ConfigScope';
5
6
  export { ensureClosingSlashTransformer } from './src/config/configTransformers';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names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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;AAIrB,2DAIkC;AAHhC,4HAAA,2BAA2B,OAAA;AAC3B,0HAAA,yBAAyB,OAAA;AACzB,kIAAA,iCAAiC,OAAA;AAEnC,uDAA4D;AAAnD,iHAAA,kBAAkB,OAAA"}
@@ -1,9 +1,9 @@
1
- export type ErrorDetails = Record<string, unknown>;
1
+ import type { ErrorDetails } from './types';
2
2
  export type InternalErrorParams<T = ErrorDetails> = {
3
3
  message: string;
4
4
  errorCode: string;
5
5
  details?: T;
6
- cause?: Error;
6
+ cause?: unknown;
7
7
  };
8
8
  export declare class InternalError<T = ErrorDetails> extends Error {
9
9
  readonly details?: T;
@@ -1,17 +1,17 @@
1
- import type { ErrorDetails } from './InternalError';
2
- export type PublicNonRecoverableErrorParams = {
1
+ import type { ErrorDetails } from './types';
2
+ export type PublicNonRecoverableErrorParams<T = ErrorDetails> = {
3
3
  message: string;
4
4
  errorCode: string;
5
- details?: ErrorDetails;
5
+ details?: T;
6
6
  httpStatusCode?: number;
7
- cause?: Error;
7
+ cause?: unknown;
8
8
  };
9
9
  /**
10
10
  * This error is returned to the consumer of API
11
11
  */
12
- export declare class PublicNonRecoverableError extends Error {
13
- readonly details?: ErrorDetails;
12
+ export declare class PublicNonRecoverableError<T = ErrorDetails> extends Error {
13
+ readonly details?: T;
14
14
  readonly errorCode: string;
15
15
  readonly httpStatusCode: number;
16
- constructor(params: PublicNonRecoverableErrorParams);
16
+ constructor(params: PublicNonRecoverableErrorParams<T>);
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PublicNonRecoverableError.js","sourceRoot":"","sources":["../../../src/errors/PublicNonRecoverableError.ts"],"names":[],"mappings":";;;AAUA;;GAEG;AACH,MAAa,yBAA0B,SAAQ,KAAK;IAClC,OAAO,CAAe;IACtB,SAAS,CAAQ;IACjB,cAAc,CAAQ;IAEtC,YAAY,MAAuC;QACjD,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;AAdD,8DAcC"}
1
+ {"version":3,"file":"PublicNonRecoverableError.js","sourceRoot":"","sources":["../../../src/errors/PublicNonRecoverableError.ts"],"names":[],"mappings":";;;AAUA;;GAEG;AACH,MAAa,yBAA4C,SAAQ,KAAK;IACpD,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;AAdD,8DAcC"}
@@ -0,0 +1 @@
1
+ export type ErrorDetails = Record<string, unknown>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/errors/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,55 +1,55 @@
1
1
  {
2
- "name": "@lokalise/node-core",
3
- "version": "11.2.0",
4
- "author": {
5
- "name": "Lokalise",
6
- "url": "https://lokalise.com/"
7
- },
8
- "homepage": "https://github.com/lokalise/node-core",
9
- "repository": {
10
- "type": "git",
11
- "url": "git://github.com/lokalise/node-core.git"
12
- },
13
- "license": "Apache-2.0",
14
- "files": [
15
- "dist/**",
16
- "LICENSE",
17
- "README.md"
18
- ],
19
- "main": "dist/index.js",
20
- "types": "dist/index.d.ts",
21
- "type": "commonjs",
22
- "publishConfig": {
23
- "access": "public"
24
- },
25
- "scripts": {
26
- "build": "tsc",
27
- "test": "vitest",
28
- "test:coverage": "vitest --coverage",
29
- "test:ci": "npm run lint && npm run test:coverage",
30
- "test:update-snapshots": "vitest -u",
31
- "lint": "biome check . && tsc --project tsconfig.lint.json --noEmit",
32
- "lint:fix": "biome check --write",
33
- "version": "auto-changelog -p && git add CHANGELOG.md",
34
- "prepublishOnly": "npm run build"
35
- },
36
- "dependencies": {
37
- "dot-prop": "6.0.1",
38
- "pino": "^9.3.1",
39
- "pino-pretty": "^11.2.1",
40
- "tslib": "^2.6.3",
41
- "zod": "^3.23.8"
42
- },
43
- "devDependencies": {
44
- "@biomejs/biome": "^1.8.3",
45
- "@lokalise/biome-config": "^1.3.0",
46
- "@types/node": "^20.14.11",
47
- "@types/tmp": "^0.2.6",
48
- "@vitest/coverage-v8": "2.0.3",
49
- "auto-changelog": "^2.4.0",
50
- "pino-test": "^1.0.1",
51
- "tmp": "^0.2.3",
52
- "typescript": "^5.5.3",
53
- "vitest": "2.0.3"
54
- }
2
+ "name": "@lokalise/node-core",
3
+ "version": "12.0.0",
4
+ "author": {
5
+ "name": "Lokalise",
6
+ "url": "https://lokalise.com/"
7
+ },
8
+ "homepage": "https://github.com/lokalise/node-core",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git://github.com/lokalise/node-core.git"
12
+ },
13
+ "license": "Apache-2.0",
14
+ "files": [
15
+ "dist/**",
16
+ "LICENSE",
17
+ "README.md"
18
+ ],
19
+ "main": "dist/index.js",
20
+ "types": "dist/index.d.ts",
21
+ "type": "commonjs",
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "scripts": {
26
+ "build": "tsc",
27
+ "test": "vitest",
28
+ "test:coverage": "vitest --coverage",
29
+ "test:ci": "npm run lint && npm run test:coverage",
30
+ "test:update-snapshots": "vitest -u",
31
+ "lint": "biome check . && tsc --project tsconfig.lint.json --noEmit",
32
+ "lint:fix": "biome check --write",
33
+ "version": "auto-changelog -p && git add CHANGELOG.md",
34
+ "prepublishOnly": "npm run build"
35
+ },
36
+ "dependencies": {
37
+ "dot-prop": "6.0.1",
38
+ "pino": "^9.3.1",
39
+ "pino-pretty": "^11.2.1",
40
+ "tslib": "^2.6.3",
41
+ "zod": "^3.23.8"
42
+ },
43
+ "devDependencies": {
44
+ "@biomejs/biome": "^1.8.3",
45
+ "@lokalise/biome-config": "^1.3.0",
46
+ "@types/node": "^20.14.11",
47
+ "@types/tmp": "^0.2.6",
48
+ "@vitest/coverage-v8": "2.0.3",
49
+ "auto-changelog": "^2.4.0",
50
+ "pino-test": "^1.0.1",
51
+ "tmp": "^0.2.3",
52
+ "typescript": "^5.5.3",
53
+ "vitest": "2.0.3"
54
+ }
55
55
  }