@supatype/cli 0.3.4 → 0.3.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 (119) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +172 -163
  3. package/.turbo/turbo-typecheck.log +1 -1
  4. package/CHANGELOG.md +36 -0
  5. package/dist/adopt-walkthrough.d.ts +40 -0
  6. package/dist/adopt-walkthrough.d.ts.map +1 -0
  7. package/dist/adopt-walkthrough.js +113 -0
  8. package/dist/adopt-walkthrough.js.map +1 -0
  9. package/dist/cli-version-embedded.js +1 -1
  10. package/dist/commands/admin.d.ts.map +1 -1
  11. package/dist/commands/admin.js +7 -16
  12. package/dist/commands/admin.js.map +1 -1
  13. package/dist/commands/adopt.d.ts.map +1 -1
  14. package/dist/commands/adopt.js +5 -6
  15. package/dist/commands/adopt.js.map +1 -1
  16. package/dist/commands/db.js +3 -3
  17. package/dist/commands/db.js.map +1 -1
  18. package/dist/commands/deploy.d.ts.map +1 -1
  19. package/dist/commands/deploy.js +7 -4
  20. package/dist/commands/deploy.js.map +1 -1
  21. package/dist/commands/dev.d.ts.map +1 -1
  22. package/dist/commands/dev.js +20 -5
  23. package/dist/commands/dev.js.map +1 -1
  24. package/dist/commands/doctor.d.ts.map +1 -1
  25. package/dist/commands/doctor.js +5 -7
  26. package/dist/commands/doctor.js.map +1 -1
  27. package/dist/commands/init.js +1 -1
  28. package/dist/commands/init.js.map +1 -1
  29. package/dist/commands/migrate.d.ts.map +1 -1
  30. package/dist/commands/migrate.js +6 -3
  31. package/dist/commands/migrate.js.map +1 -1
  32. package/dist/commands/push.d.ts.map +1 -1
  33. package/dist/commands/push.js +10 -6
  34. package/dist/commands/push.js.map +1 -1
  35. package/dist/commands/seed.js +2 -2
  36. package/dist/commands/seed.js.map +1 -1
  37. package/dist/dev-compose.d.ts +42 -0
  38. package/dist/dev-compose.d.ts.map +1 -1
  39. package/dist/dev-compose.js +116 -71
  40. package/dist/dev-compose.js.map +1 -1
  41. package/dist/dev-db-reset.d.ts +19 -0
  42. package/dist/dev-db-reset.d.ts.map +1 -0
  43. package/dist/dev-db-reset.js +75 -0
  44. package/dist/dev-db-reset.js.map +1 -0
  45. package/dist/dev-initial-push.d.ts +37 -0
  46. package/dist/dev-initial-push.d.ts.map +1 -0
  47. package/dist/dev-initial-push.js +91 -0
  48. package/dist/dev-initial-push.js.map +1 -0
  49. package/dist/dev-ports.d.ts.map +1 -1
  50. package/dist/dev-ports.js +1 -1
  51. package/dist/dev-ports.js.map +1 -1
  52. package/dist/diff-output.d.ts +2 -2
  53. package/dist/diff-output.d.ts.map +1 -1
  54. package/dist/diff-output.js +1 -1
  55. package/dist/diff-output.js.map +1 -1
  56. package/dist/engine-client.d.ts +5 -1
  57. package/dist/engine-client.d.ts.map +1 -1
  58. package/dist/engine-client.js +8 -6
  59. package/dist/engine-client.js.map +1 -1
  60. package/dist/engine-push-output.d.ts +10 -0
  61. package/dist/engine-push-output.d.ts.map +1 -1
  62. package/dist/engine-push-output.js +12 -0
  63. package/dist/engine-push-output.js.map +1 -1
  64. package/dist/{seed-connection.d.ts → host-database.d.ts} +20 -10
  65. package/dist/host-database.d.ts.map +1 -0
  66. package/dist/{seed-connection.js → host-database.js} +40 -14
  67. package/dist/host-database.js.map +1 -0
  68. package/dist/resolve-target.d.ts +2 -2
  69. package/dist/resolve-target.d.ts.map +1 -1
  70. package/dist/resolve-target.js +15 -11
  71. package/dist/resolve-target.js.map +1 -1
  72. package/dist/retired-no-cache.d.ts +18 -0
  73. package/dist/retired-no-cache.d.ts.map +1 -0
  74. package/dist/retired-no-cache.js +21 -0
  75. package/dist/retired-no-cache.js.map +1 -0
  76. package/dist/self-host-compose.d.ts +6 -0
  77. package/dist/self-host-compose.d.ts.map +1 -1
  78. package/dist/self-host-compose.js +9 -3
  79. package/dist/self-host-compose.js.map +1 -1
  80. package/dist/type-extractor.d.ts.map +1 -1
  81. package/dist/type-extractor.js +12 -6
  82. package/dist/type-extractor.js.map +1 -1
  83. package/package.json +2 -2
  84. package/src/adopt-walkthrough.ts +142 -0
  85. package/src/cli-version-embedded.ts +1 -1
  86. package/src/commands/admin.ts +7 -20
  87. package/src/commands/adopt.ts +5 -6
  88. package/src/commands/db.ts +3 -3
  89. package/src/commands/deploy.ts +7 -4
  90. package/src/commands/dev.ts +22 -6
  91. package/src/commands/doctor.ts +5 -7
  92. package/src/commands/init.ts +1 -1
  93. package/src/commands/migrate.ts +7 -4
  94. package/src/commands/push.ts +28 -10
  95. package/src/commands/seed.ts +2 -2
  96. package/src/dev-compose.ts +166 -77
  97. package/src/dev-db-reset.ts +95 -0
  98. package/src/dev-initial-push.ts +134 -0
  99. package/src/dev-ports.ts +1 -1
  100. package/src/diff-output.ts +2 -2
  101. package/src/engine-client.ts +5 -4
  102. package/src/engine-push-output.ts +19 -0
  103. package/src/{seed-connection.ts → host-database.ts} +42 -12
  104. package/src/resolve-target.ts +20 -14
  105. package/src/retired-no-cache.ts +27 -0
  106. package/src/self-host-compose.ts +10 -3
  107. package/src/type-extractor.ts +15 -5
  108. package/tests/adopt-result.test.ts +27 -0
  109. package/tests/adopt-walkthrough.test.ts +129 -0
  110. package/tests/dev-db-reset.test.ts +162 -0
  111. package/tests/dev-initial-push.test.ts +142 -0
  112. package/tests/engine-push-output.test.ts +30 -1
  113. package/tests/host-connection-targets.test.ts +84 -0
  114. package/tests/{seed-connection.test.ts → host-database.test.ts} +33 -15
  115. package/tests/retired-no-cache.test.ts +46 -0
  116. package/tests/type-extractor.test.ts +44 -0
  117. package/tsconfig.tsbuildinfo +1 -1
  118. package/dist/seed-connection.d.ts.map +0 -1
  119. package/dist/seed-connection.js.map +0 -1
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/cli@0.3.4 build /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.3.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,16 +1,16 @@
1
1
 
