@holo-js/cli 0.3.1 → 0.3.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.
Files changed (31) hide show
  1. package/dist/bin/holo.mjs +24 -24
  2. package/dist/{broadcast-PJLFVZH4.mjs → broadcast-GUQFANQ4.mjs} +8 -8
  3. package/dist/{cache-KR4ACOYD.mjs → cache-PCM2BJJ2.mjs} +7 -7
  4. package/dist/{cache-migrations-J34RE4WH.mjs → cache-migrations-M6VC3JW3.mjs} +10 -10
  5. package/dist/{chunk-FFTJKBQF.mjs → chunk-BVULOZZ4.mjs} +14 -6
  6. package/dist/{chunk-AZ6NVJAP.mjs → chunk-I6EXRSZM.mjs} +1 -1
  7. package/dist/{chunk-L6FF22IV.mjs → chunk-JLZNWWFV.mjs} +7 -7
  8. package/dist/{chunk-L3YATEQY.mjs → chunk-NSG3OJDY.mjs} +116 -7
  9. package/dist/{chunk-PVVGQSUP.mjs → chunk-OQEZ3MOE.mjs} +47 -47
  10. package/dist/{chunk-3ICVWL2M.mjs → chunk-SCVF2F3I.mjs} +2 -2
  11. package/dist/{chunk-I3RRWDLV.mjs → chunk-VQP6GHIQ.mjs} +6 -6
  12. package/dist/{chunk-7KZVFDSI.mjs → chunk-VUJ4ITXR.mjs} +3 -3
  13. package/dist/{chunk-2XXJ76YC.mjs → chunk-WMBFSYWK.mjs} +1 -1
  14. package/dist/{chunk-CT23GSEC.mjs → chunk-XXQUCGBO.mjs} +1 -1
  15. package/dist/{chunk-4VYR2ARA.mjs → chunk-ZNJ4APGF.mjs} +2 -2
  16. package/dist/{config-XVPV6DJW.mjs → config-43W3SZUI.mjs} +3 -3
  17. package/dist/{dev-NTQTEY5B.mjs → dev-SNXMGPLU.mjs} +9 -9
  18. package/dist/{discovery-TMPUQQHI.mjs → discovery-7TQXEUYW.mjs} +4 -4
  19. package/dist/{generators-3FDCCJDC.mjs → generators-2KJ6OFWA.mjs} +10 -10
  20. package/dist/index.mjs +24 -24
  21. package/dist/{media-migrations-UJ6BMUSZ.mjs → media-migrations-JMA7QMX7.mjs} +9 -9
  22. package/dist/{plugins-USHY6SPF.mjs → plugins-D6FWODCH.mjs} +3 -3
  23. package/dist/{queue-6U7JU4T6.mjs → queue-6QSL5VFZ.mjs} +10 -10
  24. package/dist/{queue-VJEFD6SE.mjs → queue-SAPFMTB7.mjs} +10 -10
  25. package/dist/{queue-migrations-6YUUOKMH.mjs → queue-migrations-GSREPIHP.mjs} +10 -10
  26. package/dist/{runtime-P5R7H3B4.mjs → runtime-HYSSH54H.mjs} +1 -1
  27. package/dist/{runtime-FVRB4O2M.mjs → runtime-RX46GVZQ.mjs} +8 -8
  28. package/dist/runtime-worker.mjs +18 -1
  29. package/dist/{scaffold-F3AZDNPG.mjs → scaffold-HPNFLBF2.mjs} +7 -7
  30. package/dist/{security-X4274RHX.mjs → security-NR2WEPQ6.mjs} +7 -7
  31. package/package.json +19 -19
package/dist/bin/holo.mjs CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  pinProjectDependencyVersions,
23
23
  removeProjectDependency,
24
24
  upsertProjectDependency
25
- } from "../chunk-CT23GSEC.mjs";
25
+ } from "../chunk-XXQUCGBO.mjs";
26
26
  import {
27
27
  runWithSpinner,
28
28
  writeLine
@@ -30,16 +30,16 @@ import {
30
30
  import {
31
31
  ensureEmptyDirectory,
32
32
  fileExists
33
- } from "../chunk-FFTJKBQF.mjs";
34
- import "../chunk-4VYR2ARA.mjs";
35
- import "../chunk-7KZVFDSI.mjs";
36
- import "../chunk-L3YATEQY.mjs";
37
- import "../chunk-3ICVWL2M.mjs";
38
- import "../chunk-AZ6NVJAP.mjs";
33
+ } from "../chunk-BVULOZZ4.mjs";
34
+ import "../chunk-ZNJ4APGF.mjs";
35
+ import "../chunk-VUJ4ITXR.mjs";
36
+ import "../chunk-NSG3OJDY.mjs";
37
+ import "../chunk-SCVF2F3I.mjs";
38
+ import "../chunk-I6EXRSZM.mjs";
39
39
  import {
40
40
  APP_CONFIG_FILE_NAMES,
41
41
  SUPPORTED_AUTH_SOCIAL_PROVIDERS
42
- } from "../chunk-PVVGQSUP.mjs";
42
+ } from "../chunk-OQEZ3MOE.mjs";
43
43
 
