better-supabase 0.25.0 → 0.28.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 (180) hide show
  1. package/dist/{access-sql-bjWFUWlk.js → access-sql-CTDNuxRv.js} +177 -12
  2. package/dist/ai-sdk/agents/index.d.ts +2 -2
  3. package/dist/{app-tables-xij_MI5H.d.ts → app-tables-62GqZIhd.d.ts} +1 -1
  4. package/dist/{authorization-BJV2i8xB.d.ts → authorization-BCG1v0iC.d.ts} +24 -3
  5. package/dist/{bind-vKDmdu_4.d.ts → bind-C54jD0r3.d.ts} +1 -1
  6. package/dist/{block-env-wVLz0KMV.d.ts → block-env-CM-LFfj4.d.ts} +3 -3
  7. package/dist/blocks/ai-chat/index.d.ts +3 -3
  8. package/dist/blocks/announcements/index.d.ts +3 -3
  9. package/dist/blocks/api-keys/index.d.ts +1 -1
  10. package/dist/blocks/attachments/index.d.ts +1 -1
  11. package/dist/blocks/audit/index.d.ts +2 -2
  12. package/dist/blocks/automations/index.d.ts +1 -1
  13. package/dist/blocks/billing/index.d.ts +1 -1
  14. package/dist/blocks/bookings/index.d.ts +1 -1
  15. package/dist/blocks/calendar/index.d.ts +1 -1
  16. package/dist/blocks/comments/index.d.ts +4 -4
  17. package/dist/blocks/custom-fields/index.js +1 -1
  18. package/dist/blocks/drive/index.d.ts +1 -1
  19. package/dist/blocks/employees/index.js +1 -1
  20. package/dist/blocks/entitlements/index.d.ts +2 -2
  21. package/dist/blocks/forms/index.d.ts +1 -1
  22. package/dist/blocks/inbox/index.d.ts +4 -4
  23. package/dist/blocks/index.d.ts +1 -1
  24. package/dist/blocks/messaging/index.d.ts +4 -4
  25. package/dist/blocks/mfa/index.d.ts +1 -1
  26. package/dist/blocks/notifications/index.d.ts +3 -3
  27. package/dist/blocks/onboarding/index.d.ts +1 -1
  28. package/dist/blocks/organizations/index.d.ts +2 -2
  29. package/dist/blocks/permissions/index.d.ts +1 -1
  30. package/dist/blocks/push/index.d.ts +1 -1
  31. package/dist/blocks/reactions/index.d.ts +3 -3
  32. package/dist/blocks/reminders/index.d.ts +1 -1
  33. package/dist/blocks/saved-views/index.d.ts +1 -1
  34. package/dist/blocks/search/index.d.ts +2 -2
  35. package/dist/blocks/sessions/index.d.ts +1 -1
  36. package/dist/blocks/settings/index.d.ts +1 -1
  37. package/dist/blocks/subjects/index.d.ts +1 -1
  38. package/dist/blocks/tags/index.d.ts +1 -1
  39. package/dist/blocks/tasks/index.d.ts +1 -1
  40. package/dist/blocks/tasks/index.js +1 -1
  41. package/dist/blocks/undo/index.d.ts +1 -1
  42. package/dist/blocks/usage/index.d.ts +1 -1
  43. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  44. package/dist/blocks/workflows/index.d.ts +3 -3
  45. package/dist/cli/{add-C2pNvVpu.js → add-BKcE_g9D.js} +2 -2
  46. package/dist/cli/{add-BTVrOGJF.js → add-DUyg9qna.js} +40 -15
  47. package/dist/cli/add-pDOlqWUa.js +1 -0
  48. package/dist/cli/{backfill-BicVPugb.js → backfill-r9RELEEh.js} +4 -4
  49. package/dist/cli/bin.js +1 -1
  50. package/dist/cli/{blocks-sScN-ik-.js → blocks-DTOFdrxL.js} +1 -1
  51. package/dist/cli/{blocks-BmYOH4T-.js → blocks-k1OG8XDs.js} +2 -2
  52. package/dist/cli/{cache-1TfBy2K4.js → cache-Czfw7Iow.js} +1 -1
  53. package/dist/cli/{codemod-ylE6wGLo.js → codemod-ClmbiLuL.js} +3 -3
  54. package/dist/cli/{command-BWEEXmtz.js → command-CVzTJSLp.js} +31 -0
  55. package/dist/cli/{completion-8EDK21xj.js → completion-CNCqE-Gb.js} +1 -1
  56. package/dist/cli/{completion-BfnKI4QZ.js → completion-Dpk6vh0p.js} +2 -2
  57. package/dist/cli/{completion-Bt7LMypX.js → completion-DxEXxFpz.js} +2 -2
  58. package/dist/cli/{config-CeaQMrvS.js → config-D2YUlzrl.js} +1 -1
  59. package/dist/cli/{config-WKDixoGK.js → config-EjNj3HfT.js} +1 -1
  60. package/dist/cli/{config-BVfeG3A5.js → config-KvV-sLZL.js} +290 -10
  61. package/dist/cli/{content-mapper-hUW2nb92.js → content-mapper-ez_mT0d4.js} +2 -2
  62. package/dist/cli/{db-DwjyUbAh.js → db-uYN6O5Eg.js} +38 -14
  63. package/dist/cli/{doctor-D3WKFBSv.js → doctor-BD9oo4MG.js} +31 -28
  64. package/dist/cli/{env-DMgjB_4y.js → env-BK0xKMeU.js} +1 -2
  65. package/dist/cli/{env-C-Bl6Awn.js → env-Bat6ogep.js} +1 -1
  66. package/dist/cli/env-Cy2lWBRC.js +1 -0
  67. package/dist/cli/{env-BCgVZkcb.js → env-DEAtgGoj.js} +2 -2
  68. package/dist/cli/{exec--Q1ZEWUW.js → exec-Ca5s-ygi.js} +1 -1
  69. package/dist/cli/{gen-CqsUdsB2.js → gen-8Ya8n2sA.js} +16 -16
  70. package/dist/cli/in-stack-diff-Cp-tVPj2.js +186 -0
  71. package/dist/cli/index.d.ts +1 -2
  72. package/dist/cli/index.js +8 -8
  73. package/dist/cli/{init-DryZ5Mp1.js → init-DgL3sDfQ.js} +118 -11
  74. package/dist/cli/{keys-CbaL0lnw.js → keys-CsanNk-2.js} +1 -1
  75. package/dist/cli/{live-Di45imoV.js → live-CMMEct_F.js} +2 -2
  76. package/dist/cli/{mcp-BklC-3eK.js → mcp-DEHtzAkq.js} +4 -4
  77. package/dist/cli/{metadata-7PsBF5Xw.js → metadata-BZh-cOzC.js} +3 -3
  78. package/dist/cli/migrate-sVs1QYTM.js +306 -0
  79. package/dist/cli/{migration-safety-Doy9qYO8.js → migration-safety-ClnYNMdq.js} +2 -2
  80. package/dist/cli/migrations-DWh38tO9.js +117 -0
  81. package/dist/cli/{module-migration-ZIn1NCMi.js → module-migration-CXfRJIV4.js} +2 -2
  82. package/dist/cli/{moved-DVwgE8lV.js → moved-Cnb4fp49.js} +1 -1
  83. package/dist/cli/{parse-B079x40m.js → parse-BWM6IGhF.js} +1 -1
  84. package/dist/cli/powersync-DURhWDVc.js +1 -0
  85. package/dist/cli/{powersync-BRGXOCJ0.js → powersync-Dnyr-Wy5.js} +4 -3
  86. package/dist/cli/{print-Dfqd4DB-.js → print-DJrSr56b.js} +2 -2
  87. package/dist/cli/{migrations-JtsPYv8g.js → providers-CpaISitn.js} +4 -116
  88. package/dist/cli/{remove-CQzSCYTu.js → remove-ChaieK3t.js} +6 -6
  89. package/dist/cli/{render-DWRz-uPQ.js → render-DUNJ4Pss.js} +8 -5
  90. package/dist/cli/{run-DPLedqTF.js → run-ChCQPYOh.js} +41 -39
  91. package/dist/cli/{run-j54rk2w-.js → run-Cl9COGuy.js} +10 -10
  92. package/dist/cli/{run-DmOTMa44.js → run-CxFDjL1Q.js} +4 -4
  93. package/dist/cli/seed-BJ7c-ktX.js +1 -0
  94. package/dist/cli/{seed-BMynpMPy.js → seed-BzVLTdRl.js} +3 -3
  95. package/dist/cli/{shared-CslNcs-R.js → shared-5uqc1GBj.js} +1 -1
  96. package/dist/cli/{skills-FXAVPLzp.js → skills-0gz_qjVb.js} +1 -1
  97. package/dist/cli/{snapshot-DdN5GlhH.js → snapshot-DdAP7LWO.js} +3 -3
  98. package/dist/cli/{source-COARbqch.js → source-2irbWSck.js} +1 -1
  99. package/dist/cli/{source-args-CDmmFmFG.js → source-args-DAcQt-Mh.js} +1 -1
  100. package/dist/cli/{spec-CgLNZc_C.js → spec-B7n4Rthp.js} +3 -3
  101. package/dist/cli/{spec-DIhBQlBF.js → spec-_MS0ym5r.js} +1 -1
  102. package/dist/cli/{sql-layout-8jrP5gIa.js → sql-layout-DYKkQw1k.js} +21 -7
  103. package/dist/cli/{stack-DgASZP0K.js → stack-CteM33gC.js} +3 -3
  104. package/dist/cli/{stack-status-B_Ipd_-z.js → stack-status-BkkYRlXG.js} +1 -1
  105. package/dist/cli/{stacks-BYlQ96WS.js → stacks-CiDBH1dB.js} +1 -1
  106. package/dist/cli/{sync-SqyVHRSJ.js → sync-DnSOrQuA.js} +4 -3
  107. package/dist/cli/table-DeH8X0qz.js +89 -0
  108. package/dist/cli/{upgrade-CY-vj_qh.js → upgrade-CWdrC-K3.js} +5 -4
  109. package/dist/cli/{upgrade-D0aLhluU.js → upgrade-cMy5fKkg.js} +3 -3
  110. package/dist/cli/{version-Bhca9D6q.js → version-C5RAWmrD.js} +1 -1
  111. package/dist/client/index.d.ts +5 -5
  112. package/dist/client/native/index.d.ts +4 -4
  113. package/dist/config/index.d.ts +3 -3
  114. package/dist/config/index.js +4 -4
  115. package/dist/{config-CP-WaboC.js → config-CTeR7XHK.js} +3 -3
  116. package/dist/{config-C19McoGo.js → config-CvJHIy5q.js} +1 -1
  117. package/dist/{context-BJoHD20l.d.ts → context-BFEX0b7H.d.ts} +106 -3
  118. package/dist/{controller-CwGXms17.d.ts → controller-Cl6HmMBk.d.ts} +1 -1
  119. package/dist/create/index.d.ts +62 -3
  120. package/dist/create/index.js +67 -4
  121. package/dist/create/lite/index.d.ts +140 -3
  122. package/dist/create/lite/index.js +399 -47
  123. package/dist/{entitlements-CsZcfllV.d.ts → entitlements-Y-n4RGAd.d.ts} +1 -1
  124. package/dist/{field-errors-6BVg31Yp.d.ts → field-errors-Btn3czyz.d.ts} +4 -4
  125. package/dist/{index-Cagz4Z2k.d.ts → index-8wOL81rB.d.ts} +1 -1
  126. package/dist/{index-D01wHGSN.d.ts → index-C0_cweyT.d.ts} +6 -6
  127. package/dist/{index-CbUCGMqj.d.ts → index-CAY7rIQs.d.ts} +2 -2
  128. package/dist/{index-DOHx3JuB.d.ts → index-DPMVWm_Z.d.ts} +2 -2
  129. package/dist/{index-C0QuN9_P.d.ts → index-k-SyCzcQ.d.ts} +104 -119
  130. package/dist/{instances-qz2MCMyK.js → instances-C7qUTjhJ.js} +1 -1
  131. package/dist/mapper/bin.js +7 -7
  132. package/dist/mcp/index.d.ts +1 -1
  133. package/dist/next/index.d.ts +3 -3
  134. package/dist/{operations-CPhOcuzl.d.ts → operations-DE7SOBw-.d.ts} +1 -1
  135. package/dist/{options-BOGo1qCA.js → options-B5E2MGIz.js} +3 -1
  136. package/dist/{options-D2s7fT1s.js → options-COo7_3MX.js} +2 -1
  137. package/dist/{options-D32-YxnO.js → options-DhoLMknl.js} +3 -1
  138. package/dist/otel/index.js +4 -4
  139. package/dist/{ports-Bw7uxPd_.d.ts → ports-DP0bthUk.d.ts} +1 -1
  140. package/dist/powersync/index.d.ts +2 -2
  141. package/dist/preset/index.d.ts +3 -3
  142. package/dist/preset/index.js +3 -3
  143. package/dist/{preset-BbSWLoXM.js → preset-DwuWNBip.js} +2 -2
  144. package/dist/{project-TN03XDsA.js → project-Bo1vZqVs.js} +5 -5
  145. package/dist/{push-token-vykw2JXT.d.ts → push-token-v3xCcVU7.d.ts} +1 -1
  146. package/dist/react/index.d.ts +5 -5
  147. package/dist/react/native/index.d.ts +1 -1
  148. package/dist/react/server.d.ts +5 -5
  149. package/dist/realtime/index.d.ts +3 -3
  150. package/dist/realtime/index.js +1 -1
  151. package/dist/records/index.d.ts +3 -3
  152. package/dist/{resolved-names-Dsf28_Dr.js → resolved-names-iLBOUaib.js} +2 -2
  153. package/dist/server/index.d.ts +1 -1
  154. package/dist/solid/index.d.ts +5 -5
  155. package/dist/sql/index.d.ts +5 -5
  156. package/dist/sql/index.js +5 -5
  157. package/dist/{sql-Dg3W1ENk.js → sql-B7vBP9g0.js} +3577 -1246
  158. package/dist/ssr/index.d.ts +1 -1
  159. package/dist/storage/index.js +1 -1
  160. package/dist/{subjects-NomQg6Eg.d.ts → subjects-BYCL-6hA.d.ts} +15 -1
  161. package/dist/svelte/index.d.ts +5 -5
  162. package/dist/{tenant-BRmKZ7aq.d.ts → tenant-CyLEXgot.d.ts} +1 -1
  163. package/dist/testing/index.d.ts +3 -3
  164. package/dist/testing/index.js +2 -2
  165. package/dist/{topic-CpsKVBot.d.ts → topic-B_DGdAEs.d.ts} +1 -1
  166. package/dist/{topic-F0FKzJyQ.js → topic-DnsNG4Kj.js} +1 -1
  167. package/dist/{types-CjRwmCRP.d.ts → types-DF8JYEf5.d.ts} +2 -2
  168. package/dist/vue/index.d.ts +5 -5
  169. package/dist/{watch-topic-BaMZX139.d.ts → watch-topic-1zIAtiNM.d.ts} +1 -1
  170. package/dist/workflow-sdk/world/index.js +1 -1
  171. package/dist/{workflow-sdk-CE8sEK57.js → workflow-sdk-CaEw822d.js} +25 -4
  172. package/dist/yjs/index.d.ts +1 -1
  173. package/dist/yjs/index.js +1 -1
  174. package/package.json +11 -1
  175. package/schemas/config-v1.json +42 -0
  176. package/dist/cli/add-Bf1fyCWm.js +0 -1
  177. package/dist/cli/env-xhwXk5Ri.js +0 -1
  178. package/dist/cli/in-stack-diff-DQTW53Vf.js +0 -257
  179. package/dist/cli/powersync-Dq-txa0_.js +0 -1
  180. package/dist/cli/seed-CO3j_bly.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import { M as Casing } from "../types-DFdg_4yN.js";
