@supatype/cli 0.2.0 → 0.3.0

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 (172) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +190 -153
  3. package/.turbo/turbo-typecheck.log +1 -1
  4. package/dist/api-config-cache.d.ts +34 -0
  5. package/dist/api-config-cache.d.ts.map +1 -0
  6. package/dist/api-config-cache.js +123 -0
  7. package/dist/api-config-cache.js.map +1 -0
  8. package/dist/cache-identity-scope.d.ts +38 -0
  9. package/dist/cache-identity-scope.d.ts.map +1 -0
  10. package/dist/cache-identity-scope.js +70 -0
  11. package/dist/cache-identity-scope.js.map +1 -0
  12. package/dist/cache-provider.d.ts +30 -0
  13. package/dist/cache-provider.d.ts.map +1 -0
  14. package/dist/cache-provider.js +60 -0
  15. package/dist/cache-provider.js.map +1 -0
  16. package/dist/cli-version-embedded.js +1 -1
  17. package/dist/commands/add.js +1 -1
  18. package/dist/commands/add.js.map +1 -1
  19. package/dist/commands/cache.d.ts +1 -1
  20. package/dist/commands/cache.js +3 -3
  21. package/dist/commands/cache.js.map +1 -1
  22. package/dist/commands/cloud.d.ts.map +1 -1
  23. package/dist/commands/cloud.js +2 -1
  24. package/dist/commands/cloud.js.map +1 -1
  25. package/dist/commands/deploy.d.ts.map +1 -1
  26. package/dist/commands/deploy.js +2 -1
  27. package/dist/commands/deploy.js.map +1 -1
  28. package/dist/commands/dev.d.ts.map +1 -1
  29. package/dist/commands/dev.js +61 -8
  30. package/dist/commands/dev.js.map +1 -1
  31. package/dist/commands/diff.d.ts.map +1 -1
  32. package/dist/commands/diff.js +2 -1
  33. package/dist/commands/diff.js.map +1 -1
  34. package/dist/commands/functions.d.ts.map +1 -1
  35. package/dist/commands/functions.js +6 -2
  36. package/dist/commands/functions.js.map +1 -1
  37. package/dist/commands/init.d.ts.map +1 -1
  38. package/dist/commands/init.js +13 -9
  39. package/dist/commands/init.js.map +1 -1
  40. package/dist/commands/keys.d.ts +14 -0
  41. package/dist/commands/keys.d.ts.map +1 -1
  42. package/dist/commands/keys.js +37 -0
  43. package/dist/commands/keys.js.map +1 -1
  44. package/dist/commands/migrate.d.ts.map +1 -1
  45. package/dist/commands/migrate.js +2 -1
  46. package/dist/commands/migrate.js.map +1 -1
  47. package/dist/commands/push.d.ts.map +1 -1
  48. package/dist/commands/push.js +52 -1
  49. package/dist/commands/push.js.map +1 -1
  50. package/dist/commands/self-host.d.ts.map +1 -1
  51. package/dist/commands/self-host.js +9 -0
  52. package/dist/commands/self-host.js.map +1 -1
  53. package/dist/compose-services.d.ts.map +1 -1
  54. package/dist/compose-services.js +2 -1
  55. package/dist/compose-services.js.map +1 -1
  56. package/dist/dev-compose.d.ts.map +1 -1
  57. package/dist/dev-compose.js +18 -7
  58. package/dist/dev-compose.js.map +1 -1
  59. package/dist/engine-floor.d.ts +11 -1
  60. package/dist/engine-floor.d.ts.map +1 -1
  61. package/dist/engine-floor.js +49 -16
  62. package/dist/engine-floor.js.map +1 -1
  63. package/dist/functions-deno-types.d.ts +9 -0
  64. package/dist/functions-deno-types.d.ts.map +1 -1
  65. package/dist/functions-deno-types.js +45 -1
  66. package/dist/functions-deno-types.js.map +1 -1
  67. package/dist/functions-router-gen.d.ts.map +1 -1
  68. package/dist/functions-router-gen.js +113 -81
  69. package/dist/functions-router-gen.js.map +1 -1
  70. package/dist/kong-config.d.ts +1 -1
  71. package/dist/model-cache.d.ts +17 -0
  72. package/dist/model-cache.d.ts.map +1 -0
  73. package/dist/model-cache.js +45 -0
  74. package/dist/model-cache.js.map +1 -0
  75. package/dist/model-hooks.d.ts +5 -0
  76. package/dist/model-hooks.d.ts.map +1 -1
  77. package/dist/model-hooks.js +29 -1
  78. package/dist/model-hooks.js.map +1 -1
  79. package/dist/model-versioning.d.ts +80 -0
  80. package/dist/model-versioning.d.ts.map +1 -0
  81. package/dist/model-versioning.js +140 -0
  82. package/dist/model-versioning.js.map +1 -0
  83. package/dist/postgres-ctl.d.ts +55 -0
  84. package/dist/postgres-ctl.d.ts.map +1 -1
  85. package/dist/postgres-ctl.js +84 -8
  86. package/dist/postgres-ctl.js.map +1 -1
  87. package/dist/preview-config-check.d.ts +21 -0
  88. package/dist/preview-config-check.d.ts.map +1 -0
  89. package/dist/preview-config-check.js +47 -0
  90. package/dist/preview-config-check.js.map +1 -0
  91. package/dist/project-config.d.ts +182 -5
  92. package/dist/project-config.d.ts.map +1 -1
  93. package/dist/project-config.js +125 -8
  94. package/dist/project-config.js.map +1 -1
  95. package/dist/resolve-target.d.ts +9 -0
  96. package/dist/resolve-target.d.ts.map +1 -1
  97. package/dist/resolve-target.js.map +1 -1
  98. package/dist/rest-cache-admin.d.ts.map +1 -1
  99. package/dist/rest-cache-admin.js +6 -2
  100. package/dist/rest-cache-admin.js.map +1 -1
  101. package/dist/schema-ast-v2.d.ts +32 -1
  102. package/dist/schema-ast-v2.d.ts.map +1 -1
  103. package/dist/schema-ast-v2.js +14 -1
  104. package/dist/schema-ast-v2.js.map +1 -1
  105. package/dist/self-host-compose.d.ts +20 -1
  106. package/dist/self-host-compose.d.ts.map +1 -1
  107. package/dist/self-host-compose.js +181 -27
  108. package/dist/self-host-compose.js.map +1 -1
  109. package/dist/studio-admin-roles.d.ts +8 -1
  110. package/dist/studio-admin-roles.d.ts.map +1 -1
  111. package/dist/studio-admin-roles.js +16 -2
  112. package/dist/studio-admin-roles.js.map +1 -1
  113. package/dist/type-extractor.d.ts +7 -0
  114. package/dist/type-extractor.d.ts.map +1 -1
  115. package/dist/type-extractor.js +234 -3
  116. package/dist/type-extractor.js.map +1 -1
  117. package/package.json +2 -2
  118. package/src/api-config-cache.ts +142 -0
  119. package/src/cache-identity-scope.ts +92 -0
  120. package/src/cache-provider.ts +61 -0
  121. package/src/cli-version-embedded.ts +1 -1
  122. package/src/commands/add.ts +1 -1
  123. package/src/commands/cache.ts +3 -3
  124. package/src/commands/cloud.ts +2 -1
  125. package/src/commands/deploy.ts +2 -1
  126. package/src/commands/dev.ts +68 -7
  127. package/src/commands/diff.ts +2 -1
  128. package/src/commands/functions.ts +6 -2
  129. package/src/commands/init.ts +13 -9
  130. package/src/commands/keys.ts +40 -0
  131. package/src/commands/migrate.ts +2 -1
  132. package/src/commands/push.ts +57 -1
  133. package/src/commands/self-host.ts +9 -0
  134. package/src/compose-services.ts +2 -1
  135. package/src/dev-compose.ts +18 -7
  136. package/src/engine-floor.ts +73 -16
  137. package/src/functions-deno-types.ts +48 -1
  138. package/src/functions-router-gen.ts +113 -81
  139. package/src/kong-config.ts +1 -1
  140. package/src/model-cache.ts +74 -0
  141. package/src/model-hooks.ts +26 -2
  142. package/src/model-versioning.ts +167 -0
  143. package/src/postgres-ctl.ts +103 -9
  144. package/src/preview-config-check.ts +52 -0
  145. package/src/project-config.ts +273 -11
  146. package/src/resolve-target.ts +11 -1
  147. package/src/rest-cache-admin.ts +8 -2
  148. package/src/schema-ast-v2.ts +47 -0
  149. package/src/self-host-compose.ts +204 -27
  150. package/src/studio-admin-roles.ts +16 -2
  151. package/src/type-extractor.ts +281 -2
  152. package/tests/api-config-cache-seed.test.ts +180 -0
  153. package/tests/cache-identity-scope.test.ts +61 -0
  154. package/tests/cache-provider-config.test.ts +132 -0
  155. package/tests/engine-floor.test.ts +43 -0
  156. package/tests/external-database-compose.test.ts +74 -3
  157. package/tests/field-masking-tier.test.ts +3 -3
  158. package/tests/fixtures/identity-scope-corpus.json +42 -0
  159. package/tests/functions-concurrency.test.ts +71 -0
  160. package/tests/init.test.ts +36 -2
  161. package/tests/model-cache-declaration.test.ts +229 -0
  162. package/tests/model-cache-manifest.test.ts +99 -0
  163. package/tests/model-hooks.test.ts +55 -0
  164. package/tests/model-versions.test.ts +229 -0
  165. package/tests/native-keyspace.test.ts +130 -0
  166. package/tests/preview-config-check.test.ts +104 -0
  167. package/tests/rest-cache-admin.test.ts +36 -0
  168. package/tests/runtime-contract.test.ts +176 -22
  169. package/tests/self-host-keys.test.ts +92 -0
  170. package/tests/studio-admin-roles.test.ts +32 -0
  171. package/tests/type-extractor.test.ts +113 -0
  172. package/tsconfig.tsbuildinfo +1 -1
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/cli@0.2.0 build /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.3.0 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,14 @@
1
1
 
