@zimic/http 0.1.0-canary.2 → 0.1.0-canary.20
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/LICENSE.md +1 -1
- package/README.md +110 -180
- package/dist/{chunk-VHQRAQPQ.mjs → chunk-C5GWXTO5.mjs} +117 -140
- package/dist/chunk-C5GWXTO5.mjs.map +1 -0
- package/dist/{chunk-VUDGONB5.js → chunk-KDDZRZK6.js} +117 -140
- package/dist/chunk-KDDZRZK6.js.map +1 -0
- package/dist/cli.js +9 -9
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.ts +29 -38
- package/dist/index.js +17 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -19
- package/dist/index.mjs.map +1 -1
- package/dist/typegen.d.ts +1 -1
- package/dist/typegen.js +2 -2
- package/dist/typegen.mjs +1 -1
- package/package.json +19 -16
- package/src/formData/HttpFormData.ts +2 -2
- package/src/formData/types.ts +1 -1
- package/src/headers/HttpHeaders.ts +12 -10
- package/src/headers/types.ts +1 -1
- package/src/index.ts +5 -0
- package/src/pathParams/types.ts +1 -1
- package/src/searchParams/HttpSearchParams.ts +1 -1
- package/src/searchParams/types.ts +1 -1
- package/src/typegen/index.ts +1 -1
- package/src/typegen/openapi/generate.ts +1 -2
- package/src/typegen/openapi/transform/components.ts +2 -3
- package/src/typegen/openapi/transform/filters.ts +3 -3
- package/src/typegen/openapi/transform/io.ts +3 -5
- package/src/typegen/openapi/transform/methods.ts +4 -5
- package/src/typegen/openapi/transform/operations.ts +2 -3
- package/src/typegen/openapi/transform/paths.ts +2 -3
- package/src/types/requests.ts +35 -2
- package/src/types/schema.ts +14 -32
- package/src/utils/console.ts +1 -1
- package/src/utils/files.ts +4 -24
- package/src/utils/prettier.ts +1 -1
- package/src/utils/time.ts +1 -1
- package/dist/chunk-VHQRAQPQ.mjs.map +0 -1
- package/dist/chunk-VUDGONB5.js.map +0 -1
- package/src/types/arrays.d.ts +0 -4
- package/src/types/objects.d.ts +0 -14
- package/src/types/strings.d.ts +0 -9
- package/src/types/utils.ts +0 -64
- package/src/utils/data.ts +0 -13
- package/src/utils/imports.ts +0 -12
- package/src/utils/urls.ts +0 -52
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ type JSONSerialized<Type> = Type extends JSONValue ? Type : Type extends string
|
|
|
66
66
|
} : never;
|
|
67
67
|
|
|
68
68
|
type Default<Type, IfEmpty = never> = [undefined | void] extends [Type] ? IfEmpty : Exclude<Type, undefined | void>;
|
|
69
|
+
type DefaultNoExclude<Type, IfEmpty = never> = [undefined | void] extends Type ? IfEmpty : Type;
|
|
69
70
|
type IfAny<Type, Yes, No = Type> = 0 extends 1 & Type ? Yes : No;
|
|
70
71
|
type IfNever<Type, Yes, No = Type> = [Type] extends [never] ? Yes : No;
|
|
71
72
|
type UnionToIntersection<Union> = (Union extends unknown ? (union: Union) => void : never) extends (intersectedUnion: infer IntersectedUnion) => void ? IntersectedUnion : never;
|
|
@@ -380,9 +381,9 @@ type HttpHeadersSerialized<Type> = HttpPathParamsSerialized<Type>;
|
|
|
380
381
|
declare class HttpHeaders<Schema extends HttpHeadersSchema = HttpHeadersSchema> extends Headers {
|
|
381
382
|
constructor(init?: HttpHeadersInit<Schema>);
|
|
382
383
|
/** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/set MDN Reference} */
|
|
383
|
-
set<Name extends HttpHeadersSchemaName<Schema>>(name: Name, value: NonNullable<Schema[Name]>): void;
|
|
384
|
+
set<Name extends HttpHeadersSchemaName<Schema>>(name: Name, value: NonNullable<Schema[Name]> & string): void;
|
|
384
385
|
/** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/append MDN Reference} */
|
|
385
|
-
append<Name extends HttpHeadersSchemaName<Schema>>(name: Name, value: NonNullable<Schema[Name]>): void;
|
|
386
|
+
append<Name extends HttpHeadersSchemaName<Schema>>(name: Name, value: NonNullable<Schema[Name]> & string): void;
|
|
386
387
|
/** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/get MDN Reference} */
|
|
387
388
|
get<Name extends HttpHeadersSchemaName<Schema>>(name: Name): ReplaceBy<Schema[Name], undefined, null>;
|
|
388
389
|
/** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/has MDN Reference} */
|
|
@@ -391,16 +392,19 @@ declare class HttpHeaders<Schema extends HttpHeadersSchema = HttpHeadersSchema>
|
|
|
391
392
|
has<Name extends HttpHeadersSchemaName<Schema>>(name: Name): boolean;
|
|
392
393
|
/** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/delete MDN Reference} */
|
|
393
394
|
delete<Name extends HttpHeadersSchemaName<Schema>>(name: Name): void;
|
|
394
|
-
forEach<This extends HttpHeaders<Schema>>(callback: <Key extends HttpHeadersSchemaName<Schema>>(value: NonNullable<Schema[Key]
|
|
395
|
+
forEach<This extends HttpHeaders<Schema>>(callback: <Key extends HttpHeadersSchemaName<Schema>>(value: NonNullable<Schema[Key]> & string, key: Key, parent: Headers) => void, thisArg?: This): void;
|
|
395
396
|
/** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/keys MDN Reference} */
|
|
396
397
|
keys(): HeadersIterator<HttpHeadersSchemaName<Schema>>;
|
|
397
398
|
/** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/values MDN Reference} */
|
|
398
|
-
values(): HeadersIterator<NonNullable<Schema[HttpHeadersSchemaName<Schema>]
|
|
399
|
+
values(): HeadersIterator<NonNullable<Schema[HttpHeadersSchemaName<Schema>]> & string>;
|
|
399
400
|
/** @see {@link https://developer.mozilla.org/docs/Web/API/Headers/entries MDN Reference} */
|
|
400
|
-
entries(): HeadersIterator<[
|
|
401
|
+
entries(): HeadersIterator<[
|
|
402
|
+
HttpHeadersSchemaName<Schema>,
|
|
403
|
+
NonNullable<Schema[HttpHeadersSchemaName<Schema>]> & string
|
|
404
|
+
]>;
|
|
401
405
|
[Symbol.iterator](): HeadersIterator<[
|
|
402
406
|
HttpHeadersSchemaName<Schema>,
|
|
403
|
-
NonNullable<Schema[HttpHeadersSchemaName<Schema>]>
|
|
407
|
+
NonNullable<Schema[HttpHeadersSchemaName<Schema>]> & string
|
|
404
408
|
]>;
|
|
405
409
|
/**
|
|
406
410
|
* Checks if this headers object is equal to another set of headers. Equality is defined as having the same keys and
|
|
@@ -638,7 +642,7 @@ type HttpMethod = (typeof HTTP_METHODS)[number];
|
|
|
638
642
|
/**
|
|
639
643
|
* A schema representing the structure of an HTTP request.
|
|
640
644
|
*
|
|
641
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐
|
|
645
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas Declaring HTTP interceptor schemas}
|
|
642
646
|
*/
|
|
643
647
|
interface HttpRequestSchema {
|
|
644
648
|
headers?: HttpHeadersSchema.Loose;
|
|
@@ -651,7 +655,7 @@ type ConvertToStrictHttpRequestSchema<Schema> = {
|
|
|
651
655
|
/**
|
|
652
656
|
* A schema representing the structure of an HTTP response.
|
|
653
657
|
*
|
|
654
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐
|
|
658
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas Declaring HTTP interceptor schemas}
|
|
655
659
|
*/
|
|
656
660
|
interface HttpResponseSchema {
|
|
657
661
|
headers?: HttpHeadersSchema.Loose;
|
|
@@ -727,7 +731,7 @@ declare namespace HttpResponseSchemaByStatusCode {
|
|
|
727
731
|
/**
|
|
728
732
|
* A schema representing the structure of HTTP responses by status code.
|
|
729
733
|
*
|
|
730
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐
|
|
734
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas Declaring HTTP interceptor schemas}
|
|
731
735
|
*/
|
|
732
736
|
type HttpResponseSchemaByStatusCode = HttpResponseSchemaByStatusCode.ConvertToStrict<HttpResponseSchemaByStatusCode.Loose>;
|
|
733
737
|
type ConvertToStrictHttpResponseSchemaByStatusCode<Schema> = {
|
|
@@ -736,13 +740,13 @@ type ConvertToStrictHttpResponseSchemaByStatusCode<Schema> = {
|
|
|
736
740
|
/**
|
|
737
741
|
* Extracts the status codes used in a response schema by status code.
|
|
738
742
|
*
|
|
739
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐
|
|
743
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas Declaring HTTP interceptor schemas}
|
|
740
744
|
*/
|
|
741
745
|
type HttpResponseSchemaStatusCode<ResponseSchemaByStatusCode extends HttpResponseSchemaByStatusCode> = keyof ResponseSchemaByStatusCode & HttpStatusCode;
|
|
742
746
|
/**
|
|
743
747
|
* A schema representing the structure of an HTTP request and response for a given method.
|
|
744
748
|
*
|
|
745
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐
|
|
749
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas Declaring HTTP interceptor schemas}
|
|
746
750
|
*/
|
|
747
751
|
interface HttpMethodSchema {
|
|
748
752
|
request?: HttpRequestSchema;
|
|
@@ -769,7 +773,7 @@ type ConvertToStrictMethod<Schema> = {
|
|
|
769
773
|
/**
|
|
770
774
|
* A schema representing the structure of HTTP request and response by method.
|
|
771
775
|
*
|
|
772
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐
|
|
776
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas Declaring HTTP interceptor schemas}
|
|
773
777
|
*/
|
|
774
778
|
interface HttpMethodsSchema {
|
|
775
779
|
GET?: HttpMethodSchema.NoRequestBody;
|
|
@@ -792,9 +796,6 @@ type ConvertToStrictHttpSchema<Schema extends HttpSchema> = {
|
|
|
792
796
|
/**
|
|
793
797
|
* Declares an HTTP service schema.
|
|
794
798
|
*
|
|
795
|
-
* **IMPORTANT**: the input of `HttpSchema` and all of its internal types, except bodies, must be declared inline or as
|
|
796
|
-
* a type aliases (`type`). Types other than bodies cannot be interfaces.
|
|
797
|
-
*
|
|
798
799
|
* @example
|
|
799
800
|
* import { type HttpSchema } from '@zimic/http';
|
|
800
801
|
*
|
|
@@ -825,16 +826,13 @@ type ConvertToStrictHttpSchema<Schema extends HttpSchema> = {
|
|
|
825
826
|
* };
|
|
826
827
|
* }>;
|
|
827
828
|
*
|
|
828
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐
|
|
829
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas Declaring HTTP interceptor schemas}
|
|
829
830
|
*/
|
|
830
831
|
type HttpSchema<Schema extends BaseHttpSchema = BaseHttpSchema> = ConvertToStrictHttpSchema<Schema>;
|
|
831
832
|
declare namespace HttpSchema {
|
|
832
833
|
/**
|
|
833
834
|
* Declares an HTTP service methods schema.
|
|
834
835
|
*
|
|
835
|
-
* **IMPORTANT**: the input of `HttpSchema.Methods` and all of its internal types, except bodies, must be declared
|
|
836
|
-
* inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.
|
|
837
|
-
*
|
|
838
836
|
* @example
|
|
839
837
|
* import { type HttpSchema } from '@zimic/http';
|
|
840
838
|
*
|
|
@@ -854,9 +852,6 @@ declare namespace HttpSchema {
|
|
|
854
852
|
/**
|
|
855
853
|
* Declares an HTTP service method schema.
|
|
856
854
|
*
|
|
857
|
-
* **IMPORTANT**: the input of `HttpSchema.Method` and all of its internal types, except bodies, must be declared
|
|
858
|
-
* inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.
|
|
859
|
-
*
|
|
860
855
|
* @example
|
|
861
856
|
* import { type HttpSchema } from '@zimic/http';
|
|
862
857
|
*
|
|
@@ -876,9 +871,6 @@ declare namespace HttpSchema {
|
|
|
876
871
|
/**
|
|
877
872
|
* Declares an HTTP service request schema.
|
|
878
873
|
*
|
|
879
|
-
* **IMPORTANT**: the input of `HttpSchema.Request` and all of its internal types, except bodies, must be declared
|
|
880
|
-
* inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.
|
|
881
|
-
*
|
|
882
874
|
* @example
|
|
883
875
|
* import { type HttpSchema } from '@zimic/http';
|
|
884
876
|
*
|
|
@@ -902,9 +894,6 @@ declare namespace HttpSchema {
|
|
|
902
894
|
/**
|
|
903
895
|
* Declares an HTTP service response schema by status code.
|
|
904
896
|
*
|
|
905
|
-
* **IMPORTANT**: the input of `HttpSchema.ResponseByStatusCode` and all of its internal types, except bodies, must be
|
|
906
|
-
* declared inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.
|
|
907
|
-
*
|
|
908
897
|
* @example
|
|
909
898
|
* import { type HttpSchema } from '@zimic/http';
|
|
910
899
|
*
|
|
@@ -925,9 +914,6 @@ declare namespace HttpSchema {
|
|
|
925
914
|
/**
|
|
926
915
|
* Declares an HTTP service response schema.
|
|
927
916
|
*
|
|
928
|
-
* **IMPORTANT**: the input of `HttpSchema.Response` and all of its internal types, except bodies, must be declared
|
|
929
|
-
* inline or as a type aliases (`type`). Types other than bodies cannot be interfaces.
|
|
930
|
-
*
|
|
931
917
|
* @example
|
|
932
918
|
* import { type HttpSchema } from '@zimic/http';
|
|
933
919
|
*
|
|
@@ -1077,7 +1063,7 @@ declare namespace HttpSchema {
|
|
|
1077
1063
|
/**
|
|
1078
1064
|
* Extracts the methods from an HTTP service schema.
|
|
1079
1065
|
*
|
|
1080
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐
|
|
1066
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas Declaring HTTP interceptor schemas}
|
|
1081
1067
|
*/
|
|
1082
1068
|
type HttpSchemaMethod<Schema extends HttpSchema> = IfAny<Schema, any, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
1083
1069
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
@@ -1109,7 +1095,7 @@ type AllowAnyStringInPathParams<Path extends string> = Path extends `${infer Pre
|
|
|
1109
1095
|
* type GetPath = HttpSchemaPath<Schema, 'GET'>;
|
|
1110
1096
|
* // "/users"
|
|
1111
1097
|
*
|
|
1112
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐
|
|
1098
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas Declaring HTTP interceptor schemas}
|
|
1113
1099
|
*/
|
|
1114
1100
|
declare namespace HttpSchemaPath {
|
|
1115
1101
|
type LooseLiteral<Schema extends HttpSchema, Method extends HttpMethod = HttpMethod> = {
|
|
@@ -1141,7 +1127,7 @@ declare namespace HttpSchemaPath {
|
|
|
1141
1127
|
* type LiteralGetPath = HttpSchemaPath.Literal<Schema, 'GET'>;
|
|
1142
1128
|
* // "/users"
|
|
1143
1129
|
*
|
|
1144
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐
|
|
1130
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas Declaring HTTP interceptor schemas}
|
|
1145
1131
|
*/
|
|
1146
1132
|
export type Literal<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>> = LooseLiteral<Schema, Method>;
|
|
1147
1133
|
/**
|
|
@@ -1170,7 +1156,7 @@ declare namespace HttpSchemaPath {
|
|
|
1170
1156
|
* type NonLiteralGetPath = HttpSchemaPath.NonLiteral<Schema, 'GET'>;
|
|
1171
1157
|
* // "/users"
|
|
1172
1158
|
*
|
|
1173
|
-
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐
|
|
1159
|
+
* @see {@link https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas Declaring HTTP interceptor schemas}
|
|
1174
1160
|
*/
|
|
1175
1161
|
export type NonLiteral<Schema extends HttpSchema, Method extends HttpSchemaMethod<Schema> = HttpSchemaMethod<Schema>> = AllowAnyStringInPathParams<Literal<Schema, Method>>;
|
|
1176
1162
|
export { };
|
|
@@ -1195,7 +1181,7 @@ type RecursiveInferPathParams<Path extends string> = Path extends `${infer _Pref
|
|
|
1195
1181
|
* @example
|
|
1196
1182
|
* import { HttpSchema, InferPathParams } from '@zimic/http';
|
|
1197
1183
|
*
|
|
1198
|
-
* type
|
|
1184
|
+
* type Schema = HttpSchema<{
|
|
1199
1185
|
* '/users/:userId': {
|
|
1200
1186
|
* GET: {
|
|
1201
1187
|
* response: { 200: { body: User } };
|
|
@@ -1204,7 +1190,7 @@ type RecursiveInferPathParams<Path extends string> = Path extends `${infer _Pref
|
|
|
1204
1190
|
* }>;
|
|
1205
1191
|
*
|
|
1206
1192
|
* // Using a schema to validate the path (recommended):
|
|
1207
|
-
* type PathParams = InferPathParams<
|
|
1193
|
+
* type PathParams = InferPathParams<Schema, '/users/:userId'>;
|
|
1208
1194
|
* // { userId: string }
|
|
1209
1195
|
*
|
|
1210
1196
|
* @example
|
|
@@ -1302,5 +1288,10 @@ interface HttpResponse<StrictBody extends HttpBody.Loose = HttpBody, StatusCode
|
|
|
1302
1288
|
formData: () => Promise<StrictBody extends HttpFormData<infer HttpFormDataSchema> ? StrictFormData<HttpFormDataSchema> : StrictBody extends HttpSearchParams<infer HttpSearchParamsSchema> ? StrictFormData<HttpSearchParamsSchema> : FormData>;
|
|
1303
1289
|
clone: () => this;
|
|
1304
1290
|
}
|
|
1291
|
+
type HttpRequestHeadersSchema<MethodSchema extends HttpMethodSchema> = Default<Default<MethodSchema['request']>['headers']>;
|
|
1292
|
+
type HttpRequestSearchParamsSchema<MethodSchema extends HttpMethodSchema> = Default<Default<MethodSchema['request']>['searchParams']>;
|
|
1293
|
+
type HttpRequestBodySchema<MethodSchema extends HttpMethodSchema> = ReplaceBy<ReplaceBy<IfNever<DefaultNoExclude<Default<MethodSchema['request']>['body']>, null>, undefined, null>, ArrayBuffer, Blob>;
|
|
1294
|
+
type HttpResponseHeadersSchema<MethodSchema extends HttpMethodSchema, StatusCode extends HttpStatusCode> = Default<DefaultNoExclude<Default<Default<MethodSchema['response']>[StatusCode]>['headers']>>;
|
|
1295
|
+
type HttpResponseBodySchema<MethodSchema extends HttpMethodSchema, StatusCode extends HttpStatusCode> = ReplaceBy<ReplaceBy<IfNever<DefaultNoExclude<Default<Default<MethodSchema['response']>[StatusCode]>['body']>, null>, undefined, null>, ArrayBuffer, Blob>;
|
|
1305
1296
|
|
|
1306
|
-
export { type AllowAnyStringInPathParams, HTTP_METHODS, HTTP_METHODS_WITH_REQUEST_BODY, HTTP_METHODS_WITH_RESPONSE_BODY, HttpBody, HttpFormData, HttpFormDataSchema, HttpFormDataSchemaName, type HttpFormDataSerialized, HttpHeaders, type HttpHeadersInit, HttpHeadersSchema, type HttpHeadersSchemaName, type HttpHeadersSchemaTuple, type HttpHeadersSerialized, type HttpMethod, HttpMethodSchema, type HttpMethodWithRequestBody, type HttpMethodWithResponseBody, type HttpMethodsSchema, HttpPathParamsSchema, type HttpPathParamsSerialized, type HttpRequest, type HttpRequestSchema, type HttpResponse, HttpResponseSchema, HttpResponseSchemaByStatusCode, type HttpResponseSchemaStatusCode, HttpSchema, type HttpSchemaMethod, HttpSchemaPath, HttpSearchParams, type HttpSearchParamsInit, HttpSearchParamsSchema, HttpSearchParamsSchemaName, type HttpSearchParamsSchemaTuple, type HttpSearchParamsSerialized, HttpStatusCode, type InferPathParams, type JSONSerialized, JSONValue, type LiteralHttpSchemaPathFromNonLiteral, type MergeHttpResponsesByStatusCode, type StrictFormData, type StrictHeaders, type StrictURLSearchParams };
|
|
1297
|
+
export { type AllowAnyStringInPathParams, HTTP_METHODS, HTTP_METHODS_WITH_REQUEST_BODY, HTTP_METHODS_WITH_RESPONSE_BODY, HttpBody, HttpFormData, HttpFormDataSchema, HttpFormDataSchemaName, type HttpFormDataSerialized, HttpHeaders, type HttpHeadersInit, HttpHeadersSchema, type HttpHeadersSchemaName, type HttpHeadersSchemaTuple, type HttpHeadersSerialized, type HttpMethod, HttpMethodSchema, type HttpMethodWithRequestBody, type HttpMethodWithResponseBody, type HttpMethodsSchema, HttpPathParamsSchema, type HttpPathParamsSerialized, type HttpRequest, type HttpRequestBodySchema, type HttpRequestHeadersSchema, type HttpRequestSchema, type HttpRequestSearchParamsSchema, type HttpResponse, type HttpResponseBodySchema, type HttpResponseHeadersSchema, HttpResponseSchema, HttpResponseSchemaByStatusCode, type HttpResponseSchemaStatusCode, HttpSchema, type HttpSchemaMethod, HttpSchemaPath, HttpSearchParams, type HttpSearchParamsInit, HttpSearchParamsSchema, HttpSearchParamsSchemaName, type HttpSearchParamsSchemaTuple, type HttpSearchParamsSerialized, HttpStatusCode, type InferPathParams, type JSONSerialized, JSONValue, type LiteralHttpSchemaPathFromNonLiteral, type MergeHttpResponsesByStatusCode, type StrictFormData, type StrictHeaders, type StrictURLSearchParams };
|
package/dist/index.js
CHANGED
|
@@ -3,27 +3,25 @@
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// ../zimic-utils/dist/chunk-PAWJFY3S.mjs
|
|
7
|
+
var __defProp2 = Object.defineProperty;
|
|
8
|
+
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
|
|
9
|
+
|
|
10
|
+
// ../zimic-utils/dist/chunk-HVLEF6VF.mjs
|
|
7
11
|
async function blobEquals(blob, otherBlob) {
|
|
8
12
|
return blob.type === otherBlob.type && blob.size === otherBlob.size && await blob.text() === await otherBlob.text();
|
|
9
13
|
}
|
|
10
14
|
__name(blobEquals, "blobEquals");
|
|
15
|
+
__name2(blobEquals, "blobEquals");
|
|
16
|
+
var blobEquals_default = blobEquals;
|
|
11
17
|
|
|
12
|
-
//
|
|
13
|
-
function createCachedDynamicImport(importModuleDynamically) {
|
|
14
|
-
let cachedImportResult;
|
|
15
|
-
return /* @__PURE__ */ __name(async function importModuleDynamicallyWithCache() {
|
|
16
|
-
if (cachedImportResult === undefined) {
|
|
17
|
-
cachedImportResult = await importModuleDynamically();
|
|
18
|
-
}
|
|
19
|
-
return cachedImportResult;
|
|
20
|
-
}, "importModuleDynamicallyWithCache");
|
|
21
|
-
}
|
|
22
|
-
__name(createCachedDynamicImport, "createCachedDynamicImport");
|
|
18
|
+
// ../zimic-utils/dist/data/fileEquals.mjs
|
|
23
19
|
async function fileEquals(file, otherFile) {
|
|
24
|
-
return file.name === otherFile.name && await
|
|
20
|
+
return file.name === otherFile.name && await blobEquals_default(file, otherFile);
|
|
25
21
|
}
|
|
26
22
|
__name(fileEquals, "fileEquals");
|
|
23
|
+
__name2(fileEquals, "fileEquals");
|
|
24
|
+
var fileEquals_default = fileEquals;
|
|
27
25
|
|
|
28
26
|
// src/formData/HttpFormData.ts
|
|
29
27
|
var HttpFormData = class extends FormData {
|
|
@@ -31,14 +29,14 @@ var HttpFormData = class extends FormData {
|
|
|
31
29
|
__name(this, "HttpFormData");
|
|
32
30
|
}
|
|
33
31
|
set(name, blobOrValue, fileName) {
|
|
34
|
-
if (fileName ===
|
|
32
|
+
if (fileName === void 0) {
|
|
35
33
|
super.set(name, blobOrValue);
|
|
36
34
|
} else {
|
|
37
35
|
super.set(name, blobOrValue, fileName);
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
append(name, blobOrValue, fileName) {
|
|
41
|
-
if (fileName ===
|
|
39
|
+
if (fileName === void 0) {
|
|
42
40
|
super.append(name, blobOrValue);
|
|
43
41
|
} else {
|
|
44
42
|
super.append(name, blobOrValue, fileName);
|
|
@@ -111,7 +109,7 @@ var HttpFormData = class extends FormData {
|
|
|
111
109
|
}
|
|
112
110
|
let valueExists = false;
|
|
113
111
|
for (const value of values) {
|
|
114
|
-
if (value === otherValue || value instanceof Blob && otherValue instanceof Blob && await
|
|
112
|
+
if (value === otherValue || value instanceof Blob && otherValue instanceof Blob && await fileEquals_default(value, otherValue)) {
|
|
115
113
|
valueExists = true;
|
|
116
114
|
break;
|
|
117
115
|
}
|
|
@@ -145,7 +143,7 @@ var HttpFormData = class extends FormData {
|
|
|
145
143
|
}
|
|
146
144
|
let valueExists = false;
|
|
147
145
|
for (const value of values) {
|
|
148
|
-
if (value === otherValue || typeof value === "string" && typeof otherValue === "string" && value === otherValue || value instanceof Blob && otherValue instanceof Blob && await
|
|
146
|
+
if (value === otherValue || typeof value === "string" && typeof otherValue === "string" && value === otherValue || value instanceof Blob && otherValue instanceof Blob && await fileEquals_default(value, otherValue)) {
|
|
149
147
|
valueExists = true;
|
|
150
148
|
break;
|
|
151
149
|
}
|
|
@@ -202,7 +200,7 @@ var HttpFormData_default = HttpFormData;
|
|
|
202
200
|
// src/headers/HttpHeaders.ts
|
|
203
201
|
function pickPrimitiveProperties(schema) {
|
|
204
202
|
return Object.entries(schema).reduce((accumulated, [key, value]) => {
|
|
205
|
-
if (value !==
|
|
203
|
+
if (value !== void 0) {
|
|
206
204
|
accumulated[key] = value;
|
|
207
205
|
}
|
|
208
206
|
return accumulated;
|
|
@@ -353,7 +351,7 @@ var HttpHeaders_default = HttpHeaders;
|
|
|
353
351
|
function pickPrimitiveProperties2(schema) {
|
|
354
352
|
const schemaWithPrimitiveProperties = Object.entries(schema).reduce(
|
|
355
353
|
(accumulated, [key, value]) => {
|
|
356
|
-
if (value !==
|
|
354
|
+
if (value !== void 0 && !Array.isArray(value)) {
|
|
357
355
|
accumulated[key] = value;
|
|
358
356
|
}
|
|
359
357
|
return accumulated;
|