@zayne-labs/callapi-plugins 4.0.25 → 4.0.26
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/index.d.ts +19 -19
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare const fallBackRouteSchemaKey = "@default";
|
|
|
10
10
|
type FallBackRouteSchemaKey = typeof fallBackRouteSchemaKey;
|
|
11
11
|
//#endregion
|
|
12
12
|
//#endregion
|
|
13
|
-
//#region ../callapi/dist/validation-
|
|
13
|
+
//#region ../callapi/dist/validation-BeCBQ6_6.d.ts
|
|
14
14
|
//#region src/types/type-helpers.d.ts
|
|
15
15
|
type AnyString = string & NonNullable<unknown>;
|
|
16
16
|
type AnyNumber = number & NonNullable<unknown>;
|
|
@@ -461,7 +461,7 @@ interface URLOptions {
|
|
|
461
461
|
}
|
|
462
462
|
//#endregion
|
|
463
463
|
//#region src/plugins.d.ts
|
|
464
|
-
type PluginSetupContext<TPluginExtraOptions = unknown> =
|
|
464
|
+
type PluginSetupContext<TPluginExtraOptions = unknown> = PluginExtraOptions<TPluginExtraOptions> & RequestContext & {
|
|
465
465
|
initURL: string;
|
|
466
466
|
};
|
|
467
467
|
type PluginInitResult = Partial<Omit<PluginSetupContext, "initURL" | "request"> & {
|
|
@@ -1121,11 +1121,7 @@ type InferHeadersOption<TSchema$1 extends CallApiSchema> = MakeSchemaOptionRequi
|
|
|
1121
1121
|
}) => InferSchemaOutput<TSchema$1["headers"], HeadersOption>);
|
|
1122
1122
|
}>;
|
|
1123
1123
|
type InferRequestOptions<TSchema$1 extends CallApiSchema, TInitURL extends InferInitURL<BaseCallApiSchemaRoutes, CallApiSchemaConfig>> = InferBodyOption<TSchema$1> & InferHeadersOption<TSchema$1> & InferMethodOption<TSchema$1, TInitURL>;
|
|
1124
|
-
|
|
1125
|
-
type GlobalMeta = Register extends {
|
|
1126
|
-
meta?: infer TMeta extends Record<string, unknown>;
|
|
1127
|
-
} ? TMeta : never;
|
|
1128
|
-
type InferMetaOption<TSchema$1 extends CallApiSchema, TCallApiEnv extends CallApiEnv> = MakeSchemaOptionRequiredIfDefined<TSchema$1["meta"], {
|
|
1124
|
+
type InferMetaOption<TSchema$1 extends CallApiSchema, TCallApiContext extends CallApiContext> = MakeSchemaOptionRequiredIfDefined<TSchema$1["meta"], {
|
|
1129
1125
|
/**
|
|
1130
1126
|
* - An optional field you can fill with additional information,
|
|
1131
1127
|
* to associate with the request, typically used for logging or tracing.
|
|
@@ -1149,7 +1145,7 @@ type InferMetaOption<TSchema$1 extends CallApiSchema, TCallApiEnv extends CallAp
|
|
|
1149
1145
|
* });
|
|
1150
1146
|
* ```
|
|
1151
1147
|
*/
|
|
1152
|
-
meta?: InferSchemaOutput<TSchema$1["meta"],
|
|
1148
|
+
meta?: InferSchemaOutput<TSchema$1["meta"], TCallApiContext["Meta"]>;
|
|
1153
1149
|
}>;
|
|
1154
1150
|
type InferQueryOption<TSchema$1 extends CallApiSchema> = MakeSchemaOptionRequiredIfDefined<TSchema$1["query"], {
|
|
1155
1151
|
/**
|
|
@@ -1172,7 +1168,7 @@ type InferParamsOption<TSchema$1 extends CallApiSchema, TBaseSchemaRoutes$1 exte
|
|
|
1172
1168
|
*/
|
|
1173
1169
|
params?: InferSchemaOutput<TSchema$1["params"], InferParamsFromRoute<TCurrentRouteSchemaKey>>;
|
|
1174
1170
|
}>;
|
|
1175
|
-
type InferExtraOptions<TSchema$1 extends CallApiSchema, TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string,
|
|
1171
|
+
type InferExtraOptions<TSchema$1 extends CallApiSchema, TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes, TCurrentRouteSchemaKey extends string, TCallApiContext extends CallApiContext> = InferMetaOption<TSchema$1, TCallApiContext> & InferParamsOption<TSchema$1, TBaseSchemaRoutes$1, TCurrentRouteSchemaKey> & InferQueryOption<TSchema$1>;
|
|
1176
1172
|
type InferPluginOptions<TPluginArray extends CallApiPlugin[]> = UnionToIntersection<TPluginArray extends Array<infer TPlugin> ? TPlugin extends CallApiPlugin ? TPlugin["defineExtraOptions"] extends AnyFunction$1<infer TReturnedSchema> ? InferSchemaOutput<TReturnedSchema> : never : never : never>;
|
|
1177
1173
|
type ResultModeOption<TErrorData$1, TResultMode extends ResultModeType> = TErrorData$1 extends false ? {
|
|
1178
1174
|
resultMode: "onlyData";
|
|
@@ -1192,9 +1188,13 @@ type ThrowOnErrorOption<TErrorData$1, TThrowOnError extends ThrowOnErrorUnion> =
|
|
|
1192
1188
|
};
|
|
1193
1189
|
//#endregion
|
|
1194
1190
|
//#region src/types/common.d.ts
|
|
1195
|
-
|
|
1196
|
-
type
|
|
1197
|
-
|
|
1191
|
+
interface Register {}
|
|
1192
|
+
type MetaObjectType = Record<string, unknown>;
|
|
1193
|
+
type GlobalMeta = Register extends {
|
|
1194
|
+
meta?: infer TMeta extends MetaObjectType;
|
|
1195
|
+
} ? TMeta : never;
|
|
1196
|
+
type CallApiContext = {
|
|
1197
|
+
Meta?: MetaObjectType;
|
|
1198
1198
|
};
|
|
1199
1199
|
type FetchSpecificKeysUnion = Exclude<(typeof fetchSpecificKeys)[number], "body" | "headers" | "method">;
|
|
1200
1200
|
type ModifiedRequestInit = RequestInit & {
|
|
@@ -1218,7 +1218,7 @@ type CallApiRequestOptions = Prettify<{
|
|
|
1218
1218
|
type CallApiRequestOptionsForHooks = Omit<CallApiRequestOptions, "headers"> & {
|
|
1219
1219
|
headers: Record<string, string | undefined>;
|
|
1220
1220
|
};
|
|
1221
|
-
type SharedExtraOptions<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TResultMode extends ResultModeType = ResultModeType,
|
|
1221
|
+
type SharedExtraOptions<TCallApiContext extends CallApiContext = CallApiContext, TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = DedupeOptions & HookConfigOptions & HooksOrHooksArray<TData$1, TErrorData$1, Partial<InferPluginOptions<TPluginArray>>> & Middlewares & Partial<InferPluginOptions<TPluginArray>> & ResultModeOption<TErrorData$1, TResultMode> & RetryOptions<TErrorData$1> & ThrowOnErrorOption<TErrorData$1, TThrowOnError> & URLOptions & {
|
|
1222
1222
|
/**
|
|
1223
1223
|
* Automatically add an Authorization header value.
|
|
1224
1224
|
*
|
|
@@ -1396,7 +1396,7 @@ type SharedExtraOptions<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataTyp
|
|
|
1396
1396
|
* });
|
|
1397
1397
|
* ```
|
|
1398
1398
|
*/
|
|
1399
|
-
meta?:
|
|
1399
|
+
meta?: TCallApiContext["Meta"];
|
|
1400
1400
|
/**
|
|
1401
1401
|
* Custom function to parse response strings into actual value instead of the default response.json().
|
|
1402
1402
|
*
|
|
@@ -1592,7 +1592,7 @@ type SharedExtraOptions<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataTyp
|
|
|
1592
1592
|
*/
|
|
1593
1593
|
timeout?: number;
|
|
1594
1594
|
};
|
|
1595
|
-
type BaseCallApiExtraOptions<TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeType = ResultModeType,
|
|
1595
|
+
type BaseCallApiExtraOptions<TBaseCallApiContext extends CallApiContext = CallApiContext, TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeType = ResultModeType, TBaseThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TBaseResponseType extends ResponseTypeType = ResponseTypeType, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig> = SharedExtraOptions<TBaseCallApiContext, TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBasePluginArray> & {
|
|
1596
1596
|
/**
|
|
1597
1597
|
* Array of base CallApi plugins to extend library functionality.
|
|
1598
1598
|
*
|
|
@@ -1702,7 +1702,7 @@ type InferExtendSchemaConfigContext<TBaseSchemaConfig extends CallApiSchemaConfi
|
|
|
1702
1702
|
type InferExtendPluginContext<TBasePluginArray extends CallApiPlugin[]> = {
|
|
1703
1703
|
basePlugins: TBasePluginArray;
|
|
1704
1704
|
};
|
|
1705
|
-
type CallApiExtraOptions<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TResultMode extends ResultModeType = ResultModeType,
|
|
1705
|
+
type CallApiExtraOptions<TCallApiContext extends CallApiContext = CallApiContext, TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray, TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema$1 extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig$1 extends CallApiSchemaConfig = CallApiSchemaConfig, TCurrentRouteSchemaKey extends string = string, TComputedPluginContext = InferExtendPluginContext<TBasePluginArray>, TComputedSchemaContext = InferExtendSchemaContext<TBaseSchemaRoutes$1, TCurrentRouteSchemaKey>, TComputedSchemaConfigContext = InferExtendSchemaConfigContext<TBaseSchemaConfig>> = SharedExtraOptions<TCallApiContext, TData$1, TErrorData$1, TResultMode, TThrowOnError, TResponseType, TPluginArray> & {
|
|
1706
1706
|
/**
|
|
1707
1707
|
* Array of instance-specific CallApi plugins or a function to configure plugins.
|
|
1708
1708
|
*
|
|
@@ -1730,14 +1730,14 @@ type CallApiExtraOptions<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataTy
|
|
|
1730
1730
|
*/
|
|
1731
1731
|
schemaConfig?: TSchemaConfig$1 | ((context: TComputedSchemaConfigContext) => TSchemaConfig$1);
|
|
1732
1732
|
};
|
|
1733
|
-
type CallApiExtraOptionsForHooks = Hooks & Omit<CallApiExtraOptions
|
|
1733
|
+
type CallApiExtraOptionsForHooks<TCallApiContext extends CallApiContext = CallApiContext> = Hooks & Omit<CallApiExtraOptions<TCallApiContext>, keyof Hooks>;
|
|
1734
1734
|
type InstanceContext = {
|
|
1735
1735
|
initURL: string;
|
|
1736
1736
|
options: CallApiExtraOptions;
|
|
1737
1737
|
request: CallApiRequestOptions;
|
|
1738
1738
|
};
|
|
1739
|
-
type BaseCallApiConfig<TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeType = ResultModeType,
|
|
1740
|
-
type CallApiConfig<TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TResultMode extends ResultModeType = ResultModeType,
|
|
1739
|
+
type BaseCallApiConfig<TBaseCallApiContext extends CallApiContext = CallApiContext, TBaseData = DefaultDataType, TBaseErrorData = DefaultDataType, TBaseResultMode extends ResultModeType = ResultModeType, TBaseThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TBaseResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaAndConfig extends BaseCallApiSchemaAndConfig = BaseCallApiSchemaAndConfig, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TComputedBaseConfig = BaseCallApiExtraOptions<TBaseCallApiContext, TBaseData, TBaseErrorData, TBaseResultMode, TBaseThrowOnError, TBaseResponseType, TBasePluginArray, TBaseSchemaAndConfig>> = (CallApiRequestOptions & TComputedBaseConfig) | ((context: InstanceContext) => CallApiRequestOptions & TComputedBaseConfig);
|
|
1740
|
+
type CallApiConfig<TCallApiContext extends CallApiContext = CallApiContext, TData$1 = DefaultDataType, TErrorData$1 = DefaultDataType, TResultMode extends ResultModeType = ResultModeType, TThrowOnError extends ThrowOnErrorUnion = DefaultThrowOnError, TResponseType extends ResponseTypeType = ResponseTypeType, TBaseSchemaRoutes$1 extends BaseCallApiSchemaRoutes = BaseCallApiSchemaRoutes, TSchema$1 extends CallApiSchema = CallApiSchema, TBaseSchemaConfig extends CallApiSchemaConfig = CallApiSchemaConfig, TSchemaConfig$1 extends CallApiSchemaConfig = CallApiSchemaConfig, TInitURL extends InitURLOrURLObject = InitURLOrURLObject, TCurrentRouteSchemaKey extends string = string, TBasePluginArray extends CallApiPlugin[] = DefaultPluginArray, TPluginArray extends CallApiPlugin[] = DefaultPluginArray> = InferExtraOptions<TSchema$1, TBaseSchemaRoutes$1, TCurrentRouteSchemaKey, TCallApiContext> & InferRequestOptions<TSchema$1, TInitURL> & Omit<CallApiExtraOptions<TCallApiContext, TData$1, TErrorData$1, TResultMode, TThrowOnError, TResponseType, TBasePluginArray, TPluginArray, TBaseSchemaRoutes$1, TSchema$1, TBaseSchemaConfig, TSchemaConfig$1, TCurrentRouteSchemaKey>, keyof InferExtraOptions<CallApiSchema, BaseCallApiSchemaRoutes, string, CallApiContext>> & Omit<CallApiRequestOptions, keyof InferRequestOptions<CallApiSchema, string>>;
|
|
1741
1741
|
//#endregion
|
|
1742
1742
|
//#region src/validation.d.ts
|
|
1743
1743
|
type ResultVariant = "infer-input" | "infer-output";
|
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.26",
|
|
5
5
|
"description": "A collection of plugins for callapi",
|
|
6
6
|
"author": "Ryan Zayne",
|
|
7
7
|
"license": "MIT",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@zayne-labs/toolkit-type-helpers": ">=0.11.17",
|
|
23
23
|
"consola": "3.x.x",
|
|
24
|
-
"@zayne-labs/callapi": "1.11.
|
|
24
|
+
"@zayne-labs/callapi": "1.11.26"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@arethetypeswrong/cli": "0.18.2",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"tsdown": "0.15.9",
|
|
39
39
|
"typescript": "5.9.3",
|
|
40
40
|
"vitest": "^4.0.14",
|
|
41
|
-
"@zayne-labs/callapi": "1.11.
|
|
41
|
+
"@zayne-labs/callapi": "1.11.26"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public",
|