2
- > @supatype/cli@0.2.0 test /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.3.0 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) 90ms
9
- ✓ tests/type-extractor.test.ts (44 tests) 117ms
10
- ✓ tests/model-hooks.test.ts (21 tests) 66ms
11
- ✓ tests/runtime-contract.test.ts (49 tests) 142ms
8
+ ✓ tests/type-extractor.test.ts (48 tests) 507ms
9
+ ✓ tests/access-composition.test.ts (26 tests) 397ms
10
+ ✓ tests/model-hooks.test.ts (23 tests) 241ms
11
+ ✓ tests/runtime-contract.test.ts (57 tests) 323ms
12
12
  stdout | tests/init.test.ts > scaffold() > creates all expected files
13
13
   created package.json
14
14
  created supatype.config.ts
@@ -295,14 +295,49 @@
295
295
  created public/.gitkeep
296
296
  created .gitignore
297
297
 
298
- ✓ tests/init.test.ts (26 tests) 44ms
299
- ✓ tests/model-constraints.test.ts (18 tests) 76ms
300
- ✓ tests/external-database-compose.test.ts (17 tests) 8ms
301
- ✓ tests/field-masking-tier.test.ts (16 tests) 14ms
298
+ stdout | tests/init.test.ts > scaffold() > a scaffolded .env never names MinIO or its port
299
+  created package.json
300
+ created supatype.config.ts
301
+ created schema/index.ts
302
+ created .env
303
+ created seed.ts
304
+ created seeds/.gitkeep
305
+ created public/.gitkeep
306
+ created .gitignore
307
+ created package.json
308
+ created supatype.config.ts
309
+ created schema/index.ts
310
+ created .env
311
+ created seed.ts
312
+ created seeds/.gitkeep
313
+ created public/.gitkeep
314
+ created .gitignore
302
315
 
