@supatype/cli 0.3.2 → 0.3.3

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 (83) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +163 -161
  3. package/.turbo/turbo-typecheck.log +1 -1
  4. package/CHANGELOG.md +77 -0
  5. package/dist/augmentation-generator.d.ts.map +1 -1
  6. package/dist/augmentation-generator.js +70 -15
  7. package/dist/augmentation-generator.js.map +1 -1
  8. package/dist/cli-version-embedded.js +1 -1
  9. package/dist/commands/generate.d.ts.map +1 -1
  10. package/dist/commands/generate.js +3 -3
  11. package/dist/commands/generate.js.map +1 -1
  12. package/dist/commands/init.d.ts.map +1 -1
  13. package/dist/commands/init.js +29 -19
  14. package/dist/commands/init.js.map +1 -1
  15. package/dist/commands/seed.d.ts +27 -1
  16. package/dist/commands/seed.d.ts.map +1 -1
  17. package/dist/commands/seed.js +206 -33
  18. package/dist/commands/seed.js.map +1 -1
  19. package/dist/engine-client.d.ts +1 -0
  20. package/dist/engine-client.d.ts.map +1 -1
  21. package/dist/engine-client.js +47 -2
  22. package/dist/engine-client.js.map +1 -1
  23. package/dist/engine-floor.d.ts +27 -4
  24. package/dist/engine-floor.d.ts.map +1 -1
  25. package/dist/engine-floor.js +90 -9
  26. package/dist/engine-floor.js.map +1 -1
  27. package/dist/gitignore.d.ts.map +1 -1
  28. package/dist/gitignore.js +7 -0
  29. package/dist/gitignore.js.map +1 -1
  30. package/dist/hooks-generator.d.ts.map +1 -1
  31. package/dist/hooks-generator.js +18 -3
  32. package/dist/hooks-generator.js.map +1 -1
  33. package/dist/seed-connection.d.ts +60 -0
  34. package/dist/seed-connection.d.ts.map +1 -0
  35. package/dist/seed-connection.js +90 -0
  36. package/dist/seed-connection.js.map +1 -0
  37. package/dist/seed-ir.d.ts +66 -0
  38. package/dist/seed-ir.d.ts.map +1 -0
  39. package/dist/seed-ir.js +265 -0
  40. package/dist/seed-ir.js.map +1 -0
  41. package/dist/seed-runner.d.ts +44 -0
  42. package/dist/seed-runner.d.ts.map +1 -0
  43. package/dist/seed-runner.js +83 -0
  44. package/dist/seed-runner.js.map +1 -0
  45. package/dist/seed.d.ts +345 -0
  46. package/dist/seed.d.ts.map +1 -1
  47. package/dist/seed.js +138 -0
  48. package/dist/seed.js.map +1 -1
  49. package/dist/self-host-compose.d.ts.map +1 -1
  50. package/dist/self-host-compose.js +14 -8
  51. package/dist/self-host-compose.js.map +1 -1
  52. package/dist/type-extractor.d.ts.map +1 -1
  53. package/dist/type-extractor.js +73 -0
  54. package/dist/type-extractor.js.map +1 -1
  55. package/dist/type-generation.d.ts +29 -0
  56. package/dist/type-generation.d.ts.map +1 -1
  57. package/dist/type-generation.js +52 -0
  58. package/dist/type-generation.js.map +1 -1
  59. package/package.json +2 -2
  60. package/src/augmentation-generator.ts +73 -14
  61. package/src/cli-version-embedded.ts +1 -1
  62. package/src/commands/generate.ts +7 -3
  63. package/src/commands/init.ts +31 -21
  64. package/src/commands/seed.ts +294 -44
  65. package/src/engine-client.ts +52 -3
  66. package/src/engine-floor.ts +100 -9
  67. package/src/gitignore.ts +7 -0
  68. package/src/hooks-generator.ts +21 -6
  69. package/src/seed-connection.ts +146 -0
  70. package/src/seed-ir.ts +311 -0
  71. package/src/seed-runner.ts +109 -0
  72. package/src/seed.ts +408 -0
  73. package/src/self-host-compose.ts +14 -8
  74. package/src/type-extractor.ts +101 -0
  75. package/src/type-generation.ts +64 -0
  76. package/tests/access-composition.test.ts +123 -0
  77. package/tests/augmentation-generator.test.ts +149 -9
  78. package/tests/engine-floor.test.ts +93 -0
  79. package/tests/fixtures/seed_golden_ir.json +186 -0
  80. package/tests/runtime-contract.test.ts +31 -6
  81. package/tests/seed-connection.test.ts +158 -0
  82. package/tests/seed-ir.test.ts +436 -0
  83. package/tsconfig.tsbuildinfo +1 -1
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/cli@0.3.2 build /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.3.3 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,14 +1,13 @@
1
1
 