2
- import { A as tenantNameOf, C as EntityConfig, D as OwnTablePolicies, S as EntitiesConfig, a as AuthorizationProvider, b as DEFAULT_ACTIVE_TENANT, c as AuthorizationScope, d as AccessBlockConfig, f as ActiveTenantSource, g as BlockMode, i as AuthorizationPermission, l as AuthorizationTokenHook, m as BlockConfig, n as AuthorizationMembership, o as AuthorizationRequirement, p as AnyBlocksConfig, r as AuthorizationOperation, s as AuthorizationRoleSource, t as AuthorizationFunctions, u as providerApiProblem, v as BlockScope, x as DisabledRow, y as BlocksConfig } from "../authorization-BJV2i8xB.js";
3
- import { $ as blockEntrySource, $n as APP_COLUMN_ACCESS, $r as RpcTypeReference, $t as ResolvedExtensions, A as ValibotGeneratorOptions, Ai as MigrationSafetyConfig, An as ExposePrivilege, Ar as CatalogIndex, At as GeneratedFile, B as jsonSchema, Br as ForeignKeyAction, Bt as GeneratorInputSchema, Cn as TopicTriggerPayloadValueConfig, Cr as CatalogColumn, D as ZodFlavor, Di as GenTask, Dn as VectorSearchConfig, Dr as CatalogFunction, Dt as resolveJsonSchema, Ei as GenConfig, En as VectorDistance, Er as CatalogForeignKey, F as nuqs, Fi as GEN_TASKS, Fr as ExtrasDomain, Ft as GeneratorEntitySchemas, G as tenantClaimPaths, Gr as PostgresColumn, Gt as JsonSchemaSource, H as ClaimPaths, Hr as SnapshotBucket, Ht as GeneratorModel, I as FactoriesGeneratorOptions, Ii as INTEGRATION_INFO, Ir as ExtrasFunction, It as GeneratorField, J as blockEntityRenames, Jn as CONFIG_DEFAULTS, Jr as RpcFunction, Jt as SourceConfig, K as BlockEntity, Kr as PostgresFunction, Kt as JsonTypeConfig, L as factories, Li as INTEGRATION_NAMES, Lr as ExtrasHook, Lt as GeneratorFunction, M as StandardSchemaGeneratorOptions, Mi as PowerSyncGenConfig, Mn as Privilege, Mr as CatalogTable, Mt as GeneratorBlock, N as standardSchema, Ni as SkillsAgent, Nn as ResolvedExpose, Nr as CatalogTrigger, Nt as GeneratorBlockEntity, O as ZodGeneratorOptions, Oi as IntegrationName, On as ColumnPrivilege, Or as CatalogFunctionArg, Ot as ClaimsConfig, P as NuqsGeneratorOptions, Pi as SkillsConfig, Pr as CatalogUnique, Pt as GeneratorColumn, Q as RENAMED_CONFIG_KEYS, Qr as RpcReturnColumn, Qt as ResolvedConfig, R as JsonSchemaGeneratorOptions, Ri as IntegrationInfo, Rr as ExtrasHookFunction, Rt as GeneratorFunctionArg, Sn as TopicTriggerLookupConfig, Sr as CatalogCheck, Ti as EnvFileConfig, Tn as TopicTriggerValueConfig, Tr as CatalogEnum, U as DEFAULT_CLAIMS, Ur as SnapshotExtras, Ut as GeneratorNoun, V as JsonSchemaTarget, Vr as Snapshot, Vt as GeneratorJsonSchema, W as claimPaths, Wr as GeneratorMetadata, Wt as GeneratorTable, X as CONFIG_GROUPS, Xr as RpcFunctionOverload, Xt as DataHooksFramework, Y as blockSubjectTypes, Yr as RpcFunctionArg, Yt as TableConfig, Z as RENAMED_BLOCK_KEYS, Zr as RpcFunctionReturns, Zt as FlatConfig, _n as ResolvedSqlConfig, _r as AppTableEvents, an as BlockInput, ar as AppColumnAccess, at as defineConfig, bn as SqlWorkflow, br as AppTablesConfig, cn as EnvironmentConfig, cr as AppColumnType, ct as BlockTableReference, dn as SqlInput, dr as AppReference, dt as RoleNames, en as ApiConfig, er as APP_COLUMN_FORMATS, et as flattenConfig, fn as ToolingConfig, fr as AppReferenceTarget, ft as TypedReference, gn as RealtimeConfig, gr as AppTableEventKind, hn as BucketConfig, hr as AppTableConfig, in as BetterSupabaseConfig, ir as APP_TABLE_EVENT_KINDS, it as CONFIG_SCHEMA_URL, j as valibot, ji as OpenApiConfig, jn as ExposeRole, jr as CatalogPolicy, jt as Generator, k as zod, ki as KeysConfig, kn as ExposeConfig, kr as CatalogGrant, kt as CodecsConfig, ln as GenGroupConfig, lr as AppLookupConfig, lt as BucketName, mn as EntitlementsConfig, mr as AppRollupConfig, mt as ExpandedConfig, nn as AppTablesInput, nr as APP_ON_DELETE_ACTIONS, nt as groupEntries, on as BlocksInput, or as AppColumnConfig, ot as resolveConfig, pn as EntitlementPlansSource, pr as AppRollupAggregate, q as blockEntities, qr as PostgresFunctionArg, qt as RelationsConfig, rn as AuthConfig, rr as APP_ROLLUP_AGGREGATES, rt as hasFlatTables, sn as DatabaseConfig, sr as AppColumnFormat, st as AppTableNames, tn as AppTableInput, tr as APP_COLUMN_TYPES, tt as groupConfig, un as OrganizationConfig, ur as AppOnDeleteAction, ut as ConfigReferences, vn as SeedConfig, vr as AppTableSubject, wi as DoctorConfig, wn as TopicTriggerTopicConfig, wr as CatalogColumnGrant, xn as TopicTriggerConfig, xr as Catalog, yn as SqlConfig, yr as AppTableVersions, z as buildJsonSchema, zi as SKILLS_AGENTS, zr as ExtrasTable, zt as GeneratorInput } from "../context-BJoHD20l.js";
4
- import { i as SubjectsConfig, n as SubjectPermission, r as SubjectSearch, t as SubjectConfig } from "../subjects-NomQg6Eg.js";
2
+ import { A as tenantNameOf, C as EntityConfig, D as OwnTablePolicies, S as EntitiesConfig, a as AuthorizationProvider, b as DEFAULT_ACTIVE_TENANT, c as AuthorizationScope, d as AccessBlockConfig, f as ActiveTenantSource, g as BlockMode, i as AuthorizationPermission, l as AuthorizationTokenHook, m as BlockConfig, n as AuthorizationMembership, o as AuthorizationRequirement, p as AnyBlocksConfig, r as AuthorizationOperation, s as AuthorizationRoleSource, t as AuthorizationFunctions, u as providerApiProblem, v as BlockScope, x as DisabledRow, y as BlocksConfig } from "../authorization-BCG1v0iC.js";
3
+ import { $ as JsonSchemaTarget, $r as Snapshot, $t as GeneratorJsonSchema, An as SeedConfig, Ar as AppTableSubject, B as ZodGeneratorOptions, Bi as IntegrationName, Bn as ColumnPrivilege, Br as CatalogFunctionArg, Bt as ClaimsConfig, Cn as SqlInput, Cr as AppReference, Ct as RoleNames, Dn as BucketConfig, Dr as AppTableConfig, En as EntitlementsConfig, Er as AppRollupConfig, Et as ExpandedConfig, Fn as TopicTriggerPayloadValueConfig, Fr as CatalogColumn, G as standardSchema, Gi as SkillsAgent, Gn as ResolvedExpose, Gr as CatalogTrigger, Gt as GeneratorBlockEntity, H as ValibotGeneratorOptions, Hi as MigrationSafetyConfig, Hn as ExposePrivilege, Hr as CatalogIndex, Ht as GeneratedFile, Ii as DoctorConfig, In as TopicTriggerTopicConfig, Ir as CatalogColumnGrant, J as FactoriesGeneratorOptions, Ji as INTEGRATION_INFO, Jr as ExtrasFunction, Jt as GeneratorField, K as NuqsGeneratorOptions, Ki as SkillsConfig, Kr as CatalogUnique, Kt as GeneratorColumn, Li as EnvFileConfig, Ln as TopicTriggerValueConfig, Lr as CatalogEnum, Mn as SqlWorkflow, Mr as AppTablesConfig, Nn as TopicTriggerConfig, Nr as Catalog, On as RealtimeConfig, Or as AppTableEventKind, Pn as TopicTriggerLookupConfig, Pr as CatalogCheck, Q as jsonSchema, Qr as ForeignKeyAction, Qt as GeneratorInputSchema, Ri as GenConfig, Rn as VectorDistance, Rr as CatalogForeignKey, Sn as OrganizationConfig, Sr as AppOnDeleteAction, St as ConfigReferences, Tn as EntitlementPlansSource, Tr as AppRollupAggregate, U as valibot, Ui as OpenApiConfig, Un as ExposeRole, Ur as CatalogPolicy, Ut as Generator, V as zod, Vi as KeysConfig, Vn as ExposeConfig, Vr as CatalogGrant, Vt as CodecsConfig, W as StandardSchemaGeneratorOptions, Wi as PowerSyncGenConfig, Wn as Privilege, Wr as CatalogTable, Wt as GeneratorBlock, X as JsonSchemaGeneratorOptions, Xi as IntegrationInfo, Xr as ExtrasHookFunction, Xt as GeneratorFunctionArg, Y as factories, Yi as INTEGRATION_NAMES, Yr as ExtrasHook, Yt as GeneratorFunction, Z as buildJsonSchema, Zi as SKILLS_AGENTS, Zr as ExtrasTable, Zt as GeneratorInput, _n as BlockInput, _r as AppColumnAccess, _t as defineConfig, ai as PostgresFunctionArg, an as RelationsConfig, at as blockEntities, bn as EnvironmentConfig, br as AppColumnType, bt as BlockTableReference, ci as RpcFunctionOverload, cn as DataHooksFramework, ct as CONFIG_GROUPS, di as RpcTypeReference, dn as ResolvedExtensions, dr as APP_COLUMN_ACCESS, dt as blockEntrySource, ei as SnapshotBucket, en as GeneratorModel, et as ClaimPaths, fn as ApiConfig, fr as APP_COLUMN_FORMATS, ft as flattenConfig, gn as BetterSupabaseConfig, gr as APP_TABLE_EVENT_KINDS, gt as CONFIG_SCHEMA_URL, hn as AuthConfig, hr as APP_ROLLUP_AGGREGATES, ht as hasFlatTables, ii as PostgresFunction, in as JsonTypeConfig, it as BlockEntity, jn as SqlConfig, jr as AppTableVersions, kn as ResolvedSqlConfig, kr as AppTableEvents, li as RpcFunctionReturns, ln as FlatConfig, lt as RENAMED_BLOCK_KEYS, mn as AppTablesInput, mr as APP_ON_DELETE_ACTIONS, mt as groupEntries, ni as GeneratorMetadata, nn as GeneratorTable, nt as claimPaths, oi as RpcFunction, on as SourceConfig, or as CONFIG_DEFAULTS, ot as blockEntityRenames, pn as AppTableInput, pr as APP_COLUMN_TYPES, pt as groupConfig, q as nuqs, qi as GEN_TASKS, qr as ExtrasDomain, qt as GeneratorEntitySchemas, ri as PostgresColumn, rn as JsonSchemaSource, rt as tenantClaimPaths, si as RpcFunctionArg, sn as TableConfig, st as blockSubjectTypes, ti as SnapshotExtras, tn as GeneratorNoun, tt as DEFAULT_CLAIMS, ui as RpcReturnColumn, un as ResolvedConfig, ut as RENAMED_CONFIG_KEYS, vn as BlocksInput, vr as AppColumnConfig, vt as resolveConfig, wn as ToolingConfig, wr as AppReferenceTarget, wt as TypedReference, xn as GenGroupConfig, xr as AppLookupConfig, xt as BucketName, yn as DatabaseConfig, yr as AppColumnFormat, yt as AppTableNames, z as ZodFlavor, zi as GenTask, zn as VectorSearchConfig, zr as CatalogFunction, zt as resolveJsonSchema } from "../context-BFEX0b7H.js";
4
+ import { i as SubjectsConfig, n as SubjectPermission, r as SubjectSearch, t as SubjectConfig } from "../subjects-BYCL-6hA.js";
5
5
  import { a as FieldFormat, o as FieldFormatInput, r as FIELD_FORMATS } from "../field-formats-CAFNkKSN.js";
