@zimic/http 0.3.1-canary.0 → 0.3.1-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +55 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/formData/HttpFormData.ts +4 -26
- package/src/headers/HttpHeaders.ts +4 -22
- package/src/searchParams/HttpSearchParams.ts +3 -17
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../zimic-utils/dist/chunk-6IEM75FG.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":";;;;;;AACA,IAAIA,aAAY,MAAO,CAAA,cAAA;AAKvB,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;;;ACNb,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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A,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 __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\nvar __require = /* @__PURE__ */ ((x) => typeof require !== \"undefined\" ? require : typeof Proxy !== \"undefined\" ? new Proxy(x, {\n get: (a, b) => (typeof require !== \"undefined\" ? require : a)[b]\n}) : x)(function(x) {\n if (typeof require !== \"undefined\") return require.apply(this, arguments);\n throw Error('Dynamic require of \"' + x + '\" is not supported');\n});\nvar __commonJS = (cb, mod) => function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\n\nexport { __commonJS, __name, __require, __toESM };\n//# sourceMappingURL=chunk-6IEM75FG.mjs.map\n//# sourceMappingURL=chunk-6IEM75FG.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‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport interface HttpRequestSchema {\n headers?: HttpHeadersSchema.Loose;\n searchParams?: HttpSearchParamsSchema.Loose;\n body?: HttpBody.Loose;\n}\n\nexport namespace HttpRequestSchema {\n /** Convert an HTTP request schema to be strictly typed. */\n export type AsStrict<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.AsStrict<Schema[Key]>\n : Schema[Key];\n };\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‐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 /** Convert an HTTP response schema to be strictly typed. */\n export type AsStrict<Schema> = HttpRequestSchema.AsStrict<Schema>;\n}\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 type HttpStatusCode =\n | HttpStatusCode.Information\n | HttpStatusCode.Success\n | HttpStatusCode.Redirection\n | HttpStatusCode.ClientError\n | HttpStatusCode.ServerError;\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\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‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpResponseSchemaByStatusCode =\n HttpResponseSchemaByStatusCode.AsStrict<HttpResponseSchemaByStatusCode.Loose>;\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 /** Converts an HTTP response schema by status code to be strictly typed. */\n export type AsStrict<Schema> = {\n [StatusCode in keyof Schema]: StatusCode extends 204\n ? HttpResponseSchema.NoBody\n : HttpResponseSchema.AsStrict<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 * Extracts the status codes used in a response schema by status code.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐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‐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 /** Converts an HTTP method schema to be strictly typed. */\n export type AsStrict<Schema> = {\n [Key in keyof Schema]: Key extends 'request'\n ? HttpRequestSchema.AsStrict<Schema[Key]>\n : Key extends 'response'\n ? HttpResponseSchemaByStatusCode.AsStrict<Schema[Key]>\n : Schema[Key];\n };\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‐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\nexport namespace HttpMethodsSchema {\n /** Converts an HTTP methods schema to be strictly typed. */\n export type AsStrict<Schema> = {\n [Method in keyof Schema]: HttpMethodSchema.AsStrict<Schema[Method]>;\n };\n}\n\ninterface BaseHttpSchema {\n [path: string]: HttpMethodsSchema;\n}\n\n/**\n * Declares an HTTP service schema.\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‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpSchema<Schema extends BaseHttpSchema = BaseHttpSchema> = HttpSchema.AsStrict<Schema>;\n\nexport namespace HttpSchema {\n /** Converts an HTTP service schema to be strictly typed. */\n export type AsStrict<Schema extends BaseHttpSchema> = {\n [Path in keyof Schema]: HttpMethodsSchema.AsStrict<Schema[Path]>;\n };\n\n /**\n * Declares an HTTP service methods schema.\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> = HttpMethodsSchema.AsStrict<Schema>;\n\n /**\n * Declares an HTTP service method schema.\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> = HttpMethodSchema.AsStrict<Schema>;\n\n /**\n * Declares an HTTP service request schema.\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> = HttpRequestSchema.AsStrict<Schema>;\n\n /**\n * Declares an HTTP service response schema by status code.\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 HttpResponseSchemaByStatusCode.AsStrict<Schema>;\n\n /**\n * Declares an HTTP service response schema.\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> = HttpResponseSchema.AsStrict<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.AsStrict<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‐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‐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‐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‐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 Schema = 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<Schema, '/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.AsStrict<RecursiveMergeHttpResponsesByStatusCode<Schemas, PastSchemas>>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../zimic-utils/dist/chunk-6IEM75FG.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":";;;;;;AACA,IAAIA,aAAY,MAAO,CAAA,cAAA;AAKvB,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;;;ACNb,eAAe,UAAA,CAAW,MAAY,SAAiB,EAAA;AACrD,EAAA,IAAI,KAAK,IAAS,KAAA,SAAA,CAAU,QAAQ,IAAK,CAAA,IAAA,KAAS,UAAU,IAAM,EAAA;AACzD,IAAA,OAAA,KAAA;AAAA;AAGT,EAAA,MAAM,MAAS,GAAA,IAAA,CAAK,MAAO,EAAA,CAAE,SAAU,EAAA;AACvC,EAAA,MAAM,WAAc,GAAA,SAAA,CAAU,MAAO,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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;;;AC3OF,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 __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\nvar __require = /* @__PURE__ */ ((x) => typeof require !== \"undefined\" ? require : typeof Proxy !== \"undefined\" ? new Proxy(x, {\n get: (a, b) => (typeof require !== \"undefined\" ? require : a)[b]\n}) : x)(function(x) {\n if (typeof require !== \"undefined\") return require.apply(this, arguments);\n throw Error('Dynamic require of \"' + x + '\" is not supported');\n});\nvar __commonJS = (cb, mod) => function __require2() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\n\nexport { __commonJS, __name, __require, __toESM };\n//# sourceMappingURL=chunk-6IEM75FG.mjs.map\n//# sourceMappingURL=chunk-6IEM75FG.mjs.map","async function blobEquals(blob: Blob, otherBlob: Blob) {\n if (blob.type !== otherBlob.type || blob.size !== otherBlob.size) {\n return false;\n }\n\n const reader = blob.stream().getReader();\n const otherReader = otherBlob.stream().getReader();\n\n let buffer: Uint8Array = new Uint8Array(0);\n let otherBuffer: Uint8Array = new Uint8Array(0);\n\n try {\n while (true) {\n await Promise.all([\n buffer.length === 0 &&\n reader.read().then((result) => {\n if (!result.done) {\n buffer = result.value;\n }\n }),\n\n otherBuffer.length === 0 &&\n otherReader.read().then((result) => {\n if (!result.done) {\n otherBuffer = result.value;\n }\n }),\n ]);\n\n const streamsEndedTogether = buffer.length === 0 && otherBuffer.length === 0;\n\n if (streamsEndedTogether) {\n return true;\n }\n\n const oneStreamEndedBeforeTheOther =\n (buffer.length === 0 && otherBuffer.length > 0) || (buffer.length > 0 && otherBuffer.length === 0);\n\n if (oneStreamEndedBeforeTheOther) {\n return false;\n }\n\n const minimumByteLength = Math.min(buffer.length, otherBuffer.length);\n\n for (let byteIndex = 0; byteIndex < minimumByteLength; byteIndex++) {\n if (buffer[byteIndex] !== otherBuffer[byteIndex]) {\n return false;\n }\n }\n\n buffer = buffer.slice(minimumByteLength);\n otherBuffer = otherBuffer.slice(minimumByteLength);\n }\n } finally {\n reader.releaseLock();\n otherReader.releaseLock();\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 if (!(await this.contains(otherData))) {\n return false;\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 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 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 if (!this.contains(otherHeaders)) {\n return false;\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 haveSameNumberOfValues = valueItems.length === otherValueItems.length;\n if (!haveSameNumberOfValues) {\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 return this.contains(otherParams) && 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 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 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‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport interface HttpRequestSchema {\n headers?: HttpHeadersSchema.Loose;\n searchParams?: HttpSearchParamsSchema.Loose;\n body?: HttpBody.Loose;\n}\n\nexport namespace HttpRequestSchema {\n /** Convert an HTTP request schema to be strictly typed. */\n export type AsStrict<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.AsStrict<Schema[Key]>\n : Schema[Key];\n };\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‐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 /** Convert an HTTP response schema to be strictly typed. */\n export type AsStrict<Schema> = HttpRequestSchema.AsStrict<Schema>;\n}\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 type HttpStatusCode =\n | HttpStatusCode.Information\n | HttpStatusCode.Success\n | HttpStatusCode.Redirection\n | HttpStatusCode.ClientError\n | HttpStatusCode.ServerError;\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\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‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpResponseSchemaByStatusCode =\n HttpResponseSchemaByStatusCode.AsStrict<HttpResponseSchemaByStatusCode.Loose>;\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 /** Converts an HTTP response schema by status code to be strictly typed. */\n export type AsStrict<Schema> = {\n [StatusCode in keyof Schema]: StatusCode extends 204\n ? HttpResponseSchema.NoBody\n : HttpResponseSchema.AsStrict<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 * Extracts the status codes used in a response schema by status code.\n *\n * @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐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‐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 /** Converts an HTTP method schema to be strictly typed. */\n export type AsStrict<Schema> = {\n [Key in keyof Schema]: Key extends 'request'\n ? HttpRequestSchema.AsStrict<Schema[Key]>\n : Key extends 'response'\n ? HttpResponseSchemaByStatusCode.AsStrict<Schema[Key]>\n : Schema[Key];\n };\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‐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\nexport namespace HttpMethodsSchema {\n /** Converts an HTTP methods schema to be strictly typed. */\n export type AsStrict<Schema> = {\n [Method in keyof Schema]: HttpMethodSchema.AsStrict<Schema[Method]>;\n };\n}\n\ninterface BaseHttpSchema {\n [path: string]: HttpMethodsSchema;\n}\n\n/**\n * Declares an HTTP service schema.\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‐http‐schemas Declaring HTTP interceptor schemas}\n */\nexport type HttpSchema<Schema extends BaseHttpSchema = BaseHttpSchema> = HttpSchema.AsStrict<Schema>;\n\nexport namespace HttpSchema {\n /** Converts an HTTP service schema to be strictly typed. */\n export type AsStrict<Schema extends BaseHttpSchema> = {\n [Path in keyof Schema]: HttpMethodsSchema.AsStrict<Schema[Path]>;\n };\n\n /**\n * Declares an HTTP service methods schema.\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> = HttpMethodsSchema.AsStrict<Schema>;\n\n /**\n * Declares an HTTP service method schema.\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> = HttpMethodSchema.AsStrict<Schema>;\n\n /**\n * Declares an HTTP service request schema.\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> = HttpRequestSchema.AsStrict<Schema>;\n\n /**\n * Declares an HTTP service response schema by status code.\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 HttpResponseSchemaByStatusCode.AsStrict<Schema>;\n\n /**\n * Declares an HTTP service response schema.\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> = HttpResponseSchema.AsStrict<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.AsStrict<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‐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‐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‐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‐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 Schema = 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<Schema, '/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.AsStrict<RecursiveMergeHttpResponsesByStatusCode<Schemas, PastSchemas>>;\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -5,9 +5,50 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
5
5
|
var __defProp2 = Object.defineProperty;
|
|
6
6
|
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
|
7
7
|
|
|
8
|
-
// ../zimic-utils/dist/chunk-
|
|
8
|
+
// ../zimic-utils/dist/chunk-HBO3G76H.mjs
|
|
9
9
|
async function blobEquals(blob, otherBlob) {
|
|
10
|
-
|
|
10
|
+
if (blob.type !== otherBlob.type || blob.size !== otherBlob.size) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const reader = blob.stream().getReader();
|
|
14
|
+
const otherReader = otherBlob.stream().getReader();
|
|
15
|
+
let buffer = new Uint8Array(0);
|
|
16
|
+
let otherBuffer = new Uint8Array(0);
|
|
17
|
+
try {
|
|
18
|
+
while (true) {
|
|
19
|
+
await Promise.all([
|
|
20
|
+
buffer.length === 0 && reader.read().then((result) => {
|
|
21
|
+
if (!result.done) {
|
|
22
|
+
buffer = result.value;
|
|
23
|
+
}
|
|
24
|
+
}),
|
|
25
|
+
otherBuffer.length === 0 && otherReader.read().then((result) => {
|
|
26
|
+
if (!result.done) {
|
|
27
|
+
otherBuffer = result.value;
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
]);
|
|
31
|
+
const streamsEndedTogether = buffer.length === 0 && otherBuffer.length === 0;
|
|
32
|
+
if (streamsEndedTogether) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
const oneStreamEndedBeforeTheOther = buffer.length === 0 && otherBuffer.length > 0 || buffer.length > 0 && otherBuffer.length === 0;
|
|
36
|
+
if (oneStreamEndedBeforeTheOther) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const minimumByteLength = Math.min(buffer.length, otherBuffer.length);
|
|
40
|
+
for (let byteIndex = 0; byteIndex < minimumByteLength; byteIndex++) {
|
|
41
|
+
if (buffer[byteIndex] !== otherBuffer[byteIndex]) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
buffer = buffer.slice(minimumByteLength);
|
|
46
|
+
otherBuffer = otherBuffer.slice(minimumByteLength);
|
|
47
|
+
}
|
|
48
|
+
} finally {
|
|
49
|
+
reader.releaseLock();
|
|
50
|
+
otherReader.releaseLock();
|
|
51
|
+
}
|
|
11
52
|
}
|
|
12
53
|
__name(blobEquals, "blobEquals");
|
|
13
54
|
__name2(blobEquals, "blobEquals");
|
|
@@ -99,22 +140,8 @@ var HttpFormData = class extends FormData {
|
|
|
99
140
|
* Important: both form data might be read while comparing.
|
|
100
141
|
*/
|
|
101
142
|
async equals(otherData) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const haveSameNumberOfValues = values.length === super.getAll.call(otherData, otherKey).length;
|
|
105
|
-
if (!haveSameNumberOfValues) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
let valueExists = false;
|
|
109
|
-
for (const value of values) {
|
|
110
|
-
if (value === otherValue || value instanceof Blob && otherValue instanceof Blob && await fileEquals_default(value, otherValue)) {
|
|
111
|
-
valueExists = true;
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (!valueExists) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
143
|
+
if (!await this.contains(otherData)) {
|
|
144
|
+
return false;
|
|
118
145
|
}
|
|
119
146
|
for (const key of this.keys()) {
|
|
120
147
|
const otherHasKey = super.has.call(otherData, key);
|
|
@@ -135,13 +162,13 @@ var HttpFormData = class extends FormData {
|
|
|
135
162
|
async contains(otherData) {
|
|
136
163
|
for (const [otherKey, otherValue] of otherData.entries()) {
|
|
137
164
|
const values = super.getAll.call(this, otherKey);
|
|
138
|
-
const
|
|
139
|
-
if (!
|
|
165
|
+
const haveSameNumberOfValues = values.length === super.getAll.call(otherData, otherKey).length;
|
|
166
|
+
if (!haveSameNumberOfValues) {
|
|
140
167
|
return false;
|
|
141
168
|
}
|
|
142
169
|
let valueExists = false;
|
|
143
170
|
for (const value of values) {
|
|
144
|
-
if (value === otherValue ||
|
|
171
|
+
if (value === otherValue || value instanceof Blob && otherValue instanceof Blob && await fileEquals_default(value, otherValue)) {
|
|
145
172
|
valueExists = true;
|
|
146
173
|
break;
|
|
147
174
|
}
|
|
@@ -266,22 +293,8 @@ var HttpHeaders = class extends Headers {
|
|
|
266
293
|
* @returns `true` if the headers are equal, `false` otherwise.
|
|
267
294
|
*/
|
|
268
295
|
equals(otherHeaders) {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (value === null) {
|
|
272
|
-
return false;
|
|
273
|
-
}
|
|
274
|
-
const valueItems = this.splitHeaderValues(value);
|
|
275
|
-
const otherValueItems = this.splitHeaderValues(otherValue);
|
|
276
|
-
const haveCompatibleNumberOfValues = valueItems.length === otherValueItems.length;
|
|
277
|
-
if (!haveCompatibleNumberOfValues) {
|
|
278
|
-
return false;
|
|
279
|
-
}
|
|
280
|
-
for (const otherValueItem of otherValueItems) {
|
|
281
|
-
if (!valueItems.includes(otherValueItem)) {
|
|
282
|
-
return false;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
296
|
+
if (!this.contains(otherHeaders)) {
|
|
297
|
+
return false;
|
|
285
298
|
}
|
|
286
299
|
for (const key of this.keys()) {
|
|
287
300
|
const otherHasKey = super.has.call(otherHeaders, key);
|
|
@@ -307,8 +320,8 @@ var HttpHeaders = class extends Headers {
|
|
|
307
320
|
}
|
|
308
321
|
const valueItems = this.splitHeaderValues(value);
|
|
309
322
|
const otherValueItems = this.splitHeaderValues(otherValue);
|
|
310
|
-
const
|
|
311
|
-
if (!
|
|
323
|
+
const haveSameNumberOfValues = valueItems.length === otherValueItems.length;
|
|
324
|
+
if (!haveSameNumberOfValues) {
|
|
312
325
|
return false;
|
|
313
326
|
}
|
|
314
327
|
for (const otherValueItem of otherValueItems) {
|
|
@@ -446,18 +459,7 @@ var HttpSearchParams = class extends URLSearchParams {
|
|
|
446
459
|
* @returns `true` if the search parameters are equal, `false` otherwise.
|
|
447
460
|
*/
|
|
448
461
|
equals(otherParams) {
|
|
449
|
-
|
|
450
|
-
const values = super.getAll.call(this, key);
|
|
451
|
-
const haveSameNumberOfValues = values.length === super.getAll.call(otherParams, key).length;
|
|
452
|
-
if (!haveSameNumberOfValues) {
|
|
453
|
-
return false;
|
|
454
|
-
}
|
|
455
|
-
const valueExists = values.includes(otherValue);
|
|
456
|
-
if (!valueExists) {
|
|
457
|
-
return false;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
return this.size === otherParams.size;
|
|
462
|
+
return this.contains(otherParams) && this.size === otherParams.size;
|
|
461
463
|
}
|
|
462
464
|
/**
|
|
463
465
|
* Checks if these search params contain another set of search parameters. This method is less strict than
|
|
@@ -470,8 +472,8 @@ var HttpSearchParams = class extends URLSearchParams {
|
|
|
470
472
|
contains(otherParams) {
|
|
471
473
|
for (const [key, otherValue] of otherParams.entries()) {
|
|
472
474
|
const values = super.getAll.call(this, key);
|
|
473
|
-
const
|
|
474
|
-
if (!
|
|
475
|
+
const haveSameNumberOfValues = values.length === super.getAll.call(otherParams, key).length;
|
|
476
|
+
if (!haveSameNumberOfValues) {
|
|
475
477
|
return false;
|
|
476
478
|
}
|
|
477
479
|
const valueExists = values.includes(otherValue);
|