@deessejs/functions 0.0.26 → 0.0.28
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/extensions/rpc.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { CommandsDefinition, MutationDefinition, QueryDefinition } from "../cont
|
|
|
5
5
|
export type APINode = CommandsDefinition | {
|
|
6
6
|
[key: string]: APINode;
|
|
7
7
|
};
|
|
8
|
-
export declare const rpc: import("./types").Extension<undefined, Record<string, unknown>, <TContext
|
|
8
|
+
export declare const rpc: import("./types").Extension<undefined, Record<string, unknown>, <TContext>(context: TContext) => {
|
|
9
9
|
query: <TArgs extends ZodType<any, any, any>, TOutput, TError extends Exception>(options: {
|
|
10
10
|
args: TArgs;
|
|
11
11
|
handler: (ctx: TContext, args: z.infer<TArgs>) => AsyncResult<TOutput, TError>;
|
package/dist/extensions/rpc.js
CHANGED
|
@@ -6,8 +6,6 @@ exports.rpc = (0, _1.extensions)({
|
|
|
6
6
|
name: "rpc",
|
|
7
7
|
schema: undefined,
|
|
8
8
|
context: undefined,
|
|
9
|
-
// FIX CRUCIAL : <TContext extends Record<string, any>>
|
|
10
|
-
// Cela garantit à TypeScript que TContext est bien un objet compatible
|
|
11
9
|
functions: (_options) => (context) => ({
|
|
12
10
|
query: (options) => {
|
|
13
11
|
return { _type: "query", ...options };
|
|
@@ -3,7 +3,7 @@ import { UnionToIntersection } from "../utils";
|
|
|
3
3
|
export type InferOptions<T extends ZodType | undefined> = T extends ZodType ? z.infer<T> : undefined;
|
|
4
4
|
type ApplyContext<TFunc, TContext> = TFunc extends (context: TContext) => infer R ? R : never;
|
|
5
5
|
export type ExtensionInstance = {
|
|
6
|
-
context:
|
|
6
|
+
context: any;
|
|
7
7
|
functions: (context: any) => any;
|
|
8
8
|
};
|
|
9
9
|
export type MergeExtensions<TContext, TExtensions extends Array<ExtensionInstance>> = UnionToIntersection<ApplyContext<TExtensions[number]["functions"], TContext>>;
|
package/package.json
CHANGED