@jitsu/functions-lib 1.3.2 → 1.8.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.
@@ -1,8 +1,12 @@
1
- @jitsu/functions-lib:build: cache hit, replaying output b1d2b889eca2f5a1
2
- @jitsu/functions-lib:build: 
3
- @jitsu/functions-lib:build: > @jitsu/functions-lib@0.0.0 build /Users/ildarnurislamov/Projects/newjitsu/libs/functions
4
- @jitsu/functions-lib:build: > rollup -c
5
- @jitsu/functions-lib:build: 
6
- @jitsu/functions-lib:build: 
7
- @jitsu/functions-lib:build: ./src/index.ts → dist/index.es.js, dist/index.cjs.js...
8
- @jitsu/functions-lib:build: created dist/index.es.js, dist/index.cjs.js in 696ms
1
+ @jitsu/functions-lib:build: cache hit, replaying output 330580804150bbdb
2
+ @jitsu/functions-lib:build: 
3
+ @jitsu/functions-lib:build: > @jitsu/functions-lib@0.0.0 build /Users/vklmn/dev2/newjitsu/libs/functions
4
+ @jitsu/functions-lib:build: > pnpm compile && rollup -c
5
+ @jitsu/functions-lib:build: 
6
+ @jitsu/functions-lib:build: 
7
+ @jitsu/functions-lib:build: > @jitsu/functions-lib@0.0.0 compile /Users/vklmn/dev2/newjitsu/libs/functions
8
+ @jitsu/functions-lib:build: > tsc -p .
9
+ @jitsu/functions-lib:build: 
10
+ @jitsu/functions-lib:build: 
11
+ @jitsu/functions-lib:build: ./src/index.ts → dist/index.es.js, dist/index.cjs.js...
12
+ @jitsu/functions-lib:build: created dist/index.es.js, dist/index.cjs.js in 501ms
package/dist/index.cjs.js CHANGED
@@ -3,12 +3,53 @@
3
3
  const DropRetryErrorName = "Drop & RetryError";
4
4
  const RetryErrorName = "RetryError";
5
5
  class RetryError extends Error {
6
+ status;
7
+ response;
8
+ message;
6
9
  constructor(message, options) {
7
- super(message);
10
+ if (typeof message === "object") {
11
+ super(message.message);
12
+ this.message = message.message;
13
+ this.status = message.status;
14
+ this.response = message.response;
15
+ }
16
+ else {
17
+ super(message);
18
+ this.message = message;
19
+ }
8
20
  this.name = options?.drop ? `${DropRetryErrorName}` : `${RetryErrorName}`;
9
21
  }
22
+ toJSON() {
23
+ return {
24
+ name: this.name,
25
+ message: this.message,
26
+ status: this.status,
27
+ response: this.response,
28
+ };
29
+ }
30
+ }
31
+ class HTTPError extends Error {
32
+ status;
33
+ response;
34
+ message;
35
+ constructor(message, status, response) {
36
+ super(message);
37
+ this.message = message;
38
+ this.name = "HTTPError";
39
+ this.status = status;
40
+ this.response = response.length > 1000 ? response.slice(0, 1000) + "..." : response;
41
+ }
42
+ toJSON() {
43
+ return {
44
+ name: this.name,
45
+ message: this.message,
46
+ status: this.status,
47
+ response: this.response,
48
+ };
49
+ }
10
50
  }
11
51
 
12
52
  exports.DropRetryErrorName = DropRetryErrorName;
53
+ exports.HTTPError = HTTPError;
13
54
  exports.RetryError = RetryError;
14
55
  exports.RetryErrorName = RetryErrorName;
package/dist/index.es.js CHANGED
@@ -1,10 +1,50 @@
1
1
  const DropRetryErrorName = "Drop & RetryError";
2
2
  const RetryErrorName = "RetryError";
