@akanjs/cli 2.3.5-rc.0 → 2.3.5-rc.2
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 +2 -2
- package/templates/lib/sig.ts +9 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "2.3.5-rc.
|
|
3
|
+
"version": "2.3.5-rc.2",
|
|
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.
|
|
38
|
+
"akanjs": "2.3.5-rc.2",
|
|
39
39
|
"chalk": "^5.6.2",
|
|
40
40
|
"commander": "^14.0.3",
|
|
41
41
|
"daisyui": "^5.5.20",
|
package/templates/lib/sig.ts
CHANGED
|
@@ -13,9 +13,12 @@ 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),
|
|
18
|
+
);
|
|
16
19
|
|
|
17
20
|
return `
|
|
18
|
-
import { FetchClient
|
|
21
|
+
import { FetchClient } from "akanjs/fetch";
|
|
19
22
|
import { SignalRegistry, serverSignal${libs.length === 0 ? ", fetch as base" : ""} } from "akanjs/signal";
|
|
20
23
|
${libs.map((lib) => `import { fetch as ${lib} } from "@libs/${lib}/server";`).join("\n")}
|
|
21
24
|
|
|
@@ -56,8 +59,11 @@ ${databaseModules.map((module) => `export const ${module} = SignalRegistry.regis
|
|
|
56
59
|
${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")}
|
|
57
60
|
|
|
58
61
|
export const fetchSignals = [${signalNames.join(", ")}] as const;
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
${fetchSignalChunks
|
|
63
|
+
.map((chunk, idx) => `const fetch${idx} = FetchClient.from(${chunk.join(", ")});`)
|
|
64
|
+
.join("\n")}
|
|
65
|
+
export type Fetch = ${fetchSignalChunks.map((_, idx) => `typeof fetch${idx}`).join(" & ")};
|
|
66
|
+
export const fetch: Fetch = FetchClient.from(${fetchSignalChunks.map((_, idx) => `fetch${idx}`).join(", ")}) as Fetch;
|
|
61
67
|
|
|
62
68
|
export const getSerializedSignal = () => fetch.serializedSignal
|
|
63
69
|
`;
|