@supatype/cli 0.1.3 → 0.1.5

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 (85) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +101 -99
  3. package/.turbo/turbo-typecheck.log +1 -1
  4. package/dist/app-vite-env.d.ts +4 -0
  5. package/dist/app-vite-env.d.ts.map +1 -0
  6. package/dist/app-vite-env.js +22 -0
  7. package/dist/app-vite-env.js.map +1 -0
  8. package/dist/binary-cache.d.ts +7 -5
  9. package/dist/binary-cache.d.ts.map +1 -1
  10. package/dist/binary-cache.js +28 -10
  11. package/dist/binary-cache.js.map +1 -1
  12. package/dist/cli-standalone.d.ts +10 -0
  13. package/dist/cli-standalone.d.ts.map +1 -0
  14. package/dist/cli-standalone.js +56 -0
  15. package/dist/cli-standalone.js.map +1 -0
  16. package/dist/commands/dev.d.ts.map +1 -1
  17. package/dist/commands/dev.js +34 -0
  18. package/dist/commands/dev.js.map +1 -1
  19. package/dist/commands/init.d.ts.map +1 -1
  20. package/dist/commands/init.js +3 -1
  21. package/dist/commands/init.js.map +1 -1
  22. package/dist/commands/keys.d.ts.map +1 -1
  23. package/dist/commands/keys.js +14 -0
  24. package/dist/commands/keys.js.map +1 -1
  25. package/dist/commands/self-update.d.ts +1 -1
  26. package/dist/commands/self-update.d.ts.map +1 -1
  27. package/dist/commands/self-update.js +33 -9
  28. package/dist/commands/self-update.js.map +1 -1
  29. package/dist/commands/update.d.ts.map +1 -1
  30. package/dist/commands/update.js +9 -1
  31. package/dist/commands/update.js.map +1 -1
  32. package/dist/components.d.ts +2 -2
  33. package/dist/components.d.ts.map +1 -1
  34. package/dist/components.js +2 -2
  35. package/dist/components.js.map +1 -1
  36. package/dist/dev-compose.d.ts.map +1 -1
  37. package/dist/dev-compose.js +120 -12
  38. package/dist/dev-compose.js.map +1 -1
  39. package/dist/project-config.d.ts +2 -0
  40. package/dist/project-config.d.ts.map +1 -1
  41. package/dist/project-config.js.map +1 -1
  42. package/dist/realtime-launch.d.ts +11 -0
  43. package/dist/realtime-launch.d.ts.map +1 -0
  44. package/dist/realtime-launch.js +39 -0
  45. package/dist/realtime-launch.js.map +1 -0
  46. package/dist/required-host-components.js +1 -1
  47. package/dist/required-host-components.js.map +1 -1
  48. package/dist/route-manifest.d.ts +3 -0
  49. package/dist/route-manifest.d.ts.map +1 -0
  50. package/dist/route-manifest.js +15 -0
  51. package/dist/route-manifest.js.map +1 -0
  52. package/dist/schema-push-lock.d.ts +17 -0
  53. package/dist/schema-push-lock.d.ts.map +1 -0
  54. package/dist/schema-push-lock.js +106 -0
  55. package/dist/schema-push-lock.js.map +1 -0
  56. package/dist/self-host-compose.d.ts.map +1 -1
  57. package/dist/self-host-compose.js +18 -0
  58. package/dist/self-host-compose.js.map +1 -1
  59. package/dist/type-extractor.d.ts.map +1 -1
  60. package/dist/type-extractor.js +169 -13
  61. package/dist/type-extractor.js.map +1 -1
  62. package/package.json +1 -1
  63. package/scripts/build-release-bundle.mjs +27 -0
  64. package/src/app-vite-env.ts +27 -0
  65. package/src/binary-cache.ts +29 -11
  66. package/src/cli-standalone.ts +62 -0
  67. package/src/commands/dev.ts +38 -0
  68. package/src/commands/init.ts +3 -1
  69. package/src/commands/keys.ts +14 -0
  70. package/src/commands/self-update.ts +34 -13
  71. package/src/commands/update.ts +9 -1
  72. package/src/components.ts +2 -2
  73. package/src/dev-compose.ts +144 -14
  74. package/src/project-config.ts +2 -0
  75. package/src/realtime-launch.ts +52 -0
  76. package/src/required-host-components.ts +1 -1
  77. package/src/route-manifest.ts +17 -0
  78. package/src/schema-push-lock.ts +131 -0
  79. package/src/self-host-compose.ts +18 -0
  80. package/src/type-extractor.ts +213 -13
  81. package/tests/realtime-launch.test.ts +25 -0
  82. package/tests/required-host-components.test.ts +2 -0
  83. package/tests/route-manifest.test.ts +29 -0
  84. package/tests/type-extractor.test.ts +153 -0
  85. package/tsconfig.tsbuildinfo +1 -1
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/cli@0.1.3 build /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.1.5 build /home/runner/work/supatype/supatype/packages/cli
3
3
  > tsc --project tsconfig.json && node --input-type=module -e "import{cpSync,mkdirSync}from'node:fs';const a='dist/assets';mkdirSync(a,{recursive:true});cpSync('assets/supatype-logo-wordmark.ascii.txt',a+'/supatype-logo-wordmark.ascii.txt')"