6
6
  export { APP_COLUMN_ACCESS, APP_COLUMN_FORMATS, APP_COLUMN_TYPES, APP_ON_DELETE_ACTIONS, APP_ROLLUP_AGGREGATES, APP_TABLE_EVENT_KINDS, type AccessBlockConfig, type ActiveTenantSource, type AnyBlocksConfig, type ApiConfig, type AppColumnAccess, type AppColumnConfig, type AppColumnFormat, type AppColumnType, type AppLookupConfig, type AppOnDeleteAction, type AppReference, type AppReferenceTarget, type AppRollupAggregate, type AppRollupConfig, type AppTableConfig, type AppTableEventKind, type AppTableEvents, type AppTableInput, type AppTableNames, type AppTableSubject, type AppTableVersions, type AppTablesConfig, type AppTablesInput, type AuthConfig, type AuthorizationFunctions, type AuthorizationMembership, type AuthorizationOperation, type AuthorizationPermission, type AuthorizationProvider, type AuthorizationRequirement, type AuthorizationRoleSource, type AuthorizationScope, type AuthorizationTokenHook, type BetterSupabaseConfig, type BlockConfig, type BlockEntity, type BlockInput, type BlockMode, type BlockScope, type BlockTableReference, type BlocksConfig, type BlocksInput, type BucketConfig, type BucketName, CONFIG_DEFAULTS, CONFIG_GROUPS, CONFIG_SCHEMA_URL, type Casing, type Catalog, type CatalogCheck, type CatalogColumn, type CatalogColumnGrant, type CatalogEnum, type CatalogForeignKey, type CatalogFunction, type CatalogFunctionArg, type CatalogGrant, type CatalogIndex, type CatalogPolicy, type CatalogTable, type CatalogTrigger, type CatalogUnique, type ClaimPaths, type ClaimsConfig, type CodecsConfig, type ColumnPrivilege, type ConfigReferences, DEFAULT_ACTIVE_TENANT, DEFAULT_CLAIMS, type DataHooksFramework, type DatabaseConfig, type DisabledRow, type DoctorConfig, type EntitiesConfig, type EntitlementPlansSource, type EntitlementsConfig, type EntityConfig, type EnvFileConfig, type EnvironmentConfig, type ExpandedConfig, type ExposeConfig, type ExposePrivilege, type ExposeRole, type ExtrasDomain, type ExtrasFunction, type ExtrasHook, type ExtrasHookFunction, type ExtrasTable, FIELD_FORMATS, type FactoriesGeneratorOptions, type FieldFormat, type FieldFormatInput, type FlatConfig, type ForeignKeyAction, GEN_TASKS, type GenConfig, type GenGroupConfig, type GenTask, type GeneratedFile, type Generator, type GeneratorBlock, type GeneratorBlockEntity, type GeneratorColumn, type GeneratorEntitySchemas, type GeneratorField, type GeneratorFunction, type GeneratorFunctionArg, type GeneratorInput, type GeneratorInputSchema, type GeneratorJsonSchema, type GeneratorMetadata, type GeneratorModel, type GeneratorNoun, type GeneratorTable, INTEGRATION_INFO, INTEGRATION_NAMES, type IntegrationInfo, type IntegrationName, type JsonSchemaGeneratorOptions, type JsonSchemaSource, type JsonSchemaTarget, type JsonTypeConfig, type KeysConfig, type MigrationSafetyConfig, type NuqsGeneratorOptions, type OpenApiConfig, type OrganizationConfig, type OwnTablePolicies, type PostgresColumn, type PostgresFunction, type PostgresFunctionArg, type PowerSyncGenConfig, type Privilege, RENAMED_BLOCK_KEYS, RENAMED_CONFIG_KEYS, type RealtimeConfig, type RelationsConfig, type ResolvedConfig, type ResolvedExpose, type ResolvedExtensions, type ResolvedSqlConfig, type RoleNames, type RpcFunction, type RpcFunctionArg, type RpcFunctionOverload, type RpcFunctionReturns, type RpcReturnColumn, type RpcTypeReference, SKILLS_AGENTS, type SeedConfig, type SkillsAgent, type SkillsConfig, type Snapshot, type SnapshotBucket, type SnapshotExtras, type SourceConfig, type SqlConfig, type SqlInput, type SqlWorkflow, type StandardSchemaGeneratorOptions, type SubjectConfig, type SubjectPermission, type SubjectSearch, type SubjectsConfig, type TableConfig, type ToolingConfig, type TopicTriggerConfig, type TopicTriggerLookupConfig, type TopicTriggerPayloadValueConfig, type TopicTriggerTopicConfig, type TopicTriggerValueConfig, type TypedReference, type ValibotGeneratorOptions, type VectorDistance, type VectorSearchConfig, type ZodFlavor, type ZodGeneratorOptions, blockEntities, blockEntityRenames, blockEntrySource, blockSubjectTypes, buildJsonSchema, claimPaths, defineConfig, factories, flattenConfig, groupConfig, groupEntries, hasFlatTables, jsonSchema, nuqs, providerApiProblem, resolveConfig, resolveJsonSchema, standardSchema, tenantClaimPaths, tenantNameOf, valibot, zod };
@@ -1,8 +1,8 @@
1
- import { n as resolveJsonSchema, r as CONFIG_DEFAULTS } from "../resolved-names-Dsf28_Dr.js";
2
- import { A as flattenConfig, D as RENAMED_BLOCK_KEYS, E as CONFIG_GROUPS, F as INTEGRATION_INFO, I as INTEGRATION_NAMES, L as SKILLS_AGENTS, M as groupEntries, N as hasFlatTables, O as RENAMED_CONFIG_KEYS, P as GEN_TASKS, j as groupConfig, k as blockEntrySource } from "../config-C19McoGo.js";
1
+ import { n as resolveJsonSchema, r as CONFIG_DEFAULTS } from "../resolved-names-iLBOUaib.js";
2
+ import { A as flattenConfig, D as RENAMED_BLOCK_KEYS, E as CONFIG_GROUPS, F as INTEGRATION_INFO, I as INTEGRATION_NAMES, L as SKILLS_AGENTS, M as groupEntries, N as hasFlatTables, O as RENAMED_CONFIG_KEYS, P as GEN_TASKS, j as groupConfig, k as blockEntrySource } from "../config-CvJHIy5q.js";
3
3
  import { a as tenantClaimPaths, r as claimPaths, t as DEFAULT_CLAIMS } from "../claims-Bp9My7XP.js";