44
44
  // src/cli.ts
45
45
  import { cp, mkdtemp, readFile as readFile2, rm, writeFile as writeFile2 } from "fs/promises";
@@ -131,31 +131,31 @@ var projectRuntimeModulePromise;
131
131
  var projectScaffoldModulePromise;
132
132
  var agentSkillsModulePromise;
133
133
  function loadRuntimeModule() {
134
- runtimeModulePromise ??= import("../runtime-FVRB4O2M.mjs");
134
+ runtimeModulePromise ??= import("../runtime-RX46GVZQ.mjs");
135
135
  return runtimeModulePromise;
136
136
  }
137
137
  function loadSecurityModule() {
138
- securityModulePromise ??= import("../security-X4274RHX.mjs");
138
+ securityModulePromise ??= import("../security-NR2WEPQ6.mjs");
139
139
  return securityModulePromise;
140
140
  }
141
141
  function loadProjectConfigModule() {
142
- projectConfigModulePromise ??= import("../config-XVPV6DJW.mjs");
142
+ projectConfigModulePromise ??= import("../config-43W3SZUI.mjs");
143
143
  return projectConfigModulePromise;
144
144
  }
145
145
  function loadProjectDiscoveryModule() {
146
- projectDiscoveryModulePromise ??= import("../discovery-TMPUQQHI.mjs");
146
+ projectDiscoveryModulePromise ??= import("../discovery-7TQXEUYW.mjs");
147
147
  return projectDiscoveryModulePromise;
148
148
  }
149
149
  function loadProjectPluginsModule() {
150
- projectPluginsModulePromise ??= import("../plugins-USHY6SPF.mjs");
150
+ projectPluginsModulePromise ??= import("../plugins-D6FWODCH.mjs");
151
151
  return projectPluginsModulePromise;
152
152
  }
153
153
  function loadProjectRuntimeModule() {
154
- projectRuntimeModulePromise ??= import("../runtime-P5R7H3B4.mjs");
154
+ projectRuntimeModulePromise ??= import("../runtime-HYSSH54H.mjs");
155
155
  return projectRuntimeModulePromise;
156
156
  }
157
157
  function loadProjectScaffoldModule() {
158
- projectScaffoldModulePromise ??= import("../scaffold-F3AZDNPG.mjs");
158
+ projectScaffoldModulePromise ??= import("../scaffold-HPNFLBF2.mjs");
159
159
  return projectScaffoldModulePromise;
160
160
  }
