@decodo/sdk-ts 2.1.1 → 2.1.2
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/build/cjs/index.cjs +5 -2
- package/build/cjs/index.d.cts +3 -0
- package/build/esm/client.d.ts +1 -0
- package/build/esm/client.js +1 -0
- package/build/esm/http.d.ts +2 -0
- package/build/esm/http.js +3 -1
- package/package.json +1 -1
package/build/cjs/index.cjs
CHANGED
|
@@ -89,9 +89,11 @@ var HttpClient = class {
|
|
|
89
89
|
baseUrl;
|
|
90
90
|
authHeader;
|
|
91
91
|
timeoutMs;
|
|
92
|
+
integrationHeader;
|
|
92
93
|
constructor(config) {
|
|
93
94
|
this.baseUrl = config.baseUrl.replace(/\/+$/, "");
|
|
94
95
|
this.timeoutMs = config.timeoutMs;
|
|
96
|
+
this.integrationHeader = config.integrationHeader ?? "sdk-ts";
|
|
95
97
|
if (config.auth.type === "basic") {
|
|
96
98
|
this.authHeader = `Basic ${config.auth.token}`;
|
|
97
99
|
} else {
|
|
@@ -109,7 +111,7 @@ var HttpClient = class {
|
|
|
109
111
|
Authorization: this.authHeader,
|
|
110
112
|
"Content-Type": "application/json",
|
|
111
113
|
Accept: "application/json",
|
|
112
|
-
"x-integration":
|
|
114
|
+
"x-integration": this.integrationHeader
|
|
113
115
|
},
|
|
114
116
|
signal: controller.signal
|
|
115
117
|
};
|
|
@@ -2776,7 +2778,8 @@ var DecodoClient = class {
|
|
|
2776
2778
|
type: "basic",
|
|
2777
2779
|
token: config.webScrapingApi.token
|
|
2778
2780
|
},
|
|
2779
|
-
timeoutMs
|
|
2781
|
+
timeoutMs,
|
|
2782
|
+
integrationHeader: config.webScrapingApi.integrationHeader
|
|
2780
2783
|
}),
|
|
2781
2784
|
schema
|
|
2782
2785
|
);
|
package/build/cjs/index.d.cts
CHANGED
|
@@ -15,11 +15,13 @@ export type HttpClientConfig = {
|
|
|
15
15
|
baseUrl: string;
|
|
16
16
|
auth: BasicAuth | ApiKeyAuth;
|
|
17
17
|
timeoutMs: number;
|
|
18
|
+
integrationHeader?: string;
|
|
18
19
|
};
|
|
19
20
|
declare class HttpClient {
|
|
20
21
|
private readonly baseUrl;
|
|
21
22
|
private readonly authHeader;
|
|
22
23
|
private readonly timeoutMs;
|
|
24
|
+
private readonly integrationHeader;
|
|
23
25
|
constructor(config: HttpClientConfig);
|
|
24
26
|
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
25
27
|
post<T>(path: string, body: unknown): Promise<T>;
|
|
@@ -836,6 +838,7 @@ export declare class WebScrapingApi {
|
|
|
836
838
|
export type DecodoConfig = {
|
|
837
839
|
webScrapingApi?: {
|
|
838
840
|
token: string;
|
|
841
|
+
integrationHeader?: string;
|
|
839
842
|
};
|
|
840
843
|
timeoutMs?: number;
|
|
841
844
|
schema?: DecodoSchema;
|
package/build/esm/client.d.ts
CHANGED
package/build/esm/client.js
CHANGED
package/build/esm/http.d.ts
CHANGED
|
@@ -10,11 +10,13 @@ export type HttpClientConfig = {
|
|
|
10
10
|
baseUrl: string;
|
|
11
11
|
auth: BasicAuth | ApiKeyAuth;
|
|
12
12
|
timeoutMs: number;
|
|
13
|
+
integrationHeader?: string;
|
|
13
14
|
};
|
|
14
15
|
export declare class HttpClient {
|
|
15
16
|
private readonly baseUrl;
|
|
16
17
|
private readonly authHeader;
|
|
17
18
|
private readonly timeoutMs;
|
|
19
|
+
private readonly integrationHeader;
|
|
18
20
|
constructor(config: HttpClientConfig);
|
|
19
21
|
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
20
22
|
post<T>(path: string, body: unknown): Promise<T>;
|
package/build/esm/http.js
CHANGED
|
@@ -3,9 +3,11 @@ export class HttpClient {
|
|
|
3
3
|
baseUrl;
|
|
4
4
|
authHeader;
|
|
5
5
|
timeoutMs;
|
|
6
|
+
integrationHeader;
|
|
6
7
|
constructor(config) {
|
|
7
8
|
this.baseUrl = config.baseUrl.replace(/\/+$/, '');
|
|
8
9
|
this.timeoutMs = config.timeoutMs;
|
|
10
|
+
this.integrationHeader = config.integrationHeader ?? 'sdk-ts';
|
|
9
11
|
if (config.auth.type === 'basic') {
|
|
10
12
|
this.authHeader = `Basic ${config.auth.token}`;
|
|
11
13
|
}
|
|
@@ -24,7 +26,7 @@ export class HttpClient {
|
|
|
24
26
|
Authorization: this.authHeader,
|
|
25
27
|
'Content-Type': 'application/json',
|
|
26
28
|
Accept: 'application/json',
|
|
27
|
-
'x-integration':
|
|
29
|
+
'x-integration': this.integrationHeader,
|
|
28
30
|
},
|
|
29
31
|
signal: controller.signal,
|
|
30
32
|
};
|