2
- > @supatype/cli@0.3.4 test /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.3.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 (49 tests) 233ms
9
- ✓ tests/access-composition.test.ts (32 tests) 217ms
10
- ✓ tests/model-hooks.test.ts (23 tests) 112ms
11
- ✓ tests/runtime-contract.test.ts (64 tests) 222ms
12
- ✓ tests/augmentation-generator.test.ts (24 tests) 26ms
13
- ✓ tests/seed-ir.test.ts (15 tests) 46ms
8
+ ✓ tests/access-composition.test.ts (32 tests) 310ms
9
+ ✓ tests/type-extractor.test.ts (51 tests) 479ms
10
+ ✓ tests/model-hooks.test.ts (23 tests) 194ms
11
+ ✓ tests/runtime-contract.test.ts (64 tests) 285ms
12
+ ✓ tests/augmentation-generator.test.ts (24 tests) 62ms
13
+ ✓ tests/seed-ir.test.ts (15 tests) 41ms
14
14
  stdout | tests/init.test.ts > scaffold() > creates all expected files
15
15
   created package.json
16
16
  created supatype.config.ts
@@ -325,31 +325,32 @@
325
325
  created public/.gitkeep
326
326
  created .gitignore
327
327
 
328
- ✓ tests/init.test.ts (28 tests) 209ms
329
- ✓ tests/engine-floor.test.ts (28 tests) 34ms
330
- ✓ tests/external-database-compose.test.ts (23 tests) 38ms
331
- ✓ tests/model-constraints.test.ts (18 tests) 222ms
332
- ✓ tests/model-versions.test.ts (19 tests) 143ms
333
- ✓ tests/api-config-cache-seed.test.ts (15 tests) 46ms
334
- ✓ tests/model-cache-declaration.test.ts (18 tests) 114ms
335
- ✓ tests/field-masking-tier.test.ts (16 tests) 18ms
328
+ ✓ tests/init.test.ts (28 tests) 158ms
329
+ ✓ tests/engine-floor.test.ts (28 tests) 20ms
330
+ ✓ tests/external-database-compose.test.ts (23 tests) 28ms
331
+ ✓ tests/model-constraints.test.ts (18 tests) 107ms
332
+ ✓ tests/model-versions.test.ts (19 tests) 105ms
333
+ ✓ tests/api-config-cache-seed.test.ts (15 tests) 59ms
334
+ ✓ tests/model-cache-declaration.test.ts (18 tests) 89ms
335
+ ✓ tests/field-masking-tier.test.ts (16 tests) 24ms
336
+ ✓ tests/hooks-generator.test.ts (7 tests) 8672ms
337
+ ✓ typechecks under strict mode, together with a handler that uses it  3055ms
338
+ ✓ rejects a handler for a table that declares no hook  3234ms
339
+ ✓ typechecks with a validator written the way the docs will show it  2330ms
336
340
 
337
- ✓ tests/dev-ui.test.ts (21 tests) 166ms
341
+ ✓ tests/dev-ui.test.ts (21 tests) 107ms
338
342
 
339
343
  [supatype] Shutting down…