161
161
  function loadAgentSkillsModule() {
@@ -163,7 +163,7 @@ function loadAgentSkillsModule() {
163
163
  return agentSkillsModulePromise;
164
164
  }
165
165
  async function resolveRuntimeExecutor(runtimeExecutor) {
166
- runtimeModulePromise ??= import("../runtime-FVRB4O2M.mjs");
166
+ runtimeModulePromise ??= import("../runtime-RX46GVZQ.mjs");
167
167
  return runtimeExecutor ?? (await runtimeModulePromise).withRuntimeEnvironment;
168
168
  }
169
169
  async function resolveExecutor(executors, loader, key) {
@@ -171,17 +171,17 @@ async function resolveExecutor(executors, loader, key) {
171
171
  return existing ? existing : await loader();
172
172
  }
173
173
  async function resolveProjectExecutor(executors, key) {
174
- devModulePromise ??= import("../dev-NTQTEY5B.mjs");
174
+ devModulePromise ??= import("../dev-SNXMGPLU.mjs");
175
175
  return resolveExecutor(executors, async () => (await devModulePromise)[key], key);
176
176
  }
177
177
  async function resolveQueueExecutor(executors, key) {
178
178
  return resolveExecutor(executors, async () => {
179
179
  if (key === "runQueueFailedTableCommand" || key === "runQueueTableCommand") {
180
- queueMigrationsModulePromise ??= import("../queue-migrations-6YUUOKMH.mjs");
180
+ queueMigrationsModulePromise ??= import("../queue-migrations-GSREPIHP.mjs");
181
181
  const migrations = await queueMigrationsModulePromise;
182
182
  return key === "runQueueFailedTableCommand" ? migrations.runQueueFailedTableCommand : migrations.runQueueTableCommand;
183
183
  }
184
- queueModulePromise ??= import("../queue-VJEFD6SE.mjs");
184
+ queueModulePromise ??= import("../queue-SAPFMTB7.mjs");
185
185
  const queue = await queueModulePromise;
186
186
  const resolved = {
187
187
  runQueueFailedCommand: queue.runQueueFailedCommand,
@@ -199,10 +199,10 @@ async function resolveQueueExecutor(executors, key) {
199
199
  async function resolveCacheExecutor(executors, key) {
200
200
  return resolveExecutor(executors, async () => {
201
201
  if (key === "runCacheTableCommand") {
202
- cacheMigrationsModulePromise ??= import("../cache-migrations-J34RE4WH.mjs");
202
+ cacheMigrationsModulePromise ??= import("../cache-migrations-M6VC3JW3.mjs");
203
203
  return (await cacheMigrationsModulePromise).runCacheTableCommand;
204
204
  }
205
- cacheModulePromise ??= import("../cache-KR4ACOYD.mjs");
205
+ cacheModulePromise ??= import("../cache-PCM2BJJ2.mjs");
206
206
  const cache = await cacheModulePromise;
207
207
  const resolved = {
208
208
  runCacheClearCommand: cache.runCacheClearCommand,
@@ -212,15 +212,15 @@ async function resolveCacheExecutor(executors, key) {
212
212
  }, key);
213
213
  }
214
214
  async function resolveMediaExecutor(executors, key) {
215
- mediaMigrationsModulePromise ??= import("../media-migrations-UJ6BMUSZ.mjs");
215
+ mediaMigrationsModulePromise ??= import("../media-migrations-JMA7QMX7.mjs");
216
216
  return resolveExecutor(executors, async () => (await mediaMigrationsModulePromise)[key], key);
217
217
  }
218
218
  async function resolveBroadcastExecutor(executors, key) {
219
- broadcastModulePromise ??= import("../broadcast-PJLFVZH4.mjs");
219
+ broadcastModulePromise ??= import("../broadcast-GUQFANQ4.mjs");
220
220
  return resolveExecutor(executors, async () => (await broadcastModulePromise)[key], key);
221
221
  }
222
222
  async function resolveGeneratorCommand(key) {
223
- generatorsModulePromise ??= import("../generators-3FDCCJDC.mjs");
223
+ generatorsModulePromise ??= import("../generators-2KJ6OFWA.mjs");
224
224
  return (await generatorsModulePromise)[key];
225
225
  }
226
226
 
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  initializeProjectRuntime
3
- } from "./chunk-I3RRWDLV.mjs";
3
+ } from "./chunk-VQP6GHIQ.mjs";
4
4
  import {
5
5
  writeLine
6
6
  } from "./chunk-Y355VYRN.mjs";
7
- import "./chunk-FFTJKBQF.mjs";
7
+ import "./chunk-BVULOZZ4.mjs";
8
8
  import {
9
9
  loadProjectConfig
10
- } from "./chunk-4VYR2ARA.mjs";
10
+ } from "./chunk-ZNJ4APGF.mjs";
11
11
  import {
12
12
  prepareProjectDiscovery
13
- } from "./chunk-7KZVFDSI.mjs";
13
+ } from "./chunk-VUJ4ITXR.mjs";
14
14
  import {
15
15
  loadGeneratedProjectRegistry
16
- } from "./chunk-L3YATEQY.mjs";
17
- import "./chunk-3ICVWL2M.mjs";
18
- import "./chunk-AZ6NVJAP.mjs";
16
+ } from "./chunk-NSG3OJDY.mjs";
17
+ import "./chunk-SCVF2F3I.mjs";
18
+ import "./chunk-I6EXRSZM.mjs";
19
19
  import {
20
20
  importProjectModule,
21
21
  resolveProjectPackageImportSpecifier
22
- } from "./chunk-PVVGQSUP.mjs";
22
+ } from "./chunk-OQEZ3MOE.mjs";
23
23
 
24
24
  // src/broadcast.ts
25
25
  import { basename, extname, resolve } from "path";
@@ -4,15 +4,15 @@ import {
4
4
  import {
5
5
  writeLine
6
6
  } from "./chunk-Y355VYRN.mjs";
7
- import "./chunk-FFTJKBQF.mjs";
8
- import "./chunk-4VYR2ARA.mjs";
9
- import "./chunk-7KZVFDSI.mjs";
10
- import "./chunk-L3YATEQY.mjs";
11
- import "./chunk-3ICVWL2M.mjs";
12
- import "./chunk-AZ6NVJAP.mjs";
7
+ import "./chunk-BVULOZZ4.mjs";
8
+ import "./chunk-ZNJ4APGF.mjs";
9
+ import "./chunk-VUJ4ITXR.mjs";
10
+ import "./chunk-NSG3OJDY.mjs";
11
+ import "./chunk-SCVF2F3I.mjs";
12
+ import "./chunk-I6EXRSZM.mjs";
13
13
  import {
14
14
  resolveProjectPackageImportSpecifier
15
- } from "./chunk-PVVGQSUP.mjs";
15
+ } from "./chunk-OQEZ3MOE.mjs";
16
16
 
17
17
  // src/cache.ts
18
18
  import { loadConfigDirectory } from "@holo-js/config";
@@ -1,33 +1,33 @@
1
1
  import {
2
2
  runProjectPrepare
3
- } from "./chunk-L6FF22IV.mjs";
4
- import "./chunk-CT23GSEC.mjs";
3
+ } from "./chunk-JLZNWWFV.mjs";
4
+ import "./chunk-XXQUCGBO.mjs";
5
5
  import {
6
6
  getRegistryMigrationSlug,
7
7
  hasRegisteredCreateTableMigration,
8
8
  hasRegisteredMigrationSlug,
9
9
  nextMigrationTemplate
10
- } from "./chunk-2XXJ76YC.mjs";
10
+ } from "./chunk-WMBFSYWK.mjs";
11
11
  import {
12
12
  writeLine
13
13
  } from "./chunk-Y355VYRN.mjs";
14
- import "./chunk-FFTJKBQF.mjs";
14
+ import "./chunk-BVULOZZ4.mjs";
15
15
  import {
16
16
  ensureProjectConfig
17
- } from "./chunk-4VYR2ARA.mjs";
17
+ } from "./chunk-ZNJ4APGF.mjs";
18
18
  import {
19
19
  prepareProjectDiscovery
20
- } from "./chunk-7KZVFDSI.mjs";
20
+ } from "./chunk-VUJ4ITXR.mjs";
21
21
  import {
22
22
  loadGeneratedProjectRegistry
23
- } from "./chunk-L3YATEQY.mjs";
24
- import "./chunk-3ICVWL2M.mjs";
25
- import "./chunk-AZ6NVJAP.mjs";
23
+ } from "./chunk-NSG3OJDY.mjs";
24
+ import "./chunk-SCVF2F3I.mjs";
25
+ import "./chunk-I6EXRSZM.mjs";
26
26
  import {
27
27
  makeProjectRelativePath,
28
28
  resolveDefaultArtifactPath,
29
29
  writeTextFile
30
- } from "./chunk-PVVGQSUP.mjs";
30
+ } from "./chunk-OQEZ3MOE.mjs";
31
31
 
