@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.
@@ -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": "sdk-ts"
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
  );
@@ -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;
@@ -3,6 +3,7 @@ import type { DecodoSchema } from './schema/types.js';
3
3
  export type DecodoConfig = {
4
4
  webScrapingApi?: {
5
5
  token: string;
6
+ integrationHeader?: string;
6
7
  };
7
8
  timeoutMs?: number;
8
9
  schema?: DecodoSchema;
@@ -19,6 +19,7 @@ export class DecodoClient {
19
19
  token: config.webScrapingApi.token,
20
20
  },
21
21
  timeoutMs,
22
+ integrationHeader: config.webScrapingApi.integrationHeader,
22
23
  }), schema);
23
24
  }
24
25
  else {
@@ -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': 'sdk-ts',
29
+ 'x-integration': this.integrationHeader,
28
30
  },
29
31
  signal: controller.signal,
30
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decodo/sdk-ts",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Official TypeScript SDK for the Decodo APIs",
5
5
  "type": "module",
6
6
  "main": "./build/cjs/index.cjs",