@zayne-labs/callapi 1.11.28 → 1.11.29
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/constants/index.d.ts +1 -1
- package/dist/constants/index.js +2 -2
- package/dist/{defaults-C6WKIXsf.js → defaults-B-dOt2Dd.js} +1 -1
- package/dist/{defaults-C6WKIXsf.js.map → defaults-B-dOt2Dd.js.map} +1 -1
- package/dist/{guards-DvOwVtmd.js → guards-ZYV-Q_as.js} +2 -2
- package/dist/{guards-DvOwVtmd.js.map → guards-ZYV-Q_as.js.map} +1 -1
- package/dist/{index-j55-O6zR.d.ts → index-CrJL7qOL.d.ts} +1292 -1382
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/external/index.d.ts +75 -3
- package/dist/utils/external/index.js +2 -2
- package/dist/{validation-8gwacxHw.js → validation-DbbofkNi.js} +2 -2
- package/dist/{validation-8gwacxHw.js.map → validation-DbbofkNi.js.map} +1 -1
- package/dist/{validation-Dq--Q5zC.d.ts → validation-Do6HBp6Z.d.ts} +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,75 @@
|
|
|
1
|
-
import "../../validation-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import "../../validation-Do6HBp6Z.js";
|
|
2
|
+
import { $ as Writeable, B as CallApiPlugin, D as ValidationError, E as HTTPError, K as CallApiSchema, Q as Satisfies, W as BaseCallApiSchemaRoutes, Z as AnyFunction, c as PossibleJavaScriptError, g as CallApiExtraOptions, i as CallApiResultErrorVariant, p as BaseCallApiConfig, q as CallApiSchemaConfig, s as PossibleHTTPError, u as PossibleValidationError } from "../../index-CrJL7qOL.js";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/external/body.d.ts
|
|
5
|
+
type ToQueryStringFn = {
|
|
6
|
+
(query: CallApiExtraOptions["query"]): string | null;
|
|
7
|
+
(query: Required<CallApiExtraOptions>["query"]): string;
|
|
8
|
+
};
|
|
9
|
+
declare const toQueryString: ToQueryStringFn;
|
|
10
|
+
type AllowedPrimitives = boolean | number | string | Blob | null | undefined;
|
|
11
|
+
type AllowedValues = AllowedPrimitives | AllowedPrimitives[] | Record<string, AllowedPrimitives>;
|
|
12
|
+
/**
|
|
13
|
+
* @description Converts a plain object to FormData.
|
|
14
|
+
*
|
|
15
|
+
* Handles various data types:
|
|
16
|
+
* - **Primitives** (string, number, boolean): Converted to strings
|
|
17
|
+
* - **Blobs/Files**: Added directly to FormData
|
|
18
|
+
* - **Arrays**: Each item is appended (allows multiple values for same key)
|
|
19
|
+
* - **Objects**: JSON stringified before adding to FormData
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* // Basic usage
|
|
24
|
+
* const formData = toFormData({
|
|
25
|
+
* name: "John",
|
|
26
|
+
* age: 30,
|
|
27
|
+
* active: true
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // With arrays
|
|
31
|
+
* const formData = toFormData({
|
|
32
|
+
* tags: ["javascript", "typescript"],
|
|
33
|
+
* name: "John"
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // With files
|
|
37
|
+
* const formData = toFormData({
|
|
38
|
+
* avatar: fileBlob,
|
|
39
|
+
* name: "John"
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // With nested objects (one level only)
|
|
43
|
+
* const formData = toFormData({
|
|
44
|
+
* user: { name: "John", age: 30 },
|
|
45
|
+
* settings: { theme: "dark" }
|
|
46
|
+
* });
|
|
47
|
+
*/
|
|
48
|
+
declare const toFormData: (data: Record<string, AllowedValues>) => FormData;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/utils/external/define.d.ts
|
|
51
|
+
declare const defineSchema: <const TBaseSchemaRoutes extends BaseCallApiSchemaRoutes, const TSchemaConfig extends CallApiSchemaConfig>(routes: TBaseSchemaRoutes, config?: Satisfies<TSchemaConfig, CallApiSchemaConfig>) => {
|
|
52
|
+
config: Writeable<Satisfies<TSchemaConfig, CallApiSchemaConfig>, "deep">;
|
|
53
|
+
routes: Writeable<TBaseSchemaRoutes, "deep">;
|
|
54
|
+
};
|
|
55
|
+
declare const defineSchemaRoutes: <const TSchemaRoutes extends BaseCallApiSchemaRoutes>(routes: TSchemaRoutes) => Writeable<typeof routes, "deep">;
|
|
56
|
+
declare const defineMainSchema: <const TSchema extends CallApiSchema>(mainSchema: Satisfies<TSchema, CallApiSchema>) => Writeable<typeof mainSchema, "deep">;
|
|
57
|
+
declare const defineSchemaConfig: <const TSchemaConfig extends CallApiSchemaConfig>(config: Satisfies<TSchemaConfig, CallApiSchemaConfig>) => Writeable<typeof config, "deep">;
|
|
58
|
+
declare const definePlugin: <const TPlugin extends CallApiPlugin>(plugin: TPlugin) => Writeable<typeof plugin, "deep">;
|
|
59
|
+
type BaseConfigObject = Exclude<BaseCallApiConfig, AnyFunction>;
|
|
60
|
+
type BaseConfigFn = Extract<BaseCallApiConfig, AnyFunction>;
|
|
61
|
+
type DefineBaseConfig = {
|
|
62
|
+
<const TBaseConfig extends BaseConfigObject>(baseConfig: Satisfies<TBaseConfig, BaseConfigObject>): Writeable<typeof baseConfig, "deep">;
|
|
63
|
+
<TBaseConfigFn extends BaseConfigFn>(baseConfig: TBaseConfigFn): TBaseConfigFn;
|
|
64
|
+
};
|
|
65
|
+
declare const defineBaseConfig: DefineBaseConfig;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/utils/external/guards.d.ts
|
|
68
|
+
declare const isHTTPError: <TErrorData>(error: CallApiResultErrorVariant<TErrorData>["error"] | null) => error is PossibleHTTPError<TErrorData>;
|
|
69
|
+
declare const isHTTPErrorInstance: <TErrorData>(error: unknown) => error is HTTPError<TErrorData>;
|
|
70
|
+
declare const isValidationError: (error: CallApiResultErrorVariant<unknown>["error"] | null) => error is PossibleValidationError;
|
|
71
|
+
declare const isValidationErrorInstance: (error: unknown) => error is ValidationError;
|
|
72
|
+
declare const isJavascriptError: (error: CallApiResultErrorVariant<unknown>["error"] | null) => error is PossibleJavaScriptError;
|
|
73
|
+
//#endregion
|
|
74
|
+
export { HTTPError, ValidationError, defineBaseConfig, defineMainSchema, definePlugin, defineSchema, defineSchemaConfig, defineSchemaRoutes, isHTTPError, isHTTPErrorInstance, isJavascriptError, isValidationError, isValidationErrorInstance, toFormData, toQueryString };
|
|
75
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../../defaults-
|
|
2
|
-
import { a as isValidationErrorInstance, c as toFormData, i as isValidationError, l as toQueryString, n as isHTTPErrorInstance, o as HTTPError, r as isJavascriptError, s as ValidationError, t as isHTTPError } from "../../guards-
|
|
1
|
+
import "../../defaults-B-dOt2Dd.js";
|
|
2
|
+
import { a as isValidationErrorInstance, c as toFormData, i as isValidationError, l as toQueryString, n as isHTTPErrorInstance, o as HTTPError, r as isJavascriptError, s as ValidationError, t as isHTTPError } from "../../guards-ZYV-Q_as.js";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/external/define.ts
|
|
5
5
|
const defineSchema = (routes, config) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as defineEnum } from "./defaults-
|
|
1
|
+
import { r as defineEnum } from "./defaults-B-dOt2Dd.js";
|
|
2
2
|
|
|
3
3
|
//#region src/constants/common.ts
|
|
4
4
|
const fetchSpecificKeys = defineEnum([
|
|
@@ -25,4 +25,4 @@ const fallBackRouteSchemaKey = "@default";
|
|
|
25
25
|
|
|
26
26
|
//#endregion
|
|
27
27
|
export { fetchSpecificKeys as n, fallBackRouteSchemaKey as t };
|
|
28
|
-
//# sourceMappingURL=validation-
|
|
28
|
+
//# sourceMappingURL=validation-DbbofkNi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-
|
|
1
|
+
{"version":3,"file":"validation-DbbofkNi.js","names":[],"sources":["../src/constants/common.ts","../src/constants/validation.ts"],"sourcesContent":["import type { ModifiedRequestInit } from \"../types/common\";\nimport { defineEnum } from \"../types/type-helpers\";\n\nexport const fetchSpecificKeys = defineEnum([\n\t\"body\",\n\t\"integrity\",\n\t\"duplex\",\n\t\"method\",\n\t\"headers\",\n\t\"signal\",\n\t\"cache\",\n\t\"redirect\",\n\t\"window\",\n\t\"credentials\",\n\t\"keepalive\",\n\t\"referrer\",\n\t\"priority\",\n\t\"mode\",\n\t\"referrerPolicy\",\n] satisfies Array<keyof ModifiedRequestInit> as Array<keyof ModifiedRequestInit>);\n","export const fallBackRouteSchemaKey = \"@default\";\n\nexport type FallBackRouteSchemaKey = typeof fallBackRouteSchemaKey;\n"],"mappings":";;;AAGA,MAAa,oBAAoB,WAAW;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAgF;;;;ACnBjF,MAAa,yBAAyB"}
|
|
@@ -6,4 +6,4 @@ declare const fallBackRouteSchemaKey = "@default";
|
|
|
6
6
|
type FallBackRouteSchemaKey = typeof fallBackRouteSchemaKey;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { fallBackRouteSchemaKey as n, fetchSpecificKeys as r, FallBackRouteSchemaKey as t };
|
|
9
|
-
//# sourceMappingURL=validation-
|
|
9
|
+
//# sourceMappingURL=validation-Do6HBp6Z.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zayne-labs/callapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.11.
|
|
4
|
+
"version": "1.11.29",
|
|
5
5
|
"description": "A lightweight wrapper over fetch with quality of life improvements like built-in request cancellation, retries, interceptors and more",
|
|
6
6
|
"author": "Ryan Zayne",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"playwright": "^1.57.0",
|
|
50
50
|
"publint": "^0.3.15",
|
|
51
51
|
"size-limit": "12.0.0",
|
|
52
|
-
"tsdown": "0.
|
|
52
|
+
"tsdown": "0.17.0-beta.4",
|
|
53
53
|
"typescript": "5.9.3",
|
|
54
54
|
"vitest": "^4.0.14",
|
|
55
55
|
"zod": "^4.1.13"
|