32
32
  // src/cache-migrations.ts
33
33
  import { resolve } from "path";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadProjectConfig,
3
3
  resolveGeneratedSchemaPath
4
- } from "./chunk-4VYR2ARA.mjs";
4
+ } from "./chunk-ZNJ4APGF.mjs";
5
5
  import {
6
6
  loadGeneratedProjectRegistry,
7
7
  relativeImportPath,
@@ -14,13 +14,17 @@ import {
14
14
  renderGeneratedModelTypes,
15
15
  renderManagedHostedAuthRouteFiles,
16
16
  renderNextGeneratedRealtimeDefinitions,
17
+ renderNextGeneratedRealtimeMutationRoute,
18
+ renderNextGeneratedRealtimeQueryRoute,
17
19
  renderNextHoloHelper,
20
+ renderNextRealtimeMutationRoute,
21
+ renderNextRealtimeQueryRoute,
18
22
  renderNextRuntimeBootstrap,
19
23
  renderSvelteViteConfig
20
- } from "./chunk-L3YATEQY.mjs";
24
+ } from "./chunk-NSG3OJDY.mjs";
21
25
  import {
22
26
  loadProjectPluginFrameworkDescriptors
23
- } from "./chunk-3ICVWL2M.mjs";
27
+ } from "./chunk-SCVF2F3I.mjs";
24
28
  import {
25
29
  AUTH_CONFIG_FILE_NAMES,
26
30
  AUTH_SOCIAL_PROVIDER_PACKAGE_NAMES,
@@ -60,7 +64,7 @@ import {
60
64
  resolveFirstExistingPath,
61
65
  sanitizePackageName,
62
66
  writeTextFile
63
- } from "./chunk-PVVGQSUP.mjs";
67
+ } from "./chunk-OQEZ3MOE.mjs";
64
68
 
65
69
  // src/project/scaffold.ts
66
70
  import { mkdir as mkdir3, readdir as readdir2 } from "fs/promises";