303
- ✓ tests/dev-ui.test.ts (21 tests) 117ms
316
+ stdout | tests/init.test.ts > scaffold() > local storage points at the port the object store actually publishes
317
+  created package.json
318
+ created supatype.config.ts
319
+ created schema/index.ts
320
+ created .env
321
+ created seed.ts
322
+ created seeds/.gitkeep
323
+ created public/.gitkeep
324
+ created .gitignore
325
+
326
+ ✓ tests/init.test.ts (28 tests) 254ms
327
+ ✓ tests/external-database-compose.test.ts (23 tests) 15ms
328
+ ✓ tests/model-constraints.test.ts (18 tests) 174ms
329
+ ✓ tests/model-versions.test.ts (19 tests) 62ms
330
+ ✓ tests/api-config-cache-seed.test.ts (15 tests) 39ms
331
+ ✓ tests/model-cache-declaration.test.ts (18 tests) 102ms
332
+ ✓ tests/field-masking-tier.test.ts (16 tests) 16ms
333
+
334
+ ✓ tests/dev-ui.test.ts (21 tests) 112ms
304
335
 
305
336
  [supatype] Shutting down…
337
+ ✓ tests/hooks-generator.test.ts (7 tests) 8217ms
338
+ ✓ typechecks under strict mode, together with a handler that uses it  2986ms
339
+ ✓ rejects a handler for a table that declares no hook  2753ms
340
+ ✓ typechecks with a validator written the way the docs will show it  2352ms
306
341
  stdout | tests/docker-runtime.test.ts > requireDockerDaemon > exits when the daemon is unavailable
307
342
  
308
343
  Start the Docker daemon (e.g. sudo systemctl start docker), then try again.
@@ -311,54 +346,52 @@
311
346
 
312
347
  docker: daemon down
313
348
 
314
- ✓ tests/docker-runtime.test.ts (10 tests) 12ms
315
- ✓ tests/hooks-generator.test.ts (7 tests) 5380ms
316
- ✓ typechecks under strict mode, together with a handler that uses it  1784ms
317
- ✓ rejects a handler for a table that declares no hook  1801ms
318
- ✓ typechecks with a validator written the way the docs will show it  1768ms
319
- ✓ tests/config.test.ts (19 tests) 5148ms
320
- ✓ loads a valid supatype.config.ts (plain export default, no package imports)  529ms
321
- ✓ normalizes shorthand schema string to { path, pg_schema }  520ms
322
- ✓ loads a supatype.config.js (plain ESM)  485ms
323
- ✓ loads config without a versions section (latest by default)  533ms
324
- ✓ prefers supatype.config.ts over supatype.config.js when both exist  588ms
325
- ✓ supports optional output field in config  581ms
326
- ✓ merges supatype.local.config.ts over base  1021ms
327
- ✓ loads defineConfig import before @supatype/cli is installed (init scaffold)  880ms
328
- ✓ tests/db-preflight.test.ts (14 tests) 5ms
329
- ✓ tests/field-bounds.test.ts (23 tests) 9ms
330
- ✓ tests/cache-clean.test.ts (8 tests) 1667ms
331
- ✓ keeps pinned versions and removes the rest  551ms
332
- ✓ --force removes pinned versions  514ms
333
- ✓ explicit version removes even when pinned (with warning)  590ms
334
- ✓ tests/functions-deno-types.test.ts (7 tests) 2732ms
335
- ✓ adds functions to root tsconfig exclude when possible  510ms
336
- ✓ tsc fails with Cannot find name Deno without ambient types  1604ms
337
- ✓ tsc passes for Deno.env after ensureFunctionsDenoTypes  612ms
338
- ✓ tests/field-bounds-matrix.test.ts (124 tests) 24ms
339
- ✓ tests/external-database-config.test.ts (14 tests) 5ms
340
- ✓ tests/compose-services.test.ts (12 tests) 19ms
341
- ✓ tests/field-validators.test.ts (10 tests) 38ms
342
- ✓ tests/command-chrome-coverage.test.ts (1 test) 16ms
343
- ✓ tests/hook-upload.test.ts (8 tests) 14ms
344
- ✓ tests/env-file.test.ts (9 tests) 14ms
349
+ ✓ tests/docker-runtime.test.ts (10 tests) 18ms
350
+ ✓ tests/config.test.ts (19 tests) 8166ms
351
+ ✓ loads a valid supatype.config.ts (plain export default, no package imports)  865ms
352
+ ✓ normalizes shorthand schema string to { path, pg_schema }  869ms
353
+ ✓ loads a supatype.config.js (plain ESM)  966ms
354
+ ✓ loads config without a versions section (latest by default)  840ms
355
+ ✓ prefers supatype.config.ts over supatype.config.js when both exist  860ms
356
+ ✓ supports optional output field in config  886ms
357
+ ✓ merges supatype.local.config.ts over base  1488ms
358
+ ✓ loads defineConfig import before @supatype/cli is installed (init scaffold)  1378ms
359
+ ✓ tests/db-preflight.test.ts (14 tests) 9ms
360
+ ✓ tests/field-bounds.test.ts (23 tests) 14ms
361
+ ✓ tests/cache-clean.test.ts (8 tests) 2182ms
362
+ ✓ keeps pinned versions and removes the rest  633ms
363
+ ✓ --force removes pinned versions  817ms
364
+ ✓ explicit version removes even when pinned (with warning)  715ms
365
+ ✓ tests/cache-provider-config.test.ts (12 tests) 13ms
366
+ ✓ tests/functions-deno-types.test.ts (7 tests) 2958ms
367
+ ✓ tsc fails with Cannot find name Deno without ambient types  2009ms
368
+ ✓ tsc passes for Deno.env after ensureFunctionsDenoTypes  929ms
369
+ ✓ tests/field-bounds-matrix.test.ts (124 tests) 36ms
370
+ ✓ tests/engine-floor.test.ts (17 tests) 13ms
371
+ ✓ tests/external-database-config.test.ts (14 tests) 20ms
372
+ ✓ tests/compose-services.test.ts (12 tests) 12ms
373
+ ✓ tests/field-validators.test.ts (10 tests) 71ms
374
+ ✓ tests/native-keyspace.test.ts (10 tests) 39ms
375
+ ✓ tests/command-chrome-coverage.test.ts (1 test) 22ms
376
+ ✓ tests/hook-upload.test.ts (8 tests) 13ms
377
+ ✓ tests/env-file.test.ts (9 tests) 16ms
345
378
  stdout | tests/link.test.ts > link model > migrates cloud.json into link.json
