@supatype/cli 0.3.2 → 0.3.4

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 (89) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +153 -150
  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/dev-compose.d.ts.map +1 -1
  20. package/dist/dev-compose.js +12 -10
  21. package/dist/dev-compose.js.map +1 -1
  22. package/dist/engine-client.d.ts +1 -0
  23. package/dist/engine-client.d.ts.map +1 -1
  24. package/dist/engine-client.js +47 -2
  25. package/dist/engine-client.js.map +1 -1
  26. package/dist/engine-floor.d.ts +27 -4
  27. package/dist/engine-floor.d.ts.map +1 -1
  28. package/dist/engine-floor.js +90 -9
  29. package/dist/engine-floor.js.map +1 -1
  30. package/dist/gitignore.d.ts.map +1 -1
  31. package/dist/gitignore.js +7 -0
  32. package/dist/gitignore.js.map +1 -1
  33. package/dist/hooks-generator.d.ts.map +1 -1
  34. package/dist/hooks-generator.js +18 -3
  35. package/dist/hooks-generator.js.map +1 -1
  36. package/dist/seed-connection.d.ts +60 -0
  37. package/dist/seed-connection.d.ts.map +1 -0
  38. package/dist/seed-connection.js +90 -0
  39. package/dist/seed-connection.js.map +1 -0
  40. package/dist/seed-ir.d.ts +66 -0
  41. package/dist/seed-ir.d.ts.map +1 -0
  42. package/dist/seed-ir.js +265 -0
  43. package/dist/seed-ir.js.map +1 -0
  44. package/dist/seed-runner.d.ts +44 -0
  45. package/dist/seed-runner.d.ts.map +1 -0
  46. package/dist/seed-runner.js +83 -0
  47. package/dist/seed-runner.js.map +1 -0
  48. package/dist/seed.d.ts +345 -0
  49. package/dist/seed.d.ts.map +1 -1
  50. package/dist/seed.js +138 -0
  51. package/dist/seed.js.map +1 -1
  52. package/dist/self-host-compose.d.ts +15 -0
  53. package/dist/self-host-compose.d.ts.map +1 -1
  54. package/dist/self-host-compose.js +31 -8
  55. package/dist/self-host-compose.js.map +1 -1
  56. package/dist/type-extractor.d.ts.map +1 -1
  57. package/dist/type-extractor.js +73 -0
  58. package/dist/type-extractor.js.map +1 -1
  59. package/dist/type-generation.d.ts +29 -0
  60. package/dist/type-generation.d.ts.map +1 -1
  61. package/dist/type-generation.js +52 -0
  62. package/dist/type-generation.js.map +1 -1
  63. package/package.json +2 -2
  64. package/src/augmentation-generator.ts +73 -14
  65. package/src/cli-version-embedded.ts +1 -1
  66. package/src/commands/generate.ts +7 -3
  67. package/src/commands/init.ts +31 -21
  68. package/src/commands/seed.ts +294 -44
  69. package/src/dev-compose.ts +12 -11
  70. package/src/engine-client.ts +52 -3
  71. package/src/engine-floor.ts +100 -9
  72. package/src/gitignore.ts +7 -0
  73. package/src/hooks-generator.ts +21 -6
  74. package/src/seed-connection.ts +146 -0
  75. package/src/seed-ir.ts +311 -0
  76. package/src/seed-runner.ts +109 -0
  77. package/src/seed.ts +408 -0
  78. package/src/self-host-compose.ts +32 -8
  79. package/src/type-extractor.ts +101 -0
  80. package/src/type-generation.ts +64 -0
  81. package/tests/access-composition.test.ts +123 -0
  82. package/tests/augmentation-generator.test.ts +149 -9
  83. package/tests/db-published-and-addressable.test.ts +69 -0
  84. package/tests/engine-floor.test.ts +93 -0
  85. package/tests/fixtures/seed_golden_ir.json +186 -0
  86. package/tests/runtime-contract.test.ts +31 -6
  87. package/tests/seed-connection.test.ts +158 -0
  88. package/tests/seed-ir.test.ts +436 -0
  89. 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.4 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,16 @@