@@ -2877,9 +2881,13 @@ async function installRealtimeIntoProject(projectRoot) {
2877
2881
  await mkdir3(realtimeRoot, { recursive: true });
2878
2882
  if (framework === "next") {
2879
2883
  const routes = [
2884
+ { path: "app/holo/realtime/query/route.ts", contents: renderNextRealtimeQueryRoute() },
2885
+ { path: "app/holo/realtime/mutation/route.ts", contents: renderNextRealtimeMutationRoute() },
2880
2886
  { path: ".holo-js/generated/next/holo.ts", contents: renderNextHoloHelper() },
2881
2887
  { path: ".holo-js/generated/next/bootstrap.mjs", contents: renderNextRuntimeBootstrap() },
2882
- { path: ".holo-js/generated/next/realtime-definitions.ts", contents: await renderNextRealtimeDefinitions(projectRoot) }
2888
+ { path: ".holo-js/generated/next/realtime-definitions.ts", contents: await renderNextRealtimeDefinitions(projectRoot) },
2889
+ { path: ".holo-js/generated/next/realtime-query-route.ts", contents: renderNextGeneratedRealtimeQueryRoute() },
2890
+ { path: ".holo-js/generated/next/realtime-mutation-route.ts", contents: renderNextGeneratedRealtimeMutationRoute() }
2883
2891
  ];
2884
2892
  for (const route of routes) {
2885
2893
  const routePath = resolve4(projectRoot, route.path);
@@ -2989,7 +2997,7 @@ async function installMediaIntoProject(projectRoot) {
2989
2997
  if (!mediaConfigPath) {
2990
2998
  await writeTextFile(resolve4(projectRoot, "config/media.ts"), renderMediaConfig());
2991
2999
  }
2992
- const { createMediaTableMigration } = await import("./media-migrations-UJ6BMUSZ.mjs");
3000
+ const { createMediaTableMigration } = await import("./media-migrations-JMA7QMX7.mjs");
2993
3001
  const migrationFilePath = await createMediaTableMigration(projectRoot, {
2994
3002
  skipIfExists: true
2995
3003
  });
@@ -6,7 +6,7 @@ import {
6
6
  pathExists,
7
7
  readTextFile,
8
8
  toPosixPath
9
- } from "./chunk-PVVGQSUP.mjs";
9
+ } from "./chunk-OQEZ3MOE.mjs";
10
10
 
11
11
  // src/project/discovery-helpers.ts
12
12
  import { readdir } from "fs/promises";
@@ -1,28 +1,28 @@
1
1
  import {
2
2
  hasProjectDependency
3
- } from "./chunk-CT23GSEC.mjs";
3
+ } from "./chunk-XXQUCGBO.mjs";
4
4
  import {
5
5
  syncManagedDriverDependencies
6
- } from "./chunk-FFTJKBQF.mjs";
6
+ } from "./chunk-BVULOZZ4.mjs";
7
7
  import {
8
8
  ensureGeneratedSchemaPlaceholder,
9
9
  ensureProjectConfig
10
- } from "./chunk-4VYR2ARA.mjs";
10
+ } from "./chunk-ZNJ4APGF.mjs";
11
11
  import {
12
12
  prepareProjectDiscovery
13
- } from "./chunk-7KZVFDSI.mjs";
13
+ } from "./chunk-VUJ4ITXR.mjs";
14
14
  import {
15
15
  renderFrameworkRunnerForDescriptor
16
- } from "./chunk-L3YATEQY.mjs";
16
+ } from "./chunk-NSG3OJDY.mjs";
17
17
  import {
18
18
  loadProjectPluginFrameworkDescriptors
19
- } from "./chunk-3ICVWL2M.mjs";
19
+ } from "./chunk-SCVF2F3I.mjs";
20
20
  import {
21
21
  getFrameworkDescriptorByIdFrom,
22
22
  getFrameworkDescriptorsWith,
23
23
  readTextFile,
24
24
  writeTextFile
25
- } from "./chunk-PVVGQSUP.mjs";
25
+ } from "./chunk-OQEZ3MOE.mjs";
26
26
 
27
27
  // src/dev.ts
28
28
  import { spawnSync, spawn } from "child_process";
@@ -34,7 +34,7 @@ import {
34
34
  isRecord,
35
35
  makeProjectRelativePath,
36
36
  normalizeScaffoldOptionalPackages
37
- } from "./chunk-PVVGQSUP.mjs";
37
+ } from "./chunk-OQEZ3MOE.mjs";
38
38
 
39
39
  // src/templates.ts
40
40
  import { dirname, relative, resolve } from "path";
