@unshared/client 0.2.1 → 0.2.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.
Files changed (47) hide show
  1. package/dist/chunks/{DvNxpeLr.js → B5hc73Po.js} +6 -13
  2. package/dist/chunks/B5hc73Po.js.map +1 -0
  3. package/dist/chunks/{KZzRv9Rx.d.ts → BsMghIPi.d.ts} +1 -1
  4. package/dist/chunks/CKfJvIQ8.js +50 -0
  5. package/dist/chunks/CKfJvIQ8.js.map +1 -0
  6. package/dist/chunks/Cx8m1YzL.cjs +49 -0
  7. package/dist/chunks/Cx8m1YzL.cjs.map +1 -0
  8. package/dist/chunks/D-WqCFul.js +30 -0
  9. package/dist/chunks/D-WqCFul.js.map +1 -0
  10. package/dist/chunks/{Bul9W_0Q.cjs → D8Tsm7xC.cjs} +6 -13
  11. package/dist/chunks/D8Tsm7xC.cjs.map +1 -0
  12. package/dist/chunks/{D8ZTxxpG.d.ts → DZp6zyqV.d.ts} +5 -3
  13. package/dist/chunks/r8pYO6Hx.d.ts +38 -0
  14. package/dist/chunks/xRZPkxch.cjs +29 -0
  15. package/dist/chunks/xRZPkxch.cjs.map +1 -0
  16. package/dist/createClient.cjs +6 -10
  17. package/dist/createClient.cjs.map +1 -1
  18. package/dist/createClient.d.ts +6 -5
  19. package/dist/createClient.js +6 -9
  20. package/dist/createClient.js.map +1 -1
  21. package/dist/fetch.cjs +2 -2
  22. package/dist/fetch.cjs.map +1 -1
  23. package/dist/fetch.d.ts +5 -1
  24. package/dist/fetch.js +2 -2
  25. package/dist/fetch.js.map +1 -1
  26. package/dist/index.cjs +12 -9
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.ts +5 -3
  29. package/dist/index.js +15 -11
  30. package/dist/index.js.map +1 -1
  31. package/dist/openapi.cjs +45 -7
  32. package/dist/openapi.cjs.map +1 -1
  33. package/dist/openapi.d.ts +2 -2
  34. package/dist/openapi.js +43 -5
  35. package/dist/openapi.js.map +1 -1
  36. package/dist/utils.cjs +4 -1
  37. package/dist/utils.cjs.map +1 -1
  38. package/dist/utils.d.ts +17 -3
  39. package/dist/utils.js +6 -2
  40. package/dist/utils.js.map +1 -1
  41. package/package.json +4 -3
  42. package/dist/chunks/Bul9W_0Q.cjs.map +0 -1
  43. package/dist/chunks/BzqHK4CV.cjs +0 -71
  44. package/dist/chunks/BzqHK4CV.cjs.map +0 -1
  45. package/dist/chunks/CRISqhP7.js +0 -72
  46. package/dist/chunks/CRISqhP7.js.map +0 -1
  47. package/dist/chunks/DvNxpeLr.js.map +0 -1
@@ -1,7 +1,8 @@
1
1
  import { Pretty, Override, MaybeLiteral } from '@unshared/types';
2
2
  import { OpenAPI, OpenAPIV3, OpenAPIV2 as OpenAPIV2$1, OpenAPIV3_1 } from 'openapi-types';
3
- import { b as RequestOptions } from './chunks/D8ZTxxpG.js';
4
- import { O as OpenAPIV2, a as OpenAPIV3$1 } from './chunks/KZzRv9Rx.js';
3
+ import { O as OpenAPIV2, a as OpenAPIV3$1 } from './chunks/BsMghIPi.js';
4
+ import { R as RequestHooks } from './chunks/r8pYO6Hx.js';
5
+ import { c as RequestOptions, a as RequestHeaders } from './chunks/DZp6zyqV.js';
5
6
  import './chunks/8BFCFxqa.js';
6
7
 
7
8
  type ClientBaseUrl<T> = MaybeLiteral<T extends OpenAPIV2$1.Document ? OpenAPIV2.ServerUrl<T> : T extends OpenAPIV3.Document ? OpenAPIV3$1.ServerUrl<T> : T extends OpenAPIV3_1.Document ? OpenAPIV3$1.ServerUrl<T> : string>;
@@ -12,15 +13,15 @@ type Client<T = OpenAPI.Document> = Pretty<{
12
13
  } & {
13
14
  fetch: ClientFetch<T>;
14
15
  }>;