1
1
 
2
- > @supatype/cli@0.3.2 test /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.3.4 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) 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
12
14
  stdout | tests/init.test.ts > scaffold() > creates all expected files
13
15
   created package.json
14
16
  created supatype.config.ts
@@ -323,22 +325,31 @@
323
325
  created public/.gitkeep
324
326
  created .gitignore
325
327
 
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
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
334
336
 
335
- ✓ tests/dev-ui.test.ts (21 tests) 130ms
337
+ ✓ tests/dev-ui.test.ts (21 tests) 166ms
336
338
 
337
339
  [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
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
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,37 +358,28 @@
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
361
+ ✓ tests/docker-runtime.test.ts (10 tests) 14ms
360
362
  ✓ 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
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
375
+ ✓ 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
376
378
  ✓ 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
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
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
@@ -391,10 +393,10 @@
391
393
  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) 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
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) 173ms
411
+ ✓ tests/service-role-check.test.ts (10 tests) 13ms
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,54 +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
428
+ ✓ tests/admin-studio-membership.test.ts (5 tests) 562ms
427
429
  ✓ 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
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
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) 16ms
450
+ ✓ 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
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) 13ms
471
+ ✓ 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
471
474
  ✓ tests/cache-identity-scope.test.ts (33 tests) 12ms
472
475
  ✓ tests/target-client-refresh.test.ts (3 tests) 11ms
473
- ✓ tests/studio-admin-roles.test.ts (6 tests) 9ms
476
+ ✓ tests/studio-admin-roles.test.ts (6 tests) 8ms
474
477
  ✓ tests/proxy-dev-app.test.ts (7 tests) 6ms
475
478
  stdout | tests/app-command.test.ts > supatype app add --static > sets app.mode=static and static_dir in supatype.config.ts
476
479
   created package.json
@@ -492,79 +495,79 @@
492
495
  created public/.gitkeep
493
496
  created .gitignore
494
497
 
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
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
515
512
  ✓ 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
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
524
527
  ✓ tests/command-chrome-wrap.test.ts (3 tests) 7ms
525
- ✓ tests/doctor-render.test.ts (3 tests) 6ms
526
528
  ✓ tests/cli-install-method.test.ts (8 tests) 8ms
527
- ✓ tests/port-in-use.test.ts (4 tests) 24ms
529
+ ✓ tests/port-in-use.test.ts (4 tests) 29ms
530
+ ✓ tests/doctor-render.test.ts (3 tests) 7ms
528
531
  ✓ tests/archive-name-alias.test.ts (4 tests) 7ms
529
532
  ✓ 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
533
+ ✓ 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
539
542
  ✓ tests/doctor-service-role.test.ts (4 tests) 7ms
540
543
  ✓ tests/required-host-components.test.ts (4 tests) 7ms
541
- ✓ 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
545
- ✓ 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
554
- ✓ tests/release-pins.test.ts (2 tests) 6ms
544
+ ✓ 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
548
+ ✓ 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
551
+ ✓ 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
555
556
  ✓ tests/dev-ready-panel.test.ts (2 tests) 4ms
556
- ✓ tests/ensure-dev-api-config.test.ts (1 test) 4ms
557
- ✓ tests/seed-discover.test.ts (2 tests) 24ms
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
558
561
  ✓ tests/init-package-json.test.ts (1 test) 4ms
559
562
  ✓ tests/pg-spawn-env.test.ts (2 tests) 4ms
560
- ✓ tests/resolve-api-url.test.ts (2 tests) 6ms
563
+ ✓ tests/resolve-api-url.test.ts (2 tests) 4ms
564
+ ✓ tests/migrate-from-v1.test.ts (1 test) 17ms
561
565
  ✓ tests/cli-package-version.test.ts (1 test) 4ms
562
- ✓ tests/migrate-from-v1.test.ts (1 test) 12ms
563
566
  ✓ tests/postgres-archive-tag.test.ts (1 test) 3ms
564
567
  ✓ tests/stdin-after-ink.test.ts (1 test) 3ms
565
568
 
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)
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)
570
573
 
@@ -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.4 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"}