@forklaunch/core 0.11.5 → 0.11.6
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/lib/http/index.d.mts +22 -6
- package/lib/http/index.d.ts +22 -6
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs.map +1 -1
- package/package.json +3 -3
package/lib/http/index.d.mts
CHANGED
@@ -818,18 +818,18 @@ interface LiveTypeRouteDefinition<SV extends AnySchemaValidator, BasePath extend
|
|
818
818
|
sdk: object;
|
819
819
|
}> {
|
820
820
|
<Name extends string, Path extends `/${string}`, SuppliedPath extends Path, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, BaseRequest>>(path: PathMatch<SuppliedPath, Path>, typedHandler: TypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth>): ChainableRouter & {
|
821
|
-
fetchMap: Prettify<ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth
|
821
|
+
fetchMap: Prettify<ChainableRouter['fetchMap'] extends Record<SanitizePathSlashes<`${BasePath}${Path}`>, unknown> ? ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, ChainableRouter['fetchMap'][SanitizePathSlashes<`${BasePath}${Path}`>] & Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>> : ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>>>;
|
822
822
|
sdk: Prettify<ChainableRouter['sdk'] & Record<PrettyCamelCase<Name>, LiveSdkFunction<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, Auth>>>;
|
823
823
|
};
|
824
824
|
<Name extends string, Path extends `/${string}`, SuppliedPath extends Path, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, BaseRequest>>(path: PathMatch<SuppliedPath, Path>, middleware: ExpressLikeSchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction>, ...middlewareAndTypedHandler: [
|
825
825
|
...ExpressLikeSchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction>[],
|
826
826
|
TypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth>
|
827
827
|
]): ChainableRouter & {
|
828
|
-
fetchMap: Prettify<ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth
|
828
|
+
fetchMap: Prettify<ChainableRouter['fetchMap'] extends Record<SanitizePathSlashes<`${BasePath}${Path}`>, unknown> ? ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, ChainableRouter['fetchMap'][SanitizePathSlashes<`${BasePath}${Path}`>] & Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>> : ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>>>;
|
829
829
|
sdk: Prettify<ChainableRouter['sdk'] & Record<PrettyCamelCase<Name>, LiveSdkFunction<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, Auth>>>;
|
830
830
|
};
|
831
831
|
<Name extends string, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, BaseRequest>>(path: Path, contractDetails: ContractDetails<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, BaseRequest, Auth>, ...middleware: ExpressLikeSchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction>[]): ChainableRouter & {
|
832
|
-
fetchMap: Prettify<ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth
|
832
|
+
fetchMap: Prettify<ChainableRouter['fetchMap'] extends Record<SanitizePathSlashes<`${BasePath}${Path}`>, unknown> ? ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, ChainableRouter['fetchMap'][SanitizePathSlashes<`${BasePath}${Path}`>] & Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>> : ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>>>;
|
833
833
|
sdk: Prettify<ChainableRouter['sdk'] & Record<PrettyCamelCase<Name>, LiveSdkFunction<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, Auth>>>;
|
834
834
|
};
|
835
835
|
}
|
@@ -982,7 +982,7 @@ type MiddlewareOrMiddlewareWithTypedHandler<SV extends AnySchemaValidator, Name
|
|
982
982
|
* });
|
983
983
|
* ```
|
984
984
|
**/
|
985
|
-
type FetchFunction<FetchMap> = <Path extends keyof FetchMap>(path: Path, ...reqInit: FetchMap[Path] extends TypeSafeFunction ? Parameters<FetchMap[Path]>[1] extends {
|
985
|
+
type FetchFunction<FetchMap> = <const Path extends keyof FetchMap, const Method extends keyof FetchMap[Path]>(path: Path, ...reqInit: FetchMap[Path][Method] extends TypeSafeFunction ? 'get' extends keyof FetchMap[Path] ? FetchMap[Path]['get'] extends TypeSafeFunction ? Parameters<FetchMap[Path]['get']>[1] extends {
|
986
986
|
body: unknown;
|
987
987
|
} | {
|
988
988
|
query: unknown;
|
@@ -990,7 +990,23 @@ type FetchFunction<FetchMap> = <Path extends keyof FetchMap>(path: Path, ...reqI
|
|
990
990
|
params: unknown;
|
991
991
|
} | {
|
992
992
|
headers: unknown;
|
993
|
-
} ? [
|
993
|
+
} ? [
|
994
|
+
reqInit: Omit<Parameters<FetchMap[Path][Method]>[1], 'method'> & {
|
995
|
+
method: Method;
|
996
|
+
}
|
997
|
+
] : [
|
998
|
+
reqInit?: Omit<Parameters<FetchMap[Path][Method]>[1], 'method'> & {
|
999
|
+
method: Method;
|
1000
|
+
}
|
1001
|
+
] : [
|
1002
|
+
reqInit: Omit<Parameters<FetchMap[Path][Method]>[1], 'method'> & {
|
1003
|
+
method: Method;
|
1004
|
+
}
|
1005
|
+
] : [
|
1006
|
+
reqInit: Omit<Parameters<FetchMap[Path][Method]>[1], 'method'> & {
|
1007
|
+
method: Method;
|
1008
|
+
}
|
1009
|
+
] : []) => Promise<FetchMap[Path][Method] extends TypeSafeFunction ? ReturnType<FetchMap[Path][Method]> : never>;
|
994
1010
|
/**
|
995
1011
|
* Creates a router SDK by combining the router's SDK with its fetch functionality.
|
996
1012
|
* This type merges the router's SDK interface with its fetch methods to create
|
@@ -1188,7 +1204,7 @@ declare class ForklaunchExpressLikeRouter<SV extends AnySchemaValidator, BasePat
|
|
1188
1204
|
*/
|
1189
1205
|
fetch: FetchFunction<this['fetchMap']>;
|
1190
1206
|
registerRoute<Name extends string, ContractMethod extends Method, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, const Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, BaseRequest>>(method: ContractMethod, path: Path, registrationMethod: PathBasedHandler<RouterHandler>, contractDetailsOrMiddlewareOrTypedHandler: ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth>, ...middlewareOrMiddlewareAndTypedHandler: MiddlewareOrMiddlewareWithTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth>[]): this & {
|
1191
|
-
fetchMap: Prettify<FetchMap & Record<SanitizePathSlashes<`${BasePath}${Path}`>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth
|
1207
|
+
fetchMap: Prettify<FetchMap extends Record<SanitizePathSlashes<`${BasePath}${Path}`>, unknown> ? FetchMap & Record<SanitizePathSlashes<`${BasePath}${Path}`>, FetchMap[SanitizePathSlashes<`${BasePath}${Path}`>] & Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>> : FetchMap & Record<SanitizePathSlashes<`${BasePath}${Path}`>, Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>>>;
|
1192
1208
|
sdk: Prettify<Sdk & Record<PrettyCamelCase<Name extends string ? Name : SanitizePathSlashes<`${BasePath}${Path}`>>, LiveSdkFunction<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, Auth>>>;
|
1193
1209
|
};
|
1194
1210
|
registerMiddlewareHandler<Name extends string, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, const Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, BaseRequest>>(registrationMethod: PathOrMiddlewareBasedHandler<RouterHandler>, pathOrContractDetailsOrMiddlewareOrTypedHandler: Path | ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth> | RouterHandler, contractDetailsOrMiddlewareOrTypedHandler?: ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth> | RouterHandler, ...middlewareOrMiddlewareWithTypedHandler: (MiddlewareOrMiddlewareWithTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth> | RouterHandler)[]): this;
|
package/lib/http/index.d.ts
CHANGED
@@ -818,18 +818,18 @@ interface LiveTypeRouteDefinition<SV extends AnySchemaValidator, BasePath extend
|
|
818
818
|
sdk: object;
|
819
819
|
}> {
|
820
820
|
<Name extends string, Path extends `/${string}`, SuppliedPath extends Path, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, BaseRequest>>(path: PathMatch<SuppliedPath, Path>, typedHandler: TypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth>): ChainableRouter & {
|
821
|
-
fetchMap: Prettify<ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth
|
821
|
+
fetchMap: Prettify<ChainableRouter['fetchMap'] extends Record<SanitizePathSlashes<`${BasePath}${Path}`>, unknown> ? ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, ChainableRouter['fetchMap'][SanitizePathSlashes<`${BasePath}${Path}`>] & Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>> : ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>>>;
|
822
822
|
sdk: Prettify<ChainableRouter['sdk'] & Record<PrettyCamelCase<Name>, LiveSdkFunction<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, Auth>>>;
|
823
823
|
};
|
824
824
|
<Name extends string, Path extends `/${string}`, SuppliedPath extends Path, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, BaseRequest>>(path: PathMatch<SuppliedPath, Path>, middleware: ExpressLikeSchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction>, ...middlewareAndTypedHandler: [
|
825
825
|
...ExpressLikeSchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction>[],
|
826
826
|
TypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth>
|
827
827
|
]): ChainableRouter & {
|
828
|
-
fetchMap: Prettify<ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth
|
828
|
+
fetchMap: Prettify<ChainableRouter['fetchMap'] extends Record<SanitizePathSlashes<`${BasePath}${Path}`>, unknown> ? ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, ChainableRouter['fetchMap'][SanitizePathSlashes<`${BasePath}${Path}`>] & Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>> : ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>>>;
|
829
829
|
sdk: Prettify<ChainableRouter['sdk'] & Record<PrettyCamelCase<Name>, LiveSdkFunction<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, Auth>>>;
|
830
830
|
};
|
831
831
|
<Name extends string, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, BaseRequest>>(path: Path, contractDetails: ContractDetails<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, BaseRequest, Auth>, ...middleware: ExpressLikeSchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction>[]): ChainableRouter & {
|
832
|
-
fetchMap: Prettify<ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth
|
832
|
+
fetchMap: Prettify<ChainableRouter['fetchMap'] extends Record<SanitizePathSlashes<`${BasePath}${Path}`>, unknown> ? ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, ChainableRouter['fetchMap'][SanitizePathSlashes<`${BasePath}${Path}`>] & Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>> : ChainableRouter['fetchMap'] & Record<SanitizePathSlashes<`${BasePath}${Path}`>, Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>>>;
|
833
833
|
sdk: Prettify<ChainableRouter['sdk'] & Record<PrettyCamelCase<Name>, LiveSdkFunction<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, Auth>>>;
|
834
834
|
};
|
835
835
|
}
|
@@ -982,7 +982,7 @@ type MiddlewareOrMiddlewareWithTypedHandler<SV extends AnySchemaValidator, Name
|
|
982
982
|
* });
|
983
983
|
* ```
|
984
984
|
**/
|
985
|
-
type FetchFunction<FetchMap> = <Path extends keyof FetchMap>(path: Path, ...reqInit: FetchMap[Path] extends TypeSafeFunction ? Parameters<FetchMap[Path]>[1] extends {
|
985
|
+
type FetchFunction<FetchMap> = <const Path extends keyof FetchMap, const Method extends keyof FetchMap[Path]>(path: Path, ...reqInit: FetchMap[Path][Method] extends TypeSafeFunction ? 'get' extends keyof FetchMap[Path] ? FetchMap[Path]['get'] extends TypeSafeFunction ? Parameters<FetchMap[Path]['get']>[1] extends {
|
986
986
|
body: unknown;
|
987
987
|
} | {
|
988
988
|
query: unknown;
|
@@ -990,7 +990,23 @@ type FetchFunction<FetchMap> = <Path extends keyof FetchMap>(path: Path, ...reqI
|
|
990
990
|
params: unknown;
|
991
991
|
} | {
|
992
992
|
headers: unknown;
|
993
|
-
} ? [
|
993
|
+
} ? [
|
994
|
+
reqInit: Omit<Parameters<FetchMap[Path][Method]>[1], 'method'> & {
|
995
|
+
method: Method;
|
996
|
+
}
|
997
|
+
] : [
|
998
|
+
reqInit?: Omit<Parameters<FetchMap[Path][Method]>[1], 'method'> & {
|
999
|
+
method: Method;
|
1000
|
+
}
|
1001
|
+
] : [
|
1002
|
+
reqInit: Omit<Parameters<FetchMap[Path][Method]>[1], 'method'> & {
|
1003
|
+
method: Method;
|
1004
|
+
}
|
1005
|
+
] : [
|
1006
|
+
reqInit: Omit<Parameters<FetchMap[Path][Method]>[1], 'method'> & {
|
1007
|
+
method: Method;
|
1008
|
+
}
|
1009
|
+
] : []) => Promise<FetchMap[Path][Method] extends TypeSafeFunction ? ReturnType<FetchMap[Path][Method]> : never>;
|
994
1010
|
/**
|
995
1011
|
* Creates a router SDK by combining the router's SDK with its fetch functionality.
|
996
1012
|
* This type merges the router's SDK interface with its fetch methods to create
|
@@ -1188,7 +1204,7 @@ declare class ForklaunchExpressLikeRouter<SV extends AnySchemaValidator, BasePat
|
|
1188
1204
|
*/
|
1189
1205
|
fetch: FetchFunction<this['fetchMap']>;
|
1190
1206
|
registerRoute<Name extends string, ContractMethod extends Method, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, const Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, BaseRequest>>(method: ContractMethod, path: Path, registrationMethod: PathBasedHandler<RouterHandler>, contractDetailsOrMiddlewareOrTypedHandler: ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth>, ...middlewareOrMiddlewareAndTypedHandler: MiddlewareOrMiddlewareWithTypedHandler<SV, Name, ContractMethod, Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth>[]): this & {
|
1191
|
-
fetchMap: Prettify<FetchMap & Record<SanitizePathSlashes<`${BasePath}${Path}`>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth
|
1207
|
+
fetchMap: Prettify<FetchMap extends Record<SanitizePathSlashes<`${BasePath}${Path}`>, unknown> ? FetchMap & Record<SanitizePathSlashes<`${BasePath}${Path}`>, FetchMap[SanitizePathSlashes<`${BasePath}${Path}`>] & Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>> : FetchMap & Record<SanitizePathSlashes<`${BasePath}${Path}`>, Record<Uppercase<ContractMethod>, LiveTypeFunction<SV, SanitizePathSlashes<`${BasePath}${Path}`>, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, ContractMethod, Auth>>>>;
|
1192
1208
|
sdk: Prettify<Sdk & Record<PrettyCamelCase<Name extends string ? Name : SanitizePathSlashes<`${BasePath}${Path}`>>, LiveSdkFunction<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, Auth>>>;
|
1193
1209
|
};
|
1194
1210
|
registerMiddlewareHandler<Name extends string, Path extends `/${string}`, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, const Auth extends SchemaAuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, BaseRequest>>(registrationMethod: PathOrMiddlewareBasedHandler<RouterHandler>, pathOrContractDetailsOrMiddlewareOrTypedHandler: Path | ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth> | RouterHandler, contractDetailsOrMiddlewareOrTypedHandler?: ContractDetailsOrMiddlewareOrTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth> | RouterHandler, ...middlewareOrMiddlewareWithTypedHandler: (MiddlewareOrMiddlewareWithTypedHandler<SV, Name, 'middleware', Path, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, BaseRequest, BaseResponse, NextFunction, Auth> | RouterHandler)[]): this;
|