4
4
 
@@ -1,12 +1,12 @@
1
1
 
2
- > @supatype/cli@0.1.3 test /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.1.5 test /home/runner/work/supatype/supatype/packages/cli
3
3
  > vitest run
4
4
 
5
5
 
6
6
   RUN  v4.0.18 /home/runner/work/supatype/supatype/packages/cli
7
7
 
8
- ✓ tests/type-extractor.test.ts (34 tests) 211ms
9
- ✓ tests/runtime-contract.test.ts (41 tests) 141ms
8
+ ✓ tests/type-extractor.test.ts (37 tests) 152ms
9
+ ✓ tests/runtime-contract.test.ts (41 tests) 121ms
10
10
  stdout | tests/init.test.ts > scaffold() > creates all expected files
11
11
   created package.json
12
12
  created supatype.config.ts
@@ -291,9 +291,11 @@
291
291
  created public/.gitkeep
292
292
  created .gitignore
293
293
 
294
- ✓ tests/init.test.ts (26 tests) 74ms
294
+ ✓ tests/init.test.ts (26 tests) 65ms
295
295
 
296
- ✓ tests/dev-ui.test.ts (21 tests) 106ms
296
+ ✓ tests/dev-ui.test.ts (21 tests) 142ms
297
+
298
+ [supatype] Shutting down…
297
299
  stdout | tests/docker-runtime.test.ts > requireDockerDaemon > exits when the daemon is unavailable
298
300
  
299
301
  Start the Docker daemon (e.g. sudo systemctl start docker), then try again.
@@ -302,36 +304,34 @@
302
304
 
303
305
  docker: daemon down
304
306
 
305
-
306
- [supatype] Shutting down…
307
- ✓ tests/docker-runtime.test.ts (10 tests) 13ms
308
- ✓ tests/config.test.ts (19 tests) 5120ms
309
- ✓ loads a valid supatype.config.ts (plain export default, no package imports)  591ms
310
- ✓ normalizes shorthand schema string to { path, pg_schema }  533ms
311
- ✓ loads a supatype.config.js (plain ESM)  533ms
312
- ✓ loads config without a versions section (latest by default)  451ms
313
- ✓ prefers supatype.config.ts over supatype.config.js when both exist  491ms
314
- ✓ supports optional output field in config  552ms
315
- ✓ merges supatype.local.config.ts over base  1019ms
316
- ✓ loads defineConfig import before @supatype/cli is installed (init scaffold)  938ms
317
- ✓ tests/command-chrome-coverage.test.ts (1 test) 14ms
307
+ ✓ tests/docker-runtime.test.ts (10 tests) 17ms
308
+ ✓ tests/config.test.ts (19 tests) 5561ms
309
+ ✓ loads a valid supatype.config.ts (plain export default, no package imports)  614ms
310
+ ✓ normalizes shorthand schema string to { path, pg_schema }  528ms
311
+ ✓ loads a supatype.config.js (plain ESM)  583ms
312
+ ✓ loads config without a versions section (latest by default)  561ms
313
+ ✓ prefers supatype.config.ts over supatype.config.js when both exist  598ms
314
+ ✓ supports optional output field in config  538ms
315
+ ✓ merges supatype.local.config.ts over base  1152ms
316
+ ✓ loads defineConfig import before @supatype/cli is installed (init scaffold)  968ms
317
+ ✓ tests/command-chrome-coverage.test.ts (1 test) 15ms
318
318
  stdout | tests/link.test.ts > link model > migrates cloud.json into link.json
