@deessejs/functions 0.0.38 → 0.0.40

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.
@@ -5,19 +5,17 @@ exports.defineContext = defineContext;
5
5
  function defineContext() {
6
6
  return {
7
7
  withExtensions: (config) => {
8
- // runtime builder (inchangé)
9
- const runtimeBuilder = {};
10
- const dummyContext = {};
8
+ // Créer un contexte avec un type explicite
9
+ const contextWithType = {};
10
+ // Appliquer les extensions manuellement pour préserver les types
11
+ const result = {
12
+ context: contextWithType,
13
+ };
11
14
  for (const extension of config.extensions) {
12
- // appele runtime, pour construire les méthodes effectives
13
- const extensionMethods = extension.functions(dummyContext);
14
- Object.assign(runtimeBuilder, extensionMethods);
15
+ const methods = extension.functions(contextWithType);
16
+ Object.assign(result, methods);
15
17
  }
16
- // On retourne runtimeBuilder mais on force le type public attendu.
17
- return {
18
- ...runtimeBuilder,
19
- context: {},
20
- };
18
+ return result;
21
19
  },
22
20
  };
23
21
  }
@@ -16,4 +16,5 @@ export declare const rpc: import("./types").Extension<undefined, Record<string,
16
16
  handler: (ctx: C, args: z.infer<TArgs>) => AsyncResult<TOutput_1, TError_1>;
17
17
  }) => MutationDefinition<C, TArgs, TOutput_1, TError_1>;
18
18
  group: <T extends Record<string, APINode>>(definitions: T) => T;
19
+ _contextType: C;
19
20
  }>;
@@ -15,5 +15,7 @@ exports.rpc = (0, _1.extensions)({
15
15
  return { _type: "mutation", ...options };
16
16
  },
17
17
  group: (definitions) => definitions,
18
+ // Exposer le type de contexte pour l'inférence
19
+ _contextType: context,
18
20
  }),
19
21
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deessejs/functions",
3
- "version": "0.0.38",
3
+ "version": "0.0.40",
4
4
  "description": "A powerful utility library for building type-safe APIs and functions with context management",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",