@zayne-labs/callapi-plugins 4.0.29 → 4.0.31
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.
|
@@ -9,7 +9,7 @@ declare const fallBackRouteSchemaKey = "@default";
|
|
|
9
9
|
type FallBackRouteSchemaKey = typeof fallBackRouteSchemaKey;
|
|
10
10
|
//#endregion
|
|
11
11
|
//#endregion
|
|
12
|
-
//#region ../callapi/dist/index-
|
|
12
|
+
//#region ../callapi/dist/index-DP2YeNBA.d.ts
|
|
13
13
|
//#region src/types/type-helpers.d.ts
|
|
14
14
|
type AnyString = string & NonNullable<unknown>;
|
|
15
15
|
type AnyNumber = number & NonNullable<unknown>;
|
|
@@ -26,8 +26,16 @@ type ArrayOrObject = Record<number | string | symbol, unknown> | unknown[] | rea
|
|
|
26
26
|
type Writeable<TObject, TLevel extends WriteableLevel = "shallow"> = TObject extends ArrayOrObject ? { -readonly [Key in keyof TObject]: TLevel extends "deep" ? NonNullable<TObject[Key]> extends ArrayOrObject ? Writeable<TObject[Key], "deep"> : TObject[Key] : TObject[Key] } : TObject;
|
|
27
27
|
type UnionToIntersection<TUnion> = (TUnion extends unknown ? (param: TUnion) => void : never) extends ((param: infer TParam) => void) ? TParam : never;
|
|
28
28
|
type UnmaskType<TValue> = {
|
|
29
|
-
|
|
30
|
-
}["
|
|
29
|
+
value: TValue;
|
|
30
|
+
}["value"];
|
|
31
|
+
/**
|
|
32
|
+
* @description Userland implementation of NoInfer intrinsic type, but this one doesn't show up on hover like the intrinsic one
|
|
33
|
+
*
|
|
34
|
+
* Prevents TypeScript from inferring `TGeneric` at this position by creating a circular dependency.
|
|
35
|
+
* The tuple index `[TGeneric extends unknown ? 0 : never]` depends on `TGeneric`, forcing TS to
|
|
36
|
+
* skip this site for inference and use other arguments or defaults instead.
|
|
37
|
+
*/
|
|
38
|
+
type NoInferUnMasked<TGeneric> = [TGeneric][TGeneric extends unknown ? 0 : never];
|
|
31
39
|
type RemovePrefix<TPrefix extends "dedupe" | "retry", TKey extends string> = TKey extends `${TPrefix}${infer TRest}` ? Uncapitalize<TRest> : TKey;
|
|
32
40
|
type Awaitable<TValue> = Promise<TValue> | TValue;
|
|
33
41
|
type DistributiveOmit<TObject, TKeysToOmit extends keyof TObject> = TObject extends unknown ? Omit<TObject, TKeysToOmit> : never;
|
|
@@ -93,15 +101,10 @@ type StreamProgressEvent = {
|
|
|
93
101
|
*/
|
|
94
102
|
transferredBytes: number;
|
|
95
103
|
};
|
|
96
|
-
declare global {
|
|
97
|
-
interface ReadableStream<R$1 = any> {
|
|
98
|
-
[Symbol.asyncIterator]: () => AsyncIterableIterator<R$1>;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
104
|
//#endregion
|
|
102
105
|
//#region src/middlewares.d.ts
|
|
103
106
|
type FetchImpl = UnmaskType<(input: string | Request | URL, init?: RequestInit) => Promise<Response>>;
|
|
104
|
-
interface Middlewares<TCallApiContext extends CallApiContext = DefaultCallApiContext> {
|
|
107
|
+
interface Middlewares<TCallApiContext extends NoInfer<CallApiContext> = DefaultCallApiContext> {
|
|
105
108
|
/**
|
|
106
109
|
* Wraps the fetch implementation to intercept requests at the network layer.
|
|
107
110
|
*
|
|
@@ -353,6 +356,7 @@ declare namespace StandardSchemaV1 {
|
|
|
353
356
|
type ResultVariant = "infer-input" | "infer-output";
|
|
354
357
|
type InferSchemaResult<TSchema, TFallbackResult, TResultVariant extends ResultVariant> = undefined extends TSchema ? TFallbackResult : TSchema extends StandardSchemaV1 ? TResultVariant extends "infer-input" ? StandardSchemaV1.InferInput<TSchema> : StandardSchemaV1.InferOutput<TSchema> : TSchema extends AnyFunction$1<infer TResult> ? Awaited<TResult> : TFallbackResult;
|
|
355
358
|
type InferSchemaOutput<TSchema, TFallbackResult = unknown> = InferSchemaResult<TSchema, TFallbackResult, "infer-output">;
|
|
359
|
+
type BooleanObject = { [Key in keyof CallApiSchema]: boolean };
|
|
356
360
|
interface CallApiSchemaConfig {
|
|
357
361
|
/**
|
|
358
362
|
* The base url of the schema. By default it's the baseURL of the callApi instance.
|
|
@@ -361,14 +365,14 @@ interface CallApiSchemaConfig {
|
|
|
361
365
|
/**
|
|
362
366
|
* Disables runtime validation for the schema.
|
|
363
367
|
*/
|
|
364
|
-
disableRuntimeValidation?: boolean;
|
|
368
|
+
disableRuntimeValidation?: boolean | BooleanObject;
|
|
365
369
|
/**
|
|
366
370
|
* If `true`, the original input value will be used instead of the transformed/validated output.
|
|
367
371
|
*
|
|
368
372
|
* This is useful when you want to validate the input but don't want any transformations
|
|
369
373
|
* applied by the validation schema (e.g., type coercion, default values, etc).
|
|
370
374
|
*/
|
|
371
|
-
disableValidationOutputApplication?: boolean;
|
|
375
|
+
disableValidationOutputApplication?: boolean | BooleanObject;
|
|
372
376
|
/**
|
|
373
377
|
* Optional url prefix that will be substituted for the `baseURL` of the schemaConfig at runtime.
|
|
374
378
|
*
|
|
@@ -738,7 +742,7 @@ interface Hooks<TCallApiContext extends CallApiContext = DefaultCallApiContext>
|
|
|
738
742
|
*/
|
|
739
743
|
onValidationError?: (context: ValidationErrorContext<TCallApiContext>) => Awaitable<unknown>;
|
|
740
744
|
}
|
|
741
|
-
type HooksOrHooksArray<TCallApiContext extends CallApiContext = DefaultCallApiContext> = { [Key in keyof Hooks<TCallApiContext>]: Hooks<TCallApiContext>[Key] | Array<Hooks<TCallApiContext>[Key]> };
|
|
745
|
+
type HooksOrHooksArray<TCallApiContext extends NoInfer<CallApiContext> = DefaultCallApiContext> = { [Key in keyof Hooks<TCallApiContext>]: Hooks<TCallApiContext>[Key] | Array<Hooks<TCallApiContext>[Key]> };
|
|
742
746
|
interface HookConfigOptions {
|
|
743
747
|
/**
|
|
744
748
|
* Controls the execution mode of all composed hooks (main + plugin hooks).
|
|
@@ -789,7 +793,7 @@ type ValidationErrorContext<TCallApiContext extends Pick<CallApiContext, "Inferr
|
|
|
789
793
|
response: Response | null;
|
|
790
794
|
};
|
|
791
795
|
type SuccessContext<TCallApiContext extends Pick<CallApiContext, "Data" | "InferredExtraOptions" | "Meta"> = DefaultCallApiContext> = RequestContext<TCallApiContext> & {
|
|
792
|
-
data:
|
|
796
|
+
data: TCallApiContext["Data"];
|
|
793
797
|
response: Response;
|
|
794
798
|
};
|
|
795
799
|
type ResponseContext<TCallApiContext extends Pick<CallApiContext, "Data" | "ErrorData" | "InferredExtraOptions" | "Meta"> = DefaultCallApiContext> = RequestContext<TCallApiContext> & (Prettify<CallApiResultSuccessVariant<TCallApiContext["Data"]>> | Prettify<Extract<CallApiResultErrorVariant<TCallApiContext["ErrorData"]>, {
|
|
@@ -1190,7 +1194,7 @@ type SharedExtraOptions<TCallApiContext extends CallApiContext = DefaultCallApiC
|
|
|
1190
1194
|
ErrorData: TErrorData;
|
|
1191
1195
|
InferredExtraOptions: TComputedMergedPluginExtraOptions;
|
|
1192
1196
|
ResultMode: TResultMode;
|
|
1193
|
-
}>> = DedupeOptions & HookConfigOptions & HooksOrHooksArray<TComputedCallApiContext
|
|
1197
|
+
}>> = DedupeOptions & HookConfigOptions & HooksOrHooksArray<NoInferUnMasked<TComputedCallApiContext>> & Middlewares<NoInferUnMasked<TComputedCallApiContext>> & ResultModeOption<TErrorData, TResultMode> & RetryOptions<TErrorData> & TComputedMergedPluginExtraOptions & ThrowOnErrorOption<TErrorData, TThrowOnError> & URLOptions & {
|
|
1194
1198
|
/**
|
|
1195
1199
|
* Automatically add an Authorization header value.
|
|
1196
1200
|
*
|
|
@@ -1726,7 +1730,7 @@ type ResponseTypeUnion = keyof InitResponseTypeMap;
|
|
|
1726
1730
|
type ResponseTypePlaceholder = null;
|
|
1727
1731
|
type ResponseTypeType = ResponseTypePlaceholder | ResponseTypeUnion;
|
|
1728
1732
|
type CallApiResultSuccessVariant<TData> = {
|
|
1729
|
-
data:
|
|
1733
|
+
data: NoInferUnMasked<TData>;
|
|
1730
1734
|
error: null;
|
|
1731
1735
|
response: Response;
|
|
1732
1736
|
};
|
|
@@ -1737,7 +1741,7 @@ type PossibleJavaScriptError = UnmaskType<{
|
|
|
1737
1741
|
originalError: DOMException | Error | SyntaxError | TypeError;
|
|
1738
1742
|
}>;
|
|
1739
1743
|
type PossibleHTTPError<TErrorData> = UnmaskType<{
|
|
1740
|
-
errorData:
|
|
1744
|
+
errorData: NoInferUnMasked<TErrorData>;
|
|
1741
1745
|
message: string;
|
|
1742
1746
|
name: "HTTPError";
|
|
1743
1747
|
originalError: HTTPError;
|
|
@@ -1759,20 +1763,13 @@ type CallApiResultErrorVariant<TErrorData> = {
|
|
|
1759
1763
|
error: PossibleJavaScriptOrValidationError;
|
|
1760
1764
|
response: Response | null;
|
|
1761
1765
|
};
|
|
1762
|
-
type
|
|
1763
|
-
type
|
|
1766
|
+
type CallApiResultSuccessOrErrorVariant<TData, TError> = CallApiResultErrorVariant<TError> | CallApiResultSuccessVariant<TData>;
|
|
1767
|
+
type ResultModeMap<TData = DefaultDataType, TErrorData = DefaultDataType, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TComputedResultWithoutException extends CallApiResultSuccessOrErrorVariant<TData, TErrorData> = CallApiResultSuccessOrErrorVariant<TData, TErrorData>, TComputedResultWithException extends CallApiResultSuccessVariant<TData> = CallApiResultSuccessVariant<TData>, TComputedResult extends (TThrowOnError extends true ? TComputedResultWithException : TComputedResultWithoutException) = (TThrowOnError extends true ? TComputedResultWithException : TComputedResultWithoutException)> = UnmaskType<{
|
|
1764
1768
|
all: TComputedResult;
|
|
1765
1769
|
onlyData: TComputedResult["data"];
|
|
1766
1770
|
onlyResponse: TComputedResult["response"];
|
|
1767
|
-
withoutResponse: DistributiveOmit<TComputedResult, "response"
|
|
1771
|
+
withoutResponse: Prettify<DistributiveOmit<TComputedResult, "response">>;
|
|
1768
1772
|
}>;
|
|
1769
|
-
type ResultModeMapWithException<TData, TComputedResult extends CallApiResultSuccessVariant<TData> = CallApiResultSuccessVariant<TData>> = {
|
|
1770
|
-
all: TComputedResult;
|
|
1771
|
-
onlyData: TComputedResult["data"];
|
|
1772
|
-
onlyResponse: TComputedResult["response"];
|
|
1773
|
-
withoutResponse: DistributiveOmit<TComputedResult, "response">;
|
|
1774
|
-
};
|
|
1775
|
-
type ResultModeMap<TData = DefaultDataType, TErrorData = DefaultDataType, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError> = TThrowOnError extends true ? ResultModeMapWithException<TData> : ResultModeMapWithoutException<TData, TErrorData>;
|
|
1776
1773
|
type ResultModePlaceholder = null;
|
|
1777
1774
|
type ResultModeUnion = keyof ResultModeMap;
|
|
1778
1775
|
type ResultModeType = ResultModePlaceholder | ResultModeUnion;
|
|
@@ -1851,4 +1848,4 @@ declare const loggerPlugin: (options?: LoggerOptions) => {
|
|
|
1851
1848
|
};
|
|
1852
1849
|
//#endregion
|
|
1853
1850
|
export { defaultConsoleObject as n, loggerPlugin as r, LoggerOptions as t };
|
|
1854
|
-
//# sourceMappingURL=index-
|
|
1851
|
+
//# sourceMappingURL=index-DtZjKewM.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as defaultConsoleObject, r as loggerPlugin, t as LoggerOptions } from "./index-
|
|
1
|
+
import { n as defaultConsoleObject, r as loggerPlugin, t as LoggerOptions } from "./index-DtZjKewM.js";
|
|
2
2
|
export { LoggerOptions, defaultConsoleObject, loggerPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as defaultConsoleObject, r as loggerPlugin, t as LoggerOptions } from "../../index-
|
|
1
|
+
import { n as defaultConsoleObject, r as loggerPlugin, t as LoggerOptions } from "../../index-DtZjKewM.js";
|
|
2
2
|
export { LoggerOptions, defaultConsoleObject, loggerPlugin };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zayne-labs/callapi-plugins",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.31",
|
|
5
5
|
"description": "A collection of plugins for callapi",
|
|
6
6
|
"author": "Ryan Zayne",
|
|
7
7
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@zayne-labs/toolkit-type-helpers": ">=0.11.17",
|
|
26
26
|
"consola": "3.x.x",
|
|
27
|
-
"@zayne-labs/callapi": "1.11.
|
|
27
|
+
"@zayne-labs/callapi": "1.11.31"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@arethetypeswrong/cli": "0.18.2",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"cross-env": "^10.1.0",
|
|
39
39
|
"publint": "^0.3.15",
|
|
40
40
|
"size-limit": "12.0.0",
|
|
41
|
-
"tsdown": "0.17.0-beta.
|
|
41
|
+
"tsdown": "0.17.0-beta.5",
|
|
42
42
|
"typescript": "5.9.3",
|
|
43
|
-
"vitest": "^4.0.
|
|
44
|
-
"@zayne-labs/callapi": "1.11.
|
|
43
|
+
"vitest": "^4.0.15",
|
|
44
|
+
"@zayne-labs/callapi": "1.11.31"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public",
|