2
- > @supatype/cli@0.3.2 test /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.3.3 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/access-composition.test.ts (26 tests) 265ms
9
- ✓ tests/type-extractor.test.ts (49 tests) 459ms
10
- ✓ tests/model-hooks.test.ts (23 tests) 178ms
11
- ✓ tests/runtime-contract.test.ts (62 tests) 309ms
8
+ ✓ tests/type-extractor.test.ts (49 tests) 408ms
9
+ ✓ tests/access-composition.test.ts (32 tests) 261ms
10
+ ✓ tests/model-hooks.test.ts (23 tests) 118ms
12
11
  stdout | tests/init.test.ts > scaffold() > creates all expected files
13
12
   created package.json
14
13
  created supatype.config.ts
@@ -323,22 +322,34 @@
323
322
  created public/.gitkeep
324
323
  created .gitignore
325
324
 
326
- ✓ tests/init.test.ts (28 tests) 173ms
327
- ✓ tests/external-database-compose.test.ts (23 tests) 16ms
328
- ✓ tests/augmentation-generator.test.ts (16 tests) 30ms
329
- ✓ tests/model-constraints.test.ts (18 tests) 243ms
330
- ✓ tests/model-versions.test.ts (19 tests) 106ms
331
- ✓ tests/api-config-cache-seed.test.ts (15 tests) 42ms
332
- ✓ tests/model-cache-declaration.test.ts (18 tests) 115ms
333
- ✓ tests/field-masking-tier.test.ts (16 tests) 39ms
334
-
335
- ✓ tests/dev-ui.test.ts (21 tests) 130ms
325
+ ✓ tests/init.test.ts (28 tests) 115ms
326
+ ✓ tests/augmentation-generator.test.ts (24 tests) 40ms
327
+ ✓ tests/runtime-contract.test.ts (64 tests) 177ms
328
+ ✓ tests/seed-ir.test.ts (15 tests) 34ms
329
+ ✓ tests/engine-floor.test.ts (28 tests) 36ms
330
+ ✓ tests/external-database-compose.test.ts (23 tests) 24ms
331
+ ✓ tests/model-constraints.test.ts (18 tests) 225ms
332
+ ✓ tests/model-versions.test.ts (19 tests) 78ms
333
+ ✓ tests/api-config-cache-seed.test.ts (15 tests) 34ms
334
+ ✓ tests/model-cache-declaration.test.ts (18 tests) 92ms
335
+ ✓ tests/field-masking-tier.test.ts (16 tests) 21ms
336
+ ✓ tests/hooks-generator.test.ts (7 tests) 9843ms
337
+ ✓ typechecks under strict mode, together with a handler that uses it  4001ms
338
+ ✓ rejects a handler for a table that declares no hook  3169ms
339
+ ✓ typechecks with a validator written the way the docs will show it  2605ms
340
+
341
+ ✓ tests/dev-ui.test.ts (21 tests) 125ms
336
342
 
337
343
  [supatype] Shutting down…
338
- ✓ tests/hooks-generator.test.ts (7 tests) 10509ms
339
- ✓ typechecks under strict mode, together with a handler that uses it  3729ms
340
- ✓ rejects a handler for a table that declares no hook  3791ms
341
- ✓ typechecks with a validator written the way the docs will show it  2921ms
344
+ ✓ tests/config.test.ts (19 tests) 9687ms
345
+ ✓ loads a valid supatype.config.ts (plain export default, no package imports)  1202ms
346
+ ✓ normalizes shorthand schema string to { path, pg_schema }  1007ms
347
+ ✓ loads a supatype.config.js (plain ESM)  1367ms
348
+ ✓ loads config without a versions section (latest by default)  1236ms
349
+ ✓ prefers supatype.config.ts over supatype.config.js when both exist  1081ms
350
+ ✓ supports optional output field in config  784ms
351
+ ✓ merges supatype.local.config.ts over base  1833ms
352
+ ✓ loads defineConfig import before @supatype/cli is installed (init scaffold)  1148ms
342
353
  stdout | tests/docker-runtime.test.ts > requireDockerDaemon > exits when the daemon is unavailable
343
354
  
344
355
  Start the Docker daemon (e.g. sudo systemctl start docker), then try again.
@@ -347,54 +358,45 @@
347
358
 
348
359
  docker: daemon down
349
360
 
