@zimic/http 0.1.0-canary.17 → 0.1.0-canary.19
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/chunk-7A4JDAZZ.mjs +63 -63
- package/dist/chunk-7A4JDAZZ.mjs.map +1 -1
- package/dist/chunk-VEQ424IU.js +63 -63
- package/dist/chunk-VEQ424IU.js.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
- package/src/headers/HttpHeaders.ts +11 -9
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../zimic-utils/dist/chunk-PAWJFY3S.mjs","../../zimic-utils/src/data/blobEquals.ts","../../zimic-utils/src/data/fileEquals.ts","../src/formData/HttpFormData.ts","../src/headers/HttpHeaders.ts","../src/searchParams/HttpSearchParams.ts","../src/types/schema.ts"],"names":["__defProp","__name","pickPrimitiveProperties"],"mappings":";;;;;;AAAA,IAAIA,aAAY,MAAO,CAAA,cAAA;AACvB,IAAIC,OAAS,mBAAA,MAAA,CAAA,CAAC,MAAQ,EAAA,KAAA,KAAUD,UAAU,CAAA,MAAA,EAAQ,MAAQ,EAAA,EAAE,KAAO,EAAA,YAAA,EAAc,IAAK,EAAC,CAA1E,EAAA,QAAA,CAAA;;;ACDb,eAAe,UAAA,CAAW,MAAY,SAAiB,EAAA;AACrD,EAAA,OACE,IAAK,CAAA,IAAA,KAAS,SAAU,CAAA,IAAA,IAAQ,KAAK,IAAS,KAAA,SAAA,CAAU,IAAS,IAAA,MAAM,IAAK,CAAA,IAAA,EAAa,KAAA,MAAM,UAAU,IAAK,EAAA;AAElH;AAJe,MAAA,CAAA,UAAA,EAAA,YAAA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AAC;AAIhB,IAAA,KAAA,MAAW,CAAC,GAAK,EAAA,KAAK,CAAK,IAAA,IAAA,CAAK,SAAW,EAAA;AACzC,MAAA,IAAI,OAAO,MAAQ,EAAA;AACjB,QAAM,MAAA,aAAA,GAAgB,OAAO,GAAG,CAAA;AAEhC,QAAI,IAAA,KAAA,CAAM,OAAqB,CAAA,aAAa,CAAG,EAAA;AAC7C,UAAA,aAAA,CAAc,KAAK,KAAoB,CAAA;AAAA,SAClC,MAAA;AACL,UAAA,MAAA,CAAO,GAAG,CAAA,GAAI,CAAC,aAAA,EAAe,KAAK,CAAA;AAAA;AACrC,OACK,MAAA;AACL,QAAA,MAAA,CAAO,GAAG,CAAI,GAAA,KAAA;AAAA;AAChB;AAGF,IAAO,OAAA,MAAA;AAAA;AAEX,CAAA;AAEA,IAAO,wBAAQ,GAAA;;;ACzPF,IAAA,8BAAA,GAAiC,OAAO,MAAO,CAAA,CAAC,QAAQ,KAAO,EAAA,OAAA,EAAS,QAAQ,CAAU;AAG1F,IAAA,+BAAA,GAAkC,OAAO,MAAO,CAAA;AAAA,EAC3D,KAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAU;AAGG,IAAA,YAAA,GAAe,MAAO,CAAA,MAAA,CAAO,CAAC,KAAA,EAAO,MAAQ,EAAA,KAAA,EAAO,OAAS,EAAA,QAAA,EAAU,MAAQ,EAAA,SAAS,CAAU","file":"index.js","sourcesContent":["var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\nexport { __name };\n//# sourceMappingURL=chunk-PAWJFY3S.mjs.map\n//# sourceMappingURL=chunk-PAWJFY3S.mjs.map","async function blobEquals(blob: Blob, otherBlob: Blob) {\n return (\n blob.type === otherBlob.type && blob.size === otherBlob.size && (await blob.text()) === (await otherBlob.text())\n );\n}\n\nexport default blobEquals;\n","import blobEquals from './blobEquals';\n\nasync function fileEquals(file: File, otherFile: File) {\n return file.name === otherFile.name && (await blobEquals(file, otherFile));\n}\n\nexport default fileEquals;\n","import fileEquals from '@zimic/utils/data/fileEquals';\nimport { ArrayItemIfArray, ReplaceBy } from '@zimic/utils/types';\n\nimport { HttpFormDataSchema, HttpFormDataSchemaName } from './types';\n\n/**\n * An extended HTTP form data object with a strictly-typed schema. Fully compatible with the built-in\n * {@link https://developer.mozilla.org/docs/Web/API/FormData `FormData`} class.\n *\n * **IMPORTANT**: the input of `HttpFormData` and all of its internal types must be declared inline or as a type aliases\n * (`type`). They cannot be interfaces.\n *\n * @example\n * import { HttpFormData } from '@zimic/http';\n *\n * const formData = new HttpFormData<{\n * files: File[];\n * description?: string;\n * }>();\n *\n * formData.append('file', new File(['content'], 'file.txt', { type: 'text/plain' }));\n * formData.append('description', 'My file');\n *\n * const files = formData.getAll('file');\n * console.log(files); // [File { name: 'file.txt', type: 'text/plain' }]\n *\n * const description = formData.get('description');\n * console.log(description); // 'My file'\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpformdata `HttpFormData` API reference}\n */\nclass HttpFormData<Schema extends HttpFormDataSchema = HttpFormDataSchema> extends FormData {\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/set MDN Reference} */\n set<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n value: Exclude<ArrayItemIfArray<NonNullable<Schema[Name]>>, Blob>,\n ): void;\n set<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n blob: Exclude<ArrayItemIfArray<NonNullable<Schema[Name]>>, string>,\n fileName?: string,\n ): void;\n set<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n blobOrValue: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n fileName?: string,\n ): void {\n if (fileName === undefined) {\n super.set(name, blobOrValue as Blob);\n } else {\n super.set(name, blobOrValue as Blob, fileName);\n }\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/append MDN Reference} */\n append<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n value: Exclude<ArrayItemIfArray<NonNullable<Schema[Name]>>, Blob>,\n ): void;\n append<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n blob: Exclude<ArrayItemIfArray<NonNullable<Schema[Name]>>, string>,\n fileName?: string,\n ): void;\n append<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n blobOrValue: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n fileName?: string,\n ): void {\n if (fileName === undefined) {\n super.append(name, blobOrValue as Blob);\n } else {\n super.append(name, blobOrValue as Blob, fileName);\n }\n }\n\n /**\n * Get the value of the entry associated to a key name.\n *\n * If the key might have multiple values, use {@link HttpFormData#getAll} instead.\n *\n * @param name The name of the key to get the value of.\n * @returns The value associated with the key name, or `null` if the key does not exist.\n * @see {@link https://developer.mozilla.org/docs/Web/API/FormData/get MDN Reference}\n */\n get<Name extends HttpFormDataSchemaName.NonArray<Schema>>(\n name: Name,\n ): ReplaceBy<ReplaceBy<ArrayItemIfArray<Schema[Name]>, undefined, null>, Blob, File> {\n return super.get(name) as ReplaceBy<ReplaceBy<ArrayItemIfArray<Schema[Name]>, undefined, null>, Blob, File>;\n }\n\n /**\n * Get all the values of the entry associated with a key name.\n *\n * If the key has at most a single value, use {@link HttpFormData#get} instead.\n *\n * @param name The name of the key to get the values of.\n * @returns An array of values associated with the key name, or an empty array if the key does not exist.\n * @see {@link https://developer.mozilla.org/docs/Web/API/FormData/getAll MDN Reference}\n */\n getAll<Name extends HttpFormDataSchemaName.Array<Schema>>(\n name: Name,\n ): ReplaceBy<ArrayItemIfArray<NonNullable<Schema[Name]>>, Blob, File>[] {\n return super.getAll(name) as ReplaceBy<ArrayItemIfArray<NonNullable<Schema[Name]>>, Blob, File>[];\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/has MDN Reference} */\n has<Name extends HttpFormDataSchemaName<Schema>>(name: Name): boolean {\n return super.has(name);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/delete MDN Reference} */\n delete<Name extends HttpFormDataSchemaName<Schema>>(name: Name): void {\n super.delete(name);\n }\n\n forEach<This extends HttpFormData<Schema>>(\n callback: <Key extends HttpFormDataSchemaName<Schema>>(\n value: ReplaceBy<ArrayItemIfArray<NonNullable<Schema[Key]>>, Blob, File>,\n key: Key,\n parent: HttpFormData<Schema>,\n ) => void,\n thisArg?: This,\n ): void {\n super.forEach(callback as (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/keys MDN Reference} */\n keys(): FormDataIterator<HttpFormDataSchemaName<Schema>> {\n return super.keys() as FormDataIterator<HttpFormDataSchemaName<Schema>>;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/values MDN Reference} */\n values(): FormDataIterator<\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>\n > {\n return super.values() as FormDataIterator<\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>\n >;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/entries MDN Reference} */\n entries(): FormDataIterator<\n [\n HttpFormDataSchemaName<Schema>,\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>,\n ]\n > {\n return super.entries() as FormDataIterator<\n [\n HttpFormDataSchemaName<Schema>,\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>,\n ]\n >;\n }\n\n [Symbol.iterator](): FormDataIterator<\n [\n HttpFormDataSchemaName<Schema>,\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>,\n ]\n > {\n return super[Symbol.iterator]() as FormDataIterator<\n [\n HttpFormDataSchemaName<Schema>,\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>,\n ]\n >;\n }\n\n /**\n * Checks if the data is equal to the other data. Equality is defined as having the same keys and values, regardless\n * of the order of keys.\n *\n * @param otherData The other data to compare.\n * @returns A promise that resolves with `true` if the data is equal to the other data, or `false` otherwise.\n * Important: both form data might be read while comparing.\n */\n async equals<OtherSchema extends Schema>(otherData: HttpFormData<OtherSchema>): Promise<boolean> {\n for (const [otherKey, otherValue] of otherData.entries()) {\n const values = super.getAll.call(this, otherKey);\n\n const haveSameNumberOfValues = values.length === super.getAll.call(otherData, otherKey).length;\n if (!haveSameNumberOfValues) {\n return false;\n }\n\n let valueExists = false;\n\n for (const value of values) {\n if (\n value === otherValue ||\n (value instanceof Blob && otherValue instanceof Blob && (await fileEquals(value, otherValue)))\n ) {\n valueExists = true;\n break;\n }\n }\n\n if (!valueExists) {\n return false;\n }\n }\n\n for (const key of this.keys()) {\n const otherHasKey = super.has.call(otherData, key);\n if (!otherHasKey) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Checks if the data contains the other data. This method is less strict than {@link HttpFormData#equals} and only\n * requires that all keys and values in the other data are present in this data.\n *\n * @param otherData The other data to compare.\n * @returns A promise that resolves with `true` if this data contains the other data, or `false` otherwise. Important:\n * both form data might be read while comparing.\n */\n async contains<OtherSchema extends Schema>(otherData: HttpFormData<OtherSchema>): Promise<boolean> {\n for (const [otherKey, otherValue] of otherData.entries()) {\n const values = super.getAll.call(this, otherKey);\n\n const haveCompatibleNumberOfValues = values.length >= super.getAll.call(otherData, otherKey).length;\n if (!haveCompatibleNumberOfValues) {\n return false;\n }\n\n let valueExists = false;\n\n for (const value of values) {\n if (\n value === otherValue ||\n (typeof value === 'string' && typeof otherValue === 'string' && value === otherValue) ||\n (value instanceof Blob && otherValue instanceof Blob && (await fileEquals(value, otherValue)))\n ) {\n valueExists = true;\n break;\n }\n }\n\n if (!valueExists) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Converts this form data into a plain object. This method is useful for serialization and debugging purposes.\n *\n * **NOTE**: If a key has multiple values, the object will contain an array of values for that key. If the key has\n * only one value, the object will contain its value directly, without an array, regardless of how the value was\n * initialized when creating the form data.\n *\n * @example\n * const formData = new HttpFormData<{\n * title: string;\n * descriptions: string[];\n * content: Blob;\n * }>();\n *\n * formData.set('title', 'My title');\n * formData.append('descriptions', 'Description 1');\n * formData.append('descriptions', 'Description 2');\n * formData.set('content', new Blob(['content'], { type: 'text/plain' }));\n *\n * const object = formData.toObject();\n * console.log(object); // { title: 'My title', descriptions: ['Description 1', 'Description 2'], content: Blob { type: 'text/plain' } }\n *\n * @returns A plain object representation of this form data.\n */\n toObject() {\n const object = {} as Schema;\n\n type SchemaValue = Schema[HttpFormDataSchemaName<Schema>];\n\n for (const [key, value] of this.entries()) {\n if (key in object) {\n const existingValue = object[key];\n\n if (Array.isArray<SchemaValue>(existingValue)) {\n existingValue.push(value as SchemaValue);\n } else {\n object[key] = [existingValue, value] as SchemaValue;\n }\n } else {\n object[key] = value as SchemaValue;\n }\n }\n\n return object;\n }\n}\n\nexport default HttpFormData;\n","import { Default, ReplaceBy } from '@zimic/utils/types';\n\nimport { HttpHeadersSchema, HttpHeadersInit, HttpHeadersSchemaName } from './types';\n\nfunction pickPrimitiveProperties<Schema extends HttpHeadersSchema>(schema: Schema) {\n return Object.entries(schema).reduce<Record<string, string>>((accumulated, [key, value]) => {\n if (value !== undefined) {\n accumulated[key] = value;\n }\n return accumulated;\n }, {});\n}\n\n/**\n * An extended HTTP headers object with a strictly-typed schema. Fully compatible with the built-in\n * {@link https://developer.mozilla.org/docs/Web/API/Headers `Headers`} class.\n *\n * **IMPORTANT**: the input of `HttpHeaders` and all of its internal types must be declared inline or as a type aliases\n * (`type`). They cannot be interfaces.\n *\n * @example\n * import { HttpHeaders } from '@zimic/http';\n *\n * const headers = new HttpHeaders<{\n * accept?: string;\n * 'content-type'?: string;\n * }>({\n * accept: '*',\n * 'content-type': 'application/json',\n * });\n *\n * const contentType = headers.get('content-type');\n * console.log(contentType); // 'application/json'\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpheaders `HttpHeaders` API reference}\n */\nclass HttpHeaders<Schema extends HttpHeadersSchema = HttpHeadersSchema> extends Headers {\n constructor(init?: HttpHeadersInit<Schema>) {\n if (init instanceof Headers || Array.isArray(init) || !init) {\n super(init);\n } else {\n super(pickPrimitiveProperties(init));\n }\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/set MDN Reference} */\n set<Name extends HttpHeadersSchemaName<Schema>>(name: Name, value: NonNullable<Schema[Name]>): void {\n super.set(name, value);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/append MDN Reference} */\n append<Name extends HttpHeadersSchemaName<Schema>>(name: Name, value: NonNullable<Schema[Name]>): void {\n super.append(name, value);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/get MDN Reference} */\n get<Name extends HttpHeadersSchemaName<Schema>>(name: Name): ReplaceBy<Schema[Name], undefined, null> {\n return super.get(name) as ReplaceBy<Schema[Name], undefined, null>;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/has MDN Reference} */\n getSetCookie(): NonNullable<Default<Schema['Set-Cookie'], string>>[] {\n return super.getSetCookie() as NonNullable<Default<Schema['Set-Cookie'], string>>[];\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/has MDN Reference} */\n has<Name extends HttpHeadersSchemaName<Schema>>(name: Name): boolean {\n return super.has(name);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/delete MDN Reference} */\n delete<Name extends HttpHeadersSchemaName<Schema>>(name: Name): void {\n super.delete(name);\n }\n\n forEach<This extends HttpHeaders<Schema>>(\n callback: <Key extends HttpHeadersSchemaName<Schema>>(\n value: NonNullable<Schema[Key]>,\n key: Key,\n parent: Headers,\n ) => void,\n thisArg?: This,\n ): void {\n super.forEach(callback as (value: string, key: string, parent: Headers) => void, thisArg);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/keys MDN Reference} */\n keys(): HeadersIterator<HttpHeadersSchemaName<Schema>> {\n return super.keys() as HeadersIterator<HttpHeadersSchemaName<Schema>>;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/values MDN Reference} */\n values(): HeadersIterator<NonNullable<Schema[HttpHeadersSchemaName<Schema>]>> {\n return super.values() as HeadersIterator<NonNullable<Schema[HttpHeadersSchemaName<Schema>]>>;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/entries MDN Reference} */\n entries(): HeadersIterator<[HttpHeadersSchemaName<Schema>, NonNullable<Schema[HttpHeadersSchemaName<Schema>]>]> {\n return super.entries() as HeadersIterator<\n [HttpHeadersSchemaName<Schema>, NonNullable<Schema[HttpHeadersSchemaName<Schema>]>]\n >;\n }\n\n [Symbol.iterator](): HeadersIterator<\n [HttpHeadersSchemaName<Schema>, NonNullable<Schema[HttpHeadersSchemaName<Schema>]>]\n > {\n return super[Symbol.iterator]() as HeadersIterator<\n [HttpHeadersSchemaName<Schema>, NonNullable<Schema[HttpHeadersSchemaName<Schema>]>]\n >;\n }\n\n /**\n * Checks if this headers object is equal to another set of headers. Equality is defined as having the same keys and\n * values, regardless of the order of keys.\n *\n * @param otherHeaders The other headers object to compare against.\n * @returns `true` if the headers are equal, `false` otherwise.\n */\n equals<OtherSchema extends Schema>(otherHeaders: HttpHeaders<OtherSchema>): boolean {\n for (const [key, otherValue] of otherHeaders.entries()) {\n const value = super.get.call(this, key);\n\n if (value === null) {\n return false;\n }\n\n const valueItems = this.splitHeaderValues(value);\n const otherValueItems = this.splitHeaderValues(otherValue);\n\n const haveCompatibleNumberOfValues = valueItems.length === otherValueItems.length;\n if (!haveCompatibleNumberOfValues) {\n return false;\n }\n\n for (const otherValueItem of otherValueItems) {\n if (!valueItems.includes(otherValueItem)) {\n return false;\n }\n }\n }\n\n for (const key of this.keys()) {\n const otherHasKey = super.has.call(otherHeaders, key);\n if (!otherHasKey) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Checks if this headers object contains another set of headers. This method is less strict than\n * {@link HttpHeaders#equals} and only requires that all keys and values in the other headers are present in these\n * headers.\n *\n * @param otherHeaders The other headers object to compare against.\n * @returns `true` if these headers contain the other headers, `false` otherwise.\n */\n contains<OtherSchema extends Schema>(otherHeaders: HttpHeaders<OtherSchema>): boolean {\n for (const [key, otherValue] of otherHeaders.entries()) {\n const value = super.get.call(this, key);\n\n if (value === null) {\n return false;\n }\n\n const valueItems = this.splitHeaderValues(value);\n const otherValueItems = this.splitHeaderValues(otherValue);\n\n const haveCompatibleNumberOfValues = valueItems.length >= otherValueItems.length;\n if (!haveCompatibleNumberOfValues) {\n return false;\n }\n\n for (const otherValueItem of otherValueItems) {\n if (!valueItems.includes(otherValueItem)) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /**\n * Converts these headers into a plain object. This method is useful for serialization and debugging purposes.\n *\n * @example\n * const headers = new HttpHeaders({\n * accept: 'application/json',\n * 'content-type': 'application/json',\n * });\n * const object = headers.toObject();\n * console.log(object); // { accept: 'application/json', 'content-type': 'application/json' }\n *\n * @returns A plain object representation of these headers.\n */\n toObject(): Schema {\n const object = {} as Schema;\n\n for (const [key, value] of this.entries()) {\n object[key] = value;\n }\n\n return object;\n }\n\n private splitHeaderValues(value: string) {\n return value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item.length > 0);\n }\n}\n\nexport default HttpHeaders;\n","import { ReplaceBy, ArrayItemIfArray } from '@zimic/utils/types';\n\nimport { HttpSearchParamsSchema, HttpSearchParamsInit, HttpSearchParamsSchemaName } from './types';\n\nfunction pickPrimitiveProperties<Schema extends HttpSearchParamsSchema>(schema: Schema) {\n const schemaWithPrimitiveProperties = Object.entries(schema).reduce<Record<string, string>>(\n (accumulated, [key, value]) => {\n if (value !== undefined && !Array.isArray(value)) {\n accumulated[key] = value;\n }\n return accumulated;\n },\n {},\n );\n return schemaWithPrimitiveProperties;\n}\n\n/**\n * An extended HTTP search params object with a strictly-typed schema. Fully compatible with the built-in\n * {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams `URLSearchParams`} class.\n *\n * **IMPORTANT**: the input of `HttpSearchParams` and all of its internal types must be declared inline or as a type\n * aliases (`type`). They cannot be interfaces.\n *\n * @example\n * import { HttpSearchParams } from '@zimic/http';\n *\n * const searchParams = new HttpSearchParams<{\n * names?: string[];\n * page?: `${number}`;\n * }>({\n * names: ['user 1', 'user 2'],\n * page: '1',\n * });\n *\n * const names = searchParams.getAll('names');\n * console.log(names); // ['user 1', 'user 2']\n *\n * const page = searchParams.get('page');\n * console.log(page); // '1'\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpsearchparams `HttpSearchParams` API reference}\n */\nclass HttpSearchParams<Schema extends HttpSearchParamsSchema = HttpSearchParamsSchema> extends URLSearchParams {\n constructor(init?: HttpSearchParamsInit<Schema>) {\n if (init instanceof URLSearchParams || Array.isArray(init) || typeof init === 'string' || !init) {\n super(init);\n } else {\n super(pickPrimitiveProperties(init));\n this.populateInitArrayProperties(init);\n }\n }\n\n private populateInitArrayProperties(init: Schema) {\n for (const [key, value] of Object.entries(init)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n super.append(key, item);\n }\n }\n }\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/set MDN Reference} */\n set<Name extends HttpSearchParamsSchemaName<Schema>>(\n name: Name,\n value: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n ): void {\n super.set(name, value);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/append MDN Reference} */\n append<Name extends HttpSearchParamsSchemaName<Schema>>(\n name: Name,\n value: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n ): void {\n super.append(name, value);\n }\n\n /**\n * Get the value of the entry associated to a key name.\n *\n * If the key might have multiple values, use {@link HttpSearchParams#getAll} instead.\n *\n * @param name The name of the key to get the value of.\n * @returns The value associated with the key name, or `null` if the key does not exist.\n * @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/get MDN Reference}\n */\n get<Name extends HttpSearchParamsSchemaName.NonArray<Schema>>(\n name: Name,\n ): ReplaceBy<ArrayItemIfArray<Schema[Name]>, undefined, null> {\n return super.get(name) as ReplaceBy<ArrayItemIfArray<Schema[Name]>, undefined, null>;\n }\n\n /**\n * Get all the values of the entry associated with a key name.\n *\n * If the key has at most one value, use {@link HttpSearchParams#get} instead.\n *\n * @param name The name of the key to get the values of.\n * @returns An array of values associated with the key name, or an empty array if the key does not exist.\n * @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll MDN Reference}\n */\n getAll<Name extends HttpSearchParamsSchemaName.Array<Schema>>(\n name: Name,\n ): ArrayItemIfArray<NonNullable<Schema[Name]>>[] {\n return super.getAll(name) as ArrayItemIfArray<NonNullable<Schema[Name]>>[];\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/has MDN Reference} */\n has<Name extends HttpSearchParamsSchemaName<Schema>>(\n name: Name,\n value?: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n ): boolean {\n return super.has(name, value);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete MDN Reference} */\n delete<Name extends HttpSearchParamsSchemaName<Schema>>(\n name: Name,\n value?: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n ): void {\n super.delete(name, value);\n }\n\n forEach<This extends HttpSearchParams<Schema>>(\n callback: <Key extends HttpSearchParamsSchemaName<Schema>>(\n value: ArrayItemIfArray<NonNullable<Schema[Key]>>,\n key: Key,\n parent: HttpSearchParams<Schema>,\n ) => void,\n thisArg?: This,\n ): void {\n super.forEach(callback as (value: string, key: string, parent: URLSearchParams) => void, thisArg);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/keys MDN Reference} */\n keys(): URLSearchParamsIterator<HttpSearchParamsSchemaName<Schema>> {\n return super.keys() as URLSearchParamsIterator<HttpSearchParamsSchemaName<Schema>>;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/values MDN Reference} */\n values(): URLSearchParamsIterator<ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>> {\n return super.values() as URLSearchParamsIterator<\n ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>\n >;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/entries MDN Reference} */\n entries(): URLSearchParamsIterator<\n [HttpSearchParamsSchemaName<Schema>, ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>]\n > {\n return super.entries() as URLSearchParamsIterator<\n [HttpSearchParamsSchemaName<Schema>, ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>]\n >;\n }\n\n [Symbol.iterator](): URLSearchParamsIterator<\n [HttpSearchParamsSchemaName<Schema>, ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>]\n > {\n return super[Symbol.iterator]() as URLSearchParamsIterator<\n [HttpSearchParamsSchemaName<Schema>, ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>]\n >;\n }\n\n /**\n * Checks if these search params are equal to another set of search parameters. Equality is defined as having the same\n * keys and values, regardless of the order of the keys.\n *\n * @param otherParams The other search parameters to compare against.\n * @returns `true` if the search parameters are equal, `false` otherwise.\n */\n equals<OtherSchema extends Schema>(otherParams: HttpSearchParams<OtherSchema>): boolean {\n for (const [key, otherValue] of otherParams.entries()) {\n const values = super.getAll.call(this, key);\n\n const haveSameNumberOfValues = values.length === super.getAll.call(otherParams, key).length;\n if (!haveSameNumberOfValues) {\n return false;\n }\n\n const valueExists = values.includes(otherValue);\n if (!valueExists) {\n return false;\n }\n }\n\n return this.size === otherParams.size;\n }\n\n /**\n * Checks if these search params contain another set of search parameters. This method is less strict than\n * {@link HttpSearchParams#equals} and only requires that all keys and values in the other search parameters are\n * present in these search parameters.\n *\n * @param otherParams The other search parameters to check for containment.\n * @returns `true` if these search parameters contain the other search parameters, `false` otherwise.\n */\n contains<OtherSchema extends Schema>(otherParams: HttpSearchParams<OtherSchema>): boolean {\n for (const [key, otherValue] of otherParams.entries()) {\n const values = super.getAll.call(this, key);\n\n const haveCompatibleNumberOfValues = values.length >= super.getAll.call(otherParams, key).length;\n if (!haveCompatibleNumberOfValues) {\n return false;\n }\n\n const valueExists = values.includes(otherValue);\n if (!valueExists) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Converts these search params into a plain object. This method is useful for serialization and debugging purposes.\n *\n * **NOTE**: If a key has multiple values, the object will contain an array of values for that key. If the key has\n * only one value, the object will contain its value directly, without an array, regardless of how the value was\n * initialized when creating the search params object.\n *\n * @example\n * const searchParams = new HttpSearchParams({\n * names: ['user 1', 'user 2'],\n * name: ['user 3'],\n * page: '1',\n * });\n * const object = searchParams.toObject();\n * console.log(object); // { names: ['user 1', 'user 2'], name: 'user 3', page: '1' }\n *\n * @returns A plain object representation of these search params.\n */\n toObject() {\n const object = {} as Schema;\n\n type SchemaValue = Schema[HttpSearchParamsSchemaName<Schema>];\n\n for (const [key, value] of this.entries()) {\n if (key in object) {\n const existingValue = object[key];\n\n if (Array.isArray<SchemaValue>(existingValue)) {\n existingValue.push(value as SchemaValue);\n } else {\n object[key] = [existingValue, value] as SchemaValue;\n }\n } else {\n object[key] = value as SchemaValue;\n }\n }\n\n return object;\n }\n}\n\nexport default HttpSearchParams;\n","import { IfAny, UnionToIntersection, UnionHasMoreThanOneType, Prettify, NonEmptyArray } from '@zimic/utils/types';\n\nimport { HttpFormDataSchema, HttpFormDataSerialized } from '../formData/types';\nimport { HttpHeadersSchema, HttpHeadersSerialized } from '../headers/types';\nimport { HttpPathParamsSchema, HttpPathParamsSerialized } from '../pathParams/types';\nimport { HttpSearchParamsSchema, HttpSearchParamsSerialized } from '../searchParams/types';\nimport { HttpBody } from './requests';\n\nexport const HTTP_METHODS_WITH_REQUEST_BODY = Object.freeze(['POST', 'PUT', 'PATCH', 'DELETE'] as const);\nexport type HttpMethodWithRequestBody = (typeof HTTP_METHODS_WITH_REQUEST_BODY)[number];\n\nexport const HTTP_METHODS_WITH_RESPONSE_BODY = Object.freeze([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n] as const);\nexport type HttpMethodWithResponseBody = (typeof HTTP_METHODS_WITH_RESPONSE_BODY)[number];\n\nexport const HTTP_METHODS = Object.freeze(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'] as const);\n/**\n * A type representing the currently supported\n * {@link https://developer.mozilla.org/docs/Web/HTTP/Methods `HTTP methods`}.\n */\nexport type HttpMethod = (typeof HTTP_METHODS)[number];\n\n/**\n * A schema representing the structure of an HTTP request.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport interface HttpRequestSchema {\n headers?: HttpHeadersSchema.Loose;\n searchParams?: HttpSearchParamsSchema.Loose;\n body?: HttpBody.Loose;\n}\n\ntype ConvertToStrictHttpRequestSchema<Schema> = {\n [Key in keyof Schema]: Key extends 'headers'\n ? HttpHeadersSerialized<Schema[Key]>\n : Key extends 'searchParams'\n ? HttpSearchParamsSerialized<Schema[Key]>\n : Key extends 'body'\n ? HttpBody.ConvertToStrict<Schema[Key]>\n : Schema[Key];\n};\n\n/**\n * A schema representing the structure of an HTTP response.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport interface HttpResponseSchema {\n headers?: HttpHeadersSchema.Loose;\n body?: HttpBody.Loose;\n}\n\nexport namespace HttpResponseSchema {\n /** A schema representing the structure of an HTTP response with no body. */\n export interface NoBody extends Omit<HttpResponseSchema, 'body'> {\n body?: null;\n }\n}\n\ntype ConvertToStrictHttpResponseSchema<Schema> = ConvertToStrictHttpRequestSchema<Schema>;\n\n/**\n * The status codes used in HTTP responses, as defined by\n * {@link https://httpwg.org/specs/rfc9110.html#overview.of.status.codes RFC-9110}.\n *\n * - `HttpStatusCode.Information`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#information_responses `1XX`}\n * - `HttpStatusCode.Success`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#successful_responses `2XX`}\n * - `HttpStatusCode.Redirection`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#redirection_messages `3XX`}\n * - `HttpStatusCode.ClientError`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#client_error_responses `4XX`}\n * - `HttpStatusCode.ServerError`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#server_error_responses `5XX`}\n */\nexport namespace HttpStatusCode {\n /**\n * An HTTP status code in the `1XX` range, representing an informational response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#information_responses `1XX`}\n */\n export type Information =\n | 100 // Continue\n | 101 // Switching Protocols\n | 102 // Processing\n | 103; // Early Hints\n\n /**\n * An HTTP status code in the `2XX` range, representing a successful response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#successful_responses `2XX`}\n */\n export type Success =\n | 200 // OK\n | 201 // Created\n | 202 // Accepted\n | 203 // Non-Authoritative Information\n | 204 // No Content\n | 205 // Reset Content\n | 206 // Partial Content\n | 207 // Multi-Status\n | 208 // Already Reported\n | 226; // IM Used\n\n /**\n * An HTTP status code in the `3XX` range, representing a redirection response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#redirection_messages `3XX`}\n */\n export type Redirection =\n | 300 // Multiple Choices\n | 301 // Moved Permanently\n | 302 // Found\n | 303 // See Other\n | 304 // Not Modified\n | 307 // Temporary Redirect\n | 308; // Permanent Redirect\n\n /**\n * An HTTP status code in the `4XX` range, representing a client error response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#client_error_responses `4XX`}\n */\n export type ClientError =\n | 400 // Bad Request\n | 401 // Unauthorized\n | 402 // Payment Required\n | 403 // Forbidden\n | 404 // Not Found\n | 405 // Method Not Allowed\n | 406 // Not Acceptable\n | 407 // Proxy Authentication Required\n | 408 // Request Timeout\n | 409 // Conflict\n | 410 // Gone\n | 411 // Length Required\n | 412 // Precondition Failed\n | 413 // Content Too Large\n | 414 // URI Too Long\n | 415 // Unsupported Media Type\n | 416 // Range Not Satisfiable\n | 417 // Expectation Failed\n | 418 // I'm a teapot\n | 421 // Misdirected Request\n | 422 // Unprocessable Content\n | 423 // Locked\n | 424 // Failed Dependency\n | 425 // Too Early\n | 426 // Upgrade Required\n | 428 // Precondition Required\n | 429 // Too Many Requests\n | 431 // Request Header Fields Too Large\n | 451; // Unavailable For Legal Reasons\n\n /**\n * An HTTP status code in the `5XX` range, representing a server error response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#server_error_responses `5XX`}\n */\n export type ServerError =\n | 500 // Internal Server Error\n | 501 // Not Implemented\n | 502 // Bad Gateway\n | 503 // Service Unavailable\n | 504 // Gateway Timeout\n | 505 // HTTP Version Not Supported\n | 506 // Variant Also Negotiates\n | 507 // Insufficient Storage\n | 508 // Loop Detected\n | 510 // Not Extended\n | 511; // Network Authentication Required\n}\n\nexport type HttpStatusCode =\n | HttpStatusCode.Information\n | HttpStatusCode.Success\n | HttpStatusCode.Redirection\n | HttpStatusCode.ClientError\n | HttpStatusCode.ServerError;\n\nexport namespace HttpResponseSchemaByStatusCode {\n /** A loose version of HTTP responses by status code. JSON values are not strictly typed. */\n export type Loose = {\n [StatusCode in HttpStatusCode]?: HttpResponseSchema;\n };\n\n /**\n * Converts a possibly loose HTTP response schema by status code to be strictly typed. JSON values are serialized to\n * their strict form.\n */\n export type ConvertToStrict<Schema extends Loose> = {\n [StatusCode in keyof Schema]: StatusCode extends 204 ? HttpResponseSchema.NoBody : Schema[StatusCode];\n };\n\n /** A schema representing the structure of HTTP responses by status code with no body. */\n export type NoBody = {\n [StatusCode in HttpStatusCode]?: HttpResponseSchema.NoBody;\n };\n}\n\n/**\n * A schema representing the structure of HTTP responses by status code.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpResponseSchemaByStatusCode =\n HttpResponseSchemaByStatusCode.ConvertToStrict<HttpResponseSchemaByStatusCode.Loose>;\n\ntype ConvertToStrictHttpResponseSchemaByStatusCode<Schema> = {\n [Key in keyof Schema]: ConvertToStrictHttpResponseSchema<Schema[Key]>;\n};\n\n/**\n * Extracts the status codes used in a response schema by status code.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpResponseSchemaStatusCode<ResponseSchemaByStatusCode extends HttpResponseSchemaByStatusCode> =\n keyof ResponseSchemaByStatusCode & HttpStatusCode;\n\n/**\n * A schema representing the structure of an HTTP request and response for a given method.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport interface HttpMethodSchema {\n request?: HttpRequestSchema;\n response?: HttpResponseSchemaByStatusCode;\n}\n\nexport namespace HttpMethodSchema {\n /** A schema representing the structure of an HTTP request and response for a given method, having no request body. */\n export interface NoRequestBody extends Omit<HttpMethodSchema, 'request'> {\n request?: Omit<HttpRequestSchema, 'body'> & { body?: null };\n }\n\n /**\n * A schema representing the structure of an HTTP request and response for a given method, having no request and\n * response bodies.\n */\n export interface NoBody extends Omit<NoRequestBody, 'response'> {\n response?: HttpResponseSchemaByStatusCode.NoBody;\n }\n}\n\ntype ConvertToStrictMethod<Schema> = {\n [Key in keyof Schema]: Key extends 'request'\n ? ConvertToStrictHttpRequestSchema<Schema[Key]>\n : Key extends 'response'\n ? ConvertToStrictHttpResponseSchemaByStatusCode<Schema[Key]>\n : Schema[Key];\n};\n\n/**\n * A schema representing the structure of HTTP request and response by method.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport interface HttpMethodsSchema {\n GET?: HttpMethodSchema.NoRequestBody;\n POST?: HttpMethodSchema;\n PUT?: HttpMethodSchema;\n PATCH?: HttpMethodSchema;\n DELETE?: HttpMethodSchema;\n HEAD?: HttpMethodSchema.NoBody;\n OPTIONS?: HttpMethodSchema.NoRequestBody;\n}\n\ntype ConvertToStrictHttpMethodsSchema<Schema> = {\n [Method in keyof Schema]: ConvertToStrictMethod<Schema[Method]>;\n};\n\ninterface BaseHttpSchema {\n [path: string]: HttpMethodsSchema;\n}\n\nexport type ConvertToStrictHttpSchema<Schema extends HttpSchema> = {\n [Path in keyof Schema]: ConvertToStrictHttpMethodsSchema<Schema[Path]>;\n};\n\n/**\n * Declares an HTTP service schema.\n *\n * **IMPORTANT**: the input of `HttpSchema` and all of its internal types, except bodies, must be declared inline or as\n * a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * interface UserListHeaders {\n * accept: string;\n * }\n *\n * interface UserListSearchParams {\n * name?: string;\n * limit?: `${number}`;\n * }\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * request: {\n * headers: UserListHeaders;\n * searchParams: UserListSearchParams;\n * };\n * response: {\n * 200: {\n * // Inline headers declaration\n * headers: { 'content-type': string };\n * body: User[];\n * };\n * };\n * };\n * };\n * }>;\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpSchema<Schema extends BaseHttpSchema = BaseHttpSchema> = ConvertToStrictHttpSchema<Schema>;\n\nexport namespace HttpSchema {\n /**\n * Declares an HTTP service methods schema.\n *\n * **IMPORTANT**: the input of `HttpSchema.Methods` and all of its internal types, except bodies, must be declared\n * inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserMethods = HttpSchema.Methods<{\n * GET: {\n * response: {\n * 200: { body: User[] };\n * };\n * };\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': UserMethods;\n * }>;\n */\n export type Methods<Schema extends HttpMethodsSchema> = ConvertToStrictHttpMethodsSchema<Schema>;\n\n /**\n * Declares an HTTP service method schema.\n *\n * **IMPORTANT**: the input of `HttpSchema.Method` and all of its internal types, except bodies, must be declared\n * inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListMethod = HttpSchema.Method<{\n * response: {\n * 200: { body: User[] };\n * };\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: UserListMethod;\n * };\n * }>;\n */\n export type Method<Schema extends HttpMethodSchema> = ConvertToStrictMethod<Schema>;\n\n /**\n * Declares an HTTP service request schema.\n *\n * **IMPORTANT**: the input of `HttpSchema.Request` and all of its internal types, except bodies, must be declared\n * inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserCreationRequest = HttpSchema.Request<{\n * headers: { 'content-type': 'application/json' };\n * body: User;\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * POST: {\n * request: UserCreationRequest;\n * response: {\n * 201: { body: User };\n * };\n * };\n * };\n * }>;\n */\n export type Request<Schema extends HttpRequestSchema> = ConvertToStrictHttpRequestSchema<Schema>;\n\n /**\n * Declares an HTTP service response schema by status code.\n *\n * **IMPORTANT**: the input of `HttpSchema.ResponseByStatusCode` and all of its internal types, except bodies, must be\n * declared inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListResponseByStatusCode = HttpSchema.ResponseByStatusCode<{\n * 200: { body: User[] };\n * 400: { body: { message: string } };\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: UserListResponseByStatusCode;\n * };\n * };\n * }>;\n */\n export type ResponseByStatusCode<Schema extends HttpResponseSchemaByStatusCode> =\n ConvertToStrictHttpResponseSchemaByStatusCode<Schema>;\n\n /**\n * Declares an HTTP service response schema.\n *\n * **IMPORTANT**: the input of `HttpSchema.Response` and all of its internal types, except bodies, must be declared\n * inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListSuccessResponse = HttpSchema.Response<{\n * body: User[];\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: {\n * 200: UserListSuccessResponse;\n * };\n * };\n * };\n * }>;\n */\n export type Response<Schema extends HttpResponseSchema> = ConvertToStrictHttpResponseSchema<Schema>;\n\n /**\n * Declares an HTTP body schema. JSON values are serialized to their strict form using\n * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic#jsonserialized `JSONSerialized`} if necessary.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListSuccessResponseBody = HttpSchema.Body<User[]>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: {\n * 200: { body: UserListSuccessResponseBody };\n * };\n * };\n * };\n * }>;\n */\n export type Body<Schema extends HttpBody.Loose> = HttpBody.ConvertToStrict<Schema>;\n\n /**\n * Declares an HTTP headers schema. Headers are serialized to their strict form using\n * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpheadersserialized `HttpHeadersSerialized`} if\n * necessary.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListHeaders = HttpSchema.Headers<{\n * accept: 'application/json';\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * request: {\n * headers: UserListHeaders;\n * };\n * response: {\n * 200: { body: User[] };\n * };\n * };\n * };\n * }>;\n */\n export type Headers<Schema extends HttpHeadersSchema.Loose> = HttpHeadersSerialized<Schema>;\n\n /**\n * Declares an HTTP search params schema. Search params are serialized to their strict form using\n * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpsearchparamsserialized `HttpSearchParamsSerialized`}\n * if necessary.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListSearchParams = HttpSchema.SearchParams<{\n * limit: `${number}`;\n * offset: `${number}`;\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * request: {\n * searchParams: UserListSearchParams;\n * };\n * response: {\n * 200: { body: User[] };\n * };\n * };\n * };\n * }>;\n */\n export type SearchParams<Schema extends HttpSearchParamsSchema.Loose> = HttpSearchParamsSerialized<Schema>;\n\n /**\n * Declares an HTTP path params schema. Path params are serialized to their strict form using\n * {@link HttpPathParamsSerialized} if necessary.\n *\n * @example\n * import { type HttpSchema, InferPathParams } from '@zimic/http';\n *\n * type Schema = HttpSchema<{\n * '/users/:userId': {\n * GET: {\n * response: {\n * 200: { body: User };\n * };\n * };\n * };\n * }>;\n *\n * type UserByIdPathParams = HttpSchema.PathParams<{\n * userId: string;\n * }>;\n *\n * // Or infer from the path string\n * type UserByIdPathParams = InferPathParams<Schema, '/users/:userId'>;\n */\n export type PathParams<Schema extends HttpPathParamsSchema.Loose> = HttpPathParamsSerialized<Schema>;\n\n /**\n * Declares an HTTP form data schema. Form data is serialized to their strict form using\n * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpformdataserialized `HttpFormDataSerialized`} if\n * necessary.\n *\n * @example\n * import { HttpFormData, type HttpSchema } from '@zimic/http';\n *\n * type UserCreationFormData = HttpFormData<\n * HttpSchema.FormData<{\n * name: string;\n * email: string;\n * }>\n * >;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * POST: {\n * request: {\n * body: UserCreationFormData;\n * };\n * response: {\n * 201: { body: User };\n * };\n * };\n * };\n * }>;\n */\n export type FormData<Schema extends HttpFormDataSchema.Loose> = HttpFormDataSerialized<Schema>;\n}\n\n/**\n * Extracts the methods from an HTTP service schema.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpSchemaMethod<Schema extends HttpSchema> = IfAny<\n Schema,\n any, // eslint-disable-line @typescript-eslint/no-explicit-any\n keyof UnionToIntersection<Schema[keyof Schema]> & HttpMethod\n>;\n\nexport type AllowAnyStringInPathParams<Path extends string> = Path extends `${infer Prefix}:${string}/${infer Suffix}`\n ? `${Prefix}${string}/${AllowAnyStringInPathParams<Suffix>}`\n : Path extends `${infer Prefix}:${string}`\n ? `${Prefix}${string}`\n : Path;\n\n/**\n * Extracts the paths from an HTTP service schema. Optionally receives a second argument with one or more methods to\n * filter the paths with. Only the methods defined in the schema are allowed.\n *\n * @example\n * import { type HttpSchema, type HttpSchemaPath } from '@zimic/http';\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: { 200: { body: User[] } };\n * };\n * };\n * '/users/:userId': {\n * DELETE: {\n * response: { 200: { body: User } };\n * };\n * };\n * }>;\n *\n * type Path = HttpSchemaPath<Schema>;\n * // \"/users\" | \"/users/:userId\" | \"/users/${string}\"\n *\n * type GetPath = HttpSchemaPath<Schema, 'GET'>;\n * // \"/users\"\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport namespace HttpSchemaPath {\n type LooseLiteral<Schema extends HttpSchema, Method extends HttpMethod = HttpMethod> = {\n [Path in keyof Schema & string]: Method extends keyof Schema[Path] ? Path : never;\n }[keyof Schema & string];\n\n /**\n * Extracts the literal paths from an HTTP service schema. Optionally receives a second argument with one or more\n * methods to filter the paths with. Only the methods defined in the schema are allowed.\n *\n * @example\n * import { type HttpSchema, type HttpSchemaPath } from '@zimic/http';\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: { 200: { body: User[] } };\n * };\n * };\n * '/users/:userId': {\n * DELETE: {\n * response: { 200: { body: User } };\n * };\n * };\n * }>;\n *\n * type LiteralPath = HttpSchemaPath.Literal<Schema>;\n * // \"/users\" | \"/users/:userId\"\n *\n * type LiteralGetPath = HttpSchemaPath.Literal<Schema, 'GET'>;\n * // \"/users\"\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\n export type Literal<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,\n > = LooseLiteral<Schema, Method>;\n\n /**\n * Extracts the non-literal paths from an HTTP service schema. Optionally receives a second argument with one or more\n * methods to filter the paths with. Only the methods defined in the schema are allowed.\n *\n * @example\n * import { type HttpSchema, type HttpSchemaPath } from '@zimic/http';\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: { 200: { body: User[] } };\n * };\n * };\n * '/users/:userId': {\n * DELETE: {\n * response: { 200: { body: User } };\n * };\n * };\n * }>;\n *\n * type NonLiteralPath = HttpSchemaPath.NonLiteral<Schema>;\n * // \"/users\" | \"/users/${string}\"\n *\n * type NonLiteralGetPath = HttpSchemaPath.NonLiteral<Schema, 'GET'>;\n * // \"/users\"\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\n export type NonLiteral<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,\n > = AllowAnyStringInPathParams<Literal<Schema, Method>>;\n}\n\nexport type HttpSchemaPath<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,\n> = HttpSchemaPath.Literal<Schema, Method> | HttpSchemaPath.NonLiteral<Schema, Method>;\n\ntype LargestPathPrefix<Path extends string> = Path extends `${infer Prefix}/${infer Suffix}`\n ? `${Prefix}/${Suffix extends `${string}/${string}` ? LargestPathPrefix<Suffix> : ''}`\n : Path;\n\ntype ExcludeNonLiteralPathsSupersededByLiteralPath<Path extends string> =\n Path extends `${LargestPathPrefix<Path>}:${string}` ? never : Path;\n\nexport type PreferMostStaticLiteralPath<Path extends string> =\n UnionHasMoreThanOneType<Path> extends true ? ExcludeNonLiteralPathsSupersededByLiteralPath<Path> : Path;\n\ntype RecursiveInferHttpSchemaPath<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema>,\n NonLiteralPath extends string,\n LiteralPath extends HttpSchemaPath.Literal<Schema, Method>,\n> =\n NonLiteralPath extends AllowAnyStringInPathParams<LiteralPath>\n ? NonLiteralPath extends `${AllowAnyStringInPathParams<LiteralPath>}/${string}`\n ? never\n : LiteralPath\n : never;\n\nexport type LiteralHttpSchemaPathFromNonLiteral<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema>,\n NonLiteralPath extends string,\n LiteralPath extends HttpSchemaPath.Literal<Schema, Method> = HttpSchemaPath.Literal<Schema, Method>,\n> = PreferMostStaticLiteralPath<\n LiteralPath extends LiteralPath ? RecursiveInferHttpSchemaPath<Schema, Method, NonLiteralPath, LiteralPath> : never\n>;\n\ntype RecursiveInferPathParams<Path extends string> = Path extends `${infer _Prefix}:${infer ParamName}/${infer Suffix}`\n ? { [Name in ParamName]: string } & RecursiveInferPathParams<Suffix>\n : Path extends `${infer _Prefix}:${infer ParamName}`\n ? { [Name in ParamName]: string }\n : {};\n\n/**\n * Infers the path parameters schema from a path string, optionally validating it against an {@link HttpSchema}.\n *\n * If the first argument is a {@link HttpSchema} (recommended), the second argument is checked to be a valid path in that\n * schema.\n *\n * @example\n * import { HttpSchema, InferPathParams } from '@zimic/http';\n *\n * type MySchema = HttpSchema<{\n * '/users/:userId': {\n * GET: {\n * response: { 200: { body: User } };\n * };\n * };\n * }>;\n *\n * // Using a schema to validate the path (recommended):\n * type PathParams = InferPathParams<MySchema, '/users/:userId'>;\n * // { userId: string }\n *\n * @example\n * import { InferPathParams } from '@zimic/http';\n *\n * // Without using a schema to validate the path (works as `PathParamsSchemaFromPath`):\n * type PathParams = InferPathParams<'/users/:userId'>;\n * // { userId: string }\n */\nexport type InferPathParams<\n PathOrSchema extends string | HttpSchema,\n OptionalPath extends PathOrSchema extends HttpSchema ? HttpSchemaPath.Literal<PathOrSchema> : never = never,\n> = Prettify<\n RecursiveInferPathParams<\n PathOrSchema extends HttpSchema ? OptionalPath : PathOrSchema extends string ? PathOrSchema : never\n >\n>;\n\ntype OmitPastHttpStatusCodes<\n Schema extends HttpResponseSchemaByStatusCode.Loose,\n PastSchemas extends HttpResponseSchemaByStatusCode.Loose[],\n> =\n PastSchemas extends NonEmptyArray<HttpResponseSchemaByStatusCode.Loose>\n ? Omit<Schema, keyof UnionToIntersection<PastSchemas[number]>>\n : Schema;\n\ntype RecursiveMergeHttpResponsesByStatusCode<\n Schemas extends HttpResponseSchemaByStatusCode.Loose[],\n PastSchemas extends HttpResponseSchemaByStatusCode.Loose[] = [],\n> = Schemas extends [\n infer FirstSchema extends HttpResponseSchemaByStatusCode.Loose,\n ...infer RestSchemas extends HttpResponseSchemaByStatusCode.Loose[],\n]\n ? RestSchemas extends NonEmptyArray<HttpResponseSchemaByStatusCode.Loose>\n ? OmitPastHttpStatusCodes<FirstSchema, PastSchemas> &\n RecursiveMergeHttpResponsesByStatusCode<RestSchemas, [...PastSchemas, FirstSchema]>\n : OmitPastHttpStatusCodes<FirstSchema, PastSchemas>\n : never;\n\n/**\n * Merges multiple HTTP response schemas by status code into a single schema. When there are duplicate status codes, the\n * first declaration takes precedence.\n *\n * @example\n * import { type HttpSchema, type HttpStatusCode, MergeHttpResponsesByStatusCode } from '@zimic/http';\n *\n * // Overriding the 400 status code with a more specific schema\n * // and using a generic schema for all other client errors.\n * type MergedResponseByStatusCode = MergeHttpResponsesByStatusCode<\n * [\n * {\n * 400: { body: { message: string; issues: string[] } };\n * },\n * {\n * [StatusCode in HttpStatusCode.ClientError]: { body: { message: string } };\n * },\n * ]\n * >;\n * // {\n * // 400: { body: { message: string; issues: string[] } };\n * // 401: { body: { message: string}; };\n * // 402: { body: { message: string}; };\n * // 403: { body: { message: string}; };\n * // ...\n * // }\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: { response: MergedResponseByStatusCode };\n * };\n * }>;\n */\nexport type MergeHttpResponsesByStatusCode<\n Schemas extends HttpResponseSchemaByStatusCode.Loose[],\n PastSchemas extends HttpResponseSchemaByStatusCode.Loose[] = [],\n> = HttpResponseSchemaByStatusCode.ConvertToStrict<RecursiveMergeHttpResponsesByStatusCode<Schemas, PastSchemas>>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../zimic-utils/dist/chunk-PAWJFY3S.mjs","../../zimic-utils/src/data/blobEquals.ts","../../zimic-utils/src/data/fileEquals.ts","../src/formData/HttpFormData.ts","../src/headers/HttpHeaders.ts","../src/searchParams/HttpSearchParams.ts","../src/types/schema.ts"],"names":["__defProp","__name","pickPrimitiveProperties"],"mappings":";;;;;;AAAA,IAAIA,aAAY,MAAO,CAAA,cAAA;AACvB,IAAIC,OAAS,mBAAA,MAAA,CAAA,CAAC,MAAQ,EAAA,KAAA,KAAUD,UAAU,CAAA,MAAA,EAAQ,MAAQ,EAAA,EAAE,KAAO,EAAA,YAAA,EAAc,IAAK,EAAC,CAA1E,EAAA,QAAA,CAAA;;;ACDb,eAAe,UAAA,CAAW,MAAY,SAAiB,EAAA;AACrD,EAAA,OACE,IAAK,CAAA,IAAA,KAAS,SAAU,CAAA,IAAA,IAAQ,KAAK,IAAS,KAAA,SAAA,CAAU,IAAS,IAAA,MAAM,IAAK,CAAA,IAAA,EAAa,KAAA,MAAM,UAAU,IAAK,EAAA;AAElH;AAJe,MAAA,CAAA,UAAA,EAAA,YAAA,CAAA;AAAAC,OAAAA,CAAA,YAAA,YAAA,CAAA;AAMf,IAAO,kBAAQ,GAAA,UAAA;;;ACJf,eAAe,UAAA,CAAW,MAAY,SAAiB,EAAA;AACrD,EAAA,OAAO,KAAK,IAAS,KAAA,SAAA,CAAU,QAAS,MAAM,kBAAA,CAAW,MAAM,SAAS,CAAA;AAC1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AAa,CAAG,EAAA;AAC7C,UAAA,aAAA,CAAc,KAAK,KAAoB,CAAA;AAAA,SAClC,MAAA;AACL,UAAA,MAAA,CAAO,GAAG,CAAA,GAAI,CAAC,aAAA,EAAe,KAAK,CAAA;AAAA;AACrC,OACK,MAAA;AACL,QAAA,MAAA,CAAO,GAAG,CAAI,GAAA,KAAA;AAAA;AAChB;AAGF,IAAO,OAAA,MAAA;AAAA;AAEX,CAAA;AAEA,IAAO,wBAAQ,GAAA;;;ACzPF,IAAA,8BAAA,GAAiC,OAAO,MAAO,CAAA,CAAC,QAAQ,KAAO,EAAA,OAAA,EAAS,QAAQ,CAAU;AAG1F,IAAA,+BAAA,GAAkC,OAAO,MAAO,CAAA;AAAA,EAC3D,KAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAU;AAGG,IAAA,YAAA,GAAe,MAAO,CAAA,MAAA,CAAO,CAAC,KAAA,EAAO,MAAQ,EAAA,KAAA,EAAO,OAAS,EAAA,QAAA,EAAU,MAAQ,EAAA,SAAS,CAAU","file":"index.js","sourcesContent":["var __defProp = Object.defineProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\n\nexport { __name };\n//# sourceMappingURL=chunk-PAWJFY3S.mjs.map\n//# sourceMappingURL=chunk-PAWJFY3S.mjs.map","async function blobEquals(blob: Blob, otherBlob: Blob) {\n return (\n blob.type === otherBlob.type && blob.size === otherBlob.size && (await blob.text()) === (await otherBlob.text())\n );\n}\n\nexport default blobEquals;\n","import blobEquals from './blobEquals';\n\nasync function fileEquals(file: File, otherFile: File) {\n return file.name === otherFile.name && (await blobEquals(file, otherFile));\n}\n\nexport default fileEquals;\n","import fileEquals from '@zimic/utils/data/fileEquals';\nimport { ArrayItemIfArray, ReplaceBy } from '@zimic/utils/types';\n\nimport { HttpFormDataSchema, HttpFormDataSchemaName } from './types';\n\n/**\n * An extended HTTP form data object with a strictly-typed schema. Fully compatible with the built-in\n * {@link https://developer.mozilla.org/docs/Web/API/FormData `FormData`} class.\n *\n * **IMPORTANT**: the input of `HttpFormData` and all of its internal types must be declared inline or as a type aliases\n * (`type`). They cannot be interfaces.\n *\n * @example\n * import { HttpFormData } from '@zimic/http';\n *\n * const formData = new HttpFormData<{\n * files: File[];\n * description?: string;\n * }>();\n *\n * formData.append('file', new File(['content'], 'file.txt', { type: 'text/plain' }));\n * formData.append('description', 'My file');\n *\n * const files = formData.getAll('file');\n * console.log(files); // [File { name: 'file.txt', type: 'text/plain' }]\n *\n * const description = formData.get('description');\n * console.log(description); // 'My file'\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpformdata `HttpFormData` API reference}\n */\nclass HttpFormData<Schema extends HttpFormDataSchema = HttpFormDataSchema> extends FormData {\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/set MDN Reference} */\n set<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n value: Exclude<ArrayItemIfArray<NonNullable<Schema[Name]>>, Blob>,\n ): void;\n set<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n blob: Exclude<ArrayItemIfArray<NonNullable<Schema[Name]>>, string>,\n fileName?: string,\n ): void;\n set<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n blobOrValue: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n fileName?: string,\n ): void {\n if (fileName === undefined) {\n super.set(name, blobOrValue as Blob);\n } else {\n super.set(name, blobOrValue as Blob, fileName);\n }\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/append MDN Reference} */\n append<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n value: Exclude<ArrayItemIfArray<NonNullable<Schema[Name]>>, Blob>,\n ): void;\n append<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n blob: Exclude<ArrayItemIfArray<NonNullable<Schema[Name]>>, string>,\n fileName?: string,\n ): void;\n append<Name extends HttpFormDataSchemaName<Schema>>(\n name: Name,\n blobOrValue: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n fileName?: string,\n ): void {\n if (fileName === undefined) {\n super.append(name, blobOrValue as Blob);\n } else {\n super.append(name, blobOrValue as Blob, fileName);\n }\n }\n\n /**\n * Get the value of the entry associated to a key name.\n *\n * If the key might have multiple values, use {@link HttpFormData#getAll} instead.\n *\n * @param name The name of the key to get the value of.\n * @returns The value associated with the key name, or `null` if the key does not exist.\n * @see {@link https://developer.mozilla.org/docs/Web/API/FormData/get MDN Reference}\n */\n get<Name extends HttpFormDataSchemaName.NonArray<Schema>>(\n name: Name,\n ): ReplaceBy<ReplaceBy<ArrayItemIfArray<Schema[Name]>, undefined, null>, Blob, File> {\n return super.get(name) as ReplaceBy<ReplaceBy<ArrayItemIfArray<Schema[Name]>, undefined, null>, Blob, File>;\n }\n\n /**\n * Get all the values of the entry associated with a key name.\n *\n * If the key has at most a single value, use {@link HttpFormData#get} instead.\n *\n * @param name The name of the key to get the values of.\n * @returns An array of values associated with the key name, or an empty array if the key does not exist.\n * @see {@link https://developer.mozilla.org/docs/Web/API/FormData/getAll MDN Reference}\n */\n getAll<Name extends HttpFormDataSchemaName.Array<Schema>>(\n name: Name,\n ): ReplaceBy<ArrayItemIfArray<NonNullable<Schema[Name]>>, Blob, File>[] {\n return super.getAll(name) as ReplaceBy<ArrayItemIfArray<NonNullable<Schema[Name]>>, Blob, File>[];\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/has MDN Reference} */\n has<Name extends HttpFormDataSchemaName<Schema>>(name: Name): boolean {\n return super.has(name);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/delete MDN Reference} */\n delete<Name extends HttpFormDataSchemaName<Schema>>(name: Name): void {\n super.delete(name);\n }\n\n forEach<This extends HttpFormData<Schema>>(\n callback: <Key extends HttpFormDataSchemaName<Schema>>(\n value: ReplaceBy<ArrayItemIfArray<NonNullable<Schema[Key]>>, Blob, File>,\n key: Key,\n parent: HttpFormData<Schema>,\n ) => void,\n thisArg?: This,\n ): void {\n super.forEach(callback as (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/keys MDN Reference} */\n keys(): FormDataIterator<HttpFormDataSchemaName<Schema>> {\n return super.keys() as FormDataIterator<HttpFormDataSchemaName<Schema>>;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/values MDN Reference} */\n values(): FormDataIterator<\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>\n > {\n return super.values() as FormDataIterator<\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>\n >;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/FormData/entries MDN Reference} */\n entries(): FormDataIterator<\n [\n HttpFormDataSchemaName<Schema>,\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>,\n ]\n > {\n return super.entries() as FormDataIterator<\n [\n HttpFormDataSchemaName<Schema>,\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>,\n ]\n >;\n }\n\n [Symbol.iterator](): FormDataIterator<\n [\n HttpFormDataSchemaName<Schema>,\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>,\n ]\n > {\n return super[Symbol.iterator]() as FormDataIterator<\n [\n HttpFormDataSchemaName<Schema>,\n ReplaceBy<ArrayItemIfArray<NonNullable<Schema[HttpFormDataSchemaName<Schema>]>>, Blob, File>,\n ]\n >;\n }\n\n /**\n * Checks if the data is equal to the other data. Equality is defined as having the same keys and values, regardless\n * of the order of keys.\n *\n * @param otherData The other data to compare.\n * @returns A promise that resolves with `true` if the data is equal to the other data, or `false` otherwise.\n * Important: both form data might be read while comparing.\n */\n async equals<OtherSchema extends Schema>(otherData: HttpFormData<OtherSchema>): Promise<boolean> {\n for (const [otherKey, otherValue] of otherData.entries()) {\n const values = super.getAll.call(this, otherKey);\n\n const haveSameNumberOfValues = values.length === super.getAll.call(otherData, otherKey).length;\n if (!haveSameNumberOfValues) {\n return false;\n }\n\n let valueExists = false;\n\n for (const value of values) {\n if (\n value === otherValue ||\n (value instanceof Blob && otherValue instanceof Blob && (await fileEquals(value, otherValue)))\n ) {\n valueExists = true;\n break;\n }\n }\n\n if (!valueExists) {\n return false;\n }\n }\n\n for (const key of this.keys()) {\n const otherHasKey = super.has.call(otherData, key);\n if (!otherHasKey) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Checks if the data contains the other data. This method is less strict than {@link HttpFormData#equals} and only\n * requires that all keys and values in the other data are present in this data.\n *\n * @param otherData The other data to compare.\n * @returns A promise that resolves with `true` if this data contains the other data, or `false` otherwise. Important:\n * both form data might be read while comparing.\n */\n async contains<OtherSchema extends Schema>(otherData: HttpFormData<OtherSchema>): Promise<boolean> {\n for (const [otherKey, otherValue] of otherData.entries()) {\n const values = super.getAll.call(this, otherKey);\n\n const haveCompatibleNumberOfValues = values.length >= super.getAll.call(otherData, otherKey).length;\n if (!haveCompatibleNumberOfValues) {\n return false;\n }\n\n let valueExists = false;\n\n for (const value of values) {\n if (\n value === otherValue ||\n (typeof value === 'string' && typeof otherValue === 'string' && value === otherValue) ||\n (value instanceof Blob && otherValue instanceof Blob && (await fileEquals(value, otherValue)))\n ) {\n valueExists = true;\n break;\n }\n }\n\n if (!valueExists) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Converts this form data into a plain object. This method is useful for serialization and debugging purposes.\n *\n * **NOTE**: If a key has multiple values, the object will contain an array of values for that key. If the key has\n * only one value, the object will contain its value directly, without an array, regardless of how the value was\n * initialized when creating the form data.\n *\n * @example\n * const formData = new HttpFormData<{\n * title: string;\n * descriptions: string[];\n * content: Blob;\n * }>();\n *\n * formData.set('title', 'My title');\n * formData.append('descriptions', 'Description 1');\n * formData.append('descriptions', 'Description 2');\n * formData.set('content', new Blob(['content'], { type: 'text/plain' }));\n *\n * const object = formData.toObject();\n * console.log(object); // { title: 'My title', descriptions: ['Description 1', 'Description 2'], content: Blob { type: 'text/plain' } }\n *\n * @returns A plain object representation of this form data.\n */\n toObject() {\n const object = {} as Schema;\n\n type SchemaValue = Schema[HttpFormDataSchemaName<Schema>];\n\n for (const [key, value] of this.entries()) {\n if (key in object) {\n const existingValue = object[key];\n\n if (Array.isArray<SchemaValue>(existingValue)) {\n existingValue.push(value as SchemaValue);\n } else {\n object[key] = [existingValue, value] as SchemaValue;\n }\n } else {\n object[key] = value as SchemaValue;\n }\n }\n\n return object;\n }\n}\n\nexport default HttpFormData;\n","import { Default, ReplaceBy } from '@zimic/utils/types';\n\nimport { HttpHeadersSchema, HttpHeadersInit, HttpHeadersSchemaName } from './types';\n\nfunction pickPrimitiveProperties<Schema extends HttpHeadersSchema>(schema: Schema) {\n return Object.entries(schema).reduce<Record<string, string>>((accumulated, [key, value]) => {\n if (value !== undefined) {\n accumulated[key] = value;\n }\n return accumulated;\n }, {});\n}\n\n/**\n * An extended HTTP headers object with a strictly-typed schema. Fully compatible with the built-in\n * {@link https://developer.mozilla.org/docs/Web/API/Headers `Headers`} class.\n *\n * **IMPORTANT**: the input of `HttpHeaders` and all of its internal types must be declared inline or as a type aliases\n * (`type`). They cannot be interfaces.\n *\n * @example\n * import { HttpHeaders } from '@zimic/http';\n *\n * const headers = new HttpHeaders<{\n * accept?: string;\n * 'content-type'?: string;\n * }>({\n * accept: '*',\n * 'content-type': 'application/json',\n * });\n *\n * const contentType = headers.get('content-type');\n * console.log(contentType); // 'application/json'\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpheaders `HttpHeaders` API reference}\n */\nclass HttpHeaders<Schema extends HttpHeadersSchema = HttpHeadersSchema> extends Headers {\n constructor(init?: HttpHeadersInit<Schema>) {\n if (init instanceof Headers || Array.isArray(init) || !init) {\n super(init);\n } else {\n super(pickPrimitiveProperties(init));\n }\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/set MDN Reference} */\n set<Name extends HttpHeadersSchemaName<Schema>>(name: Name, value: NonNullable<Schema[Name]> & string): void {\n super.set(name, value);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/append MDN Reference} */\n append<Name extends HttpHeadersSchemaName<Schema>>(name: Name, value: NonNullable<Schema[Name]> & string): void {\n super.append(name, value);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/get MDN Reference} */\n get<Name extends HttpHeadersSchemaName<Schema>>(name: Name): ReplaceBy<Schema[Name], undefined, null> {\n return super.get(name) as ReplaceBy<Schema[Name], undefined, null>;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/has MDN Reference} */\n getSetCookie(): NonNullable<Default<Schema['Set-Cookie'], string>>[] {\n return super.getSetCookie() as NonNullable<Default<Schema['Set-Cookie'], string>>[];\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/has MDN Reference} */\n has<Name extends HttpHeadersSchemaName<Schema>>(name: Name): boolean {\n return super.has(name);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/delete MDN Reference} */\n delete<Name extends HttpHeadersSchemaName<Schema>>(name: Name): void {\n super.delete(name);\n }\n\n forEach<This extends HttpHeaders<Schema>>(\n callback: <Key extends HttpHeadersSchemaName<Schema>>(\n value: NonNullable<Schema[Key]> & string,\n key: Key,\n parent: Headers,\n ) => void,\n thisArg?: This,\n ): void {\n super.forEach(callback as (value: string, key: string, parent: Headers) => void, thisArg);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/keys MDN Reference} */\n keys(): HeadersIterator<HttpHeadersSchemaName<Schema>> {\n return super.keys() as HeadersIterator<HttpHeadersSchemaName<Schema>>;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/values MDN Reference} */\n values(): HeadersIterator<NonNullable<Schema[HttpHeadersSchemaName<Schema>]> & string> {\n return super.values() as HeadersIterator<NonNullable<Schema[HttpHeadersSchemaName<Schema>]> & string>;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/entries MDN Reference} */\n entries(): HeadersIterator<\n [HttpHeadersSchemaName<Schema>, NonNullable<Schema[HttpHeadersSchemaName<Schema>]> & string]\n > {\n return super.entries() as HeadersIterator<\n [HttpHeadersSchemaName<Schema>, NonNullable<Schema[HttpHeadersSchemaName<Schema>]> & string]\n >;\n }\n\n [Symbol.iterator](): HeadersIterator<\n [HttpHeadersSchemaName<Schema>, NonNullable<Schema[HttpHeadersSchemaName<Schema>]> & string]\n > {\n return super[Symbol.iterator]() as HeadersIterator<\n [HttpHeadersSchemaName<Schema>, NonNullable<Schema[HttpHeadersSchemaName<Schema>]> & string]\n >;\n }\n\n /**\n * Checks if this headers object is equal to another set of headers. Equality is defined as having the same keys and\n * values, regardless of the order of keys.\n *\n * @param otherHeaders The other headers object to compare against.\n * @returns `true` if the headers are equal, `false` otherwise.\n */\n equals<OtherSchema extends Schema>(otherHeaders: HttpHeaders<OtherSchema>): boolean {\n for (const [key, otherValue] of otherHeaders.entries()) {\n const value = super.get.call(this, key);\n\n if (value === null) {\n return false;\n }\n\n const valueItems = this.splitHeaderValues(value);\n const otherValueItems = this.splitHeaderValues(otherValue);\n\n const haveCompatibleNumberOfValues = valueItems.length === otherValueItems.length;\n if (!haveCompatibleNumberOfValues) {\n return false;\n }\n\n for (const otherValueItem of otherValueItems) {\n if (!valueItems.includes(otherValueItem)) {\n return false;\n }\n }\n }\n\n for (const key of this.keys()) {\n const otherHasKey = super.has.call(otherHeaders, key);\n if (!otherHasKey) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Checks if this headers object contains another set of headers. This method is less strict than\n * {@link HttpHeaders#equals} and only requires that all keys and values in the other headers are present in these\n * headers.\n *\n * @param otherHeaders The other headers object to compare against.\n * @returns `true` if these headers contain the other headers, `false` otherwise.\n */\n contains<OtherSchema extends Schema>(otherHeaders: HttpHeaders<OtherSchema>): boolean {\n for (const [key, otherValue] of otherHeaders.entries()) {\n const value = super.get.call(this, key);\n\n if (value === null) {\n return false;\n }\n\n const valueItems = this.splitHeaderValues(value);\n const otherValueItems = this.splitHeaderValues(otherValue);\n\n const haveCompatibleNumberOfValues = valueItems.length >= otherValueItems.length;\n if (!haveCompatibleNumberOfValues) {\n return false;\n }\n\n for (const otherValueItem of otherValueItems) {\n if (!valueItems.includes(otherValueItem)) {\n return false;\n }\n }\n }\n\n return true;\n }\n\n /**\n * Converts these headers into a plain object. This method is useful for serialization and debugging purposes.\n *\n * @example\n * const headers = new HttpHeaders({\n * accept: 'application/json',\n * 'content-type': 'application/json',\n * });\n * const object = headers.toObject();\n * console.log(object); // { accept: 'application/json', 'content-type': 'application/json' }\n *\n * @returns A plain object representation of these headers.\n */\n toObject(): Schema {\n const object = {} as Schema;\n\n for (const [key, value] of this.entries()) {\n object[key] = value;\n }\n\n return object;\n }\n\n private splitHeaderValues(value: string) {\n return value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item.length > 0);\n }\n}\n\nexport default HttpHeaders;\n","import { ReplaceBy, ArrayItemIfArray } from '@zimic/utils/types';\n\nimport { HttpSearchParamsSchema, HttpSearchParamsInit, HttpSearchParamsSchemaName } from './types';\n\nfunction pickPrimitiveProperties<Schema extends HttpSearchParamsSchema>(schema: Schema) {\n const schemaWithPrimitiveProperties = Object.entries(schema).reduce<Record<string, string>>(\n (accumulated, [key, value]) => {\n if (value !== undefined && !Array.isArray(value)) {\n accumulated[key] = value;\n }\n return accumulated;\n },\n {},\n );\n return schemaWithPrimitiveProperties;\n}\n\n/**\n * An extended HTTP search params object with a strictly-typed schema. Fully compatible with the built-in\n * {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams `URLSearchParams`} class.\n *\n * **IMPORTANT**: the input of `HttpSearchParams` and all of its internal types must be declared inline or as a type\n * aliases (`type`). They cannot be interfaces.\n *\n * @example\n * import { HttpSearchParams } from '@zimic/http';\n *\n * const searchParams = new HttpSearchParams<{\n * names?: string[];\n * page?: `${number}`;\n * }>({\n * names: ['user 1', 'user 2'],\n * page: '1',\n * });\n *\n * const names = searchParams.getAll('names');\n * console.log(names); // ['user 1', 'user 2']\n *\n * const page = searchParams.get('page');\n * console.log(page); // '1'\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpsearchparams `HttpSearchParams` API reference}\n */\nclass HttpSearchParams<Schema extends HttpSearchParamsSchema = HttpSearchParamsSchema> extends URLSearchParams {\n constructor(init?: HttpSearchParamsInit<Schema>) {\n if (init instanceof URLSearchParams || Array.isArray(init) || typeof init === 'string' || !init) {\n super(init);\n } else {\n super(pickPrimitiveProperties(init));\n this.populateInitArrayProperties(init);\n }\n }\n\n private populateInitArrayProperties(init: Schema) {\n for (const [key, value] of Object.entries(init)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n super.append(key, item);\n }\n }\n }\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/set MDN Reference} */\n set<Name extends HttpSearchParamsSchemaName<Schema>>(\n name: Name,\n value: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n ): void {\n super.set(name, value);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/append MDN Reference} */\n append<Name extends HttpSearchParamsSchemaName<Schema>>(\n name: Name,\n value: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n ): void {\n super.append(name, value);\n }\n\n /**\n * Get the value of the entry associated to a key name.\n *\n * If the key might have multiple values, use {@link HttpSearchParams#getAll} instead.\n *\n * @param name The name of the key to get the value of.\n * @returns The value associated with the key name, or `null` if the key does not exist.\n * @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/get MDN Reference}\n */\n get<Name extends HttpSearchParamsSchemaName.NonArray<Schema>>(\n name: Name,\n ): ReplaceBy<ArrayItemIfArray<Schema[Name]>, undefined, null> {\n return super.get(name) as ReplaceBy<ArrayItemIfArray<Schema[Name]>, undefined, null>;\n }\n\n /**\n * Get all the values of the entry associated with a key name.\n *\n * If the key has at most one value, use {@link HttpSearchParams#get} instead.\n *\n * @param name The name of the key to get the values of.\n * @returns An array of values associated with the key name, or an empty array if the key does not exist.\n * @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll MDN Reference}\n */\n getAll<Name extends HttpSearchParamsSchemaName.Array<Schema>>(\n name: Name,\n ): ArrayItemIfArray<NonNullable<Schema[Name]>>[] {\n return super.getAll(name) as ArrayItemIfArray<NonNullable<Schema[Name]>>[];\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/has MDN Reference} */\n has<Name extends HttpSearchParamsSchemaName<Schema>>(\n name: Name,\n value?: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n ): boolean {\n return super.has(name, value);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete MDN Reference} */\n delete<Name extends HttpSearchParamsSchemaName<Schema>>(\n name: Name,\n value?: ArrayItemIfArray<NonNullable<Schema[Name]>>,\n ): void {\n super.delete(name, value);\n }\n\n forEach<This extends HttpSearchParams<Schema>>(\n callback: <Key extends HttpSearchParamsSchemaName<Schema>>(\n value: ArrayItemIfArray<NonNullable<Schema[Key]>>,\n key: Key,\n parent: HttpSearchParams<Schema>,\n ) => void,\n thisArg?: This,\n ): void {\n super.forEach(callback as (value: string, key: string, parent: URLSearchParams) => void, thisArg);\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/keys MDN Reference} */\n keys(): URLSearchParamsIterator<HttpSearchParamsSchemaName<Schema>> {\n return super.keys() as URLSearchParamsIterator<HttpSearchParamsSchemaName<Schema>>;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/values MDN Reference} */\n values(): URLSearchParamsIterator<ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>> {\n return super.values() as URLSearchParamsIterator<\n ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>\n >;\n }\n\n /** @see {@link https://developer.mozilla.org/docs/Web/API/URLSearchParams/entries MDN Reference} */\n entries(): URLSearchParamsIterator<\n [HttpSearchParamsSchemaName<Schema>, ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>]\n > {\n return super.entries() as URLSearchParamsIterator<\n [HttpSearchParamsSchemaName<Schema>, ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>]\n >;\n }\n\n [Symbol.iterator](): URLSearchParamsIterator<\n [HttpSearchParamsSchemaName<Schema>, ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>]\n > {\n return super[Symbol.iterator]() as URLSearchParamsIterator<\n [HttpSearchParamsSchemaName<Schema>, ArrayItemIfArray<NonNullable<Schema[HttpSearchParamsSchemaName<Schema>]>>]\n >;\n }\n\n /**\n * Checks if these search params are equal to another set of search parameters. Equality is defined as having the same\n * keys and values, regardless of the order of the keys.\n *\n * @param otherParams The other search parameters to compare against.\n * @returns `true` if the search parameters are equal, `false` otherwise.\n */\n equals<OtherSchema extends Schema>(otherParams: HttpSearchParams<OtherSchema>): boolean {\n for (const [key, otherValue] of otherParams.entries()) {\n const values = super.getAll.call(this, key);\n\n const haveSameNumberOfValues = values.length === super.getAll.call(otherParams, key).length;\n if (!haveSameNumberOfValues) {\n return false;\n }\n\n const valueExists = values.includes(otherValue);\n if (!valueExists) {\n return false;\n }\n }\n\n return this.size === otherParams.size;\n }\n\n /**\n * Checks if these search params contain another set of search parameters. This method is less strict than\n * {@link HttpSearchParams#equals} and only requires that all keys and values in the other search parameters are\n * present in these search parameters.\n *\n * @param otherParams The other search parameters to check for containment.\n * @returns `true` if these search parameters contain the other search parameters, `false` otherwise.\n */\n contains<OtherSchema extends Schema>(otherParams: HttpSearchParams<OtherSchema>): boolean {\n for (const [key, otherValue] of otherParams.entries()) {\n const values = super.getAll.call(this, key);\n\n const haveCompatibleNumberOfValues = values.length >= super.getAll.call(otherParams, key).length;\n if (!haveCompatibleNumberOfValues) {\n return false;\n }\n\n const valueExists = values.includes(otherValue);\n if (!valueExists) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Converts these search params into a plain object. This method is useful for serialization and debugging purposes.\n *\n * **NOTE**: If a key has multiple values, the object will contain an array of values for that key. If the key has\n * only one value, the object will contain its value directly, without an array, regardless of how the value was\n * initialized when creating the search params object.\n *\n * @example\n * const searchParams = new HttpSearchParams({\n * names: ['user 1', 'user 2'],\n * name: ['user 3'],\n * page: '1',\n * });\n * const object = searchParams.toObject();\n * console.log(object); // { names: ['user 1', 'user 2'], name: 'user 3', page: '1' }\n *\n * @returns A plain object representation of these search params.\n */\n toObject() {\n const object = {} as Schema;\n\n type SchemaValue = Schema[HttpSearchParamsSchemaName<Schema>];\n\n for (const [key, value] of this.entries()) {\n if (key in object) {\n const existingValue = object[key];\n\n if (Array.isArray<SchemaValue>(existingValue)) {\n existingValue.push(value as SchemaValue);\n } else {\n object[key] = [existingValue, value] as SchemaValue;\n }\n } else {\n object[key] = value as SchemaValue;\n }\n }\n\n return object;\n }\n}\n\nexport default HttpSearchParams;\n","import { IfAny, UnionToIntersection, UnionHasMoreThanOneType, Prettify, NonEmptyArray } from '@zimic/utils/types';\n\nimport { HttpFormDataSchema, HttpFormDataSerialized } from '../formData/types';\nimport { HttpHeadersSchema, HttpHeadersSerialized } from '../headers/types';\nimport { HttpPathParamsSchema, HttpPathParamsSerialized } from '../pathParams/types';\nimport { HttpSearchParamsSchema, HttpSearchParamsSerialized } from '../searchParams/types';\nimport { HttpBody } from './requests';\n\nexport const HTTP_METHODS_WITH_REQUEST_BODY = Object.freeze(['POST', 'PUT', 'PATCH', 'DELETE'] as const);\nexport type HttpMethodWithRequestBody = (typeof HTTP_METHODS_WITH_REQUEST_BODY)[number];\n\nexport const HTTP_METHODS_WITH_RESPONSE_BODY = Object.freeze([\n 'GET',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'OPTIONS',\n] as const);\nexport type HttpMethodWithResponseBody = (typeof HTTP_METHODS_WITH_RESPONSE_BODY)[number];\n\nexport const HTTP_METHODS = Object.freeze(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'] as const);\n/**\n * A type representing the currently supported\n * {@link https://developer.mozilla.org/docs/Web/HTTP/Methods `HTTP methods`}.\n */\nexport type HttpMethod = (typeof HTTP_METHODS)[number];\n\n/**\n * A schema representing the structure of an HTTP request.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport interface HttpRequestSchema {\n headers?: HttpHeadersSchema.Loose;\n searchParams?: HttpSearchParamsSchema.Loose;\n body?: HttpBody.Loose;\n}\n\ntype ConvertToStrictHttpRequestSchema<Schema> = {\n [Key in keyof Schema]: Key extends 'headers'\n ? HttpHeadersSerialized<Schema[Key]>\n : Key extends 'searchParams'\n ? HttpSearchParamsSerialized<Schema[Key]>\n : Key extends 'body'\n ? HttpBody.ConvertToStrict<Schema[Key]>\n : Schema[Key];\n};\n\n/**\n * A schema representing the structure of an HTTP response.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport interface HttpResponseSchema {\n headers?: HttpHeadersSchema.Loose;\n body?: HttpBody.Loose;\n}\n\nexport namespace HttpResponseSchema {\n /** A schema representing the structure of an HTTP response with no body. */\n export interface NoBody extends Omit<HttpResponseSchema, 'body'> {\n body?: null;\n }\n}\n\ntype ConvertToStrictHttpResponseSchema<Schema> = ConvertToStrictHttpRequestSchema<Schema>;\n\n/**\n * The status codes used in HTTP responses, as defined by\n * {@link https://httpwg.org/specs/rfc9110.html#overview.of.status.codes RFC-9110}.\n *\n * - `HttpStatusCode.Information`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#information_responses `1XX`}\n * - `HttpStatusCode.Success`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#successful_responses `2XX`}\n * - `HttpStatusCode.Redirection`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#redirection_messages `3XX`}\n * - `HttpStatusCode.ClientError`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#client_error_responses `4XX`}\n * - `HttpStatusCode.ServerError`: {@link https://developer.mozilla.org/docs/Web/HTTP/Status#server_error_responses `5XX`}\n */\nexport namespace HttpStatusCode {\n /**\n * An HTTP status code in the `1XX` range, representing an informational response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#information_responses `1XX`}\n */\n export type Information =\n | 100 // Continue\n | 101 // Switching Protocols\n | 102 // Processing\n | 103; // Early Hints\n\n /**\n * An HTTP status code in the `2XX` range, representing a successful response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#successful_responses `2XX`}\n */\n export type Success =\n | 200 // OK\n | 201 // Created\n | 202 // Accepted\n | 203 // Non-Authoritative Information\n | 204 // No Content\n | 205 // Reset Content\n | 206 // Partial Content\n | 207 // Multi-Status\n | 208 // Already Reported\n | 226; // IM Used\n\n /**\n * An HTTP status code in the `3XX` range, representing a redirection response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#redirection_messages `3XX`}\n */\n export type Redirection =\n | 300 // Multiple Choices\n | 301 // Moved Permanently\n | 302 // Found\n | 303 // See Other\n | 304 // Not Modified\n | 307 // Temporary Redirect\n | 308; // Permanent Redirect\n\n /**\n * An HTTP status code in the `4XX` range, representing a client error response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#client_error_responses `4XX`}\n */\n export type ClientError =\n | 400 // Bad Request\n | 401 // Unauthorized\n | 402 // Payment Required\n | 403 // Forbidden\n | 404 // Not Found\n | 405 // Method Not Allowed\n | 406 // Not Acceptable\n | 407 // Proxy Authentication Required\n | 408 // Request Timeout\n | 409 // Conflict\n | 410 // Gone\n | 411 // Length Required\n | 412 // Precondition Failed\n | 413 // Content Too Large\n | 414 // URI Too Long\n | 415 // Unsupported Media Type\n | 416 // Range Not Satisfiable\n | 417 // Expectation Failed\n | 418 // I'm a teapot\n | 421 // Misdirected Request\n | 422 // Unprocessable Content\n | 423 // Locked\n | 424 // Failed Dependency\n | 425 // Too Early\n | 426 // Upgrade Required\n | 428 // Precondition Required\n | 429 // Too Many Requests\n | 431 // Request Header Fields Too Large\n | 451; // Unavailable For Legal Reasons\n\n /**\n * An HTTP status code in the `5XX` range, representing a server error response.\n *\n * @see {@link https://developer.mozilla.org/docs/Web/HTTP/Status#server_error_responses `5XX`}\n */\n export type ServerError =\n | 500 // Internal Server Error\n | 501 // Not Implemented\n | 502 // Bad Gateway\n | 503 // Service Unavailable\n | 504 // Gateway Timeout\n | 505 // HTTP Version Not Supported\n | 506 // Variant Also Negotiates\n | 507 // Insufficient Storage\n | 508 // Loop Detected\n | 510 // Not Extended\n | 511; // Network Authentication Required\n}\n\nexport type HttpStatusCode =\n | HttpStatusCode.Information\n | HttpStatusCode.Success\n | HttpStatusCode.Redirection\n | HttpStatusCode.ClientError\n | HttpStatusCode.ServerError;\n\nexport namespace HttpResponseSchemaByStatusCode {\n /** A loose version of HTTP responses by status code. JSON values are not strictly typed. */\n export type Loose = {\n [StatusCode in HttpStatusCode]?: HttpResponseSchema;\n };\n\n /**\n * Converts a possibly loose HTTP response schema by status code to be strictly typed. JSON values are serialized to\n * their strict form.\n */\n export type ConvertToStrict<Schema extends Loose> = {\n [StatusCode in keyof Schema]: StatusCode extends 204 ? HttpResponseSchema.NoBody : Schema[StatusCode];\n };\n\n /** A schema representing the structure of HTTP responses by status code with no body. */\n export type NoBody = {\n [StatusCode in HttpStatusCode]?: HttpResponseSchema.NoBody;\n };\n}\n\n/**\n * A schema representing the structure of HTTP responses by status code.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpResponseSchemaByStatusCode =\n HttpResponseSchemaByStatusCode.ConvertToStrict<HttpResponseSchemaByStatusCode.Loose>;\n\ntype ConvertToStrictHttpResponseSchemaByStatusCode<Schema> = {\n [Key in keyof Schema]: ConvertToStrictHttpResponseSchema<Schema[Key]>;\n};\n\n/**\n * Extracts the status codes used in a response schema by status code.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpResponseSchemaStatusCode<ResponseSchemaByStatusCode extends HttpResponseSchemaByStatusCode> =\n keyof ResponseSchemaByStatusCode & HttpStatusCode;\n\n/**\n * A schema representing the structure of an HTTP request and response for a given method.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport interface HttpMethodSchema {\n request?: HttpRequestSchema;\n response?: HttpResponseSchemaByStatusCode;\n}\n\nexport namespace HttpMethodSchema {\n /** A schema representing the structure of an HTTP request and response for a given method, having no request body. */\n export interface NoRequestBody extends Omit<HttpMethodSchema, 'request'> {\n request?: Omit<HttpRequestSchema, 'body'> & { body?: null };\n }\n\n /**\n * A schema representing the structure of an HTTP request and response for a given method, having no request and\n * response bodies.\n */\n export interface NoBody extends Omit<NoRequestBody, 'response'> {\n response?: HttpResponseSchemaByStatusCode.NoBody;\n }\n}\n\ntype ConvertToStrictMethod<Schema> = {\n [Key in keyof Schema]: Key extends 'request'\n ? ConvertToStrictHttpRequestSchema<Schema[Key]>\n : Key extends 'response'\n ? ConvertToStrictHttpResponseSchemaByStatusCode<Schema[Key]>\n : Schema[Key];\n};\n\n/**\n * A schema representing the structure of HTTP request and response by method.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport interface HttpMethodsSchema {\n GET?: HttpMethodSchema.NoRequestBody;\n POST?: HttpMethodSchema;\n PUT?: HttpMethodSchema;\n PATCH?: HttpMethodSchema;\n DELETE?: HttpMethodSchema;\n HEAD?: HttpMethodSchema.NoBody;\n OPTIONS?: HttpMethodSchema.NoRequestBody;\n}\n\ntype ConvertToStrictHttpMethodsSchema<Schema> = {\n [Method in keyof Schema]: ConvertToStrictMethod<Schema[Method]>;\n};\n\ninterface BaseHttpSchema {\n [path: string]: HttpMethodsSchema;\n}\n\nexport type ConvertToStrictHttpSchema<Schema extends HttpSchema> = {\n [Path in keyof Schema]: ConvertToStrictHttpMethodsSchema<Schema[Path]>;\n};\n\n/**\n * Declares an HTTP service schema.\n *\n * **IMPORTANT**: the input of `HttpSchema` and all of its internal types, except bodies, must be declared inline or as\n * a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * interface UserListHeaders {\n * accept: string;\n * }\n *\n * interface UserListSearchParams {\n * name?: string;\n * limit?: `${number}`;\n * }\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * request: {\n * headers: UserListHeaders;\n * searchParams: UserListSearchParams;\n * };\n * response: {\n * 200: {\n * // Inline headers declaration\n * headers: { 'content-type': string };\n * body: User[];\n * };\n * };\n * };\n * };\n * }>;\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpSchema<Schema extends BaseHttpSchema = BaseHttpSchema> = ConvertToStrictHttpSchema<Schema>;\n\nexport namespace HttpSchema {\n /**\n * Declares an HTTP service methods schema.\n *\n * **IMPORTANT**: the input of `HttpSchema.Methods` and all of its internal types, except bodies, must be declared\n * inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserMethods = HttpSchema.Methods<{\n * GET: {\n * response: {\n * 200: { body: User[] };\n * };\n * };\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': UserMethods;\n * }>;\n */\n export type Methods<Schema extends HttpMethodsSchema> = ConvertToStrictHttpMethodsSchema<Schema>;\n\n /**\n * Declares an HTTP service method schema.\n *\n * **IMPORTANT**: the input of `HttpSchema.Method` and all of its internal types, except bodies, must be declared\n * inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListMethod = HttpSchema.Method<{\n * response: {\n * 200: { body: User[] };\n * };\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: UserListMethod;\n * };\n * }>;\n */\n export type Method<Schema extends HttpMethodSchema> = ConvertToStrictMethod<Schema>;\n\n /**\n * Declares an HTTP service request schema.\n *\n * **IMPORTANT**: the input of `HttpSchema.Request` and all of its internal types, except bodies, must be declared\n * inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserCreationRequest = HttpSchema.Request<{\n * headers: { 'content-type': 'application/json' };\n * body: User;\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * POST: {\n * request: UserCreationRequest;\n * response: {\n * 201: { body: User };\n * };\n * };\n * };\n * }>;\n */\n export type Request<Schema extends HttpRequestSchema> = ConvertToStrictHttpRequestSchema<Schema>;\n\n /**\n * Declares an HTTP service response schema by status code.\n *\n * **IMPORTANT**: the input of `HttpSchema.ResponseByStatusCode` and all of its internal types, except bodies, must be\n * declared inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListResponseByStatusCode = HttpSchema.ResponseByStatusCode<{\n * 200: { body: User[] };\n * 400: { body: { message: string } };\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: UserListResponseByStatusCode;\n * };\n * };\n * }>;\n */\n export type ResponseByStatusCode<Schema extends HttpResponseSchemaByStatusCode> =\n ConvertToStrictHttpResponseSchemaByStatusCode<Schema>;\n\n /**\n * Declares an HTTP service response schema.\n *\n * **IMPORTANT**: the input of `HttpSchema.Response` and all of its internal types, except bodies, must be declared\n * inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListSuccessResponse = HttpSchema.Response<{\n * body: User[];\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: {\n * 200: UserListSuccessResponse;\n * };\n * };\n * };\n * }>;\n */\n export type Response<Schema extends HttpResponseSchema> = ConvertToStrictHttpResponseSchema<Schema>;\n\n /**\n * Declares an HTTP body schema. JSON values are serialized to their strict form using\n * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic#jsonserialized `JSONSerialized`} if necessary.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListSuccessResponseBody = HttpSchema.Body<User[]>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: {\n * 200: { body: UserListSuccessResponseBody };\n * };\n * };\n * };\n * }>;\n */\n export type Body<Schema extends HttpBody.Loose> = HttpBody.ConvertToStrict<Schema>;\n\n /**\n * Declares an HTTP headers schema. Headers are serialized to their strict form using\n * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpheadersserialized `HttpHeadersSerialized`} if\n * necessary.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListHeaders = HttpSchema.Headers<{\n * accept: 'application/json';\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * request: {\n * headers: UserListHeaders;\n * };\n * response: {\n * 200: { body: User[] };\n * };\n * };\n * };\n * }>;\n */\n export type Headers<Schema extends HttpHeadersSchema.Loose> = HttpHeadersSerialized<Schema>;\n\n /**\n * Declares an HTTP search params schema. Search params are serialized to their strict form using\n * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpsearchparamsserialized `HttpSearchParamsSerialized`}\n * if necessary.\n *\n * @example\n * import { type HttpSchema } from '@zimic/http';\n *\n * type UserListSearchParams = HttpSchema.SearchParams<{\n * limit: `${number}`;\n * offset: `${number}`;\n * }>;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * request: {\n * searchParams: UserListSearchParams;\n * };\n * response: {\n * 200: { body: User[] };\n * };\n * };\n * };\n * }>;\n */\n export type SearchParams<Schema extends HttpSearchParamsSchema.Loose> = HttpSearchParamsSerialized<Schema>;\n\n /**\n * Declares an HTTP path params schema. Path params are serialized to their strict form using\n * {@link HttpPathParamsSerialized} if necessary.\n *\n * @example\n * import { type HttpSchema, InferPathParams } from '@zimic/http';\n *\n * type Schema = HttpSchema<{\n * '/users/:userId': {\n * GET: {\n * response: {\n * 200: { body: User };\n * };\n * };\n * };\n * }>;\n *\n * type UserByIdPathParams = HttpSchema.PathParams<{\n * userId: string;\n * }>;\n *\n * // Or infer from the path string\n * type UserByIdPathParams = InferPathParams<Schema, '/users/:userId'>;\n */\n export type PathParams<Schema extends HttpPathParamsSchema.Loose> = HttpPathParamsSerialized<Schema>;\n\n /**\n * Declares an HTTP form data schema. Form data is serialized to their strict form using\n * {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpformdataserialized `HttpFormDataSerialized`} if\n * necessary.\n *\n * @example\n * import { HttpFormData, type HttpSchema } from '@zimic/http';\n *\n * type UserCreationFormData = HttpFormData<\n * HttpSchema.FormData<{\n * name: string;\n * email: string;\n * }>\n * >;\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * POST: {\n * request: {\n * body: UserCreationFormData;\n * };\n * response: {\n * 201: { body: User };\n * };\n * };\n * };\n * }>;\n */\n export type FormData<Schema extends HttpFormDataSchema.Loose> = HttpFormDataSerialized<Schema>;\n}\n\n/**\n * Extracts the methods from an HTTP service schema.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpSchemaMethod<Schema extends HttpSchema> = IfAny<\n Schema,\n any, // eslint-disable-line @typescript-eslint/no-explicit-any\n keyof UnionToIntersection<Schema[keyof Schema]> & HttpMethod\n>;\n\nexport type AllowAnyStringInPathParams<Path extends string> = Path extends `${infer Prefix}:${string}/${infer Suffix}`\n ? `${Prefix}${string}/${AllowAnyStringInPathParams<Suffix>}`\n : Path extends `${infer Prefix}:${string}`\n ? `${Prefix}${string}`\n : Path;\n\n/**\n * Extracts the paths from an HTTP service schema. Optionally receives a second argument with one or more methods to\n * filter the paths with. Only the methods defined in the schema are allowed.\n *\n * @example\n * import { type HttpSchema, type HttpSchemaPath } from '@zimic/http';\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: { 200: { body: User[] } };\n * };\n * };\n * '/users/:userId': {\n * DELETE: {\n * response: { 200: { body: User } };\n * };\n * };\n * }>;\n *\n * type Path = HttpSchemaPath<Schema>;\n * // \"/users\" | \"/users/:userId\" | \"/users/${string}\"\n *\n * type GetPath = HttpSchemaPath<Schema, 'GET'>;\n * // \"/users\"\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport namespace HttpSchemaPath {\n type LooseLiteral<Schema extends HttpSchema, Method extends HttpMethod = HttpMethod> = {\n [Path in keyof Schema & string]: Method extends keyof Schema[Path] ? Path : never;\n }[keyof Schema & string];\n\n /**\n * Extracts the literal paths from an HTTP service schema. Optionally receives a second argument with one or more\n * methods to filter the paths with. Only the methods defined in the schema are allowed.\n *\n * @example\n * import { type HttpSchema, type HttpSchemaPath } from '@zimic/http';\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: { 200: { body: User[] } };\n * };\n * };\n * '/users/:userId': {\n * DELETE: {\n * response: { 200: { body: User } };\n * };\n * };\n * }>;\n *\n * type LiteralPath = HttpSchemaPath.Literal<Schema>;\n * // \"/users\" | \"/users/:userId\"\n *\n * type LiteralGetPath = HttpSchemaPath.Literal<Schema, 'GET'>;\n * // \"/users\"\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\n export type Literal<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,\n > = LooseLiteral<Schema, Method>;\n\n /**\n * Extracts the non-literal paths from an HTTP service schema. Optionally receives a second argument with one or more\n * methods to filter the paths with. Only the methods defined in the schema are allowed.\n *\n * @example\n * import { type HttpSchema, type HttpSchemaPath } from '@zimic/http';\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: {\n * response: { 200: { body: User[] } };\n * };\n * };\n * '/users/:userId': {\n * DELETE: {\n * response: { 200: { body: User } };\n * };\n * };\n * }>;\n *\n * type NonLiteralPath = HttpSchemaPath.NonLiteral<Schema>;\n * // \"/users\" | \"/users/${string}\"\n *\n * type NonLiteralGetPath = HttpSchemaPath.NonLiteral<Schema, 'GET'>;\n * // \"/users\"\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http‐schemas Declaring HTTP interceptor schemas}\n */\n export type NonLiteral<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,\n > = AllowAnyStringInPathParams<Literal<Schema, Method>>;\n}\n\nexport type HttpSchemaPath<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>,\n> = HttpSchemaPath.Literal<Schema, Method> | HttpSchemaPath.NonLiteral<Schema, Method>;\n\ntype LargestPathPrefix<Path extends string> = Path extends `${infer Prefix}/${infer Suffix}`\n ? `${Prefix}/${Suffix extends `${string}/${string}` ? LargestPathPrefix<Suffix> : ''}`\n : Path;\n\ntype ExcludeNonLiteralPathsSupersededByLiteralPath<Path extends string> =\n Path extends `${LargestPathPrefix<Path>}:${string}` ? never : Path;\n\nexport type PreferMostStaticLiteralPath<Path extends string> =\n UnionHasMoreThanOneType<Path> extends true ? ExcludeNonLiteralPathsSupersededByLiteralPath<Path> : Path;\n\ntype RecursiveInferHttpSchemaPath<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema>,\n NonLiteralPath extends string,\n LiteralPath extends HttpSchemaPath.Literal<Schema, Method>,\n> =\n NonLiteralPath extends AllowAnyStringInPathParams<LiteralPath>\n ? NonLiteralPath extends `${AllowAnyStringInPathParams<LiteralPath>}/${string}`\n ? never\n : LiteralPath\n : never;\n\nexport type LiteralHttpSchemaPathFromNonLiteral<\n Schema extends HttpSchema,\n Method extends HttpSchemaMethod<Schema>,\n NonLiteralPath extends string,\n LiteralPath extends HttpSchemaPath.Literal<Schema, Method> = HttpSchemaPath.Literal<Schema, Method>,\n> = PreferMostStaticLiteralPath<\n LiteralPath extends LiteralPath ? RecursiveInferHttpSchemaPath<Schema, Method, NonLiteralPath, LiteralPath> : never\n>;\n\ntype RecursiveInferPathParams<Path extends string> = Path extends `${infer _Prefix}:${infer ParamName}/${infer Suffix}`\n ? { [Name in ParamName]: string } & RecursiveInferPathParams<Suffix>\n : Path extends `${infer _Prefix}:${infer ParamName}`\n ? { [Name in ParamName]: string }\n : {};\n\n/**\n * Infers the path parameters schema from a path string, optionally validating it against an {@link HttpSchema}.\n *\n * If the first argument is a {@link HttpSchema} (recommended), the second argument is checked to be a valid path in that\n * schema.\n *\n * @example\n * import { HttpSchema, InferPathParams } from '@zimic/http';\n *\n * type MySchema = HttpSchema<{\n * '/users/:userId': {\n * GET: {\n * response: { 200: { body: User } };\n * };\n * };\n * }>;\n *\n * // Using a schema to validate the path (recommended):\n * type PathParams = InferPathParams<MySchema, '/users/:userId'>;\n * // { userId: string }\n *\n * @example\n * import { InferPathParams } from '@zimic/http';\n *\n * // Without using a schema to validate the path (works as `PathParamsSchemaFromPath`):\n * type PathParams = InferPathParams<'/users/:userId'>;\n * // { userId: string }\n */\nexport type InferPathParams<\n PathOrSchema extends string | HttpSchema,\n OptionalPath extends PathOrSchema extends HttpSchema ? HttpSchemaPath.Literal<PathOrSchema> : never = never,\n> = Prettify<\n RecursiveInferPathParams<\n PathOrSchema extends HttpSchema ? OptionalPath : PathOrSchema extends string ? PathOrSchema : never\n >\n>;\n\ntype OmitPastHttpStatusCodes<\n Schema extends HttpResponseSchemaByStatusCode.Loose,\n PastSchemas extends HttpResponseSchemaByStatusCode.Loose[],\n> =\n PastSchemas extends NonEmptyArray<HttpResponseSchemaByStatusCode.Loose>\n ? Omit<Schema, keyof UnionToIntersection<PastSchemas[number]>>\n : Schema;\n\ntype RecursiveMergeHttpResponsesByStatusCode<\n Schemas extends HttpResponseSchemaByStatusCode.Loose[],\n PastSchemas extends HttpResponseSchemaByStatusCode.Loose[] = [],\n> = Schemas extends [\n infer FirstSchema extends HttpResponseSchemaByStatusCode.Loose,\n ...infer RestSchemas extends HttpResponseSchemaByStatusCode.Loose[],\n]\n ? RestSchemas extends NonEmptyArray<HttpResponseSchemaByStatusCode.Loose>\n ? OmitPastHttpStatusCodes<FirstSchema, PastSchemas> &\n RecursiveMergeHttpResponsesByStatusCode<RestSchemas, [...PastSchemas, FirstSchema]>\n : OmitPastHttpStatusCodes<FirstSchema, PastSchemas>\n : never;\n\n/**\n * Merges multiple HTTP response schemas by status code into a single schema. When there are duplicate status codes, the\n * first declaration takes precedence.\n *\n * @example\n * import { type HttpSchema, type HttpStatusCode, MergeHttpResponsesByStatusCode } from '@zimic/http';\n *\n * // Overriding the 400 status code with a more specific schema\n * // and using a generic schema for all other client errors.\n * type MergedResponseByStatusCode = MergeHttpResponsesByStatusCode<\n * [\n * {\n * 400: { body: { message: string; issues: string[] } };\n * },\n * {\n * [StatusCode in HttpStatusCode.ClientError]: { body: { message: string } };\n * },\n * ]\n * >;\n * // {\n * // 400: { body: { message: string; issues: string[] } };\n * // 401: { body: { message: string}; };\n * // 402: { body: { message: string}; };\n * // 403: { body: { message: string}; };\n * // ...\n * // }\n *\n * type Schema = HttpSchema<{\n * '/users': {\n * GET: { response: MergedResponseByStatusCode };\n * };\n * }>;\n */\nexport type MergeHttpResponsesByStatusCode<\n Schemas extends HttpResponseSchemaByStatusCode.Loose[],\n PastSchemas extends HttpResponseSchemaByStatusCode.Loose[] = [],\n> = HttpResponseSchemaByStatusCode.ConvertToStrict<RecursiveMergeHttpResponsesByStatusCode<Schemas, PastSchemas>>;\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -27,14 +27,14 @@ var HttpFormData = class extends FormData {
|
|
|
27
27
|
__name(this, "HttpFormData");
|
|
28
28
|
}
|
|
29
29
|
set(name, blobOrValue, fileName) {
|
|
30
|
-
if (fileName ===
|
|
30
|
+
if (fileName === void 0) {
|
|
31
31
|
super.set(name, blobOrValue);
|
|
32
32
|
} else {
|
|
33
33
|
super.set(name, blobOrValue, fileName);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
append(name, blobOrValue, fileName) {
|
|
37
|
-
if (fileName ===
|
|
37
|
+
if (fileName === void 0) {
|
|
38
38
|
super.append(name, blobOrValue);
|
|
39
39
|
} else {
|
|
40
40
|
super.append(name, blobOrValue, fileName);
|
|
@@ -198,7 +198,7 @@ var HttpFormData_default = HttpFormData;
|
|
|
198
198
|
// src/headers/HttpHeaders.ts
|
|
199
199
|
function pickPrimitiveProperties(schema) {
|
|
200
200
|
return Object.entries(schema).reduce((accumulated, [key, value]) => {
|
|
201
|
-
if (value !==
|
|
201
|
+
if (value !== void 0) {
|
|
202
202
|
accumulated[key] = value;
|
|
203
203
|
}
|
|
204
204
|
return accumulated;
|
|
@@ -349,7 +349,7 @@ var HttpHeaders_default = HttpHeaders;
|
|
|
349
349
|
function pickPrimitiveProperties2(schema) {
|
|
350
350
|
const schemaWithPrimitiveProperties = Object.entries(schema).reduce(
|
|
351
351
|
(accumulated, [key, value]) => {
|
|
352
|
-
if (value !==
|
|
352
|
+
if (value !== void 0 && !Array.isArray(value)) {
|
|
353
353
|
accumulated[key] = value;
|
|
354
354
|
}
|
|
355
355
|
return accumulated;
|