@zimic/fetch 1.2.6 → 1.2.7-canary.0
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/README.md +1 -1
- package/dist/index.d.ts +11 -11
- package/package.json +2 -2
- package/src/client/types/requests.ts +1 -1
- package/src/index.ts +1 -1
- package/src/client/types/json.ts +0 -22
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { HttpSchema, HttpSchemaMethod, HttpSchemaPath, HttpMethodSchema, HttpHeadersSchema, HttpHeadersInit, HttpRequestHeadersSchema, HttpSearchParamsSchema, HttpSearchParamsInit, HttpRequestSearchParamsSchema, HttpBody, HttpRequestSchema, HttpSearchParams, HttpFormData, HttpRequest, HttpRequestBodySchema, AllowAnyStringInPathParams, HttpMethod, HttpStatusCode, HttpResponseSchemaStatusCode, HttpResponse, HttpResponseBodySchema, HttpResponseHeadersSchema, HttpHeadersSerialized, LiteralHttpSchemaPathFromNonLiteral } from '@zimic/http';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* @see {@link https://zimic.dev/docs/fetch/guides/bodies#json-request-body Using a JSON request body}
|
|
10
|
-
*/
|
|
11
|
-
type JSONStringified<Value> = string & {
|
|
12
|
-
[value]: Value;
|
|
13
|
-
};
|
|
3
|
+
type JSON = {
|
|
4
|
+
[key: string]: JSON;
|
|
5
|
+
} | JSON[] | string | number | boolean | null | undefined;
|
|
6
|
+
declare namespace JSON {
|
|
7
|
+
type Loose = Record<string, any> | Loose[] | string | number | boolean | null | undefined;
|
|
8
|
+
}
|
|
14
9
|
declare global {
|
|
15
10
|
interface JSON {
|
|
11
|
+
readonly value: unique symbol;
|
|
16
12
|
stringify<Value>(value: Value, replacer?: ((this: any, key: string, value: Value) => any) | (number | string)[] | null, space?: string | number): JSONStringified<Value>;
|
|
13
|
+
parse<Value>(text: JSONStringified<Value>, reviver?: (this: any, key: string, value: any) => any): Value;
|
|
17
14
|
}
|
|
18
15
|
}
|
|
16
|
+
type JSONStringified<Value> = string & {
|
|
17
|
+
[JSON.value]: Value;
|
|
18
|
+
};
|
|
19
19
|
|
|
20
20
|
type Default<Type, IfEmpty = never> = [undefined | void] extends [Type] ? IfEmpty : Exclude<Type, undefined | void>;
|
|
21
21
|
type PossiblePromise<Type> = Type | PromiseLike<Type>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zimic/fetch",
|
|
3
|
-
"description": "Next-gen TypeScript-first
|
|
3
|
+
"description": "Next-gen TypeScript-first Fetch client",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"zimic",
|
|
6
6
|
"fetch",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"api",
|
|
14
14
|
"static"
|
|
15
15
|
],
|
|
16
|
-
"version": "1.2.
|
|
16
|
+
"version": "1.2.7-canary.0",
|
|
17
17
|
"homepage": "https://zimic.dev/docs/fetch",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
@@ -26,9 +26,9 @@ import {
|
|
|
26
26
|
HttpFormData,
|
|
27
27
|
} from '@zimic/http';
|
|
28
28
|
import { Default } from '@zimic/utils/types';
|
|
29
|
+
import { JSONStringified } from '@zimic/utils/types/json';
|
|
29
30
|
|
|
30
31
|
import FetchResponseError, { AnyFetchRequestError } from '../errors/FetchResponseError';
|
|
31
|
-
import { JSONStringified } from './json';
|
|
32
32
|
import { FetchInput } from './public';
|
|
33
33
|
|
|
34
34
|
type FetchRequestInitWithHeaders<HeadersSchema extends HttpHeadersSchema | undefined> = [HeadersSchema] extends [never]
|
package/src/index.ts
CHANGED
package/src/client/types/json.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
declare const value: unique symbol;
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Represents a value stringified by `JSON.stringify`, maintaining a reference to the original type.
|
|
5
|
-
*
|
|
6
|
-
* This type is used to validate that the expected stringified body is passed to `fetch`.
|
|
7
|
-
*
|
|
8
|
-
* @see {@link https://zimic.dev/docs/fetch/guides/bodies#json-request-body Using a JSON request body}
|
|
9
|
-
*/
|
|
10
|
-
export type JSONStringified<Value> = string & { [value]: Value };
|
|
11
|
-
|
|
12
|
-
declare global {
|
|
13
|
-
interface JSON {
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/method-signature-style
|
|
15
|
-
stringify<Value>(
|
|
16
|
-
value: Value,
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
replacer?: ((this: any, key: string, value: Value) => any) | (number | string)[] | null,
|
|
19
|
-
space?: string | number,
|
|
20
|
-
): JSONStringified<Value>;
|
|
21
|
-
}
|
|
22
|
-
}
|