@akanjs/cli 2.3.5-rc.4 → 2.3.5-rc.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/cli",
3
- "version": "2.3.5-rc.4",
3
+ "version": "2.3.5-rc.6",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -35,7 +35,7 @@
35
35
  "@langchain/openai": "^1.4.6",
36
36
  "@tailwindcss/node": "^4.3.0",
37
37
  "@trapezedev/project": "^7.1.4",
38
- "akanjs": "2.3.5-rc.4",
38
+ "akanjs": "2.3.5-rc.6",
39
39
  "chalk": "^5.6.2",
40
40
  "commander": "^14.0.3",
41
41
  "daisyui": "^5.5.20",
@@ -13,12 +13,16 @@ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { [
13
13
  const libs = scanInfo.getLibs();
14
14
 
15
15
  const signalNames = [...(libs.length === 0 ? ["base"] : libs), ...databaseModules, ...serviceModules];
16
- const fetchSignalChunks = Array.from({ length: Math.ceil(signalNames.length / 4) }, (_, idx) =>
17
- signalNames.slice(idx * 4, idx * 4 + 4),
16
+ const importedFetchParts = (libs.length === 0 ? ["base"] : libs).map((signal) => `SafeFetchPart<typeof ${signal}>`);
17
+ const databaseFetchTypes = databaseModules.map((module) => `${capitalize(module)}Fetch`);
18
+ const serviceFetchTypes = serviceModules.map((module) => `${capitalize(module)}Fetch`);
19
+ const fetchTypeParts = [...importedFetchParts, ...databaseFetchTypes, ...serviceFetchTypes];
20
+ const fetchTypeGroups = Array.from({ length: Math.ceil(fetchTypeParts.length / 4) }, (_, idx) =>
21
+ fetchTypeParts.slice(idx * 4, idx * 4 + 4),
18
22
  );
19
23
 
20
24
  return `
21
- import { FetchClient, type FetchClientType } from "akanjs/fetch";
25
+ import { FetchClient, type GetFetchTypeFromEndpoint, type GetFetchTypeFromSlice, type SafeFetchPart } from "akanjs/fetch";
22
26
  import { SignalRegistry, serverSignal${libs.length === 0 ? ", fetch as base" : ""} } from "akanjs/signal";
23
27
  ${libs.map((lib) => `import { fetch as ${lib} } from "@libs/${lib}/server";`).join("\n")}
24
28
 
@@ -59,10 +63,21 @@ ${databaseModules.map((module) => `export const ${module} = SignalRegistry.regis
59
63
  ${serviceModules.map((module) => `export const ${module} = SignalRegistry.registerService("${module}" as const, ${module}Sig.${capitalize(module)}Internal, ${module}Sig.${capitalize(module)}Endpoint, ${capitalize(module)});`).join("\n")}
60
64
 
61
65
  export const fetchSignals = [${signalNames.join(", ")}] as const;
62
- ${fetchSignalChunks
63
- .map((chunk, idx) => `type Fetch${idx} = FetchClientType<readonly [${chunk.map((signal) => `typeof ${signal}`).join(", ")}]>;`)
66
+ ${databaseModules
67
+ .map(
68
+ (module) =>
69
+ `type ${capitalize(module)}Fetch = GetFetchTypeFromEndpoint<typeof ${module}Sig.${capitalize(module)}Endpoint, typeof ${module}Sig.${capitalize(module)}Slice> & GetFetchTypeFromSlice<typeof ${module}Sig.${capitalize(module)}Slice>;`,
70
+ )
71
+ .join("\n")}
72
+ ${serviceModules
73
+ .map(
74
+ (module) =>
75
+ `type ${capitalize(module)}Fetch = GetFetchTypeFromEndpoint<typeof ${module}Sig.${capitalize(module)}Endpoint>;`,
76
+ )
64
77
  .join("\n")}
65
- export type Fetch = ${fetchSignalChunks.map((_, idx) => `Fetch${idx}`).join(" & ")};
78
+ ${fetchTypeGroups.map((group, idx) => `type FetchGroup${idx} = ${group.join(" & ")};`).join("\n")}
79
+ export type Fetch = ${fetchTypeGroups.length ? fetchTypeGroups.map((_, idx) => `FetchGroup${idx}`).join(" &\n ") : "unknown"};
80
+ // Avoid re-instantiating the full signal tuple here; Fetch type above is the public contract.
66
81
  export const fetch: Fetch = (FetchClient.from as (...signals: unknown[]) => unknown)(...fetchSignals) as Fetch;
67
82
 
68
83
  export const getSerializedSignal = () => fetch.serializedSignal