340
- ✓ tests/hooks-generator.test.ts (7 tests) 9881ms
341
- ✓ typechecks under strict mode, together with a handler that uses it  3886ms
342
- ✓ rejects a handler for a table that declares no hook  3521ms
343
- ✓ typechecks with a validator written the way the docs will show it  2367ms
344
- ✓ tests/config.test.ts (19 tests) 9093ms
345
- ✓ loads a valid supatype.config.ts (plain export default, no package imports)  1136ms
346
- ✓ normalizes shorthand schema string to { path, pg_schema }  1487ms
347
- ✓ loads a supatype.config.js (plain ESM)  1023ms
348
- ✓ loads config without a versions section (latest by default)  1103ms
349
- ✓ prefers supatype.config.ts over supatype.config.js when both exist  922ms
350
- ✓ supports optional output field in config  858ms
351
- ✓ merges supatype.local.config.ts over base  1337ms
352
- ✓ loads defineConfig import before @supatype/cli is installed (init scaffold)  1214ms
344
+ ✓ tests/host-database.test.ts (15 tests) 38ms
345
+ ✓ tests/config.test.ts (19 tests) 8275ms
346
+ ✓ loads a valid supatype.config.ts (plain export default, no package imports)  1005ms
347
+ ✓ normalizes shorthand schema string to { path, pg_schema }  1241ms
348
+ ✓ loads a supatype.config.js (plain ESM)  953ms
349
+ ✓ loads config without a versions section (latest by default)  977ms
350
+ ✓ prefers supatype.config.ts over supatype.config.js when both exist  873ms
351
+ ✓ supports optional output field in config  806ms
352
+ ✓ merges supatype.local.config.ts over base  1444ms
353
+ ✓ loads defineConfig import before @supatype/cli is installed (init scaffold)  951ms
353
354
  stdout | tests/docker-runtime.test.ts > requireDockerDaemon > exits when the daemon is unavailable
354
355
  
355
356
  Start the Docker daemon (e.g. sudo systemctl start docker), then try again.
@@ -358,28 +359,30 @@
358
359
 
359
360
  docker: daemon down
360
361
 
361
- ✓ tests/docker-runtime.test.ts (10 tests) 14ms
362
- ✓ tests/db-preflight.test.ts (14 tests) 10ms
363
- ✓ tests/keys-write.test.ts (11 tests) 24ms
364
- ✓ tests/field-bounds.test.ts (23 tests) 15ms
365
- ✓ tests/cache-clean.test.ts (8 tests) 2007ms
366
- ✓ keeps pinned versions and removes the rest  562ms
367
- ✓ --force removes pinned versions  731ms
368
- ✓ explicit version removes even when pinned (with warning)  698ms
369
- ✓ tests/cache-provider-config.test.ts (12 tests) 12ms
370
- ✓ tests/functions-deno-types.test.ts (7 tests) 2956ms
371
- ✓ tsc fails with Cannot find name Deno without ambient types  2063ms
372
- ✓ tsc passes for Deno.env after ensureFunctionsDenoTypes  879ms
373
- ✓ tests/seed-connection.test.ts (13 tests) 16ms
374
- ✓ tests/field-bounds-matrix.test.ts (124 tests) 34ms
362
+ ✓ tests/docker-runtime.test.ts (10 tests) 23ms
363
+ ✓ tests/db-preflight.test.ts (14 tests) 8ms
364
+ ✓ tests/dev-db-reset.test.ts (8 tests) 181ms
365
+ ✓ tests/keys-write.test.ts (11 tests) 15ms
366
+ ✓ tests/field-bounds.test.ts (23 tests) 13ms
367
+ ✓ tests/cache-clean.test.ts (8 tests) 1859ms
368
+ ✓ keeps pinned versions and removes the rest  677ms
369
+ ✓ --force removes pinned versions  615ms
370
+ ✓ explicit version removes even when pinned (with warning)  550ms
371
+ ✓ tests/functions-deno-types.test.ts (7 tests) 2587ms
372
+ ✓ tsc fails with Cannot find name Deno without ambient types  1778ms
373
+ ✓ tsc passes for Deno.env after ensureFunctionsDenoTypes  792ms
374
+ ✓ tests/cache-provider-config.test.ts (12 tests) 11ms
375
+ ✓ tests/field-bounds-matrix.test.ts (124 tests) 23ms
375
376
  ✓ tests/external-database-config.test.ts (14 tests) 10ms
376
- ✓ tests/compose-services.test.ts (12 tests) 12ms
377
- ✓ tests/field-validators.test.ts (10 tests) 68ms
378
- ✓ tests/native-keyspace.test.ts (10 tests) 39ms
379
- ✓ tests/db-port.test.ts (14 tests) 17ms
380
- ✓ tests/command-chrome-coverage.test.ts (1 test) 22ms
381
- ✓ tests/hook-upload.test.ts (8 tests) 14ms
382
- ✓ tests/env-file.test.ts (9 tests) 17ms
377
+ ✓ tests/compose-services.test.ts (12 tests) 10ms
378
+ ✓ tests/adopt-walkthrough.test.ts (12 tests) 11ms
379
+ ✓ tests/dev-initial-push.test.ts (7 tests) 23ms
380
+ ✓ tests/field-validators.test.ts (10 tests) 60ms
381
+ ✓ tests/native-keyspace.test.ts (10 tests) 36ms
382
+ ✓ tests/db-port.test.ts (14 tests) 11ms
383
+ ✓ tests/command-chrome-coverage.test.ts (1 test) 11ms
384
+ ✓ tests/hook-upload.test.ts (8 tests) 12ms
385
+ ✓ tests/env-file.test.ts (9 tests) 15ms
383
386
  stdout | tests/link.test.ts > link model > migrates cloud.json into link.json
384
387
   created package.json
385
388
  created supatype.config.ts
@@ -393,10 +396,10 @@
393
396
  stderr | tests/link.test.ts > link model > migrates cloud.json into link.json