350
- ✓ tests/docker-runtime.test.ts (10 tests) 16ms
351
- ✓ tests/config.test.ts (19 tests) 10463ms
352
- ✓ loads a valid supatype.config.ts (plain export default, no package imports)  1328ms
353
- ✓ normalizes shorthand schema string to { path, pg_schema }  1353ms
354
- ✓ loads a supatype.config.js (plain ESM)  1161ms
355
- ✓ loads config without a versions section (latest by default)  1543ms
356
- ✓ prefers supatype.config.ts over supatype.config.js when both exist  1011ms
357
- ✓ supports optional output field in config  1040ms
358
- ✓ merges supatype.local.config.ts over base  1764ms
359
- ✓ loads defineConfig import before @supatype/cli is installed (init scaffold)  1229ms
360
- ✓ tests/db-preflight.test.ts (14 tests) 10ms
361
- ✓ tests/keys-write.test.ts (11 tests) 21ms
362
- ✓ tests/field-bounds.test.ts (23 tests) 12ms
363
- ✓ tests/cache-clean.test.ts (8 tests) 2210ms
364
- ✓ keeps pinned versions and removes the rest  671ms
365
- ✓ --force removes pinned versions  762ms
366
- ✓ explicit version removes even when pinned (with warning)  741ms
367
- ✓ tests/cache-provider-config.test.ts (12 tests) 8ms
368
- ✓ tests/functions-deno-types.test.ts (7 tests) 3188ms
369
- ✓ tsc fails with Cannot find name Deno without ambient types  2269ms
370
- ✓ tsc passes for Deno.env after ensureFunctionsDenoTypes  899ms
371
- ✓ tests/field-bounds-matrix.test.ts (124 tests) 33ms
372
- ✓ tests/engine-floor.test.ts (17 tests) 14ms
373
- ✓ tests/external-database-config.test.ts (14 tests) 12ms
374
- ✓ tests/compose-services.test.ts (12 tests) 13ms
375
- ✓ tests/field-validators.test.ts (10 tests) 81ms
376
- ✓ tests/native-keyspace.test.ts (10 tests) 39ms
377
- ✓ tests/db-port.test.ts (14 tests) 19ms
378
- ✓ tests/command-chrome-coverage.test.ts (1 test) 18ms
379
- ✓ tests/hook-upload.test.ts (8 tests) 12ms
380
- ✓ tests/env-file.test.ts (9 tests) 20ms
361
+ ✓ tests/docker-runtime.test.ts (10 tests) 17ms
362
+ ✓ tests/db-preflight.test.ts (14 tests) 11ms
363
+ ✓ tests/keys-write.test.ts (11 tests) 23ms
364
+ ✓ tests/field-bounds.test.ts (23 tests) 17ms
365
+ ✓ tests/cache-clean.test.ts (8 tests) 2011ms
366
+ ✓ keeps pinned versions and removes the rest  634ms
367
+ ✓ --force removes pinned versions  708ms
368
+ ✓ explicit version removes even when pinned (with warning)  651ms
369
+ ✓ tests/cache-provider-config.test.ts (12 tests) 14ms
370
+ ✓ tests/functions-deno-types.test.ts (7 tests) 2963ms
371
+ ✓ tsc fails with Cannot find name Deno without ambient types  2060ms
372
+ ✓ tsc passes for Deno.env after ensureFunctionsDenoTypes  883ms
373
+ ✓ tests/seed-connection.test.ts (13 tests) 15ms
374
+ ✓ tests/field-bounds-matrix.test.ts (124 tests) 24ms
375
+ ✓ tests/external-database-config.test.ts (14 tests) 10ms
376
+ ✓ tests/compose-services.test.ts (12 tests) 11ms
377
+ ✓ tests/field-validators.test.ts (10 tests) 70ms
378
+ ✓ tests/native-keyspace.test.ts (10 tests) 27ms
379
+ ✓ tests/db-port.test.ts (14 tests) 17ms
380
+ ✓ tests/command-chrome-coverage.test.ts (1 test) 19ms
381
+ ✓ tests/hook-upload.test.ts (8 tests) 10ms
382
+ ✓ tests/env-file.test.ts (9 tests) 21ms
381
383
  stdout | tests/link.test.ts > link model > migrates cloud.json into link.json
382
384
   created package.json
383
385
  created supatype.config.ts
384
386
  created schema/index.ts
385
387
  created .env
386
388
  created seed.ts
389
+ stderr | tests/link.test.ts > link model > migrates cloud.json into link.json
387
390
  created seeds/.gitkeep
388
391
  created public/.gitkeep
389
392
  created .gitignore
390
393
 