@@ -653,6 +653,12 @@ function renderNextBroadcastAuthRoute() {
653
653
  function renderNextBroadcastConfigRoute() {
654
654
  return renderNextRouteBridge("../../../.holo-js/generated/next/broadcast-config-route", ["GET"]);
655
655
  }
656
+ function renderNextRealtimeQueryRoute() {
657
+ return renderNextRouteBridge("../../../../.holo-js/generated/next/realtime-query-route", ["POST"]);
658
+ }
659
+ function renderNextRealtimeMutationRoute() {
660
+ return renderNextRouteBridge("../../../../.holo-js/generated/next/realtime-mutation-route", ["POST"]);
661
+ }
656
662
  function renderNextGeneratedBroadcastConfigRoute() {
657
663
  return [
658
664
  "import { renderBroadcastClientConfigResponse } from '@holo-js/broadcast/client-config'",
@@ -701,7 +707,7 @@ function renderNextGeneratedBroadcastAuthRoute() {
701
707
  ].join("\n");
702
708
  }
703
709
  function renderNextGeneratedRealtimeDefinitions(importPaths = []) {
704
- const imports = importPaths.map((importPath, index) => `import * as realtimeModule${index} from ${JSON.stringify(importPath)}`);
710
+ const imports = importPaths.map((importPath, index) => `import * as realtimeModule${index} from ${JSON.stringify(`${importPath}?holo-realtime-server`)}`);
705
711
  const values = importPaths.map((_importPath, index) => `...Object.values(realtimeModule${index})`);
706
712
  return [
707
713
  ...imports,
@@ -710,6 +716,47 @@ function renderNextGeneratedRealtimeDefinitions(importPaths = []) {
710
716
  ""
711
717
  ].join("\n");
712
718
  }
719
+ function renderNextGeneratedRealtimeServerModules() {
720
+ return [
721
+ "declare module '*?holo-realtime-server' {",
722
+ " const realtimeModule: Readonly<Record<string, unknown>>",
723
+ " export = realtimeModule",
724
+ "}",
725
+ ""
726
+ ].join("\n");
727
+ }
728
+ function renderNextGeneratedRealtimeQueryRoute() {
729
+ return [
730
+ "import { handleRealtimeQueryRequest } from '@holo-js/realtime/server'",
731
+ "import { realtimeDefinitions } from './realtime-definitions'",
732
+ "import { holo } from './holo'",
733
+ "",
734
+ "export async function POST(request: Request) {",
735
+ " const app = await holo.getApp()",
736
+ " return await handleRealtimeQueryRequest(request, {",
737
+ " projectRoot: app.projectRoot,",
738
+ " definitions: realtimeDefinitions,",
739
+ " })",
740
+ "}",
741
+ ""
742
+ ].join("\n");
743
+ }
744
+ function renderNextGeneratedRealtimeMutationRoute() {
745
+ return [
746
+ "import { handleRealtimeMutationRequest } from '@holo-js/realtime/server'",
747
+ "import { realtimeDefinitions } from './realtime-definitions'",
748
+ "import { holo } from './holo'",
749
+ "",
750
+ "export async function POST(request: Request) {",
751
+ " const app = await holo.getApp()",
752
+ " return await handleRealtimeMutationRequest(request, {",
753
+ " projectRoot: app.projectRoot,",
754
+ " definitions: realtimeDefinitions,",
755
+ " })",
756
+ "}",
757
+ ""
758
+ ].join("\n");
759
+ }
713
760
  function renderNextManagedRouteFiles(options = {}) {
714
761
  return [
715
762
  { path: ".holo-js/generated/next/holo.ts", contents: renderNextHoloHelper() },
@@ -717,7 +764,12 @@ function renderNextManagedRouteFiles(options = {}) {
717
764
  ...options.storageEnabled ? [{ path: ".holo-js/generated/next/storage-route.ts", contents: renderNextGeneratedStorageRoute() }] : [],
718
765
  ...options.broadcastEnabled ? [{ path: ".holo-js/generated/next/broadcast-config-route.ts", contents: renderNextGeneratedBroadcastConfigRoute() }] : [],
719
766
  ...options.broadcastAuthEnabled ? [{ path: ".holo-js/generated/next/broadcast-auth-route.ts", contents: renderNextGeneratedBroadcastAuthRoute() }] : [],
720
- ...options.realtimeEnabled ? [{ path: ".holo-js/generated/next/realtime-definitions.ts", contents: renderNextGeneratedRealtimeDefinitions() }] : []
767
+ ...options.realtimeEnabled ? [
768
+ { path: ".holo-js/generated/next/realtime-definitions.ts", contents: renderNextGeneratedRealtimeDefinitions() },
769
+ { path: ".holo-js/generated/next/realtime-server-modules.d.ts", contents: renderNextGeneratedRealtimeServerModules() },
770
+ { path: ".holo-js/generated/next/realtime-query-route.ts", contents: renderNextGeneratedRealtimeQueryRoute() },
771
+ { path: ".holo-js/generated/next/realtime-mutation-route.ts", contents: renderNextGeneratedRealtimeMutationRoute() }
772
+ ] : []
721
773
  ];
722
774
  }
723
775
  function renderNextManagedHostedAuthRouteFiles(features) {
@@ -1005,6 +1057,10 @@ var FRAMEWORK_RENDERERS = {
1005
1057
  ...authEnabled ? [{ path: "app/api/auth/user/route.ts", contents: renderNextCurrentAuthRoute() }] : [],
1006
1058
  ...storageEnabled ? [{ path: "app/storage/[[...path]]/route.ts", contents: renderNextStorageRoute() }] : [],
1007
1059
  ...broadcastEnabled ? [{ path: "app/broadcasting/config/route.ts", contents: renderNextBroadcastConfigRoute() }] : [],
1060
+ ...realtimeEnabled ? [
1061
+ { path: "app/holo/realtime/query/route.ts", contents: renderNextRealtimeQueryRoute() },
1062
+ { path: "app/holo/realtime/mutation/route.ts", contents: renderNextRealtimeMutationRoute() }
1063
+ ] : [],
1008
1064
  ...renderNextManagedRouteFiles({ authEnabled, broadcastEnabled, storageEnabled, realtimeEnabled })
1009
1065
  ];
1010
1066
  }
@@ -1463,6 +1519,8 @@ function renderManagedSvelteServerHooksModule(features) {
1463
1519
  "import { renderBroadcastClientConfigResponse } from '@holo-js/broadcast/client-config'"
1464
1520
  ] : [],
1465
1521
  ...features.storageEnabled ? ["import { createPublicStorageResponse } from '@holo-js/storage'"] : [],
1522
+ ...features.realtimeEnabled ? ["import { handleRealtimeMutationRequest, handleRealtimeQueryRequest } from '@holo-js/realtime/server'"] : [],
1523
+ ...features.realtimeImportPaths.map((importPath, index) => `import * as holoRealtimeModule${index} from ${JSON.stringify(importPath)}`),
1466
1524
  ...features.clerkEnabled ? ["import { completeClerkAuth, loginWithClerk, logoutWithClerk, registerWithClerk } from '@holo-js/auth-clerk'"] : [],
1467
1525
  ...features.workosEnabled ? ["import { completeWorkosAuth, loginWithWorkos, logoutWithWorkos, registerWithWorkos } from '@holo-js/auth-workos'"] : [],
1468
1526
  "import { holo } from './sveltekit/holo'",
@@ -1473,6 +1531,7 @@ function renderManagedSvelteServerHooksModule(features) {
1473
1531
  ...features.authEnabled ? ["handleHoloCurrentAuthRoute"] : [],
1474
1532
  ...features.storageEnabled ? ["handleHoloStorageRoute"] : [],
1475
1533
  ...features.broadcastEnabled ? ["handleHoloBroadcastConfigRoute", "handleHoloBroadcastAuthRoute"] : [],
1534
+ ...features.realtimeEnabled ? ["handleHoloRealtimeQueryRoute", "handleHoloRealtimeMutationRoute"] : [],
1476
1535
  ...features.clerkEnabled ? [
1477
1536
  "handleHoloClerkLoginRoute",
1478
1537
  "handleHoloClerkRegisterRoute",
@@ -1496,6 +1555,9 @@ function renderManagedSvelteServerHooksModule(features) {
1496
1555
  "",
1497
1556
  "type HoloApp = Awaited<ReturnType<typeof holo.getApp>>",
1498
1557
  "type HoloRouteHandler = (event: RequestEvent, app: HoloApp) => Promise<Response | undefined>",
1558
+ ...features.realtimeEnabled ? [
1559
+ `const realtimeDefinitions = [${features.realtimeImportPaths.map((_path, index) => `...Object.values(holoRealtimeModule${index})`).join(", ")}] as const`
1560
+ ] : [],
1499
1561
  "",
1500
1562
  "function isRoute(event: RequestEvent, method: string, paths: readonly string[]): boolean {",
1501
1563
  " return event.request.method.toUpperCase() === method && paths.includes(event.url.pathname)",
@@ -1602,6 +1664,30 @@ function renderManagedSvelteServerHooksModule(features) {
1602
1664
  "}",
1603
1665
  ""
1604
1666
  ] : [],
1667
+ ...features.realtimeEnabled ? [
1668
+ "async function handleHoloRealtimeQueryRoute(event: RequestEvent, app: HoloApp): Promise<Response | undefined> {",
1669
+ " if (!isRoute(event, 'POST', ['/holo/realtime/query'])) {",
1670
+ " return undefined",
1671
+ " }",
1672
+ "",
1673
+ " return await handleRealtimeQueryRequest(event.request, {",
1674
+ " projectRoot: app.projectRoot,",
1675
+ " definitions: realtimeDefinitions,",
1676
+ " })",
1677
+ "}",
1678
+ "",
1679
+ "async function handleHoloRealtimeMutationRoute(event: RequestEvent, app: HoloApp): Promise<Response | undefined> {",
1680
+ " if (!isRoute(event, 'POST', ['/holo/realtime/mutation'])) {",
1681
+ " return undefined",
1682
+ " }",
1683
+ "",
1684
+ " return await handleRealtimeMutationRequest(event.request, {",
1685
+ " projectRoot: app.projectRoot,",
1686
+ " definitions: realtimeDefinitions,",
1687
+ " })",
1688
+ "}",
1689
+ ""
1690
+ ] : [],
1605
1691
  ...features.clerkEnabled ? renderSvelteHostedAuthHookRoutes("clerk", "Clerk") : [],
1606
1692
  ...features.workosEnabled ? renderSvelteHostedAuthHookRoutes("workos", "Workos") : [],
1607
1693
  `const holoRouteHandlers: readonly HoloRouteHandler[] = [${routeHandlers.join(", ")}]`,
@@ -2002,10 +2088,20 @@ async function ensureNextManagedRoutes(projectRoot) {
2002
2088
  await writeFileIfChanged(resolve2(projectRoot, file.path), file.contents);
2003
2089
  }
2004
2090
  if (realtimeEnabled) {
2005
- await writeFileIfChanged(
2006
- resolve2(projectRoot, ".holo-js/generated/next/realtime-definitions.ts"),
2007
- await renderNextRealtimeDefinitions(projectRoot)
2008
- );
2091
+ await Promise.all([
2092
+ writeFileIfChanged(
2093
+ resolve2(projectRoot, ".holo-js/generated/next/realtime-definitions.ts"),
2094
+ await renderNextRealtimeDefinitions(projectRoot)
2095
+ ),
2096
+ writeFileIfChanged(
2097
+ resolve2(projectRoot, "app/holo/realtime/query/route.ts"),
2098
+ renderNextRealtimeQueryRoute()
2099
+ ),
2100
+ writeFileIfChanged(
2101
+ resolve2(projectRoot, "app/holo/realtime/mutation/route.ts"),
2102
+ renderNextRealtimeMutationRoute()
2103
+ )
2104
+ ]);
2009
2105
  }
2010
2106
  await removeLegacyManagedHoloHelper(resolve2(projectRoot, "server/holo.ts"), renderNextHoloHelper());
2011
2107
  }
@@ -2027,9 +2123,18 @@ async function readProjectDependencies(projectRoot) {
2027
2123
  }
2028
2124
  async function resolveSvelteManagedFeatures(projectRoot) {
2029
2125
  const dependencies = await readProjectDependencies(projectRoot);
2126
+ const realtimeFiles = await collectRealtimeDefinitionFiles(resolve2(projectRoot, "server/realtime"));
2127
+ const generatedRoot = resolve2(projectRoot, ".holo-js/generated");
2128
+ const realtimeImportPaths = realtimeFiles.map((filePath) => {
2129
+ const withoutExtension = filePath.slice(0, -extname(filePath).length);
2130
+ const importPath = relative2(generatedRoot, withoutExtension).split(sep).join("/");
2131
+ return importPath.startsWith(".") ? importPath : `./${importPath}`;
2132
+ });
2030
2133
  return {
2031
2134
  authEnabled: dependencies.has("@holo-js/auth"),
2032
2135
  broadcastEnabled: dependencies.has("@holo-js/broadcast"),
2136
+ realtimeEnabled: dependencies.has("@holo-js/realtime"),
2137
+ realtimeImportPaths,
2033
2138
  storageEnabled: dependencies.has("@holo-js/storage"),
2034
2139
  clerkEnabled: dependencies.has("@holo-js/auth-clerk"),
2035
2140
  workosEnabled: dependencies.has("@holo-js/auth-workos")
@@ -2870,7 +2975,11 @@ export {
2870
2975
  renderNextHoloHelper,
2871
2976
  renderNextRuntimeBootstrap,
2872
2977
  renderNextBroadcastConfigRoute,
2978
+ renderNextRealtimeQueryRoute,
2979
+ renderNextRealtimeMutationRoute,
2873
2980
  renderNextGeneratedRealtimeDefinitions,
2981
+ renderNextGeneratedRealtimeQueryRoute,
2982
+ renderNextGeneratedRealtimeMutationRoute,
2874
2983
  renderSvelteViteConfig,
2875
2984
  renderAuthProviderRouteFiles,
2876
2985
  renderAuthRouteFiles,