394
397
  [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
395
398
 
396
- ✓ tests/link.test.ts (4 tests) 3052ms
397
- ✓ resolveTarget returns cloud mode with /api/v1 prefix  984ms
398
- ✓ resolveTarget returns self-host mode with /platform/v1 prefix  1012ms
399
- ✓ targetSchemaRollback posts to /platform/v1 when linked  1043ms
399
+ ✓ tests/link.test.ts (4 tests) 2823ms
400
+ ✓ resolveTarget returns cloud mode with /api/v1 prefix  922ms
401
+ ✓ resolveTarget returns self-host mode with /platform/v1 prefix  938ms
402
+ ✓ targetSchemaRollback posts to /platform/v1 when linked  951ms
400
403
  stdout | tests/admin-ensure.test.ts > init admin seed in .env > writes SUPATYPE_ADMIN_* when scaffold options include credentials
401
404
   created package.json
402
405
  created supatype.config.ts
@@ -407,8 +410,8 @@
407
410
  created public/.gitkeep
408
411
  created .gitignore
409
412
 
410
- ✓ tests/admin-ensure.test.ts (10 tests) 173ms
411
- ✓ tests/service-role-check.test.ts (10 tests) 13ms
413
+ ✓ tests/admin-ensure.test.ts (10 tests) 160ms
414
+ ✓ tests/service-role-check.test.ts (10 tests) 8ms
412
415
  stdout | tests/admin-studio-membership.test.ts > first admin user creation > does not write a role into app_metadata
413
416
  [supatype] Admin user "admin@example.com" created (role: admin).
414
417
  [supatype] Log in at /admin after starting the dev server.
@@ -425,56 +428,79 @@
425
428
  [supatype] Admin user "admin@example.com" created (role: admin).
426
429
  [supatype] Log in at /admin after starting the dev server.
427
430
 
428
- ✓ tests/admin-studio-membership.test.ts (5 tests) 562ms
429
- ✓ tests/pull-utils.test.ts (49 tests) 10ms
430
- ✓ tests/schema-sources.test.ts (5 tests) 1198ms
431
- ✓ buildSchemaSourcesPayload includes manifest metadata  612ms
432
- ✓ restore overwrites modified local files  544ms
433
- ✓ tests/preview-config-check.test.ts (9 tests) 12ms
434
- ✓ tests/keys.test.ts (11 tests) 17909ms
435
- ✓ exits 0 with --secret  1677ms
436
- ✓ outputs ANON_KEY= line  1546ms
437
- ✓ outputs SERVICE_ROLE_KEY= line  1372ms
438
- ✓ ANON_KEY is a valid three-part JWT  1425ms
439
- ✓ SERVICE_ROLE_KEY payload has role: service_role  1469ms
440
- ✓ JWT has exp in the future  1628ms
441
- ✓ --exp-years changes the expiry window  2967ms
442
- ✓ reads JWT_SECRET from environment variable  1526ms
443
- ✓ reads JWT_SECRET from .env file  1486ms
444
- ✓ exits non-zero when no secret is available  1489ms
445
- ✓ keys --help shows --secret and --exp-years options  1319ms
431
+ ✓ tests/admin-studio-membership.test.ts (5 tests) 476ms
432
+ ✓ tests/pull-utils.test.ts (49 tests) 11ms
433
+ ✓ tests/keys.test.ts (11 tests) 14812ms
434
+ ✓ exits 0 with --secret  1257ms
435
+ ✓ outputs ANON_KEY= line  1279ms
436
+ ✓ outputs SERVICE_ROLE_KEY= line  1245ms
437
+ ✓ ANON_KEY is a valid three-part JWT  1293ms
438
+ ✓ SERVICE_ROLE_KEY payload has role: service_role  1120ms
439
+ ✓ JWT has exp in the future  1137ms
440
+ ✓ --exp-years changes the expiry window  2593ms
441
+ ✓ reads JWT_SECRET from environment variable  1218ms
442
+ ✓ reads JWT_SECRET from .env file  1282ms
443
+ ✓ exits non-zero when no secret is available  1163ms
444
+ ✓ keys --help shows --secret and --exp-years options  1220ms
445
+ ✓ tests/preview-config-check.test.ts (9 tests) 7ms
446
+ ✓ tests/schema-sources.test.ts (5 tests) 1129ms
447
+ ✓ buildSchemaSourcesPayload includes manifest metadata  581ms
448
+ ✓ restore overwrites modified local files  512ms
446
449
  stderr | tests/binary-cache-cloud-overrides.test.ts > isLinkedToCloudProject > is true when .supatype/cloud.json has projectSlug
447
450
  [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
448
451
 
449
452
  ✓ tests/binary-cache-cloud-overrides.test.ts (11 tests) 16ms
453
+ ✓ tests/homebrew-formula.test.ts (4 tests) 195ms
454
+ ✓ tests/model-cache-manifest.test.ts (12 tests) 5ms
450
455
  ✓ tests/local-server-image-env.test.ts (5 tests) 15ms
451
- ✓ tests/model-cache-manifest.test.ts (12 tests) 8ms
452
- ✓ tests/homebrew-formula.test.ts (4 tests) 191ms
453
- ✓ tests/minisign.test.ts (5 tests) 14ms
454
- ✓ tests/client-generator.test.ts (9 tests) 10ms
455
- ✓ tests/local-secrets.test.ts (5 tests) 13ms
456
- ✓ tests/functions-concurrency.test.ts (6 tests) 4ms
457
- ✓ tests/readiness-poll.test.ts (3 tests) 325ms
458
- ✓ ends promptly when it carries a deadline  320ms
459
- ✓ tests/ast-derived-outputs.test.ts (5 tests) 14ms
460
- ✓ tests/functions-context-refresh.test.ts (4 tests) 12ms
461
- ✓ tests/self-host-keys.test.ts (7 tests) 11ms
462
- ✓ tests/gitignore-secrets.test.ts (5 tests) 102ms
463
- ✓ tests/api-schemas.test.ts (10 tests) 9ms
456
+ ✓ tests/minisign.test.ts (5 tests) 9ms
457
+ ✓ tests/local-secrets.test.ts (5 tests) 9ms
458
+ ✓ tests/client-generator.test.ts (9 tests) 9ms
459
+ ✓ tests/functions-concurrency.test.ts (6 tests) 5ms
460
+ ✓ tests/readiness-poll.test.ts (3 tests) 320ms
461
+ ✓ ends promptly when it carries a deadline  317ms
462
+ ✓ tests/ast-derived-outputs.test.ts (5 tests) 11ms
463
+ ✓ tests/self-host-keys.test.ts (7 tests) 12ms
464
+ ✓ tests/functions-context-refresh.test.ts (4 tests) 10ms
465
+ ✓ tests/engine-push-output.test.ts (10 tests) 9ms
466
+ ✓ tests/db-published-and-addressable.test.ts (4 tests) 6ms
467
+ ✓ tests/gitignore-secrets.test.ts (5 tests) 42ms
468
+ ✓ tests/api-schemas.test.ts (10 tests) 8ms
464
469
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
465
470
  [supatype] Storage bucket "photos" ready.
466
471
 
467
472
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
468
473
  [supatype] Storage bucket "avatars" ready.
469
474
 
470
- ✓ tests/storage-provision.test.ts (6 tests) 13ms
475
+ ✓ tests/storage-provision.test.ts (6 tests) 15ms
471
476
  ✓ tests/strict.test.ts (7 tests) 8ms
472
- ✓ tests/cached-artifact-format.test.ts (7 tests) 13ms
473
- ✓ tests/db-published-and-addressable.test.ts (4 tests) 6ms
474
- ✓ tests/cache-identity-scope.test.ts (33 tests) 12ms
475
- ✓ tests/target-client-refresh.test.ts (3 tests) 11ms
476
- ✓ tests/studio-admin-roles.test.ts (6 tests) 8ms
477
- ✓ tests/proxy-dev-app.test.ts (7 tests) 6ms
477
+ ✓ tests/cached-artifact-format.test.ts (7 tests) 15ms
478
+ ✓ tests/host-connection-targets.test.ts (4 tests) 2180ms
479
+ ✓ connects direct mode to the host-published database, not the container (#85)  580ms
480
+ ✓ does the same for the local target used when there is no service key  511ms
481
+ ✓ reads the project's .env for doctor and pull, not only the process environment  547ms
482
+ ✓ still takes --connection over everything  541ms
483
+ ✓ tests/cache-identity-scope.test.ts (33 tests) 7ms
484
+ ✓ tests/proxy-dev-app.test.ts (7 tests) 5ms
485
+ ✓ tests/target-client-refresh.test.ts (3 tests) 10ms
486
+ ✓ tests/studio-admin-roles.test.ts (6 tests) 4ms
487
+ ✓ tests/cli-help.test.ts (16 tests) 19955ms
488
+ ✓ --help lists all top-level commands  1245ms
489
+ ✓ --version prints package.json version  1115ms
490
+ ✓ self-update --help describes the command  1249ms
491
+ ✓ init --help describes the init command  1260ms
492
+ ✓ push --help describes the push command and --yes flag  1280ms
493
+ ✓ diff --help describes the diff command  1323ms
494
+ ✓ pull --help describes scaffold pull command  1312ms
495
+ ✓ doctor --help describes drift report command  1235ms
496
+ ✓ introspect --help describes database introspection command  1249ms
497
+ ✓ adopt --help describes adoption ceremony command  1167ms
498
+ ✓ reset --help shows --yes flag  1251ms
499
+ ✓ app --help describes the app command with add/remove subcommands  1190ms
500
+ ✓ app add --help shows --static and --port options  1160ms
501
+ ✓ self-host --help shows compose only (legacy commands hidden)  1346ms
502
+ ✓ self-host compose --help shows compose subcommands  1314ms
503
+ ✓ unknown command exits non-zero  1249ms
478
504
  stdout | tests/app-command.test.ts > supatype app add --static > sets app.mode=static and static_dir in supatype.config.ts
479
505
   created package.json
480
506
  created supatype.config.ts
@@ -485,6 +511,13 @@
485
511
  created public/.gitkeep
486
512
  created .gitignore
487
513
 
514
+ ✓ tests/compose-parsable-defaults.test.ts (2 tests) 8ms
515
+ ✓ tests/rest-cache-admin.test.ts (3 tests) 38ms
516
+ ✓ tests/init-dependency-versions.test.ts (4 tests) 37ms
517
+ ✓ tests/service-role-routes.test.ts (4 tests) 1625ms
518
+ ✓ reads the declared list  552ms
519
+ ✓ is an empty list when a project declares none  575ms
520
+ ✓ sends what the project declared, hook entries included  492ms
488
521
  stdout | tests/app-command.test.ts > supatype app add --static > creates the static directory when missing
489
522
   created package.json
490
523
  created supatype.config.ts
@@ -495,79 +528,55 @@
495
528
  created public/.gitkeep
496
529
  created .gitignore
497
530
 
498
- ✓ tests/service-role-routes.test.ts (4 tests) 1658ms
499
- ✓ reads the declared list  538ms
500
- ✓ is an empty list when a project declares none  532ms
501
- ✓ sends what the project declared, hook entries included  584ms
502
- ✓ tests/cli-help.test.ts (16 tests) 23281ms
503
- ✓ --help lists all top-level commands  1493ms
504
- ✓ --version prints package.json version  1517ms
505
- ✓ self-update --help describes the command  1364ms
506
- ✓ init --help describes the init command  1405ms
507
- ✓ push --help describes the push command and --yes flag  1538ms
508
- ✓ diff --help describes the diff command  1459ms
509
- ✓ pull --help describes scaffold pull command  1423ms
510
- ✓ doctor --help describes drift report command  1526ms
511
- ✓ introspect --help describes database introspection command  1444ms
512
- ✓ adopt --help describes adoption ceremony command  1508ms
513
- ✓ reset --help shows --yes flag  1447ms
514
- ✓ app --help describes the app command with add/remove subcommands  1249ms
515
- ✓ app add --help shows --static and --port options  1475ms
516
- ✓ self-host --help shows compose only (legacy commands hidden)  1394ms
517
- ✓ self-host compose --help shows compose subcommands  1455ms
518
- ✓ unknown command exits non-zero  1574ms
519
- ✓ tests/rest-cache-admin.test.ts (3 tests) 42ms
520
- ✓ tests/init-dependency-versions.test.ts (4 tests) 38ms
521
- ✓ tests/compose-parsable-defaults.test.ts (2 tests) 8ms
522
- ✓ tests/app-command.test.ts (2 tests) 3178ms
523
- ✓ sets app.mode=static and static_dir in supatype.config.ts  1650ms
524
- ✓ creates the static directory when missing  1526ms
525
- ✓ tests/engine-push-output.test.ts (7 tests) 7ms
526
- ✓ tests/type-resolver.test.ts (2 tests) 16ms
527
- ✓ tests/command-chrome-wrap.test.ts (3 tests) 7ms
528
- ✓ tests/cli-install-method.test.ts (8 tests) 8ms
529
- ✓ tests/port-in-use.test.ts (4 tests) 29ms
530
- ✓ tests/doctor-render.test.ts (3 tests) 7ms
531
- ✓ tests/archive-name-alias.test.ts (4 tests) 7ms
532
- ✓ tests/init-project-detect.test.ts (4 tests) 12ms
531
+ ✓ tests/type-resolver.test.ts (2 tests) 13ms
532
+ ✓ tests/app-command.test.ts (2 tests) 2820ms
533
+ ✓ sets app.mode=static and static_dir in supatype.config.ts  1431ms
534
+ ✓ creates the static directory when missing  1387ms
535
+ ✓ tests/command-chrome-wrap.test.ts (3 tests) 6ms
536
+ ✓ tests/cli-install-method.test.ts (8 tests) 6ms
537
+ ✓ tests/port-in-use.test.ts (4 tests) 23ms
538
+ ✓ tests/archive-name-alias.test.ts (4 tests) 8ms
533
539
  ✓ tests/ensure-binary.test.ts (2 tests) 9ms
534
- ✓ tests/tsx-runner.test.ts (7 tests) 2963ms
535
- ✓ evaluates a simple expression and returns stdout  368ms
536
- ✓ evaluates TypeScript syntax (type annotations)  445ms
537
- ✓ can serialize a JSON object to stdout  372ms
538
- ✓ returns non-zero exit code on syntax error  402ms
539
- ✓ returns non-zero exit code on runtime error  411ms
540
- ✓ captures stderr separately from stdout  403ms
541
- ✓ runs a .ts file and returns its stdout  554ms
542
- ✓ tests/doctor-service-role.test.ts (4 tests) 7ms
543
- ✓ tests/required-host-components.test.ts (4 tests) 7ms
540
+ ✓ tests/doctor-render.test.ts (3 tests) 6ms
541
+ ✓ tests/init-project-detect.test.ts (4 tests) 10ms
542
+ ✓ tests/tsx-runner.test.ts (7 tests) 2668ms
543
+ ✓ evaluates TypeScript syntax (type annotations)  365ms
544
+ ✓ can serialize a JSON object to stdout  391ms
545
+ ✓ returns non-zero exit code on syntax error  401ms
546
+ ✓ returns non-zero exit code on runtime error  329ms
547
+ ✓ captures stderr separately from stdout  365ms
548
+ ✓ runs a .ts file and returns its stdout  515ms
549
+ ✓ tests/doctor-service-role.test.ts (4 tests) 9ms
550
+ ✓ tests/dev-ports-owner.test.ts (6 tests) 4ms
551
+ ✓ tests/required-host-components.test.ts (4 tests) 5ms
544
552
  ✓ tests/ui-messages.test.ts (5 tests) 6ms
545
- ✓ tests/dev-ports-owner.test.ts (6 tests) 8ms
546
- ✓ tests/normalize-admin-config.test.ts (1 test) 8ms
547
- ✓ tests/ui-confirm.test.ts (3 tests) 9ms
553
+ ✓ tests/retired-no-cache.test.ts (4 tests) 8ms
554
+ ✓ tests/normalize-admin-config.test.ts (1 test) 6ms
555
+ ✓ tests/ui-confirm.test.ts (3 tests) 7ms
548
556
  ✓ tests/docker-postgres.test.ts (5 tests) 4ms
549
- ✓ tests/binary-download-lock.test.ts (2 tests) 7ms
550
- ✓ tests/dev-session-lock.test.ts (2 tests) 4ms
557
+ ✓ tests/binary-download-lock.test.ts (2 tests) 6ms
558
+ ✓ tests/dev-session-lock.test.ts (2 tests) 5ms
551
559
  ✓ tests/dev-ports.test.ts (3 tests) 6ms
552
- ✓ tests/config-load-failure.test.ts (2 tests) 3819ms
553
- ✓ is reported, rather than treated as absent  2219ms
554
- ✓ does not stop the CLI working with no config at all  1597ms
555
- ✓ tests/route-manifest.test.ts (1 test) 7ms
556
- ✓ tests/dev-ready-panel.test.ts (2 tests) 4ms
557
- ✓ tests/realtime-launch.test.ts (1 test) 5ms
558
- ✓ tests/release-pins.test.ts (2 tests) 4ms
559
- ✓ tests/ensure-dev-api-config.test.ts (1 test) 5ms
560
- ✓ tests/seed-discover.test.ts (2 tests) 19ms
561
- ✓ tests/init-package-json.test.ts (1 test) 4ms
562
- ✓ tests/pg-spawn-env.test.ts (2 tests) 4ms
563
- ✓ tests/resolve-api-url.test.ts (2 tests) 4ms
564
- ✓ tests/migrate-from-v1.test.ts (1 test) 17ms
565
- ✓ tests/cli-package-version.test.ts (1 test) 4ms
566
- ✓ tests/postgres-archive-tag.test.ts (1 test) 3ms
560
+ ✓ tests/route-manifest.test.ts (1 test) 4ms
561
+ ✓ tests/config-load-failure.test.ts (2 tests) 3319ms
562
+ ✓ is reported, rather than treated as absent  1957ms
563
+ ✓ does not stop the CLI working with no config at all  1359ms
564
+ ✓ tests/dev-ready-panel.test.ts (2 tests) 3ms
565
+ ✓ tests/realtime-launch.test.ts (1 test) 3ms
566
+ ✓ tests/release-pins.test.ts (2 tests) 3ms
567
+ ✓ tests/seed-discover.test.ts (2 tests) 15ms
568
+ ✓ tests/ensure-dev-api-config.test.ts (1 test) 4ms
569
+ ✓ tests/adopt-result.test.ts (2 tests) 4ms
570
+ ✓ tests/init-package-json.test.ts (1 test) 3ms
571
+ ✓ tests/pg-spawn-env.test.ts (2 tests) 3ms
572
+ ✓ tests/resolve-api-url.test.ts (2 tests) 5ms
573
+ ✓ tests/migrate-from-v1.test.ts (1 test) 14ms
574
+ ✓ tests/cli-package-version.test.ts (1 test) 3ms
575
+ ✓ tests/postgres-archive-tag.test.ts (1 test) 2ms
567
576
  ✓ tests/stdin-after-ink.test.ts (1 test) 3ms
568
577
 
569
-  Test Files  104 passed (104)
570
-  Tests  1116 passed (1116)
571
-  Start at  07:44:24
572
-  Duration  54.40s (transform 8.08s, setup 0ms, import 55.68s, tests 85.10s, environment 24ms)
578
+  Test Files  110 passed (110)
579
+  Tests  1160 passed (1160)
580
+  Start at  09:56:07
581
+  Duration  52.88s (transform 9.45s, setup 0ms, import 61.11s, tests 77.01s, environment 17ms)
573
582
 
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/cli@0.3.4 typecheck /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.3.5 typecheck /home/runner/work/supatype/supatype/packages/cli
3
3
  > tsc --project tsconfig.json --noEmit && tsc --project tests/tsconfig.json --noEmit
4
4
 
package/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@
4
4
 
5
5
  ### Features
6
6
 
7
+ * **push:** when the engine refuses tables Supatype does not manage, `supatype push` and
8
+ `supatype dev` say which tables and that their declared access rules are not in force, and in a
9
+ terminal offer to adopt them there and then: the SQL adoption would run is shown, nothing is
10
+ applied without a second yes, and the push runs again afterwards. Without a terminal, or with
11
+ `--yes`, nothing is adopted and the command to run is printed. On a docker project adoption runs
12
+ through the compose schema-engine, so it reaches the stack's database. The refusal is read from
13
+ the engine's JSON reason, with its wording only as the fallback for an older engine.
14
+ * **adopt, doctor:** `--no-cache` is hidden and does nothing but say it is no longer needed: both
15
+ read the database live. It never worked from the CLI (Commander stores it as `cache: false` and
16
+ the commands read `noCache`), and `doctor` would have passed it to an engine subcommand that does
17
+ not accept it.
18
+
7
19
  * **seed:** a seed file now exports a default function and describes writes rather than
8
20
  performing them. The calls are collected into a document that the engine validates against
9
21
  the schema, orders by foreign key, batches, and applies in one transaction. There is no
@@ -41,6 +53,9 @@
41
53
  process, so the previous rule left a fresh project with a database nothing on the host could
42
54
  reach and a remedy nobody had reason to know about.
43
55
  * **schema:** `After<>` and `Before<>` are parsed from the schema into the AST.
56
+ * **dev:** `--reset-db` starts from an empty local database. It removes the Postgres data volume
57
+ and nothing else, after a prompt that names the volume. Without a TTY it is refused unless
58
+ `--yes` is passed as well. Nothing in `dev` removes data without it.
44
59
 
45
60
  * **generate:** a rich text column is typed as the document it holds on the way out and as
46
61
  `RichText | string` on the way in. The engine emits a trigger that normalises a plain string
@@ -50,6 +65,27 @@
50
65
 
51
66
  ### Bug Fixes
52
67
 
68
+ * **connection:** every command that runs the engine on the host finds the database the same way,
69
+ in seed's order: `--connection`, `database.external.url`, `connection` in the config,
70
+ `DATABASE_URL` in the environment, `DATABASE_URL` in the project's `.env`, then the project's own
71
+ database. `supatype adopt`, `introspect` and `migrate` on a docker project took the URL in
72
+ `.supatype/environment.json`, which describes the `db` container, and failed looking up the host
73
+ `db` (supatype#85). `doctor`, `pull` and `admin` read only the process environment, never `.env`.
74
+ The derived default for a docker project is now the published compose database rather than the
75
+ native layout (`postgres:postgres@127.0.0.1:5432/<name>`), which a docker stack does not have.
76
+ * **storage:** a bucket's `update` rule reaches the engine. Every key other than `read`, `create`
77
+ and `delete` was skipped without a word, so an overwrite rule the author wrote was never
78
+ enforced. Any other key in a bucket's `access` is now an error that names it.
79
+ * **push:** every push prints the engine's warnings, as `supatype diff` does, without repeating
80
+ the ones the diff before it showed. None did, so a push said nothing about a bucket operation it
81
+ had just made unreachable, and the warnings found after applying were shown nowhere.
82
+ * **dev:** a failed first schema push no longer wipes the local database. Every failure was
83
+ answered with `docker compose down -v`, which removes every volume in the stack, Postgres and
84
+ storage alike, so a push the engine refused on purpose (a table Supatype does not manage, a
85
+ destructive change) cost the developer their rows and uploaded files, and the second attempt
86
+ then succeeded against an empty database. Only a database that is not reachable yet is retried
87
+ now, and the retry only starts Postgres again. A refusal stops `dev` with the engine's message
88
+ and exits non-zero; for unmanaged tables it names `supatype adopt` as the remedy.
53
89
  * **generate:** the client augmentation follows the order the schema declares its models and
54
90
  columns in. It sorted alphabetically, which threw away an order the author chose and the AST
55
91
  preserved, and made it disagree with `types/database.ts` about the same table.
@@ -0,0 +1,40 @@
1
+ /** The `reason` the engine gives this refusal in its JSON output and its HTTP response. */
2
+ export declare const UNMANAGED_MODEL_TABLES = "unmanaged_model_tables";
3
+ /**
4
+ * The tables an unmanaged-tables refusal names, or null when the output is not that refusal.
5
+ *
6
+ * Read from the engine's JSON line first. The wording is only a fallback for an engine image that
7
+ * predates it, which is what a pinned version can still be.
8
+ */
9
+ export declare function unmanagedTables(output: string): string[] | null;
10
+ /** Everything a failed push printed: the engine's stdout carries the JSON refusal. */
11
+ export declare function engineOutputOf(err: unknown): string;
12
+ /** How to adopt, wherever the database is. */
13
+ export interface AdoptionSteps {
14
+ /** The stamp statements adoption would run, without running them. */
15
+ preview: () => Promise<string[]>;
16
+ /** Run them, returning how many objects were stamped. */
17
+ apply: () => Promise<number>;
18
+ }
19
+ export interface AdoptionPolicy {
20
+ /** `--yes`: the caller agreed to a push without being asked, which is not agreeing to adopt. */
21
+ yes: boolean;
22
+ /** The command that would retry the push, named in what this prints. */
23
+ retry: string;
24
+ }
25
+ export type AdoptionOutcome = "adopted" | "declined";
26
+ /** Say what the refusal means, and offer to adopt in a terminal. */
27
+ export declare function offerAdoption(tables: readonly string[], steps: AdoptionSteps, policy: AdoptionPolicy): Promise<AdoptionOutcome>;
28
+ /**
29
+ * Push, and when the engine refuses unmanaged tables, offer to adopt them and push once more.
30
+ *
31
+ * Any other failure, a declined offer, or a second refusal is thrown as it came, so the caller's
32
+ * exit code still says the push did not happen.
33
+ */
34
+ export declare function pushOfferingAdoption<T>(push: () => Promise<T>, steps: AdoptionSteps, policy: AdoptionPolicy): Promise<T>;
35
+ /** Adoption through a deploy target, for the push walkthrough on a direct or local target. */
36
+ export declare function targetAdoptionSteps(adopt: (yes: boolean) => Promise<{
37
+ stampStatements?: string[];
38
+ stamped?: number;
39
+ }>): AdoptionSteps;
40
+ //# sourceMappingURL=adopt-walkthrough.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adopt-walkthrough.d.ts","sourceRoot":"","sources":["../src/adopt-walkthrough.ts"],"names":[],"mappings":"AAkBA,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,2BAA2B,CAAA;AAK9D;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAe/D;AAED,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAGnD;AAED,8CAA8C;AAC9C,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAChC,yDAAyD;IACzD,KAAK,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,gGAAgG;IAChG,GAAG,EAAE,OAAO,CAAA;IACZ,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,UAAU,CAAA;AAEpD,oEAAoE;AACpE,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,eAAe,CAAC,CAiB1B;AAoBD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACtB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,CAAC,CAAC,CASZ;AAED,8FAA8F;AAC9F,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC;IAAE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACjF,aAAa,CAKf"}