391
- stderr | tests/link.test.ts > link model > migrates cloud.json into link.json
392
394
  [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
393
395
 
394
- ✓ tests/link.test.ts (4 tests) 3203ms
395
- ✓ resolveTarget returns cloud mode with /api/v1 prefix  1058ms
396
- ✓ resolveTarget returns self-host mode with /platform/v1 prefix  1015ms
397
- ✓ targetSchemaRollback posts to /platform/v1 when linked  1117ms
396
+ ✓ tests/link.test.ts (4 tests) 3123ms
397
+ ✓ resolveTarget returns cloud mode with /api/v1 prefix  1060ms
398
+ ✓ resolveTarget returns self-host mode with /platform/v1 prefix  1041ms
399
+ ✓ targetSchemaRollback posts to /platform/v1 when linked  1011ms
398
400
  stdout | tests/admin-ensure.test.ts > init admin seed in .env > writes SUPATYPE_ADMIN_* when scaffold options include credentials
399
401
   created package.json
400
402
  created supatype.config.ts
@@ -405,8 +407,8 @@
405
407
  created public/.gitkeep
406
408
  created .gitignore
407
409
 
408
- ✓ tests/admin-ensure.test.ts (10 tests) 164ms
409
- ✓ tests/service-role-check.test.ts (10 tests) 14ms
410
+ ✓ tests/admin-ensure.test.ts (10 tests) 182ms
411
+ ✓ tests/service-role-check.test.ts (10 tests) 15ms
410
412
  stdout | tests/admin-studio-membership.test.ts > first admin user creation > does not write a role into app_metadata
411
413
  [supatype] Admin user "admin@example.com" created (role: admin).
412
414
  [supatype] Log in at /admin after starting the dev server.
@@ -423,55 +425,55 @@
423
425
  [supatype] Admin user "admin@example.com" created (role: admin).
424
426
  [supatype] Log in at /admin after starting the dev server.
425
427
 
426
- ✓ tests/admin-studio-membership.test.ts (5 tests) 492ms
427
- ✓ tests/pull-utils.test.ts (49 tests) 10ms
428
- ✓ tests/schema-sources.test.ts (5 tests) 1316ms
429
- ✓ buildSchemaSourcesPayload includes manifest metadata  542ms
430
- ✓ restore overwrites modified local files  729ms
431
- ✓ tests/preview-config-check.test.ts (9 tests) 9ms
432
- ✓ tests/keys.test.ts (11 tests) 18907ms
433
- ✓ exits 0 with --secret  1728ms
434
- ✓ outputs ANON_KEY= line  1574ms
435
- ✓ outputs SERVICE_ROLE_KEY= line  1444ms
436
- ✓ ANON_KEY is a valid three-part JWT  1606ms
437
- ✓ SERVICE_ROLE_KEY payload has role: service_role  1463ms
438
- ✓ JWT has exp in the future  1582ms
439
- ✓ --exp-years changes the expiry window  3261ms
440
- ✓ reads JWT_SECRET from environment variable  1569ms
441
- ✓ reads JWT_SECRET from .env file  1606ms
442
- ✓ exits non-zero when no secret is available  1575ms
443
- ✓ keys --help shows --secret and --exp-years options  1493ms
428
+ ✓ tests/admin-studio-membership.test.ts (5 tests) 440ms
429
+ ✓ tests/pull-utils.test.ts (49 tests) 14ms
430
+ ✓ tests/schema-sources.test.ts (5 tests) 1223ms
431
+ ✓ buildSchemaSourcesPayload includes manifest metadata  594ms
432
+ ✓ restore overwrites modified local files  586ms
433
+ ✓ tests/preview-config-check.test.ts (9 tests) 6ms
434
+ ✓ tests/keys.test.ts (11 tests) 17760ms
435
+ ✓ exits 0 with --secret  1627ms
436
+ ✓ outputs ANON_KEY= line  1464ms
437
+ ✓ outputs SERVICE_ROLE_KEY= line  1362ms
438
+ ✓ ANON_KEY is a valid three-part JWT  1546ms
439
+ ✓ SERVICE_ROLE_KEY payload has role: service_role  1374ms
440
+ ✓ JWT has exp in the future  1603ms
441
+ ✓ --exp-years changes the expiry window  2946ms
442
+ ✓ reads JWT_SECRET from environment variable  1496ms
443
+ ✓ reads JWT_SECRET from .env file  1518ms
444
+ ✓ exits non-zero when no secret is available  1378ms
445
+ ✓ keys --help shows --secret and --exp-years options  1438ms
444
446
  stderr | tests/binary-cache-cloud-overrides.test.ts > isLinkedToCloudProject > is true when .supatype/cloud.json has projectSlug
445
447
  [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
446
448
 
447
- ✓ tests/binary-cache-cloud-overrides.test.ts (11 tests) 24ms
448
- ✓ tests/homebrew-formula.test.ts (4 tests) 271ms
449
- ✓ tests/local-server-image-env.test.ts (5 tests) 20ms
450
- ✓ tests/minisign.test.ts (5 tests) 12ms
451
- ✓ tests/model-cache-manifest.test.ts (12 tests) 10ms
452
- ✓ tests/local-secrets.test.ts (5 tests) 8ms
453
- ✓ tests/client-generator.test.ts (9 tests) 18ms
454
- ✓ tests/functions-concurrency.test.ts (6 tests) 6ms
455
- ✓ tests/readiness-poll.test.ts (3 tests) 329ms
456
- ✓ ends promptly when it carries a deadline  322ms
457
- ✓ tests/ast-derived-outputs.test.ts (5 tests) 27ms
458
- ✓ tests/self-host-keys.test.ts (7 tests) 16ms
459
- ✓ tests/functions-context-refresh.test.ts (4 tests) 11ms
460
- ✓ tests/api-schemas.test.ts (10 tests) 10ms
461
- ✓ tests/gitignore-secrets.test.ts (5 tests) 95ms
449
+ ✓ tests/binary-cache-cloud-overrides.test.ts (11 tests) 22ms
450
+ ✓ tests/local-server-image-env.test.ts (5 tests) 19ms
451
+ ✓ tests/homebrew-formula.test.ts (4 tests) 214ms
452
+ ✓ tests/model-cache-manifest.test.ts (12 tests) 9ms
453
+ ✓ tests/minisign.test.ts (5 tests) 17ms
454
+ ✓ tests/client-generator.test.ts (9 tests) 11ms
455
+ ✓ tests/local-secrets.test.ts (5 tests) 11ms
456
+ ✓ tests/functions-concurrency.test.ts (6 tests) 5ms
457
+ ✓ tests/readiness-poll.test.ts (3 tests) 331ms
458
+ ✓ ends promptly when it carries a deadline  327ms
459
+ ✓ tests/ast-derived-outputs.test.ts (5 tests) 15ms
460
+ ✓ tests/self-host-keys.test.ts (7 tests) 15ms
461
+ ✓ tests/functions-context-refresh.test.ts (4 tests) 10ms
462
+ ✓ tests/api-schemas.test.ts (10 tests) 13ms
463
+ ✓ tests/gitignore-secrets.test.ts (5 tests) 93ms
462
464
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
463
465
  [supatype] Storage bucket "photos" ready.
464
466
 
465
467
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
466
468
  [supatype] Storage bucket "avatars" ready.
467
469
 
468
- ✓ tests/storage-provision.test.ts (6 tests) 10ms
469
- ✓ tests/strict.test.ts (7 tests) 11ms
470
- ✓ tests/cached-artifact-format.test.ts (7 tests) 14ms
470
+ ✓ tests/storage-provision.test.ts (6 tests) 12ms
471
+ ✓ tests/strict.test.ts (7 tests) 7ms
472
+ ✓ tests/cached-artifact-format.test.ts (7 tests) 10ms
471
473
  ✓ tests/cache-identity-scope.test.ts (33 tests) 12ms
472
- ✓ tests/target-client-refresh.test.ts (3 tests) 11ms
473
- ✓ tests/studio-admin-roles.test.ts (6 tests) 9ms
474
- ✓ tests/proxy-dev-app.test.ts (7 tests) 6ms
474
+ ✓ tests/target-client-refresh.test.ts (3 tests) 15ms
475
+ ✓ tests/studio-admin-roles.test.ts (6 tests) 6ms
476
+ ✓ tests/proxy-dev-app.test.ts (7 tests) 7ms
475
477
  stdout | tests/app-command.test.ts > supatype app add --static > sets app.mode=static and static_dir in supatype.config.ts
476
478
   created package.json
477
479
  created supatype.config.ts
@@ -492,79 +494,79 @@
492
494
  created public/.gitkeep
493
495
  created .gitignore
494
496
 
495
- ✓ tests/service-role-routes.test.ts (4 tests) 1872ms
496
- ✓ reads the declared list  582ms
497
- ✓ is an empty list when a project declares none  646ms
498
- ✓ sends what the project declared, hook entries included  640ms
499
- ✓ tests/compose-parsable-defaults.test.ts (2 tests) 8ms
500
- ✓ tests/app-command.test.ts (2 tests) 3419ms
501
- ✓ sets app.mode=static and static_dir in supatype.config.ts  1745ms
502
- ✓ creates the static directory when missing  1672ms
503
- ✓ tests/rest-cache-admin.test.ts (3 tests) 55ms
504
- ✓ tests/init-dependency-versions.test.ts (4 tests) 42ms
505
- ✓ tests/cli-help.test.ts (16 tests) 24704ms
506
- ✓ --help lists all top-level commands  1544ms
507
- ✓ --version prints package.json version  1558ms
508
- ✓ self-update --help describes the command  1544ms
509
- ✓ init --help describes the init command  1554ms
510
- ✓ push --help describes the push command and --yes flag  1589ms
511
- ✓ diff --help describes the diff command  1493ms
512
- ✓ pull --help describes scaffold pull command  1574ms
513
- ✓ doctor --help describes drift report command  1472ms
514
- ✓ introspect --help describes database introspection command  1583ms
515
- ✓ adopt --help describes adoption ceremony command  1508ms
516
- ✓ reset --help shows --yes flag  1474ms
517
- ✓ app --help describes the app command with add/remove subcommands  1443ms
518
- ✓ app add --help shows --static and --port options  1675ms
519
- ✓ self-host --help shows compose only (legacy commands hidden)  1568ms
520
- ✓ self-host compose --help shows compose subcommands  1558ms
521
- ✓ unknown command exits non-zero  1561ms
522
- ✓ tests/engine-push-output.test.ts (7 tests) 13ms
523
- ✓ tests/type-resolver.test.ts (2 tests) 21ms
524
- ✓ tests/command-chrome-wrap.test.ts (3 tests) 7ms
525
- ✓ tests/doctor-render.test.ts (3 tests) 6ms
497
+ ✓ tests/service-role-routes.test.ts (4 tests) 1771ms
498
+ ✓ reads the declared list  592ms
499
+ ✓ is an empty list when a project declares none  610ms
500
+ ✓ sends what the project declared, hook entries included  565ms
501
+ ✓ tests/cli-help.test.ts (16 tests) 23059ms
502
+ ✓ --help lists all top-level commands  1506ms
503
+ ✓ --version prints package.json version  1416ms
504
+ ✓ self-update --help describes the command  1380ms
505
+ ✓ init --help describes the init command  1381ms
506
+ ✓ push --help describes the push command and --yes flag  1515ms
507
+ ✓ diff --help describes the diff command  1450ms
508
+ ✓ pull --help describes scaffold pull command  1361ms
509
+ ✓ doctor --help describes drift report command  1414ms
510
+ ✓ introspect --help describes database introspection command  1491ms
511
+ ✓ adopt --help describes adoption ceremony command  1400ms
512
+ ✓ reset --help shows --yes flag  1420ms
513
+ ✓ app --help describes the app command with add/remove subcommands  1412ms
514
+ ✓ app add --help shows --static and --port options  1438ms
515
+ ✓ self-host --help shows compose only (legacy commands hidden)  1571ms
516
+ ✓ self-host compose --help shows compose subcommands  1453ms
517
+ ✓ unknown command exits non-zero  1444ms
518
+ ✓ tests/compose-parsable-defaults.test.ts (2 tests) 7ms
519
+ ✓ tests/app-command.test.ts (2 tests) 3088ms
520
+ ✓ sets app.mode=static and static_dir in supatype.config.ts  1595ms
521
+ ✓ creates the static directory when missing  1491ms
522
+ ✓ tests/rest-cache-admin.test.ts (3 tests) 52ms
523
+ ✓ tests/init-dependency-versions.test.ts (4 tests) 41ms
524
+ ✓ tests/engine-push-output.test.ts (7 tests) 7ms
525
+ ✓ tests/type-resolver.test.ts (2 tests) 17ms
526
+ ✓ tests/command-chrome-wrap.test.ts (3 tests) 8ms
526
527
  ✓ tests/cli-install-method.test.ts (8 tests) 8ms
527
- ✓ tests/port-in-use.test.ts (4 tests) 24ms
528
- ✓ tests/archive-name-alias.test.ts (4 tests) 7ms
529
- ✓ tests/init-project-detect.test.ts (4 tests) 12ms
530
- ✓ tests/ensure-binary.test.ts (2 tests) 15ms
531
- ✓ tests/tsx-runner.test.ts (7 tests) 3274ms
532
- ✓ evaluates a simple expression and returns stdout  466ms
533
- ✓ evaluates TypeScript syntax (type annotations)  442ms
534
- ✓ can serialize a JSON object to stdout  456ms
535
- ✓ returns non-zero exit code on syntax error  419ms
536
- ✓ returns non-zero exit code on runtime error  526ms
537
- ✓ captures stderr separately from stdout  392ms
538
- ✓ runs a .ts file and returns its stdout  568ms
539
- ✓ tests/doctor-service-role.test.ts (4 tests) 7ms
540
- ✓ tests/required-host-components.test.ts (4 tests) 7ms
528
+ ✓ tests/port-in-use.test.ts (4 tests) 26ms
529
+ ✓ tests/doctor-render.test.ts (3 tests) 8ms
530
+ ✓ tests/archive-name-alias.test.ts (4 tests) 5ms
531
+ ✓ tests/ensure-binary.test.ts (2 tests) 11ms
532
+ ✓ tests/init-project-detect.test.ts (4 tests) 8ms
533
+ ✓ tests/tsx-runner.test.ts (7 tests) 3066ms
534
+ ✓ evaluates a simple expression and returns stdout  381ms
535
+ ✓ evaluates TypeScript syntax (type annotations)  436ms
536
+ ✓ can serialize a JSON object to stdout  429ms
537
+ ✓ returns non-zero exit code on syntax error  407ms
538
+ ✓ returns non-zero exit code on runtime error  427ms
539
+ ✓ captures stderr separately from stdout  388ms
540
+ ✓ runs a .ts file and returns its stdout  591ms
541
+ ✓ tests/doctor-service-role.test.ts (4 tests) 8ms
542
+ ✓ tests/required-host-components.test.ts (4 tests) 6ms
541
543
  ✓ tests/ui-messages.test.ts (5 tests) 7ms
542
- ✓ tests/dev-ports-owner.test.ts (6 tests) 6ms
543
- ✓ tests/normalize-admin-config.test.ts (1 test) 9ms
544
- ✓ tests/ui-confirm.test.ts (3 tests) 8ms
544
+ ✓ tests/normalize-admin-config.test.ts (1 test) 6ms
545
+ ✓ tests/dev-ports-owner.test.ts (6 tests) 5ms
546
+ ✓ tests/ui-confirm.test.ts (3 tests) 9ms
545
547
  ✓ tests/docker-postgres.test.ts (5 tests) 5ms
546
- ✓ tests/binary-download-lock.test.ts (2 tests) 9ms
547
- ✓ tests/dev-session-lock.test.ts (2 tests) 6ms
548
- ✓ tests/config-load-failure.test.ts (2 tests) 3861ms
549
- ✓ is reported, rather than treated as absent  2316ms
550
- ✓ does not stop the CLI working with no config at all  1542ms
551
- ✓ tests/dev-ports.test.ts (3 tests) 7ms
552
- ✓ tests/route-manifest.test.ts (1 test) 9ms
553
- ✓ tests/realtime-launch.test.ts (1 test) 6ms
548
+ ✓ tests/binary-download-lock.test.ts (2 tests) 13ms
549
+ ✓ tests/dev-session-lock.test.ts (2 tests) 5ms
550
+ ✓ tests/config-load-failure.test.ts (2 tests) 3614ms
551
+ ✓ is reported, rather than treated as absent  2066ms
552
+ ✓ does not stop the CLI working with no config at all  1545ms
553
+ ✓ tests/route-manifest.test.ts (1 test) 6ms
554
+ ✓ tests/dev-ports.test.ts (3 tests) 6ms
555
+ ✓ tests/realtime-launch.test.ts (1 test) 4ms
554
556
  ✓ tests/release-pins.test.ts (2 tests) 6ms
555
557
  ✓ tests/dev-ready-panel.test.ts (2 tests) 4ms
556
558
  ✓ tests/ensure-dev-api-config.test.ts (1 test) 4ms
557
- ✓ tests/seed-discover.test.ts (2 tests) 24ms
559
+ ✓ tests/seed-discover.test.ts (2 tests) 19ms
558
560
  ✓ tests/init-package-json.test.ts (1 test) 4ms
559
- ✓ tests/pg-spawn-env.test.ts (2 tests) 4ms
560
- ✓ tests/resolve-api-url.test.ts (2 tests) 6ms
561
+ ✓ tests/pg-spawn-env.test.ts (2 tests) 7ms
562
+ ✓ tests/resolve-api-url.test.ts (2 tests) 4ms
563
+ ✓ tests/migrate-from-v1.test.ts (1 test) 11ms
561
564
  ✓ tests/cli-package-version.test.ts (1 test) 4ms
562
- ✓ tests/migrate-from-v1.test.ts (1 test) 12ms
563
- ✓ tests/postgres-archive-tag.test.ts (1 test) 3ms
565
+ ✓ tests/postgres-archive-tag.test.ts (1 test) 2ms
564
566
  ✓ tests/stdin-after-ink.test.ts (1 test) 3ms
565
567
 
566
-  Test Files  101 passed (101)
567
-  Tests  1057 passed (1057)
568
-  Start at  06:44:27
569
-  Duration  58.81s (transform 9.89s, setup 0ms, import 62.00s, tests 91.35s, environment 20ms)
568
+  Test Files  103 passed (103)
569
+  Tests  1112 passed (1112)
570
+  Start at  16:22:17
571
+  Duration  55.20s (transform 7.96s, setup 0ms, import 58.00s, tests 85.16s, environment 24ms)
570
572
 
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/cli@0.3.2 typecheck /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.3.3 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 ADDED
@@ -0,0 +1,77 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ### Features
6
+
7
+ * **seed:** a seed file now exports a default function and describes writes rather than
8
+ performing them. The calls are collected into a document that the engine validates against
9
+ the schema, orders by foreign key, batches, and applies in one transaction. There is no
10
+ connection to open, no SQL, no ordering to work out by hand, and a failure part way through
11
+ leaves nothing behind. See `references/seeding.md`.
12
+ * **seed:** `db` is typed from the project's schema by a generated builder. A reference to the
13
+ wrong model, a `where` on a column that does not identify a row, a time expression on a text
14
+ column, or a currency amount as a float are all compile errors.
15
+ * **seed:** `upsert`, `createMany`, nested `create` on the inverse side of a relation, and
16
+ `connect` by any unique key.
17
+ * **seed:** `$if` runs a block only when the database says so, evaluated by the engine at that
18
+ position inside the transaction. `$sql` puts a raw statement in the same transaction and the
19
+ same order as everything else.
20
+ * **seed:** `expr.now`, `expr.startOf`, `expr.ago` and `expr.default` are evaluated by Postgres
21
+ at seed time, so a fixture calendar stays ahead of whenever it is run.
22
+ * **seed:** `--status` reports what has been applied to an environment, including whether a file
23
+ has changed since it ran. `--atomic` runs every file in one transaction. `--connection` and
24
+ `--environment` were added alongside.
25
+ * **seed:** every run is recorded in `_supatype.seeds`, inside the same transaction as the writes
26
+ it describes, so the record can never claim a seed applied when it rolled back. A file may opt
27
+ into `runOnce` for a genuine one-time backfill.
28
+ * **seed:** failures arrive in the schema's terms. `Organiser.slug is already taken`, with the
29
+ file and the position in the document, rather than a Postgres constraint name.
30
+ * **seed:** exit codes distinguish a seed that failed (1) from an environment that is not set up
31
+ (2), so CI can tell which one to retry.
32
+ * **seed:** the connection string is resolved from the flag, the config, the environment and the
33
+ project's `.env` in that order, and when none of them has one the error names every source it
34
+ tried. Connection strings are redacted wherever they are printed.
35
+ * **generate:** writes the seed builder beside the generated client. It needs no database and no
36
+ running stack, which is what makes it safe to gitignore.
37
+ * **init:** the scaffolded seed uses the new contract and carries no connection string. The
38
+ scaffolded `package.json` runs `supatype seed` and gains a `prepare` script so a fresh clone
39
+ has a builder before anything imports it.
40
+ * **dev:** the database is always published to the host on `127.0.0.1`. Seeding is a host
41
+ process, so the previous rule left a fresh project with a database nothing on the host could
42
+ reach and a remedy nobody had reason to know about.
43
+ * **schema:** `After<>` and `Before<>` are parsed from the schema into the AST.
44
+
45
+ * **generate:** a rich text column is typed as the document it holds on the way out and as
46
+ `RichText | string` on the way in. The engine emits a trigger that normalises a plain string
47
+ into a Lexical document on insert and update, so prose can be written as prose while a read
48
+ always returns the document. The seed builder gets the same split, and a tightening with it:
49
+ the column was typed as any JSON at all, so a seed could write a bare number into one.
50
+
51
+ ### Bug Fixes
52
+
53
+ * **generate:** the client augmentation follows the order the schema declares its models and
54
+ columns in. It sorted alphabetically, which threw away an order the author chose and the AST
55
+ preserved, and made it disagree with `types/database.ts` about the same table.
56
+ * **generate:** a `Slug` column is no longer demanded on insert. A trigger fills it, so the
57
+ generated type was asking for a value the database was about to overwrite.
58
+ * **generate:** a rich text column is typed as the Lexical document it holds. It was
59
+ `SerializedEditorState | string`, which made the augmentation disagree with
60
+ `types/database.ts` about the same column in the same project.
61
+ * **generate:** the augmentation's columns are indented into the block that holds them.
62
+ * **generate:** the augmentation and the database types use the same named types for storage
63
+ references and rich text, rather than one naming them and the other writing them out.
64
+ * **hooks:** the generated Deno stand-in for rich text loses its `| string` for the same reason,
65
+ and a storage reference is declared beside it.
66
+ * **generate:** the generated output paths are resolved in one place. `generate` applied defaults
67
+ and the seed runner did not, so a project that had configured no output got a builder written
68
+ and then a run that reported it missing.
69
+ * **engine:** a failed seed is reported with its result document. The engine exits non-zero and
70
+ prints what happened, and that was being discarded as a crash with no output.
71
+ * **seed:** a project pinned to an engine with no `seed` subcommand is told so, by name, before
72
+ anything is resolved or downloaded. It got a usage error about an unrecognised argument, which
73
+ names nothing about the project and reads like a broken install.
74
+ * **push:** a schema with a rich text column is refused on an engine that cannot normalise one.
75
+ The generated types accept a string on the way in and promise a document on the way out, and
76
+ the trigger is what makes the second half true; an older engine emits no trigger and rejects
77
+ nothing, so the push succeeded and a later read returned what the types call impossible.
@@ -1 +1 @@
1
- {"version":3,"file":"augmentation-generator.d.ts","sourceRoot":"","sources":["../src/augmentation-generator.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAC/C,WAAW,CAAC,EAAE;QACZ,EAAE,CAAC,EAAE;YAAE,SAAS,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAA;SAAE,CAAA;KACjD,CAAA;CACF;AAMD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAQxD;AAUD,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CA2B/D;AAkDD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAKvF;AAMD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAU1F;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAK1F"}
1
+ {"version":3,"file":"augmentation-generator.d.ts","sourceRoot":"","sources":["../src/augmentation-generator.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAC/C,WAAW,CAAC,EAAE;QACZ,EAAE,CAAC,EAAE;YAAE,SAAS,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAA;SAAE,CAAA;KACjD,CAAA;CACF;AAMD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAQxD;AAUD,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAkD/D;AA0DD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAKvF;AA4BD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAU1F;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAO1F"}