346
379
   created package.json
347
380
  created supatype.config.ts
381
+ stderr | tests/link.test.ts > link model > migrates cloud.json into link.json
382
+ [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
348
383
  created schema/index.ts
384
+
349
385
  created .env
350
386
  created seed.ts
351
387
  created seeds/.gitkeep
352
388
  created public/.gitkeep
353
389
  created .gitignore
354
390
 
355
- stderr | tests/link.test.ts > link model > migrates cloud.json into link.json
356
- [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
357
-
358
- ✓ tests/link.test.ts (4 tests) 2564ms
359
- ✓ resolveTarget returns cloud mode with /api/v1 prefix  899ms
360
- ✓ resolveTarget returns self-host mode with /platform/v1 prefix  789ms
361
- ✓ targetSchemaRollback posts to /platform/v1 when linked  867ms
391
+ ✓ tests/link.test.ts (4 tests) 3162ms
392
+ ✓ resolveTarget returns cloud mode with /api/v1 prefix  1108ms
393
+ ✓ resolveTarget returns self-host mode with /platform/v1 prefix  992ms
394
+ ✓ targetSchemaRollback posts to /platform/v1 when linked  1051ms
362
395
  stdout | tests/admin-ensure.test.ts > init admin seed in .env > writes SUPATYPE_ADMIN_* when scaffold options include credentials
363
396
   created package.json
364
397
  created supatype.config.ts
@@ -369,8 +402,8 @@
369
402
  created public/.gitkeep
370
403
  created .gitignore
371
404
 
372
- ✓ tests/admin-ensure.test.ts (10 tests) 144ms
373
- ✓ tests/service-role-check.test.ts (10 tests) 8ms
405
+ ✓ tests/admin-ensure.test.ts (10 tests) 149ms
406
+ ✓ tests/service-role-check.test.ts (10 tests) 13ms
374
407
  stdout | tests/admin-studio-membership.test.ts > first admin user creation > does not write a role into app_metadata
375
408
  [supatype] Admin user "admin@example.com" created (role: admin).
376
409
  [supatype] Log in at /admin after starting the dev server.
@@ -387,45 +420,50 @@
387
420
  [supatype] Admin user "admin@example.com" created (role: admin).
388
421
  [supatype] Log in at /admin after starting the dev server.
389
422
 
390
- ✓ tests/admin-studio-membership.test.ts (5 tests) 385ms
391
- ✓ tests/augmentation-generator.test.ts (6 tests) 16ms
392
- ✓ tests/pull-utils.test.ts (49 tests) 10ms
393
- ✓ tests/keys.test.ts (11 tests) 13237ms
394
- ✓ exits 0 with --secret  1193ms
395
- ✓ outputs ANON_KEY= line  1194ms
396
- ✓ outputs SERVICE_ROLE_KEY= line  1074ms
397
- ✓ ANON_KEY is a valid three-part JWT  1092ms
398
- ✓ SERVICE_ROLE_KEY payload has role: service_role  1053ms
399
- ✓ JWT has exp in the future  1047ms
400
- ✓ --exp-years changes the expiry window  2168ms
401
- ✓ reads JWT_SECRET from environment variable  1063ms
402
- ✓ reads JWT_SECRET from .env file  1105ms
403
- ✓ exits non-zero when no secret is available  1134ms
404
- ✓ keys --help shows --secret and --exp-years options  1108ms
405
- ✓ tests/schema-sources.test.ts (5 tests) 1099ms
406
- ✓ buildSchemaSourcesPayload includes manifest metadata  459ms
407
- ✓ restore overwrites modified local files  604ms
423
+ ✓ tests/admin-studio-membership.test.ts (5 tests) 499ms
424
+ ✓ tests/augmentation-generator.test.ts (6 tests) 13ms
425
+ ✓ tests/pull-utils.test.ts (49 tests) 13ms
426
+ ✓ tests/keys.test.ts (11 tests) 17971ms
427
+ ✓ exits 0 with --secret  1795ms
428
+ ✓ outputs ANON_KEY= line  1603ms
429
+ ✓ outputs SERVICE_ROLE_KEY= line  1405ms
430
+ ✓ ANON_KEY is a valid three-part JWT  1507ms
431
+ ✓ SERVICE_ROLE_KEY payload has role: service_role  1445ms
432
+ ✓ JWT has exp in the future  1351ms
433
+ ✓ --exp-years changes the expiry window  2906ms
434
+ ✓ reads JWT_SECRET from environment variable  1577ms
435
+ ✓ reads JWT_SECRET from .env file  1520ms
436
+ ✓ exits non-zero when no secret is available  1364ms
437
+ ✓ keys --help shows --secret and --exp-years options  1491ms
438
+ ✓ tests/schema-sources.test.ts (5 tests) 1311ms
439
+ ✓ buildSchemaSourcesPayload includes manifest metadata  664ms
440
+ ✓ restore overwrites modified local files  597ms
441
+ ✓ tests/preview-config-check.test.ts (9 tests) 12ms
408
442
  stderr | tests/binary-cache-cloud-overrides.test.ts > isLinkedToCloudProject > is true when .supatype/cloud.json has projectSlug
409
443
  [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
410
444
 
411
- ✓ tests/binary-cache-cloud-overrides.test.ts (11 tests) 17ms
412
- ✓ tests/homebrew-formula.test.ts (4 tests) 110ms
413
- ✓ tests/local-server-image-env.test.ts (5 tests) 218ms
414
- ✓ tests/minisign.test.ts (5 tests) 8ms
415
- ✓ tests/engine-floor.test.ts (11 tests) 7ms
416
- ✓ tests/local-secrets.test.ts (5 tests) 7ms
417
- ✓ tests/api-schemas.test.ts (10 tests) 7ms
445
+ ✓ tests/binary-cache-cloud-overrides.test.ts (11 tests) 21ms
446
+ ✓ tests/homebrew-formula.test.ts (4 tests) 223ms
447
+ ✓ tests/model-cache-manifest.test.ts (12 tests) 10ms
448
+ ✓ tests/local-server-image-env.test.ts (5 tests) 12ms
449
+ ✓ tests/minisign.test.ts (5 tests) 11ms
450
+ ✓ tests/local-secrets.test.ts (5 tests) 10ms
451
+ ✓ tests/functions-concurrency.test.ts (6 tests) 4ms
452
+ ✓ tests/readiness-poll.test.ts (3 tests) 330ms
453
+ ✓ ends promptly when it carries a deadline  326ms
454
+ ✓ tests/self-host-keys.test.ts (7 tests) 14ms
455
+ ✓ tests/api-schemas.test.ts (10 tests) 6ms
418
456
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
419
457
  [supatype] Storage bucket "photos" ready.
420
458
 
421
459
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
422
460
  [supatype] Storage bucket "avatars" ready.
423
461
 
424
- ✓ tests/storage-provision.test.ts (6 tests) 10ms
425
- ✓ tests/cached-artifact-format.test.ts (7 tests) 7ms
426
- ✓ tests/readiness-poll.test.ts (3 tests) 320ms
427
- ✓ ends promptly when it carries a deadline  317ms
428
- ✓ tests/target-client-refresh.test.ts (3 tests) 9ms
462
+ ✓ tests/storage-provision.test.ts (6 tests) 12ms
463
+ ✓ tests/cached-artifact-format.test.ts (7 tests) 10ms
464
+ ✓ tests/cache-identity-scope.test.ts (33 tests) 9ms
465
+ ✓ tests/target-client-refresh.test.ts (3 tests) 22ms
466
+ ✓ tests/studio-admin-roles.test.ts (6 tests) 8ms
429
467
  ✓ tests/proxy-dev-app.test.ts (7 tests) 5ms
430
468
  stdout | tests/app-command.test.ts > supatype app add --static > sets app.mode=static and static_dir in supatype.config.ts
431
469
   created package.json
@@ -447,80 +485,79 @@
447
485
  created public/.gitkeep
448
486
  created .gitignore
449
487
 
450
- ✓ tests/service-role-routes.test.ts (4 tests) 1404ms
451
- ✓ reads the declared list  465ms
452
- ✓ is an empty list when a project declares none  458ms
453
- ✓ sends what the project declared, hook entries included  479ms
454
- ✓ tests/app-command.test.ts (2 tests) 2281ms
455
- ✓ sets app.mode=static and static_dir in supatype.config.ts  1088ms
456
- ✓ creates the static directory when missing  1191ms
457
- ✓ tests/init-dependency-versions.test.ts (4 tests) 28ms
458
- ✓ tests/compose-parsable-defaults.test.ts (2 tests) 6ms
459
- ✓ tests/type-resolver.test.ts (2 tests) 13ms
460
- ✓ tests/engine-push-output.test.ts (7 tests) 6ms
461
- ✓ tests/cli-help.test.ts (16 tests) 17072ms
462
- ✓ --help lists all top-level commands  1059ms
463
- ✓ --version prints package.json version  1058ms
464
- ✓ self-update --help describes the command  975ms
465
- ✓ init --help describes the init command  1062ms
466
- ✓ push --help describes the push command and --yes flag  1091ms
467
- ✓ diff --help describes the diff command  1054ms
468
- ✓ pull --help describes scaffold pull command  1091ms
469
- ✓ doctor --help describes drift report command  1142ms
470
- ✓ introspect --help describes database introspection command  1060ms
471
- ✓ adopt --help describes adoption ceremony command  1025ms
472
- ✓ reset --help shows --yes flag  987ms
473
- ✓ app --help describes the app command with add/remove subcommands  1006ms
474
- ✓ app add --help shows --static and --port options  1046ms
475
- ✓ self-host --help shows compose only (legacy commands hidden)  1161ms
476
- ✓ self-host compose --help shows compose subcommands  1139ms
477
- ✓ unknown command exits non-zero  1108ms
488
+ ✓ tests/service-role-routes.test.ts (4 tests) 1804ms
489
+ ✓ reads the declared list  608ms
490
+ ✓ is an empty list when a project declares none  599ms
491
+ ✓ sends what the project declared, hook entries included  592ms
492
+ ✓ tests/app-command.test.ts (2 tests) 3147ms
493
+ ✓ sets app.mode=static and static_dir in supatype.config.ts  1581ms
494
+ ✓ creates the static directory when missing  1564ms
495
+ ✓ tests/compose-parsable-defaults.test.ts (2 tests) 7ms
496
+ ✓ tests/rest-cache-admin.test.ts (3 tests) 45ms
497
+ ✓ tests/init-dependency-versions.test.ts (4 tests) 60ms
498
+ ✓ tests/type-resolver.test.ts (2 tests) 24ms
499
+ ✓ tests/engine-push-output.test.ts (7 tests) 8ms
500
+ ✓ tests/cli-help.test.ts (16 tests) 23650ms
501
+ ✓ --help lists all top-level commands  1432ms
502
+ ✓ --version prints package.json version  1508ms
503
+ ✓ self-update --help describes the command  1414ms
504
+ ✓ init --help describes the init command  1625ms
505
+ ✓ push --help describes the push command and --yes flag  1503ms
506
+ ✓ diff --help describes the diff command  1457ms
507
+ ✓ pull --help describes scaffold pull command  1344ms
508
+ ✓ doctor --help describes drift report command  1512ms
509
+ ✓ introspect --help describes database introspection command  1351ms
510
+ ✓ adopt --help describes adoption ceremony command  1533ms
511
+ ✓ reset --help shows --yes flag  1421ms
512
+ ✓ app --help describes the app command with add/remove subcommands  1491ms
513
+ ✓ app add --help shows --static and --port options  1418ms
514
+ ✓ self-host --help shows compose only (legacy commands hidden)  1477ms
515
+ ✓ self-host compose --help shows compose subcommands  1538ms
516
+ ✓ unknown command exits non-zero  1613ms
478
517
  ✓ tests/command-chrome-wrap.test.ts (3 tests) 6ms
479
- ✓ tests/cli-install-method.test.ts (8 tests) 5ms
480
- ✓ tests/doctor-render.test.ts (3 tests) 5ms
481
- ✓ tests/port-in-use.test.ts (4 tests) 26ms
482
- ✓ tests/archive-name-alias.test.ts (4 tests) 5ms
483
- ✓ tests/ensure-binary.test.ts (2 tests) 8ms
484
- ✓ tests/init-project-detect.test.ts (4 tests) 9ms
485
- ✓ tests/tsx-runner.test.ts (7 tests) 2520ms
486
- ✓ evaluates a simple expression and returns stdout  329ms
487
- ✓ evaluates TypeScript syntax (type annotations)  343ms
488
- ✓ can serialize a JSON object to stdout  339ms
489
- ✓ returns non-zero exit code on syntax error  350ms
490
- ✓ returns non-zero exit code on runtime error  360ms
491
- ✓ captures stderr separately from stdout  344ms
492
- ✓ runs a .ts file and returns its stdout  448ms
493
- ✓ tests/doctor-service-role.test.ts (4 tests) 5ms
494
- ✓ tests/required-host-components.test.ts (4 tests) 4ms
495
- ✓ tests/dev-ports-owner.test.ts (6 tests) 4ms
518
+ ✓ tests/cli-install-method.test.ts (8 tests) 6ms
519
+ ✓ tests/port-in-use.test.ts (4 tests) 33ms
520
+ ✓ tests/archive-name-alias.test.ts (4 tests) 6ms
521
+ ✓ tests/doctor-render.test.ts (3 tests) 7ms
522
+ ✓ tests/ensure-binary.test.ts (2 tests) 12ms
523
+ ✓ tests/tsx-runner.test.ts (7 tests) 3052ms
524
+ ✓ evaluates a simple expression and returns stdout  383ms
525
+ ✓ evaluates TypeScript syntax (type annotations)  367ms
526
+ ✓ can serialize a JSON object to stdout  398ms
527
+ ✓ returns non-zero exit code on syntax error  381ms
528
+ ✓ returns non-zero exit code on runtime error  452ms
529
+ ✓ captures stderr separately from stdout  469ms
530
+ ✓ runs a .ts file and returns its stdout  597ms
531
+ ✓ tests/init-project-detect.test.ts (4 tests) 8ms
532
+ ✓ tests/doctor-service-role.test.ts (4 tests) 7ms
533
+ ✓ tests/dev-ports-owner.test.ts (6 tests) 6ms
534
+ ✓ tests/required-host-components.test.ts (4 tests) 7ms
496
535
  ✓ tests/ui-messages.test.ts (5 tests) 5ms
497
- ✓ tests/normalize-admin-config.test.ts (1 test) 5ms
498
- ✓ tests/ui-confirm.test.ts (3 tests) 6ms
499
- ✓ tests/docker-postgres.test.ts (5 tests) 4ms
500
- ✓ tests/binary-download-lock.test.ts (2 tests) 5ms
501
- ✓ tests/dev-session-lock.test.ts (2 tests) 3ms
502
- ✓ tests/dev-ports.test.ts (3 tests) 5ms
503
- ✓ tests/config-load-failure.test.ts (2 tests) 2836ms
504
- ✓ is reported, rather than treated as absent  1611ms
505
- ✓ does not stop the CLI working with no config at all  1223ms
506
- ✓ tests/route-manifest.test.ts (1 test) 4ms
507
- ✓ tests/dev-ready-panel.test.ts (2 tests) 3ms
508
- ✓ tests/studio-admin-roles.test.ts (3 tests) 3ms
509
- ✓ tests/release-pins.test.ts (2 tests) 3ms
510
- ✓ tests/realtime-launch.test.ts (1 test) 4ms
511
- ✓ tests/ensure-dev-api-config.test.ts (1 test) 3ms
512
- ✓ tests/seed-discover.test.ts (2 tests) 10ms
513
- ✓ tests/rest-cache-admin.test.ts (1 test) 40ms
514
- ✓ tests/init-package-json.test.ts (1 test) 2ms
515
- ✓ tests/resolve-api-url.test.ts (2 tests) 5ms
516
- ✓ tests/pg-spawn-env.test.ts (2 tests) 4ms
536
+ ✓ tests/normalize-admin-config.test.ts (1 test) 8ms
537
+ ✓ tests/ui-confirm.test.ts (3 tests) 16ms
538
+ ✓ tests/docker-postgres.test.ts (5 tests) 5ms
539
+ ✓ tests/binary-download-lock.test.ts (2 tests) 7ms
540
+ ✓ tests/dev-session-lock.test.ts (2 tests) 6ms
541
+ ✓ tests/dev-ports.test.ts (3 tests) 6ms
542
+ ✓ tests/route-manifest.test.ts (1 test) 5ms
543
+ ✓ tests/config-load-failure.test.ts (2 tests) 3799ms
544
+ ✓ is reported, rather than treated as absent  2235ms
545
+ ✓ does not stop the CLI working with no config at all  1561ms
546
+ ✓ tests/dev-ready-panel.test.ts (2 tests) 4ms
547
+ ✓ tests/realtime-launch.test.ts (1 test) 6ms
548
+ ✓ tests/release-pins.test.ts (2 tests) 5ms
549
+ ✓ tests/ensure-dev-api-config.test.ts (1 test) 4ms
550
+ ✓ tests/seed-discover.test.ts (2 tests) 22ms
551
+ ✓ tests/init-package-json.test.ts (1 test) 4ms
552
+ ✓ tests/resolve-api-url.test.ts (2 tests) 4ms
517
553
  ✓ tests/migrate-from-v1.test.ts (1 test) 12ms
518
- ✓ tests/cli-package-version.test.ts (1 test) 3ms
519
- ✓ tests/postgres-archive-tag.test.ts (1 test) 2ms
520
- ✓ tests/stdin-after-ink.test.ts (1 test) 2ms
521
-
522
-  Test Files  84 passed (84)
523
-  Tests  812 passed (812)
524
-  Start at  07:11:48
525
-  Duration  35.25s (transform 4.64s, setup 0ms, import 33.01s, tests 60.32s, environment 10ms)
554
+ ✓ tests/pg-spawn-env.test.ts (2 tests) 5ms
555
+ ✓ tests/cli-package-version.test.ts (1 test) 4ms
556
+ ✓ tests/stdin-after-ink.test.ts (1 test) 3ms
557
+ ✓ tests/postgres-archive-tag.test.ts (1 test) 3ms
558
+
559
+  Test Files  94 passed (94)
560
+  Tests  986 passed (986)
561
+  Start at  09:24:20
562
+  Duration  54.40s (transform 9.67s, setup 0ms, import 58.44s, tests 83.74s, environment 19ms)
526
563
 
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/cli@0.2.0 typecheck /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.3.0 typecheck /home/runner/work/supatype/supatype/packages/cli
3
3
  > tsc --project tsconfig.json --noEmit && tsc --project tests/tsconfig.json --noEmit
4
4
 
@@ -0,0 +1,34 @@
1
+ export interface CacheSeedResult {
2
+ /** Tables switched on by this push because the schema had just started declaring them. */
3
+ seeded: string[];
4
+ /** True when every declared table is switched off project-wide by `cache_max_ttl: 0`. */
5
+ ttlIsOff: boolean;
6
+ /** Tables the schema declares, whether or not this push changed anything. */
7
+ declared: string[];
8
+ }
9
+ /**
10
+ * Bring the local allowlist in line with new declarations, and report what is still in the way.
11
+ *
12
+ * Returns null when there is no file to seed — a cloud-only project, or a stack that has never
13
+ * been started. A missing file is not an error here: the file is the local server's, and `dev`
14
+ * creates it.
15
+ */
16
+ export declare function seedApiConfigCache(cwd: string, ast: unknown): CacheSeedResult | null;
17
+ /**
18
+ * §13.4's note, in the words of the project that will read it — or null when there is nothing to
19
+ * say.
20
+ *
21
+ * A free project with `cache` in its schema has asked for the paid feature **in code**. That is
22
+ * better qualified than any banner, and it is why this names the tables: "your cache is off" is a
23
+ * fact about the plan, while "posts and profiles are served from PostgREST on every request" is a
24
+ * fact about their project.
25
+ *
26
+ * Said once per push and never as an error. Declaring a cache on a tier that does not honour it is
27
+ * a correct declaration, not a mistake — the tier decides what runs, not what a schema may say —
28
+ * and a push that failed over it would be punishing someone for writing down their intent.
29
+ */
30
+ export declare function freeTierCacheNote(report: {
31
+ tables?: string[];
32
+ honoured?: boolean;
33
+ } | undefined): string | null;
34
+ //# sourceMappingURL=api-config-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-config-cache.d.ts","sourceRoot":"","sources":["../src/api-config-cache.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,eAAe;IAC9B,0FAA0F;IAC1F,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,yFAAyF;IACzF,QAAQ,EAAE,OAAO,CAAA;IACjB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CA4CpF;AAmBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAW9G"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Seed `.supatype/api-config.json`'s cache allowlist from what the schema declares.
3
+ *
4
+ * The declaration is a **ceiling**, not a switch: the server reads `cache` on the manifest as what
5
+ * *may* be cached and `cache_tables` as what *is*. Both are needed, and only one of them is written
6
+ * by a push — which on a local stack means a developer who wrote `cache: { enabled: true }`, pushed,
7
+ * and called `.cache({ server: true })` gets a BYPASS and no explanation short of opening Studio.
8
+ *
9
+ * So a push turns on what the schema newly declares, and **never touches an entry that already
10
+ * exists**. That asymmetry is the whole design:
11
+ *
12
+ * - Seeding a new table is not a decision anyone made differently. The schema is the only thing
13
+ * that has ever said anything about it.
14
+ * - Rewriting an existing entry is `push resets to declared`, which §13.2 rejects by name: an
15
+ * operator narrows a table during an incident, someone pushes an unrelated model, and the
16
+ * mitigation is reverted at the worst possible moment with nothing in the output to say so.
17
+ *
18
+ * It follows that a table dropped from the schema keeps its entry here. That is not a leak: the
19
+ * server intersects the allowlist with the declaration on every request, so an entry with no
20
+ * declaration behind it caches nothing. Removing it would be tidier and would also mean a push
21
+ * silently editing entries it did not create.
22
+ */
23
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
24
+ import { dirname, join } from "node:path";
25
+ import { manifestCache } from "./model-cache.js";
26
+ /**
27
+ * Bring the local allowlist in line with new declarations, and report what is still in the way.
28
+ *
29
+ * Returns null when there is no file to seed — a cloud-only project, or a stack that has never
30
+ * been started. A missing file is not an error here: the file is the local server's, and `dev`
31
+ * creates it.
32
+ */
33
+ export function seedApiConfigCache(cwd, ast) {
34
+ const declared = manifestCache(ast);
35
+ const declaredTables = Object.keys(declared).filter((t) => declared[t]?.enabled !== false).sort();
36
+ const path = join(cwd, ".supatype", "api-config.json");
37
+ if (!existsSync(path))
38
+ return null;
39
+ let parsed;
40
+ try {
41
+ parsed = JSON.parse(readFileSync(path, "utf8"));
42
+ }
43
+ catch {
44
+ // Malformed: the server reports this far more clearly than a push can, and rewriting it here
45
+ // would destroy whatever the author was in the middle of.
46
+ return null;
47
+ }
48
+ if (typeof parsed !== "object" || parsed === null)
49
+ return null;
50
+ const rest = asRecord(parsed["rest"]);
51
+ if (!rest)
52
+ return null;
53
+ const tables = asRecord(rest["cache_tables"]) ?? {};
54
+ const seeded = [];
55
+ for (const table of declaredTables) {
56
+ if (table in tables)
57
+ continue;
58
+ tables[table] = seedEntry(declared[table]);
59
+ seeded.push(table);
60
+ }
61
+ if (seeded.length > 0) {
62
+ rest["cache_tables"] = tables;
63
+ parsed["rest"] = rest;
64
+ mkdirSync(dirname(path), { recursive: true });
65
+ writeFileSync(path, `${JSON.stringify(parsed, null, 2)}\n`, "utf8");
66
+ }
67
+ const ttl = rest["cache_max_ttl"];
68
+ return {
69
+ seeded,
70
+ // The project-wide TTL is deliberately not written. Zero is an operator's off switch, and a
71
+ // push that turned it on would be overriding a decision rather than filling in a blank — so it
72
+ // is reported instead, where the person who can decide is reading.
73
+ ttlIsOff: declaredTables.length > 0 && (typeof ttl !== "number" || ttl <= 0),
74
+ declared: declaredTables,
75
+ };
76
+ }
77
+ /**
78
+ * What a newly declared table is switched on as.
79
+ *
80
+ * `allow_public` follows the declaration rather than defaulting off: the schema saying `public` is
81
+ * a considered statement that this table's reads are the same for everyone, and `push` has already
82
+ * refused it where the read rule varies by caller. Defaulting it off would make the declaration
83
+ * mean nothing until someone ticked a box that the schema had already justified.
84
+ */
85
+ function seedEntry(entry) {
86
+ return { enabled: true, allow_public: entry.public === true };
87
+ }
88
+ function asRecord(value) {
89
+ if (typeof value !== "object" || value === null || Array.isArray(value))
90
+ return null;
91
+ return value;
92
+ }
93
+ /**
94
+ * §13.4's note, in the words of the project that will read it — or null when there is nothing to
95
+ * say.
96
+ *
97
+ * A free project with `cache` in its schema has asked for the paid feature **in code**. That is
98
+ * better qualified than any banner, and it is why this names the tables: "your cache is off" is a
99
+ * fact about the plan, while "posts and profiles are served from PostgREST on every request" is a
100
+ * fact about their project.
101
+ *
102
+ * Said once per push and never as an error. Declaring a cache on a tier that does not honour it is
103
+ * a correct declaration, not a mistake — the tier decides what runs, not what a schema may say —
104
+ * and a push that failed over it would be punishing someone for writing down their intent.
105
+ */
106
+ export function freeTierCacheNote(report) {
107
+ // Absent, rather than `honoured: false`, is a control plane too old to answer. Silence is the
108
+ // only honest response to a question that was never asked.
109
+ if (!report || report.honoured !== false)
110
+ return null;
111
+ const tables = (report.tables ?? []).filter((t) => typeof t === "string" && t.length > 0);
112
+ if (tables.length === 0)
113
+ return null;
114
+ return (`${listed(tables)} declare a cache in your schema. On the free tier these are served from ` +
115
+ `PostgREST on every request — the declaration is stored and takes effect on a paid plan.`);
116
+ }
117
+ /** "posts", "posts and profiles", "posts, profiles and tags". */
118
+ function listed(tables) {
119
+ if (tables.length === 1)
120
+ return tables[0];
121
+ return `${tables.slice(0, -1).join(", ")} and ${tables[tables.length - 1]}`;
122
+ }
123
+ //# sourceMappingURL=api-config-cache.js.map