3
3
  class RetryError extends Error {
4
+ status;
5
+ response;
6
+ message;
4
7
  constructor(message, options) {
5
- super(message);
8
+ if (typeof message === "object") {
9
+ super(message.message);
10
+ this.message = message.message;
11
+ this.status = message.status;
12
+ this.response = message.response;
13
+ }
14
+ else {
15
+ super(message);
16
+ this.message = message;
17
+ }
6
18
  this.name = options?.drop ? `${DropRetryErrorName}` : `${RetryErrorName}`;
7
19
  }
20
+ toJSON() {
21
+ return {
22
+ name: this.name,
23
+ message: this.message,
24
+ status: this.status,
25
+ response: this.response,
26
+ };
27
+ }
28
+ }
29
+ class HTTPError extends Error {
30
+ status;
31
+ response;
32
+ message;
33
+ constructor(message, status, response) {
34
+ super(message);
35
+ this.message = message;
36
+ this.name = "HTTPError";
37
+ this.status = status;
38
+ this.response = response.length > 1000 ? response.slice(0, 1000) + "..." : response;
39
+ }
40
+ toJSON() {
41
+ return {
42
+ name: this.name,
43
+ message: this.message,
44
+ status: this.status,
45
+ response: this.response,
46
+ };
47
+ }
8
48
  }
9
49
 
10
- export { DropRetryErrorName, RetryError, RetryErrorName };
50
+ export { DropRetryErrorName, HTTPError, RetryError, RetryErrorName };
@@ -1,10 +1,28 @@
1
1
  export declare const DropRetryErrorName = "Drop & RetryError";
2
2
  export declare const RetryErrorName = "RetryError";
3
3
  export declare class RetryError extends Error {
4
- constructor(
5
- message?: any,
6
- options?: {
7
- drop: boolean;
8
- }
9
- );
4
+ status: number;
5
+ response: string;
6
+ message: string;
7
+ constructor(message?: any, options?: {
8
+ drop: boolean;
9
+ });
10
+ toJSON(): {
11
+ name: string;
12
+ message: string;
13
+ status: number;
14
+ response: string;
15
+ };
16
+ }
17
+ export declare class HTTPError extends Error {
18
+ status: number;
19
+ response: string;
20
+ message: string;
21
+ constructor(message: string, status: number, response: string);
22
+ toJSON(): {
23
+ name: string;
24
+ message: string;
25
+ status: number;
26
+ response: string;
27
+ };
10
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jitsu/functions-lib",
3
- "version": "1.3.2",
3
+ "version": "1.8.0",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,6 +25,6 @@
25
25
  },
26
26
  "scripts": {
27
27
  "compile": "tsc -p .",
28
- "build": "rollup -c"
28
+ "build": "pnpm compile && rollup -c"
29
29
  }
30
30
  }
@@ -2,8 +2,49 @@ export const DropRetryErrorName = "Drop & RetryError";
2
2
  export const RetryErrorName = "RetryError";
3
3
 
4
4
  export class RetryError extends Error {
5
+ status: number;
6
+ response: string;
7
+ message: string;
5
8
  constructor(message?: any, options?: { drop: boolean }) {
6
- super(message);
9
+ if (typeof message === "object") {
10
+ super(message.message);
11
+ this.message = message.message;
12
+ this.status = message.status;
13
+ this.response = message.response;
14
+ } else {
15
+ super(message);
16
+ this.message = message;
17
+ }
7
18
  this.name = options?.drop ? `${DropRetryErrorName}` : `${RetryErrorName}`;
8
19
  }
20
+ toJSON() {
21
+ return {
22
+ name: this.name,
23
+ message: this.message,
24
+ status: this.status,
25
+ response: this.response,
26
+ };
27
+ }
28
+ }
29
+
30
+ export class HTTPError extends Error {
31
+ status: number;
32
+ response: string;
33
+ message: string;
34
+ constructor(message: string, status: number, response: string) {
35
+ super(message);
36
+ this.message = message;
37
+ this.name = "HTTPError";
38
+ this.status = status;
39
+ this.response = response.length > 1000 ? response.slice(0, 1000) + "..." : response;
40
+ }
41
+
42
+ toJSON() {
43
+ return {
44
+ name: this.name,
45
+ message: this.message,
46
+ status: this.status,
47
+ response: this.response,
48
+ };
49
+ }
9
50
  }
package/tsconfig.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "lib": ["es2015", "dom", "es2017"],
3
+ "lib": ["dom", "esnext"],
4
4
  "rootDir": "./src",
5
5
  "outDir": "./dist",
6
6
  "declaration": true,
7
7
  "esModuleInterop": true,
8
8
  "noEmit": true,
9
- "target": "esnext"
9
+ "target": "esnext",
10
+ "skipLibCheck": true
10
11
  },
11
12
  "exclude": [
12
13
  "__tests__",