4
- import { A as APP_ROLLUP_AGGREGATES, D as APP_COLUMN_FORMATS, E as APP_COLUMN_ACCESS, L as tenantNameOf, O as APP_COLUMN_TYPES, P as DEFAULT_ACTIVE_TENANT, j as APP_TABLE_EVENT_KINDS, k as APP_ON_DELETE_ACTIONS } from "../instances-qz2MCMyK.js";
4
+ import { A as APP_ROLLUP_AGGREGATES, D as APP_COLUMN_FORMATS, E as APP_COLUMN_ACCESS, L as tenantNameOf, O as APP_COLUMN_TYPES, P as DEFAULT_ACTIVE_TENANT, j as APP_TABLE_EVENT_KINDS, k as APP_ON_DELETE_ACTIONS } from "../instances-C7qUTjhJ.js";
5
5
  import { r as FIELD_FORMATS } from "../field-formats-C6QKA3UR.js";
6
- import { a as factories, c as resolveConfig, d as blockSubjectTypes, f as providerApiProblem, i as nuqs, l as blockEntities, n as valibot, o as CONFIG_SCHEMA_URL, r as standardSchema, s as defineConfig, t as zod, u as blockEntityRenames } from "../config-CP-WaboC.js";
6
+ import { a as factories, c as resolveConfig, d as blockSubjectTypes, f as providerApiProblem, i as nuqs, l as blockEntities, n as valibot, o as CONFIG_SCHEMA_URL, r as standardSchema, s as defineConfig, t as zod, u as blockEntityRenames } from "../config-CTeR7XHK.js";
7
7
  import { n as jsonSchema, t as buildJsonSchema } from "../json-schema-DHJxiizN.js";
8
8
  export { APP_COLUMN_ACCESS, APP_COLUMN_FORMATS, APP_COLUMN_TYPES, APP_ON_DELETE_ACTIONS, APP_ROLLUP_AGGREGATES, APP_TABLE_EVENT_KINDS, CONFIG_DEFAULTS, CONFIG_GROUPS, CONFIG_SCHEMA_URL, DEFAULT_ACTIVE_TENANT, DEFAULT_CLAIMS, FIELD_FORMATS, GEN_TASKS, INTEGRATION_INFO, INTEGRATION_NAMES, RENAMED_BLOCK_KEYS, RENAMED_CONFIG_KEYS, SKILLS_AGENTS, blockEntities, blockEntityRenames, blockEntrySource, blockSubjectTypes, buildJsonSchema, claimPaths, defineConfig, factories, flattenConfig, groupConfig, groupEntries, hasFlatTables, jsonSchema, nuqs, providerApiProblem, resolveConfig, resolveJsonSchema, standardSchema, tenantClaimPaths, tenantNameOf, valibot, zod };
@@ -1,8 +1,8 @@
1
- import { r as CONFIG_DEFAULTS, t as resolveNames } from "./resolved-names-Dsf28_Dr.js";
2
- import { A as flattenConfig, n as expandFlatPreset, r as expandPreset } from "./config-C19McoGo.js";
1
+ import { r as CONFIG_DEFAULTS, t as resolveNames } from "./resolved-names-iLBOUaib.js";
2
+ import { A as flattenConfig, n as expandFlatPreset, r as expandPreset } from "./config-CvJHIy5q.js";
3
3
  import { t as DEFAULT_CLAIMS } from "./claims-Bp9My7XP.js";
4
4
  import { o as tenantNames } from "./entity-naming-Dtyq5sKE.js";
5
- import { I as resolveBlock, L as tenantNameOf, M as PRESET_CATALOG, _ as appTablesOf, o as resolveInstances, r as blocksByName, v as withAppTableSubjects } from "./instances-qz2MCMyK.js";
5
+ import { I as resolveBlock, L as tenantNameOf, M as PRESET_CATALOG, _ as appTablesOf, o as resolveInstances, r as blocksByName, v as withAppTableSubjects } from "./instances-C7qUTjhJ.js";
6
6
  import { C as variantsFor, S as variantTitle, _ as schemaName, a as extraSchemas, b as tableEntries, c as resultType, d as fieldSpec, f as fieldsFor, g as rowType, h as propertyKey, i as extraKinds, l as HEADER, m as parseImport, o as fieldMetaLines, p as optionalLine, s as objectType, u as fieldDocs, v as siblingPath, x as temporalGuardImport, y as tableDocs } from "./json-schema-DHJxiizN.js";
7
7
  //#region src/config/authorization.ts
8
8
  /**
@@ -1,5 +1,5 @@
1
1
  import { t as DEFAULT_TENANT } from "./entity-naming-Dtyq5sKE.js";
2
- import { F as asBlocksConfig, M as PRESET_CATALOG } from "./instances-qz2MCMyK.js";
2
+ import { F as asBlocksConfig, M as PRESET_CATALOG } from "./instances-C7qUTjhJ.js";
3
3
  //#region src/config/names.ts
4
4
  /** The steps `better-supabase gen` runs, in the order it runs them. */
