@deliverart/sdk-js-core 0.1.2 → 0.1.4
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +3 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/package.json +1 -1
- package/src/ApiClient.ts +4 -3
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -94,7 +94,8 @@ var AbstractApiRequest = class {
|
|
|
94
94
|
}
|
|
95
95
|
return result.data;
|
|
96
96
|
}
|
|
97
|
-
parseResponse(data) {
|
|
97
|
+
parseResponse(data, rawResponse) {
|
|
98
|
+
void rawResponse;
|
|
98
99
|
return this.validateOutput(data);
|
|
99
100
|
}
|
|
100
101
|
};
|
|
@@ -117,7 +118,7 @@ function createApiClient(config) {
|
|
|
117
118
|
params: query,
|
|
118
119
|
data: request.method !== "GET" ? input : void 0
|
|
119
120
|
});
|
|
120
|
-
return request.parseResponse(res.data);
|
|
121
|
+
return request.parseResponse(res.data, res);
|
|
121
122
|
},
|
|
122
123
|
addPlugin(plugin) {
|
|
123
124
|
const extension = plugin.setup(this);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
1
|
+
import { AxiosResponse, AxiosInstance } from 'axios';
|
|
2
2
|
import { ZodSchema, ZodIssue } from 'zod';
|
|
3
3
|
|
|
4
4
|
type ApiExtension = Record<string, unknown>;
|
|
@@ -28,7 +28,7 @@ declare abstract class AbstractApiRequest<Input, Output, Query = unknown, Header
|
|
|
28
28
|
validateQuery(): Query | undefined;
|
|
29
29
|
validateHeaders(): Headers | undefined;
|
|
30
30
|
validateOutput(data: unknown): Output;
|
|
31
|
-
parseResponse(data: unknown): Output;
|
|
31
|
+
parseResponse(data: unknown, rawResponse?: AxiosResponse): Output;
|
|
32
32
|
}
|
|
33
33
|
interface ApiClientBase {
|
|
34
34
|
http: AxiosInstance;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
1
|
+
import { AxiosResponse, AxiosInstance } from 'axios';
|
|
2
2
|
import { ZodSchema, ZodIssue } from 'zod';
|
|
3
3
|
|
|
4
4
|
type ApiExtension = Record<string, unknown>;
|
|
@@ -28,7 +28,7 @@ declare abstract class AbstractApiRequest<Input, Output, Query = unknown, Header
|
|
|
28
28
|
validateQuery(): Query | undefined;
|
|
29
29
|
validateHeaders(): Headers | undefined;
|
|
30
30
|
validateOutput(data: unknown): Output;
|
|
31
|
-
parseResponse(data: unknown): Output;
|
|
31
|
+
parseResponse(data: unknown, rawResponse?: AxiosResponse): Output;
|
|
32
32
|
}
|
|
33
33
|
interface ApiClientBase {
|
|
34
34
|
http: AxiosInstance;
|
package/dist/index.js
CHANGED
|
@@ -55,7 +55,8 @@ var AbstractApiRequest = class {
|
|
|
55
55
|
}
|
|
56
56
|
return result.data;
|
|
57
57
|
}
|
|
58
|
-
parseResponse(data) {
|
|
58
|
+
parseResponse(data, rawResponse) {
|
|
59
|
+
void rawResponse;
|
|
59
60
|
return this.validateOutput(data);
|
|
60
61
|
}
|
|
61
62
|
};
|
|
@@ -78,7 +79,7 @@ function createApiClient(config) {
|
|
|
78
79
|
params: query,
|
|
79
80
|
data: request.method !== "GET" ? input : void 0
|
|
80
81
|
});
|
|
81
|
-
return request.parseResponse(res.data);
|
|
82
|
+
return request.parseResponse(res.data, res);
|
|
82
83
|
},
|
|
83
84
|
addPlugin(plugin) {
|
|
84
85
|
const extension = plugin.setup(this);
|
package/package.json
CHANGED
package/src/ApiClient.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import axios, { AxiosInstance } from 'axios'
|
|
1
|
+
import axios, { AxiosInstance, AxiosResponse } from 'axios'
|
|
2
2
|
import { ZodSchema } from 'zod'
|
|
3
3
|
|
|
4
4
|
import { InputValidationError, OutputValidationError } from './errors'
|
|
@@ -64,7 +64,8 @@ export abstract class AbstractApiRequest<Input, Output, Query = unknown, Headers
|
|
|
64
64
|
return result.data
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
parseResponse(data: unknown): Output {
|
|
67
|
+
parseResponse(data: unknown, rawResponse?: AxiosResponse): Output {
|
|
68
|
+
void rawResponse
|
|
68
69
|
return this.validateOutput(data)
|
|
69
70
|
}
|
|
70
71
|
}
|
|
@@ -102,7 +103,7 @@ export function createApiClient<Extensions extends ApiExtension = NonNullable<un
|
|
|
102
103
|
data: request.method !== 'GET' ? input : undefined,
|
|
103
104
|
})
|
|
104
105
|
|
|
105
|
-
return request.parseResponse(res.data)
|
|
106
|
+
return request.parseResponse(res.data, res)
|
|
106
107
|
},
|
|
107
108
|
|
|
108
109
|
addPlugin<T extends ApiExtension>(plugin: ApiClientPlugin<T>) {
|