@seatmap-fyi/api-client 0.1.0-alpha.2 → 0.1.0-alpha.3
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/dist/configuration.d.ts +0 -2
- package/dist/configuration.js +0 -2
- package/dist/transport.js +2 -3
- package/package.json +1 -1
package/dist/configuration.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export interface ConfigurationParameters {
|
|
|
2
2
|
readonly basePath: string;
|
|
3
3
|
readonly fetchApi?: typeof globalThis.fetch;
|
|
4
4
|
readonly credentials?: RequestCredentials;
|
|
5
|
-
readonly contract?: string;
|
|
6
5
|
readonly compressRequests?: boolean;
|
|
7
6
|
readonly mapError?: (cause: unknown) => Promise<Error>;
|
|
8
7
|
}
|
|
@@ -10,7 +9,6 @@ export declare class Configuration {
|
|
|
10
9
|
readonly basePath: string;
|
|
11
10
|
readonly fetchApi: typeof globalThis.fetch;
|
|
12
11
|
readonly credentials: RequestCredentials | undefined;
|
|
13
|
-
readonly contract: string | undefined;
|
|
14
12
|
readonly compressRequests: boolean;
|
|
15
13
|
readonly mapError: ConfigurationParameters["mapError"];
|
|
16
14
|
csrfToken: string | undefined;
|
package/dist/configuration.js
CHANGED
|
@@ -2,7 +2,6 @@ export class Configuration {
|
|
|
2
2
|
basePath;
|
|
3
3
|
fetchApi;
|
|
4
4
|
credentials;
|
|
5
|
-
contract;
|
|
6
5
|
compressRequests;
|
|
7
6
|
mapError;
|
|
8
7
|
csrfToken;
|
|
@@ -10,7 +9,6 @@ export class Configuration {
|
|
|
10
9
|
this.basePath = parameters.basePath;
|
|
11
10
|
this.fetchApi = parameters.fetchApi ?? globalThis.fetch;
|
|
12
11
|
this.credentials = parameters.credentials;
|
|
13
|
-
this.contract = parameters.contract;
|
|
14
12
|
this.compressRequests = parameters.compressRequests ?? false;
|
|
15
13
|
this.mapError = parameters.mapError;
|
|
16
14
|
}
|
package/dist/transport.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ApiError } from "./errors/api-error.js";
|
|
2
|
+
const clientContract = "1";
|
|
2
3
|
const requestCompressionThreshold = 64 * 1024;
|
|
3
4
|
export function createApiFetcher(configuration) {
|
|
4
5
|
const baseUrl = new URL(configuration.basePath);
|
|
@@ -7,9 +8,7 @@ export function createApiFetcher(configuration) {
|
|
|
7
8
|
const headers = normalizeHeaders(options?.headers ?? request?.headers ?? {});
|
|
8
9
|
const method = (options?.method ?? request?.method ?? "GET").toUpperCase();
|
|
9
10
|
if (!["GET", "HEAD", "OPTIONS"].includes(method)) {
|
|
10
|
-
|
|
11
|
-
headers.set("X-Seatmap-Contract", configuration.contract);
|
|
12
|
-
}
|
|
11
|
+
headers.set("X-Seatmap-Contract", clientContract);
|
|
13
12
|
if (configuration.csrfToken) {
|
|
14
13
|
headers.set("X-CSRF-Token", configuration.csrfToken);
|
|
15
14
|
}
|