5
5
  const GEN_TASKS = [
@@ -1,9 +1,9 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { M as Casing, P as ClaimsMeta, T as AccessBucketPolicy, _t as BucketLifecycle, j as BucketPolicyName, ot as SchemaMeta } from "./types-DFdg_4yN.js";
3
- import { D as OwnTablePolicies, E as NamedInstance, I as TablesOf, L as BlockNameRegistry, O as ResolvedBlock, T as InstanceOn, _ as BlockName, a as AuthorizationProvider, d as AccessBlockConfig, g as BlockMode, h as BlockConfigOf, m as BlockConfig, n as AuthorizationMembership, p as AnyBlocksConfig, r as AuthorizationOperation, s as AuthorizationRoleSource, t as AuthorizationFunctions, v as BlockScope, w as InstanceKeys, x as DisabledRow, y as BlocksConfig } from "./authorization-BJV2i8xB.js";
3
+ import { D as OwnTablePolicies, E as NamedInstance, I as TablesOf, L as BlockNameRegistry, O as ResolvedBlock, T as InstanceOn, _ as BlockName, a as AuthorizationProvider, d as AccessBlockConfig, g as BlockMode, h as BlockConfigOf, m as BlockConfig, n as AuthorizationMembership, p as AnyBlocksConfig, r as AuthorizationOperation, s as AuthorizationRoleSource, t as AuthorizationFunctions, v as BlockScope, w as InstanceKeys, x as DisabledRow, y as BlocksConfig } from "./authorization-BCG1v0iC.js";
4
4
  import { Mn as EntityNames, Nn as EntityNoun, Pn as EntityRename, R as PortName, Ut as ActionDescriptor, Xt as BlockSchedule, Zt as DefaultAutomation, _ as BlockProvider, g as BlockEnvKey, i as BlockCategory, y as BlockWorker } from "./define-block-DibVN37N.js";
5
5
  import { a as ScalarKind, i as FieldSpec } from "./table-schema-BlF6k62Q.js";
6
- import { i as SubjectsConfig } from "./subjects-NomQg6Eg.js";
6
+ import { i as SubjectsConfig } from "./subjects-BYCL-6hA.js";
7
7
  import { i as FIELD_FORMAT_NAMES, s as FieldFormatName } from "./field-formats-CAFNkKSN.js";
8
8
  import { t as GuestAction } from "./guest-actions-1T1DeS5Y.js";
9
9
  //#region src/config/names.d.ts
@@ -3211,6 +3211,97 @@ interface VectorSearchTable {
3211
3211
  readonly order?: string;
3212
3212
  }
3213
3213
  //#endregion
3214
+ //#region src/sql/schema-scan.d.ts
3215
+ /** Privileges one role gets on a table, from the policies that name it. */
3216
+ interface PolicyGrant {
3217
+ /** `schema.table`, unquoted; an unqualified name is in `public`. */
3218
+ readonly table: string;
3219
+ readonly role: "anon" | "authenticated";
3220
+ readonly privileges: readonly ("select" | "insert" | "update" | "delete")[];
3221
+ }
3222
+ /**
3223
+ * The tables `files` create (`create table`), as `schema.table`, in the order
3224
+ * they first appear. Only tables in `schemas` are kept.
3225
+ */
3226
+ declare function declaredTables(files: readonly {
3227
+ readonly text: string;
3228
+ }[], schemas: readonly string[]): string[];
3229
+ /** A view the app's files create. */
3230
+ interface DeclaredView {
3231
+ /** Its columns, or `undefined` when they can't be read (`select *`). */
3232
+ readonly columns: readonly string[] | undefined;
3233
+ /** Whether `insert`, `update` and `delete` reach the table under it. */
3234
+ readonly updatable: boolean;
3235
+ }
3236
+ /**
3237
+ * The views and materialized views `files` create, as `schema.view`, with their
3238
+ * columns and whether they are auto-updatable. A later `drop view` removes one.
3239
+ * Only views in `schemas` are kept.
3240
+ */
3241
+ declare function declaredViews(files: readonly {
3242
+ readonly text: string;
3243
+ }[], schemas: readonly string[]): ReadonlyMap<string, DeclaredView>;
3244
+ /**
3245
+ * The tables in `schemas` that `files` leave with row level security on: `alter
3246
+ * table ... enable row level security`, until a later `disable` or `drop
3247
+ * table`.
3248
+ */
3249
+ declare function rlsTables(files: readonly {
3250
+ readonly text: string;
3251
+ }[], schemas: readonly string[]): string[];
3252
+ /**
3253
+ * Columns each `create table` in `files` declares, as `schema.table` to
3254
+ * unquoted names. `like` and table constraints are skipped. Only tables in
3255
+ * `schemas` are kept.
3256
+ */
3257
+ declare function declaredTableColumns(files: readonly {
3258
+ readonly text: string;
3259
+ }[], schemas: readonly string[]): ReadonlyMap<string, ReadonlySet<string>>;
3260
+ /**
3261
+ * The declared type of each column of each `create table` in `files`, as
3262
+ * `schema.table` to unquoted column name to type. A type is lower-cased with
3263
+ * its spacing normalised, and a quoted part keeps its case without quotes. Only
3264
+ * tables in `schemas` are kept.
3265
+ */
3266
+ declare function declaredColumnTypes(files: readonly {
3267
+ readonly text: string;
3268
+ }[], schemas: readonly string[]): ReadonlyMap<string, ReadonlyMap<string, string>>;
3269
+ /**
3270
+ * The privileges the permissive policies in `files` imply, per table and role:
3271
+ * `for all` gives the four commands, `to public` (or no `to`) counts for
3272
+ * `authenticated` only, so `anon` needs a policy that names it. Restrictive
3273
+ * policies grant nothing. Only tables in `schemas` are kept.
3274
+ */
3275
+ declare function policyGrants(files: readonly {
3276
+ readonly text: string;
3277
+ }[], schemas: readonly string[]): PolicyGrant[];
3278
+ declare function extensionSchema(sources: readonly {
3279
+ readonly text: string;
3280
+ }[], extension: string): string | undefined;
3281
+ /**
3282
+ * The update trigger that keeps `updated_at` current on each table in `schemas`
3283
+ * the files create one on, by `schema.table`: its function is named like one
3284
+ * (`set_updated_at`, `moddatetime`, `touch_*`) or the files define it with
3285
+ * `new.updated_at :=`. Block triggers (`bsb_*`) don't count.
3286
+ */
3287
+ declare function declaredUpdatedAtTriggers(files: readonly {
3288
+ readonly text: string;
3289
+ }[], schemas: readonly string[]): Readonly<Record<string, string>>;
3290
+ /** A full btree index, by its name when it has one, and its leading columns. */
3291
+ interface OwnIndex {
3292
+ readonly name?: string;
3293
+ readonly columns: readonly string[];
3294
+ }
3295
+ /**
3296
+ * The leading columns of every full btree index the files give each table in
3297
+ * `schemas`: `create index` statements, and the primary keys and unique
3298
+ * constraints in `create table`. Partial indexes and other methods are left
3299
+ * out, since they don't answer every lookup.
3300
+ */
3301
+ declare function declaredIndexes(files: readonly {
3302
+ readonly text: string;
3303
+ }[], schemas: readonly string[]): ReadonlyMap<string, readonly OwnIndex[]>;
3304
+ //#endregion
3214
3305
  //#region src/sql/shared.d.ts
3215
3306
  /**
3216
3307
  * The name `addNotNullCheck` gives the check on `column` of `table`, both
@@ -3364,6 +3455,11 @@ interface BlockSql {
3364
3455
  readonly scope: "tenant" | "platform";
3365
3456
  readonly setting: string;
3366
3457
  }[];
3458
+ /**
3459
+ * Actions of the module's `OPERATIONS` this config never checks, so their
3460
+ * keys aren't reported to the authorization provider.
3461
+ */
3462
+ readonly unusedPermissions?: (ctx: BlockSqlContext) => readonly string[];
3367
3463
  /**
3368
3464
  * Functions granted to `anon` or `authenticated` only so the module's
3369
3465
  * policies and triggers can call them as the client. `api` writes no entry
@@ -3515,6 +3611,11 @@ interface BlockSqlLayout {
3515
3611
  readonly ownTables?: Readonly<Record<string, string>>;
3516
3612
  /** The columns of the tables in `ownTables`, where they are known. */
3517
3613
  readonly ownColumns?: Readonly<Record<string, readonly string[]>>;
3614
+ /**
3615
+ * The leading columns of each full btree index on a table in `ownTables`, by
3616
+ * `schema.table`. A block adds no plain index that one of them covers.
3617
+ */
3618
+ readonly ownIndexes?: Readonly<Record<string, readonly OwnIndex[]>>;
3518
3619
  /**
3519
3620
  * The entries of `ownTables` that are views or materialized views, by
3520
3621
  * `schema.view`, and whether Postgres can write through each one. A block
@@ -4032,6 +4133,8 @@ interface BlockSqlContext extends BlockSqlValueMethods {
4032
4133
  readonly modules: AnyBlocksConfig;
4033
4134
  /** The app-wide subject registry (`config.records`). */
4034
4135
  readonly subjects: SubjectsConfig;
4136
+ /** The provider's `rowsWith` template under the `provider` model. */
4137
+ readonly providerRowsWith: string | undefined;
4035
4138
  /**
4036
4139
  * The names of `config.appTables`, created in `public` after every block
4037
4140
  * file, so a block can't put a trigger on one (ADR 0043).
@@ -4243,4 +4346,4 @@ interface ExtraColumn {
4243
4346
  /** The contract's argument list with `{id}` resolved, as Postgres prints it. */
4244
4347
  declare function contractSignature(fn: BlockSqlContractFunction, idType: string): string;
4245
4348
  //#endregion
4246
- export { blockEntrySource as $, APP_COLUMN_ACCESS as $n, RpcTypeReference as $r, ResolvedExtensions as $t, ValibotGeneratorOptions as A, MigrationSafetyConfig as Ai, ExposePrivilege as An, CatalogIndex as Ar, GeneratedFile as At, jsonSchema as B, PRESETS as Bn, ForeignKeyAction as Br, GeneratorInputSchema as Bt, OwnView as C, presetValueLabel as Ci, TopicTriggerPayloadValueConfig as Cn, CatalogColumn as Cr, ResolvedPresetBlock as Ct, ZodFlavor as D, GenTask as Di, VectorSearchConfig as Dn, CatalogFunction as Dr, resolveJsonSchema as Dt, TableGrant as E, GenConfig as Ei, VectorDistance as En, CatalogForeignKey as Er, resolvePreset as Et, nuqs as F, GEN_TASKS as Fi, presetFromSpec as Fn, ExtrasDomain as Fr, GeneratorEntitySchemas as Ft, tenantClaimPaths as G, defaultPreset as Gn, PostgresColumn as Gr, JsonSchemaSource as Gt, ClaimPaths as H, PRESET_NAMES as Hn, SnapshotBucket as Hr, GeneratorModel as Ht, FactoriesGeneratorOptions as I, INTEGRATION_INFO as Ii, presetOfSpec as In, ExtrasFunction as Ir, GeneratorField as It, blockEntityRenames as J, CONFIG_DEFAULTS as Jn, RpcFunction as Jr, SourceConfig as Jt, BlockEntity as K, isPresetName as Kn, PostgresFunction as Kr, JsonTypeConfig as Kt, factories as L, INTEGRATION_NAMES as Li, presetSpec as Ln, ExtrasHook as Lr, GeneratorFunction as Lt, StandardSchemaGeneratorOptions as M, PowerSyncGenConfig as Mi, Privilege as Mn, CatalogTable as Mr, GeneratorBlock as Mt, standardSchema as N, SkillsAgent as Ni, ResolvedExpose as Nn, CatalogTrigger as Nr, GeneratorBlockEntity as Nt, ZodGeneratorOptions as O, IntegrationName as Oi, ColumnPrivilege as On, CatalogFunctionArg as Or, ClaimsConfig as Ot, NuqsGeneratorOptions as P, SkillsConfig as Pi, PresetSpec as Pn, CatalogUnique as Pr, GeneratorColumn as Pt, RENAMED_CONFIG_KEYS as Q, auditRegistrations as Qn, RpcReturnColumn as Qr, ResolvedConfig as Qt, JsonSchemaGeneratorOptions as R, IntegrationInfo as Ri, DEFAULT_PRESET_NAME as Rn, ExtrasHookFunction as Rr, GeneratorFunctionArg as Rt, BlockSqlUpgrade as S, presetField as Si, TopicTriggerLookupConfig as Sn, CatalogCheck as Sr, ResolvedPreset as St, notNullCheckName as T, EnvFileConfig as Ti, TopicTriggerValueConfig as Tn, CatalogEnum as Tr, presetBlockConflict as Tt, DEFAULT_CLAIMS as U, PresetGroup as Un, SnapshotExtras as Ur, GeneratorNoun as Ut, JsonSchemaTarget as V, PRESET_GROUPS as Vn, Snapshot as Vr, GeneratorJsonSchema as Vt, claimPaths as W, PresetName as Wn, GeneratorMetadata as Wr, GeneratorTable as Wt, CONFIG_GROUPS as X, sameTenantLayout as Xn, RpcFunctionOverload as Xr, DataHooksFramework as Xt, blockSubjectTypes as Y, DeclaredForeignKey as Yn, RpcFunctionArg as Yr, TableConfig as Yt, RENAMED_BLOCK_KEYS as Z, AuditedTable as Zn, RpcFunctionReturns as Zr, FlatConfig as Zt, BlockSqlDeprecation as _, PresetFramework as _i, ResolvedSqlConfig as _n, AppTableEvents as _r, expandPreset as _t, BlockSqlContext as a, PresetCatalogManifest as ai, BlockInput as an, AppColumnAccess as ar, defineConfig as at, BlockSqlLayout as b, PresetValueInfo as bi, SqlWorkflow as bn, AppTablesConfig as br, PresetConflict as bt, BlockSqlIdType as c, DEFAULT_CONVENTIONS as ci, EnvironmentConfig as cn, AppColumnType as cr, BlockTableReference as ct, MODULE_ID_TYPES as d, Preset as di, SqlInput as dn, AppReference as dr, RoleNames as dt, CORE_BLOCKS as ei, ApiConfig as en, APP_COLUMN_FORMATS as er, flattenConfig as et, contractSignature as f, PresetAccess as fi, ToolingConfig as fn, AppReferenceTarget as fr, TypedReference as ft, BlockSqlAccessProvider as g, PresetFieldValue as gi, RealtimeConfig as gn, AppTableEventKind as gr, conventionConfig as gt, BlockSql as h, PresetFieldKey as hi, BucketConfig as hn, AppTableConfig as hr, PresetInput as ht, BlockSqlAudit as i, PresetCatalogBlock as ii, BetterSupabaseConfig as in, APP_TABLE_EVENT_KINDS as ir, CONFIG_SCHEMA_URL as it, valibot as j, OpenApiConfig as ji, ExposeRole as jn, CatalogPolicy as jr, Generator as jt, zod as k, KeysConfig as ki, ExposeConfig as kn, CatalogGrant as kr, CodecsConfig as kt, BlockSqlNames as l, PRESET_FRAMEWORKS as li, GenGroupConfig as ln, AppLookupConfig as lr, BucketName as lt, moduleIdType as m, PresetField as mi, EntitlementsConfig as mn, AppRollupConfig as mr, ExpandedConfig as mt, AuditCategory as n, instancePrefix as ni, AppTablesInput as nn, APP_ON_DELETE_ACTIONS as nr, groupEntries as nt, BlockSqlContractFunction as o, PresetGlueItem as oi, BlocksInput as on, AppColumnConfig as or, resolveConfig as ot, isBlockSqlIdType as p, PresetConventions as pi, EntitlementPlansSource as pn, AppRollupAggregate as pr, ConfigConventions as pt, blockEntities as q, namedPreset as qn, PostgresFunctionArg as qr, RelationsConfig as qt, BlockSqlAction as r, PresetCatalog as ri, AuthConfig as rn, APP_ROLLUP_AGGREGATES as rr, hasFlatTables as rt, BlockSqlEmit as s, CONVENTION_FIELDS as si, DatabaseConfig as sn, AppColumnFormat as sr, AppTableNames as st, AUDIT_CATEGORIES as t, INSTANCE_NAME as ti, AppTableInput as tn, APP_COLUMN_TYPES as tr, groupConfig as tt, BlockSqlTableSpec as u, PRESET_TENANT_NAMES as ui, OrganizationConfig as un, AppOnDeleteAction as ur, ConfigReferences as ut, BlockSqlEntitlementsProvider as v, PresetPlatforms as vi, SeedConfig as vn, AppTableSubject as vr, presetConfig as vt, blockSqlVersion as w, DoctorConfig as wi, TopicTriggerTopicConfig as wn, CatalogColumnGrant as wr, listNames as wt, BlockSqlTestFile as x, integrationsForFramework as xi, TopicTriggerConfig as xn, Catalog as xr, PresetIntegration as xt, BlockSqlFile as y, PresetScope as yi, SqlConfig as yn, AppTableVersions as yr, presetOf as yt, buildJsonSchema as z, SKILLS_AGENTS as zi, NamedPreset as zn, ExtrasTable as zr, GeneratorInput as zt };
4349
+ export { JsonSchemaTarget as $, PRESET_GROUPS as $n, Snapshot as $r, GeneratorJsonSchema as $t, declaredIndexes as A, PresetPlatforms as Ai, SeedConfig as An, AppTableSubject as Ar, presetConfig as At, ZodGeneratorOptions as B, IntegrationName as Bi, ColumnPrivilege as Bn, CatalogFunctionArg as Br, ClaimsConfig as Bt, OwnView as C, Preset as Ci, SqlInput as Cn, AppReference as Cr, RoleNames as Ct, OwnIndex as D, PresetFieldKey as Di, BucketConfig as Dn, AppTableConfig as Dr, PresetInput as Dt, DeclaredView as E, PresetField as Ei, EntitlementsConfig as En, AppRollupConfig as Er, ExpandedConfig as Et, extensionSchema as F, presetValueLabel as Fi, TopicTriggerPayloadValueConfig as Fn, CatalogColumn as Fr, ResolvedPresetBlock as Ft, standardSchema as G, SkillsAgent as Gi, ResolvedExpose as Gn, CatalogTrigger as Gr, GeneratorBlockEntity as Gt, ValibotGeneratorOptions as H, MigrationSafetyConfig as Hi, ExposePrivilege as Hn, CatalogIndex as Hr, GeneratedFile as Ht, policyGrants as I, DoctorConfig as Ii, TopicTriggerTopicConfig as In, CatalogColumnGrant as Ir, listNames as It, FactoriesGeneratorOptions as J, INTEGRATION_INFO as Ji, presetOfSpec as Jn, ExtrasFunction as Jr, GeneratorField as Jt, NuqsGeneratorOptions as K, SkillsConfig as Ki, PresetSpec as Kn, CatalogUnique as Kr, GeneratorColumn as Kt, rlsTables as L, EnvFileConfig as Li, TopicTriggerValueConfig as Ln, CatalogEnum as Lr, presetBlockConflict as Lt, declaredTables as M, PresetValueInfo as Mi, SqlWorkflow as Mn, AppTablesConfig as Mr, PresetConflict as Mt, declaredUpdatedAtTriggers as N, integrationsForFramework as Ni, TopicTriggerConfig as Nn, Catalog as Nr, PresetIntegration as Nt, PolicyGrant as O, PresetFieldValue as Oi, RealtimeConfig as On, AppTableEventKind as Or, conventionConfig as Ot, declaredViews as P, presetField as Pi, TopicTriggerLookupConfig as Pn, CatalogCheck as Pr, ResolvedPreset as Pt, jsonSchema as Q, PRESETS as Qn, ForeignKeyAction as Qr, GeneratorInputSchema as Qt, TableGrant as R, GenConfig as Ri, VectorDistance as Rn, CatalogForeignKey as Rr, resolvePreset as Rt, BlockSqlUpgrade as S, PRESET_TENANT_NAMES as Si, OrganizationConfig as Sn, AppOnDeleteAction as Sr, ConfigReferences as St, notNullCheckName as T, PresetConventions as Ti, EntitlementPlansSource as Tn, AppRollupAggregate as Tr, ConfigConventions as Tt, valibot as U, OpenApiConfig as Ui, ExposeRole as Un, CatalogPolicy as Ur, Generator as Ut, zod as V, KeysConfig as Vi, ExposeConfig as Vn, CatalogGrant as Vr, CodecsConfig as Vt, StandardSchemaGeneratorOptions as W, PowerSyncGenConfig as Wi, Privilege as Wn, CatalogTable as Wr, GeneratorBlock as Wt, JsonSchemaGeneratorOptions as X, IntegrationInfo as Xi, DEFAULT_PRESET_NAME as Xn, ExtrasHookFunction as Xr, GeneratorFunctionArg as Xt, factories as Y, INTEGRATION_NAMES as Yi, presetSpec as Yn, ExtrasHook as Yr, GeneratorFunction as Yt, buildJsonSchema as Z, SKILLS_AGENTS as Zi, NamedPreset as Zn, ExtrasTable as Zr, GeneratorInput as Zt, BlockSqlDeprecation as _, PresetCatalogManifest as _i, BlockInput as _n, AppColumnAccess as _r, defineConfig as _t, BlockSqlContext as a, PostgresFunctionArg as ai, RelationsConfig as an, namedPreset as ar, blockEntities as at, BlockSqlLayout as b, DEFAULT_CONVENTIONS as bi, EnvironmentConfig as bn, AppColumnType as br, BlockTableReference as bt, BlockSqlIdType as c, RpcFunctionOverload as ci, DataHooksFramework as cn, sameTenantLayout as cr, CONFIG_GROUPS as ct, MODULE_ID_TYPES as d, RpcTypeReference as di, ResolvedExtensions as dn, APP_COLUMN_ACCESS as dr, blockEntrySource as dt, SnapshotBucket as ei, GeneratorModel as en, PRESET_NAMES as er, ClaimPaths as et, contractSignature as f, CORE_BLOCKS as fi, ApiConfig as fn, APP_COLUMN_FORMATS as fr, flattenConfig as ft, BlockSqlAccessProvider as g, PresetCatalogBlock as gi, BetterSupabaseConfig as gn, APP_TABLE_EVENT_KINDS as gr, CONFIG_SCHEMA_URL as gt, BlockSql as h, PresetCatalog as hi, AuthConfig as hn, APP_ROLLUP_AGGREGATES as hr, hasFlatTables as ht, BlockSqlAudit as i, PostgresFunction as ii, JsonTypeConfig as in, isPresetName as ir, BlockEntity as it, declaredTableColumns as j, PresetScope as ji, SqlConfig as jn, AppTableVersions as jr, presetOf as jt, declaredColumnTypes as k, PresetFramework as ki, ResolvedSqlConfig as kn, AppTableEvents as kr, expandPreset as kt, BlockSqlNames as l, RpcFunctionReturns as li, FlatConfig as ln, AuditedTable as lr, RENAMED_BLOCK_KEYS as lt, moduleIdType as m, instancePrefix as mi, AppTablesInput as mn, APP_ON_DELETE_ACTIONS as mr, groupEntries as mt, AuditCategory as n, GeneratorMetadata as ni, GeneratorTable as nn, PresetName as nr, claimPaths as nt, BlockSqlContractFunction as o, RpcFunction as oi, SourceConfig as on, CONFIG_DEFAULTS as or, blockEntityRenames as ot, isBlockSqlIdType as p, INSTANCE_NAME as pi, AppTableInput as pn, APP_COLUMN_TYPES as pr, groupConfig as pt, nuqs as q, GEN_TASKS as qi, presetFromSpec as qn, ExtrasDomain as qr, GeneratorEntitySchemas as qt, BlockSqlAction as r, PostgresColumn as ri, JsonSchemaSource as rn, defaultPreset as rr, tenantClaimPaths as rt, BlockSqlEmit as s, RpcFunctionArg as si, TableConfig as sn, DeclaredForeignKey as sr, blockSubjectTypes as st, AUDIT_CATEGORIES as t, SnapshotExtras as ti, GeneratorNoun as tn, PresetGroup as tr, DEFAULT_CLAIMS as tt, BlockSqlTableSpec as u, RpcReturnColumn as ui, ResolvedConfig as un, auditRegistrations as ur, RENAMED_CONFIG_KEYS as ut, BlockSqlEntitlementsProvider as v, PresetGlueItem as vi, BlocksInput as vn, AppColumnConfig as vr, resolveConfig as vt, blockSqlVersion as w, PresetAccess as wi, ToolingConfig as wn, AppReferenceTarget as wr, TypedReference as wt, BlockSqlTestFile as x, PRESET_FRAMEWORKS as xi, GenGroupConfig as xn, AppLookupConfig as xr, BucketName as xt, BlockSqlFile as y, CONVENTION_FIELDS as yi, DatabaseConfig as yn, AppColumnFormat as yr, AppTableNames as yt, ZodFlavor as z, GenTask as zi, VectorSearchConfig as zn, CatalogFunction as zr, resolveJsonSchema as zt };
@@ -1,4 +1,4 @@
1
- import { a as ClientAuth } from "./bind-vKDmdu_4.js";
1
+ import { a as ClientAuth } from "./bind-C54jD0r3.js";
2
2
  //#region src/blocks/controller.d.ts
3
3
  /**
4
4
  * A block's client state, framework-agnostic. `subscribe` and `getSnapshot`
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { Pn as PresetSpec, Wn as PresetName, ar as AppColumnAccess, cr as AppColumnType, di as Preset, g as BlockSqlAccessProvider, ht as PresetInput, nr as APP_ON_DELETE_ACTIONS, ur as AppOnDeleteAction } from "../context-BJoHD20l.js";
3
- import { E as CreateDesign, b as DesignChange } from "../index-Cagz4Z2k.js";
4
- import { $ as SchemaTable, A as renameColumn, B as AppEvents, C as editTable, Ct as tableWithComputed, D as isEmptyDesign, Dt as IssueSeverity, E as isAppTable, Et as IssueCode, F as singular, G as subjectTypeError, H as eventsColumnsEdited, I as tidy, J as SchemaData, K as SchemaColumn, L as updateTable, M as setColumn, N as setExtraColumn, O as moveTables, Ot as IssueSource, P as setTableId, Q as SchemaSource, R as userConnection, S as duplicateTable, St as rollupSources, T as identifierError, Tt as Issue, U as subjectColumns, V as AppSubject, W as subjectColumnsEdited, X as SchemaOptions, Y as SchemaForeignKey, Z as SchemaSoftRef, _ as connect, _t as isRollupAggregate, a as AppScope, at as tenantColumnOf, b as deleteExtraColumn, bt as readableColumns, c as ConnectResult, ct as ComputedRow, d as EMPTY_DESIGN, dt as RollupAggregate, et as SchemaTarget, f as NamedDesign, ft as computedColumnRenamed, g as columnError, gt as fittedRollup, h as appTableId, ht as filterColumns, i as AppReference, it as tableStatements, j as renameTable, k as referenceFrom, l as Connection, lt as DraftRollup, m as addTable, mt as computedTableRenamed, n as APP_MODULE, nt as parseSchema, o as AppTable, ot as AppLookup, p as TablePatch, pt as computedRows, q as SchemaComputed, r as AppColumn, rt as schemaRelations, s as AppTableId, st as AppRollup, t as PresetMigrationFile, tt as keyColumnsOf, u as Design, ut as ROLLUP_AGGREGATES, v as defaultError, vt as lookupSources, w as freeTableName, wt as tableWithoutComputed, x as deleteTable, xt as rollupColumns, y as deleteColumn, yt as prunedComputed, z as withDesign } from "../types-CjRwmCRP.js";
2
+ import { Ci as Preset, Dt as PresetInput, Kn as PresetSpec, Sr as AppOnDeleteAction, _r as AppColumnAccess, br as AppColumnType, g as BlockSqlAccessProvider, mr as APP_ON_DELETE_ACTIONS, nr as PresetName } from "../context-BFEX0b7H.js";
3
+ import { E as CreateDesign, b as DesignChange } from "../index-8wOL81rB.js";
4
+ import { $ as SchemaTable, A as renameColumn, B as AppEvents, C as editTable, Ct as tableWithComputed, D as isEmptyDesign, Dt as IssueSeverity, E as isAppTable, Et as IssueCode, F as singular, G as subjectTypeError, H as eventsColumnsEdited, I as tidy, J as SchemaData, K as SchemaColumn, L as updateTable, M as setColumn, N as setExtraColumn, O as moveTables, Ot as IssueSource, P as setTableId, Q as SchemaSource, R as userConnection, S as duplicateTable, St as rollupSources, T as identifierError, Tt as Issue, U as subjectColumns, V as AppSubject, W as subjectColumnsEdited, X as SchemaOptions, Y as SchemaForeignKey, Z as SchemaSoftRef, _ as connect, _t as isRollupAggregate, a as AppScope, at as tenantColumnOf, b as deleteExtraColumn, bt as readableColumns, c as ConnectResult, ct as ComputedRow, d as EMPTY_DESIGN, dt as RollupAggregate, et as SchemaTarget, f as NamedDesign, ft as computedColumnRenamed, g as columnError, gt as fittedRollup, h as appTableId, ht as filterColumns, i as AppReference, it as tableStatements, j as renameTable, k as referenceFrom, l as Connection, lt as DraftRollup, m as addTable, mt as computedTableRenamed, n as APP_MODULE, nt as parseSchema, o as AppTable, ot as AppLookup, p as TablePatch, pt as computedRows, q as SchemaComputed, r as AppColumn, rt as schemaRelations, s as AppTableId, st as AppRollup, t as PresetMigrationFile, tt as keyColumnsOf, u as Design, ut as ROLLUP_AGGREGATES, v as defaultError, vt as lookupSources, w as freeTableName, wt as tableWithoutComputed, x as deleteTable, xt as rollupColumns, y as deleteColumn, yt as prunedComputed, z as withDesign } from "../types-DF8JYEf5.js";
5
5
  import { a as SupabaseLint, o as SupabaseOrganization, s as SupabaseProject } from "../management-wtecfrNf.js";
6
6
  //#region src/create/check.d.ts
7
7
  /** What `checkDesign` returns. */
@@ -369,4 +369,63 @@ export type MigrationPlan = {
369
369
  */
370
370
  export declare function migrationBetween(preset: PresetInput, base: CreateDesign, next: CreateDesign): MigrationPlan;
371
371
  //#endregion
372
+ //#region src/create/plan-gate.d.ts
373
+ /** The part of a pg-delta `Action` the gate reads. */
374
+ export interface PlanActionLike {
375
+ readonly sql: string;
376
+ readonly verb: "create" | "alter" | "drop";
377
+ readonly dataLoss: "none" | "destructive";
378
+ }
379
+ /** The part of a pg-delta `RenameCandidate` the gate reads. */
380
+ export interface RenameCandidateLike {
381
+ readonly kind: string;
382
+ readonly from: string;
383
+ readonly to: string;
384
+ readonly status: "unambiguous" | "ambiguous" | "nearMiss";
385
+ readonly reason?: string;
386
+ }
387
+ /**
388
+ * The part of a pg-delta `Plan` the gate reads; the real plan fits it
389
+ * structurally.
390
+ */
391
+ export interface PlanLike {
392
+ readonly actions: readonly PlanActionLike[];
393
+ readonly renameCandidates: readonly RenameCandidateLike[];
394
+ }
395
+ /** A rename the user recorded with `-- bsb: rename old -> new`. */
396
+ export interface RenameHint {
397
+ readonly from: string;
398
+ readonly to: string;
399
+ }
400
+ export interface GateOptions {
401
+ /** Let destructive actions through (`--allow-data-loss`). */
402
+ readonly allowDataLoss?: boolean;
403
+ /** Renames recorded in the edit log; see `parseRenameHints`. */
404
+ readonly hints?: readonly RenameHint[];
405
+ }
406
+ export interface PlanGate {
407
+ /** Candidates a hint confirmed: apply these as renames. */
408
+ readonly accepted: readonly RenameCandidateLike[];
409
+ /** Unambiguous candidates nobody confirmed: ask the user. */
410
+ readonly questions: readonly RenameCandidateLike[];
411
+ /**
412
+ * Ambiguous candidates and near misses: never guessed, they plan as drop and
413
+ * create.
414
+ */
415
+ readonly unresolved: readonly RenameCandidateLike[];
416
+ readonly destructive: readonly PlanActionLike[];
417
+ /** `true` when a destructive action is present and `allowDataLoss` is off. */
418
+ readonly blocked: boolean;
419
+ readonly issues: readonly Issue[];
420
+ }
421
+ /** The `-- bsb: rename old -> new` lines of a migration or edit log. */
422
+ export declare function parseRenameHints(text: string): RenameHint[];
423
+ /**
424
+ * Applies the rules of ADR 0106 to a plan: only a recorded rename or a
425
+ * confirmed prompt becomes a rename, an ambiguous candidate never does, and a
426
+ * destructive action is blocked unless data loss is allowed. Returns the
427
+ * decisions and the findings as `Issue`s with `source: "plan"`.
428
+ */
429
+ export declare function gatePlan(plan: PlanLike, options?: GateOptions): PlanGate;
430
+ //#endregion
372
431
  export { APP_MODULE, AppColumn, type AppColumnAccess, type AppColumnType, AppEvents, AppLookup, AppReference, AppRollup, AppScope, AppSubject, AppTable, AppTableId, ComputedRow, ConnectResult, Connection, Design, DraftRollup, EMPTY_DESIGN, type Issue, type IssueCode, type IssueSeverity, type IssueSource, NamedDesign, APP_ON_DELETE_ACTIONS as ON_DELETE_ACTIONS, type AppOnDeleteAction as OnDeleteAction, type PresetMigrationFile, ROLLUP_AGGREGATES, RollupAggregate, SchemaColumn, SchemaComputed, SchemaData, SchemaForeignKey, SchemaOptions, SchemaSoftRef, SchemaSource, SchemaTable, SchemaTarget, TablePatch, addTable, appTableId, columnError, computedColumnRenamed, computedRows, computedTableRenamed, connect, defaultError, deleteColumn, deleteExtraColumn, deleteTable, duplicateTable, editTable, eventsColumnsEdited, filterColumns, fittedRollup, freeTableName, identifierError, isAppTable, isEmptyDesign, isRollupAggregate, keyColumnsOf, lookupSources, moveTables, parseSchema, prunedComputed, readableColumns, referenceFrom, renameColumn, renameTable, rollupColumns, rollupSources, schemaRelations, setColumn, setExtraColumn, setTableId, singular, subjectColumns, subjectColumnsEdited, subjectTypeError, tableStatements, tableWithComputed, tableWithoutComputed, tenantColumnOf, tidy, updateTable, userConnection, withDesign };
@@ -1,6 +1,6 @@
1
- import { k as APP_ON_DELETE_ACTIONS } from "../instances-qz2MCMyK.js";
2
- import { m as diffDesigns } from "../preset-BbSWLoXM.js";
3
- import { $ as tableWithComputed, A as referenceFrom, B as withDesign, C as duplicateTable, D as isAppTable, E as identifierError, F as setTableId, G as filterColumns, H as computedColumnRenamed, I as singular, J as lookupSources, K as fittedRollup, L as tidy, M as renameTable, N as setColumn, O as isEmptyDesign, P as setExtraColumn, Q as rollupSources, R as updateTable, S as deleteTable, T as freeTableName, U as computedRows, V as ROLLUP_AGGREGATES, W as computedTableRenamed, X as readableColumns, Y as prunedComputed, Z as rollupColumns, _ as columnError, a as parseSchema, at as boundError, b as deleteColumn, c as tenantColumnOf, ct as fitted, d as previewFiles, dt as takesBounds, et as tableWithoutComputed, f as designIssues, ft as withBounds, g as appTableId, h as addTable, i as keyColumnsOf, it as subjectTypeError, j as renameColumn, k as moveTables, l as schemaData, lt as lockedWithoutDefault, m as EMPTY_DESIGN, n as loadProject, nt as subjectColumns, o as schemaRelations, ot as columnLabel, p as APP_MODULE, q as isRollupAggregate, r as checkDesign, rt as subjectColumnsEdited, s as tableStatements, st as encryptable, t as checkProject, tt as eventsColumnsEdited, u as previewAccessProvider, ut as optionError, v as connect, w as editTable, x as deleteExtraColumn, y as defaultError, z as userConnection } from "../project-TN03XDsA.js";
1
+ import { k as APP_ON_DELETE_ACTIONS } from "../instances-C7qUTjhJ.js";
2
+ import { m as diffDesigns } from "../preset-DwuWNBip.js";
3
+ import { $ as tableWithComputed, A as referenceFrom, B as withDesign, C as duplicateTable, D as isAppTable, E as identifierError, F as setTableId, G as filterColumns, H as computedColumnRenamed, I as singular, J as lookupSources, K as fittedRollup, L as tidy, M as renameTable, N as setColumn, O as isEmptyDesign, P as setExtraColumn, Q as rollupSources, R as updateTable, S as deleteTable, T as freeTableName, U as computedRows, V as ROLLUP_AGGREGATES, W as computedTableRenamed, X as readableColumns, Y as prunedComputed, Z as rollupColumns, _ as columnError, a as parseSchema, at as boundError, b as deleteColumn, c as tenantColumnOf, ct as fitted, d as previewFiles, dt as takesBounds, et as tableWithoutComputed, f as designIssues, ft as withBounds, g as appTableId, h as addTable, i as keyColumnsOf, it as subjectTypeError, j as renameColumn, k as moveTables, l as schemaData, lt as lockedWithoutDefault, m as EMPTY_DESIGN, n as loadProject, nt as subjectColumns, o as schemaRelations, ot as columnLabel, p as APP_MODULE, q as isRollupAggregate, r as checkDesign, rt as subjectColumnsEdited, s as tableStatements, st as encryptable, t as checkProject, tt as eventsColumnsEdited, u as previewAccessProvider, ut as optionError, v as connect, w as editTable, x as deleteExtraColumn, y as defaultError, z as userConnection } from "../project-Bo1vZqVs.js";
4
4
  //#region src/create/column-kinds.ts
5
5
  /** The groups of the column type picker, in the order it shows them. */
6
6
  const KIND_GROUPS = [
@@ -602,4 +602,67 @@ function migrationBetween(preset, base, next) {
602
602
  };
603
603
  }
604
604
  //#endregion
605
- export { APP_MODULE, COLUMN_KINDS, EMPTY_DESIGN, HISTORY_LIMIT, KIND_GROUPS, MIGRATION_NAME, APP_ON_DELETE_ACTIONS as ON_DELETE_ACTIONS, ROLLUP_AGGREGATES, SAMPLE_ROW_COUNT, addTable, appTableId, boundError, checkDesign, checkProject, columnError, columnLabel, computedColumnRenamed, computedRows, computedTableRenamed, connect, dashboardUrl, defaultError, deleteColumn, deleteExtraColumn, deleteTable, deployBlocker, deployQuery, designIssues, duplicateTable, editTable, encryptable, eventsColumnsEdited, filterColumns, fitted, fittedRollup, freeTableName, generatePassword, hiddenColumns, identifierError, initialHistory, isAppTable, isEmptyDesign, isRollupAggregate, keyColumnsOf, kindById, kindOf, loadProject, lockedWithoutDefault, lookupSources, migrationBetween, moveTables, newDeployId, optionError, parseSchema, previewAccessProvider, previewFiles, prunedComputed, readableColumns, referenceFrom, renameColumn, renameTable, rollupColumns, rollupSources, sampleRows, schemaData, schemaRelations, setColumn, setColumnKind, setExtraColumn, setTableId, singular, subjectColumns, subjectColumnsEdited, subjectTypeError, suggestedProjectName, tableStatements, tableWithComputed, tableWithoutComputed, takesBounds, tenantColumnOf, tidy, undoHistory, updateTable, userConnection, withBounds, withDesign, withKind };
605
+ //#region src/create/plan-gate.ts
606
+ const HINT = /^--\s*bsb:\s*rename\s+(\S+)\s*->\s*(\S+)\s*$/gmu;
607
+ /** The `-- bsb: rename old -> new` lines of a migration or edit log. */
608
+ function parseRenameHints(text) {
609
+ return [...text.matchAll(HINT)].flatMap((match) => {
610
+ const [, from, to] = match;
611
+ return from === void 0 || to === void 0 ? [] : [{
612
+ from,
613
+ to
614
+ }];
615
+ });
616
+ }
617
+ function bare(name) {
618
+ return name.replaceAll("\"", "").toLowerCase();
619
+ }
620
+ /** `id` names `name`, written as `table` or `schema.table`. */
621
+ function names(id, name) {
622
+ const wanted = bare(name);
623
+ const have = bare(id);
624
+ return have === wanted || have.endsWith(`.${wanted}`) || have.endsWith(`:${wanted}`);
625
+ }
626
+ function confirmed(candidate, hints) {
627
+ return hints.some((hint) => names(candidate.from, hint.from) && names(candidate.to, hint.to));
628
+ }
629
+ function planIssue(code, severity, table, message) {
630
+ return {
631
+ code,
632
+ severity,
633
+ source: "plan",
634
+ path: "",
635
+ table,
636
+ message
637
+ };
638
+ }
639
+ /**
640
+ * Applies the rules of ADR 0106 to a plan: only a recorded rename or a
641
+ * confirmed prompt becomes a rename, an ambiguous candidate never does, and a
642
+ * destructive action is blocked unless data loss is allowed. Returns the
643
+ * decisions and the findings as `Issue`s with `source: "plan"`.
644
+ */
645
+ function gatePlan(plan, options = {}) {
646
+ const hints = options.hints ?? [];
647
+ const accepted = [];
648
+ const questions = [];
649
+ const unresolved = [];
650
+ for (const candidate of plan.renameCandidates) if (candidate.status !== "unambiguous") unresolved.push(candidate);
651
+ else if (confirmed(candidate, hints)) accepted.push(candidate);
652
+ else questions.push(candidate);
653
+ const destructive = plan.actions.filter((action) => action.dataLoss === "destructive");
654
+ return {
655
+ accepted,
656
+ questions,
657
+ unresolved,
658
+ destructive,
659
+ blocked: destructive.length > 0 && options.allowDataLoss !== true,
660
+ issues: [
661
+ ...questions.map((candidate) => planIssue("plan_rename_question", "warning", candidate.to, `Is ${candidate.from} renamed to ${candidate.to}? Record \`-- bsb: rename\` or it plans as drop and create.`)),
662
+ ...unresolved.map((candidate) => planIssue("plan_rename_unresolved", "info", candidate.to, `${candidate.from} to ${candidate.to} is ${candidate.status}${candidate.reason === void 0 ? "" : `: ${candidate.reason}`}; it plans as drop and create.`)),
663
+ ...destructive.map((action) => planIssue("plan_data_loss", options.allowDataLoss === true ? "warning" : "error", "", `Destroys data: ${action.sql.split("\n")[0] ?? ""}`))
664
+ ]
665
+ };
666
+ }
667
+ //#endregion
668
+ export { APP_MODULE, COLUMN_KINDS, EMPTY_DESIGN, HISTORY_LIMIT, KIND_GROUPS, MIGRATION_NAME, APP_ON_DELETE_ACTIONS as ON_DELETE_ACTIONS, ROLLUP_AGGREGATES, SAMPLE_ROW_COUNT, addTable, appTableId, boundError, checkDesign, checkProject, columnError, columnLabel, computedColumnRenamed, computedRows, computedTableRenamed, connect, dashboardUrl, defaultError, deleteColumn, deleteExtraColumn, deleteTable, deployBlocker, deployQuery, designIssues, duplicateTable, editTable, encryptable, eventsColumnsEdited, filterColumns, fitted, fittedRollup, freeTableName, gatePlan, generatePassword, hiddenColumns, identifierError, initialHistory, isAppTable, isEmptyDesign, isRollupAggregate, keyColumnsOf, kindById, kindOf, loadProject, lockedWithoutDefault, lookupSources, migrationBetween, moveTables, newDeployId, optionError, parseRenameHints, parseSchema, previewAccessProvider, previewFiles, prunedComputed, readableColumns, referenceFrom, renameColumn, renameTable, rollupColumns, rollupSources, sampleRows, schemaData, schemaRelations, setColumn, setColumnKind, setExtraColumn, setTableId, singular, subjectColumns, subjectColumnsEdited, subjectTypeError, suggestedProjectName, tableStatements, tableWithComputed, tableWithoutComputed, takesBounds, tenantColumnOf, tidy, undoHistory, updateTable, userConnection, withBounds, withDesign, withKind };
@@ -1,7 +1,7 @@
1
1
  import { ot as SchemaMeta } from "../../types-DFdg_4yN.js";
2
- import { ht as PresetInput } from "../../context-BJoHD20l.js";
3
- import { E as CreateDesign } from "../../index-Cagz4Z2k.js";
4
- import { Tt as Issue, t as PresetMigrationFile, u as Design } from "../../types-CjRwmCRP.js";
2
+ import { Dt as PresetInput } from "../../context-BFEX0b7H.js";
3
+ import { E as CreateDesign } from "../../index-8wOL81rB.js";
4
+ import { Tt as Issue, t as PresetMigrationFile, u as Design } from "../../types-DF8JYEf5.js";
5
5
  import { c as SpecDiagnostic } from "../../format-u-65igKI.js";
6
6
  //#region src/lite/runtime.d.ts
7
7
  /**
@@ -110,6 +110,13 @@ interface RawCatalog {
110
110
  readonly tables: readonly RawTable[];
111
111
  readonly functions: readonly string[];
112
112
  }
113
+ /**
114
+ * One query that returns the whole catalog as JSON, so it runs through the
115
+ * Management API's read-only endpoint in a single call.
116
+ */
117
+ export declare function catalogQuery(schemas?: readonly string[]): string;
118
+ /** Reads the one row `catalogQuery` returns; the JSON may arrive as text. */
119
+ export declare function readCatalog(rows: readonly unknown[]): RawCatalog;
113
120
  //#endregion
114
121
  //#region src/create/lite/import.d.ts
115
122
  /** Anything that runs a read-only query and returns rows: PGlite, `pg`, a shim. */
@@ -298,6 +305,136 @@ export type DesignDataApi = {
298
305
  */
299
306
  export declare function designDataApi(preset: PresetInput, design?: CreateDesign, options?: DesignDataApiOptions): Promise<DesignDataApi>;
300
307
  //#endregion
308
+ //#region src/create/lite/verify.d.ts
309
+ /** What a policy does, as the catalog states it (ADR 0105). */
310
+ export interface CatalogPolicy {
311
+ readonly name: string;
312
+ readonly command: "select" | "insert" | "update" | "delete" | "all";
313
+ readonly permissive: boolean;
314
+ /** The roles it applies to; `public` means every role. */
315
+ readonly roles: readonly string[];
316
+ readonly using: string | null;
317
+ readonly check: string | null;
318
+ }
319
+ export interface CatalogGrant {
320
+ /** The role, or `public` for a grant to `PUBLIC`. */
321
+ readonly grantee: string;
322
+ readonly privilege: string;
323
+ }
324
+ export interface CatalogTable {
325
+ readonly schema: string;
326
+ readonly name: string;
327
+ readonly rls: boolean;
328
+ readonly force: boolean;
329
+ readonly policies: readonly CatalogPolicy[];
330
+ readonly grants: readonly CatalogGrant[];
331
+ }
332
+ export interface CatalogFunction {
333
+ readonly schema: string;
334
+ readonly name: string;
335
+ readonly definer: boolean;
336
+ /** Whether the function sets `search_path` in its own configuration. */
337
+ readonly searchPath: boolean;
338
+ }
339
+ /** The security facts `verifyCatalog` checks. */
340
+ export interface SecurityCatalog {
341
+ readonly tables: readonly CatalogTable[];
342
+ readonly functions: readonly CatalogFunction[];
343
+ }
344
+ export interface VerifyOptions {
345
+ /** `schema.table` names that must have row level security forced. */
346
+ readonly force?: readonly string[];
347
+ /**
348
+ * `schema.table` names that must carry a restrictive tenant scope policy
349
+ * (`bsb_tenant_scope*`).
350
+ */
351
+ readonly tenantScoped?: readonly string[];
352
+ }
353
+ /** A role the access matrix answers for. */
354
+ export type MatrixRole = "anon" | "authenticated";
355
+ export type MatrixCommand = "select" | "insert" | "update" | "delete";
356
+ export declare const MATRIX_COMMANDS: readonly MatrixCommand[];
357
+ /**
358
+ * How far a role reaches with one command on one table: `denied` without the
359
+ * table privilege or without a permissive policy, `open` when a permissive
360
+ * policy admits every row, and `policy` when a policy decides per row.
361
+ */
362
+ export type Reach = "denied" | "open" | "policy";
363
+ export interface MatrixCell {
364
+ readonly table: string;
365
+ readonly role: MatrixRole;
366
+ readonly command: MatrixCommand;
367
+ readonly reach: Reach;
368
+ }
369
+ /**
370
+ * One query that returns the security facts as JSON: row level security and
371
+ * grants of each table, its policies, and the functions' `search_path`.
372
+ */
373
+ export declare function verifyQuery(schemas?: readonly string[]): string;
374
+ /** Reads the row `verifyQuery` returns; the JSON may arrive as text. */
375
+ export declare function readSecurityCatalog(rows: readonly unknown[]): SecurityCatalog;
376
+ /**
377
+ * The role by command by table matrix: how far `anon` and `authenticated` reach
378
+ * with each command on each table (ADR 0105). The service role bypasses row
379
+ * level security, so it has no row.
380
+ */
381
+ export declare function accessMatrix(catalog: SecurityCatalog): readonly MatrixCell[];
382
+ /**
383
+ * Checks the facts a policy file can't show on its own: row level security on
384
+ * every exposed table, no permissive write policy that is only `true`, no write
385
+ * grant to `anon`, nothing granted to `PUBLIC`, `search_path` on every security
386
+ * definer function, and, when asked, forced row level security and a
387
+ * restrictive tenant scope. A permissive `select` policy of `true` for `anon`
388
+ * is an error too. Findings are `Issue`s with `source: "verifier"`.
389
+ */
390
+ export declare function verifyCatalog(catalog: SecurityCatalog, options?: VerifyOptions): readonly Issue[];
391
+ export interface VerifyDesignOptions extends VerifyOptions {
392
+ /** A loaded `@supabase/lite`; loaded on demand when left out. */
393
+ readonly runtime?: LiteRuntime;
394
+ /** The schemas to read; `public` by default. */
395
+ readonly schemas?: readonly string[];
396
+ }
397
+ /**
398
+ * Applies the files to an in-memory PGlite database, reads its catalog and
399
+ * returns `verifyCatalog`'s findings with the matrix. Throws when
400
+ * `@supabase/lite` isn't installed.
401
+ */
402
+ export declare function verifyFiles(files: readonly PresetMigrationFile[], options?: VerifyDesignOptions): Promise<{
403
+ readonly issues: readonly Issue[];
404
+ readonly matrix: readonly MatrixCell[];
405
+ }>;
406
+ //#endregion
407
+ //#region src/create/lite/matrix-tests.d.ts
408
+ /** A caller the generated access tests act as (ADR 0105). */
409
+ export type MatrixPersona = "anon" | "signed-in" | "member-a" | "member-b" | "support" | "service";
410
+ export declare const MATRIX_PERSONAS: readonly MatrixPersona[];
411
+ /** How one persona is set up before its assertions run. */
412
+ export interface PersonaSetup {
413
+ /** The `sub` claim; every persona has a fixed default. */
414
+ readonly sub?: string;
415
+ /** Claims merged into the JWT claims the persona sends. */
416
+ readonly claims?: Readonly<Record<string, unknown>>;
417
+ /** SQL run as the owner before the role switch, for example a membership row. */
418
+ readonly setup?: string;
419
+ }
420
+ export interface MatrixTestOptions {
421
+ /** The personas to write a file for; all of them by default. */
422
+ readonly personas?: readonly MatrixPersona[];
423
+ /** Per-persona claims and setup SQL, because memberships are the app's own. */
424
+ readonly setup?: Readonly<Partial<Record<MatrixPersona, PersonaSetup>>>;
425
+ /** The folder of the files; `supabase/tests/database` by default. */
426
+ readonly directory?: string;
427
+ }
428
+ /**
429
+ * One pgTAP file per persona from the access matrix (ADR 0105): anon, a signed
430
+ * in user without a membership, a member of tenant A and of tenant B, a
431
+ * read-only support session and the service role. A cell that reaches no row
432
+ * must not return one, an open cell must not be denied, and the service role is
433
+ * never stopped by row level security. Memberships belong to the app, so a
434
+ * persona's rows and claims come from `options.setup`.
435
+ */
436
+ export declare function accessMatrixTests(matrix: readonly MatrixCell[], options?: MatrixTestOptions): readonly PresetMigrationFile[];
437
+ //#endregion
301
438
  //#region src/create/lite/index.d.ts
302
439
  export interface DesignValidation {
303
440
  /** `true` when every file that could run applied cleanly. */