@seatmap-fyi/api-client 0.0.0-stage → 0.1.0-alpha.10

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.
@@ -0,0 +1,2 @@
1
+ export * from "./generated.js";
2
+ export { Configuration, type ConfigurationParameters, } from "./configuration.js";
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./generated.js";
2
+ export { Configuration, } from "./configuration.js";
@@ -0,0 +1,14 @@
1
+ import type { AxiosRequestConfig } from "axios";
2
+ import type { Configuration } from "./configuration.js";
3
+ /**
4
+ * @method prepareRequestOptions
5
+ * @description Applies instance-scoped transport settings, the SDK write contract and optional body compression.
6
+ * @async
7
+ * @param {Configuration} configuration
8
+ * @param {string | undefined} basePath
9
+ * @param {AxiosRequestConfig | undefined} options
10
+ * @param {string} method
11
+ * @param {unknown} [body]
12
+ * @returns {Promise<AxiosRequestConfig<unknown>>}
13
+ */
14
+ export declare function prepareRequestOptions(configuration: Configuration, basePath: string | undefined, options: AxiosRequestConfig | undefined, method: string, body?: unknown): Promise<AxiosRequestConfig<unknown>>;
@@ -0,0 +1,50 @@
1
+ import { mergeConfig } from "axios";
2
+ const clientContract = "2";
3
+ const requestCompressionThreshold = 64 * 1024;
4
+ /**
5
+ * @method prepareRequestOptions
6
+ * @description Applies instance-scoped transport settings, the SDK write contract and optional body compression.
7
+ * @async
8
+ * @param {Configuration} configuration
9
+ * @param {string | undefined} basePath
10
+ * @param {AxiosRequestConfig | undefined} options
11
+ * @param {string} method
12
+ * @param {unknown} [body]
13
+ * @returns {Promise<AxiosRequestConfig<unknown>>}
14
+ */
15
+ export async function prepareRequestOptions(configuration, basePath, options, method, body) {
16
+ const prepared = mergeConfig(configuration.baseOptions ?? {}, options ?? {});
17
+ const headers = { ...prepared.headers };
18
+ if (!["GET", "HEAD", "OPTIONS"].includes(method)) {
19
+ headers["X-Seatmap-Contract"] = clientContract;
20
+ }
21
+ const configuredBasePath = basePath ?? configuration.basePath;
22
+ if (configuredBasePath !== undefined) {
23
+ prepared.baseURL = configuredBasePath;
24
+ }
25
+ if (body === undefined &&
26
+ !["GET", "HEAD", "OPTIONS"].includes(method) &&
27
+ !Object.keys(headers).some((name) => name.toLowerCase() === "content-type")) {
28
+ headers["Content-Type"] = "application/json";
29
+ }
30
+ prepared.headers = headers;
31
+ if (prepared.validateStatus === undefined) {
32
+ prepared.validateStatus = (status) => (status >= 200 && status < 300) || status === 304;
33
+ }
34
+ if (!configuration.compressRequests ||
35
+ body === undefined ||
36
+ (typeof Blob !== "undefined" && body instanceof Blob) ||
37
+ body instanceof ArrayBuffer ||
38
+ ArrayBuffer.isView(body) ||
39
+ Object.keys(headers).some((name) => name.toLowerCase() === "content-encoding")) {
40
+ return prepared;
41
+ }
42
+ const serialized = JSON.stringify(options?.data ?? body);
43
+ if (serialized.length < requestCompressionThreshold ||
44
+ typeof CompressionStream === "undefined") {
45
+ return prepared;
46
+ }
47
+ prepared.data = await new Response(new Blob([serialized]).stream().pipeThrough(new CompressionStream("gzip"))).arrayBuffer();
48
+ headers["Content-Encoding"] = "gzip";
49
+ return prepared;
50
+ }
package/package.json CHANGED
@@ -1,6 +1,25 @@
1
1
  {
2
2
  "name": "@seatmap-fyi/api-client",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-alpha.10",
4
+ "license": "UNLICENSED",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "scripts": {
17
+ "build": "node --input-type=module -e \"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true });\" && tsc -p tsconfig.json"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "dependencies": {
23
+ "axios": "1.20.0"
24
+ }
25
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.