15
- type ClientOptions<T = any> = Pretty<Override<RequestOptions, {
16
+ type ClientOptions<T = any> = Override<RequestHooks & RequestOptions, {
16
17
  baseUrl?: ClientBaseUrl<T>;
17
18
  /**
18
19
  * The headers to include in every request made by the client.
19
20
  *
20
21
  * @example { 'Authorization': 'Bearer ...' }
21
22
  */
22
- headers?: T extends OpenAPIV3.Document ? OpenAPIV3$1.ServerHeaders<T> : Record<string, string>;
23
- }>>;
23
+ headers?: T extends OpenAPIV3.Document ? OpenAPIV3$1.ServerHeaders<T> : RequestHeaders;
24
+ }>;
24
25
  /**
25
26
  * Create a new client instance for the given OpenAPI specification.
26
27
  *
@@ -1,6 +1,8 @@
1
1
  import { fetch } from "./fetch.js";
2
- import { a as getOperationById, g as getBaseUrl } from "./chunks/CRISqhP7.js";
3
- import "./chunks/DvNxpeLr.js";
2
+ import { a as getOperationById, g as getBaseUrl } from "./chunks/D-WqCFul.js";
3
+ import { h as handleResponse } from "./chunks/CKfJvIQ8.js";
4
+ import "./chunks/B5hc73Po.js";
5
+ import "@unshared/functions/awaitable";
4
6
  function createClient(documentOrUrl, initialOptions = {}) {
5
7
  const specifications = typeof documentOrUrl == "string" ? void 0 : documentOrUrl;
6
8
  typeof documentOrUrl == "string" && (initialOptions.baseUrl = documentOrUrl);
@@ -8,13 +10,8 @@ function createClient(documentOrUrl, initialOptions = {}) {
8
10
  if (!specifications) throw new Error("No OpenAPI specification provided.");
9
11
  const operation = getOperationById(specifications, operationId);
10
12
  if (!operation) throw new Error(`Operation ID "${operationId}" not found.`);
11
- const { method, path, responses = {} } = operation, response = await fetch(path, {
12
- method,
13
- baseUrl: getBaseUrl(specifications),
14
- ...initialOptions,
15
- ...options
16
- });
17
- if (response.ok) return response.json();
13
+ const { method, path, responses = {} } = operation, fetchOptions = { method, baseUrl: getBaseUrl(specifications), ...initialOptions, ...options }, response = await fetch(path, fetchOptions);
14
+ if (response.ok) return handleResponse(response, fetchOptions);
18
15
  const status = response.status.toString();
19
16
  throw status in responses && typeof responses[status] == "object" && responses[status] !== null && "description" in responses[status] && typeof responses[status].description == "string" ? new Error(responses[status].description) : new Error(response.statusText);
20
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createClient.js","sources":["../createClient.ts"],"sourcesContent":["import type { MaybeLiteral, Override, Pretty } from '@unshared/types'\nimport type { OpenAPI, OpenAPIV2 as V2, OpenAPIV3 as V3, OpenAPIV3_1 as V3_1 } from 'openapi-types'\nimport type { RequestOptions } from './utils/index'\nimport { fetch } from './fetch'\nimport { getOperationById } from './openapi/getOperationById'\nimport { getBaseUrl, type OpenAPIV2, type OpenAPIV3 } from './openapi/index'\n\ntype ClientBaseUrl<T> =\n MaybeLiteral<\n T extends V2.Document ? OpenAPIV2.ServerUrl<T>\n : T extends V3.Document ? OpenAPIV3.ServerUrl<T>\n : T extends V3_1.Document ? OpenAPIV3.ServerUrl<T>\n : string\n >\n\ntype ClientFetch<T> =\n T extends V2.Document ? <P extends OpenAPIV2.Route<T>>(name: P, options: OpenAPIV2.RequestInit<T, OpenAPIV2.OperationByRoute<T, P>>) => Promise<OpenAPIV2.Response<OpenAPIV2.OperationByRoute<T, P>>>\n : T extends V3.Document ? <P extends OpenAPIV2.Route<T>>(name: P, options: OpenAPIV3.RequestInit<T, OpenAPIV2.OperationByRoute<T, P>>) => Promise<OpenAPIV3.Response<OpenAPIV2.OperationByRoute<T, P>>>\n : T extends V3_1.Document ? <P extends OpenAPIV2.Route<T>>(name: P, options: OpenAPIV3.RequestInit<T, OpenAPIV2.OperationByRoute<T, P>>) => Promise<OpenAPIV3.Response<OpenAPIV2.OperationByRoute<T, P>>>\n : typeof globalThis.fetch\n\ntype ClientFetchOperation<T, U extends OpenAPIV2.OperationId<T>> =\n T extends V2.Document ? (options: OpenAPIV2.RequestInit<T, OpenAPIV2.OperationById<T, U>>) => Promise<OpenAPIV2.ResponseBody<OpenAPIV2.OperationById<T, U>>>\n : T extends V3.Document ? (options: OpenAPIV3.RequestInit<T, OpenAPIV2.OperationById<T, U>>) => Promise<OpenAPIV3.ResponseBody<OpenAPIV2.OperationById<T, U>>>\n : T extends V3_1.Document ? (options: OpenAPIV3.RequestInit<T, OpenAPIV2.OperationById<T, U>>) => Promise<OpenAPIV3.ResponseBody<OpenAPIV2.OperationById<T, U>>>\n : (options: RequestOptions) => Promise<Response>\n\nexport type Client<T = OpenAPI.Document> =\n Pretty<\n & { [K in OpenAPIV2.OperationId<T>]: ClientFetchOperation<T, K> }\n & { fetch: ClientFetch<T> }\n >\n\nexport type ClientOptions<T = any> = Pretty<Override<RequestOptions, {\n baseUrl?: ClientBaseUrl<T>\n\n /**\n * The headers to include in every request made by the client.\n *\n * @example { 'Authorization': 'Bearer ...' }\n */\n headers?: T extends V3.Document\n ? OpenAPIV3.ServerHeaders<T>\n : Record<string, string>\n}>>\n\n/**\n * Create a new client instance for the given OpenAPI specification.\n *\n * @param document The OpenAPI specification document.\n * @param initialOptions The initial options to use for every request.\n * @returns The client instance.\n * @example\n * const client = createClient(document)\n * await client.fetch({ ... })\n */\n// @ts-expect-error: `ClientOptions` is not assignable to `ClientOptions<T>`.\nexport function createClient<T extends OpenAPI.Document>(document: Readonly<T>, initialOptions?: ClientOptions<T>): Client<T>\nexport function createClient<T extends OpenAPI.Document>(url: ClientBaseUrl<T>, initialOptions?: ClientOptions<T>): Client<T>\nexport function createClient(documentOrUrl: Readonly<OpenAPI.Document> | string, initialOptions: ClientOptions = {}): Client {\n const specifications = typeof documentOrUrl === 'string' ? undefined : documentOrUrl\n\n if (typeof documentOrUrl === 'string')\n initialOptions.baseUrl = documentOrUrl\n\n async function fetchByOperationId(operationId: string, options: ClientOptions<any>) {\n if (!specifications) throw new Error('No OpenAPI specification provided.')\n const operation = getOperationById(specifications, operationId) as { method: string; path: string } & OpenAPI.Operation\n if (!operation) throw new Error(`Operation ID \"${operationId}\" not found.`)\n const { method, path, responses = {} } = operation\n const response = await fetch(path, {\n method,\n baseUrl: getBaseUrl(specifications),\n ...initialOptions,\n ...options,\n })\n\n // --- Return the JSON response if successful.\n if (response.ok) return response.json() as Promise<unknown>\n\n // --- Throw an error if the response was not successful.\n const status = response.status.toString()\n if (status in responses\n && typeof responses[status] === 'object'\n && responses[status] !== null\n && 'description' in responses[status]\n && typeof responses[status].description === 'string')\n throw new Error(responses[status].description)\n\n // --- Throw a generic error if the response was not successful.\n throw new Error(response.statusText)\n }\n\n return new Proxy({}, {\n get(_, property: string) {\n if (property === 'fetch') return (route: string, options: RequestOptions) => fetch(route, ({ ...initialOptions, ...options }))\n return (options: Record<string, unknown>) => fetchByOperationId(property, options)\n },\n }) as unknown as Client\n}\n"],"names":[],"mappings":";;;AA2DO,SAAS,aAAa,eAAoD,iBAAgC,IAAY;AAC3H,QAAM,iBAAiB,OAAO,iBAAkB,WAAW,SAAY;AAEnE,SAAO,iBAAkB,aAC3B,eAAe,UAAU;AAEZ,iBAAA,mBAAmB,aAAqB,SAA6B;AAClF,QAAI,CAAC,eAAsB,OAAA,IAAI,MAAM,oCAAoC;AACnE,UAAA,YAAY,iBAAiB,gBAAgB,WAAW;AAC9D,QAAI,CAAC,UAAW,OAAM,IAAI,MAAM,iBAAiB,WAAW,cAAc;AACpE,UAAA,EAAE,QAAQ,MAAM,YAAY,CAAA,MAAO,WACnC,WAAW,MAAM,MAAM,MAAM;AAAA,MACjC;AAAA,MACA,SAAS,WAAW,cAAc;AAAA,MAClC,GAAG;AAAA,MACH,GAAG;AAAA,IAAA,CACJ;AAGD,QAAI,SAAS,GAAW,QAAA,SAAS,KAAK;AAGhC,UAAA,SAAS,SAAS,OAAO,SAAS;AACxC,UAAI,UAAU,aACT,OAAO,UAAU,MAAM,KAAM,YAC7B,UAAU,MAAM,MAAM,QACtB,iBAAiB,UAAU,MAAM,KACjC,OAAO,UAAU,MAAM,EAAE,eAAgB,WACtC,IAAI,MAAM,UAAU,MAAM,EAAE,WAAW,IAGzC,IAAI,MAAM,SAAS,UAAU;AAAA,EAAA;AAG9B,SAAA,IAAI,MAAM,IAAI;AAAA,IACnB,IAAI,GAAG,UAAkB;AACvB,aAAI,aAAa,UAAgB,CAAC,OAAe,YAA4B,MAAM,OAAQ,EAAE,GAAG,gBAAgB,GAAG,SAAU,IACtH,CAAC,YAAqC,mBAAmB,UAAU,OAAO;AAAA,IAAA;AAAA,EACnF,CACD;AACH;"}
1
+ {"version":3,"file":"createClient.js","sources":["../createClient.ts"],"sourcesContent":["import type { MaybeLiteral, Override, Pretty } from '@unshared/types'\nimport type { OpenAPI, OpenAPIV2 as V2, OpenAPIV3 as V3, OpenAPIV3_1 as V3_1 } from 'openapi-types'\nimport type { OpenAPIV2, OpenAPIV3 } from './openapi/index'\nimport type { RequestHooks } from './utils/handleResponse'\nimport type { RequestHeaders, RequestMethod, RequestOptions } from './utils/parseRequest'\nimport { fetch } from './fetch'\nimport { getBaseUrl } from './openapi/getBaseUrl'\nimport { getOperationById } from './openapi/getOperationById'\nimport { handleResponse } from './utils/handleResponse'\n\ntype ClientBaseUrl<T> =\n MaybeLiteral<\n T extends V2.Document ? OpenAPIV2.ServerUrl<T>\n : T extends V3.Document ? OpenAPIV3.ServerUrl<T>\n : T extends V3_1.Document ? OpenAPIV3.ServerUrl<T>\n : string\n >\n\ntype ClientFetch<T> =\n T extends V2.Document ? <P extends OpenAPIV2.Route<T>>(name: P, options: OpenAPIV2.RequestInit<T, OpenAPIV2.OperationByRoute<T, P>>) => Promise<OpenAPIV2.Response<OpenAPIV2.OperationByRoute<T, P>>>\n : T extends V3.Document ? <P extends OpenAPIV2.Route<T>>(name: P, options: OpenAPIV3.RequestInit<T, OpenAPIV2.OperationByRoute<T, P>>) => Promise<OpenAPIV3.Response<OpenAPIV2.OperationByRoute<T, P>>>\n : T extends V3_1.Document ? <P extends OpenAPIV2.Route<T>>(name: P, options: OpenAPIV3.RequestInit<T, OpenAPIV2.OperationByRoute<T, P>>) => Promise<OpenAPIV3.Response<OpenAPIV2.OperationByRoute<T, P>>>\n : typeof globalThis.fetch\n\ntype ClientFetchOperation<T, U extends OpenAPIV2.OperationId<T>> =\n T extends V2.Document ? (options: OpenAPIV2.RequestInit<T, OpenAPIV2.OperationById<T, U>>) => Promise<OpenAPIV2.ResponseBody<OpenAPIV2.OperationById<T, U>>>\n : T extends V3.Document ? (options: OpenAPIV3.RequestInit<T, OpenAPIV2.OperationById<T, U>>) => Promise<OpenAPIV3.ResponseBody<OpenAPIV2.OperationById<T, U>>>\n : T extends V3_1.Document ? (options: OpenAPIV3.RequestInit<T, OpenAPIV2.OperationById<T, U>>) => Promise<OpenAPIV3.ResponseBody<OpenAPIV2.OperationById<T, U>>>\n : (options: RequestOptions) => Promise<Response>\n\nexport type Client<T = OpenAPI.Document> =\n Pretty<\n & { [K in OpenAPIV2.OperationId<T>]: ClientFetchOperation<T, K> }\n & { fetch: ClientFetch<T> }\n >\n\nexport type ClientOptions<T = any> = Override<RequestHooks & RequestOptions, {\n baseUrl?: ClientBaseUrl<T>\n\n /**\n * The headers to include in every request made by the client.\n *\n * @example { 'Authorization': 'Bearer ...' }\n */\n headers?: T extends V3.Document\n ? OpenAPIV3.ServerHeaders<T>\n : RequestHeaders\n}>\n\n/**\n * Create a new client instance for the given OpenAPI specification.\n *\n * @param document The OpenAPI specification document.\n * @param initialOptions The initial options to use for every request.\n * @returns The client instance.\n * @example\n * const client = createClient(document)\n * await client.fetch({ ... })\n */\n// @ts-expect-error: `ClientOptions` is not assignable to `ClientOptions<T>`.\nexport function createClient<T extends OpenAPI.Document>(document: Readonly<T>, initialOptions?: ClientOptions<T>): Client<T>\nexport function createClient<T extends OpenAPI.Document>(url: ClientBaseUrl<T>, initialOptions?: ClientOptions<T>): Client<T>\nexport function createClient(documentOrUrl: Readonly<OpenAPI.Document> | string, initialOptions: ClientOptions = {}): Client {\n const specifications = typeof documentOrUrl === 'string' ? undefined : documentOrUrl\n if (typeof documentOrUrl === 'string') initialOptions.baseUrl = documentOrUrl\n\n async function fetchByOperationId(operationId: string, options: ClientOptions<any>) {\n if (!specifications) throw new Error('No OpenAPI specification provided.')\n const operation = getOperationById(specifications, operationId) as { method: RequestMethod; path: string } & OpenAPI.Operation\n if (!operation) throw new Error(`Operation ID \"${operationId}\" not found.`)\n const { method, path, responses = {} } = operation\n const fetchOptions = { method, baseUrl: getBaseUrl(specifications), ...initialOptions, ...options }\n const response = await fetch(path, fetchOptions)\n\n // --- Return the JSON response if successful.\n if (response.ok) return handleResponse(response, fetchOptions)\n\n // --- Throw an error if the response was not successful.\n const status = response.status.toString()\n if (status in responses\n && typeof responses[status] === 'object'\n && responses[status] !== null\n && 'description' in responses[status]\n && typeof responses[status].description === 'string')\n throw new Error(responses[status].description)\n\n // --- Throw a generic error if the response was not successful.\n throw new Error(response.statusText)\n }\n\n return new Proxy({}, {\n get(_, property: string) {\n if (property === 'fetch') return (route: string, options: RequestOptions) => fetch(route, ({ ...initialOptions, ...options }))\n return (options: Record<string, unknown>) => fetchByOperationId(property, options)\n },\n }) as unknown as Client\n}\n"],"names":[],"mappings":";;;;;AA8DO,SAAS,aAAa,eAAoD,iBAAgC,IAAY;AAC3H,QAAM,iBAAiB,OAAO,iBAAkB,WAAW,SAAY;AACnE,SAAO,iBAAkB,aAAU,eAAe,UAAU;AAEjD,iBAAA,mBAAmB,aAAqB,SAA6B;AAClF,QAAI,CAAC,eAAsB,OAAA,IAAI,MAAM,oCAAoC;AACnE,UAAA,YAAY,iBAAiB,gBAAgB,WAAW;AAC9D,QAAI,CAAC,UAAW,OAAM,IAAI,MAAM,iBAAiB,WAAW,cAAc;AACpE,UAAA,EAAE,QAAQ,MAAM,YAAY,CAAA,EAAO,IAAA,WACnC,eAAe,EAAE,QAAQ,SAAS,WAAW,cAAc,GAAG,GAAG,gBAAgB,GAAG,QAAA,GACpF,WAAW,MAAM,MAAM,MAAM,YAAY;AAG/C,QAAI,SAAS,GAAW,QAAA,eAAe,UAAU,YAAY;AAGvD,UAAA,SAAS,SAAS,OAAO,SAAS;AACxC,UAAI,UAAU,aACT,OAAO,UAAU,MAAM,KAAM,YAC7B,UAAU,MAAM,MAAM,QACtB,iBAAiB,UAAU,MAAM,KACjC,OAAO,UAAU,MAAM,EAAE,eAAgB,WACtC,IAAI,MAAM,UAAU,MAAM,EAAE,WAAW,IAGzC,IAAI,MAAM,SAAS,UAAU;AAAA,EAAA;AAG9B,SAAA,IAAI,MAAM,IAAI;AAAA,IACnB,IAAI,GAAG,UAAkB;AACvB,aAAI,aAAa,UAAgB,CAAC,OAAe,YAA4B,MAAM,OAAQ,EAAE,GAAG,gBAAgB,GAAG,SAAU,IACtH,CAAC,YAAqC,mBAAmB,UAAU,OAAO;AAAA,IAAA;AAAA,EACnF,CACD;AACH;"}
package/dist/fetch.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- var parseRequest = require("./chunks/Bul9W_0Q.cjs");
3
- function fetch(route, options) {
2
+ var parseRequest = require("./chunks/D8Tsm7xC.cjs");
3
+ function fetch(route, options = {}) {
4
4
  const { url, init } = parseRequest.parseRequest(route, options);
5
5
  return globalThis.fetch(url, init);
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.cjs","sources":["../fetch.ts"],"sourcesContent":["import { parseRequest } from './utils/parseRequest'\n\n/**\n * Fetch a route with the provided options. This function will parse the route and\n * options to create a `Request` object and return the response from the server.\n *\n * @param route The name of the route to fetch.\n * @param options The options to pass to the request.\n * @returns The response from the server.\n * @example fetch('GET /users', { query: { limit: 10 } })\n */\nexport function fetch(route: string, options: Record<string, unknown>) {\n const { url, init } = parseRequest(route, options)\n return globalThis.fetch(url!, init)\n}\n"],"names":["parseRequest"],"mappings":";;AAWgB,SAAA,MAAM,OAAe,SAAkC;AACrE,QAAM,EAAE,KAAK,KAAA,IAASA,aAAAA,aAAa,OAAO,OAAO;AAC1C,SAAA,WAAW,MAAM,KAAM,IAAI;AACpC;;"}
1
+ {"version":3,"file":"fetch.cjs","sources":["../fetch.ts"],"sourcesContent":["import type { RequestOptions } from './utils/parseRequest'\nimport { parseRequest } from './utils/parseRequest'\n\n/**\n * Fetch a route with the provided options. This function will parse the route and\n * options to create a `Request` object and return the response from the server.\n *\n * @param route The name of the route to fetch.\n * @param options The options to pass to the request.\n * @returns The response from the server.\n * @example fetch('GET /users', { query: { limit: 10 } })\n */\nexport function fetch(route: string, options: RequestOptions = {}) {\n const { url, init } = parseRequest(route, options)\n return globalThis.fetch(url!, init)\n}\n"],"names":["parseRequest"],"mappings":";;AAYO,SAAS,MAAM,OAAe,UAA0B,IAAI;AACjE,QAAM,EAAE,KAAK,KAAA,IAASA,aAAAA,aAAa,OAAO,OAAO;AAC1C,SAAA,WAAW,MAAM,KAAM,IAAI;AACpC;;"}
package/dist/fetch.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ import { c as RequestOptions } from './chunks/DZp6zyqV.js';
2
+ import '@unshared/types';
3
+ import './chunks/8BFCFxqa.js';
4
+
1
5
  /**
2
6
  * Fetch a route with the provided options. This function will parse the route and
3
7
  * options to create a `Request` object and return the response from the server.
@@ -7,6 +11,6 @@
7
11
  * @returns The response from the server.
8
12
  * @example fetch('GET /users', { query: { limit: 10 } })
9
13
  */
10
- declare function fetch(route: string, options: Record<string, unknown>): Promise<Response>;
14
+ declare function fetch(route: string, options?: RequestOptions): Promise<Response>;
11
15
 
12
16
  export { fetch };
package/dist/fetch.js CHANGED
@@ -1,5 +1,5 @@
1
- import { p as parseRequest } from "./chunks/DvNxpeLr.js";
2
- function fetch(route, options) {
1
+ import { p as parseRequest } from "./chunks/B5hc73Po.js";
2
+ function fetch(route, options = {}) {
3
3
  const { url, init } = parseRequest(route, options);
4
4
  return globalThis.fetch(url, init);
5
5
  }
package/dist/fetch.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sources":["../fetch.ts"],"sourcesContent":["import { parseRequest } from './utils/parseRequest'\n\n/**\n * Fetch a route with the provided options. This function will parse the route and\n * options to create a `Request` object and return the response from the server.\n *\n * @param route The name of the route to fetch.\n * @param options The options to pass to the request.\n * @returns The response from the server.\n * @example fetch('GET /users', { query: { limit: 10 } })\n */\nexport function fetch(route: string, options: Record<string, unknown>) {\n const { url, init } = parseRequest(route, options)\n return globalThis.fetch(url!, init)\n}\n"],"names":[],"mappings":";AAWgB,SAAA,MAAM,OAAe,SAAkC;AACrE,QAAM,EAAE,KAAK,KAAA,IAAS,aAAa,OAAO,OAAO;AAC1C,SAAA,WAAW,MAAM,KAAM,IAAI;AACpC;"}
1
+ {"version":3,"file":"fetch.js","sources":["../fetch.ts"],"sourcesContent":["import type { RequestOptions } from './utils/parseRequest'\nimport { parseRequest } from './utils/parseRequest'\n\n/**\n * Fetch a route with the provided options. This function will parse the route and\n * options to create a `Request` object and return the response from the server.\n *\n * @param route The name of the route to fetch.\n * @param options The options to pass to the request.\n * @returns The response from the server.\n * @example fetch('GET /users', { query: { limit: 10 } })\n */\nexport function fetch(route: string, options: RequestOptions = {}) {\n const { url, init } = parseRequest(route, options)\n return globalThis.fetch(url!, init)\n}\n"],"names":[],"mappings":";AAYO,SAAS,MAAM,OAAe,UAA0B,IAAI;AACjE,QAAM,EAAE,KAAK,KAAA,IAAS,aAAa,OAAO,OAAO;AAC1C,SAAA,WAAW,MAAM,KAAM,IAAI;AACpC;"}
package/dist/index.cjs CHANGED
@@ -1,16 +1,19 @@
1
1
  "use strict";
2
- var createClient = require("./createClient.cjs"), fetch = require("./fetch.cjs");
3
- require("./openapi.cjs");
2
+ var createClient = require("./createClient.cjs"), fetch = require("./fetch.cjs"), openapi = require("./openapi.cjs");
4
3
  require("./utils.cjs");
5
- var index = require("./chunks/BzqHK4CV.cjs"), parseRequest = require("./chunks/Bul9W_0Q.cjs"), HttpHeader = /* @__PURE__ */ ((HttpHeader2) => (HttpHeader2["Accept-CH"] = "Accept-CH", HttpHeader2["Accept-Charset"] = "Accept-Charset", HttpHeader2["Accept-Encoding"] = "Accept-Encoding", HttpHeader2["Accept-Language"] = "Accept-Language", HttpHeader2["Accept-Patch"] = "Accept-Patch", HttpHeader2["Accept-Post"] = "Accept-Post", HttpHeader2["Accept-Ranges"] = "Accept-Ranges", HttpHeader2.Accept = "Accept", HttpHeader2["Access-Control-Allow-Credentials"] = "Access-Control-Allow-Credentials", HttpHeader2["Access-Control-Allow-Headers"] = "Access-Control-Allow-Headers", HttpHeader2["Access-Control-Allow-Methods"] = "Access-Control-Allow-Methods", HttpHeader2["Access-Control-Allow-Origin"] = "Access-Control-Allow-Origin", HttpHeader2["Access-Control-Expose-Headers"] = "Access-Control-Expose-Headers", HttpHeader2["Access-Control-Max-Age"] = "Access-Control-Max-Age", HttpHeader2["Access-Control-Request-Headers"] = "Access-Control-Request-Headers", HttpHeader2["Access-Control-Request-Method"] = "Access-Control-Request-Method", HttpHeader2.Age = "Age", HttpHeader2.Allow = "Allow", HttpHeader2["Alt-Svc"] = "Alt-Svc", HttpHeader2["Alt-Used"] = "Alt-Used", HttpHeader2["Attribution-Reporting-Eligible"] = "Attribution-Reporting-Eligible", HttpHeader2["Attribution-Reporting-Register-Source"] = "Attribution-Reporting-Register-Source", HttpHeader2["Attribution-Reporting-Register-Trigger"] = "Attribution-Reporting-Register-Trigger", HttpHeader2.Authorization = "Authorization", HttpHeader2["Cache-Control"] = "Cache-Control", HttpHeader2["Clear-Site-Data"] = "Clear-Site-Data", HttpHeader2.Connection = "Connection", HttpHeader2["Content-Digest"] = "Content-Digest", HttpHeader2["Content-Disposition"] = "Content-Disposition", HttpHeader2["Content-DPR"] = "Content-DPR", HttpHeader2["Content-Encoding"] = "Content-Encoding", HttpHeader2["Content-Language"] = "Content-Language", HttpHeader2["Content-Length"] = "Content-Length", HttpHeader2["Content-Location"] = "Content-Location", HttpHeader2["Content-Range"] = "Content-Range", HttpHeader2["Content-Security-Policy-Report-Only"] = "Content-Security-Policy-Report-Only", HttpHeader2["Content-Security-Policy"] = "Content-Security-Policy", HttpHeader2["Content-Type"] = "Content-Type", HttpHeader2.Cookie = "Cookie", HttpHeader2["Critical-CH"] = "Critical-CH", HttpHeader2["Cross-Origin-Embedder-Policy"] = "Cross-Origin-Embedder-Policy", HttpHeader2["Cross-Origin-Opener-Policy"] = "Cross-Origin-Opener-Policy", HttpHeader2["Cross-Origin-Resource-Policy"] = "Cross-Origin-Resource-Policy", HttpHeader2.Date = "Date", HttpHeader2["Device-Memory"] = "Device-Memory", HttpHeader2.Digest = "Digest", HttpHeader2.DNT = "DNT", HttpHeader2.Downlink = "Downlink", HttpHeader2.DPR = "DPR", HttpHeader2["Early-Data"] = "Early-Data", HttpHeader2.ECT = "ECT", HttpHeader2.ETag = "ETag", HttpHeader2["Expect-CT"] = "Expect-CT", HttpHeader2.Expect = "Expect", HttpHeader2.Expires = "Expires", HttpHeader2.Forwarded = "Forwarded", HttpHeader2.From = "From", HttpHeader2.Host = "Host", HttpHeader2["If-Match"] = "If-Match", HttpHeader2["If-Modified-Since"] = "If-Modified-Since", HttpHeader2["If-None-Match"] = "If-None-Match", HttpHeader2["If-Range"] = "If-Range", HttpHeader2["If-Unmodified-Since"] = "If-Unmodified-Since", HttpHeader2["Keep-Alive"] = "Keep-Alive", HttpHeader2["Last-Modified"] = "Last-Modified", HttpHeader2.Link = "Link", HttpHeader2.Location = "Location", HttpHeader2["Max-Forwards"] = "Max-Forwards", HttpHeader2.NEL = "NEL", HttpHeader2["No-Vary-Search"] = "No-Vary-Search", HttpHeader2["Observe-Browsing-Topics"] = "Observe-Browsing-Topics", HttpHeader2["Origin-Agent-Cluster"] = "Origin-Agent-Cluster", HttpHeader2.Origin = "Origin", HttpHeader2["Permissions-Policy"] = "Permissions-Policy", HttpHeader2.Pragma = "Pragma", HttpHeader2.Priority = "Priority", HttpHeader2["Proxy-Authenticate"] = "Proxy-Authenticate", HttpHeader2["Proxy-Authorization"] = "Proxy-Authorization", HttpHeader2.Range = "Range", HttpHeader2.Referer = "Referer", HttpHeader2["Referrer-Policy"] = "Referrer-Policy", HttpHeader2.Refresh = "Refresh", HttpHeader2["Report-To"] = "Report-To", HttpHeader2["Reporting-Endpoints"] = "Reporting-Endpoints", HttpHeader2["Repr-Digest"] = "Repr-Digest", HttpHeader2["Retry-After"] = "Retry-After", HttpHeader2.RTT = "RTT", HttpHeader2["Save-Data"] = "Save-Data", HttpHeader2["Sec-Browsing-Topics"] = "Sec-Browsing-Topics", HttpHeader2["Sec-CH-Prefers-Color-Scheme"] = "Sec-CH-Prefers-Color-Scheme", HttpHeader2["Sec-CH-Prefers-Reduced-Motion"] = "Sec-CH-Prefers-Reduced-Motion", HttpHeader2["Sec-CH-Prefers-Reduced-Transparency"] = "Sec-CH-Prefers-Reduced-Transparency", HttpHeader2["Sec-CH-UA-Arch"] = "Sec-CH-UA-Arch", HttpHeader2["Sec-CH-UA-Bitness"] = "Sec-CH-UA-Bitness", HttpHeader2["Sec-CH-UA-Full-Version-List"] = "Sec-CH-UA-Full-Version-List", HttpHeader2["Sec-CH-UA-Full-Version"] = "Sec-CH-UA-Full-Version", HttpHeader2["Sec-CH-UA-Mobile"] = "Sec-CH-UA-Mobile", HttpHeader2["Sec-CH-UA-Model"] = "Sec-CH-UA-Model", HttpHeader2["Sec-CH-UA-Platform-Version"] = "Sec-CH-UA-Platform-Version", HttpHeader2["Sec-CH-UA-Platform"] = "Sec-CH-UA-Platform", HttpHeader2["Sec-CH-UA"] = "Sec-CH-UA", HttpHeader2["Sec-Fetch-Dest"] = "Sec-Fetch-Dest", HttpHeader2["Sec-Fetch-Mode"] = "Sec-Fetch-Mode", HttpHeader2["Sec-Fetch-Site"] = "Sec-Fetch-Site", HttpHeader2["Sec-Fetch-User"] = "Sec-Fetch-User", HttpHeader2["Sec-GPC"] = "Sec-GPC", HttpHeader2["Sec-Purpose"] = "Sec-Purpose", HttpHeader2["Sec-WebSocket-Accept"] = "Sec-WebSocket-Accept", HttpHeader2["Sec-WebSocket-Extensions"] = "Sec-WebSocket-Extensions", HttpHeader2["Sec-WebSocket-Key"] = "Sec-WebSocket-Key", HttpHeader2["Sec-WebSocket-Protocol"] = "Sec-WebSocket-Protocol", HttpHeader2["Sec-WebSocket-Version"] = "Sec-WebSocket-Version", HttpHeader2["Server-Timing"] = "Server-Timing", HttpHeader2.Server = "Server", HttpHeader2["Service-Worker-Navigation-Preload"] = "Service-Worker-Navigation-Preload", HttpHeader2["Set-Cookie"] = "Set-Cookie", HttpHeader2["Set-Login"] = "Set-Login", HttpHeader2.SourceMap = "SourceMap", HttpHeader2["Speculation-Rules"] = "Speculation-Rules", HttpHeader2["Strict-Transport-Security"] = "Strict-Transport-Security", HttpHeader2["Supports-Loading-Mode"] = "Supports-Loading-Mode", HttpHeader2.TE = "TE", HttpHeader2["Timing-Allow-Origin"] = "Timing-Allow-Origin", HttpHeader2.Tk = "Tk", HttpHeader2.Trailer = "Trailer", HttpHeader2["Transfer-Encoding"] = "Transfer-Encoding", HttpHeader2["Upgrade-Insecure-Requests"] = "Upgrade-Insecure-Requests", HttpHeader2.Upgrade = "Upgrade", HttpHeader2["User-Agent"] = "User-Agent", HttpHeader2.Vary = "Vary", HttpHeader2.Via = "Via", HttpHeader2["Viewport-Width"] = "Viewport-Width", HttpHeader2["Want-Content-Digest"] = "Want-Content-Digest", HttpHeader2["Want-Digest"] = "Want-Digest", HttpHeader2["Want-Repr-Digest"] = "Want-Repr-Digest", HttpHeader2.Warning = "Warning", HttpHeader2.Width = "Width", HttpHeader2["WWW-Authenticate"] = "WWW-Authenticate", HttpHeader2["X-Content-Type-Options"] = "X-Content-Type-Options", HttpHeader2["X-DNS-Prefetch-Control"] = "X-DNS-Prefetch-Control", HttpHeader2["X-Forwarded-For"] = "X-Forwarded-For", HttpHeader2["X-Forwarded-Host"] = "X-Forwarded-Host", HttpHeader2["X-Forwarded-Proto"] = "X-Forwarded-Proto", HttpHeader2["X-Frame-Options"] = "X-Frame-Options", HttpHeader2["X-XSS-Protection"] = "X-XSS-Protection", HttpHeader2))(HttpHeader || {}), HttpMethod = /* @__PURE__ */ ((HttpMethod2) => (HttpMethod2.CONNECT = "CONNECT", HttpMethod2.DELETE = "DELETE", HttpMethod2.GET = "GET", HttpMethod2.HEAD = "HEAD", HttpMethod2.OPTIONS = "OPTIONS", HttpMethod2.PATCH = "PATCH", HttpMethod2.POST = "POST", HttpMethod2.PUT = "PUT", HttpMethod2.TRACE = "TRACE", HttpMethod2))(HttpMethod || {}), HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => (HttpStatusCode2[HttpStatusCode2.CONTINUE = 100] = "CONTINUE", HttpStatusCode2[HttpStatusCode2.SWITCHING_PROTOCOLS = 101] = "SWITCHING_PROTOCOLS", HttpStatusCode2[HttpStatusCode2.PROCESSING = 102] = "PROCESSING", HttpStatusCode2[HttpStatusCode2.EARLY_HINTS = 103] = "EARLY_HINTS", HttpStatusCode2[HttpStatusCode2.OK = 200] = "OK", HttpStatusCode2[HttpStatusCode2.CREATED = 201] = "CREATED", HttpStatusCode2[HttpStatusCode2.ACCEPTED = 202] = "ACCEPTED", HttpStatusCode2[HttpStatusCode2.NON_AUTHORITATIVE_INFORMATION = 203] = "NON_AUTHORITATIVE_INFORMATION", HttpStatusCode2[HttpStatusCode2.NO_CONTENT = 204] = "NO_CONTENT", HttpStatusCode2[HttpStatusCode2.RESET_CONTENT = 205] = "RESET_CONTENT", HttpStatusCode2[HttpStatusCode2.PARTIAL_CONTENT = 206] = "PARTIAL_CONTENT", HttpStatusCode2[HttpStatusCode2.MULTI_STATUS = 207] = "MULTI_STATUS", HttpStatusCode2[HttpStatusCode2.ALREADY_REPORTED = 208] = "ALREADY_REPORTED", HttpStatusCode2[HttpStatusCode2.IM_USED = 226] = "IM_USED", HttpStatusCode2[HttpStatusCode2.MULTIPLE_CHOICES = 300] = "MULTIPLE_CHOICES", HttpStatusCode2[HttpStatusCode2.MOVED_PERMANENTLY = 301] = "MOVED_PERMANENTLY", HttpStatusCode2[HttpStatusCode2.FOUND = 302] = "FOUND", HttpStatusCode2[HttpStatusCode2.SEE_OTHER = 303] = "SEE_OTHER", HttpStatusCode2[HttpStatusCode2.NOT_MODIFIED = 304] = "NOT_MODIFIED", HttpStatusCode2[HttpStatusCode2.TEMPORARY_REDIRECT = 307] = "TEMPORARY_REDIRECT", HttpStatusCode2[HttpStatusCode2.PERMANENT_REDIRECT = 308] = "PERMANENT_REDIRECT", HttpStatusCode2[HttpStatusCode2.BAD_REQUEST = 400] = "BAD_REQUEST", HttpStatusCode2[HttpStatusCode2.UNAUTHORIZED = 401] = "UNAUTHORIZED", HttpStatusCode2[HttpStatusCode2.PAYMENT_REQUIRED = 402] = "PAYMENT_REQUIRED", HttpStatusCode2[HttpStatusCode2.FORBIDDEN = 403] = "FORBIDDEN", HttpStatusCode2[HttpStatusCode2.NOT_FOUND = 404] = "NOT_FOUND", HttpStatusCode2[HttpStatusCode2.METHOD_NOT_ALLOWED = 405] = "METHOD_NOT_ALLOWED", HttpStatusCode2[HttpStatusCode2.NOT_ACCEPTABLE = 406] = "NOT_ACCEPTABLE", HttpStatusCode2[HttpStatusCode2.PROXY_AUTHENTICATION_REQUIRED = 407] = "PROXY_AUTHENTICATION_REQUIRED", HttpStatusCode2[HttpStatusCode2.REQUEST_TIMEOUT = 408] = "REQUEST_TIMEOUT", HttpStatusCode2[HttpStatusCode2.CONFLICT = 409] = "CONFLICT", HttpStatusCode2[HttpStatusCode2.GONE = 410] = "GONE", HttpStatusCode2[HttpStatusCode2.LENGTH_REQUIRED = 411] = "LENGTH_REQUIRED", HttpStatusCode2[HttpStatusCode2.PRECONDITION_FAILED = 412] = "PRECONDITION_FAILED", HttpStatusCode2[HttpStatusCode2.CONTENT_TOO_LARGE = 413] = "CONTENT_TOO_LARGE", HttpStatusCode2[HttpStatusCode2.URI_TOO_LONG = 414] = "URI_TOO_LONG", HttpStatusCode2[HttpStatusCode2.UNSUPPORTED_MEDIA_TYPE = 415] = "UNSUPPORTED_MEDIA_TYPE", HttpStatusCode2[HttpStatusCode2.RANGE_NOT_SATISFIABLE = 416] = "RANGE_NOT_SATISFIABLE", HttpStatusCode2[HttpStatusCode2.EXPECTATION_FAILED = 417] = "EXPECTATION_FAILED", HttpStatusCode2[HttpStatusCode2.I_M_A_TEAPOT = 418] = "I_M_A_TEAPOT", HttpStatusCode2[HttpStatusCode2.MISDIRECTED_REQUEST = 421] = "MISDIRECTED_REQUEST", HttpStatusCode2[HttpStatusCode2.UNPROCESSABLE_CONTENT = 422] = "UNPROCESSABLE_CONTENT", HttpStatusCode2[HttpStatusCode2.LOCKED = 423] = "LOCKED", HttpStatusCode2[HttpStatusCode2.FAILED_DEPENDENCY = 424] = "FAILED_DEPENDENCY", HttpStatusCode2[HttpStatusCode2.TOO_EARLY = 425] = "TOO_EARLY", HttpStatusCode2[HttpStatusCode2.UPGRADE_REQUIRED = 426] = "UPGRADE_REQUIRED", HttpStatusCode2[HttpStatusCode2.PRECONDITION_REQUIRED = 428] = "PRECONDITION_REQUIRED", HttpStatusCode2[HttpStatusCode2.TOO_MANY_REQUESTS = 429] = "TOO_MANY_REQUESTS", HttpStatusCode2[HttpStatusCode2.REQUEST_HEADER_FIELDS_TOO_LARGE = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE", HttpStatusCode2[HttpStatusCode2.UNAVAILABLE_FOR_LEGAL_REASONS = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS", HttpStatusCode2[HttpStatusCode2.INTERNAL_SERVER_ERROR = 500] = "INTERNAL_SERVER_ERROR", HttpStatusCode2[HttpStatusCode2.NOT_IMPLEMENTED = 501] = "NOT_IMPLEMENTED", HttpStatusCode2[HttpStatusCode2.BAD_GATEWAY = 502] = "BAD_GATEWAY", HttpStatusCode2[HttpStatusCode2.SERVICE_UNAVAILABLE = 503] = "SERVICE_UNAVAILABLE", HttpStatusCode2[HttpStatusCode2.GATEWAY_TIMEOUT = 504] = "GATEWAY_TIMEOUT", HttpStatusCode2[HttpStatusCode2.HTTP_VERSION_NOT_SUPPORTED = 505] = "HTTP_VERSION_NOT_SUPPORTED", HttpStatusCode2[HttpStatusCode2.VARIANT_ALSO_NEGOTIATES = 506] = "VARIANT_ALSO_NEGOTIATES", HttpStatusCode2[HttpStatusCode2.INSUFFICIENT_STORAGE = 507] = "INSUFFICIENT_STORAGE", HttpStatusCode2[HttpStatusCode2.LOOP_DETECTED = 508] = "LOOP_DETECTED", HttpStatusCode2[HttpStatusCode2.NOT_EXTENDED = 510] = "NOT_EXTENDED", HttpStatusCode2[HttpStatusCode2.NETWORK_AUTHENTICATION_REQUIRED = 511] = "NETWORK_AUTHENTICATION_REQUIRED", HttpStatusCode2))(HttpStatusCode || {});
4
+ var getOperationById = require("./chunks/xRZPkxch.cjs"), handleResponse = require("./chunks/Cx8m1YzL.cjs"), parseRequest = require("./chunks/D8Tsm7xC.cjs");
5
+ require("@unshared/functions/awaitable");
6
+ var HttpHeader = /* @__PURE__ */ ((HttpHeader2) => (HttpHeader2["Accept-CH"] = "Accept-CH", HttpHeader2["Accept-Charset"] = "Accept-Charset", HttpHeader2["Accept-Encoding"] = "Accept-Encoding", HttpHeader2["Accept-Language"] = "Accept-Language", HttpHeader2["Accept-Patch"] = "Accept-Patch", HttpHeader2["Accept-Post"] = "Accept-Post", HttpHeader2["Accept-Ranges"] = "Accept-Ranges", HttpHeader2.Accept = "Accept", HttpHeader2["Access-Control-Allow-Credentials"] = "Access-Control-Allow-Credentials", HttpHeader2["Access-Control-Allow-Headers"] = "Access-Control-Allow-Headers", HttpHeader2["Access-Control-Allow-Methods"] = "Access-Control-Allow-Methods", HttpHeader2["Access-Control-Allow-Origin"] = "Access-Control-Allow-Origin", HttpHeader2["Access-Control-Expose-Headers"] = "Access-Control-Expose-Headers", HttpHeader2["Access-Control-Max-Age"] = "Access-Control-Max-Age", HttpHeader2["Access-Control-Request-Headers"] = "Access-Control-Request-Headers", HttpHeader2["Access-Control-Request-Method"] = "Access-Control-Request-Method", HttpHeader2.Age = "Age", HttpHeader2.Allow = "Allow", HttpHeader2["Alt-Svc"] = "Alt-Svc", HttpHeader2["Alt-Used"] = "Alt-Used", HttpHeader2["Attribution-Reporting-Eligible"] = "Attribution-Reporting-Eligible", HttpHeader2["Attribution-Reporting-Register-Source"] = "Attribution-Reporting-Register-Source", HttpHeader2["Attribution-Reporting-Register-Trigger"] = "Attribution-Reporting-Register-Trigger", HttpHeader2.Authorization = "Authorization", HttpHeader2["Cache-Control"] = "Cache-Control", HttpHeader2["Clear-Site-Data"] = "Clear-Site-Data", HttpHeader2.Connection = "Connection", HttpHeader2["Content-Digest"] = "Content-Digest", HttpHeader2["Content-Disposition"] = "Content-Disposition", HttpHeader2["Content-DPR"] = "Content-DPR", HttpHeader2["Content-Encoding"] = "Content-Encoding", HttpHeader2["Content-Language"] = "Content-Language", HttpHeader2["Content-Length"] = "Content-Length", HttpHeader2["Content-Location"] = "Content-Location", HttpHeader2["Content-Range"] = "Content-Range", HttpHeader2["Content-Security-Policy-Report-Only"] = "Content-Security-Policy-Report-Only", HttpHeader2["Content-Security-Policy"] = "Content-Security-Policy", HttpHeader2["Content-Type"] = "Content-Type", HttpHeader2.Cookie = "Cookie", HttpHeader2["Critical-CH"] = "Critical-CH", HttpHeader2["Cross-Origin-Embedder-Policy"] = "Cross-Origin-Embedder-Policy", HttpHeader2["Cross-Origin-Opener-Policy"] = "Cross-Origin-Opener-Policy", HttpHeader2["Cross-Origin-Resource-Policy"] = "Cross-Origin-Resource-Policy", HttpHeader2.Date = "Date", HttpHeader2["Device-Memory"] = "Device-Memory", HttpHeader2.Digest = "Digest", HttpHeader2.DNT = "DNT", HttpHeader2.Downlink = "Downlink", HttpHeader2.DPR = "DPR", HttpHeader2["Early-Data"] = "Early-Data", HttpHeader2.ECT = "ECT", HttpHeader2.ETag = "ETag", HttpHeader2["Expect-CT"] = "Expect-CT", HttpHeader2.Expect = "Expect", HttpHeader2.Expires = "Expires", HttpHeader2.Forwarded = "Forwarded", HttpHeader2.From = "From", HttpHeader2.Host = "Host", HttpHeader2["If-Match"] = "If-Match", HttpHeader2["If-Modified-Since"] = "If-Modified-Since", HttpHeader2["If-None-Match"] = "If-None-Match", HttpHeader2["If-Range"] = "If-Range", HttpHeader2["If-Unmodified-Since"] = "If-Unmodified-Since", HttpHeader2["Keep-Alive"] = "Keep-Alive", HttpHeader2["Last-Modified"] = "Last-Modified", HttpHeader2.Link = "Link", HttpHeader2.Location = "Location", HttpHeader2["Max-Forwards"] = "Max-Forwards", HttpHeader2.NEL = "NEL", HttpHeader2["No-Vary-Search"] = "No-Vary-Search", HttpHeader2["Observe-Browsing-Topics"] = "Observe-Browsing-Topics", HttpHeader2["Origin-Agent-Cluster"] = "Origin-Agent-Cluster", HttpHeader2.Origin = "Origin", HttpHeader2["Permissions-Policy"] = "Permissions-Policy", HttpHeader2.Pragma = "Pragma", HttpHeader2.Priority = "Priority", HttpHeader2["Proxy-Authenticate"] = "Proxy-Authenticate", HttpHeader2["Proxy-Authorization"] = "Proxy-Authorization", HttpHeader2.Range = "Range", HttpHeader2.Referer = "Referer", HttpHeader2["Referrer-Policy"] = "Referrer-Policy", HttpHeader2.Refresh = "Refresh", HttpHeader2["Report-To"] = "Report-To", HttpHeader2["Reporting-Endpoints"] = "Reporting-Endpoints", HttpHeader2["Repr-Digest"] = "Repr-Digest", HttpHeader2["Retry-After"] = "Retry-After", HttpHeader2.RTT = "RTT", HttpHeader2["Save-Data"] = "Save-Data", HttpHeader2["Sec-Browsing-Topics"] = "Sec-Browsing-Topics", HttpHeader2["Sec-CH-Prefers-Color-Scheme"] = "Sec-CH-Prefers-Color-Scheme", HttpHeader2["Sec-CH-Prefers-Reduced-Motion"] = "Sec-CH-Prefers-Reduced-Motion", HttpHeader2["Sec-CH-Prefers-Reduced-Transparency"] = "Sec-CH-Prefers-Reduced-Transparency", HttpHeader2["Sec-CH-UA-Arch"] = "Sec-CH-UA-Arch", HttpHeader2["Sec-CH-UA-Bitness"] = "Sec-CH-UA-Bitness", HttpHeader2["Sec-CH-UA-Full-Version-List"] = "Sec-CH-UA-Full-Version-List", HttpHeader2["Sec-CH-UA-Full-Version"] = "Sec-CH-UA-Full-Version", HttpHeader2["Sec-CH-UA-Mobile"] = "Sec-CH-UA-Mobile", HttpHeader2["Sec-CH-UA-Model"] = "Sec-CH-UA-Model", HttpHeader2["Sec-CH-UA-Platform-Version"] = "Sec-CH-UA-Platform-Version", HttpHeader2["Sec-CH-UA-Platform"] = "Sec-CH-UA-Platform", HttpHeader2["Sec-CH-UA"] = "Sec-CH-UA", HttpHeader2["Sec-Fetch-Dest"] = "Sec-Fetch-Dest", HttpHeader2["Sec-Fetch-Mode"] = "Sec-Fetch-Mode", HttpHeader2["Sec-Fetch-Site"] = "Sec-Fetch-Site", HttpHeader2["Sec-Fetch-User"] = "Sec-Fetch-User", HttpHeader2["Sec-GPC"] = "Sec-GPC", HttpHeader2["Sec-Purpose"] = "Sec-Purpose", HttpHeader2["Sec-WebSocket-Accept"] = "Sec-WebSocket-Accept", HttpHeader2["Sec-WebSocket-Extensions"] = "Sec-WebSocket-Extensions", HttpHeader2["Sec-WebSocket-Key"] = "Sec-WebSocket-Key", HttpHeader2["Sec-WebSocket-Protocol"] = "Sec-WebSocket-Protocol", HttpHeader2["Sec-WebSocket-Version"] = "Sec-WebSocket-Version", HttpHeader2["Server-Timing"] = "Server-Timing", HttpHeader2.Server = "Server", HttpHeader2["Service-Worker-Navigation-Preload"] = "Service-Worker-Navigation-Preload", HttpHeader2["Set-Cookie"] = "Set-Cookie", HttpHeader2["Set-Login"] = "Set-Login", HttpHeader2.SourceMap = "SourceMap", HttpHeader2["Speculation-Rules"] = "Speculation-Rules", HttpHeader2["Strict-Transport-Security"] = "Strict-Transport-Security", HttpHeader2["Supports-Loading-Mode"] = "Supports-Loading-Mode", HttpHeader2.TE = "TE", HttpHeader2["Timing-Allow-Origin"] = "Timing-Allow-Origin", HttpHeader2.Tk = "Tk", HttpHeader2.Trailer = "Trailer", HttpHeader2["Transfer-Encoding"] = "Transfer-Encoding", HttpHeader2["Upgrade-Insecure-Requests"] = "Upgrade-Insecure-Requests", HttpHeader2.Upgrade = "Upgrade", HttpHeader2["User-Agent"] = "User-Agent", HttpHeader2.Vary = "Vary", HttpHeader2.Via = "Via", HttpHeader2["Viewport-Width"] = "Viewport-Width", HttpHeader2["Want-Content-Digest"] = "Want-Content-Digest", HttpHeader2["Want-Digest"] = "Want-Digest", HttpHeader2["Want-Repr-Digest"] = "Want-Repr-Digest", HttpHeader2.Warning = "Warning", HttpHeader2.Width = "Width", HttpHeader2["WWW-Authenticate"] = "WWW-Authenticate", HttpHeader2["X-Content-Type-Options"] = "X-Content-Type-Options", HttpHeader2["X-DNS-Prefetch-Control"] = "X-DNS-Prefetch-Control", HttpHeader2["X-Forwarded-For"] = "X-Forwarded-For", HttpHeader2["X-Forwarded-Host"] = "X-Forwarded-Host", HttpHeader2["X-Forwarded-Proto"] = "X-Forwarded-Proto", HttpHeader2["X-Frame-Options"] = "X-Frame-Options", HttpHeader2["X-XSS-Protection"] = "X-XSS-Protection", HttpHeader2))(HttpHeader || {}), HttpMethod = /* @__PURE__ */ ((HttpMethod2) => (HttpMethod2.CONNECT = "CONNECT", HttpMethod2.DELETE = "DELETE", HttpMethod2.GET = "GET", HttpMethod2.HEAD = "HEAD", HttpMethod2.OPTIONS = "OPTIONS", HttpMethod2.PATCH = "PATCH", HttpMethod2.POST = "POST", HttpMethod2.PUT = "PUT", HttpMethod2.TRACE = "TRACE", HttpMethod2))(HttpMethod || {}), HttpStatusCode = /* @__PURE__ */ ((HttpStatusCode2) => (HttpStatusCode2[HttpStatusCode2.CONTINUE = 100] = "CONTINUE", HttpStatusCode2[HttpStatusCode2.SWITCHING_PROTOCOLS = 101] = "SWITCHING_PROTOCOLS", HttpStatusCode2[HttpStatusCode2.PROCESSING = 102] = "PROCESSING", HttpStatusCode2[HttpStatusCode2.EARLY_HINTS = 103] = "EARLY_HINTS", HttpStatusCode2[HttpStatusCode2.OK = 200] = "OK", HttpStatusCode2[HttpStatusCode2.CREATED = 201] = "CREATED", HttpStatusCode2[HttpStatusCode2.ACCEPTED = 202] = "ACCEPTED", HttpStatusCode2[HttpStatusCode2.NON_AUTHORITATIVE_INFORMATION = 203] = "NON_AUTHORITATIVE_INFORMATION", HttpStatusCode2[HttpStatusCode2.NO_CONTENT = 204] = "NO_CONTENT", HttpStatusCode2[HttpStatusCode2.RESET_CONTENT = 205] = "RESET_CONTENT", HttpStatusCode2[HttpStatusCode2.PARTIAL_CONTENT = 206] = "PARTIAL_CONTENT", HttpStatusCode2[HttpStatusCode2.MULTI_STATUS = 207] = "MULTI_STATUS", HttpStatusCode2[HttpStatusCode2.ALREADY_REPORTED = 208] = "ALREADY_REPORTED", HttpStatusCode2[HttpStatusCode2.IM_USED = 226] = "IM_USED", HttpStatusCode2[HttpStatusCode2.MULTIPLE_CHOICES = 300] = "MULTIPLE_CHOICES", HttpStatusCode2[HttpStatusCode2.MOVED_PERMANENTLY = 301] = "MOVED_PERMANENTLY", HttpStatusCode2[HttpStatusCode2.FOUND = 302] = "FOUND", HttpStatusCode2[HttpStatusCode2.SEE_OTHER = 303] = "SEE_OTHER", HttpStatusCode2[HttpStatusCode2.NOT_MODIFIED = 304] = "NOT_MODIFIED", HttpStatusCode2[HttpStatusCode2.TEMPORARY_REDIRECT = 307] = "TEMPORARY_REDIRECT", HttpStatusCode2[HttpStatusCode2.PERMANENT_REDIRECT = 308] = "PERMANENT_REDIRECT", HttpStatusCode2[HttpStatusCode2.BAD_REQUEST = 400] = "BAD_REQUEST", HttpStatusCode2[HttpStatusCode2.UNAUTHORIZED = 401] = "UNAUTHORIZED", HttpStatusCode2[HttpStatusCode2.PAYMENT_REQUIRED = 402] = "PAYMENT_REQUIRED", HttpStatusCode2[HttpStatusCode2.FORBIDDEN = 403] = "FORBIDDEN", HttpStatusCode2[HttpStatusCode2.NOT_FOUND = 404] = "NOT_FOUND", HttpStatusCode2[HttpStatusCode2.METHOD_NOT_ALLOWED = 405] = "METHOD_NOT_ALLOWED", HttpStatusCode2[HttpStatusCode2.NOT_ACCEPTABLE = 406] = "NOT_ACCEPTABLE", HttpStatusCode2[HttpStatusCode2.PROXY_AUTHENTICATION_REQUIRED = 407] = "PROXY_AUTHENTICATION_REQUIRED", HttpStatusCode2[HttpStatusCode2.REQUEST_TIMEOUT = 408] = "REQUEST_TIMEOUT", HttpStatusCode2[HttpStatusCode2.CONFLICT = 409] = "CONFLICT", HttpStatusCode2[HttpStatusCode2.GONE = 410] = "GONE", HttpStatusCode2[HttpStatusCode2.LENGTH_REQUIRED = 411] = "LENGTH_REQUIRED", HttpStatusCode2[HttpStatusCode2.PRECONDITION_FAILED = 412] = "PRECONDITION_FAILED", HttpStatusCode2[HttpStatusCode2.CONTENT_TOO_LARGE = 413] = "CONTENT_TOO_LARGE", HttpStatusCode2[HttpStatusCode2.URI_TOO_LONG = 414] = "URI_TOO_LONG", HttpStatusCode2[HttpStatusCode2.UNSUPPORTED_MEDIA_TYPE = 415] = "UNSUPPORTED_MEDIA_TYPE", HttpStatusCode2[HttpStatusCode2.RANGE_NOT_SATISFIABLE = 416] = "RANGE_NOT_SATISFIABLE", HttpStatusCode2[HttpStatusCode2.EXPECTATION_FAILED = 417] = "EXPECTATION_FAILED", HttpStatusCode2[HttpStatusCode2.I_M_A_TEAPOT = 418] = "I_M_A_TEAPOT", HttpStatusCode2[HttpStatusCode2.MISDIRECTED_REQUEST = 421] = "MISDIRECTED_REQUEST", HttpStatusCode2[HttpStatusCode2.UNPROCESSABLE_CONTENT = 422] = "UNPROCESSABLE_CONTENT", HttpStatusCode2[HttpStatusCode2.LOCKED = 423] = "LOCKED", HttpStatusCode2[HttpStatusCode2.FAILED_DEPENDENCY = 424] = "FAILED_DEPENDENCY", HttpStatusCode2[HttpStatusCode2.TOO_EARLY = 425] = "TOO_EARLY", HttpStatusCode2[HttpStatusCode2.UPGRADE_REQUIRED = 426] = "UPGRADE_REQUIRED", HttpStatusCode2[HttpStatusCode2.PRECONDITION_REQUIRED = 428] = "PRECONDITION_REQUIRED", HttpStatusCode2[HttpStatusCode2.TOO_MANY_REQUESTS = 429] = "TOO_MANY_REQUESTS", HttpStatusCode2[HttpStatusCode2.REQUEST_HEADER_FIELDS_TOO_LARGE = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE", HttpStatusCode2[HttpStatusCode2.UNAVAILABLE_FOR_LEGAL_REASONS = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS", HttpStatusCode2[HttpStatusCode2.INTERNAL_SERVER_ERROR = 500] = "INTERNAL_SERVER_ERROR", HttpStatusCode2[HttpStatusCode2.NOT_IMPLEMENTED = 501] = "NOT_IMPLEMENTED", HttpStatusCode2[HttpStatusCode2.BAD_GATEWAY = 502] = "BAD_GATEWAY", HttpStatusCode2[HttpStatusCode2.SERVICE_UNAVAILABLE = 503] = "SERVICE_UNAVAILABLE", HttpStatusCode2[HttpStatusCode2.GATEWAY_TIMEOUT = 504] = "GATEWAY_TIMEOUT", HttpStatusCode2[HttpStatusCode2.HTTP_VERSION_NOT_SUPPORTED = 505] = "HTTP_VERSION_NOT_SUPPORTED", HttpStatusCode2[HttpStatusCode2.VARIANT_ALSO_NEGOTIATES = 506] = "VARIANT_ALSO_NEGOTIATES", HttpStatusCode2[HttpStatusCode2.INSUFFICIENT_STORAGE = 507] = "INSUFFICIENT_STORAGE", HttpStatusCode2[HttpStatusCode2.LOOP_DETECTED = 508] = "LOOP_DETECTED", HttpStatusCode2[HttpStatusCode2.NOT_EXTENDED = 510] = "NOT_EXTENDED", HttpStatusCode2[HttpStatusCode2.NETWORK_AUTHENTICATION_REQUIRED = 511] = "NETWORK_AUTHENTICATION_REQUIRED", HttpStatusCode2))(HttpStatusCode || {});
6
7
  exports.createClient = createClient.createClient;
7
8
  exports.fetch = fetch.fetch;
8
- exports.getBaseUrl = index.getBaseUrl;
9
- exports.getOperationById = index.getOperationById;
10
- exports.getOperationByRoute = index.getOperationByRoute;
11
- exports.isReferenceObject = index.isReferenceObject;
12
- exports.resolveDocument = index.resolveDocument;
13
- exports.resolveReference = index.resolveReference;
9
+ exports.getOperationByRoute = openapi.getOperationByRoute;
10
+ exports.isReferenceObject = openapi.isReferenceObject;
11
+ exports.resolveDocument = openapi.resolveDocument;
12
+ exports.resolveReference = openapi.resolveReference;
13
+ exports.getBaseUrl = getOperationById.getBaseUrl;
14
+ exports.getOperationById = getOperationById.getOperationById;
15
+ exports.handleResponse = handleResponse.handleResponse;
16
+ exports.handleResponseStreamJson = handleResponse.handleResponseStreamJson;
14
17
  exports.isFormDataLike = parseRequest.isFormDataLike;
15
18
  exports.isObjectLike = parseRequest.isObjectLike;
16
19
  exports.parseRequest = parseRequest.parseRequest;