319
319
   created package.json
320
- stderr | tests/link.test.ts > link model > migrates cloud.json into link.json
321
320
  created supatype.config.ts
322
321
  created schema/index.ts
323
- [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
324
322
  created .env
325
323
  created seed.ts
326
324
  created seeds/.gitkeep
327
325
  created public/.gitkeep
328
326
  created .gitignore
329
327
 
328
+ stderr | tests/link.test.ts > link model > migrates cloud.json into link.json
329
+ [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
330
330
 
331
- ✓ tests/link.test.ts (4 tests) 2602ms
332
- ✓ resolveTarget returns cloud mode with /api/v1 prefix  909ms
333
- ✓ resolveTarget returns self-host mode with /platform/v1 prefix  849ms
334
- ✓ targetSchemaRollback posts to /platform/v1 when linked  834ms
331
+ ✓ tests/link.test.ts (4 tests) 2992ms
332
+ ✓ resolveTarget returns cloud mode with /api/v1 prefix  973ms
333
+ ✓ resolveTarget returns self-host mode with /platform/v1 prefix  1066ms
334
+ ✓ targetSchemaRollback posts to /platform/v1 when linked  943ms
335
335
  stdout | tests/admin-ensure.test.ts > init admin seed in .env > writes SUPATYPE_ADMIN_* when scaffold options include credentials
336
336
   created package.json
337
337
  created supatype.config.ts
@@ -342,55 +342,52 @@
342
342
  created public/.gitkeep
343
343
  created .gitignore
344
344
 
345
- ✓ tests/admin-ensure.test.ts (10 tests) 158ms
346
- ✓ tests/pull-utils.test.ts (49 tests) 11ms
347
- ✓ tests/schema-sources.test.ts (5 tests) 1160ms
348
- ✓ buildSchemaSourcesPayload includes manifest metadata  503ms
349
- ✓ restore overwrites modified local files  608ms
345
+ ✓ tests/admin-ensure.test.ts (10 tests) 177ms
346
+ ✓ tests/pull-utils.test.ts (49 tests) 12ms
347
+ ✓ tests/schema-sources.test.ts (5 tests) 1214ms
348
+ ✓ buildSchemaSourcesPayload includes manifest metadata  623ms
349
+ ✓ restore overwrites modified local files  549ms
350
350
  stderr | tests/binary-cache-cloud-overrides.test.ts > isLinkedToCloudProject > is true when .supatype/cloud.json has projectSlug
351
351
  [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
352
352
 
353
- ✓ tests/binary-cache-cloud-overrides.test.ts (11 tests) 19ms
354
- ✓ tests/minisign.test.ts (5 tests) 14ms
353
+ ✓ tests/binary-cache-cloud-overrides.test.ts (11 tests) 12ms
354
+ ✓ tests/minisign.test.ts (5 tests) 12ms
355
355
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
356
356
  [supatype] Storage bucket "photos" ready.
357
357
 
358
358
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
359
359
  [supatype] Storage bucket "avatars" ready.
360
360
 
361
- ✓ tests/storage-provision.test.ts (6 tests) 11ms
362
- ✓ tests/cached-artifact-format.test.ts (7 tests) 24ms
363
- ✓ tests/proxy-dev-app.test.ts (7 tests) 5ms
364
- ✓ tests/init-dependency-versions.test.ts (4 tests) 39ms
365
- ✓ tests/keys.test.ts (11 tests) 16241ms
366
- ✓ exits 0 with --secret  1443ms
367
- ✓ outputs ANON_KEY= line  1398ms
368
- ✓ outputs SERVICE_ROLE_KEY= line  1314ms
369
- ✓ ANON_KEY is a valid three-part JWT  1369ms
370
- ✓ SERVICE_ROLE_KEY payload has role: service_role  1397ms
371
- ✓ JWT has exp in the future  1411ms
372
- ✓ --exp-years changes the expiry window  2752ms
373
- ✓ reads JWT_SECRET from environment variable  1240ms
374
- ✓ reads JWT_SECRET from .env file  1296ms
375
- ✓ exits non-zero when no secret is available  1318ms
376
- ✓ keys --help shows --secret and --exp-years options  1299ms
377
- ✓ tests/augmentation-generator.test.ts (3 tests) 17ms
361
+ ✓ tests/storage-provision.test.ts (6 tests) 23ms
362
+ ✓ tests/cached-artifact-format.test.ts (7 tests) 12ms
363
+ ✓ tests/keys.test.ts (11 tests) 15921ms
364
+ ✓ exits 0 with --secret  1342ms
365
+ ✓ outputs ANON_KEY= line  1343ms
366
+ ✓ outputs SERVICE_ROLE_KEY= line  1278ms
367
+ ✓ ANON_KEY is a valid three-part JWT  1288ms
368
+ ✓ SERVICE_ROLE_KEY payload has role: service_role  1359ms
369
+ ✓ JWT has exp in the future  1302ms
370
+ ✓ --exp-years changes the expiry window  2717ms
371
+ ✓ reads JWT_SECRET from environment variable  1354ms
372
+ ✓ reads JWT_SECRET from .env file  1338ms
373
+ ✓ exits non-zero when no secret is available  1355ms
374
+ ✓ keys --help shows --secret and --exp-years options  1239ms
375
+ ✓ tests/init-dependency-versions.test.ts (4 tests) 47ms
376
+ ✓ tests/proxy-dev-app.test.ts (7 tests) 6ms
377
+ ✓ tests/augmentation-generator.test.ts (3 tests) 19ms
378
378
  ✓ tests/type-resolver.test.ts (2 tests) 16ms
379
- ✓ tests/engine-push-output.test.ts (7 tests) 6ms
380
- ✓ tests/tsx-runner.test.ts (7 tests) 2720ms
381
- ✓ evaluates a simple expression and returns stdout  400ms
382
- ✓ evaluates TypeScript syntax (type annotations)  368ms
383
- ✓ can serialize a JSON object to stdout  337ms
384
- ✓ returns non-zero exit code on syntax error  342ms
385
- ✓ returns non-zero exit code on runtime error  387ms
386
- ✓ captures stderr separately from stdout  342ms
387
- ✓ runs a .ts file and returns its stdout  541ms
388
- ✓ tests/command-chrome-wrap.test.ts (3 tests) 6ms
389
- ✓ tests/init-project-detect.test.ts (4 tests) 9ms
390
- ✓ tests/ensure-binary.test.ts (2 tests) 12ms
391
- ✓ tests/ui-messages.test.ts (5 tests) 7ms
392
- ✓ tests/required-host-components.test.ts (4 tests) 5ms
393
- ✓ tests/normalize-admin-config.test.ts (1 test) 7ms
379
+ ✓ tests/engine-push-output.test.ts (7 tests) 5ms
380
+ ✓ tests/command-chrome-wrap.test.ts (3 tests) 7ms
381
+ ✓ tests/ensure-binary.test.ts (2 tests) 6ms
382
+ ✓ tests/init-project-detect.test.ts (4 tests) 8ms
383
+ ✓ tests/tsx-runner.test.ts (7 tests) 3124ms
384
+ ✓ evaluates a simple expression and returns stdout  383ms
385
+ ✓ evaluates TypeScript syntax (type annotations)  402ms
386
+ ✓ can serialize a JSON object to stdout  441ms
387
+ ✓ returns non-zero exit code on syntax error  476ms
388
+ ✓ returns non-zero exit code on runtime error  381ms
389
+ ✓ captures stderr separately from stdout  438ms
390
+ ✓ runs a .ts file and returns its stdout  597ms
394
391
  stdout | tests/app-command.test.ts > supatype app add --static > sets app.mode=static and static_dir in supatype.config.ts
395
392
   created package.json
396
393
  created supatype.config.ts
@@ -401,11 +398,11 @@
401
398
  created public/.gitkeep
402
399
  created .gitignore
403
400
 
404
- ✓ tests/dev-session-lock.test.ts (2 tests) 4ms
405
- ✓ tests/ui-confirm.test.ts (3 tests) 8ms
406
- ✓ tests/docker-postgres.test.ts (5 tests) 4ms
407
- ✓ tests/binary-download-lock.test.ts (2 tests) 7ms
408
- ✓ tests/dev-ports.test.ts (3 tests) 6ms
401
+ ✓ tests/required-host-components.test.ts (4 tests) 6ms
402
+ ✓ tests/ui-messages.test.ts (5 tests) 7ms
403
+ ✓ tests/normalize-admin-config.test.ts (1 test) 6ms
404
+ ✓ tests/dev-session-lock.test.ts (2 tests) 5ms
405
+ ✓ tests/ui-confirm.test.ts (3 tests) 5ms
409
406
  stdout | tests/app-command.test.ts > supatype app add --static > creates the static directory when missing
410
407
   created package.json
411
408
  created supatype.config.ts
@@ -416,42 +413,47 @@
416
413
  created public/.gitkeep
417
414
  created .gitignore
418
415
 
416
+ ✓ tests/docker-postgres.test.ts (5 tests) 3ms
417
+ ✓ tests/binary-download-lock.test.ts (2 tests) 6ms
418
+ ✓ tests/cli-help.test.ts (16 tests) 21129ms
419
+ ✓ --help lists all top-level commands  1374ms
420
+ ✓ --version prints package.json version  1332ms
421
+ ✓ self-update --help describes the command  1374ms
422
+ ✓ init --help describes the init command  1306ms
423
+ ✓ push --help describes the push command and --yes flag  1282ms
424
+ ✓ diff --help describes the diff command  1325ms
425
+ ✓ pull --help describes scaffold pull command  1308ms
426
+ ✓ doctor --help describes drift report command  1269ms
427
+ ✓ introspect --help describes database introspection command  1343ms
428
+ ✓ adopt --help describes adoption ceremony command  1235ms
429
+ ✓ reset --help shows --yes flag  1258ms
430
+ ✓ app --help describes the app command with add/remove subcommands  1302ms
431
+ ✓ app add --help shows --static and --port options  1369ms
432
+ ✓ self-host --help shows compose only (legacy commands hidden)  1390ms
433
+ ✓ self-host compose --help shows compose subcommands  1312ms
434
+ ✓ unknown command exits non-zero  1342ms
435
+ ✓ tests/dev-ports.test.ts (3 tests) 6ms
419
436
  ✓ tests/dev-ready-panel.test.ts (2 tests) 4ms
420
- ✓ tests/cli-help.test.ts (16 tests) 21614ms
421
- ✓ --help lists all top-level commands  1439ms
422
- ✓ --version prints package.json version  1284ms
423
- ✓ self-update --help describes the command  1331ms
424
- ✓ init --help describes the init command  1443ms
425
- ✓ push --help describes the push command and --yes flag  1272ms
426
- ✓ diff --help describes the diff command  1335ms
427
- ✓ pull --help describes scaffold pull command  1398ms
428
- ✓ doctor --help describes drift report command  1280ms
429
- ✓ introspect --help describes database introspection command  1370ms
430
- ✓ adopt --help describes adoption ceremony command  1316ms
431
- ✓ reset --help shows --yes flag  1428ms
432
- ✓ app --help describes the app command with add/remove subcommands  1330ms
433
- ✓ app add --help shows --static and --port options  1395ms
434
- ✓ self-host --help shows compose only (legacy commands hidden)  1328ms
435
- ✓ self-host compose --help shows compose subcommands  1274ms
436
- ✓ unknown command exits non-zero  1383ms
437
+ ✓ tests/route-manifest.test.ts (1 test) 6ms
437
438
  ✓ tests/studio-admin-roles.test.ts (3 tests) 5ms
438
- ✓ tests/release-pins.test.ts (2 tests) 4ms
439
+ ✓ tests/app-command.test.ts (2 tests) 2816ms
440
+ ✓ sets app.mode=static and static_dir in supatype.config.ts  1454ms
441
+ ✓ creates the static directory when missing  1359ms
442
+ ✓ tests/realtime-launch.test.ts (1 test) 4ms
443
+ ✓ tests/release-pins.test.ts (2 tests) 3ms
444
+ ✓ tests/seed-discover.test.ts (2 tests) 18ms
439
445
  ✓ tests/ensure-dev-api-config.test.ts (1 test) 4ms
440
- ✓ tests/app-command.test.ts (2 tests) 2786ms
441
- ✓ sets app.mode=static and static_dir in supatype.config.ts  1429ms
442
- ✓ creates the static directory when missing  1355ms
443
- ✓ tests/seed-discover.test.ts (2 tests) 20ms
444
- ✓ tests/rest-cache-admin.test.ts (1 test) 44ms
445
- ✓ tests/init-package-json.test.ts (1 test) 3ms
446
+ ✓ tests/rest-cache-admin.test.ts (1 test) 38ms
447
+ ✓ tests/init-package-json.test.ts (1 test) 4ms
446
448
  ✓ tests/resolve-api-url.test.ts (2 tests) 4ms
447
449
  ✓ tests/pg-spawn-env.test.ts (2 tests) 4ms
448
- ✓ tests/migrate-from-v1.test.ts (1 test) 17ms
449
- ✓ tests/cli-package-version.test.ts (1 test) 4ms
450
- ✓ tests/postgres-archive-tag.test.ts (1 test) 2ms
450
+ ✓ tests/cli-package-version.test.ts (1 test) 3ms
451
+ ✓ tests/migrate-from-v1.test.ts (1 test) 15ms
452
+ ✓ tests/postgres-archive-tag.test.ts (1 test) 3ms
451
453
  ✓ tests/stdin-after-ink.test.ts (1 test) 3ms
452
454
 
453
-  Test Files  48 passed (48)
454
-  Tests  362 passed (362)
455
-  Start at  23:33:06
456
-  Duration  27.66s (transform 4.07s, setup 0ms, import 21.16s, tests 53.31s, environment 9ms)
455
+  Test Files  50 passed (50)
456
+  Tests  367 passed (367)
457
+  Start at  11:11:20
458
+  Duration  27.85s (transform 4.06s, setup 0ms, import 20.61s, tests 53.79s, environment 11ms)
457
459
 
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/cli@0.1.3 typecheck /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.1.5 typecheck /home/runner/work/supatype/supatype/packages/cli
3
3
  > tsc --project tsconfig.json --noEmit && tsc --project tests/tsconfig.json --noEmit
4
4
 
@@ -0,0 +1,4 @@
1
+ import { type SupatypeProjectConfig } from "./project-config.js";
2
+ /** Write VITE_SUPATYPE_* keys for the app dev server (P2 DX). */
3
+ export declare function writeAppViteEnv(cwd: string, config: SupatypeProjectConfig, apiUrl: string, anonKey: string): void;
4
+ //# sourceMappingURL=app-vite-env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-vite-env.d.ts","sourceRoot":"","sources":["../src/app-vite-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AASvF,iEAAiE;AACjE,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,IAAI,CASN"}
@@ -0,0 +1,22 @@
1
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+ import { projectRootFromConfig } from "./project-config.js";
4
+ function upsertEnvVar(content, key, value) {
5
+ const re = new RegExp(`^${key}=.*$`, "m");
6
+ if (re.test(content))
7
+ return content.replace(re, `${key}=${value}`);
8
+ const sep = content.endsWith("\n") || content.length === 0 ? "" : "\n";
9
+ return `${content}${sep}${key}=${value}\n`;
10
+ }
11
+ /** Write VITE_SUPATYPE_* keys for the app dev server (P2 DX). */
12
+ export function writeAppViteEnv(cwd, config, apiUrl, anonKey) {
13
+ const appDir = projectRootFromConfig(config, cwd);
14
+ if (!existsSync(join(appDir, "package.json")))
15
+ return;
16
+ const envPath = resolve(appDir, ".env.local");
17
+ let content = existsSync(envPath) ? readFileSync(envPath, "utf8") : "";
18
+ content = upsertEnvVar(content, "VITE_SUPATYPE_URL", apiUrl);
19
+ content = upsertEnvVar(content, "VITE_SUPATYPE_ANON_KEY", anonKey);
20
+ writeFileSync(envPath, content, "utf8");
21
+ }
22
+ //# sourceMappingURL=app-vite-env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-vite-env.js","sourceRoot":"","sources":["../src/app-vite-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,qBAAqB,EAA8B,MAAM,qBAAqB,CAAA;AAEvF,SAAS,YAAY,CAAC,OAAe,EAAE,GAAW,EAAE,KAAa;IAC/D,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,MAAM,EAAE,GAAG,CAAC,CAAA;IACzC,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAA;IACnE,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IACtE,OAAO,GAAG,OAAO,GAAG,GAAG,GAAG,GAAG,IAAI,KAAK,IAAI,CAAA;AAC5C,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,eAAe,CAC7B,GAAW,EACX,MAA6B,EAC7B,MAAc,EACd,OAAe;IAEf,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACjD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAAE,OAAM;IAErD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAC7C,IAAI,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACtE,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,CAAC,CAAA;IAC5D,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,wBAAwB,EAAE,OAAO,CAAC,CAAA;IAClE,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;AACzC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Binary cache — manages supatype component binaries.
3
3
  *
4
- * Components: engine, server, postgres, deno.
4
+ * Components: engine, server, postgres, deno, realtime.
5
5
  * Cache root: ~/.supatype/cache/{component}/{version}/
6
6
  * Override path: config.overrides?.{component} (local build path).
7
7
  *
@@ -92,16 +92,18 @@ export declare function versionFor(component: Component, config: SupatypeProject
92
92
  * Each component directory on the CDN exposes `latest.json` → `{"version":"x.y.z"}`.
93
93
  */
94
94
  export declare function fetchLatestVersion(component: Component): Promise<string>;
95
- /** Fetch the latest version for all components concurrently. */
96
- export declare function fetchAllLatestVersions(): Promise<Record<Component, string>>;
95
+ /** Fetch the latest version for all components concurrently. Missing CDN entries are omitted. */
96
+ export declare function fetchAllLatestVersions(): Promise<Partial<Record<Component, string>>>;
97
97
  /**
98
98
  * Download all component binaries for the current platform.
99
99
  * Skips components that are already cached.
100
100
  * Fails gracefully when graceful=true (suitable for postinstall).
101
101
  */
102
102
  /**
103
- * Verify all cached binaries for the current platform (used by integration CI).
104
- * Throws if any cached component is missing or fails format checks.
103
+ * Verify cached binaries for the current platform (used by integration CI).
104
+ * Only checks components present in `versions` unpublished CDN components
105
+ * (no latest.json yet) are skipped with a log so CI can land before first release.
106
+ * Throws if a pinned component is missing from cache or fails format checks.
105
107
  */
106
108
  export declare function verifyCachedBinaries(versions: Partial<ComponentVersions> | undefined): void;
107
109
  export declare function downloadAll(versions: Partial<ComponentVersions> | undefined, graceful?: boolean): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"binary-cache.d.ts","sourceRoot":"","sources":["../src/binary-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAoBH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAUhE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,UAAU,CAAA;AAExC,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAGxE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAGxE;AAED,yFAAyF;AACzF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAO7E;AAED,kEAAkE;AAClE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,EAAE,CAgB/E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAyB1F;AAMD,YAA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tF;AAMD;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAW9E;AAED,iGAAiG;AACjG,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAe1F;AAMD;;;;GAIG;AACH;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,SAAS,GAAG,IAAI,CAqB3F;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,SAAS,EAChD,QAAQ,UAAQ,GACf,OAAO,CAAC,IAAI,CAAC,CAmBf"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Binary cache — manages supatype component binaries.
3
3
  *
4
- * Components: engine, server, postgres, deno.
4
+ * Components: engine, server, postgres, deno, realtime.
5
5
  * Cache root: ~/.supatype/cache/{component}/{version}/
6
6
  * Override path: config.overrides?.{component} (local build path).
7
7
  *
@@ -63,6 +63,7 @@ export function describeActiveOverrides(config) {
63
63
  add("server", o.server);
64
64
  add("postgres_dir", o.postgres_dir);
65
65
  add("deno", o.deno);
66
+ add("realtime", o.realtime);
66
67
  add("studio", o.studio);
67
68
  add("postgrest", o.postgrest);
68
69
  return lines;
@@ -115,6 +116,7 @@ const CDN_PATHS = {
115
116
  server: (v, p) => `/server/v${v}/supatype-server-${p.os}-${p.arch}${p.os === "windows" ? ".exe" : ""}`,
116
117
  postgres: (v, p) => `/postgres/v${v}/supatype-pg-${postgresArchiveTag(v)}-${p.os}-${p.arch}${p.os === "windows" ? ".zip" : ".tar.gz"}`,
117
118
  deno: (v, p) => `/deno/v${v}/deno-${p.os}-${p.arch}${p.os === "windows" ? ".exe" : ""}`,
119
+ realtime: (v, p) => `/realtime/v${v}/supatype-realtime-${p.os}-${p.arch}${p.os === "windows" ? ".exe" : ""}`,
118
120
  };
119
121
  // Checksums file path (one per version directory, covers all platform binaries).
120
122
  const checksumsDirPath = (component, version) => `/${component}/v${version}/checksums.sha256`;
@@ -142,6 +144,7 @@ function binaryName(component, version, platform) {
142
144
  case "server": return `supatype-server-${platform.os}-${platform.arch}${win ? ".exe" : ""}`;
143
145
  case "postgres": return `supatype-pg-${postgresArchiveTag(version)}-${platform.os}-${platform.arch}${win ? ".zip" : ".tar.gz"}`;
144
146
  case "deno": return `deno-${platform.os}-${platform.arch}${win ? ".exe" : ""}`;
147
+ case "realtime": return `supatype-realtime-${platform.os}-${platform.arch}${win ? ".exe" : ""}`;
145
148
  }
146
149
  }
147
150
  // ---------------------------------------------------------------------------
@@ -496,7 +499,7 @@ async function streamToFileWithProgress(url, destPath) {
496
499
  // ---------------------------------------------------------------------------
497
500
  // SHA256 verification
498
501
  // ---------------------------------------------------------------------------
499
- const EXECUTABLE_COMPONENTS = new Set(["engine", "server", "deno"]);
502
+ const EXECUTABLE_COMPONENTS = new Set(["engine", "server", "deno", "realtime"]);
500
503
  /** True when a cached file matches expected format for the current platform. */
501
504
  function cachedArtifactLooksValid(component, filePath) {
502
505
  try {
@@ -516,7 +519,7 @@ export function validateArtifactFormat(component, filePath, platform) {
516
519
  }
517
520
  /**
518
521
  * Per-component CDN artifact shapes:
519
- * engine, server, deno — native executable (ELF / Mach-O / PE)
522
+ * engine, server, deno, realtime — native executable (ELF / Mach-O / PE)
520
523
  * postgres (unix) — .tar.gz (gzip)
521
524
  * postgres (windows) — .zip
522
525
  */
@@ -692,10 +695,22 @@ export async function fetchLatestVersion(component) {
692
695
  }
693
696
  return data.version.trim();
694
697
  }
695
- /** Fetch the latest version for all components concurrently. */
698
+ /** Fetch the latest version for all components concurrently. Missing CDN entries are omitted. */
696
699
  export async function fetchAllLatestVersions() {
697
- const results = await Promise.all(BINARY_COMPONENTS.map(async (c) => [c, await fetchLatestVersion(c)]));
698
- return Object.fromEntries(results);
700
+ const results = await Promise.all(BINARY_COMPONENTS.map(async (c) => {
701
+ try {
702
+ return [c, await fetchLatestVersion(c)];
703
+ }
704
+ catch {
705
+ return [c, undefined];
706
+ }
707
+ }));
708
+ const out = {};
709
+ for (const [c, v] of results) {
710
+ if (v)
711
+ out[c] = v;
712
+ }
713
+ return out;
699
714
  }
700
715
  // ---------------------------------------------------------------------------
701
716
  // Download all components (used by postinstall + supatype update)
@@ -706,8 +721,10 @@ export async function fetchAllLatestVersions() {
706
721
  * Fails gracefully when graceful=true (suitable for postinstall).
707
722
  */
708
723
  /**
709
- * Verify all cached binaries for the current platform (used by integration CI).
710
- * Throws if any cached component is missing or fails format checks.
724
+ * Verify cached binaries for the current platform (used by integration CI).
725
+ * Only checks components present in `versions` unpublished CDN components
726
+ * (no latest.json yet) are skipped with a log so CI can land before first release.
727
+ * Throws if a pinned component is missing from cache or fails format checks.
711
728
  */
712
729
  export function verifyCachedBinaries(versions) {
713
730
  if (!versions) {
@@ -717,7 +734,8 @@ export function verifyCachedBinaries(versions) {
717
734
  for (const component of BINARY_COMPONENTS) {
718
735
  const version = versions[component];
719
736
  if (typeof version !== "string" || version.trim() === "") {
720
- throw new Error(`[supatype] versions.${component} must be set`);
737
+ console.log(`[supatype] skipping verify for ${component} (no version — CDN latest.json not published yet)`);
738
+ continue;
721
739
  }
722
740
  const destPath = join(cachePath(component, version), binaryName(component, version, platform));
723
741
  if (!cachedArtifactLooksValid(component, destPath)) {
@@ -732,7 +750,7 @@ export async function downloadAll(versions, graceful = false) {
732
750
  const latest = await fetchAllLatestVersions();
733
751
  for (const component of components) {
734
752
  const version = versions?.[component] ?? latest[component];
735
- if (version === VERSION_PIN_LOCAL)
753
+ if (!version || version === VERSION_PIN_LOCAL)
736
754
  continue;
737
755
  try {
738
756
  await download(component, version, platform);