better-supabase 0.14.0 → 0.15.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.
- package/README.md +67 -377
- package/dist/access-sql-B-MkVARa.js +207 -0
- package/dist/actor-go7p9-CJ.js +150 -0
- package/dist/adapter-B0b6MXYS.js +2299 -0
- package/dist/agents-5n8DWRfP.d.ts +117 -0
- package/dist/ai-cache-Cu8j6aQQ.js +87 -0
- package/dist/ai-cache-DyHohbFP.d.ts +82 -0
- package/dist/ai-chat-D1GuRnke.d.ts +619 -0
- package/dist/ai-files-CgFCRsnU.js +339 -0
- package/dist/ai-schedules-CAquecT_.d.ts +166 -0
- package/dist/ai-sdk/agents/index.d.ts +6 -6
- package/dist/ai-sdk/agents/index.js +2 -2
- package/dist/ai-sdk/batches/index.d.ts +5 -5
- package/dist/ai-sdk/batches/index.js +4 -4
- package/dist/ai-sdk/cache/index.d.ts +3 -3
- package/dist/ai-sdk/cache/index.js +2 -2
- package/dist/ai-sdk/chat/index.d.ts +1 -1
- package/dist/ai-sdk/chat/index.js +5 -5
- package/dist/ai-sdk/embeddings/index.d.ts +2 -2
- package/dist/ai-sdk/files/index.d.ts +2 -2
- package/dist/ai-sdk/files/index.js +5 -5
- package/dist/ai-sdk/index.d.ts +10 -10
- package/dist/ai-sdk/index.js +3 -3
- package/dist/ai-sdk/mcp/index.d.ts +4 -4
- package/dist/ai-sdk/mcp/index.js +6 -6
- package/dist/ai-sdk/memory/index.d.ts +3 -3
- package/dist/ai-sdk/memory/index.js +1 -1
- package/dist/ai-sdk/workflow/index.d.ts +4 -4
- package/dist/ai-sdk/workflow/index.js +7 -7
- package/dist/api-DxAPqMrE.d.ts +495 -0
- package/dist/api-keys-D5k63K6y.d.ts +213 -0
- package/dist/app-tables-CF2DD-Mu.d.ts +28 -0
- package/dist/app-tables-D29Rahtg.js +16350 -0
- package/dist/approvals-Crutd4-o.d.ts +129 -0
- package/dist/assistant-CD_h8Vxx.d.ts +157 -0
- package/dist/astro/index.d.ts +12 -12
- package/dist/astro/index.js +8 -8
- package/dist/attachments-aJYgdYtB.js +369 -0
- package/dist/attributes-Bzf51_nc.js +47 -0
- package/dist/auth-reply-tlXB2FQ9.js +31 -0
- package/dist/authorization-HZdJCaVm.d.ts +3595 -0
- package/dist/authorization-hooks-Cs1vP_ej.d.ts +217 -0
- package/dist/authorizer-B6X09otb.d.ts +118 -0
- package/dist/authorizer-BGhXaDmo.js +172 -0
- package/dist/automation-D41DXyvT.js +75 -0
- package/dist/automations-BYsz43AG.js +314 -0
- package/dist/automations-Bc2ue55V.js +26 -0
- package/dist/automations-CD1XlL2W.js +33 -0
- package/dist/automations-CIwRq7zm.js +30 -0
- package/dist/availability-vguUvEK2.d.ts +226 -0
- package/dist/better-result/index.d.ts +20 -30
- package/dist/better-result/index.js +2 -2
- package/dist/bind-CrMBwrPN.d.ts +104 -0
- package/dist/block-authors-BDV3y1SP.js +14 -0
- package/dist/block-env-B_uEM2xz.d.ts +32 -0
- package/dist/block-fields-BE7pInWZ.d.ts +58 -0
- package/dist/block-fields-DE_FgpOU.js +139 -0
- package/dist/block-helpers-CRpAHrp_.d.ts +62 -0
- package/dist/block-helpers-CtBdjgO4.js +353 -0
- package/dist/block-hooks-BfxX3682.js +130 -0
- package/dist/block-hooks-DZN2w69m.d.ts +117 -0
- package/dist/block-method-C9hWdHom.js +21 -0
- package/dist/block-method-CiVa2G-J.d.ts +14 -0
- package/dist/block-subjects-BhDKK_j7.js +55 -0
- package/dist/block-subjects-CphkQPxp.d.ts +6 -0
- package/dist/block-tenant-DHp7subc.js +14 -0
- package/dist/block-transport-DWZSJrwN.d.ts +69 -0
- package/dist/blocks/access-requests/index.d.ts +8 -8
- package/dist/blocks/access-requests/index.js +6 -6
- package/dist/blocks/activities/index.d.ts +215 -0
- package/dist/blocks/activities/index.js +414 -0
- package/dist/blocks/agents/index.d.ts +4 -4
- package/dist/blocks/agents/index.js +5 -5
- package/dist/blocks/ai-cache/index.d.ts +3 -3
- package/dist/blocks/ai-cache/index.js +3 -3
- package/dist/blocks/ai-chat/index.d.ts +119 -6
- package/dist/blocks/ai-chat/index.js +1067 -5
- package/dist/blocks/ai-files/index.d.ts +5 -5
- package/dist/blocks/ai-files/index.js +3 -3
- package/dist/blocks/ai-keys/index.d.ts +22 -0
- package/dist/blocks/ai-keys/index.js +236 -0
- package/dist/blocks/ai-schedules/index.d.ts +10 -0
- package/dist/blocks/ai-schedules/index.js +258 -0
- package/dist/blocks/announcements/index.d.ts +134 -5
- package/dist/blocks/announcements/index.js +179 -4
- package/dist/blocks/api-keys/index.d.ts +69 -8
- package/dist/blocks/api-keys/index.js +417 -7
- package/dist/blocks/approvals/index.d.ts +4 -4
- package/dist/blocks/approvals/index.js +10 -10
- package/dist/blocks/assets/index.d.ts +11 -13
- package/dist/blocks/assets/index.js +10 -10
- package/dist/blocks/assignment/index.d.ts +8 -8
- package/dist/blocks/assignment/index.js +5 -5
- package/dist/blocks/attachments/index.d.ts +97 -12
- package/dist/blocks/attachments/index.js +279 -47
- package/dist/blocks/audit/index.d.ts +476 -7
- package/dist/blocks/audit/index.js +863 -6
- package/dist/blocks/automations/index.d.ts +524 -0
- package/dist/blocks/automations/index.js +553 -0
- package/dist/blocks/billable-time/index.d.ts +22 -24
- package/dist/blocks/billable-time/index.js +13 -13
- package/dist/blocks/billing/index.d.ts +82 -11
- package/dist/blocks/billing/index.js +93 -9
- package/dist/blocks/bookings/index.d.ts +49 -7
- package/dist/blocks/bookings/index.js +419 -4
- package/dist/blocks/bulk/index.d.ts +6 -6
- package/dist/blocks/bulk/index.js +4 -4
- package/dist/blocks/calendar/index.d.ts +180 -7
- package/dist/blocks/calendar/index.js +1073 -5
- package/dist/blocks/catalog/index.d.ts +128 -13
- package/dist/blocks/catalog/index.js +149 -13
- package/dist/blocks/channels/index.d.ts +15 -13
- package/dist/blocks/channels/index.js +12 -13
- package/dist/blocks/collections/index.d.ts +16 -16
- package/dist/blocks/collections/index.js +8 -8
- package/dist/blocks/comments/index.d.ts +231 -14
- package/dist/blocks/comments/index.js +260 -13
- package/dist/blocks/compliance/index.d.ts +325 -0
- package/dist/blocks/compliance/index.js +410 -0
- package/dist/blocks/connectors/index.d.ts +4 -4
- package/dist/blocks/connectors/index.js +8 -8
- package/dist/blocks/contacts/index.d.ts +182 -0
- package/dist/blocks/contacts/index.js +358 -0
- package/dist/blocks/content/index.d.ts +188 -0
- package/dist/blocks/content/index.js +219 -0
- package/dist/blocks/contracts/index.d.ts +16 -18
- package/dist/blocks/contracts/index.js +24 -24
- package/dist/blocks/courses/index.d.ts +17 -17
- package/dist/blocks/courses/index.js +13 -13
- package/dist/blocks/created-by/index.d.ts +27 -0
- package/dist/blocks/created-by/index.js +14 -0
- package/dist/blocks/custom-fields/index.d.ts +11 -11
- package/dist/blocks/custom-fields/index.js +7 -7
- package/dist/blocks/data-lifecycle/index.d.ts +9 -9
- package/dist/blocks/data-lifecycle/index.js +7 -7
- package/dist/blocks/deals/index.d.ts +10 -10
- package/dist/blocks/deals/index.js +11 -11
- package/dist/blocks/dispatch/index.d.ts +20 -22
- package/dist/blocks/dispatch/index.js +17 -17
- package/dist/blocks/documents/index.d.ts +4 -4
- package/dist/blocks/documents/index.js +4 -4
- package/dist/blocks/domains/index.d.ts +7 -7
- package/dist/blocks/domains/index.js +6 -6
- package/dist/blocks/donations/index.d.ts +27 -29
- package/dist/blocks/donations/index.js +36 -28
- package/dist/blocks/drive/index.d.ts +10 -10
- package/dist/blocks/drive/index.js +8 -8
- package/dist/blocks/employees/index.d.ts +204 -7
- package/dist/blocks/employees/index.js +36 -10
- package/dist/blocks/enrichment/index.d.ts +7 -7
- package/dist/blocks/enrichment/index.js +14 -6
- package/dist/blocks/enrollments/index.d.ts +14 -16
- package/dist/blocks/enrollments/index.js +10 -10
- package/dist/blocks/entitlements/index.d.ts +48 -8
- package/dist/blocks/entitlements/index.js +62 -4
- package/dist/blocks/expenses/index.d.ts +8 -8
- package/dist/blocks/expenses/index.js +11 -11
- package/dist/blocks/field-history/index.d.ts +5 -5
- package/dist/blocks/field-history/index.js +3 -5
- package/dist/blocks/flags/index.d.ts +17 -13
- package/dist/blocks/flags/index.js +7 -7
- package/dist/blocks/forecasts/index.d.ts +7 -7
- package/dist/blocks/forecasts/index.js +7 -7
- package/dist/blocks/forms/index.d.ts +144 -12
- package/dist/blocks/forms/index.js +385 -7
- package/dist/blocks/goals/index.d.ts +82 -0
- package/dist/blocks/goals/index.js +72 -0
- package/dist/blocks/guests/index.d.ts +19 -21
- package/dist/blocks/guests/index.js +12 -12
- package/dist/blocks/hiring/index.d.ts +20 -10
- package/dist/blocks/hiring/index.js +10 -9
- package/dist/blocks/identities/index.d.ts +7 -7
- package/dist/blocks/identities/index.js +4 -4
- package/dist/blocks/imports/index.d.ts +8 -8
- package/dist/blocks/imports/index.js +6 -6
- package/dist/blocks/inbox/index.d.ts +137 -8
- package/dist/blocks/inbox/index.js +290 -56
- package/dist/blocks/incidents/index.d.ts +8 -8
- package/dist/blocks/incidents/index.js +7 -7
- package/dist/blocks/index.d.ts +37 -18
- package/dist/blocks/index.js +40 -19
- package/dist/blocks/inventory/index.d.ts +10 -10
- package/dist/blocks/inventory/index.js +6 -6
- package/dist/blocks/invoices/index.d.ts +11 -11
- package/dist/blocks/invoices/index.js +8 -8
- package/dist/blocks/knowledge/index.d.ts +3 -3
- package/dist/blocks/knowledge/index.js +4 -4
- package/dist/blocks/lead-scoring/index.d.ts +11 -11
- package/dist/blocks/lead-scoring/index.js +7 -7
- package/dist/blocks/leases/index.d.ts +16 -73
- package/dist/blocks/leases/index.js +29 -104
- package/dist/blocks/leave/index.d.ts +8 -8
- package/dist/blocks/leave/index.js +5 -5
- package/dist/blocks/ledger/index.d.ts +11 -13
- package/dist/blocks/ledger/index.js +10 -10
- package/dist/blocks/mail-sync/index.d.ts +6 -6
- package/dist/blocks/mail-sync/index.js +18 -10
- package/dist/blocks/memberships/index.d.ts +67 -0
- package/dist/blocks/memberships/index.js +14 -0
- package/dist/blocks/memory/index.d.ts +4 -4
- package/dist/blocks/memory/index.js +8 -8
- package/dist/blocks/messaging/index.d.ts +113 -13
- package/dist/blocks/messaging/index.js +579 -8
- package/dist/blocks/metrics/index.d.ts +7 -7
- package/dist/blocks/metrics/index.js +6 -6
- package/dist/blocks/mfa/index.d.ts +145 -3
- package/dist/blocks/mfa/index.js +211 -2
- package/dist/blocks/moderation/index.d.ts +13 -15
- package/dist/blocks/moderation/index.js +10 -10
- package/dist/blocks/notifications/index.d.ts +67 -15
- package/dist/blocks/notifications/index.js +62 -13
- package/dist/blocks/numbering/index.d.ts +45 -0
- package/dist/blocks/numbering/index.js +49 -0
- package/dist/blocks/oauth-server/index.d.ts +6 -6
- package/dist/blocks/oauth-server/index.js +6 -6
- package/dist/blocks/onboarding/index.d.ts +112 -4
- package/dist/blocks/onboarding/index.js +107 -4
- package/dist/blocks/orders/index.d.ts +35 -14
- package/dist/blocks/orders/index.js +49 -12
- package/dist/blocks/organizations/index.d.ts +452 -6
- package/dist/blocks/organizations/index.js +689 -5
- package/dist/blocks/outbox/index.d.ts +4 -4
- package/dist/blocks/outbox/index.js +19 -6
- package/dist/blocks/passes/index.d.ts +19 -21
- package/dist/blocks/passes/index.js +17 -17
- package/dist/blocks/permissions/index.d.ts +92 -0
- package/dist/blocks/permissions/index.js +127 -0
- package/dist/blocks/pipelines/index.d.ts +15 -15
- package/dist/blocks/pipelines/index.js +12 -12
- package/dist/blocks/posts/index.d.ts +9 -9
- package/dist/blocks/posts/index.js +8 -8
- package/dist/blocks/profiles/index.d.ts +7 -7
- package/dist/blocks/profiles/index.js +5 -5
- package/dist/blocks/promotions/index.d.ts +9 -9
- package/dist/blocks/promotions/index.js +7 -7
- package/dist/blocks/push/index.d.ts +9 -9
- package/dist/blocks/push/index.js +4 -4
- package/dist/blocks/queue/index.d.ts +562 -0
- package/dist/blocks/queue/index.js +1407 -0
- package/dist/blocks/quotes/index.d.ts +29 -14
- package/dist/blocks/quotes/index.js +14 -13
- package/dist/blocks/rank/index.d.ts +7 -7
- package/dist/blocks/rank/index.js +4 -4
- package/dist/blocks/reactions/index.d.ts +154 -5
- package/dist/blocks/reactions/index.js +168 -4
- package/dist/blocks/relations/index.d.ts +36 -38
- package/dist/blocks/relations/index.js +18 -18
- package/dist/blocks/reminders/index.d.ts +16 -16
- package/dist/blocks/reminders/index.js +14 -14
- package/dist/blocks/reviews/index.d.ts +8 -8
- package/dist/blocks/reviews/index.js +6 -6
- package/dist/blocks/saved-views/index.d.ts +311 -4
- package/dist/blocks/saved-views/index.js +437 -2
- package/dist/blocks/scores/index.d.ts +8 -10
- package/dist/blocks/scores/index.js +10 -10
- package/dist/blocks/search/index.d.ts +168 -5
- package/dist/blocks/search/index.js +277 -5
- package/dist/blocks/security-events/index.d.ts +440 -0
- package/dist/blocks/security-events/index.js +885 -0
- package/dist/blocks/segments/index.d.ts +13 -13
- package/dist/blocks/segments/index.js +7 -7
- package/dist/blocks/sequences/index.d.ts +13 -13
- package/dist/blocks/sequences/index.js +16 -10
- package/dist/blocks/service-accounts/index.d.ts +132 -0
- package/dist/blocks/service-accounts/index.js +109 -0
- package/dist/blocks/sessions/index.d.ts +138 -3
- package/dist/blocks/sessions/index.js +173 -2
- package/dist/blocks/settings/index.d.ts +181 -5
- package/dist/blocks/settings/index.js +226 -4
- package/dist/blocks/share-links/index.d.ts +20 -22
- package/dist/blocks/share-links/index.js +16 -16
- package/dist/blocks/shipments/index.d.ts +23 -25
- package/dist/blocks/shipments/index.js +30 -22
- package/dist/blocks/signatures/index.d.ts +9 -9
- package/dist/blocks/signatures/index.js +5 -5
- package/dist/blocks/signing-keys/index.d.ts +4 -4
- package/dist/blocks/signing-keys/index.js +3 -3
- package/dist/blocks/sla/index.d.ts +20 -22
- package/dist/blocks/sla/index.js +22 -16
- package/dist/blocks/sso/index.d.ts +7 -7
- package/dist/blocks/sso/index.js +4 -4
- package/dist/blocks/state-machine/index.d.ts +14 -14
- package/dist/blocks/state-machine/index.js +4 -4
- package/dist/blocks/subjects/index.d.ts +41 -7
- package/dist/blocks/subjects/index.js +187 -5
- package/dist/blocks/tags/index.d.ts +146 -13
- package/dist/blocks/tags/index.js +229 -14
- package/dist/blocks/tasks/index.d.ts +346 -0
- package/dist/blocks/tasks/index.js +626 -0
- package/dist/blocks/teams/index.d.ts +7 -7
- package/dist/blocks/teams/index.js +4 -4
- package/dist/blocks/templates/index.d.ts +18 -18
- package/dist/blocks/templates/index.js +10 -10
- package/dist/blocks/time-tracking/index.d.ts +16 -16
- package/dist/blocks/time-tracking/index.js +13 -13
- package/dist/blocks/timeline/index.d.ts +116 -0
- package/dist/blocks/timeline/index.js +164 -0
- package/dist/blocks/trash/index.d.ts +47 -9
- package/dist/blocks/trash/index.js +9 -7
- package/dist/blocks/undo/index.d.ts +48 -5
- package/dist/blocks/undo/index.js +60 -4
- package/dist/blocks/updated-at/index.d.ts +20 -0
- package/dist/blocks/updated-at/index.js +14 -0
- package/dist/blocks/usage/index.d.ts +39 -5
- package/dist/blocks/usage/index.js +301 -4
- package/dist/blocks/vercel-marketplace/index.d.ts +7 -7
- package/dist/blocks/vercel-marketplace/index.js +8 -8
- package/dist/blocks/versions/index.d.ts +20 -22
- package/dist/blocks/versions/index.js +16 -16
- package/dist/blocks/waitlist/index.d.ts +9 -9
- package/dist/blocks/waitlist/index.js +5 -5
- package/dist/blocks/webhooks/index.d.ts +21 -21
- package/dist/blocks/webhooks/index.js +16 -16
- package/dist/blocks/workflow-editor/index.d.ts +99 -0
- package/dist/blocks/workflow-editor/index.js +733 -0
- package/dist/blocks/workflows/index.d.ts +72 -6
- package/dist/blocks/workflows/index.js +379 -4
- package/dist/bookings-D4dvGXiR.d.ts +290 -0
- package/dist/bucket-CiNi8sIw.d.ts +666 -0
- package/dist/build-BFC8nFiL.js +797 -0
- package/dist/build-QitPVzzO.js +2073 -0
- package/dist/carrier-KzeYXVrW.d.ts +169 -0
- package/dist/chat-sdk/index.d.ts +8 -8
- package/dist/chat-sdk/index.js +3 -3
- package/dist/claims-DTy6R6my.js +63 -0
- package/dist/cli/add-BgsUjCan.js +1252 -0
- package/dist/cli/add-DCI5JKjA.js +99 -0
- package/dist/cli/add-DWjlVwvP.js +1 -0
- package/dist/cli/args-UEwg0l-N.js +27 -0
- package/dist/cli/backfill-nxPbcsns.js +293 -0
- package/dist/cli/bin.js +1 -1
- package/dist/cli/blocks-BZHI8mRC.js +156 -0
- package/dist/cli/blocks-Cr4HGePW.js +1 -0
- package/dist/cli/cache-CXgR_Ahi.js +607 -0
- package/dist/cli/codemod-DSN7iAdg.js +2343 -0
- package/dist/cli/codemod-block-renames-BuSaTE_G.js +239 -0
- package/dist/cli/command-CQ61x6gN.js +941 -0
- package/dist/cli/completion-2Y3D_eNu.js +211 -0
- package/dist/cli/completion-BwI0_Ap5.js +30 -0
- package/dist/cli/completion-Dlu5AdUW.js +1 -0
- package/dist/cli/config-9t5ec_N7.js +1642 -0
- package/dist/cli/config-CBqkQjjN.js +1 -0
- package/dist/cli/config-CPux9Wa7.js +47 -0
- package/dist/cli/config-edit-CrWfk8s3.js +621 -0
- package/dist/cli/config-group-C8tjut39.js +391 -0
- package/dist/cli/content-mapper-DNs7lTu7.js +182 -0
- package/dist/cli/db-DrBI_HNv.js +223 -0
- package/dist/cli/detect-D9JaAX20.js +84 -0
- package/dist/cli/dist-D_VbPAMR.js +129 -0
- package/dist/cli/doctor-DDrEM6S1.js +4561 -0
- package/dist/cli/env-BBl5L8Bf.js +143 -0
- package/dist/cli/env-CAU1nknN.js +1 -0
- package/dist/cli/files-CX71yBm8.js +1010 -0
- package/dist/cli/gen-MtijJQ9r.js +387 -0
- package/dist/cli/in-stack-diff-DQTW53Vf.js +257 -0
- package/dist/cli/index.d.ts +43 -8
- package/dist/cli/index.js +8 -8
- package/dist/cli/init-D-aDv9r5.js +440 -0
- package/dist/cli/keys-DGEpMbeB.js +106 -0
- package/dist/cli/live-iEeH15ck.js +341 -0
- package/dist/cli/mcp-BAPyaQ62.js +249 -0
- package/dist/cli/metadata-DVx9Zgbj.js +150 -0
- package/dist/cli/migration-safety-D7PhzFxm.js +928 -0
- package/dist/cli/module-migration-aPCckev6.js +734 -0
- package/dist/cli/moved-CsfDQcyk.js +254 -0
- package/dist/cli/orphans-BAboqyVM.js +28 -0
- package/dist/cli/parse-B9Iv_-Pf.js +182 -0
- package/dist/cli/preset-BwmIfFnh.js +101 -0
- package/dist/cli/print-BeWO7OJY.js +67 -0
- package/dist/cli/remove-B46Dmd2M.js +238 -0
- package/dist/cli/render-ucJmUyuM.js +2170 -0
- package/dist/cli/run-BXx6D1aR.js +63 -0
- package/dist/cli/run-CvYVAztY.js +1427 -0
- package/dist/cli/run-DYhLBcFW.js +702 -0
- package/dist/cli/seed-Cz8PcXeT.js +188 -0
- package/dist/cli/seed-D6XijwbR.js +1 -0
- package/dist/cli/shared-LZroULBe.js +151 -0
- package/dist/cli/skills-toUan_OV.js +121 -0
- package/dist/cli/snapshot-C8MVPyO8.js +729 -0
- package/dist/cli/source-DANaJJVc.js +320 -0
- package/dist/cli/source-args-IpJRJO5t.js +59 -0
- package/dist/cli/spec-DGVNMSSB.js +7530 -0
- package/dist/cli/spec-g8_G5K7o.js +1 -0
- package/dist/cli/stack-CWEHdO0b.js +135 -0
- package/dist/cli/sync-btj01bcM.js +319 -0
- package/dist/cli/upgrade-B596d4t8.js +403 -0
- package/dist/cli/upgrade-Dw3TMQzn.js +41 -0
- package/dist/cli/version-Du4CgONY.js +4 -0
- package/dist/client/index.d.ts +8 -7
- package/dist/client/index.js +9 -7
- package/dist/client/native/index.d.ts +6 -6
- package/dist/client/native/index.js +3 -3
- package/dist/client-BAEbEA7t.js +287 -0
- package/dist/cloud-event-CzZTJkXv.d.ts +64 -0
- package/dist/codecs-CMWlhHZ0.d.ts +222 -0
- package/dist/codecs-TylXqU_I.js +358 -0
- package/dist/commerce/index.d.ts +3 -3
- package/dist/commerce/index.js +6 -6
- package/dist/compiler-D3UmE7ao.d.ts +14 -0
- package/dist/compose-DKW0Tr3e.js +53 -0
- package/dist/composite-BARuBEDE.js +130 -0
- package/dist/composite-Dsxj7T5K.d.ts +82 -0
- package/dist/config/index.d.ts +6 -7
- package/dist/config/index.js +6 -6
- package/dist/config-CcehOvbz.js +1698 -0
- package/dist/config-DWGgUQCh.js +1108 -0
- package/dist/connectors-Fud4amxp.d.ts +147 -0
- package/dist/context-CEuTKrkz.d.ts +4129 -0
- package/dist/context-DBicfUNz.js +41 -0
- package/dist/controller-BNZKd6bJ.js +73 -0
- package/dist/controller-BrP0gn47.d.ts +52 -0
- package/dist/conversion-BAbucuXq.d.ts +86 -0
- package/dist/conversion-Dq1S7xzE.js +77 -0
- package/dist/create/index.d.ts +19 -21
- package/dist/create/index.js +21 -22
- package/dist/create/lite/index.d.ts +2 -2
- package/dist/create/supabase/index.d.ts +2 -2
- package/dist/create/supabase/index.js +2 -2
- package/dist/create-blocks-Bu4H5TXw.js +352 -0
- package/dist/credentials/index.d.ts +5 -5
- package/dist/credentials/index.js +6 -6
- package/dist/cron-CgHTKwYG.js +148 -0
- package/dist/cron-route-UU9i5i9J.js +24 -0
- package/dist/data-engine-BWoz9lED.d.ts +273 -0
- package/dist/data-engine-D1BkmBoR.js +173 -0
- package/dist/data-hooks-tgF1Ct0F.js +280 -0
- package/dist/db-blocks-DJGbjIPz.js +62 -0
- package/dist/deal-forecast-Bv52QMyX.js +39 -0
- package/dist/define-DFBnQyYg.d.ts +1255 -0
- package/dist/define-DlUeKHce.js +2011 -0
- package/dist/define-block-BGqOO8B3.js +64 -0
- package/dist/define-block-BVcLQ3DF.d.ts +1657 -0
- package/dist/delegation--93jRsVO.js +146 -0
- package/dist/documents-Cup1rpjF.d.ts +152 -0
- package/dist/edge/index.d.ts +20 -20
- package/dist/edge/index.js +14 -14
- package/dist/elysia/index.d.ts +1 -1
- package/dist/elysia/index.js +1 -1
- package/dist/embeddings-kFbRvuic.d.ts +78 -0
- package/dist/ended-gUsMZVNg.d.ts +26 -0
- package/dist/entitlements-CJpYQXeE.d.ts +54 -0
- package/dist/entitlements-NZAE_vLj.js +45 -0
- package/dist/entity-naming-Dtyq5sKE.js +131 -0
- package/dist/entity-schema-BDv6w-OQ.js +39 -0
- package/dist/envelope-Bzu0JnY2.js +90 -0
- package/dist/errors-BVFgt8BZ.js +328 -0
- package/dist/errors-CyxMxzlu.js +44 -0
- package/dist/escape-like-PReMbEEU.d.ts +30 -0
- package/dist/eve/index.d.ts +5 -5
- package/dist/eve/index.js +3 -3
- package/dist/eve-BFSwTu1z.d.ts +157 -0
- package/dist/event-calendar-DCufbihU.d.ts +65 -0
- package/dist/events/index.d.ts +3 -4
- package/dist/events-vcqenSYU.d.ts +852 -0
- package/dist/executor-3qcMhg6R.js +207 -0
- package/dist/executor-BQ7dYw4E.js +843 -0
- package/dist/executor-CVIn6JHa.d.ts +174 -0
- package/dist/executor-D3gB-9si.js +486 -0
- package/dist/executor-_2ekNofh.d.ts +104 -0
- package/dist/executor-hGjrop3A.d.ts +37 -0
- package/dist/expo/index.d.ts +12 -11
- package/dist/expo/index.js +11 -10
- package/dist/extension-B-lajjex.js +58 -0
- package/dist/extension-B0EjCYhO.js +61 -0
- package/dist/extension-DeAd_MqI.js +121 -0
- package/dist/extension-DzCc0IOd.js +103 -0
- package/dist/extension-shared-Djm8mGHD.js +60 -0
- package/dist/field-errors-fsbFktYF.d.ts +216 -0
- package/dist/field-formats-CAFNkKSN.d.ts +38 -0
- package/dist/fields-B0zaJAO3.js +107 -0
- package/dist/fields-C3q2ypnO.d.ts +78 -0
- package/dist/filter-evaluate-CPxeae5X.d.ts +37 -0
- package/dist/filter-evaluate-w1XOIUOL.js +217 -0
- package/dist/filter-query-BXLs72G9.d.ts +133 -0
- package/dist/filter-query-DMoKo82_.js +566 -0
- package/dist/flags-BOdA_ETQ.js +279 -0
- package/dist/flags-C01PLMJ-.d.ts +246 -0
- package/dist/flags-sdk/index.d.ts +1 -1
- package/dist/flags-sdk/index.js +2 -2
- package/dist/format-u-65igKI.d.ts +79 -0
- package/dist/framework-BKyTeS-j.d.ts +47 -0
- package/dist/framework-DDdkR7FX.js +58 -0
- package/dist/function-contract-DxFNOmsm.d.ts +27 -0
- package/dist/gateway-TD1pRfTP.d.ts +115 -0
- package/dist/h3/index.d.ts +2 -4
- package/dist/h3/index.js +2 -4
- package/dist/h3/v1/index.d.ts +2 -3
- package/dist/h3/v1/index.js +2 -3
- package/dist/hono/index.d.ts +27 -21
- package/dist/hono/index.js +22 -20
- package/dist/http-7-UvHjQe.js +28 -0
- package/dist/impersonation-DM3oWNoD.js +62 -0
- package/dist/inbox-NDKwSk_H.d.ts +321 -0
- package/dist/index-B938YqY-.d.ts +188 -0
- package/dist/index-BUuVq1co.d.ts +158 -0
- package/dist/index-BnH4Gomw.d.ts +633 -0
- package/dist/index-BxYOB1Oc.d.ts +149 -0
- package/dist/index-C-qpk8EQ.d.ts +262 -0
- package/dist/index-CG9rA8H8.d.ts +407 -0
- package/dist/index-CguFm716.d.ts +518 -0
- package/dist/index-DLq69k3F.d.ts +588 -0
- package/dist/index-Do2ChN_y.d.ts +287 -0
- package/dist/index.d.ts +39 -17
- package/dist/index.js +94 -16
- package/dist/instances-BHjCZoF8.js +277 -0
- package/dist/invalidate-DMp4eqfF.d.ts +21 -0
- package/dist/json-schema-Ca6gYbEP.js +888 -0
- package/dist/jwks-cache-DEsKI0hJ.js +49 -0
- package/dist/kit-5l-o8RxL.js +133 -0
- package/dist/kit-DOwKpSkA.d.ts +94 -0
- package/dist/knowledge-BGbtxMP9.js +300 -0
- package/dist/knowledge-CtL-Vfgy.d.ts +217 -0
- package/dist/lint/index.d.ts +94 -11
- package/dist/lint/index.js +268 -26
- package/dist/list/index.d.ts +4 -4
- package/dist/list/index.js +3 -3
- package/dist/list-query-BDVutLFr.d.ts +222 -0
- package/dist/list-query-BKy2zBaT.js +559 -0
- package/dist/live-C21DgbsD.js +275 -0
- package/dist/mapper/bin.js +380 -0
- package/dist/mcp/index.d.ts +8 -8
- package/dist/mcp/index.js +11 -11
- package/dist/mcp/sdk/index.d.ts +10 -10
- package/dist/mcp/sdk/index.js +11 -11
- package/dist/messages-D4XWuRTj.js +492 -0
- package/dist/messaging-C_Pr9tGx.d.ts +297 -0
- package/dist/methods-B3o7BFOW.js +11 -0
- package/dist/mfa-oIOYTpvc.d.ts +36 -0
- package/dist/model-hwpvole9.d.ts +340 -0
- package/dist/model-messages-CKG0zwdF.js +206 -0
- package/dist/money-codec-BzddguAQ.js +41 -0
- package/dist/nestjs/index.d.ts +3 -3
- package/dist/nestjs/index.js +2 -2
- package/dist/next/index.d.ts +244 -205
- package/dist/next/index.js +288 -197
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +6 -8
- package/dist/operations-CSc_IsHO.d.ts +6 -0
- package/dist/options-0qvUckqt.js +9 -0
- package/dist/options-1GgseJq5.js +10 -0
- package/dist/options-21s0dpnX.js +9 -0
- package/dist/options-B-cxGmRA.js +5 -0
- package/dist/options-B0EJULm5.js +5 -0
- package/dist/options-B2swWnJW.js +9 -0
- package/dist/options-BMGClqoa.js +11 -0
- package/dist/options-BQIYfx9F.js +9 -0
- package/dist/options-BVg58avP.js +5 -0
- package/dist/options-BbnPv6p7.js +12 -0
- package/dist/options-BfLmA375.js +5 -0
- package/dist/options-BlncUmIc.js +9 -0
- package/dist/options-BlzSfWxC.d.ts +10 -0
- package/dist/options-BnZS7IK-.js +9 -0
- package/dist/options-Bt0bYMLl.js +24 -0
- package/dist/options-BvtnxHfK.js +24 -0
- package/dist/options-C-dQHH5-.js +8 -0
- package/dist/options-C3RgtOLo.js +5 -0
- package/dist/options-CE93HOYi.d.ts +7 -0
- package/dist/options-CM6-18FQ.d.ts +13 -0
- package/dist/options-CPK2nQER.js +5 -0
- package/dist/options-CRz8Ht_4.js +9 -0
- package/dist/options-CW9wTqOk.js +11 -0
- package/dist/options-Cl9Ag2Pt.js +8 -0
- package/dist/options-Cp0HyUEk.js +9 -0
- package/dist/options-Cqq2jUww.js +10 -0
- package/dist/options-CsGl5BLH.d.ts +52 -0
- package/dist/options-CtUUU71w.js +20 -0
- package/dist/options-CvD9vNvx.js +9 -0
- package/dist/options-CyAhRKKm.d.ts +14 -0
- package/dist/options-D0G06Zm9.js +8 -0
- package/dist/options-D6as77gU.d.ts +16 -0
- package/dist/options-DChZoVfs.d.ts +11 -0
- package/dist/options-DINdgVih.d.ts +9 -0
- package/dist/options-DPgdAXO5.js +11 -0
- package/dist/options-DWVYM8P0.d.ts +17 -0
- package/dist/options-DWbA9buW.js +9 -0
- package/dist/options-DXnBN2E7.js +8 -0
- package/dist/options-D_bBVCXg.js +5 -0
- package/dist/options-DcOx8_3X.d.ts +19 -0
- package/dist/options-DeNejBtq.js +8 -0
- package/dist/options-DgQo80Xh.js +5 -0
- package/dist/options-DplE18Ko.d.ts +12 -0
- package/dist/options-HLwOuF2H.js +10 -0
- package/dist/options-KV84gAxl.js +10 -0
- package/dist/options-Li1Dyu88.d.ts +10 -0
- package/dist/options-Q1Bzgqpr.js +5 -0
- package/dist/options-_F-enoBs.d.ts +26 -0
- package/dist/options-c5WCsky5.js +21 -0
- package/dist/options-nFzfgtA6.js +5 -0
- package/dist/options-pOVWwbAK.d.ts +10 -0
- package/dist/options-y_-AkVCs.d.ts +15 -0
- package/dist/orpc/index.d.ts +69 -71
- package/dist/orpc/index.js +161 -27
- package/dist/otel/index.d.ts +3 -3
- package/dist/otel/index.js +6 -6
- package/dist/outbox-HvGAJuBe.d.ts +199 -0
- package/dist/payments-BXvabJOw.js +16 -0
- package/dist/payments-BYcN34Fp.d.ts +114 -0
- package/dist/permissions-controller-BMsqIE5T.js +34 -0
- package/dist/plugin-AKwwe2gF.js +48 -0
- package/dist/pool-CrtT4dg-.d.ts +123 -0
- package/dist/pool-errors-JUBcGrre.js +27 -0
- package/dist/ports-DOhtuw3c.js +152 -0
- package/dist/ports-sx226JUL.d.ts +89 -0
- package/dist/postgres/index.d.ts +5 -5
- package/dist/postgres/index.js +3 -3
- package/dist/postgrest-executor-BFW4oWte.js +1064 -0
- package/dist/postgrest-z-T0l23T.d.ts +53 -0
- package/dist/powersync/index.d.ts +106 -7
- package/dist/powersync/index.js +123 -7
- package/dist/preset/index.d.ts +4 -4
- package/dist/preset/index.js +4 -4
- package/dist/preset-CsHnIBJF.js +875 -0
- package/dist/problem-Bf0cJ7tk.js +162 -0
- package/dist/problem-DNwN8iGz.d.ts +79 -0
- package/dist/provider-B6g7rBZX.js +57 -0
- package/dist/provider-CqwEOLCA.d.ts +112 -0
- package/dist/push-token-D3Vcf0Pf.d.ts +24 -0
- package/dist/queries-BWYYS9um.js +239 -0
- package/dist/query/index.d.ts +4 -4
- package/dist/query/index.js +114 -48
- package/dist/rank-result-BBJIK-k_.js +18 -0
- package/dist/rank-result-Bwe7igy-.d.ts +14 -0
- package/dist/rate-limit-BWKGlhTM.js +49 -0
- package/dist/rate-limit-Bztf32cl.d.ts +50 -0
- package/dist/rate-limit-o44SYkVY.js +327 -0
- package/dist/react/index.d.ts +10 -9
- package/dist/react/index.js +5 -5
- package/dist/react/native/index.d.ts +1 -1
- package/dist/react/native/index.js +2 -3
- package/dist/react/server.d.ts +47 -15
- package/dist/react/server.js +46 -11
- package/dist/react/session.d.ts +3 -3
- package/dist/react-BuDYI62C.js +979 -0
- package/dist/react-router/index.d.ts +13 -10
- package/dist/react-router/index.js +10 -10
- package/dist/read-set-BnKnofIj.js +199 -0
- package/dist/realtime/index.d.ts +7 -7
- package/dist/realtime/index.js +4 -4
- package/dist/record-bindings-DkBJpC5A.js +26 -0
- package/dist/record-form-BYs9xv_N.d.ts +82 -0
- package/dist/record-type-DRbnlj5q.js +221 -0
- package/dist/recordings-BBSJt_YV.d.ts +119 -0
- package/dist/records/index.d.ts +28 -28
- package/dist/records/index.js +22 -23
- package/dist/refresh-DT_ICaK-.d.ts +54 -0
- package/dist/refusal-ByBZcm0V.js +64 -0
- package/dist/refusal-CSntB_x8.d.ts +32 -0
- package/dist/replicas-Dyoh3CEg.js +94 -0
- package/dist/resolve-B0mW2m7f.js +932 -0
- package/dist/resolve-CXX6DHv3.d.ts +288 -0
- package/dist/resource-D8pzB5Qf.d.ts +123 -0
- package/dist/resource-DV2GC2dB.js +520 -0
- package/dist/resource-DvgXqZB_.js +105 -0
- package/dist/resource-execute-CzHuDsil.d.ts +15 -0
- package/dist/resource-types-DnKiH4G2.d.ts +157 -0
- package/dist/resources-B9cQxhjw.d.ts +7 -0
- package/dist/resources-C02l_YBJ.js +64 -0
- package/dist/respond-C3CcOZlA.js +100 -0
- package/dist/respond-Dn1_YhC1.d.ts +106 -0
- package/dist/result-DZeA5KS6.d.ts +351 -0
- package/dist/result-ntFBW2p2.js +146 -0
- package/dist/rows-BDLZStp4.js +80 -0
- package/dist/rows-Bm6sskji.js +39 -0
- package/dist/rrule-79K2c3Nr.js +290 -0
- package/dist/run-state-BMCD_1Lt.d.ts +13 -0
- package/dist/sales-lines-Bk4mbLH1.d.ts +37 -0
- package/dist/sales-lines-D-sf9PIB.js +43 -0
- package/dist/sales-shared-DXGFJP4g.js +22 -0
- package/dist/schemas-l2aF78zQ.js +216 -0
- package/dist/scores-B2BiNuVJ.d.ts +174 -0
- package/dist/scores-CRp3vvQU.js +177 -0
- package/dist/server/index.d.ts +103 -42
- package/dist/server/index.js +98 -30
- package/dist/server-types-CFtehAsr.d.ts +946 -0
- package/dist/session-CH0SKgIz.d.ts +99 -0
- package/dist/shared-C47zAh2A.js +17 -0
- package/dist/sign-in-BAjR49fq.d.ts +24 -0
- package/dist/sign-in-BsIaNx2C.js +392 -0
- package/dist/sign-in-DNCdrk05.js +608 -0
- package/dist/signatures-CNcoq392.js +145 -0
- package/dist/signatures-Dkx9OE8j.d.ts +43 -0
- package/dist/signers-BAEzvTJ0.d.ts +390 -0
- package/dist/signing-keys-BNDUxpQL.d.ts +119 -0
- package/dist/signing-keys-wGKh4vtt.js +164 -0
- package/dist/solid/index.d.ts +52 -18
- package/dist/solid/index.js +69 -11
- package/dist/solid-start/index.d.ts +11 -11
- package/dist/solid-start/index.js +8 -8
- package/dist/spec/index.d.ts +691 -10
- package/dist/spec/index.js +2487 -5
- package/dist/spec-DTWkHzYZ.js +124 -0
- package/dist/spec-pins-C1Vm8OBl.js +61 -0
- package/dist/spec-pins-DIx95afw.d.ts +125 -0
- package/dist/sql/index.d.ts +5 -5
- package/dist/sql/index.js +5 -5
- package/dist/sql-BPbbPzRJ.js +421 -0
- package/dist/sql-ClHIdgKS.js +126996 -0
- package/dist/sqlite/index.d.ts +126 -0
- package/dist/sqlite/index.js +197 -0
- package/dist/sso-B0Txid2-.d.ts +161 -0
- package/dist/sso-d2S4x_f9.js +217 -0
- package/dist/ssr/index.d.ts +5 -4
- package/dist/ssr/index.js +3 -3
- package/dist/standard-BA3mLh6w.js +25 -0
- package/dist/standard-DBV730sF.d.ts +7 -0
- package/dist/stats-BHl1-zj9.js +83 -0
- package/dist/storage/index.d.ts +3 -3
- package/dist/storage/index.js +10 -10
- package/dist/store-CpheI-lN.d.ts +83 -0
- package/dist/streams/index.d.ts +3 -3
- package/dist/streams/index.js +2 -2
- package/dist/streams/redis/index.d.ts +2 -2
- package/dist/streams/redis/index.js +3 -3
- package/dist/subject-readers-B-pQ9Mmo.js +49 -0
- package/dist/subject-readers-BNSzkqw_.d.ts +21 -0
- package/dist/subjects-BpIEN1MS.d.ts +90 -0
- package/dist/subjects-DvmQeF_F.d.ts +79 -0
- package/dist/support-view-BYOgwXsJ.d.ts +17 -0
- package/dist/svelte/index.d.ts +52 -15
- package/dist/svelte/index.js +87 -11
- package/dist/sveltekit/index.d.ts +13 -13
- package/dist/sveltekit/index.js +13 -13
- package/dist/table-schema-BlF6k62Q.d.ts +81 -0
- package/dist/table-schema-CD8cJz_M.js +293 -0
- package/dist/tags-BjHflcHF.d.ts +30 -0
- package/dist/tags-CIZTqtlY.js +39 -0
- package/dist/tanstack-db/index.d.ts +50 -6
- package/dist/tanstack-db/index.js +43 -2
- package/dist/tanstack-start/index.d.ts +9 -9
- package/dist/tanstack-start/index.js +9 -9
- package/dist/tax-BkCNWWMc.js +140 -0
- package/dist/tax-DPShHual.d.ts +170 -0
- package/dist/tee-V97_v1ZS.js +101 -0
- package/dist/template-Drgg3v2J.js +126 -0
- package/dist/temporal-required-Dy0GGD8E.js +20 -0
- package/dist/tenant-BgIiMQpo.js +27 -0
- package/dist/tenant-yYg0E2-n.d.ts +17 -0
- package/dist/testing/index.d.ts +77 -75
- package/dist/testing/index.js +89 -99
- package/dist/timeline--VU3A1e4.js +50 -0
- package/dist/timeline-CtG0sehj.d.ts +151 -0
- package/dist/timing-dypS0nxW.js +95 -0
- package/dist/topic-CJrQZQaa.d.ts +415 -0
- package/dist/topic-ikV_pLTX.js +643 -0
- package/dist/types-BBQLbui9.d.ts +659 -0
- package/dist/types-CAQBmpDx.d.ts +217 -0
- package/dist/types-DFdg_4yN.d.ts +912 -0
- package/dist/types-Dp3UCr1e.d.ts +194 -0
- package/dist/types-Dr9wZgNy.d.ts +251 -0
- package/dist/types-EO2crSX_.d.ts +177 -0
- package/dist/types-SFRomQF7.d.ts +624 -0
- package/dist/undo-B1jwnVyN.d.ts +46 -0
- package/dist/undo-BjCChCmH.js +44 -0
- package/dist/upload-claim-B1ZU8ydB.js +33 -0
- package/dist/usage-D7QkrwzV.d.ts +232 -0
- package/dist/user-change-DgWC6RRC.js +135 -0
- package/dist/variants-Cy--Ub-a.js +53 -0
- package/dist/vault-O-YlAyHb.d.ts +62 -0
- package/dist/vercel-connect/index.d.ts +1 -1
- package/dist/vercel-connect/index.js +3 -3
- package/dist/verify-CMou8dWZ.d.ts +146 -0
- package/dist/verify-ZLFUdlqE.js +130 -0
- package/dist/view-C8Ve14ja.js +247 -0
- package/dist/view-DyFdMCqg.d.ts +97 -0
- package/dist/vue/index.d.ts +52 -23
- package/dist/vue/index.js +77 -14
- package/dist/watch-topic-BcGfvZOE.d.ts +31 -0
- package/dist/wiring-CDNuQoJJ.js +13 -0
- package/dist/workflow-sdk/builder/index.d.ts +12 -12
- package/dist/workflow-sdk/builder/index.js +16 -17
- package/dist/workflow-sdk/index.d.ts +18 -15
- package/dist/workflow-sdk/index.js +2 -2
- package/dist/workflow-sdk/world/index.d.ts +6 -6
- package/dist/workflow-sdk/world/index.js +12 -12
- package/dist/workflow-sdk-BFHu4sci.d.ts +163 -0
- package/dist/workflow-sdk-BVlFEB5Q.js +242 -0
- package/dist/workflow-sdk-Bw6_u0ar.js +2446 -0
- package/dist/workflows-B0ZPAQu0.d.ts +255 -0
- package/dist/yjs/index.d.ts +3 -3
- package/dist/yjs/index.js +2 -2
- package/package.json +75 -623
- package/schemas/config-v1.json +2082 -1754
- package/schemas/design-v1.json +141 -5
- package/schemas/doctor-report-v1.json +14 -0
- package/skills/better-supabase/SKILL.md +70 -28
- package/skills/better-supabase/references/block-extensions.md +64 -0
- package/skills/better-supabase/references/frontend.md +29 -26
- package/skills/better-supabase/references/troubleshooting.md +3 -3
- package/skills/better-supabase/references/ui-recipes.md +267 -134
- package/skills/better-supabase-api/SKILL.md +49 -38
- package/skills/better-supabase-api/references/adapters.md +42 -39
- package/skills/better-supabase-api/references/ai.md +4 -4
- package/skills/better-supabase-api/references/expo.md +8 -8
- package/skills/better-supabase-api/references/powersync.md +20 -13
- package/skills/better-supabase-api/references/streams-credentials.md +3 -3
- package/skills/better-supabase-auth/SKILL.md +17 -17
- package/skills/better-supabase-auth/references/authorization-providers.md +8 -6
- package/skills/better-supabase-testing/SKILL.md +8 -8
- package/dist/access-sql-CPoq9F86.js +0 -207
- package/dist/access-z7NwWtqx.js +0 -34
- package/dist/actor-hNajGNEK.js +0 -150
- package/dist/adapter-BCFAg58A.js +0 -2190
- package/dist/agents-CmZlLPXC.d.ts +0 -117
- package/dist/ai-cache-BxlOkc_M.d.ts +0 -82
- package/dist/ai-cache-DQikwXhJ.js +0 -87
- package/dist/ai-chat-DBxEz3o1.d.ts +0 -619
- package/dist/ai-files-t-kHmS5H.js +0 -339
- package/dist/ai-tasks-BDywBUgN.d.ts +0 -166
- package/dist/announcements-BeOD0zbc.js +0 -128
- package/dist/api-CWhpq24a.d.ts +0 -174
- package/dist/api-DKp2Ggz_.js +0 -685
- package/dist/api-keys-CboAenU8.d.ts +0 -213
- package/dist/api-keys-DT6Fi50R.js +0 -318
- package/dist/app-tables-BHrzAUFJ.d.ts +0 -27
- package/dist/app-tables-C5aoI5rZ.js +0 -959
- package/dist/approvals-bMb7dsBY.d.ts +0 -129
- package/dist/arazzo/index.d.ts +0 -278
- package/dist/arazzo/index.js +0 -630
- package/dist/assistant-D1yev_fR.d.ts +0 -157
- package/dist/asyncapi/index.d.ts +0 -110
- package/dist/asyncapi/index.js +0 -572
- package/dist/attachments-Cjdgarpa.js +0 -351
- package/dist/attributes-BOFl922R.js +0 -44
- package/dist/audit-log-C3rQxeHd.js +0 -788
- package/dist/auth-reply-jVKoAV6R.js +0 -31
- package/dist/authorization-BuT26_sR.d.ts +0 -3455
- package/dist/authorization-hooks-dLmUO_PZ.d.ts +0 -217
- package/dist/authorizer-DFP3gHv8.d.ts +0 -82
- package/dist/authorizer-DPTeL-7h.js +0 -125
- package/dist/availability-q3dZoZYM.d.ts +0 -226
- package/dist/bind-Dz8y3T5T.d.ts +0 -95
- package/dist/block-authors-BRTlT0qv.js +0 -14
- package/dist/block-controller-DTGuBemi.js +0 -112
- package/dist/block-env-DJiUu1fq.js +0 -35
- package/dist/block-env-kFcaaJLM.d.ts +0 -10
- package/dist/block-env-options-2e6IQrSw.js +0 -26
- package/dist/block-events-records-BGVyoz57.d.ts +0 -343
- package/dist/block-fields-3w4MZr8U.d.ts +0 -58
- package/dist/block-fields-DBSJSeaO.js +0 -139
- package/dist/block-helpers-BaugZlJV.d.ts +0 -62
- package/dist/block-helpers-CiKtrb6g.js +0 -353
- package/dist/block-hooks-BymdcD0V.js +0 -130
- package/dist/block-hooks-CmjPKqQ_.d.ts +0 -117
- package/dist/block-method-Bvsao626.js +0 -21
- package/dist/block-method-hsPAGFi5.d.ts +0 -19
- package/dist/block-names-Dbv_2wmE.js +0 -66
- package/dist/block-subjects-Dzq5Xn_0.js +0 -55
- package/dist/block-subjects-FHwLlIHU.d.ts +0 -6
- package/dist/block-tenant-C1sNV8_4.js +0 -14
- package/dist/block-transport-d53POsem.d.ts +0 -69
- package/dist/blocks/access/index.d.ts +0 -9
- package/dist/blocks/access/index.js +0 -18
- package/dist/blocks/access/react/index.d.ts +0 -52
- package/dist/blocks/access/react/index.js +0 -73
- package/dist/blocks/access/react/server.d.ts +0 -11
- package/dist/blocks/access/react/server.js +0 -16
- package/dist/blocks/access/solid/index.d.ts +0 -13
- package/dist/blocks/access/solid/index.js +0 -14
- package/dist/blocks/access/svelte/index.d.ts +0 -13
- package/dist/blocks/access/svelte/index.js +0 -14
- package/dist/blocks/access/vue/index.d.ts +0 -13
- package/dist/blocks/access/vue/index.js +0 -14
- package/dist/blocks/activity/index.d.ts +0 -116
- package/dist/blocks/activity/index.js +0 -164
- package/dist/blocks/ai-chat/react/index.d.ts +0 -52
- package/dist/blocks/ai-chat/react/index.js +0 -95
- package/dist/blocks/ai-chat/react/server.d.ts +0 -25
- package/dist/blocks/ai-chat/react/server.js +0 -23
- package/dist/blocks/ai-chat/solid/index.d.ts +0 -34
- package/dist/blocks/ai-chat/solid/index.js +0 -41
- package/dist/blocks/ai-chat/svelte/index.d.ts +0 -34
- package/dist/blocks/ai-chat/svelte/index.js +0 -41
- package/dist/blocks/ai-chat/vue/index.d.ts +0 -34
- package/dist/blocks/ai-chat/vue/index.js +0 -41
- package/dist/blocks/ai-providers/index.d.ts +0 -22
- package/dist/blocks/ai-providers/index.js +0 -236
- package/dist/blocks/ai-tasks/index.d.ts +0 -10
- package/dist/blocks/ai-tasks/index.js +0 -252
- package/dist/blocks/announcements/react/index.d.ts +0 -28
- package/dist/blocks/announcements/react/index.js +0 -38
- package/dist/blocks/announcements/react/server.d.ts +0 -9
- package/dist/blocks/announcements/react/server.js +0 -10
- package/dist/blocks/announcements/solid/index.d.ts +0 -13
- package/dist/blocks/announcements/solid/index.js +0 -14
- package/dist/blocks/announcements/svelte/index.d.ts +0 -13
- package/dist/blocks/announcements/svelte/index.js +0 -14
- package/dist/blocks/announcements/vue/index.d.ts +0 -13
- package/dist/blocks/announcements/vue/index.js +0 -14
- package/dist/blocks/api-keys/react/index.d.ts +0 -32
- package/dist/blocks/api-keys/react/index.js +0 -43
- package/dist/blocks/api-keys/react/server.d.ts +0 -7
- package/dist/blocks/api-keys/react/server.js +0 -7
- package/dist/blocks/api-keys/solid/index.d.ts +0 -13
- package/dist/blocks/api-keys/solid/index.js +0 -14
- package/dist/blocks/api-keys/svelte/index.d.ts +0 -13
- package/dist/blocks/api-keys/svelte/index.js +0 -14
- package/dist/blocks/api-keys/vue/index.d.ts +0 -13
- package/dist/blocks/api-keys/vue/index.js +0 -14
- package/dist/blocks/attachments/react/index.d.ts +0 -53
- package/dist/blocks/attachments/react/index.js +0 -78
- package/dist/blocks/attachments/react/server.d.ts +0 -9
- package/dist/blocks/attachments/react/server.js +0 -10
- package/dist/blocks/attachments/solid/index.d.ts +0 -13
- package/dist/blocks/attachments/solid/index.js +0 -14
- package/dist/blocks/attachments/svelte/index.d.ts +0 -13
- package/dist/blocks/attachments/svelte/index.js +0 -14
- package/dist/blocks/attachments/vue/index.d.ts +0 -13
- package/dist/blocks/attachments/vue/index.js +0 -14
- package/dist/blocks/audit/react/index.d.ts +0 -31
- package/dist/blocks/audit/react/index.js +0 -46
- package/dist/blocks/audit/react/server.d.ts +0 -7
- package/dist/blocks/audit/react/server.js +0 -7
- package/dist/blocks/audit/solid/index.d.ts +0 -13
- package/dist/blocks/audit/solid/index.js +0 -14
- package/dist/blocks/audit/svelte/index.d.ts +0 -13
- package/dist/blocks/audit/svelte/index.js +0 -14
- package/dist/blocks/audit/vue/index.d.ts +0 -13
- package/dist/blocks/audit/vue/index.js +0 -14
- package/dist/blocks/billing/react/index.d.ts +0 -44
- package/dist/blocks/billing/react/index.js +0 -40
- package/dist/blocks/billing/react/server.d.ts +0 -10
- package/dist/blocks/billing/react/server.js +0 -10
- package/dist/blocks/billing/solid/index.d.ts +0 -15
- package/dist/blocks/billing/solid/index.js +0 -14
- package/dist/blocks/billing/svelte/index.d.ts +0 -15
- package/dist/blocks/billing/svelte/index.js +0 -14
- package/dist/blocks/billing/vue/index.d.ts +0 -15
- package/dist/blocks/billing/vue/index.js +0 -14
- package/dist/blocks/bookings/react/index.d.ts +0 -36
- package/dist/blocks/bookings/react/index.js +0 -63
- package/dist/blocks/bookings/react/server.d.ts +0 -9
- package/dist/blocks/bookings/react/server.js +0 -10
- package/dist/blocks/bookings/solid/index.d.ts +0 -13
- package/dist/blocks/bookings/solid/index.js +0 -14
- package/dist/blocks/bookings/svelte/index.d.ts +0 -13
- package/dist/blocks/bookings/svelte/index.js +0 -14
- package/dist/blocks/bookings/vue/index.d.ts +0 -13
- package/dist/blocks/bookings/vue/index.js +0 -14
- package/dist/blocks/calendar/react/index.d.ts +0 -26
- package/dist/blocks/calendar/react/index.js +0 -58
- package/dist/blocks/calendar/react/server.d.ts +0 -9
- package/dist/blocks/calendar/react/server.js +0 -10
- package/dist/blocks/calendar/solid/index.d.ts +0 -13
- package/dist/blocks/calendar/solid/index.js +0 -14
- package/dist/blocks/calendar/svelte/index.d.ts +0 -13
- package/dist/blocks/calendar/svelte/index.js +0 -14
- package/dist/blocks/calendar/vue/index.d.ts +0 -13
- package/dist/blocks/calendar/vue/index.js +0 -14
- package/dist/blocks/comments/react/index.d.ts +0 -32
- package/dist/blocks/comments/react/index.js +0 -56
- package/dist/blocks/comments/react/server.d.ts +0 -7
- package/dist/blocks/comments/react/server.js +0 -7
- package/dist/blocks/comments/solid/index.d.ts +0 -13
- package/dist/blocks/comments/solid/index.js +0 -14
- package/dist/blocks/comments/svelte/index.d.ts +0 -13
- package/dist/blocks/comments/svelte/index.js +0 -14
- package/dist/blocks/comments/vue/index.d.ts +0 -13
- package/dist/blocks/comments/vue/index.js +0 -14
- package/dist/blocks/controls/index.d.ts +0 -325
- package/dist/blocks/controls/index.js +0 -410
- package/dist/blocks/engagements/index.d.ts +0 -41
- package/dist/blocks/engagements/index.js +0 -414
- package/dist/blocks/entitlements/react/index.d.ts +0 -27
- package/dist/blocks/entitlements/react/index.js +0 -35
- package/dist/blocks/entitlements/react/server.d.ts +0 -9
- package/dist/blocks/entitlements/react/server.js +0 -10
- package/dist/blocks/entitlements/solid/index.d.ts +0 -13
- package/dist/blocks/entitlements/solid/index.js +0 -14
- package/dist/blocks/entitlements/svelte/index.d.ts +0 -13
- package/dist/blocks/entitlements/svelte/index.js +0 -14
- package/dist/blocks/entitlements/vue/index.d.ts +0 -13
- package/dist/blocks/entitlements/vue/index.js +0 -14
- package/dist/blocks/forms/react/index.d.ts +0 -19
- package/dist/blocks/forms/react/index.js +0 -28
- package/dist/blocks/forms/react/server.d.ts +0 -9
- package/dist/blocks/forms/react/server.js +0 -10
- package/dist/blocks/forms/solid/index.d.ts +0 -13
- package/dist/blocks/forms/solid/index.js +0 -14
- package/dist/blocks/forms/svelte/index.d.ts +0 -13
- package/dist/blocks/forms/svelte/index.js +0 -14
- package/dist/blocks/forms/vue/index.d.ts +0 -13
- package/dist/blocks/forms/vue/index.js +0 -14
- package/dist/blocks/inbox/react/index.d.ts +0 -3
- package/dist/blocks/inbox/react/index.js +0 -87
- package/dist/blocks/inbox/react/server.d.ts +0 -17
- package/dist/blocks/inbox/react/server.js +0 -18
- package/dist/blocks/inbox/solid/index.d.ts +0 -27
- package/dist/blocks/inbox/solid/index.js +0 -32
- package/dist/blocks/inbox/svelte/index.d.ts +0 -27
- package/dist/blocks/inbox/svelte/index.js +0 -32
- package/dist/blocks/inbox/vue/index.d.ts +0 -27
- package/dist/blocks/inbox/vue/index.js +0 -32
- package/dist/blocks/jobs/index.d.ts +0 -523
- package/dist/blocks/jobs/index.js +0 -1345
- package/dist/blocks/messaging/react/index.d.ts +0 -39
- package/dist/blocks/messaging/react/index.js +0 -80
- package/dist/blocks/messaging/react/server.d.ts +0 -12
- package/dist/blocks/messaging/react/server.js +0 -14
- package/dist/blocks/messaging/solid/index.d.ts +0 -20
- package/dist/blocks/messaging/solid/index.js +0 -23
- package/dist/blocks/messaging/svelte/index.d.ts +0 -20
- package/dist/blocks/messaging/svelte/index.js +0 -23
- package/dist/blocks/messaging/vue/index.d.ts +0 -20
- package/dist/blocks/messaging/vue/index.js +0 -23
- package/dist/blocks/mfa/react/index.d.ts +0 -30
- package/dist/blocks/mfa/react/index.js +0 -45
- package/dist/blocks/mfa/react/server.d.ts +0 -9
- package/dist/blocks/mfa/react/server.js +0 -12
- package/dist/blocks/mfa/solid/index.d.ts +0 -20
- package/dist/blocks/mfa/solid/index.js +0 -23
- package/dist/blocks/mfa/svelte/index.d.ts +0 -20
- package/dist/blocks/mfa/svelte/index.js +0 -23
- package/dist/blocks/mfa/vue/index.d.ts +0 -20
- package/dist/blocks/mfa/vue/index.js +0 -23
- package/dist/blocks/notifications/react/index.d.ts +0 -19
- package/dist/blocks/notifications/react/index.js +0 -41
- package/dist/blocks/notifications/react/server.d.ts +0 -10
- package/dist/blocks/notifications/react/server.js +0 -10
- package/dist/blocks/notifications/solid/index.d.ts +0 -13
- package/dist/blocks/notifications/solid/index.js +0 -14
- package/dist/blocks/notifications/svelte/index.d.ts +0 -13
- package/dist/blocks/notifications/svelte/index.js +0 -14
- package/dist/blocks/notifications/vue/index.d.ts +0 -13
- package/dist/blocks/notifications/vue/index.js +0 -14
- package/dist/blocks/number-sequences/index.d.ts +0 -48
- package/dist/blocks/number-sequences/index.js +0 -52
- package/dist/blocks/onboarding/react/index.d.ts +0 -24
- package/dist/blocks/onboarding/react/index.js +0 -38
- package/dist/blocks/onboarding/react/server.d.ts +0 -10
- package/dist/blocks/onboarding/react/server.js +0 -10
- package/dist/blocks/onboarding/solid/index.d.ts +0 -13
- package/dist/blocks/onboarding/solid/index.js +0 -14
- package/dist/blocks/onboarding/svelte/index.d.ts +0 -13
- package/dist/blocks/onboarding/svelte/index.js +0 -14
- package/dist/blocks/onboarding/vue/index.d.ts +0 -13
- package/dist/blocks/onboarding/vue/index.js +0 -14
- package/dist/blocks/organizations/react/index.d.ts +0 -127
- package/dist/blocks/organizations/react/index.js +0 -113
- package/dist/blocks/organizations/react/server.d.ts +0 -20
- package/dist/blocks/organizations/react/server.js +0 -24
- package/dist/blocks/organizations/solid/index.d.ts +0 -34
- package/dist/blocks/organizations/solid/index.js +0 -32
- package/dist/blocks/organizations/svelte/index.d.ts +0 -34
- package/dist/blocks/organizations/svelte/index.js +0 -32
- package/dist/blocks/organizations/vue/index.d.ts +0 -34
- package/dist/blocks/organizations/vue/index.js +0 -32
- package/dist/blocks/parties/index.d.ts +0 -182
- package/dist/blocks/parties/index.js +0 -358
- package/dist/blocks/reactions/react/index.d.ts +0 -32
- package/dist/blocks/reactions/react/index.js +0 -57
- package/dist/blocks/reactions/react/server.d.ts +0 -9
- package/dist/blocks/reactions/react/server.js +0 -10
- package/dist/blocks/reactions/solid/index.d.ts +0 -13
- package/dist/blocks/reactions/solid/index.js +0 -14
- package/dist/blocks/reactions/svelte/index.d.ts +0 -13
- package/dist/blocks/reactions/svelte/index.js +0 -14
- package/dist/blocks/reactions/vue/index.d.ts +0 -13
- package/dist/blocks/reactions/vue/index.js +0 -14
- package/dist/blocks/rules/index.d.ts +0 -175
- package/dist/blocks/rules/index.js +0 -163
- package/dist/blocks/rules/react/index.d.ts +0 -38
- package/dist/blocks/rules/react/index.js +0 -59
- package/dist/blocks/rules/react/server.d.ts +0 -6
- package/dist/blocks/rules/react/server.js +0 -7
- package/dist/blocks/rules/solid/index.d.ts +0 -13
- package/dist/blocks/rules/solid/index.js +0 -14
- package/dist/blocks/rules/svelte/index.d.ts +0 -13
- package/dist/blocks/rules/svelte/index.js +0 -14
- package/dist/blocks/rules/vue/index.d.ts +0 -13
- package/dist/blocks/rules/vue/index.js +0 -14
- package/dist/blocks/saved-views/react/index.d.ts +0 -40
- package/dist/blocks/saved-views/react/index.js +0 -60
- package/dist/blocks/saved-views/react/server.d.ts +0 -10
- package/dist/blocks/saved-views/react/server.js +0 -10
- package/dist/blocks/saved-views/solid/index.d.ts +0 -13
- package/dist/blocks/saved-views/solid/index.js +0 -14
- package/dist/blocks/saved-views/svelte/index.d.ts +0 -13
- package/dist/blocks/saved-views/svelte/index.js +0 -14
- package/dist/blocks/saved-views/vue/index.d.ts +0 -13
- package/dist/blocks/saved-views/vue/index.js +0 -14
- package/dist/blocks/search/react/index.d.ts +0 -39
- package/dist/blocks/search/react/index.js +0 -49
- package/dist/blocks/search/react/server.d.ts +0 -10
- package/dist/blocks/search/react/server.js +0 -11
- package/dist/blocks/search/solid/index.d.ts +0 -13
- package/dist/blocks/search/solid/index.js +0 -14
- package/dist/blocks/search/svelte/index.d.ts +0 -13
- package/dist/blocks/search/svelte/index.js +0 -14
- package/dist/blocks/search/vue/index.d.ts +0 -13
- package/dist/blocks/search/vue/index.js +0 -14
- package/dist/blocks/service-principals/index.d.ts +0 -132
- package/dist/blocks/service-principals/index.js +0 -109
- package/dist/blocks/sessions/react/index.d.ts +0 -36
- package/dist/blocks/sessions/react/index.js +0 -53
- package/dist/blocks/sessions/react/server.d.ts +0 -15
- package/dist/blocks/sessions/react/server.js +0 -17
- package/dist/blocks/sessions/solid/index.d.ts +0 -20
- package/dist/blocks/sessions/solid/index.js +0 -23
- package/dist/blocks/sessions/svelte/index.d.ts +0 -20
- package/dist/blocks/sessions/svelte/index.js +0 -23
- package/dist/blocks/sessions/vue/index.d.ts +0 -20
- package/dist/blocks/sessions/vue/index.js +0 -23
- package/dist/blocks/settings/react/index.d.ts +0 -31
- package/dist/blocks/settings/react/index.js +0 -37
- package/dist/blocks/settings/react/server.d.ts +0 -10
- package/dist/blocks/settings/react/server.js +0 -10
- package/dist/blocks/settings/solid/index.d.ts +0 -13
- package/dist/blocks/settings/solid/index.js +0 -14
- package/dist/blocks/settings/svelte/index.d.ts +0 -13
- package/dist/blocks/settings/svelte/index.js +0 -14
- package/dist/blocks/settings/vue/index.d.ts +0 -13
- package/dist/blocks/settings/vue/index.js +0 -14
- package/dist/blocks/shared-signals/index.d.ts +0 -440
- package/dist/blocks/shared-signals/index.js +0 -885
- package/dist/blocks/subjects/react/index.d.ts +0 -31
- package/dist/blocks/subjects/react/index.js +0 -60
- package/dist/blocks/subjects/react/server.d.ts +0 -9
- package/dist/blocks/subjects/react/server.js +0 -12
- package/dist/blocks/subjects/solid/index.d.ts +0 -13
- package/dist/blocks/subjects/solid/index.js +0 -14
- package/dist/blocks/subjects/svelte/index.d.ts +0 -13
- package/dist/blocks/subjects/svelte/index.js +0 -14
- package/dist/blocks/subjects/vue/index.d.ts +0 -13
- package/dist/blocks/subjects/vue/index.js +0 -14
- package/dist/blocks/tags/react/index.d.ts +0 -29
- package/dist/blocks/tags/react/index.js +0 -53
- package/dist/blocks/tags/react/server.d.ts +0 -7
- package/dist/blocks/tags/react/server.js +0 -7
- package/dist/blocks/tags/solid/index.d.ts +0 -13
- package/dist/blocks/tags/solid/index.js +0 -14
- package/dist/blocks/tags/svelte/index.d.ts +0 -13
- package/dist/blocks/tags/svelte/index.js +0 -14
- package/dist/blocks/tags/vue/index.d.ts +0 -13
- package/dist/blocks/tags/vue/index.js +0 -14
- package/dist/blocks/targets/index.d.ts +0 -82
- package/dist/blocks/targets/index.js +0 -72
- package/dist/blocks/undo/react/index.d.ts +0 -17
- package/dist/blocks/undo/react/index.js +0 -24
- package/dist/blocks/undo/react/server.d.ts +0 -10
- package/dist/blocks/undo/react/server.js +0 -10
- package/dist/blocks/undo/solid/index.d.ts +0 -13
- package/dist/blocks/undo/solid/index.js +0 -14
- package/dist/blocks/undo/svelte/index.d.ts +0 -13
- package/dist/blocks/undo/svelte/index.js +0 -14
- package/dist/blocks/undo/vue/index.d.ts +0 -13
- package/dist/blocks/undo/vue/index.js +0 -14
- package/dist/blocks/usage/react/index.d.ts +0 -29
- package/dist/blocks/usage/react/index.js +0 -38
- package/dist/blocks/usage/react/server.d.ts +0 -7
- package/dist/blocks/usage/react/server.js +0 -7
- package/dist/blocks/usage/solid/index.d.ts +0 -13
- package/dist/blocks/usage/solid/index.js +0 -14
- package/dist/blocks/usage/svelte/index.d.ts +0 -13
- package/dist/blocks/usage/svelte/index.js +0 -14
- package/dist/blocks/usage/vue/index.d.ts +0 -13
- package/dist/blocks/usage/vue/index.js +0 -14
- package/dist/blocks/work-items/index.d.ts +0 -87
- package/dist/blocks/work-items/index.js +0 -431
- package/dist/blocks/workflow-builder/index.d.ts +0 -43
- package/dist/blocks/workflow-builder/index.js +0 -33
- package/dist/blocks/workflow-builder/react/index.d.ts +0 -32
- package/dist/blocks/workflow-builder/react/index.js +0 -75
- package/dist/blocks/workflow-builder/react/server.d.ts +0 -14
- package/dist/blocks/workflow-builder/react/server.js +0 -17
- package/dist/blocks/workflow-builder/solid/index.d.ts +0 -20
- package/dist/blocks/workflow-builder/solid/index.js +0 -23
- package/dist/blocks/workflow-builder/svelte/index.d.ts +0 -20
- package/dist/blocks/workflow-builder/svelte/index.js +0 -23
- package/dist/blocks/workflow-builder/vue/index.d.ts +0 -20
- package/dist/blocks/workflow-builder/vue/index.js +0 -23
- package/dist/blocks/workflows/react/index.d.ts +0 -39
- package/dist/blocks/workflows/react/index.js +0 -65
- package/dist/blocks/workflows/react/server.d.ts +0 -14
- package/dist/blocks/workflows/react/server.js +0 -17
- package/dist/blocks/workflows/solid/index.d.ts +0 -20
- package/dist/blocks/workflows/solid/index.js +0 -23
- package/dist/blocks/workflows/svelte/index.d.ts +0 -20
- package/dist/blocks/workflows/svelte/index.js +0 -23
- package/dist/blocks/workflows/vue/index.d.ts +0 -20
- package/dist/blocks/workflows/vue/index.js +0 -23
- package/dist/bookings-BB5lFlNO.js +0 -310
- package/dist/bookings-CC7IeiRa.d.ts +0 -290
- package/dist/bucket-TkB7_xv8.d.ts +0 -667
- package/dist/build-DCfpwg78.js +0 -1839
- package/dist/build-g9wTbQdp.js +0 -703
- package/dist/calendar-T3Vdpq7E.js +0 -952
- package/dist/carrier-C7Q_21Kd.d.ts +0 -169
- package/dist/chat-sdk/react/index.d.ts +0 -3
- package/dist/chat-sdk/react/index.js +0 -2
- package/dist/chat-sdk/react/server.d.ts +0 -4
- package/dist/chat-sdk/react/server.js +0 -1
- package/dist/claims-T8TWZ53E.js +0 -63
- package/dist/cli/add-Bf3kE6PY.js +0 -75
- package/dist/cli/add-CYh6Sxk1.js +0 -674
- package/dist/cli/add-Dg40eFKE.js +0 -1
- package/dist/cli/adopt-B0vrj-4B.js +0 -421
- package/dist/cli/adopt-DJR1k3lS.js +0 -1
- package/dist/cli/apply-DUQ-5LC6.js +0 -329
- package/dist/cli/blocks-DzgYfjVv.js +0 -124
- package/dist/cli/blocks-gGupqvBH.js +0 -1
- package/dist/cli/cache-C3K_wOE2.js +0 -536
- package/dist/cli/catalog-CNM0ViIh.js +0 -199
- package/dist/cli/codemod-Dz4R-tVY.js +0 -1127
- package/dist/cli/command-33pu13LT.js +0 -963
- package/dist/cli/completion-6M6Hr8TL.js +0 -211
- package/dist/cli/completion-Bqu8yq0q.js +0 -1
- package/dist/cli/completion-Ddr3yqd3.js +0 -30
- package/dist/cli/config-B31tIvAl.js +0 -42
- package/dist/cli/config-CjgXMZW2.js +0 -1522
- package/dist/cli/config-D9k5ckqV.js +0 -1
- package/dist/cli/config-edit-D46H0UHp.js +0 -613
- package/dist/cli/db-CeagtENM.js +0 -473
- package/dist/cli/design-edit-B40ljpGZ.js +0 -205
- package/dist/cli/detect-RApSAA8v.js +0 -84
- package/dist/cli/dist-DSwzLVAG.js +0 -129
- package/dist/cli/doctor-COGJJ1gy.js +0 -3898
- package/dist/cli/emit-DbQeLlHt.js +0 -1123
- package/dist/cli/env-Ba-pOD3a.js +0 -1
- package/dist/cli/env-DlgfvI8U.js +0 -143
- package/dist/cli/files-C5JfVnj5.js +0 -972
- package/dist/cli/gen-DHW1qENn.js +0 -307
- package/dist/cli/init-CZifzAUD.js +0 -397
- package/dist/cli/introspect-Dfwu5vAg.js +0 -51
- package/dist/cli/keys-iJs_1WT8.js +0 -106
- package/dist/cli/live-1eL2MIkS.js +0 -344
- package/dist/cli/mcp-CaFW6uKU.js +0 -240
- package/dist/cli/metadata-DkOQHZoH.js +0 -146
- package/dist/cli/migration-safety-BsCKKxPf.js +0 -305
- package/dist/cli/module-migration-CbX-jRhV.js +0 -606
- package/dist/cli/moved-CdNtCf4t.js +0 -161
- package/dist/cli/names-D6LrQnOv.js +0 -6
- package/dist/cli/parse-CRZLku1b.js +0 -182
- package/dist/cli/preset-C4fagbhZ.js +0 -130
- package/dist/cli/run-CE2s5TDh.js +0 -711
- package/dist/cli/run-Du5XPOCv.js +0 -63
- package/dist/cli/run-KXjrgNCH.js +0 -2378
- package/dist/cli/scaffold-CPH8sEhw.js +0 -901
- package/dist/cli/scaffold-DS6g3INp.js +0 -1
- package/dist/cli/seed-D6V-T5Af.js +0 -188
- package/dist/cli/seed-DPQaA8aP.js +0 -1
- package/dist/cli/shared-CCpxS5if.js +0 -151
- package/dist/cli/skills-Bz4INB8f.js +0 -121
- package/dist/cli/snapshot-Dkwxc1uV.js +0 -351
- package/dist/cli/source-args-DZV4RnZL.js +0 -59
- package/dist/cli/spec-B3Tbc7Dm.js +0 -7534
- package/dist/cli/spec-Cv1GYrcW.js +0 -1
- package/dist/cli/sql-C58MS9DI.js +0 -348
- package/dist/cli/sql-DVPw5tvO.js +0 -2
- package/dist/cli/stack-_F_JhllX.js +0 -135
- package/dist/cli/sync-CjkKpI6d.js +0 -91
- package/dist/cli/typegen-F9GEjpvD.js +0 -502
- package/dist/cli/typegen-version-BNBPI4Eu.js +0 -9
- package/dist/cli/version-CTqnp3HO.js +0 -4
- package/dist/cli/write-3qdrpS1v.js +0 -201
- package/dist/client--tyFmxDT.js +0 -52
- package/dist/client-7_4Y21ue.d.ts +0 -122
- package/dist/client-B1cjaIfv.js +0 -116
- package/dist/client-B2GCMvfd.d.ts +0 -451
- package/dist/client-B8cHiZfF.js +0 -67
- package/dist/client-BIMg9IiF.d.ts +0 -349
- package/dist/client-BKGVUgo7.js +0 -380
- package/dist/client-BNaOcfeH.js +0 -58
- package/dist/client-BQseXods.d.ts +0 -309
- package/dist/client-BSnf6fn6.d.ts +0 -59
- package/dist/client-BW3-RUbq.js +0 -235
- package/dist/client-BYAY7lLs.d.ts +0 -137
- package/dist/client-BcXmbm4f.js +0 -173
- package/dist/client-BgmVu505.js +0 -167
- package/dist/client-Bj0xrUzr.js +0 -437
- package/dist/client-Bn0qqRBg.d.ts +0 -37
- package/dist/client-Bni68sve.d.ts +0 -136
- package/dist/client-BrtwaIBh.d.ts +0 -74
- package/dist/client-BtRx0-kn.js +0 -82
- package/dist/client-BteuBPIy.js +0 -337
- package/dist/client-C1TxDBgX.js +0 -111
- package/dist/client-C1zOmnS8.js +0 -89
- package/dist/client-C56l0MnY.d.ts +0 -177
- package/dist/client-CA6KuLDu.d.ts +0 -223
- package/dist/client-CBcq7LBg.d.ts +0 -178
- package/dist/client-CGJrSTMZ.js +0 -234
- package/dist/client-CLIBcMzL.d.ts +0 -116
- package/dist/client-COuIfjbB.d.ts +0 -46
- package/dist/client-CVToJ4uI.js +0 -84
- package/dist/client-C_0XZieg.js +0 -287
- package/dist/client-CebKlRU7.js +0 -157
- package/dist/client-ChOJ4v0D.js +0 -137
- package/dist/client-CnENAa0E.d.ts +0 -69
- package/dist/client-Cp79i2ZE.d.ts +0 -152
- package/dist/client-CwKsEl6q.js +0 -99
- package/dist/client-D-LPdEDQ.d.ts +0 -43
- package/dist/client-D6gD9qt9.d.ts +0 -45
- package/dist/client-DBwWXQKF.d.ts +0 -132
- package/dist/client-DD3EcytK.js +0 -65
- package/dist/client-DScMvaty.js +0 -38
- package/dist/client-DT6Tvudr.d.ts +0 -54
- package/dist/client-DU1_Jq4e.d.ts +0 -116
- package/dist/client-Dd-a0tup.d.ts +0 -475
- package/dist/client-Dh8zXgpq.js +0 -1060
- package/dist/client-DkI0oyR7.js +0 -76
- package/dist/client-DmjG9PHH.js +0 -211
- package/dist/client-DnUFHmje.js +0 -129
- package/dist/client-Do5hykMK.d.ts +0 -38
- package/dist/client-DzOL3lsV.d.ts +0 -110
- package/dist/client-DzukpHS1.d.ts +0 -165
- package/dist/client-LngH55pZ.d.ts +0 -83
- package/dist/client-PPSwiJaK.js +0 -291
- package/dist/client-RoAuPQNB.d.ts +0 -103
- package/dist/client-WzuQExHk.js +0 -253
- package/dist/client-Y_HnZGF4.js +0 -51
- package/dist/client-bDXsvSXp.d.ts +0 -90
- package/dist/client-bx3Bk7c5.d.ts +0 -64
- package/dist/client-jgDU7Roj.d.ts +0 -144
- package/dist/client-kRvHKAKS.js +0 -60
- package/dist/client-pxXoQOdC.js +0 -40
- package/dist/client-yIxEJwTK.js +0 -121
- package/dist/cloud-event-SPyXMdcd.d.ts +0 -64
- package/dist/codecs-CQrX3ZW4.js +0 -358
- package/dist/codecs-DAu2sYWn.d.ts +0 -222
- package/dist/comments-CB8pFSV1.js +0 -142
- package/dist/compiler-BCyHFI6n.d.ts +0 -14
- package/dist/compose--4D1FoPN.js +0 -53
- package/dist/composite-Dv6o2BSw.js +0 -130
- package/dist/composite-KllwFim2.d.ts +0 -82
- package/dist/config-BuOz_O-y.d.ts +0 -2152
- package/dist/config-Dh4D8lBa.js +0 -13931
- package/dist/config-Dn0cC3bM.js +0 -1093
- package/dist/connector-BdCE4Efp.d.ts +0 -164
- package/dist/connectors-DDiSNvkF.d.ts +0 -147
- package/dist/context-9Q23weHu.d.ts +0 -524
- package/dist/context-CMxVnPMY.js +0 -9
- package/dist/context-CYquqpA6.js +0 -41
- package/dist/controller-CSsC9s3s.js +0 -73
- package/dist/controller-DAD4hbl4.d.ts +0 -52
- package/dist/create-blocks-kPUhCvje.js +0 -217
- package/dist/cron-_i5pBGkY.js +0 -148
- package/dist/cron-route-Y0eJ-FNi.js +0 -24
- package/dist/deal-forecast-CBlp20PY.js +0 -39
- package/dist/define-DQznpZYl.js +0 -2023
- package/dist/define-Dw7pRO4h.d.ts +0 -1123
- package/dist/define-block-COpcS6aT.d.ts +0 -1338
- package/dist/define-block-Dze77QTw.js +0 -56
- package/dist/delegation-CeXm9AJ3.js +0 -146
- package/dist/documents-kgDOHUfn.d.ts +0 -152
- package/dist/embeddings-CcRP-cMN.d.ts +0 -78
- package/dist/employees-Dwyvxs4r.d.ts +0 -180
- package/dist/ended--Bd_Q6uL.d.ts +0 -76
- package/dist/engagements-CsJhf2OM.d.ts +0 -179
- package/dist/entitlements-B_ttRvI6.js +0 -45
- package/dist/entitlements-DDevu4ZE.d.ts +0 -54
- package/dist/entity-form-B67vq97h.d.ts +0 -82
- package/dist/entity-naming-DLDhHTbK.js +0 -131
- package/dist/entity-schema-BXXC1NnT.js +0 -39
- package/dist/envelope-DCfHtVtZ.js +0 -90
- package/dist/errors-03ysrOt4.js +0 -325
- package/dist/errors-DZx8w-MH.js +0 -44
- package/dist/escape-like-BfXS-iVe.d.ts +0 -30
- package/dist/eve-BlJI8ZXL.d.ts +0 -157
- package/dist/event-calendar-D3SVa3AE.d.ts +0 -65
- package/dist/events-DbLjvxDX.d.ts +0 -852
- package/dist/executor-BDAGTc_O.js +0 -207
- package/dist/executor-BElVQpaB.d.ts +0 -188
- package/dist/executor-CPyrQdjh.d.ts +0 -700
- package/dist/executor-CsTaO3AT.d.ts +0 -37
- package/dist/executor-DQoczQZJ.d.ts +0 -104
- package/dist/executor-QtVn0axs.js +0 -147
- package/dist/executor-o9HkOJ0m.js +0 -869
- package/dist/expo-sqlite/index.d.ts +0 -61
- package/dist/expo-sqlite/index.js +0 -110
- package/dist/feature-BBLdbGu7.js +0 -224
- package/dist/field-errors-vshYTVKr.d.ts +0 -166
- package/dist/field-formats-DbjaDXoZ.d.ts +0 -39
- package/dist/fields-CanaxA0U.d.ts +0 -75
- package/dist/fields-DK30XCgc.js +0 -107
- package/dist/filter-evaluate-C3i2bGfk.d.ts +0 -37
- package/dist/filter-evaluate-CRDXv0Dl.js +0 -217
- package/dist/filter-query-D4ZSwbcJ.js +0 -524
- package/dist/filter-query-o3b_GuyC.d.ts +0 -133
- package/dist/flags-BTDPaN11.d.ts +0 -246
- package/dist/flags-BhYByvP1.js +0 -279
- package/dist/flows/index.d.ts +0 -247
- package/dist/flows/index.js +0 -229
- package/dist/format-AYHceC2m.d.ts +0 -79
- package/dist/framework-CXoyWGgd.js +0 -57
- package/dist/framework-FxfJpyoF.d.ts +0 -41
- package/dist/function-contract-vPqwt1j4.d.ts +0 -27
- package/dist/gateway-DI8dbOml.d.ts +0 -115
- package/dist/graph-B4eubUQG.js +0 -365
- package/dist/groups-CxonH3u5.js +0 -16
- package/dist/http-51t9xppD.js +0 -28
- package/dist/impersonation-CZD9AOAk.js +0 -62
- package/dist/inbox-BPBb6etH.d.ts +0 -321
- package/dist/index-BSUX4dlB.d.ts +0 -305
- package/dist/index-BgSuw4CC.d.ts +0 -151
- package/dist/index-C7CrdGgz.d.ts +0 -562
- package/dist/index-CvxK2BZS.d.ts +0 -847
- package/dist/index-CxZQgNVE.d.ts +0 -62
- package/dist/index-D4420jLW.d.ts +0 -66
- package/dist/index-DK-YTWLd.d.ts +0 -443
- package/dist/index-DbXWcrOI.d.ts +0 -577
- package/dist/index-U0o7kU0s.d.ts +0 -69
- package/dist/index-WEafENqH.d.ts +0 -149
- package/dist/index-Yep7auV-.d.ts +0 -287
- package/dist/index-eTY4kJzo.d.ts +0 -163
- package/dist/invalidate-BLiBFbLy.d.ts +0 -19
- package/dist/json-schema-DWDTfD8J.js +0 -888
- package/dist/jwks-cache-CRymV-Dr.js +0 -49
- package/dist/kit-Ct4Z6GIO.js +0 -127
- package/dist/kit-DKfbNTAA.d.ts +0 -94
- package/dist/knowledge-BKGrXdS_.js +0 -272
- package/dist/knowledge-CFkCRxO9.d.ts +0 -202
- package/dist/list-query-BtluNnYk.d.ts +0 -222
- package/dist/list-query-CuS1w2Af.js +0 -559
- package/dist/live-CZtRMh62.js +0 -246
- package/dist/mentions-ByYnRNIG.js +0 -114
- package/dist/messages-DNzIVvgN.js +0 -492
- package/dist/messaging-BC-P-yAv.js +0 -329
- package/dist/messaging-CZ6aWb10.d.ts +0 -297
- package/dist/methods-7u6vSgz_.js +0 -11
- package/dist/mfa-wrx1rqJT.d.ts +0 -36
- package/dist/model-Btl8X9cs.d.ts +0 -326
- package/dist/model-messages-D-jVOIOK.js +0 -206
- package/dist/money-codec-jMP0PQLZ.js +0 -41
- package/dist/onboarding-CGMuX7sP.js +0 -68
- package/dist/openapi/index.d.ts +0 -5
- package/dist/openapi/index.js +0 -36
- package/dist/operations-nWYRexee.d.ts +0 -6
- package/dist/options-289GJc2l.d.ts +0 -52
- package/dist/options-70OsM-wK.js +0 -10
- package/dist/options-B7EJaOX-.js +0 -5
- package/dist/options-BkpqTGrJ.js +0 -8
- package/dist/options-Blg8lAkz.js +0 -9
- package/dist/options-Bn4cu0gt.js +0 -5
- package/dist/options-BnoJOwXK.js +0 -8
- package/dist/options-C2HesT4A.js +0 -9
- package/dist/options-C3EzJATk.js +0 -10
- package/dist/options-C3hZ1fbC.js +0 -10
- package/dist/options-CAzVf-1T.js +0 -8
- package/dist/options-CGKSUFUq.js +0 -5
- package/dist/options-CGjGE8xS.js +0 -12
- package/dist/options-CUqQ9pm7.js +0 -9
- package/dist/options-CalPr6kN.d.ts +0 -12
- package/dist/options-CfxBliP6.d.ts +0 -17
- package/dist/options-ChD15QxJ.js +0 -9
- package/dist/options-CmoJsd4V.d.ts +0 -8
- package/dist/options-CyD7OObW.js +0 -17
- package/dist/options-D1blDihM.js +0 -9
- package/dist/options-D2Gd6VfS.js +0 -8
- package/dist/options-D4aD9qwB.js +0 -5
- package/dist/options-D65jzn7S.js +0 -5
- package/dist/options-D7f2VKzj.js +0 -25
- package/dist/options-D7sgG1bQ.js +0 -16
- package/dist/options-DJm31rsi.d.ts +0 -16
- package/dist/options-DXqcJyOP.js +0 -10
- package/dist/options-DXuA4JVa.d.ts +0 -15
- package/dist/options-DZupPoI0.d.ts +0 -10
- package/dist/options-Dm-2crCx.d.ts +0 -273
- package/dist/options-Dmg1Da9P.js +0 -25
- package/dist/options-DsUgamiy.js +0 -5
- package/dist/options-DujalSfR.js +0 -10
- package/dist/options-Dz3hJxUw.d.ts +0 -10
- package/dist/options-HSv8R6h5.js +0 -13
- package/dist/options-I8zVkB_y.js +0 -8
- package/dist/options-MHhjOoWz.js +0 -5
- package/dist/options-MLxMkd5B.js +0 -11
- package/dist/options-MQfTGMgP.d.ts +0 -14
- package/dist/options-OJ5zmgr8.js +0 -10
- package/dist/options-OMAUVcKK.d.ts +0 -10
- package/dist/options-_9arpsX9.js +0 -11
- package/dist/options-a-28mlYT.js +0 -9
- package/dist/options-kLKILdIu.js +0 -10
- package/dist/options-n22NK3PL.js +0 -8
- package/dist/options-qU8vgxhO.js +0 -18
- package/dist/options-te6d5-yz.d.ts +0 -19
- package/dist/options-wFnK3qWl.js +0 -9
- package/dist/options-xVAy3UsV.js +0 -9
- package/dist/organizations-DtehZg3J.js +0 -401
- package/dist/outbox-CsF_iKjx.d.ts +0 -199
- package/dist/overlay/index.d.ts +0 -249
- package/dist/overlay/index.js +0 -561
- package/dist/payments-BtScsgPS.js +0 -16
- package/dist/payments-CBzQIjoX.d.ts +0 -114
- package/dist/permissions-BetA_Fo_.js +0 -34
- package/dist/plugin-Ar5546xh.d.ts +0 -202
- package/dist/plugin-D9bYbYli.js +0 -45
- package/dist/plugins/actor/index.d.ts +0 -19
- package/dist/plugins/actor/index.js +0 -57
- package/dist/plugins/rules/index.d.ts +0 -96
- package/dist/plugins/rules/index.js +0 -235
- package/dist/plugins/soft-delete/index.d.ts +0 -39
- package/dist/plugins/soft-delete/index.js +0 -90
- package/dist/plugins/tenant/index.d.ts +0 -60
- package/dist/plugins/tenant/index.js +0 -119
- package/dist/plugins/timestamps/index.d.ts +0 -11
- package/dist/plugins/timestamps/index.js +0 -47
- package/dist/plugins/validation/index.d.ts +0 -24
- package/dist/plugins/validation/index.js +0 -83
- package/dist/pool-CRkU15dA.d.ts +0 -123
- package/dist/pool-errors-B17BQRW-.js +0 -27
- package/dist/ports-DsJicwI2.d.ts +0 -89
- package/dist/ports-yajgT0t0.js +0 -139
- package/dist/postgrest-DHLlN2nS.d.ts +0 -53
- package/dist/powersync/react/index.d.ts +0 -93
- package/dist/powersync/react/index.js +0 -120
- package/dist/preset-DzcQ5CQM.js +0 -841
- package/dist/problem-BWElIgIb.js +0 -162
- package/dist/problem-DpHB7tWl.d.ts +0 -79
- package/dist/provider-DmiaI1qt.d.ts +0 -112
- package/dist/provider-EJ0-5GwJ.js +0 -57
- package/dist/push-token-BxKmYhwk.d.ts +0 -24
- package/dist/queries-Dw8y9bvz.js +0 -245
- package/dist/rank-result-C_sHjkiz.js +0 -18
- package/dist/rank-result-DwR0FawB.d.ts +0 -14
- package/dist/rate-limit-B_U12PdL.js +0 -49
- package/dist/rate-limit-CrOuXfjj.d.ts +0 -50
- package/dist/rate-limit-DExDw3Cy.js +0 -327
- package/dist/react-28VgUbm9.js +0 -852
- package/dist/react-controller-CKSdtJ10.js +0 -43
- package/dist/react-env-CfA3EdBH.js +0 -20
- package/dist/read-set-BAR84kPC.js +0 -199
- package/dist/recordings-DgDu7AOt.d.ts +0 -119
- package/dist/refusal-DXydjgsS.js +0 -64
- package/dist/refusal-efy5bZMd.d.ts +0 -32
- package/dist/replicas-BvIL4_jL.js +0 -94
- package/dist/resolve-CzUKTIMq.d.ts +0 -289
- package/dist/resolve-DAYdcs22.js +0 -892
- package/dist/resolved-names-Dr7brlLL.js +0 -133
- package/dist/resource-BRRU-A7j.js +0 -91
- package/dist/resource-DYDEnww-.d.ts +0 -115
- package/dist/resource-Dk_JYsOt.js +0 -469
- package/dist/resource-execute-bT9ltHVT.d.ts +0 -15
- package/dist/resource-types-Bzt_bpR5.d.ts +0 -153
- package/dist/resources-BV6j5TTD.js +0 -64
- package/dist/resources-Du5wcL3f.d.ts +0 -7
- package/dist/respond-CZYibxUx.d.ts +0 -101
- package/dist/respond-z_yfyitp.js +0 -100
- package/dist/result-B3m7xtRY.js +0 -146
- package/dist/result-C6jDfedy.d.ts +0 -350
- package/dist/rows-Bb0EPupt.js +0 -80
- package/dist/rows-CtLWqdGQ.js +0 -39
- package/dist/rrule-xDm2znty.js +0 -290
- package/dist/rules-DcW5mj1r.js +0 -287
- package/dist/run-state-CPo-1X2B.d.ts +0 -12
- package/dist/sales-lines-9HsX89aO.d.ts +0 -28
- package/dist/sales-lines-BhrIx2oK.js +0 -41
- package/dist/sales-shared-C_u68eq2.js +0 -22
- package/dist/sales-shared-DAAGwQwN.d.ts +0 -8
- package/dist/schemas-9Ci3K0Hk.js +0 -103
- package/dist/schemas-ypoQZ_6N.js +0 -157
- package/dist/scores-CsURQDUB.d.ts +0 -172
- package/dist/scores-DdPZVVt8.js +0 -177
- package/dist/search-ToCOlCZ8.js +0 -106
- package/dist/sections-DjxYmpu-.js +0 -26
- package/dist/server-types-BOs-eFpo.d.ts +0 -809
- package/dist/session-BgsOPGZs.d.ts +0 -97
- package/dist/settings-mL-i7QUM.js +0 -93
- package/dist/shared-LmlfYPv4.js +0 -60
- package/dist/shared-eVrl39dX.js +0 -17
- package/dist/sign-in-lAyf6Ohy.js +0 -386
- package/dist/signatures-GUBuhLOB.js +0 -145
- package/dist/signatures-zbu6KTNQ.d.ts +0 -43
- package/dist/signers-D6ecZl22.d.ts +0 -390
- package/dist/signing-keys-B3RHGMMu.d.ts +0 -119
- package/dist/signing-keys-fWapUzi0.js +0 -164
- package/dist/solid-bind-C1jeq4Qm.d.ts +0 -11
- package/dist/solid-bind-iHGfGtBK.js +0 -38
- package/dist/solid-controller-DGuv7V8a.js +0 -13
- package/dist/spec-CoWHDoud.js +0 -119
- package/dist/spec-pins-CZ2CL8YZ.d.ts +0 -120
- package/dist/spec-pins-D3Tm6HJi.js +0 -60
- package/dist/sql-CVYjOUyG.js +0 -421
- package/dist/sql-rQDL6PIL.js +0 -122247
- package/dist/sso-B744gHeS.d.ts +0 -161
- package/dist/sso-Bt9HocgW.js +0 -217
- package/dist/standard-DbQsD2xZ.d.ts +0 -7
- package/dist/standard-DtkpFGkS.js +0 -25
- package/dist/stats-qCEV5M3B.js +0 -1147
- package/dist/store-o0HwYXl8.d.ts +0 -83
- package/dist/subject-readers-CsTpx44c.js +0 -49
- package/dist/subject-readers-DEZ45DQF.d.ts +0 -21
- package/dist/subjects-B6p4oAZJ.d.ts +0 -78
- package/dist/subjects-DXFmanh5.d.ts +0 -90
- package/dist/subjects-DevU_atb.js +0 -107
- package/dist/support-Ds1-UCN4.js +0 -534
- package/dist/support-view-vwJbRMpV.d.ts +0 -17
- package/dist/svelte-bind-BHN5a8VV.js +0 -46
- package/dist/svelte-bind-Ja6CtQGp.d.ts +0 -13
- package/dist/svelte-controller-oFKC9AYu.js +0 -19
- package/dist/table-schema-BcB-VCQb.js +0 -293
- package/dist/table-schema-Cb-IV_pZ.d.ts +0 -78
- package/dist/tags-CLXi2c6O.d.ts +0 -30
- package/dist/tags-C_ym1yDM.js +0 -39
- package/dist/tags-EnvIccSJ.js +0 -86
- package/dist/tanstack-db/supabase/index.d.ts +0 -66
- package/dist/tanstack-db/supabase/index.js +0 -271
- package/dist/tax-CIIxd8Zf.d.ts +0 -170
- package/dist/tax-DmOMjrYc.js +0 -140
- package/dist/tee-DwkUvJD_.js +0 -101
- package/dist/template-BWP7IXZg.js +0 -126
- package/dist/temporal-required-B8qQHYbI.js +0 -20
- package/dist/tenant-Bg4PDLkG.d.ts +0 -17
- package/dist/tenant-DnMqeNIM.js +0 -27
- package/dist/timeline-0_hTBH0-.js +0 -52
- package/dist/timeline-DUUsPLv5.d.ts +0 -152
- package/dist/timing-C5NzaEgy.js +0 -95
- package/dist/topic-CPOmMgkf.js +0 -643
- package/dist/topic-D9j8G2dw.d.ts +0 -415
- package/dist/types-BEDfwXL4.d.ts +0 -251
- package/dist/types-BRJHGhSq.d.ts +0 -177
- package/dist/types-BTK75521.js +0 -8
- package/dist/types-CGUDoF5I.d.ts +0 -624
- package/dist/types-DkPE7yd2.d.ts +0 -194
- package/dist/types-QHeku_6b.d.ts +0 -217
- package/dist/types-uHD9yANu.d.ts +0 -700
- package/dist/undo-B696duxr.d.ts +0 -46
- package/dist/undo-vutx78k8.js +0 -44
- package/dist/upload-claim-D_wgDbi7.js +0 -33
- package/dist/usage-BI1E2940.js +0 -264
- package/dist/usage-DBcVGqnr.d.ts +0 -232
- package/dist/user-change-CSR_prhd.js +0 -133
- package/dist/variants-DL7NpFJ7.js +0 -53
- package/dist/vault-BQTdu4eH.d.ts +0 -62
- package/dist/verify-27w0I5C9.js +0 -130
- package/dist/verify-BmuCB4PW.d.ts +0 -146
- package/dist/view-2_I-2ukO.d.ts +0 -90
- package/dist/view-BtgqxQLM.js +0 -108
- package/dist/vue-bind-CFxon-Vs.js +0 -45
- package/dist/vue-bind-TPkbLl4z.d.ts +0 -11
- package/dist/vue-controller-WtbuT-Ux.js +0 -13
- package/dist/watch-CfMT6vX7.js +0 -139
- package/dist/watch-DziJudwj.d.ts +0 -93
- package/dist/watch-topic-CIT3UlAh.d.ts +0 -31
- package/dist/wire-Bizdxvp-.js +0 -66
- package/dist/work-items-Cnntm8ij.d.ts +0 -238
- package/dist/workflow-builder-2q1iqHYG.js +0 -699
- package/dist/workflow-sdk-BTYWQQg9.d.ts +0 -163
- package/dist/workflow-sdk-_pqDUwNK.js +0 -242
- package/dist/workflow-sdk-world-BIwGVy6S.js +0 -2401
- package/dist/workflows-D8U7KyXJ.d.ts +0 -258
- package/dist/workflows-VJBSV-QR.js +0 -285
- package/skills/better-supabase/references/plugins.md +0 -71
|
@@ -0,0 +1,4129 @@
|
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
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 ResolvedBlock, E as NamedInstance, F as BlockNameRegistry, P as TablesOf, 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-HZdJCaVm.js";
|
|
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-BVcLQ3DF.js";
|
|
5
|
+
import { a as ScalarKind, i as FieldSpec } from "./table-schema-BlF6k62Q.js";
|
|
6
|
+
import { n as SubjectsConfig } from "./subjects-DvmQeF_F.js";
|
|
7
|
+
import { i as FIELD_FORMAT_NAMES, s as FieldFormatName } from "./field-formats-CAFNkKSN.js";
|
|
8
|
+
import { t as GuestAction } from "./guest-actions-1T1DeS5Y.js";
|
|
9
|
+
//#region src/config/names.d.ts
|
|
10
|
+
/** The steps `better-supabase gen` runs, in the order it runs them. */
|
|
11
|
+
declare const GEN_TASKS: readonly ["types", "sql", "spec", "seed", "env"];
|
|
12
|
+
/** Glue `better-supabase init` and `add` write for a framework or runtime. */
|
|
13
|
+
declare const INTEGRATION_NAMES: readonly ["next", "hono", "orpc", "edge", "expo", "mcp", "client", "react"];
|
|
14
|
+
/**
|
|
15
|
+
* An integration as `init`, `add` and `/create` show it, and the integrations
|
|
16
|
+
* it needs.
|
|
17
|
+
*/
|
|
18
|
+
interface IntegrationInfo {
|
|
19
|
+
readonly title: string;
|
|
20
|
+
/** What `init` or `add` writes, one sentence. */
|
|
21
|
+
readonly description: string;
|
|
22
|
+
readonly requires: readonly (typeof INTEGRATION_NAMES)[number][];
|
|
23
|
+
}
|
|
24
|
+
declare const INTEGRATION_INFO: Readonly<Record<(typeof INTEGRATION_NAMES)[number], IntegrationInfo>>;
|
|
25
|
+
/** The agent folders `better-supabase skills install` writes to. */
|
|
26
|
+
declare const SKILLS_AGENTS: readonly ["cursor", "claude", "agents"];
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/config/types/tooling.d.ts
|
|
29
|
+
interface OpenApiConfig {
|
|
30
|
+
/**
|
|
31
|
+
* Module exporting the document (or a function returning it) as `openapi` or
|
|
32
|
+
* default.
|
|
33
|
+
*/
|
|
34
|
+
readonly entry?: string;
|
|
35
|
+
/** JSON file `better-supabase spec emit openapi` writes. */
|
|
36
|
+
readonly output?: string;
|
|
37
|
+
}
|
|
38
|
+
/** A docs UI `spec emit --ui` writes next to an OpenAPI document. */
|
|
39
|
+
type SpecUiName = "scalar" | "swagger" | "redoc" | "elements" | "rapidoc";
|
|
40
|
+
/** One document `better-supabase spec emit` writes. */
|
|
41
|
+
interface SpecOutputConfig {
|
|
42
|
+
/** A format id: `openapi`, `asyncapi` or `arazzo`. */
|
|
43
|
+
readonly format: string;
|
|
44
|
+
/** Defaults to the format's default version, e.g. `3.1` for OpenAPI. */
|
|
45
|
+
readonly version?: string;
|
|
46
|
+
/** File to write, relative to the root. Defaults to the format's file name. */
|
|
47
|
+
readonly output?: string;
|
|
48
|
+
/** Overlay files (JSON or YAML), applied in order. */
|
|
49
|
+
readonly overlays?: readonly string[];
|
|
50
|
+
/**
|
|
51
|
+
* Defaults to `yaml` when `output` ends in `.yaml` or `.yml`, otherwise
|
|
52
|
+
* `json`.
|
|
53
|
+
*/
|
|
54
|
+
readonly serialize?: "json" | "yaml";
|
|
55
|
+
/**
|
|
56
|
+
* Also writes a reference page (`openapi.html` for `openapi.json`) next to
|
|
57
|
+
* OpenAPI outputs.
|
|
58
|
+
*/
|
|
59
|
+
readonly ui?: SpecUiName;
|
|
60
|
+
}
|
|
61
|
+
interface SpecsConfig {
|
|
62
|
+
/**
|
|
63
|
+
* Module exporting a `defineApi()` result (or a function returning one) as
|
|
64
|
+
* `api` or default.
|
|
65
|
+
*/
|
|
66
|
+
readonly entry?: string;
|
|
67
|
+
/** The documents to write. Defaults to one OpenAPI document. */
|
|
68
|
+
readonly outputs?: readonly SpecOutputConfig[];
|
|
69
|
+
/**
|
|
70
|
+
* The lowest severity that fails `spec emit`, `check` and `validate`.
|
|
71
|
+
* Defaults to `error`.
|
|
72
|
+
*/
|
|
73
|
+
readonly failOn?: "error" | "warning" | "never";
|
|
74
|
+
/**
|
|
75
|
+
* Also write the diagnostics manifest (JSON) to this file, like `spec
|
|
76
|
+
* --manifest`.
|
|
77
|
+
*/
|
|
78
|
+
readonly manifest?: string;
|
|
79
|
+
}
|
|
80
|
+
/** A step `better-supabase gen` runs. */
|
|
81
|
+
type GenTask = (typeof GEN_TASKS)[number];
|
|
82
|
+
interface GenConfig {
|
|
83
|
+
/**
|
|
84
|
+
* The steps `better-supabase gen` runs, in this order: `types` (the generated
|
|
85
|
+
* modules and `generators`), `sql` (`upgrade`), `spec` (`spec emit`), `seed`
|
|
86
|
+
* and `env`. Without a list, `types` runs, plus `sql` when `blocks` or
|
|
87
|
+
* `realtime.policies` is set, and `spec` and `seed` when their entry file
|
|
88
|
+
* exists. `env` runs only when listed, because it needs the local stack. A
|
|
89
|
+
* listed step always runs.
|
|
90
|
+
*/
|
|
91
|
+
readonly tasks?: readonly GenTask[];
|
|
92
|
+
/** Milliseconds between checks in `gen --watch` and `spec emit --watch`. */
|
|
93
|
+
readonly watchInterval?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Serves the schema types through the TypeScript 7.1 content mapper instead
|
|
96
|
+
* of writing them. `gen` then writes a slim `generated.ts` with the runtime
|
|
97
|
+
* values and a `schema.bsb` next to it, and no `database.types.ts`. The app
|
|
98
|
+
* still imports from `./generated`. Needs a `contentMappers` entry in
|
|
99
|
+
* `tsconfig.json` and `tsc --runExternalCode`. Defaults to `false`.
|
|
100
|
+
*/
|
|
101
|
+
readonly contentMapper?: boolean;
|
|
102
|
+
}
|
|
103
|
+
/** Glue `better-supabase init` and `add` write for a framework or runtime. */
|
|
104
|
+
type IntegrationName = (typeof INTEGRATION_NAMES)[number];
|
|
105
|
+
interface EnvFileConfig {
|
|
106
|
+
/** Env file `better-supabase dev env` writes. Defaults to `.env.local`. */
|
|
107
|
+
readonly output?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Prefix for the browser variables, such as `NEXT_PUBLIC_`; `'none'` for no
|
|
110
|
+
* prefix. Detected from the framework by default.
|
|
111
|
+
*/
|
|
112
|
+
readonly prefix?: string;
|
|
113
|
+
}
|
|
114
|
+
/** An agent folder `better-supabase skills install` writes to. */
|
|
115
|
+
type SkillsAgent = (typeof SKILLS_AGENTS)[number];
|
|
116
|
+
interface SkillsConfig {
|
|
117
|
+
/** Defaults to the agent folders the project has, else `agents`. */
|
|
118
|
+
readonly agents?: readonly SkillsAgent[];
|
|
119
|
+
}
|
|
120
|
+
interface KeysConfig {
|
|
121
|
+
/**
|
|
122
|
+
* Signing key file `better-supabase dev keys` writes. Defaults to
|
|
123
|
+
* `supabase/signing_keys.json`.
|
|
124
|
+
*/
|
|
125
|
+
readonly output?: string;
|
|
126
|
+
}
|
|
127
|
+
interface DoctorConfig {
|
|
128
|
+
/** Finding codes to skip, e.g. `['BS204']`. */
|
|
129
|
+
readonly ignore?: readonly string[];
|
|
130
|
+
/** Run only these checks, e.g. `['BS100', 'BS304']`. */
|
|
131
|
+
readonly only?: readonly string[];
|
|
132
|
+
/** Treat warnings as errors. */
|
|
133
|
+
readonly strict?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Report format: `text` (default), `sarif` (code scanning) or `github`
|
|
136
|
+
* (workflow annotations). `--json` still wins.
|
|
137
|
+
*/
|
|
138
|
+
readonly format?: "text" | "sarif" | "github";
|
|
139
|
+
/** Write the report to this file. */
|
|
140
|
+
readonly output?: string;
|
|
141
|
+
/**
|
|
142
|
+
* App source files doctor scans for API use (BS210). Globs relative to the
|
|
143
|
+
* root. Defaults to `['src/**\/*.{ts,tsx}']`.
|
|
144
|
+
*/
|
|
145
|
+
readonly sources?: readonly string[];
|
|
146
|
+
/**
|
|
147
|
+
* How many policies a security definer helper may appear in before BS206 asks
|
|
148
|
+
* for an inlinable `language sql stable` function. Defaults to 5.
|
|
149
|
+
*/
|
|
150
|
+
readonly policyHelperLimit?: number;
|
|
151
|
+
/**
|
|
152
|
+
* The BS405 limit in bytes. When the authorization provider's token hook has
|
|
153
|
+
* a budget, it replaces that budget and the whole token keeps 2048. Otherwise
|
|
154
|
+
* it limits the whole token's claims (default 2048).
|
|
155
|
+
*/
|
|
156
|
+
readonly claimsLimit?: number;
|
|
157
|
+
/** Which migrations the lock checks (BS229 to BS235) read. */
|
|
158
|
+
readonly migrationSafety?: MigrationSafetyConfig;
|
|
159
|
+
}
|
|
160
|
+
interface MigrationSafetyConfig {
|
|
161
|
+
/**
|
|
162
|
+
* The newest migration that is already applied everywhere, by file name
|
|
163
|
+
* (`20260101000000_init.sql`) or version (`20260101000000`). Offline, doctor
|
|
164
|
+
* checks only the migrations after it; with `--db-url` it checks the ones the
|
|
165
|
+
* database hasn't applied. `init` and `add --adopt` set it to the latest
|
|
166
|
+
* migration.
|
|
167
|
+
*/
|
|
168
|
+
readonly since?: string;
|
|
169
|
+
}
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/preset/fields.d.ts
|
|
172
|
+
/**
|
|
173
|
+
* How `/create` and `init` show one value: its label and, where the label is
|
|
174
|
+
* not enough, a hint.
|
|
175
|
+
*/
|
|
176
|
+
interface PresetValueInfo {
|
|
177
|
+
readonly label: string;
|
|
178
|
+
readonly hint?: string;
|
|
179
|
+
}
|
|
180
|
+
/** One convention a preset sets, with the names `/create` and `init` show. */
|
|
181
|
+
interface PresetField<K extends string = string, V extends string = string> {
|
|
182
|
+
readonly key: K;
|
|
183
|
+
readonly values: readonly V[];
|
|
184
|
+
readonly default: V | readonly V[];
|
|
185
|
+
/** The field takes several values (`integrations`). */
|
|
186
|
+
readonly multi?: true;
|
|
187
|
+
readonly label: string;
|
|
188
|
+
readonly labels: { readonly [P in V]: PresetValueInfo; };
|
|
189
|
+
}
|
|
190
|
+
/** The value each convention field takes. */
|
|
191
|
+
interface PresetConventions {
|
|
192
|
+
readonly framework: PresetFramework;
|
|
193
|
+
readonly platforms: "web" | "native" | "both";
|
|
194
|
+
readonly casing: "snake" | "camel";
|
|
195
|
+
readonly idType: "uuid" | "text" | "bigint" | "integer";
|
|
196
|
+
readonly scope: "tenant" | "user" | "none";
|
|
197
|
+
readonly tenantName: PresetTenantName;
|
|
198
|
+
readonly access: "roles" | "catalog" | "provider" | "custom";
|
|
199
|
+
readonly api: "none" | "api";
|
|
200
|
+
readonly integrations: readonly IntegrationName[];
|
|
201
|
+
}
|
|
202
|
+
/** A convention field's key. */
|
|
203
|
+
type PresetFieldKey = keyof PresetConventions;
|
|
204
|
+
/** The values a convention field takes. */
|
|
205
|
+
type PresetFieldValue<K extends PresetFieldKey> = ValueOf<K>;
|
|
206
|
+
type ValueOf<K extends PresetFieldKey> = PresetConventions[K] extends readonly (infer V extends string)[] ? V : Extract<PresetConventions[K], string>;
|
|
207
|
+
/** The tenant names a preset can set (`blocks.memberships.names.organization`). */
|
|
208
|
+
declare const PRESET_TENANT_NAMES: readonly ["organization", "workspace", "team"];
|
|
209
|
+
type PresetTenantName = (typeof PRESET_TENANT_NAMES)[number];
|
|
210
|
+
/** The frameworks `/create` and `init --preset` set up glue for. */
|
|
211
|
+
declare const PRESET_FRAMEWORKS: readonly ["next", "vite", "tanstack-start", "expo", "sveltekit", "nuxt", "hono", "astro", "react-router"];
|
|
212
|
+
type PresetFramework = (typeof PRESET_FRAMEWORKS)[number];
|
|
213
|
+
/** The convention fields, in the order `/create` and `init` show them. */
|
|
214
|
+
declare const CONVENTION_FIELDS: readonly PresetField<PresetFieldKey>[];
|
|
215
|
+
/** A convention field by key, with its values and labels typed. */
|
|
216
|
+
declare function presetField<K extends PresetFieldKey>(key: K): PresetField<K, ValueOf<K>>;
|
|
217
|
+
/** A field value's label, or the value itself when it has none. */
|
|
218
|
+
declare function presetValueLabel(key: PresetFieldKey, value: string): PresetValueInfo;
|
|
219
|
+
/**
|
|
220
|
+
* The integrations `init --preset` adds for a framework whatever the selection
|
|
221
|
+
* says: the framework's own one, when it has one, then what that one requires.
|
|
222
|
+
*/
|
|
223
|
+
declare function integrationsForFramework(framework: PresetFramework): readonly IntegrationName[];
|
|
224
|
+
type PresetPlatforms = PresetConventions["platforms"];
|
|
225
|
+
type PresetScope = PresetConventions["scope"];
|
|
226
|
+
type PresetAccess = PresetConventions["access"];
|
|
227
|
+
/** A block selection and its conventions. */
|
|
228
|
+
interface Preset extends PresetConventions {
|
|
229
|
+
/**
|
|
230
|
+
* Block names (`blocks` keys in the config), as selected; `resolvePreset`
|
|
231
|
+
* adds what they require.
|
|
232
|
+
*/
|
|
233
|
+
readonly blocks: readonly string[];
|
|
234
|
+
/**
|
|
235
|
+
* `blocks` entries the preset writes: a selected block's names and options
|
|
236
|
+
* (`tasks: { names: { work_item: "ticket" } }`), or another instance of a
|
|
237
|
+
* block (`maintenance: { block: "tasks" }`).
|
|
238
|
+
*/
|
|
239
|
+
readonly instances?: Readonly<Record<string, PresetInstance>>;
|
|
240
|
+
}
|
|
241
|
+
/** A `blocks` entry a preset writes, with the keys a config file uses. */
|
|
242
|
+
interface PresetInstance extends InstanceKeys {
|
|
243
|
+
readonly names?: Readonly<Record<string, string>>;
|
|
244
|
+
readonly options?: Readonly<Record<string, unknown>>;
|
|
245
|
+
readonly tables?: Readonly<Record<string, string | null>>;
|
|
246
|
+
}
|
|
247
|
+
/** Every convention at its default. */
|
|
248
|
+
declare const DEFAULT_CONVENTIONS: PresetConventions;
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/preset/catalog-types.d.ts
|
|
251
|
+
/** One SQL module in the preset catalog: a key of `blocks` in the config. */
|
|
252
|
+
interface PresetCatalogBlock {
|
|
253
|
+
readonly name: string;
|
|
254
|
+
readonly title: string;
|
|
255
|
+
readonly category: BlockCategory;
|
|
256
|
+
/** The modules it needs with the default options. */
|
|
257
|
+
readonly requires: readonly string[];
|
|
258
|
+
/** What it needs instead under an access model, where that differs. */
|
|
259
|
+
readonly requiresByAccess?: Partial<Readonly<Record<PresetAccess, readonly string[]>>>;
|
|
260
|
+
/** The scopes it runs in; unset, every scope. */
|
|
261
|
+
readonly scopes?: readonly PresetScope[];
|
|
262
|
+
/** Tenant names that would rename a table or column to a name it already uses. */
|
|
263
|
+
readonly tenantNameClashes?: readonly PresetTenantName[];
|
|
264
|
+
/**
|
|
265
|
+
* The logical table `options.extraColumns` adds columns to, when it takes
|
|
266
|
+
* them.
|
|
267
|
+
*/
|
|
268
|
+
readonly extraColumns?: string;
|
|
269
|
+
/**
|
|
270
|
+
* The nouns `blocks.<name>.names` renames, with what config resolution needs
|
|
271
|
+
* to name them and register their subjects.
|
|
272
|
+
*/
|
|
273
|
+
readonly entities?: PresetCatalogEntities;
|
|
274
|
+
/** Modules it works with when installed; `*` is every module. */
|
|
275
|
+
readonly integrates: readonly string[];
|
|
276
|
+
/** The manifest that installs it, a key of `manifests`. */
|
|
277
|
+
readonly manifest: string;
|
|
278
|
+
}
|
|
279
|
+
/** A block's entities as the catalog carries them. */
|
|
280
|
+
interface PresetCatalogEntities {
|
|
281
|
+
readonly specs: Readonly<Record<string, BlockSqlEntitySpec>>;
|
|
282
|
+
/** The tables that hold them, with their default names and columns. */
|
|
283
|
+
readonly tables: Readonly<Record<string, Pick<BlockSqlTableSpec, "name" | "columns">>>;
|
|
284
|
+
/** The default permission key of each module action. */
|
|
285
|
+
readonly keys: Readonly<Record<string, string>>;
|
|
286
|
+
}
|
|
287
|
+
/** One block manifest (ADR 0029): what `lib/blocks.ts` wires. */
|
|
288
|
+
interface PresetCatalogManifest {
|
|
289
|
+
readonly name: string;
|
|
290
|
+
/** The SQL modules it installs. */
|
|
291
|
+
readonly sql: readonly string[];
|
|
292
|
+
readonly category: BlockCategory;
|
|
293
|
+
/** Its export and subpath, when it has a TypeScript client. */
|
|
294
|
+
readonly client: {
|
|
295
|
+
readonly export: string;
|
|
296
|
+
readonly subpath: string;
|
|
297
|
+
} | null;
|
|
298
|
+
readonly consumes: Partial<Readonly<Record<PortName, "optional" | "required">>>;
|
|
299
|
+
readonly provides: readonly PortName[];
|
|
300
|
+
/** The export of its subpath that builds its repository extension. */
|
|
301
|
+
readonly extension?: string;
|
|
302
|
+
/**
|
|
303
|
+
* The types its subpath exports that carry one of its entities' names, which
|
|
304
|
+
* `gen` aliases under the renamed names.
|
|
305
|
+
*/
|
|
306
|
+
readonly entityTypes?: readonly PresetCatalogEntityType[];
|
|
307
|
+
/**
|
|
308
|
+
* JSON Schemas of the inputs its client takes, by entity key, from the
|
|
309
|
+
* Standard Schemas the block exports.
|
|
310
|
+
*/
|
|
311
|
+
readonly entitySchemas?: Readonly<Record<string, PresetCatalogEntitySchemas>>;
|
|
312
|
+
/**
|
|
313
|
+
* The block's events: the event map type its subpath exports and the event
|
|
314
|
+
* types, in its default names.
|
|
315
|
+
*/
|
|
316
|
+
readonly events?: {
|
|
317
|
+
readonly type: string;
|
|
318
|
+
readonly types: readonly string[];
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* The write names of its record binding (`block.record`), present when the
|
|
322
|
+
* block binds to records; `gen` puts the block on each served record type.
|
|
323
|
+
*/
|
|
324
|
+
readonly record?: readonly string[];
|
|
325
|
+
/** The env keys it reads, for `.env.example` and doctor's BS504. */
|
|
326
|
+
readonly env?: readonly BlockEnvKey[];
|
|
327
|
+
/** The interfaces the app implements for it, for `providers.ts` and BS505. */
|
|
328
|
+
readonly providers?: readonly BlockProvider[];
|
|
329
|
+
/** The registry items that hold its routes, without the framework suffix. */
|
|
330
|
+
readonly routes?: readonly string[];
|
|
331
|
+
/** The crons or processes it needs. */
|
|
332
|
+
readonly workers?: readonly BlockWorker[];
|
|
333
|
+
/** The action kinds it ships, for the action registry. */
|
|
334
|
+
readonly actions?: readonly ActionDescriptor[];
|
|
335
|
+
/** The timers it runs on the queue's `block_ticks`. */
|
|
336
|
+
readonly schedules?: readonly BlockSchedule[];
|
|
337
|
+
}
|
|
338
|
+
/** One entity's input schemas, in the block's default names. */
|
|
339
|
+
interface PresetCatalogEntitySchemas {
|
|
340
|
+
readonly input?: PresetCatalogInputSchema;
|
|
341
|
+
readonly change?: PresetCatalogInputSchema;
|
|
342
|
+
readonly listFilter?: PresetCatalogInputSchema;
|
|
343
|
+
}
|
|
344
|
+
/** One input schema: its fields as `entitySchema` takes them, and JSON Schema. */
|
|
345
|
+
interface PresetCatalogInputSchema {
|
|
346
|
+
readonly title: string;
|
|
347
|
+
readonly fields: Readonly<Record<string, FieldSpec>>;
|
|
348
|
+
readonly jsonSchema: Readonly<Record<string, unknown>>;
|
|
349
|
+
}
|
|
350
|
+
/** A block type named after one of its entities, such as `WorkItem`. */
|
|
351
|
+
interface PresetCatalogEntityType {
|
|
352
|
+
readonly name: string;
|
|
353
|
+
/** Takes the extra columns as its first type parameter, `F`. */
|
|
354
|
+
readonly fields?: true;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* One item of the `@better-supabase` shadcn registry: glue the app copies (`npx
|
|
358
|
+
* shadcn add @better-supabase/<name>`), for some blocks, frameworks and
|
|
359
|
+
* platforms.
|
|
360
|
+
*/
|
|
361
|
+
interface PresetGlueItem {
|
|
362
|
+
readonly name: string;
|
|
363
|
+
readonly title: string;
|
|
364
|
+
/** The SQL modules the item needs. */
|
|
365
|
+
readonly blocks: readonly string[];
|
|
366
|
+
readonly frameworks: readonly string[];
|
|
367
|
+
readonly platforms: readonly ("web" | "native")[];
|
|
368
|
+
/** Where its files go, as shadcn targets (`@lib/blocks.ts`, `~/app/...`). */
|
|
369
|
+
readonly targets: readonly string[];
|
|
370
|
+
/** The env keys its files read. */
|
|
371
|
+
readonly envVars?: readonly string[];
|
|
372
|
+
/** The named preset a bundle item (`registry:item`) installs the glue of. */
|
|
373
|
+
readonly preset?: string;
|
|
374
|
+
}
|
|
375
|
+
/** What `scripts/build-catalog.ts` writes to `catalog.generated.ts`. */
|
|
376
|
+
interface PresetCatalog {
|
|
377
|
+
readonly blocks: readonly PresetCatalogBlock[];
|
|
378
|
+
readonly manifests: readonly PresetCatalogManifest[];
|
|
379
|
+
readonly glue: readonly PresetGlueItem[];
|
|
380
|
+
}
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region src/config/instances.d.ts
|
|
383
|
+
/** One named install of a block. */
|
|
384
|
+
interface ResolvedInstance {
|
|
385
|
+
/** The key in `blocks`. */
|
|
386
|
+
readonly name: string;
|
|
387
|
+
/** The block it installs. */
|
|
388
|
+
readonly block: string;
|
|
389
|
+
/** The record types it attaches to; unset, every record type. */
|
|
390
|
+
readonly on?: InstanceOn;
|
|
391
|
+
/**
|
|
392
|
+
* Each dependency block to the instance it resolves to, when that is not the
|
|
393
|
+
* instance named after the block: what `uses` sets, and a dependency's only
|
|
394
|
+
* instance when it has another name.
|
|
395
|
+
*/
|
|
396
|
+
readonly uses: Readonly<Record<string, string>>;
|
|
397
|
+
/** Its config, without `block`. */
|
|
398
|
+
readonly config: BlockConfig;
|
|
399
|
+
}
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/sql/contributions.d.ts
|
|
402
|
+
/**
|
|
403
|
+
* What a block adds to a generic block's SQL through `contributes`, keyed by
|
|
404
|
+
* the generic block. The generic block reads the contributions of every
|
|
405
|
+
* installed instance whose `uses` names it, so it never names its consumers.
|
|
406
|
+
*/
|
|
407
|
+
interface BlockContributions {
|
|
408
|
+
readonly approvals: ApprovalContribution;
|
|
409
|
+
readonly bulk: BulkActionContribution;
|
|
410
|
+
readonly numbering: NumberingContribution;
|
|
411
|
+
readonly pipelines: PipelineContribution;
|
|
412
|
+
readonly "share-links": ShareLinkContribution;
|
|
413
|
+
readonly subjects: SubjectContribution;
|
|
414
|
+
}
|
|
415
|
+
/** `BlockSql.contributes`: one function per generic block it adds to. */
|
|
416
|
+
type BlockContributes = { readonly [K in keyof BlockContributions]?: (own: BlockSqlContext, target: BlockSqlContext) => readonly BlockContributions[K][]; };
|
|
417
|
+
/** SQL expressions for the approval request being decided. */
|
|
418
|
+
interface ApprovalRequestSql {
|
|
419
|
+
/** The request's subject id, as text. */
|
|
420
|
+
readonly subjectId: string;
|
|
421
|
+
/** The decision's comment. */
|
|
422
|
+
readonly comment: string;
|
|
423
|
+
}
|
|
424
|
+
/** Requests of one subject type the contributing block files with approvals. */
|
|
425
|
+
interface ApprovalContribution {
|
|
426
|
+
readonly subject: string;
|
|
427
|
+
/**
|
|
428
|
+
* `declared`: whoever reads the organization's requests reads these.
|
|
429
|
+
* `linked`: the contributing block decides them, so only the requester and
|
|
430
|
+
* eligible approvers read them, they can't be delegated, and
|
|
431
|
+
* `approval_settle` closes them.
|
|
432
|
+
*/
|
|
433
|
+
readonly access: "declared" | "linked";
|
|
434
|
+
/** Statements `approval_finalize` runs once a request is approved. */
|
|
435
|
+
readonly approve: (request: ApprovalRequestSql) => string;
|
|
436
|
+
/** Statements `decide_approval` runs when a request is rejected. */
|
|
437
|
+
readonly reject?: (request: ApprovalRequestSql) => string;
|
|
438
|
+
/** A boolean expression: whether the request can still be decided. */
|
|
439
|
+
readonly approvable?: (request: ApprovalRequestSql) => string;
|
|
440
|
+
}
|
|
441
|
+
/** A bulk action the contributing block runs on one row. */
|
|
442
|
+
interface BulkActionContribution {
|
|
443
|
+
/** The action name callers pass, such as `tags.set`. */
|
|
444
|
+
readonly name: string;
|
|
445
|
+
/**
|
|
446
|
+
* PL/pgSQL statements for one row, reading `bulk_row.tenant`,
|
|
447
|
+
* `bulk_row.subject_type`, `bulk_row.subject_id` and `bulk_row.args`.
|
|
448
|
+
*/
|
|
449
|
+
readonly run: string;
|
|
450
|
+
/** Variables the statements declare, such as `v_tag uuid;`. */
|
|
451
|
+
readonly declare?: string;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* A number sequence the contributing block draws from, for when the app doesn't
|
|
455
|
+
* configure `blocks.numbering.options.entities.<entity>` itself.
|
|
456
|
+
*/
|
|
457
|
+
interface NumberingContribution {
|
|
458
|
+
/** The entity name, after the instance's entity names. */
|
|
459
|
+
readonly entity: string;
|
|
460
|
+
/** The default entry: `{ period, format }` and the other entity keys. */
|
|
461
|
+
readonly entry: Readonly<Record<string, unknown>>;
|
|
462
|
+
}
|
|
463
|
+
/** A record table of the contributing block that runs on pipelines. */
|
|
464
|
+
interface PipelineContribution {
|
|
465
|
+
/** The subject type, after the instance's entity names. */
|
|
466
|
+
readonly type: string;
|
|
467
|
+
/** The qualified table its records live in. */
|
|
468
|
+
readonly table: string;
|
|
469
|
+
/** Its tenant column, unquoted; `tenant_id` when left out. */
|
|
470
|
+
readonly tenant?: string;
|
|
471
|
+
/** The binding; an app's own `on` entry is merged over it. */
|
|
472
|
+
readonly entry: Readonly<Record<string, unknown>>;
|
|
473
|
+
}
|
|
474
|
+
/** SQL expressions for the subject a new share link names. */
|
|
475
|
+
interface ShareLinkSubjectSql {
|
|
476
|
+
readonly id: string;
|
|
477
|
+
readonly tenant: string;
|
|
478
|
+
}
|
|
479
|
+
/** A subject type the contributing block owns and share links can name. */
|
|
480
|
+
interface ShareLinkContribution {
|
|
481
|
+
readonly subject: string;
|
|
482
|
+
/**
|
|
483
|
+
* A boolean expression: the subject exists in the tenant, and the caller may
|
|
484
|
+
* share it.
|
|
485
|
+
*/
|
|
486
|
+
readonly exists: (subject: ShareLinkSubjectSql) => string;
|
|
487
|
+
/** Statements share-links adds for this subject type, such as wrappers. */
|
|
488
|
+
readonly sql?: string;
|
|
489
|
+
}
|
|
490
|
+
/** One section `record_summary` counts. */
|
|
491
|
+
interface SummarySection {
|
|
492
|
+
readonly name: string;
|
|
493
|
+
/** The `from` clause; rows are aliased `x`. */
|
|
494
|
+
readonly from: string;
|
|
495
|
+
readonly subjectType: string;
|
|
496
|
+
readonly subjectId: string;
|
|
497
|
+
/** The row's time, for the unread check. */
|
|
498
|
+
readonly latest: string;
|
|
499
|
+
/** Extra conditions a counted row meets, such as not being deleted. */
|
|
500
|
+
readonly live?: string;
|
|
501
|
+
/**
|
|
502
|
+
* When the caller last read the section, as a SQL expression; the `seen_at`
|
|
503
|
+
* argument is the fallback.
|
|
504
|
+
*/
|
|
505
|
+
readonly readAt?: string;
|
|
506
|
+
}
|
|
507
|
+
/** What the contributing block adds to the subject functions. */
|
|
508
|
+
interface SubjectContribution {
|
|
509
|
+
/** A section `record_summary` counts. */
|
|
510
|
+
readonly summary?: SummarySection;
|
|
511
|
+
/**
|
|
512
|
+
* A `my_work` branch selecting `kind, subject_type, subject_id, ref, title,
|
|
513
|
+
* at`; `my_work.tenant` filters by organization and `v_me` is the caller.
|
|
514
|
+
*/
|
|
515
|
+
readonly work?: string;
|
|
516
|
+
/** Statements the subjects block adds ahead of `my_work`. */
|
|
517
|
+
readonly sql?: string;
|
|
518
|
+
}
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region src/config/generator-metadata.d.ts
|
|
521
|
+
/**
|
|
522
|
+
* A copy of `@supabase/postgrest-typegen`'s `GeneratorMetadata` contract
|
|
523
|
+
* (version 1), so the published types don't reference the package: it is an
|
|
524
|
+
* optional peer that only the CLI loads.
|
|
525
|
+
* `tests/config/generator-metadata.test-d.ts` checks the copy against the
|
|
526
|
+
* pinned version.
|
|
527
|
+
*/
|
|
528
|
+
interface PostgresColumn {
|
|
529
|
+
table_id: number;
|
|
530
|
+
schema: string;
|
|
531
|
+
table: string;
|
|
532
|
+
id: string;
|
|
533
|
+
ordinal_position: number;
|
|
534
|
+
name: string;
|
|
535
|
+
default_value: unknown;
|
|
536
|
+
data_type: string;
|
|
537
|
+
format: string;
|
|
538
|
+
type_schema: string;
|
|
539
|
+
is_identity: boolean;
|
|
540
|
+
identity_generation: "ALWAYS" | "BY DEFAULT" | null;
|
|
541
|
+
is_generated: boolean;
|
|
542
|
+
is_nullable: boolean;
|
|
543
|
+
is_updatable: boolean;
|
|
544
|
+
is_unique: boolean;
|
|
545
|
+
enums: string[];
|
|
546
|
+
check: string | null;
|
|
547
|
+
comment: string | null;
|
|
548
|
+
}
|
|
549
|
+
interface PostgresFunctionArg {
|
|
550
|
+
mode: "in" | "inout" | "out" | "table" | "variadic";
|
|
551
|
+
name: string;
|
|
552
|
+
type_id: number;
|
|
553
|
+
has_default: boolean | null;
|
|
554
|
+
}
|
|
555
|
+
interface PostgresFunction {
|
|
556
|
+
id: number;
|
|
557
|
+
schema: string;
|
|
558
|
+
name: string;
|
|
559
|
+
language: string;
|
|
560
|
+
definition: string;
|
|
561
|
+
complete_statement: string;
|
|
562
|
+
args: PostgresFunctionArg[];
|
|
563
|
+
argument_types: string;
|
|
564
|
+
identity_argument_types: string;
|
|
565
|
+
return_type_id: number;
|
|
566
|
+
return_type: string;
|
|
567
|
+
return_type_relation_id: number | null;
|
|
568
|
+
is_set_returning_function: boolean;
|
|
569
|
+
prorows: number | null;
|
|
570
|
+
behavior: "IMMUTABLE" | "STABLE" | "VOLATILE";
|
|
571
|
+
security_definer: boolean;
|
|
572
|
+
config_params: {
|
|
573
|
+
[x: string]: string;
|
|
574
|
+
} | null;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* A reference to a `types` entry by oid; `null` names when it is not in
|
|
578
|
+
* `types`.
|
|
579
|
+
*/
|
|
580
|
+
interface RpcTypeReference {
|
|
581
|
+
type_id: number;
|
|
582
|
+
format: string | null;
|
|
583
|
+
type_schema: string | null;
|
|
584
|
+
}
|
|
585
|
+
interface RpcFunctionArg extends RpcTypeReference {
|
|
586
|
+
name: string;
|
|
587
|
+
mode: "in" | "inout" | "variadic";
|
|
588
|
+
has_default: boolean;
|
|
589
|
+
relation_id: number | null;
|
|
590
|
+
}
|
|
591
|
+
interface RpcReturnColumn extends RpcTypeReference {
|
|
592
|
+
name: string;
|
|
593
|
+
}
|
|
594
|
+
interface RpcFunctionReturns extends RpcTypeReference {
|
|
595
|
+
relation_id: number | null;
|
|
596
|
+
columns: RpcReturnColumn[] | null;
|
|
597
|
+
}
|
|
598
|
+
interface RpcFunctionOverload {
|
|
599
|
+
function_id: number;
|
|
600
|
+
args: RpcFunctionArg[];
|
|
601
|
+
returns: RpcFunctionReturns;
|
|
602
|
+
is_set_returning: boolean;
|
|
603
|
+
rows_estimate: number | null;
|
|
604
|
+
setof_options: {
|
|
605
|
+
from: string;
|
|
606
|
+
to: string;
|
|
607
|
+
is_one_to_one: boolean;
|
|
608
|
+
is_setof_return: boolean;
|
|
609
|
+
} | null;
|
|
610
|
+
computed_field_of: number | null;
|
|
611
|
+
error: string | null;
|
|
612
|
+
}
|
|
613
|
+
/** A function PostgREST exposes under `/rpc`, with its overloads resolved. */
|
|
614
|
+
interface RpcFunction {
|
|
615
|
+
schema: string;
|
|
616
|
+
name: string;
|
|
617
|
+
overloads: RpcFunctionOverload[];
|
|
618
|
+
}
|
|
619
|
+
interface GeneratorMetadata {
|
|
620
|
+
version: 1;
|
|
621
|
+
schemas: {
|
|
622
|
+
id: number;
|
|
623
|
+
name: string;
|
|
624
|
+
owner: string;
|
|
625
|
+
}[];
|
|
626
|
+
tables: {
|
|
627
|
+
bytes: number;
|
|
628
|
+
comment: string | null;
|
|
629
|
+
dead_rows_estimate: number;
|
|
630
|
+
id: number;
|
|
631
|
+
live_rows_estimate: number;
|
|
632
|
+
name: string;
|
|
633
|
+
replica_identity: "DEFAULT" | "FULL" | "INDEX" | "NOTHING";
|
|
634
|
+
rls_enabled: boolean;
|
|
635
|
+
rls_forced: boolean;
|
|
636
|
+
schema: string;
|
|
637
|
+
size: string;
|
|
638
|
+
}[];
|
|
639
|
+
foreignTables: {
|
|
640
|
+
comment: string | null;
|
|
641
|
+
id: number;
|
|
642
|
+
name: string;
|
|
643
|
+
schema: string;
|
|
644
|
+
}[];
|
|
645
|
+
views: {
|
|
646
|
+
comment: string | null;
|
|
647
|
+
id: number;
|
|
648
|
+
is_insert_enabled?: boolean | undefined;
|
|
649
|
+
is_updatable: boolean;
|
|
650
|
+
is_update_enabled?: boolean | undefined;
|
|
651
|
+
name: string;
|
|
652
|
+
schema: string;
|
|
653
|
+
}[];
|
|
654
|
+
materializedViews: {
|
|
655
|
+
comment: string | null;
|
|
656
|
+
id: number;
|
|
657
|
+
is_populated: boolean;
|
|
658
|
+
name: string;
|
|
659
|
+
schema: string;
|
|
660
|
+
}[];
|
|
661
|
+
columns: PostgresColumn[];
|
|
662
|
+
primaryKeys: {
|
|
663
|
+
schema: string;
|
|
664
|
+
table_name: string;
|
|
665
|
+
name: string;
|
|
666
|
+
table_id: number;
|
|
667
|
+
}[];
|
|
668
|
+
relationships: {
|
|
669
|
+
foreign_key_name: string;
|
|
670
|
+
schema: string;
|
|
671
|
+
relation: string;
|
|
672
|
+
columns: string[];
|
|
673
|
+
is_one_to_one: boolean;
|
|
674
|
+
referenced_schema: string;
|
|
675
|
+
referenced_relation: string;
|
|
676
|
+
referenced_columns: string[];
|
|
677
|
+
}[];
|
|
678
|
+
functions: PostgresFunction[];
|
|
679
|
+
types: {
|
|
680
|
+
id: number;
|
|
681
|
+
name: string;
|
|
682
|
+
schema: string;
|
|
683
|
+
format: string;
|
|
684
|
+
enums: string[];
|
|
685
|
+
attributes: {
|
|
686
|
+
name: string;
|
|
687
|
+
type_id: number;
|
|
688
|
+
}[];
|
|
689
|
+
comment: string | null;
|
|
690
|
+
type_relation_id: number | null;
|
|
691
|
+
}[];
|
|
692
|
+
/**
|
|
693
|
+
* Derived from `functions`; generators resolve it themselves when it is
|
|
694
|
+
* absent, which is how better-supabase stores metadata.
|
|
695
|
+
*/
|
|
696
|
+
rpcFunctions?: RpcFunction[] | undefined;
|
|
697
|
+
}
|
|
698
|
+
//#endregion
|
|
699
|
+
//#region src/config/snapshot.d.ts
|
|
700
|
+
/**
|
|
701
|
+
* What `better-supabase gen --save-snapshot` reads from Postgres. `generator`
|
|
702
|
+
* is the `@supabase/postgrest-typegen` contract (the same metadata behind
|
|
703
|
+
* `supabase gen types`); `extras` holds what that contract leaves out. Codegen
|
|
704
|
+
* and doctor both work from this snapshot, so either can run offline from a
|
|
705
|
+
* saved file.
|
|
706
|
+
*/
|
|
707
|
+
interface Snapshot {
|
|
708
|
+
readonly $schema?: string;
|
|
709
|
+
readonly version: 2;
|
|
710
|
+
/** Every schema that was read, including helper schemas for doctor. */
|
|
711
|
+
readonly schemas: readonly string[];
|
|
712
|
+
readonly generator: GeneratorMetadata;
|
|
713
|
+
readonly extras: SnapshotExtras;
|
|
714
|
+
}
|
|
715
|
+
/** Catalog details `GeneratorMetadata` does not carry. */
|
|
716
|
+
interface SnapshotExtras {
|
|
717
|
+
readonly tables: readonly ExtrasTable[];
|
|
718
|
+
readonly buckets: readonly SnapshotBucket[];
|
|
719
|
+
/** Tables in the `supabase_realtime` publication, as `schema.table`. */
|
|
720
|
+
readonly realtime: readonly string[];
|
|
721
|
+
/**
|
|
722
|
+
* `alter role ... set` values for the Data API roles (`authenticator`), such
|
|
723
|
+
* as `pgrst.db_aggregates_enabled`. Absent in older snapshots.
|
|
724
|
+
*/
|
|
725
|
+
readonly roleSettings?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
726
|
+
/**
|
|
727
|
+
* Functions that policies in the read schemas call, plus functions in those
|
|
728
|
+
* schemas with `set` options. Absent in older snapshots.
|
|
729
|
+
*/
|
|
730
|
+
readonly functions?: readonly ExtrasFunction[];
|
|
731
|
+
/**
|
|
732
|
+
* The Postgres functions `supabase/config.toml` configures as Auth hooks, in
|
|
733
|
+
* any schema. Absent in older snapshots and without a `config.toml`.
|
|
734
|
+
*/
|
|
735
|
+
readonly hooks?: readonly ExtrasHook[];
|
|
736
|
+
/**
|
|
737
|
+
* Comments of the functions in the read schemas that carry a gen tag
|
|
738
|
+
* (`@notNull`), keyed by `schema.name(signature)`. Absent when none do.
|
|
739
|
+
*/
|
|
740
|
+
readonly functionComments?: Readonly<Record<string, string>>;
|
|
741
|
+
/**
|
|
742
|
+
* Domains that the read schemas' functions take or return, with their base
|
|
743
|
+
* type. Typegen leaves them `unknown`; `gen` types them by the base type, and
|
|
744
|
+
* a `returns table` column of a NOT NULL domain is never null. Absent when no
|
|
745
|
+
* function uses a domain.
|
|
746
|
+
*/
|
|
747
|
+
readonly domains?: readonly ExtrasDomain[];
|
|
748
|
+
/**
|
|
749
|
+
* Set when the snapshot comes from a `GeneratorMetadata` document alone (`gen
|
|
750
|
+
* --metadata`): unique keys, checks and foreign keys are inferred from the
|
|
751
|
+
* columns and relationships, and the rest is empty, so doctor skips the rules
|
|
752
|
+
* that read it.
|
|
753
|
+
*/
|
|
754
|
+
readonly fromMetadata?: true;
|
|
755
|
+
}
|
|
756
|
+
interface ExtrasDomain {
|
|
757
|
+
readonly schema: string;
|
|
758
|
+
readonly name: string;
|
|
759
|
+
/** The base type's name (`uuid`, `_text`). */
|
|
760
|
+
readonly baseType: string;
|
|
761
|
+
readonly baseSchema: string;
|
|
762
|
+
/** Declared `not null`. */
|
|
763
|
+
readonly notNull: boolean;
|
|
764
|
+
}
|
|
765
|
+
/** An `[auth.hook.<name>]` with a `pg-functions://` URI. */
|
|
766
|
+
interface ExtrasHook {
|
|
767
|
+
/** `custom_access_token`, `send_email`, ... */
|
|
768
|
+
readonly hook: string;
|
|
769
|
+
readonly schema: string;
|
|
770
|
+
readonly name: string;
|
|
771
|
+
/** Every overload with that name; empty when the function does not exist. */
|
|
772
|
+
readonly functions: readonly ExtrasHookFunction[];
|
|
773
|
+
}
|
|
774
|
+
interface ExtrasHookFunction extends ExtrasFunction {
|
|
775
|
+
/**
|
|
776
|
+
* Of `supabase_auth_admin`, `authenticated` and `anon`, the roles that may
|
|
777
|
+
* execute it (directly or through `public`).
|
|
778
|
+
*/
|
|
779
|
+
readonly execute: readonly string[];
|
|
780
|
+
/** Whether `public` may execute it (the default until revoked). */
|
|
781
|
+
readonly publicExecute: boolean;
|
|
782
|
+
/** Of the same roles, those with `usage` on its schema. */
|
|
783
|
+
readonly schemaUsage: readonly string[];
|
|
784
|
+
/** The function body (`pg_proc.prosrc`). Absent in snapshots that predate it. */
|
|
785
|
+
readonly source?: string;
|
|
786
|
+
}
|
|
787
|
+
/** A function as doctor needs it for RLS checks, in any schema. */
|
|
788
|
+
interface ExtrasFunction {
|
|
789
|
+
readonly schema: string;
|
|
790
|
+
readonly name: string;
|
|
791
|
+
/** Identity arguments, e.g. `organization uuid`. */
|
|
792
|
+
readonly signature: string;
|
|
793
|
+
/** `sql`, `plpgsql`, `c`, ... */
|
|
794
|
+
readonly language: string;
|
|
795
|
+
readonly volatility: "immutable" | "stable" | "volatile";
|
|
796
|
+
readonly securityDefiner: boolean;
|
|
797
|
+
/** `set` options, e.g. `{ statement_timeout: '5s' }`. */
|
|
798
|
+
readonly settings: Readonly<Record<string, string>>;
|
|
799
|
+
/**
|
|
800
|
+
* Which of `anon` and `authenticated` may execute it. Absent in older
|
|
801
|
+
* snapshots.
|
|
802
|
+
*/
|
|
803
|
+
readonly execute?: readonly string[];
|
|
804
|
+
}
|
|
805
|
+
interface ExtrasTable {
|
|
806
|
+
/** Table oid, matching `GeneratorMetadata.tables[].id`. */
|
|
807
|
+
readonly id: number;
|
|
808
|
+
readonly schema: string;
|
|
809
|
+
readonly name: string;
|
|
810
|
+
/** Primary key columns in key order. */
|
|
811
|
+
readonly primaryKey: readonly string[];
|
|
812
|
+
readonly uniques: readonly CatalogUnique[];
|
|
813
|
+
readonly foreignKeys: readonly {
|
|
814
|
+
readonly name: string;
|
|
815
|
+
readonly onDelete: ForeignKeyAction;
|
|
816
|
+
readonly onUpdate: ForeignKeyAction;
|
|
817
|
+
}[];
|
|
818
|
+
readonly checks: readonly CatalogCheck[];
|
|
819
|
+
readonly indexes: readonly CatalogIndex[];
|
|
820
|
+
readonly policies: readonly CatalogPolicy[];
|
|
821
|
+
readonly triggers: readonly CatalogTrigger[];
|
|
822
|
+
readonly grants: readonly CatalogGrant[];
|
|
823
|
+
/** Absent in snapshots taken before column grants were introspected. */
|
|
824
|
+
readonly columnGrants?: readonly CatalogColumnGrant[];
|
|
825
|
+
/**
|
|
826
|
+
* Postgres estimates at least `LARGE_TABLE_ROWS` rows; the `unbounded-read`
|
|
827
|
+
* lint reads it.
|
|
828
|
+
*/
|
|
829
|
+
readonly large?: true;
|
|
830
|
+
/** The partitioned parent as `schema.name`, when the table is a partition. */
|
|
831
|
+
readonly partitionOf?: string;
|
|
832
|
+
}
|
|
833
|
+
type ForeignKeyAction = "no action" | "restrict" | "cascade" | "set null" | "set default";
|
|
834
|
+
interface CatalogUnique {
|
|
835
|
+
readonly name: string;
|
|
836
|
+
readonly columns: readonly string[];
|
|
837
|
+
}
|
|
838
|
+
interface CatalogCheck {
|
|
839
|
+
readonly name: string;
|
|
840
|
+
readonly definition: string;
|
|
841
|
+
}
|
|
842
|
+
interface CatalogIndex {
|
|
843
|
+
readonly name: string;
|
|
844
|
+
readonly columns: readonly string[];
|
|
845
|
+
readonly unique: boolean;
|
|
846
|
+
readonly primary: boolean;
|
|
847
|
+
readonly partial: boolean;
|
|
848
|
+
/** Access method (`btree`, `gin`, `gist`, ...). Absent in older snapshots. */
|
|
849
|
+
readonly method?: string;
|
|
850
|
+
/**
|
|
851
|
+
* The `where` of a partial index, as Postgres prints it. Absent in older
|
|
852
|
+
* snapshots.
|
|
853
|
+
*/
|
|
854
|
+
readonly predicate?: string | null;
|
|
855
|
+
}
|
|
856
|
+
interface CatalogPolicy {
|
|
857
|
+
readonly name: string;
|
|
858
|
+
readonly command: "all" | "select" | "insert" | "update" | "delete";
|
|
859
|
+
readonly roles: readonly string[];
|
|
860
|
+
readonly permissive: boolean;
|
|
861
|
+
readonly using: string | null;
|
|
862
|
+
readonly check: string | null;
|
|
863
|
+
/**
|
|
864
|
+
* Functions the policy expressions call, as `schema.name`, from `pg_depend`.
|
|
865
|
+
* Absent in older snapshots.
|
|
866
|
+
*/
|
|
867
|
+
readonly functions?: readonly string[];
|
|
868
|
+
}
|
|
869
|
+
interface CatalogTrigger {
|
|
870
|
+
readonly name: string;
|
|
871
|
+
readonly timing: "before" | "after" | "instead of";
|
|
872
|
+
readonly events: readonly ("insert" | "update" | "delete" | "truncate")[];
|
|
873
|
+
readonly level: "row" | "statement";
|
|
874
|
+
readonly function: string;
|
|
875
|
+
/** The `create trigger` arguments, when there are any. */
|
|
876
|
+
readonly args?: readonly string[];
|
|
877
|
+
/**
|
|
878
|
+
* The function's body, only for functions that call `realtime.send()` or
|
|
879
|
+
* `realtime.broadcast_changes()`, other than `broadcast_topic()`.
|
|
880
|
+
*/
|
|
881
|
+
readonly source?: string;
|
|
882
|
+
/** The function's comment, for the same functions as `source`. */
|
|
883
|
+
readonly comment?: string;
|
|
884
|
+
}
|
|
885
|
+
interface CatalogGrant {
|
|
886
|
+
readonly role: string;
|
|
887
|
+
readonly privileges: readonly string[];
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* A column-level `select`, `insert` or `update` grant to `anon` or
|
|
891
|
+
* `authenticated`.
|
|
892
|
+
*/
|
|
893
|
+
interface CatalogColumnGrant {
|
|
894
|
+
readonly column: string;
|
|
895
|
+
readonly role: string;
|
|
896
|
+
readonly privileges: readonly string[];
|
|
897
|
+
}
|
|
898
|
+
interface SnapshotBucket {
|
|
899
|
+
readonly id: string;
|
|
900
|
+
readonly public: boolean;
|
|
901
|
+
readonly fileSizeLimit: number | null;
|
|
902
|
+
readonly allowedMimeTypes: readonly string[] | null;
|
|
903
|
+
/** `versioning_status`; absent when Storage has no versioning. */
|
|
904
|
+
readonly versioning?: "DISABLED" | "ENABLED" | "SUSPENDED" | null;
|
|
905
|
+
/** `lifecycle_configuration`; absent when Storage has no lifecycles. */
|
|
906
|
+
readonly lifecycle?: unknown;
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* The snapshot joined into one record per table, function and enum. Codegen and
|
|
910
|
+
* doctor read this view rather than the raw snapshot.
|
|
911
|
+
*/
|
|
912
|
+
interface Catalog {
|
|
913
|
+
readonly schemas: readonly string[];
|
|
914
|
+
readonly tables: readonly CatalogTable[];
|
|
915
|
+
readonly enums: readonly CatalogEnum[];
|
|
916
|
+
readonly functions: readonly CatalogFunction[];
|
|
917
|
+
readonly buckets: readonly SnapshotBucket[];
|
|
918
|
+
readonly realtime: readonly string[];
|
|
919
|
+
}
|
|
920
|
+
interface CatalogTable {
|
|
921
|
+
readonly id: number;
|
|
922
|
+
readonly schema: string;
|
|
923
|
+
readonly name: string;
|
|
924
|
+
/** Materialized views count as views; foreign tables as tables. */
|
|
925
|
+
readonly kind: "table" | "view";
|
|
926
|
+
readonly rls: boolean;
|
|
927
|
+
readonly forceRls: boolean;
|
|
928
|
+
readonly replicaIdentity: "DEFAULT" | "INDEX" | "FULL" | "NOTHING" | null;
|
|
929
|
+
/** Inserts work (always true for tables). */
|
|
930
|
+
readonly insertable: boolean;
|
|
931
|
+
/** Updates work (always true for tables). */
|
|
932
|
+
readonly updatable: boolean;
|
|
933
|
+
readonly comment: string | null;
|
|
934
|
+
readonly columns: readonly CatalogColumn[];
|
|
935
|
+
readonly primaryKey: readonly string[];
|
|
936
|
+
readonly uniques: readonly CatalogUnique[];
|
|
937
|
+
readonly foreignKeys: readonly CatalogForeignKey[];
|
|
938
|
+
readonly checks: readonly CatalogCheck[];
|
|
939
|
+
readonly indexes: readonly CatalogIndex[];
|
|
940
|
+
readonly policies: readonly CatalogPolicy[];
|
|
941
|
+
readonly triggers: readonly CatalogTrigger[];
|
|
942
|
+
readonly grants: readonly CatalogGrant[];
|
|
943
|
+
/** Absent in snapshots taken before column grants were introspected. */
|
|
944
|
+
readonly columnGrants?: readonly CatalogColumnGrant[];
|
|
945
|
+
/** The partitioned parent as `schema.name`, when the table is a partition. */
|
|
946
|
+
readonly partitionOf?: string;
|
|
947
|
+
}
|
|
948
|
+
interface CatalogColumn {
|
|
949
|
+
readonly name: string;
|
|
950
|
+
/** Type name; the element type for arrays (`uuid`, `int8`, `note_kind`). */
|
|
951
|
+
readonly udt: string;
|
|
952
|
+
/** Raw type name as Postgres reports it (`_text` for `text[]`). */
|
|
953
|
+
readonly format: string;
|
|
954
|
+
readonly typeSchema: string;
|
|
955
|
+
readonly isArray: boolean;
|
|
956
|
+
readonly isEnum: boolean;
|
|
957
|
+
readonly nullable: boolean;
|
|
958
|
+
readonly hasDefault: boolean;
|
|
959
|
+
readonly default: string | null;
|
|
960
|
+
readonly identity: "always" | "by default" | null;
|
|
961
|
+
readonly generated: boolean;
|
|
962
|
+
readonly updatable: boolean;
|
|
963
|
+
readonly comment: string | null;
|
|
964
|
+
}
|
|
965
|
+
interface CatalogForeignKey {
|
|
966
|
+
readonly name: string;
|
|
967
|
+
readonly columns: readonly string[];
|
|
968
|
+
readonly refSchema: string;
|
|
969
|
+
readonly refTable: string;
|
|
970
|
+
readonly refColumns: readonly string[];
|
|
971
|
+
readonly oneToOne: boolean;
|
|
972
|
+
readonly onDelete: ForeignKeyAction;
|
|
973
|
+
readonly onUpdate: ForeignKeyAction;
|
|
974
|
+
}
|
|
975
|
+
interface CatalogEnum {
|
|
976
|
+
readonly schema: string;
|
|
977
|
+
readonly name: string;
|
|
978
|
+
readonly values: readonly string[];
|
|
979
|
+
}
|
|
980
|
+
interface CatalogFunction {
|
|
981
|
+
readonly schema: string;
|
|
982
|
+
readonly name: string;
|
|
983
|
+
/** Signature that tells overloads apart, e.g. `a integer, b text`. */
|
|
984
|
+
readonly signature: string;
|
|
985
|
+
readonly args: readonly CatalogFunctionArg[];
|
|
986
|
+
/** Columns for `returns table (...)` functions. */
|
|
987
|
+
readonly returnsTable: readonly {
|
|
988
|
+
readonly name: string;
|
|
989
|
+
readonly udt: string;
|
|
990
|
+
/** Schema of the column's type, when typegen knows it. */
|
|
991
|
+
readonly typeSchema?: string;
|
|
992
|
+
/** The column's type is a NOT NULL domain. */
|
|
993
|
+
readonly notNull?: true;
|
|
994
|
+
}[] | null;
|
|
995
|
+
/** Return type name (`int4`, `_text`, a table's row type). */
|
|
996
|
+
readonly returns: string;
|
|
997
|
+
/** Schema of the return type, when typegen knows it. */
|
|
998
|
+
readonly returnsSchema?: string;
|
|
999
|
+
/** `schema.table` when the function returns rows of a table or view. */
|
|
1000
|
+
readonly returnsRelation: string | null;
|
|
1001
|
+
readonly returnsSet: boolean;
|
|
1002
|
+
readonly volatility: "immutable" | "stable" | "volatile";
|
|
1003
|
+
readonly securityDefiner: boolean;
|
|
1004
|
+
readonly language: string;
|
|
1005
|
+
/** `search_path` from `SET search_path`, or `null` when unset. */
|
|
1006
|
+
readonly searchPath: string | null;
|
|
1007
|
+
/** The function's comment, when it carries a gen tag such as `@notNull`. */
|
|
1008
|
+
readonly comment?: string;
|
|
1009
|
+
}
|
|
1010
|
+
interface CatalogFunctionArg {
|
|
1011
|
+
readonly name: string;
|
|
1012
|
+
readonly udt: string;
|
|
1013
|
+
/** Schema of the argument's type, when typegen knows it. */
|
|
1014
|
+
readonly typeSchema?: string;
|
|
1015
|
+
readonly isArray: boolean;
|
|
1016
|
+
readonly hasDefault: boolean;
|
|
1017
|
+
}
|
|
1018
|
+
//#endregion
|
|
1019
|
+
//#region src/config/types/app-tables.d.ts
|
|
1020
|
+
/**
|
|
1021
|
+
* The column types an app table may use. Money is a `bigint` of minor units
|
|
1022
|
+
* next to a `text` currency column (ADR 0024 and 0037), never `numeric`.
|
|
1023
|
+
*/
|
|
1024
|
+
declare const APP_COLUMN_TYPES: readonly ["text", "uuid", "integer", "bigint", "numeric", "boolean", "timestamptz", "date", "jsonb", "text[]"];
|
|
1025
|
+
type AppColumnType = (typeof APP_COLUMN_TYPES)[number];
|
|
1026
|
+
/**
|
|
1027
|
+
* What a reference does when the row it points at is deleted
|
|
1028
|
+
* (`references.onDelete`).
|
|
1029
|
+
*/
|
|
1030
|
+
declare const APP_ON_DELETE_ACTIONS: readonly ["cascade", "restrict", "set null", "no action"];
|
|
1031
|
+
type AppOnDeleteAction = (typeof APP_ON_DELETE_ACTIONS)[number];
|
|
1032
|
+
/**
|
|
1033
|
+
* What a column references: another app table, `auth.users` (`{ table:
|
|
1034
|
+
* "auth.users" }`), or a logical table of an installed block (`{ block: "crm",
|
|
1035
|
+
* table: "contacts" }`), which follows the block's renames.
|
|
1036
|
+
*/
|
|
1037
|
+
type AppReferenceTarget = {
|
|
1038
|
+
readonly table: string;
|
|
1039
|
+
} | {
|
|
1040
|
+
readonly block: string;
|
|
1041
|
+
readonly table: string;
|
|
1042
|
+
};
|
|
1043
|
+
type AppReference = AppReferenceTarget & {
|
|
1044
|
+
/** Defaults to `no action`. */
|
|
1045
|
+
readonly onDelete?: AppOnDeleteAction;
|
|
1046
|
+
};
|
|
1047
|
+
/**
|
|
1048
|
+
* What a column holds, beyond its Postgres type. `email`, `url`, `rating` and
|
|
1049
|
+
* `percent` add a check; the others tell the UI and `gen` how to show the
|
|
1050
|
+
* value. `FIELD_FORMATS` lists the types each fits and its input.
|
|
1051
|
+
*/
|
|
1052
|
+
declare const APP_COLUMN_FORMATS: typeof FIELD_FORMAT_NAMES;
|
|
1053
|
+
type AppColumnFormat = FieldFormatName;
|
|
1054
|
+
interface AppColumnConfig {
|
|
1055
|
+
readonly type: AppColumnType;
|
|
1056
|
+
/** Defaults to true. */
|
|
1057
|
+
readonly nullable?: boolean;
|
|
1058
|
+
/**
|
|
1059
|
+
* The column default, from an allowlist: `now()`, `gen_random_uuid()`,
|
|
1060
|
+
* `auth.uid()`, `true`, `false`, a number, a `'quoted'` text literal, and
|
|
1061
|
+
* `'{}'` or `'[]'` for `jsonb` and `text[]`.
|
|
1062
|
+
*/
|
|
1063
|
+
readonly default?: string;
|
|
1064
|
+
readonly unique?: boolean;
|
|
1065
|
+
readonly references?: AppReference;
|
|
1066
|
+
/** What the column holds; see `APP_COLUMN_FORMATS`. */
|
|
1067
|
+
readonly format?: AppColumnFormat;
|
|
1068
|
+
/**
|
|
1069
|
+
* The values a `text` column (single select) or each element of a `text[]`
|
|
1070
|
+
* column (multi-select) may take, checked by the database.
|
|
1071
|
+
*/
|
|
1072
|
+
readonly options?: readonly string[];
|
|
1073
|
+
/** The smallest value of a number column, or the shortest `text`. */
|
|
1074
|
+
readonly min?: number;
|
|
1075
|
+
/** The largest value of a number column, or the longest `text`. */
|
|
1076
|
+
readonly max?: number;
|
|
1077
|
+
/** Rendered as `comment on column`. */
|
|
1078
|
+
readonly comment?: string;
|
|
1079
|
+
/**
|
|
1080
|
+
* An `integer` or `bigint` the database numbers (`generated by default as
|
|
1081
|
+
* identity`).
|
|
1082
|
+
*/
|
|
1083
|
+
readonly identity?: boolean;
|
|
1084
|
+
/**
|
|
1085
|
+
* Who reaches the column, through column grants (ADR 0051). By default
|
|
1086
|
+
* signed-in users read and write it, within the row's policies. `read` lets
|
|
1087
|
+
* them read it while only the service role, triggers and defaults write it;
|
|
1088
|
+
* `server` hides it from them, so only the service role reads and writes it.
|
|
1089
|
+
*/
|
|
1090
|
+
readonly access?: AppColumnAccess;
|
|
1091
|
+
/**
|
|
1092
|
+
* Stores the column encrypted with the row's tenant (or user) data key from
|
|
1093
|
+
* Supabase Vault, through the `field-encryption` block. Signed-in users write
|
|
1094
|
+
* plaintext and never select the column; they read it through
|
|
1095
|
+
* `public.<table>_reveal(ids)`, which checks the row's policy and decrypts.
|
|
1096
|
+
* It can't be unique, a reference, an identity, indexed or searched.
|
|
1097
|
+
*/
|
|
1098
|
+
readonly encrypted?: boolean;
|
|
1099
|
+
}
|
|
1100
|
+
declare const APP_COLUMN_ACCESS: readonly ["read", "server"];
|
|
1101
|
+
type AppColumnAccess = (typeof APP_COLUMN_ACCESS)[number];
|
|
1102
|
+
/**
|
|
1103
|
+
* A table the app owns, created in `public` by `better-supabase upgrade` next
|
|
1104
|
+
* to the block files. Every table gets `id`, the scope column and (unless
|
|
1105
|
+
* `timestamps: false`) `created_at` and `updated_at`.
|
|
1106
|
+
*/
|
|
1107
|
+
interface AppTableConfig {
|
|
1108
|
+
/** The table's own columns, keyed by lower snake name. */
|
|
1109
|
+
readonly columns?: Readonly<Record<string, AppColumnConfig>>;
|
|
1110
|
+
/**
|
|
1111
|
+
* Who reaches a row. `inherit` (the default) follows `sql.scope`: per tenant,
|
|
1112
|
+
* members of the row's tenant; per user, the row's user. `user` keeps rows
|
|
1113
|
+
* per user in any scope, and `none` lets signed-in users read every row while
|
|
1114
|
+
* only the service role writes.
|
|
1115
|
+
*/
|
|
1116
|
+
readonly scope?: "inherit" | "user" | "none";
|
|
1117
|
+
/** `created_at` and `updated_at`. Defaults to true. */
|
|
1118
|
+
readonly timestamps?: boolean;
|
|
1119
|
+
/**
|
|
1120
|
+
* The id's type: `uuid` (the default, `gen_random_uuid()`) or `bigint` (an
|
|
1121
|
+
* identity). A reference to the table needs a column of the same type.
|
|
1122
|
+
*/
|
|
1123
|
+
readonly id?: "uuid" | "bigint";
|
|
1124
|
+
/** Sets of columns that are unique together, each a unique constraint. */
|
|
1125
|
+
readonly unique?: readonly (readonly string[])[];
|
|
1126
|
+
/**
|
|
1127
|
+
* Sets of columns to index, in order. Reference and scope columns already
|
|
1128
|
+
* have one.
|
|
1129
|
+
*/
|
|
1130
|
+
readonly indexes?: readonly (readonly string[])[];
|
|
1131
|
+
/** Rendered as `comment on table`. */
|
|
1132
|
+
readonly comment?: string;
|
|
1133
|
+
/**
|
|
1134
|
+
* Registers the table as a subject (ADR 0043), so blocks that attach rows to
|
|
1135
|
+
* subjects (comments, attachments, tags, versions, search and others) reach
|
|
1136
|
+
* its rows without a `subjects` entry.
|
|
1137
|
+
*/
|
|
1138
|
+
readonly subject?: AppTableSubject;
|
|
1139
|
+
/**
|
|
1140
|
+
* Values computed from the rows of another app table that references this
|
|
1141
|
+
* one, keyed by the column name they get in `public.<table>_view` (ADR
|
|
1142
|
+
* 0044).
|
|
1143
|
+
*/
|
|
1144
|
+
readonly rollups?: Readonly<Record<string, AppRollupConfig>>;
|
|
1145
|
+
/**
|
|
1146
|
+
* Columns of the row a reference points at, keyed by the column name they get
|
|
1147
|
+
* in `public.<table>_view` (ADR 0044).
|
|
1148
|
+
*/
|
|
1149
|
+
readonly lookups?: Readonly<Record<string, AppLookupConfig>>;
|
|
1150
|
+
/**
|
|
1151
|
+
* Emits an outbox event for each insert, update and delete (ADR 0048):
|
|
1152
|
+
* `<subject type or table>.created`, `.updated` and `.deleted`. Needs the
|
|
1153
|
+
* `outbox` block.
|
|
1154
|
+
*/
|
|
1155
|
+
readonly events?: true | AppTableEvents;
|
|
1156
|
+
/**
|
|
1157
|
+
* Writes an audit log entry in the `read` category for each call of
|
|
1158
|
+
* `public.<table>_reveal`: who read which rows and when, one entry per tenant
|
|
1159
|
+
* per call. Needs an `encrypted` column and the `audit` block.
|
|
1160
|
+
*/
|
|
1161
|
+
readonly auditReads?: boolean;
|
|
1162
|
+
}
|
|
1163
|
+
declare const APP_TABLE_EVENT_KINDS: readonly ["created", "updated", "deleted"];
|
|
1164
|
+
type AppTableEventKind = (typeof APP_TABLE_EVENT_KINDS)[number];
|
|
1165
|
+
/** Which writes emit an event and which column values its payload carries. */
|
|
1166
|
+
interface AppTableEvents {
|
|
1167
|
+
/** Defaults to all three. */
|
|
1168
|
+
readonly on?: readonly AppTableEventKind[];
|
|
1169
|
+
/**
|
|
1170
|
+
* Columns whose values go in the payload. By default it holds the row id and,
|
|
1171
|
+
* for updates, the names of the changed columns.
|
|
1172
|
+
*/
|
|
1173
|
+
readonly include?: readonly string[];
|
|
1174
|
+
}
|
|
1175
|
+
declare const APP_ROLLUP_AGGREGATES: readonly ["count", "sum", "min", "max", "avg"];
|
|
1176
|
+
type AppRollupAggregate = (typeof APP_ROLLUP_AGGREGATES)[number];
|
|
1177
|
+
/**
|
|
1178
|
+
* An aggregate over the rows of `table` whose `via` column references this
|
|
1179
|
+
* table: `{ table: "tasks", via: "project_id", aggregate: "count" }`.
|
|
1180
|
+
*/
|
|
1181
|
+
interface AppRollupConfig {
|
|
1182
|
+
/** The app table whose rows are aggregated. */
|
|
1183
|
+
readonly table: string;
|
|
1184
|
+
/** The column of `table` that references this table. */
|
|
1185
|
+
readonly via: string;
|
|
1186
|
+
/** `sum` of no rows is 0; `min`, `max` and `avg` of no rows are null. */
|
|
1187
|
+
readonly aggregate: AppRollupAggregate;
|
|
1188
|
+
/**
|
|
1189
|
+
* The column of `table` the aggregate reads: a number for `sum` and `avg`, a
|
|
1190
|
+
* number, date, time or text for `min` and `max`. `count` takes none and
|
|
1191
|
+
* counts rows.
|
|
1192
|
+
*/
|
|
1193
|
+
readonly column?: string;
|
|
1194
|
+
/**
|
|
1195
|
+
* Only the rows whose select column (a `text` column with `options`) holds
|
|
1196
|
+
* `equals`.
|
|
1197
|
+
*/
|
|
1198
|
+
readonly where?: {
|
|
1199
|
+
readonly column: string;
|
|
1200
|
+
readonly equals: string;
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
/** The `column` of the app table row that this table's `via` column references. */
|
|
1204
|
+
interface AppLookupConfig {
|
|
1205
|
+
/** A column of this table that references another app table. */
|
|
1206
|
+
readonly via: string;
|
|
1207
|
+
/** A column of the referenced table. */
|
|
1208
|
+
readonly column: string;
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* The subject an app table registers. The table, id type and tenant column come
|
|
1212
|
+
* from the table itself.
|
|
1213
|
+
*/
|
|
1214
|
+
interface AppTableSubject {
|
|
1215
|
+
/** The subject type, lowercase letters, digits and underscores. */
|
|
1216
|
+
readonly type: string;
|
|
1217
|
+
/** The column `subject_title` returns. */
|
|
1218
|
+
readonly title?: string;
|
|
1219
|
+
/**
|
|
1220
|
+
* The path `subject_url` returns, with `{column}` placeholders:
|
|
1221
|
+
* `/projects/{id}`.
|
|
1222
|
+
*/
|
|
1223
|
+
readonly url?: string;
|
|
1224
|
+
/** The columns a search index reads. */
|
|
1225
|
+
readonly search?: {
|
|
1226
|
+
readonly title?: string;
|
|
1227
|
+
readonly body?: readonly string[];
|
|
1228
|
+
};
|
|
1229
|
+
/**
|
|
1230
|
+
* A permission key per action that `can_subject` checks; see
|
|
1231
|
+
* `SubjectConfig.permissions`.
|
|
1232
|
+
*/
|
|
1233
|
+
readonly permissions?: Readonly<Record<string, string>>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Adds a `rank text collate "C"` column for `move()` (ADR 0021), ordered
|
|
1236
|
+
* within `group` when set.
|
|
1237
|
+
*/
|
|
1238
|
+
readonly rank?: true | {
|
|
1239
|
+
readonly group?: string;
|
|
1240
|
+
};
|
|
1241
|
+
/**
|
|
1242
|
+
* Adds a `deleted_at timestamptz` column that blocks treat as the soft-delete
|
|
1243
|
+
* time.
|
|
1244
|
+
*/
|
|
1245
|
+
readonly softDelete?: boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* Registers the table with the versions block: `true` snapshots every column
|
|
1248
|
+
* of the table on each change; `columns` and `auto` narrow it.
|
|
1249
|
+
*/
|
|
1250
|
+
readonly versions?: true | AppTableVersions;
|
|
1251
|
+
}
|
|
1252
|
+
/** What the versions block keeps of an app table's rows. */
|
|
1253
|
+
interface AppTableVersions {
|
|
1254
|
+
/**
|
|
1255
|
+
* The columns a snapshot copies and a restore writes back; every column of
|
|
1256
|
+
* the table by default.
|
|
1257
|
+
*/
|
|
1258
|
+
readonly columns?: readonly string[];
|
|
1259
|
+
/** Snapshot on each change to `columns`, debounced; `true` by default. */
|
|
1260
|
+
readonly auto?: boolean;
|
|
1261
|
+
}
|
|
1262
|
+
type AppTablesConfig = Readonly<Record<string, AppTableConfig>>;
|
|
1263
|
+
//#endregion
|
|
1264
|
+
//#region src/sql/audit-registrations.d.ts
|
|
1265
|
+
/** A table registered with `better_supabase.audit(...)` in a SQL file. */
|
|
1266
|
+
interface AuditedTable {
|
|
1267
|
+
/** `schema.table`, unquoted; an unqualified name is in `public`. */
|
|
1268
|
+
readonly target: string;
|
|
1269
|
+
readonly ignore: readonly string[];
|
|
1270
|
+
readonly redact: readonly string[];
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* The tables `files` register with `better_supabase.audit(...)` or a static
|
|
1274
|
+
* `create trigger bsb_audit ... execute function
|
|
1275
|
+
* better_supabase.audit_row_change('{...}')`, in file order: a later
|
|
1276
|
+
* registration for the same table replaces the earlier one, and `unaudit(...)`
|
|
1277
|
+
* or a `drop table` removes it. Calls with non-literal arguments are skipped.
|
|
1278
|
+
*/
|
|
1279
|
+
declare function auditRegistrations(files: readonly {
|
|
1280
|
+
readonly text: string;
|
|
1281
|
+
}[]): AuditedTable[];
|
|
1282
|
+
//#endregion
|
|
1283
|
+
//#region src/sql/foreign-keys.d.ts
|
|
1284
|
+
/** A foreign key the schema files declare. */
|
|
1285
|
+
interface DeclaredForeignKey {
|
|
1286
|
+
/** `schema.table`, unquoted. */
|
|
1287
|
+
readonly table: string;
|
|
1288
|
+
readonly columns: readonly string[];
|
|
1289
|
+
/** The referenced `schema.table`, unquoted. */
|
|
1290
|
+
readonly references: string;
|
|
1291
|
+
/**
|
|
1292
|
+
* The referenced columns. Without a column list, the referenced table's
|
|
1293
|
+
* declared primary key, or `id` when the files don't declare one.
|
|
1294
|
+
*/
|
|
1295
|
+
readonly referencedColumns: readonly string[];
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* The layout fields `blocks.memberships.options.sameTenant.auto` derives its
|
|
1299
|
+
* entries from.
|
|
1300
|
+
*/
|
|
1301
|
+
declare function sameTenantLayout(files: readonly {
|
|
1302
|
+
readonly text: string;
|
|
1303
|
+
}[], schemas: readonly string[]): Required<Pick<BlockSqlLayout, "foreignKeys" | "declaredColumns">>;
|
|
1304
|
+
//#endregion
|
|
1305
|
+
//#region src/config/defaults.d.ts
|
|
1306
|
+
/**
|
|
1307
|
+
* Every default `resolveConfig` fills in. Other modules (the SQL module
|
|
1308
|
+
* registry, the CLI) read their fallbacks from here instead of repeating the
|
|
1309
|
+
* literals.
|
|
1310
|
+
*/
|
|
1311
|
+
declare const CONFIG_DEFAULTS: {
|
|
1312
|
+
readonly output: string;
|
|
1313
|
+
readonly schemas: readonly string[];
|
|
1314
|
+
readonly casing: "snake";
|
|
1315
|
+
readonly postgrestVersion: string;
|
|
1316
|
+
readonly codecs: {
|
|
1317
|
+
readonly timestamptz: "string";
|
|
1318
|
+
readonly int8: "number";
|
|
1319
|
+
readonly numeric: "number";
|
|
1320
|
+
};
|
|
1321
|
+
readonly sql: {
|
|
1322
|
+
readonly dir: string;
|
|
1323
|
+
readonly prefix: string;
|
|
1324
|
+
readonly testsDir: string;
|
|
1325
|
+
};
|
|
1326
|
+
readonly seed: {
|
|
1327
|
+
readonly entry: string;
|
|
1328
|
+
readonly output: string;
|
|
1329
|
+
readonly perTenant: string;
|
|
1330
|
+
};
|
|
1331
|
+
readonly openapi: {
|
|
1332
|
+
readonly entry: string;
|
|
1333
|
+
readonly output: string;
|
|
1334
|
+
};
|
|
1335
|
+
readonly specs: {
|
|
1336
|
+
readonly failOn: "error";
|
|
1337
|
+
};
|
|
1338
|
+
readonly doctor: {
|
|
1339
|
+
readonly format: "text";
|
|
1340
|
+
readonly sources: readonly string[];
|
|
1341
|
+
readonly policyHelperLimit: number;
|
|
1342
|
+
};
|
|
1343
|
+
readonly gen: {
|
|
1344
|
+
readonly watchInterval: number;
|
|
1345
|
+
};
|
|
1346
|
+
readonly env: {
|
|
1347
|
+
readonly output: string;
|
|
1348
|
+
};
|
|
1349
|
+
};
|
|
1350
|
+
//#endregion
|
|
1351
|
+
//#region src/preset/presets.d.ts
|
|
1352
|
+
/** Where a named preset sits in the `/create` and `init` pickers. */
|
|
1353
|
+
type PresetGroup = "starters" | "products" | "verticals" | "ai" | "platforms" | "everything";
|
|
1354
|
+
/** The preset groups in display order, with their headings. */
|
|
1355
|
+
declare const PRESET_GROUPS: Readonly<Record<PresetGroup, string>>;
|
|
1356
|
+
/** A named starting point: a block selection with the default conventions. */
|
|
1357
|
+
interface NamedPreset {
|
|
1358
|
+
readonly name: string;
|
|
1359
|
+
readonly title: string;
|
|
1360
|
+
readonly description: string;
|
|
1361
|
+
readonly group: PresetGroup;
|
|
1362
|
+
/** The blocks it selects; `resolvePreset` adds what they require. */
|
|
1363
|
+
readonly blocks: readonly string[];
|
|
1364
|
+
/** The conventions it sets over the defaults, such as a user scope. */
|
|
1365
|
+
readonly conventions?: Partial<PresetConventions>;
|
|
1366
|
+
/** The `blocks` entries it writes: its nouns and extra instances. */
|
|
1367
|
+
readonly instances?: Preset["instances"];
|
|
1368
|
+
}
|
|
1369
|
+
/** A named preset's name. */
|
|
1370
|
+
type PresetName = "minimal" | "saas" | "consumer" | "crm" | "projects" | "helpdesk" | "chat" | "commerce" | "cms" | "erp" | "pim" | "marketplace" | "scheduling" | "people" | "drive" | "docs" | "invoicing" | "forms" | "property" | "field-service" | "clinic" | "lms" | "events" | "legal" | "spend" | "contracts" | "customer-success" | "logistics" | "pos" | "fitness" | "nonprofit" | "itsm" | "compliance" | "construction" | "claims" | "community" | "feedback" | "ai" | "ai-chat" | "ai-agents" | "developer-api" | "automation" | "enterprise" | "admin" | "everything";
|
|
1371
|
+
/** The named presets, for `defineConfig({ preset })` and `/create`. */
|
|
1372
|
+
declare const PRESETS: Readonly<Record<PresetName, NamedPreset>>;
|
|
1373
|
+
/** The named presets in display order, grouped by `group`. */
|
|
1374
|
+
declare const PRESET_NAMES: readonly PresetName[];
|
|
1375
|
+
declare function isPresetName(value: unknown): value is PresetName;
|
|
1376
|
+
/** The named preset as a `Preset`: the default conventions, then its own. */
|
|
1377
|
+
declare function namedPreset(name: PresetName): Preset;
|
|
1378
|
+
/** The preset `/create` and `init` start from. */
|
|
1379
|
+
declare const DEFAULT_PRESET_NAME: "saas";
|
|
1380
|
+
/** The default preset as a `Preset`, so a new design can start from it. */
|
|
1381
|
+
declare function defaultPreset(): Preset;
|
|
1382
|
+
//#endregion
|
|
1383
|
+
//#region src/preset/spec.d.ts
|
|
1384
|
+
/**
|
|
1385
|
+
* A preset written out: the conventions that differ from the defaults and the
|
|
1386
|
+
* selected blocks. It is what the config's `preset` key and a design's `preset`
|
|
1387
|
+
* key hold when the selection isn't a named preset.
|
|
1388
|
+
*/
|
|
1389
|
+
type PresetSpec = Partial<PresetConventions> & {
|
|
1390
|
+
readonly blocks?: readonly string[];
|
|
1391
|
+
readonly instances?: Readonly<Record<string, PresetInstance>>;
|
|
1392
|
+
};
|
|
1393
|
+
/**
|
|
1394
|
+
* The preset as the config or a design writes it: its name when it is a named
|
|
1395
|
+
* preset as it ships, otherwise the conventions that differ from the defaults
|
|
1396
|
+
* and the selected blocks.
|
|
1397
|
+
*/
|
|
1398
|
+
declare function presetSpec(preset: Preset): PresetName | PresetSpec;
|
|
1399
|
+
/**
|
|
1400
|
+
* Reads a preset object (`PresetSpec`) into a `Preset`, with the conventions it
|
|
1401
|
+
* leaves out at their defaults. Throws a TypeError naming the first key or
|
|
1402
|
+
* value that isn't one.
|
|
1403
|
+
*/
|
|
1404
|
+
declare function presetFromSpec(value: unknown): Preset;
|
|
1405
|
+
/** A preset name or object as a `Preset`. */
|
|
1406
|
+
declare function presetOfSpec(value: unknown): Preset;
|
|
1407
|
+
//#endregion
|
|
1408
|
+
//#region src/config/expose.d.ts
|
|
1409
|
+
/** A privilege the Data API roles can be granted on a table or view. */
|
|
1410
|
+
type Privilege = "select" | "insert" | "update" | "delete";
|
|
1411
|
+
type ColumnPrivilege = `${"select" | "insert" | "update"}(${string})`;
|
|
1412
|
+
type ExposePrivilege = Privilege | ColumnPrivilege;
|
|
1413
|
+
/** A role the `grants` module writes privileges for. */
|
|
1414
|
+
type ExposeRole = "anon" | "authenticated" | "service_role";
|
|
1415
|
+
/**
|
|
1416
|
+
* Data API grants for one table: privileges for `authenticated`, or per role.
|
|
1417
|
+
* `serviceRole` defaults to every privilege. For a function, keyed by its
|
|
1418
|
+
* signature (`search_notes(text, integer)`), `execute` lists the roles that may
|
|
1419
|
+
* call it; `service_role` is added unless `serviceRole` is false.
|
|
1420
|
+
*/
|
|
1421
|
+
type ExposeConfig = readonly ExposePrivilege[] | {
|
|
1422
|
+
readonly anon?: readonly ExposePrivilege[];
|
|
1423
|
+
readonly authenticated?: readonly ExposePrivilege[];
|
|
1424
|
+
readonly serviceRole?: readonly ExposePrivilege[];
|
|
1425
|
+
} | {
|
|
1426
|
+
readonly execute: readonly ("anon" | "authenticated")[];
|
|
1427
|
+
readonly serviceRole?: boolean;
|
|
1428
|
+
};
|
|
1429
|
+
/** Resolved grants for one table. */
|
|
1430
|
+
interface ResolvedExpose {
|
|
1431
|
+
readonly anon: readonly ExposePrivilege[];
|
|
1432
|
+
readonly authenticated: readonly ExposePrivilege[];
|
|
1433
|
+
readonly serviceRole: readonly ExposePrivilege[];
|
|
1434
|
+
}
|
|
1435
|
+
//#endregion
|
|
1436
|
+
//#region src/config/types/database.d.ts
|
|
1437
|
+
interface BucketConfig {
|
|
1438
|
+
readonly id?: string;
|
|
1439
|
+
readonly public?: boolean;
|
|
1440
|
+
/**
|
|
1441
|
+
* Path template with `{placeholders}`, e.g.
|
|
1442
|
+
* `{organizationId}/{customerId}/logo.webp`, or several when the bucket
|
|
1443
|
+
* stores objects in more than one layout. A last segment `{...rest}` matches
|
|
1444
|
+
* one or more segments.
|
|
1445
|
+
*/
|
|
1446
|
+
readonly path: string | readonly [string, ...string[]];
|
|
1447
|
+
/** Generated storage policy, or an access contract policy (`{ access }`). */
|
|
1448
|
+
readonly policy?: BucketPolicyName | AccessBucketPolicy;
|
|
1449
|
+
readonly fileSizeLimit?: string;
|
|
1450
|
+
readonly allowedMimeTypes?: readonly string[];
|
|
1451
|
+
/**
|
|
1452
|
+
* Keep earlier object versions. `bucket.apply()` sets it; doctor (BS302)
|
|
1453
|
+
* compares it.
|
|
1454
|
+
*/
|
|
1455
|
+
readonly versioning?: boolean;
|
|
1456
|
+
/** When noncurrent versions expire. Needs `versioning: true`. */
|
|
1457
|
+
readonly lifecycle?: BucketLifecycle;
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* How the SQL modules reach the database: `pg-delta` (Supabase Declarative
|
|
1461
|
+
* Schemas 2.0, `supabase db schema declarative sync`), `migra` (declarative
|
|
1462
|
+
* schemas 1.0, `supabase db diff`) or `migrations` (no declarative schemas: the
|
|
1463
|
+
* `sql` commands write the modules into a migration).
|
|
1464
|
+
*/
|
|
1465
|
+
type SqlWorkflow = "pg-delta" | "migra" | "migrations";
|
|
1466
|
+
interface SqlConfig {
|
|
1467
|
+
/**
|
|
1468
|
+
* The workflow. Unset, better-supabase reads `supabase/config.toml`: pg-delta
|
|
1469
|
+
* when it enables it or nothing says otherwise, migra when it turns pg-delta
|
|
1470
|
+
* off or the project keeps migra's declarative schemas.
|
|
1471
|
+
*/
|
|
1472
|
+
readonly workflow?: SqlWorkflow;
|
|
1473
|
+
/** Directory declarative schema files are written to. */
|
|
1474
|
+
readonly dir?: string;
|
|
1475
|
+
/** File name prefix, so generated files sort after yours. */
|
|
1476
|
+
readonly prefix?: string;
|
|
1477
|
+
/** Directory pgTAP files (the `pgtap` module) are written to. */
|
|
1478
|
+
readonly testsDir?: string;
|
|
1479
|
+
/**
|
|
1480
|
+
* The schema every module writes its functions and managed tables to, unless
|
|
1481
|
+
* `blocks.<name>.schema` sets its own. Defaults to `better_supabase`.
|
|
1482
|
+
*/
|
|
1483
|
+
readonly schema?: string;
|
|
1484
|
+
/**
|
|
1485
|
+
* The Data API schema, such as `api`, every module writes its `security
|
|
1486
|
+
* invoker` wrappers to, unless `blocks.<name>.api` sets its own or `false`.
|
|
1487
|
+
*/
|
|
1488
|
+
readonly api?: string;
|
|
1489
|
+
/**
|
|
1490
|
+
* Who a block's rows belong to, unless `blocks.<name>.owner` sets its own:
|
|
1491
|
+
* `tenant` (a tenant, checked through the access contract; the default),
|
|
1492
|
+
* `user` (the signed-in user, with no tenants) or `none` (one shared space
|
|
1493
|
+
* every signed-in user reads and writes).
|
|
1494
|
+
*/
|
|
1495
|
+
readonly scope?: BlockScope;
|
|
1496
|
+
}
|
|
1497
|
+
/** `sql` with defaults applied. */
|
|
1498
|
+
interface ResolvedSqlConfig {
|
|
1499
|
+
/** Unset when the config leaves it to `supabase/config.toml`. */
|
|
1500
|
+
readonly workflow?: SqlWorkflow;
|
|
1501
|
+
readonly dir: string;
|
|
1502
|
+
readonly prefix: string;
|
|
1503
|
+
readonly testsDir: string;
|
|
1504
|
+
/** Unset means `tenant`. */
|
|
1505
|
+
readonly scope?: BlockScope;
|
|
1506
|
+
}
|
|
1507
|
+
interface SeedConfig {
|
|
1508
|
+
/** Module exporting `defineSeed(...)` as `seed` or default. */
|
|
1509
|
+
readonly entry?: string;
|
|
1510
|
+
/** SQL file `better-supabase db seed` writes. Add it to `[db.seed] sql_paths`. */
|
|
1511
|
+
readonly output?: string;
|
|
1512
|
+
/**
|
|
1513
|
+
* Module exporting `defineTenantSeed(...)` as `seed` or default.
|
|
1514
|
+
* `better-supabase db seed --tenant <slug>` applies it to one tenant.
|
|
1515
|
+
*/
|
|
1516
|
+
readonly perTenant?: string;
|
|
1517
|
+
}
|
|
1518
|
+
interface RealtimeConfig {
|
|
1519
|
+
/**
|
|
1520
|
+
* Tables that broadcast a change signal for live queries (`table` or
|
|
1521
|
+
* `schema.table`). Tenant tables broadcast per tenant. Install the triggers
|
|
1522
|
+
* with `better-supabase add realtime-tables`.
|
|
1523
|
+
*/
|
|
1524
|
+
readonly tables?: readonly string[];
|
|
1525
|
+
/**
|
|
1526
|
+
* Tables in `tables` without a tenant column. They broadcast on one topic
|
|
1527
|
+
* every signed-in user receives. With the `tenant` plugin, a table that lacks
|
|
1528
|
+
* the tenant column and is not listed here fails to install.
|
|
1529
|
+
*/
|
|
1530
|
+
readonly global?: readonly string[];
|
|
1531
|
+
/**
|
|
1532
|
+
* Tables in `tables` whose rows belong to one user: table to its user column
|
|
1533
|
+
* (`{ notifications: "user_id" }`). They broadcast on a topic per user,
|
|
1534
|
+
* `bsb:t:<schema>.<table>:u:<user id>`, which only that user receives,
|
|
1535
|
+
* instead of the tenant's topic.
|
|
1536
|
+
*/
|
|
1537
|
+
readonly users?: Readonly<Record<string, string>>;
|
|
1538
|
+
/**
|
|
1539
|
+
* Writes the `realtime.messages` policies of the topics that `from` exports
|
|
1540
|
+
* (`defineTopic`) to `output`, a file in `supabase/schemas`, on
|
|
1541
|
+
* `better-supabase upgrade`; `upgrade --check` fails when it is stale.
|
|
1542
|
+
*/
|
|
1543
|
+
readonly policies?: TopicPoliciesConfig;
|
|
1544
|
+
/**
|
|
1545
|
+
* Broadcast triggers that `upgrade` writes to `policies.output` next to the
|
|
1546
|
+
* policies, through the topic's `trigger()`, for topics that `policies.from`
|
|
1547
|
+
* exports. A trigger with column values, one topic, a `keys` or `row` payload
|
|
1548
|
+
* and one event name calls `better_supabase.broadcast_topic()` (the
|
|
1549
|
+
* `realtime-tables` module); any other gets a generated function.
|
|
1550
|
+
*/
|
|
1551
|
+
readonly triggers?: readonly TopicTriggerConfig[];
|
|
1552
|
+
}
|
|
1553
|
+
interface TopicTriggerLookupConfig {
|
|
1554
|
+
readonly from: string;
|
|
1555
|
+
readonly via: TopicTriggerValueConfig;
|
|
1556
|
+
readonly select: string;
|
|
1557
|
+
readonly key?: string;
|
|
1558
|
+
}
|
|
1559
|
+
type TopicTriggerValueConfig = string | TopicTriggerLookupConfig;
|
|
1560
|
+
type TopicTriggerPayloadValueConfig = TopicTriggerValueConfig | {
|
|
1561
|
+
readonly sql: string;
|
|
1562
|
+
};
|
|
1563
|
+
interface TopicTriggerTopicConfig {
|
|
1564
|
+
readonly topic: string;
|
|
1565
|
+
readonly values?: Readonly<Record<string, TopicTriggerValueConfig>>;
|
|
1566
|
+
}
|
|
1567
|
+
/** One `realtime.triggers` entry: a table whose row changes go to a topic. */
|
|
1568
|
+
interface TopicTriggerConfig {
|
|
1569
|
+
/** The template of a topic that `realtime.policies.from` exports. */
|
|
1570
|
+
readonly topic: string;
|
|
1571
|
+
/** `table` or `schema.table`. */
|
|
1572
|
+
readonly table: string;
|
|
1573
|
+
/**
|
|
1574
|
+
* The column or lookup per placeholder. Defaults to the placeholder in
|
|
1575
|
+
* snake_case. A row whose topic comes out null is not sent to it.
|
|
1576
|
+
*/
|
|
1577
|
+
readonly values?: Readonly<Record<string, TopicTriggerValueConfig>>;
|
|
1578
|
+
/** Defaults to all three. */
|
|
1579
|
+
readonly events?: readonly ("insert" | "update" | "delete")[];
|
|
1580
|
+
/**
|
|
1581
|
+
* The broadcast event name, or one per operation (`{ insert: "created",
|
|
1582
|
+
* delete: "deleted" }`). Defaults to the operation.
|
|
1583
|
+
*/
|
|
1584
|
+
readonly event?: string | {
|
|
1585
|
+
readonly insert?: string;
|
|
1586
|
+
readonly update?: string;
|
|
1587
|
+
readonly delete?: string;
|
|
1588
|
+
};
|
|
1589
|
+
/**
|
|
1590
|
+
* `"keys"` (default) sends the primary key and the placeholder values.
|
|
1591
|
+
* `"row"` sends the whole row, which bypasses column grants. An object is the
|
|
1592
|
+
* payload itself: each key is a column, a lookup, or `{ sql }`, an expression
|
|
1593
|
+
* on the row `{row}` (`tg_op` is the operation).
|
|
1594
|
+
*/
|
|
1595
|
+
readonly payload?: "keys" | "row" | Readonly<Record<string, TopicTriggerPayloadValueConfig>>;
|
|
1596
|
+
readonly topics?: readonly TopicTriggerTopicConfig[];
|
|
1597
|
+
readonly functionSchema?: string;
|
|
1598
|
+
/**
|
|
1599
|
+
* `{ changed: ["status"] }` sends an UPDATE only when one of these columns
|
|
1600
|
+
* changed. Inserts and deletes always send.
|
|
1601
|
+
*/
|
|
1602
|
+
readonly when?: {
|
|
1603
|
+
readonly changed: readonly string[];
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
/** `realtime.policies`: where topic policies come from and go. */
|
|
1607
|
+
interface TopicPoliciesConfig {
|
|
1608
|
+
/** Modules that export `defineTopic` results. Node imports them. */
|
|
1609
|
+
readonly from: readonly string[];
|
|
1610
|
+
/** The SQL file to write, such as `supabase/schemas/905_topics.sql`. */
|
|
1611
|
+
readonly output: string;
|
|
1612
|
+
}
|
|
1613
|
+
/**
|
|
1614
|
+
* Pgvector distance: `<=>` (cosine), `<->` (l2) or `<#>` (negative inner
|
|
1615
|
+
* product).
|
|
1616
|
+
*/
|
|
1617
|
+
type VectorDistance = "cosine" | "l2" | "inner_product";
|
|
1618
|
+
/** The embedding column, or the column and its distance (default `cosine`). */
|
|
1619
|
+
type VectorSearchConfig = string | {
|
|
1620
|
+
readonly column: string;
|
|
1621
|
+
readonly distance?: VectorDistance;
|
|
1622
|
+
/** The column's pgvector type. Defaults to `vector`. */
|
|
1623
|
+
readonly type?: "vector" | "halfvec";
|
|
1624
|
+
/**
|
|
1625
|
+
* The primary key column `db.$search({ score: true })` merges by.
|
|
1626
|
+
* Defaults to `id`.
|
|
1627
|
+
*/
|
|
1628
|
+
readonly key?: string;
|
|
1629
|
+
/**
|
|
1630
|
+
* Fuses a full-text ranking over a `tsvector` column with the vector
|
|
1631
|
+
* ranking (reciprocal rank fusion), for `db.$search({ text })`.
|
|
1632
|
+
*/
|
|
1633
|
+
readonly hybrid?: {
|
|
1634
|
+
readonly tsvector: string;
|
|
1635
|
+
/** The query's text search configuration. Defaults to `simple`. */
|
|
1636
|
+
readonly config?: string;
|
|
1637
|
+
/** The RRF constant. Defaults to 60. */
|
|
1638
|
+
readonly k?: number;
|
|
1639
|
+
};
|
|
1640
|
+
/**
|
|
1641
|
+
* A SQL expression over the row `t` the score is multiplied by, such as
|
|
1642
|
+
* `t.priority`.
|
|
1643
|
+
*/
|
|
1644
|
+
readonly boost?: string;
|
|
1645
|
+
/** Columns `db.$search({ filter })` narrows before ranking. */
|
|
1646
|
+
readonly prefilter?: readonly string[];
|
|
1647
|
+
/**
|
|
1648
|
+
* A SQL condition over the row `t` every candidate must meet, applied
|
|
1649
|
+
* before ranking: ranges, a parent row, such as `t.expires_at > now() and
|
|
1650
|
+
* exists (select 1 from public.folders f where f.id = t.folder_id and not
|
|
1651
|
+
* f.disabled)`.
|
|
1652
|
+
*/
|
|
1653
|
+
readonly predicate?: string;
|
|
1654
|
+
/** How `boost` combines with the score: `multiply` (default) or `add`. */
|
|
1655
|
+
readonly boostMode?: "multiply" | "add";
|
|
1656
|
+
/**
|
|
1657
|
+
* A SQL `order by` list over the row `t` that breaks score ties, such as
|
|
1658
|
+
* `t.created_at desc`.
|
|
1659
|
+
*/
|
|
1660
|
+
readonly order?: string;
|
|
1661
|
+
};
|
|
1662
|
+
//#endregion
|
|
1663
|
+
//#region src/config/types/entitlements.d.ts
|
|
1664
|
+
interface EntitlementsConfig {
|
|
1665
|
+
/**
|
|
1666
|
+
* `table.column` (or `schema.table.column`) holding each tenant's Stripe
|
|
1667
|
+
* customer id, read by the `entitlements` SQL module. Required without the
|
|
1668
|
+
* `organizations` module; with it, defaults to the `stripe_customer_id`
|
|
1669
|
+
* column that module adds.
|
|
1670
|
+
*/
|
|
1671
|
+
readonly customer?: string;
|
|
1672
|
+
/** The tenant id column of that table. Defaults to `id`. */
|
|
1673
|
+
readonly key?: string;
|
|
1674
|
+
/**
|
|
1675
|
+
* Where `has_entitlement` and `feature_claims` read memberships from.
|
|
1676
|
+
* `"provider"` calls the authorization provider's `memberIds` and
|
|
1677
|
+
* `memberIdsFor` functions; `"tenant"` reads `better_supabase.memberships`.
|
|
1678
|
+
* Defaults to `"provider"` when `authorization` is set, else `"tenant"`.
|
|
1679
|
+
*/
|
|
1680
|
+
readonly memberships?: "tenant" | "provider";
|
|
1681
|
+
/**
|
|
1682
|
+
* Where each tenant's entitlements come from. `"stripe-sync"` (the default)
|
|
1683
|
+
* reads the Stripe Sync Engine's `stripe.active_entitlements` through
|
|
1684
|
+
* `customer`. `{ plans }` reads a plan catalog: the tenant's active
|
|
1685
|
+
* subscription and the features its plan includes. `"custom"` leaves
|
|
1686
|
+
* `better_supabase.tenant_entitlements(tenant)` to you; the module writes the
|
|
1687
|
+
* checks and the claim over it.
|
|
1688
|
+
*/
|
|
1689
|
+
readonly source?: "stripe-sync" | "custom" | EntitlementPlansSource;
|
|
1690
|
+
/**
|
|
1691
|
+
* The shape of the features claim `feature_claims` writes, which every token
|
|
1692
|
+
* carries. `false` writes `{}` (check entitlements in SQL with
|
|
1693
|
+
* `has_entitlement` only); `maxTenants` keeps at most that many tenants;
|
|
1694
|
+
* `keys` writes short codes instead of the feature keys. Pass the same `keys`
|
|
1695
|
+
* to `hasEntitlement`.
|
|
1696
|
+
*/
|
|
1697
|
+
readonly claim?: false | {
|
|
1698
|
+
readonly maxTenants?: number;
|
|
1699
|
+
readonly keys?: Readonly<Record<string, string>>;
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
/** `entitlements.source.plans`: a plan catalog in your own tables. */
|
|
1703
|
+
interface EntitlementPlansSource {
|
|
1704
|
+
readonly plans: {
|
|
1705
|
+
readonly subscriptions: {
|
|
1706
|
+
/** `table` or `schema.table`. */
|
|
1707
|
+
readonly table: string;
|
|
1708
|
+
/** The tenant id column. */
|
|
1709
|
+
readonly tenant: string;
|
|
1710
|
+
/** The plan key column. */
|
|
1711
|
+
readonly plan: string;
|
|
1712
|
+
/** A status column; with it, only rows in `activeStatuses` count. */
|
|
1713
|
+
readonly status?: string;
|
|
1714
|
+
/** Defaults to `["active", "trialing"]`. */
|
|
1715
|
+
readonly activeStatuses?: readonly string[];
|
|
1716
|
+
};
|
|
1717
|
+
readonly features: {
|
|
1718
|
+
/** `table` or `schema.table`. */
|
|
1719
|
+
readonly table: string;
|
|
1720
|
+
/** The plan key column. */
|
|
1721
|
+
readonly plan: string;
|
|
1722
|
+
/** The feature key column: what `has_entitlement` and the claim name. */
|
|
1723
|
+
readonly feature: string;
|
|
1724
|
+
/** A boolean column; with it, only included features count. */
|
|
1725
|
+
readonly included?: string;
|
|
1726
|
+
/**
|
|
1727
|
+
* A column with the feature's value (a number, text or jsonb), such as a
|
|
1728
|
+
* limit, that `tenant_entitlement_value` returns.
|
|
1729
|
+
*/
|
|
1730
|
+
readonly value?: string;
|
|
1731
|
+
};
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
//#endregion
|
|
1735
|
+
//#region src/config/types/groups.d.ts
|
|
1736
|
+
interface LegacyBlockKeys {
|
|
1737
|
+
readonly mode?: unknown;
|
|
1738
|
+
readonly scope?: unknown;
|
|
1739
|
+
readonly entities?: unknown;
|
|
1740
|
+
readonly hooks?: unknown;
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* One `blocks.<name>` entry as the config writes it: the block settings with
|
|
1744
|
+
* `ownership`, `owner`, `names` and `callbacks`.
|
|
1745
|
+
*/
|
|
1746
|
+
type BlockInput<T extends LegacyBlockKeys> = Omit<T, keyof LegacyBlockKeys> & {
|
|
1747
|
+
/**
|
|
1748
|
+
* Who owns the block's tables: `managed` (better-supabase writes them, the
|
|
1749
|
+
* default), `adopt` (your tables, mapped through `tables` and `columns`) or
|
|
1750
|
+
* `custom` (your functions behind the block's contract).
|
|
1751
|
+
*/
|
|
1752
|
+
readonly ownership?: T["mode"];
|
|
1753
|
+
/**
|
|
1754
|
+
* Who the block's rows belong to. Defaults to `database.sql.owner`, then
|
|
1755
|
+
* `tenant`.
|
|
1756
|
+
*/
|
|
1757
|
+
readonly owner?: T["scope"];
|
|
1758
|
+
/** New names for the block's entities. */
|
|
1759
|
+
readonly names?: T["entities"];
|
|
1760
|
+
/**
|
|
1761
|
+
* The app's optional `before_*` and `after_*` functions the block calls when
|
|
1762
|
+
* they exist, e.g. `after_organization_create(organization, user)`.
|
|
1763
|
+
*/
|
|
1764
|
+
readonly callbacks?: T["hooks"];
|
|
1765
|
+
};
|
|
1766
|
+
/**
|
|
1767
|
+
* `blocks` keyed by instance, as the config writes it: a block name installs
|
|
1768
|
+
* that block, and any other key names an instance with `block`.
|
|
1769
|
+
*/
|
|
1770
|
+
type BlocksInput = { readonly [M in BlockName]?: BlockInput<BlockConfigOf<M>>; } & {
|
|
1771
|
+
readonly [instance: string]: NamedInstance | undefined;
|
|
1772
|
+
};
|
|
1773
|
+
/** One `tables.<name>` entry: an app table with `owner`. */
|
|
1774
|
+
type AppTableInput = Omit<AppTableConfig, "scope"> & {
|
|
1775
|
+
/**
|
|
1776
|
+
* Who reaches a row. `inherit` (the default) follows `database.sql.owner`;
|
|
1777
|
+
* `user` keeps rows per user, and `none` lets signed-in users read every row
|
|
1778
|
+
* while only the service role writes.
|
|
1779
|
+
*/
|
|
1780
|
+
readonly owner?: AppTableConfig["scope"];
|
|
1781
|
+
};
|
|
1782
|
+
type AppTablesInput = Readonly<Record<string, AppTableInput>>;
|
|
1783
|
+
/** `database.sql`: SQL-wide settings with `owner`. */
|
|
1784
|
+
type SqlInput = Omit<SqlConfig, "scope"> & {
|
|
1785
|
+
/**
|
|
1786
|
+
* Who a block's rows belong to, unless `blocks.<name>.owner` sets its own:
|
|
1787
|
+
* `tenant` (the default), `user` or `none`.
|
|
1788
|
+
*/
|
|
1789
|
+
readonly owner?: SqlConfig["scope"];
|
|
1790
|
+
};
|
|
1791
|
+
/** Where the active organization of a request comes from. */
|
|
1792
|
+
interface OrganizationConfig {
|
|
1793
|
+
/**
|
|
1794
|
+
* Top-level claim holding the active organization id. Defaults to
|
|
1795
|
+
* `tenant_id`.
|
|
1796
|
+
*/
|
|
1797
|
+
readonly claim?: string;
|
|
1798
|
+
/**
|
|
1799
|
+
* The column holding the organization id on organization tables, which the
|
|
1800
|
+
* `memberships` extension scopes and fills. Defaults to `organization_id`, or
|
|
1801
|
+
* `<name>_id` when `blocks.memberships.names.organization` renames it.
|
|
1802
|
+
* Setting it without the `memberships` block turns the extension on for an
|
|
1803
|
+
* app's own tenancy.
|
|
1804
|
+
*/
|
|
1805
|
+
readonly column?: string;
|
|
1806
|
+
/**
|
|
1807
|
+
* A request without an organization on an organization table: `skip`
|
|
1808
|
+
* (default) leaves it to RLS, `error` fails it with `forbidden`.
|
|
1809
|
+
*/
|
|
1810
|
+
readonly onMissing?: "error" | "skip";
|
|
1811
|
+
/**
|
|
1812
|
+
* The request header an app's resolver reads the organization from; the API
|
|
1813
|
+
* spec documents it on organization tables.
|
|
1814
|
+
*/
|
|
1815
|
+
readonly header?: string;
|
|
1816
|
+
}
|
|
1817
|
+
/** The database: where it is read from, its SQL and what it exposes. */
|
|
1818
|
+
interface DatabaseConfig {
|
|
1819
|
+
readonly source?: SourceConfig;
|
|
1820
|
+
/** Postgres schemas to generate. Defaults to `['public']`. */
|
|
1821
|
+
readonly schemas?: readonly string[];
|
|
1822
|
+
/**
|
|
1823
|
+
* SQL-wide settings: the workflow, paths, and the `schema`, `api` and `owner`
|
|
1824
|
+
* every block inherits.
|
|
1825
|
+
*/
|
|
1826
|
+
readonly sql?: SqlInput;
|
|
1827
|
+
readonly seed?: SeedConfig;
|
|
1828
|
+
/**
|
|
1829
|
+
* Data API grants, keyed by `table` or `schema.table`, and function `execute`
|
|
1830
|
+
* grants, keyed by `name(argument types)` or `schema.name(argument types)`.
|
|
1831
|
+
*/
|
|
1832
|
+
readonly expose?: Readonly<Record<string, ExposeConfig>>;
|
|
1833
|
+
readonly buckets?: Readonly<Record<string, BucketConfig>>;
|
|
1834
|
+
readonly realtime?: RealtimeConfig;
|
|
1835
|
+
/**
|
|
1836
|
+
* Realtime topic templates: `{ notifications:
|
|
1837
|
+
* 'organization:{organizationId}:notifications' }`.
|
|
1838
|
+
*/
|
|
1839
|
+
readonly topics?: Readonly<Record<string, string>>;
|
|
1840
|
+
/**
|
|
1841
|
+
* Embedding columns, keyed by `table` or `schema.table`. The `vector-search`
|
|
1842
|
+
* block writes `search_<table>(query, k)` for each.
|
|
1843
|
+
*/
|
|
1844
|
+
readonly vectorSearch?: Readonly<Record<string, VectorSearchConfig>>;
|
|
1845
|
+
}
|
|
1846
|
+
/** Who the caller is: the organization, claims and authorization. */
|
|
1847
|
+
interface AuthConfig {
|
|
1848
|
+
readonly organization?: OrganizationConfig;
|
|
1849
|
+
/** Claim names shared by the SQL, codegen and the runtime. */
|
|
1850
|
+
readonly claims?: Omit<ClaimsConfig, "tenant">;
|
|
1851
|
+
/**
|
|
1852
|
+
* An authorization system the blocks, policies and doctor delegate to: the
|
|
1853
|
+
* `provider` access model, `entitlements.memberships` and the hook and policy
|
|
1854
|
+
* checks.
|
|
1855
|
+
*/
|
|
1856
|
+
readonly authorization?: AuthorizationProvider;
|
|
1857
|
+
readonly entitlements?: EntitlementsConfig;
|
|
1858
|
+
}
|
|
1859
|
+
/** What `better-supabase gen` writes and how. */
|
|
1860
|
+
interface GenGroupConfig extends GenConfig {
|
|
1861
|
+
/**
|
|
1862
|
+
* Main generated module. Defaults to `src/lib/supabase/generated.ts`;
|
|
1863
|
+
* `database.types.ts` is written next to it.
|
|
1864
|
+
*/
|
|
1865
|
+
readonly output?: string;
|
|
1866
|
+
/** Casing of generated models and returned rows. Defaults to `'snake'`. */
|
|
1867
|
+
readonly casing?: Casing;
|
|
1868
|
+
/**
|
|
1869
|
+
* PostgREST major version, written to `__InternalSupabase` in
|
|
1870
|
+
* `database.types.ts`. Defaults to `'13'`.
|
|
1871
|
+
*/
|
|
1872
|
+
readonly postgrestVersion?: string;
|
|
1873
|
+
/**
|
|
1874
|
+
* Write one `records/<type>.ts` next to `output` per record type that an
|
|
1875
|
+
* installed block binds to (`defineRecordType`). Defaults to `true`.
|
|
1876
|
+
*/
|
|
1877
|
+
readonly recordTypes?: boolean;
|
|
1878
|
+
/**
|
|
1879
|
+
* Write `hooks.ts` next to `output`: `defineDataHooks` from this framework's
|
|
1880
|
+
* entry, once per block instance and table (`useTickets`, `useTicket`).
|
|
1881
|
+
* Defaults to `react` when the adapters include `next`, `react` or `expo`,
|
|
1882
|
+
* and to `false` otherwise.
|
|
1883
|
+
*/
|
|
1884
|
+
readonly hooks?: DataHooksFramework | false;
|
|
1885
|
+
/** Overrides per generated table, keyed by `table` or `schema.table`. */
|
|
1886
|
+
readonly tables?: Readonly<Record<string, TableConfig>>;
|
|
1887
|
+
/** Types for jsonb columns, keyed by `table.column`. */
|
|
1888
|
+
readonly json?: Readonly<Record<string, JsonTypeConfig>>;
|
|
1889
|
+
readonly codecs?: CodecsConfig;
|
|
1890
|
+
readonly relations?: RelationsConfig;
|
|
1891
|
+
/**
|
|
1892
|
+
* Columns that must not be read by accident (`table.column` or
|
|
1893
|
+
* `schema.table.column`, database names), for the `noSensitiveSelect` rule.
|
|
1894
|
+
*/
|
|
1895
|
+
readonly sensitive?: readonly string[];
|
|
1896
|
+
/**
|
|
1897
|
+
* Text columns that hold an object path, keyed by `table.column` or
|
|
1898
|
+
* `schema.table.column`, with the bucket as the value (a `database.buckets`
|
|
1899
|
+
* key or a bucket id).
|
|
1900
|
+
*/
|
|
1901
|
+
readonly storagePaths?: Readonly<Record<string, string>>;
|
|
1902
|
+
/** Function results `gen` may type as not null, keyed by function name. */
|
|
1903
|
+
readonly functions?: Readonly<Record<string, FunctionConfig>>;
|
|
1904
|
+
readonly generators?: readonly Generator[];
|
|
1905
|
+
/**
|
|
1906
|
+
* Modules that export `defineReadSet` results, compiled to functions in the
|
|
1907
|
+
* `read-sets` block.
|
|
1908
|
+
*/
|
|
1909
|
+
readonly readSets?: readonly string[];
|
|
1910
|
+
}
|
|
1911
|
+
/** The API documents `better-supabase spec emit` writes. */
|
|
1912
|
+
interface ApiConfig {
|
|
1913
|
+
/** @deprecated Use `specs`; `openapi.entry` and `openapi.output` map onto it. */
|
|
1914
|
+
readonly openapi?: OpenApiConfig;
|
|
1915
|
+
/** The documents `spec emit` writes (OpenAPI, AsyncAPI, Arazzo). */
|
|
1916
|
+
readonly specs?: SpecsConfig;
|
|
1917
|
+
}
|
|
1918
|
+
/** Project tooling: doctor, env files, keys and skills. */
|
|
1919
|
+
interface ToolingConfig {
|
|
1920
|
+
readonly doctor?: DoctorConfig;
|
|
1921
|
+
readonly env?: EnvFileConfig;
|
|
1922
|
+
readonly keys?: KeysConfig;
|
|
1923
|
+
readonly skills?: SkillsConfig;
|
|
1924
|
+
}
|
|
1925
|
+
/** `better-supabase.config.ts`, grouped by what each key configures. */
|
|
1926
|
+
interface BetterSupabaseConfig {
|
|
1927
|
+
readonly $schema?: string;
|
|
1928
|
+
/**
|
|
1929
|
+
* A named preset (`saas`, `crm`, ...), or a preset object: the conventions
|
|
1930
|
+
* that differ from the defaults and the blocks. It expands into `blocks`,
|
|
1931
|
+
* with the blocks they require, and the conventions it sets; the keys you set
|
|
1932
|
+
* win.
|
|
1933
|
+
*/
|
|
1934
|
+
readonly preset?: PresetName | (string & {}) | PresetSpec;
|
|
1935
|
+
readonly database?: DatabaseConfig;
|
|
1936
|
+
readonly auth?: AuthConfig;
|
|
1937
|
+
/**
|
|
1938
|
+
* The app's record types: the entities blocks attach tags, comments, fields
|
|
1939
|
+
* and ranks to, keyed by type name.
|
|
1940
|
+
*/
|
|
1941
|
+
readonly records?: SubjectsConfig;
|
|
1942
|
+
/**
|
|
1943
|
+
* Tables the app owns, keyed by name, created in `public` by `better-supabase
|
|
1944
|
+
* upgrade`. ADR 0040.
|
|
1945
|
+
*/
|
|
1946
|
+
readonly tables?: AppTablesInput;
|
|
1947
|
+
/**
|
|
1948
|
+
* The blocks to install and keep in sync: a list of names, or an object keyed
|
|
1949
|
+
* by block name whose values set each block's ownership, names and options.
|
|
1950
|
+
*/
|
|
1951
|
+
readonly blocks?: readonly string[] | BlocksInput;
|
|
1952
|
+
/** The framework and runtime adapters `init` and `add` wrote. */
|
|
1953
|
+
readonly adapters?: readonly IntegrationName[];
|
|
1954
|
+
readonly gen?: GenGroupConfig;
|
|
1955
|
+
readonly api?: ApiConfig;
|
|
1956
|
+
readonly tooling?: ToolingConfig;
|
|
1957
|
+
/**
|
|
1958
|
+
* Overrides per environment, keyed by name. The CLI applies the block for
|
|
1959
|
+
* `--env <name>`, else `$BETTER_SUPABASE_ENV`, else `ci` when `$CI` is set.
|
|
1960
|
+
* Objects merge into the config; arrays and other values replace.
|
|
1961
|
+
*/
|
|
1962
|
+
readonly $env?: Readonly<Record<string, EnvironmentConfig>>;
|
|
1963
|
+
/** Shorthand for `$env.development`. */
|
|
1964
|
+
readonly $development?: EnvironmentConfig;
|
|
1965
|
+
/** Shorthand for `$env.production`. */
|
|
1966
|
+
readonly $production?: EnvironmentConfig;
|
|
1967
|
+
/** Shorthand for `$env.test`. */
|
|
1968
|
+
readonly $test?: EnvironmentConfig;
|
|
1969
|
+
/** Shorthand for `$env.ci`, which the CLI picks when `$CI` is set. */
|
|
1970
|
+
readonly $ci?: EnvironmentConfig;
|
|
1971
|
+
}
|
|
1972
|
+
/** The keys an environment block may override. */
|
|
1973
|
+
type EnvironmentConfig = Omit<BetterSupabaseConfig, "$schema" | "$env" | "$development" | "$production" | "$test" | "$ci" | "preset">;
|
|
1974
|
+
//#endregion
|
|
1975
|
+
//#region src/config/types/config.d.ts
|
|
1976
|
+
/** The frameworks `gen.hooks` writes data hooks for. */
|
|
1977
|
+
type DataHooksFramework = "react" | "vue" | "svelte" | "solid";
|
|
1978
|
+
/**
|
|
1979
|
+
* The config with every key at the top level, as `flattenConfig` returns it and
|
|
1980
|
+
* `resolveConfig` reads it. Apps write the grouped `BetterSupabaseConfig`.
|
|
1981
|
+
*/
|
|
1982
|
+
interface FlatConfig {
|
|
1983
|
+
readonly $schema?: string;
|
|
1984
|
+
readonly source?: SourceConfig;
|
|
1985
|
+
/** Postgres schemas to generate. Defaults to `['public']`. */
|
|
1986
|
+
readonly schemas?: readonly string[];
|
|
1987
|
+
/** Casing of generated models and returned rows. Defaults to `'snake'`. */
|
|
1988
|
+
readonly casing?: Casing;
|
|
1989
|
+
readonly tables?: Readonly<Record<string, TableConfig>>;
|
|
1990
|
+
/**
|
|
1991
|
+
* Main generated module. Defaults to `src/lib/supabase/generated.ts`;
|
|
1992
|
+
* `database.types.ts` is written next to it.
|
|
1993
|
+
*/
|
|
1994
|
+
readonly output?: string;
|
|
1995
|
+
/**
|
|
1996
|
+
* PostgREST major version, written to `__InternalSupabase` in
|
|
1997
|
+
* `database.types.ts` so `createClient` picks matching behavior. Defaults to
|
|
1998
|
+
* `'13'`.
|
|
1999
|
+
*/
|
|
2000
|
+
readonly postgrestVersion?: string;
|
|
2001
|
+
/**
|
|
2002
|
+
* Write one `records/<type>.ts` next to `output` per record type that an
|
|
2003
|
+
* installed block binds to (`defineRecordType`). Defaults to `true`.
|
|
2004
|
+
*/
|
|
2005
|
+
readonly recordTypes?: boolean;
|
|
2006
|
+
/**
|
|
2007
|
+
* Write `hooks.ts` next to `output`: `defineDataHooks` from this framework's
|
|
2008
|
+
* entry, once per block instance and table (`useTickets`, `useTicket`).
|
|
2009
|
+
* Defaults to `react` when the adapters include `next`, `react` or `expo`,
|
|
2010
|
+
* and to `false` otherwise.
|
|
2011
|
+
*/
|
|
2012
|
+
readonly hooks?: DataHooksFramework | false;
|
|
2013
|
+
/** Types for jsonb columns, keyed by `table.column`. */
|
|
2014
|
+
readonly json?: Readonly<Record<string, JsonTypeConfig>>;
|
|
2015
|
+
readonly codecs?: CodecsConfig;
|
|
2016
|
+
readonly relations?: RelationsConfig;
|
|
2017
|
+
/**
|
|
2018
|
+
* Columns that must not be read by accident (`table.column` or
|
|
2019
|
+
* `schema.table.column`, database names), for the `noSensitiveSelect` rule.
|
|
2020
|
+
*/
|
|
2021
|
+
readonly sensitive?: readonly string[];
|
|
2022
|
+
/**
|
|
2023
|
+
* Text columns that hold an object path, keyed by `table.column` or
|
|
2024
|
+
* `schema.table.column` (database names), with the bucket as the value (a
|
|
2025
|
+
* `buckets` key or a bucket id). Generated rows type them as
|
|
2026
|
+
* `StoragePath<'bucket-id'>`.
|
|
2027
|
+
*/
|
|
2028
|
+
readonly storagePaths?: Readonly<Record<string, string>>;
|
|
2029
|
+
/**
|
|
2030
|
+
* Function results `gen` may type as not null, keyed by function name.
|
|
2031
|
+
* Results are `| null` by default, since Postgres can't promise a function
|
|
2032
|
+
* returns a value. `notNull: true` covers the whole result (each element of a
|
|
2033
|
+
* set, each column of `returns table`); a list names the `returns table`
|
|
2034
|
+
* columns that are never null.
|
|
2035
|
+
*/
|
|
2036
|
+
readonly functions?: Readonly<Record<string, FunctionConfig>>;
|
|
2037
|
+
/**
|
|
2038
|
+
* Data API grants, keyed by `table` or `schema.table`, and function `execute`
|
|
2039
|
+
* grants, keyed by `name(argument types)` or `schema.name(argument types)`. A
|
|
2040
|
+
* project with default privileges turned off grants new tables to no Data API
|
|
2041
|
+
* role; the `grants` SQL module writes these as the complete privilege set
|
|
2042
|
+
* (it revokes what is not listed), and doctor (BS106) checks them. Tables not
|
|
2043
|
+
* listed need `select, insert, update, delete` for `authenticated` (`select`
|
|
2044
|
+
* for views).
|
|
2045
|
+
*/
|
|
2046
|
+
readonly expose?: Readonly<Record<string, ExposeConfig>>;
|
|
2047
|
+
/**
|
|
2048
|
+
* Modules that export `defineReadSet` results. `gen` compiles each set to a
|
|
2049
|
+
* function in the `read-sets` SQL module. Node imports them, so relative
|
|
2050
|
+
* imports need their `.ts` extension.
|
|
2051
|
+
*/
|
|
2052
|
+
readonly readSets?: readonly string[];
|
|
2053
|
+
readonly generators?: readonly Generator[];
|
|
2054
|
+
/**
|
|
2055
|
+
* `auth.organization` without its claim (that is `claims.tenant`): the
|
|
2056
|
+
* organization column and how the `memberships` extension resolves it.
|
|
2057
|
+
*/
|
|
2058
|
+
readonly organization?: Omit<OrganizationConfig, "claim">;
|
|
2059
|
+
readonly claims?: ClaimsConfig;
|
|
2060
|
+
readonly buckets?: Readonly<Record<string, BucketConfig>>;
|
|
2061
|
+
/**
|
|
2062
|
+
* Realtime topic templates: `{ notifications:
|
|
2063
|
+
* 'organization:{organizationId}:notifications' }`.
|
|
2064
|
+
*/
|
|
2065
|
+
readonly topics?: Readonly<Record<string, string>>;
|
|
2066
|
+
readonly realtime?: RealtimeConfig;
|
|
2067
|
+
readonly entitlements?: EntitlementsConfig;
|
|
2068
|
+
/**
|
|
2069
|
+
* An authorization system the SQL modules, policies and doctor delegate to:
|
|
2070
|
+
* the `provider` access model, `entitlements.memberships` and the hook and
|
|
2071
|
+
* policy checks.
|
|
2072
|
+
*/
|
|
2073
|
+
readonly authorization?: AuthorizationProvider;
|
|
2074
|
+
/**
|
|
2075
|
+
* Embedding columns, keyed by `table` or `schema.table`. The `vector-search`
|
|
2076
|
+
* SQL module writes `search_<table>(query, k)` for each, which
|
|
2077
|
+
* `db.$search(table, { vector, k })` calls.
|
|
2078
|
+
*/
|
|
2079
|
+
readonly vectorSearch?: Readonly<Record<string, VectorSearchConfig>>;
|
|
2080
|
+
/**
|
|
2081
|
+
* The app's subject types: the entities blocks attach tags, comments, fields
|
|
2082
|
+
* and ranks to. Subject-bound SQL modules read this registry, the `subjects`
|
|
2083
|
+
* module writes `subject_title`, `subject_url` and `can_subject` from it, and
|
|
2084
|
+
* `gen` types `SubjectType` from its keys.
|
|
2085
|
+
*/
|
|
2086
|
+
readonly subjects?: SubjectsConfig;
|
|
2087
|
+
/**
|
|
2088
|
+
* A named preset (`saas`, `crm`, ...), or a preset object: the conventions
|
|
2089
|
+
* that differ from the defaults and the blocks. It expands into `blocks`,
|
|
2090
|
+
* with the blocks they require, and the conventions it sets; the keys you set
|
|
2091
|
+
* win.
|
|
2092
|
+
*/
|
|
2093
|
+
readonly preset?: PresetName | (string & {}) | PresetSpec;
|
|
2094
|
+
/**
|
|
2095
|
+
* The blocks to install and keep in sync (`better-supabase add`): a list of
|
|
2096
|
+
* names, or an object keyed by block name whose values set each block's mode,
|
|
2097
|
+
* schema, table and column names, permission keys and options. The foundation
|
|
2098
|
+
* blocks (`tenant`, `access`, `updated-at`, `rls-guard`, ...) are configured
|
|
2099
|
+
* here too.
|
|
2100
|
+
*/
|
|
2101
|
+
readonly blocks?: readonly string[] | BlocksConfig;
|
|
2102
|
+
/**
|
|
2103
|
+
* Tables the app owns, keyed by name, created in `public` by `better-supabase
|
|
2104
|
+
* upgrade` with an `id`, the scope column, timestamps, row level security and
|
|
2105
|
+
* policies for the scope. Columns reference each other, `auth.users` or a
|
|
2106
|
+
* block's logical table. ADR 0040.
|
|
2107
|
+
*/
|
|
2108
|
+
readonly appTables?: AppTablesConfig;
|
|
2109
|
+
/**
|
|
2110
|
+
* SQL-wide settings: the workflow, paths, and the `schema` and `api` every
|
|
2111
|
+
* block inherits.
|
|
2112
|
+
*/
|
|
2113
|
+
readonly sql?: SqlConfig;
|
|
2114
|
+
readonly seed?: SeedConfig;
|
|
2115
|
+
/** @deprecated Use `specs`; `openapi.entry` and `openapi.output` map onto it. */
|
|
2116
|
+
readonly openapi?: OpenApiConfig;
|
|
2117
|
+
/**
|
|
2118
|
+
* The documents `better-supabase spec emit` writes (OpenAPI, AsyncAPI,
|
|
2119
|
+
* Arazzo).
|
|
2120
|
+
*/
|
|
2121
|
+
readonly specs?: SpecsConfig;
|
|
2122
|
+
readonly doctor?: DoctorConfig;
|
|
2123
|
+
/** What `better-supabase gen` runs. */
|
|
2124
|
+
readonly gen?: GenConfig;
|
|
2125
|
+
readonly env?: EnvFileConfig;
|
|
2126
|
+
/**
|
|
2127
|
+
* The integrations `init` and `add` wrote; `add` without a name sets up the
|
|
2128
|
+
* ones that have no files yet.
|
|
2129
|
+
*/
|
|
2130
|
+
readonly integrations?: readonly IntegrationName[];
|
|
2131
|
+
readonly skills?: SkillsConfig;
|
|
2132
|
+
readonly keys?: KeysConfig;
|
|
2133
|
+
}
|
|
2134
|
+
/** The config with defaults applied. */
|
|
2135
|
+
interface ResolvedConfig {
|
|
2136
|
+
readonly root: string;
|
|
2137
|
+
readonly source: SourceConfig;
|
|
2138
|
+
readonly schemas: readonly string[];
|
|
2139
|
+
readonly casing: Casing;
|
|
2140
|
+
readonly tables: Readonly<Record<string, TableConfig>>;
|
|
2141
|
+
readonly output: string;
|
|
2142
|
+
/** `database.types.ts` next to `output`. */
|
|
2143
|
+
readonly databaseTypesOutput: string;
|
|
2144
|
+
readonly postgrestVersion: string;
|
|
2145
|
+
readonly recordTypes: boolean;
|
|
2146
|
+
readonly hooks: DataHooksFramework | false;
|
|
2147
|
+
readonly json: Readonly<Record<string, JsonTypeConfig>>;
|
|
2148
|
+
readonly codecs: Required<CodecsConfig>;
|
|
2149
|
+
readonly relations: Required<RelationsConfig>;
|
|
2150
|
+
readonly sensitive: readonly string[];
|
|
2151
|
+
readonly storagePaths: Readonly<Record<string, string>>;
|
|
2152
|
+
readonly functions: Readonly<Record<string, FunctionConfig>>;
|
|
2153
|
+
/** The table entries of `expose`. */
|
|
2154
|
+
readonly expose: Readonly<Record<string, ResolvedExpose>>;
|
|
2155
|
+
/** The function entries of `expose`: the roles that may execute each one. */
|
|
2156
|
+
readonly exposeFunctions: Readonly<Record<string, readonly ExposeRole[]>>;
|
|
2157
|
+
readonly readSets: readonly string[];
|
|
2158
|
+
readonly generators: readonly Generator[];
|
|
2159
|
+
/**
|
|
2160
|
+
* The repository extensions of the installed blocks and the columns they
|
|
2161
|
+
* manage; `gen` writes them as table flags.
|
|
2162
|
+
*/
|
|
2163
|
+
readonly extensions: ResolvedExtensions;
|
|
2164
|
+
readonly claims: Required<ClaimsConfig>;
|
|
2165
|
+
readonly buckets: Readonly<Record<string, BucketConfig>>;
|
|
2166
|
+
readonly entitlements: {
|
|
2167
|
+
/** Unset without `entitlements.customer`. */
|
|
2168
|
+
readonly table?: string;
|
|
2169
|
+
readonly column?: string;
|
|
2170
|
+
readonly key: string;
|
|
2171
|
+
readonly memberships: "tenant" | "provider";
|
|
2172
|
+
readonly source: NonNullable<EntitlementsConfig["source"]>;
|
|
2173
|
+
readonly claim?: NonNullable<EntitlementsConfig["claim"]>;
|
|
2174
|
+
};
|
|
2175
|
+
readonly authorization?: AuthorizationProvider;
|
|
2176
|
+
readonly vectorSearch: readonly ({
|
|
2177
|
+
readonly table: string;
|
|
2178
|
+
readonly column: string;
|
|
2179
|
+
readonly distance: VectorDistance;
|
|
2180
|
+
} & Omit<Exclude<VectorSearchConfig, string>, "column" | "distance">)[];
|
|
2181
|
+
readonly subjects: SubjectsConfig;
|
|
2182
|
+
readonly topics: Readonly<Record<string, string>>;
|
|
2183
|
+
readonly realtime: Required<Omit<RealtimeConfig, "policies">> & {
|
|
2184
|
+
readonly policies?: TopicPoliciesConfig;
|
|
2185
|
+
};
|
|
2186
|
+
/**
|
|
2187
|
+
* The `preset` the config started from, as written; `blocks` already holds it
|
|
2188
|
+
* expanded.
|
|
2189
|
+
*/
|
|
2190
|
+
readonly preset?: string | PresetSpec;
|
|
2191
|
+
/** `blocks` with `sql.schema` and `sql.api` applied, keyed by block name. */
|
|
2192
|
+
readonly blocks: AnyBlocksConfig;
|
|
2193
|
+
/** The installed blocks, in config order, each once. */
|
|
2194
|
+
readonly blockNames: readonly string[];
|
|
2195
|
+
/** Every install of a block, keyed by its key in `blocks`. */
|
|
2196
|
+
readonly instances: Readonly<Record<string, ResolvedInstance>>;
|
|
2197
|
+
/** `appTables`, checked; empty without any. */
|
|
2198
|
+
readonly appTables: AppTablesConfig;
|
|
2199
|
+
readonly sql: ResolvedSqlConfig;
|
|
2200
|
+
readonly seed: Required<SeedConfig>;
|
|
2201
|
+
readonly openapi: Required<OpenApiConfig>;
|
|
2202
|
+
readonly specs: {
|
|
2203
|
+
readonly entry: string;
|
|
2204
|
+
readonly outputs: readonly SpecOutputConfig[];
|
|
2205
|
+
readonly failOn: NonNullable<SpecsConfig["failOn"]>;
|
|
2206
|
+
readonly manifest?: string;
|
|
2207
|
+
};
|
|
2208
|
+
readonly doctor: Required<Omit<DoctorConfig, "claimsLimit" | "output" | "migrationSafety">> & Pick<DoctorConfig, "claimsLimit" | "output" | "migrationSafety">;
|
|
2209
|
+
/**
|
|
2210
|
+
* `tasks` stays unset without a list, so `gen` picks the steps the project
|
|
2211
|
+
* uses.
|
|
2212
|
+
*/
|
|
2213
|
+
readonly gen: GenConfig;
|
|
2214
|
+
readonly env: {
|
|
2215
|
+
readonly output: string;
|
|
2216
|
+
readonly prefix?: string;
|
|
2217
|
+
};
|
|
2218
|
+
readonly integrations: readonly IntegrationName[];
|
|
2219
|
+
readonly skills: SkillsConfig;
|
|
2220
|
+
readonly keys: KeysConfig;
|
|
2221
|
+
/** The environment block the CLI applied, when one was active. */
|
|
2222
|
+
readonly environment?: string;
|
|
2223
|
+
}
|
|
2224
|
+
/**
|
|
2225
|
+
* The columns the repository extensions of the installed blocks manage, by
|
|
2226
|
+
* extension; an extension whose block is not installed is `undefined`.
|
|
2227
|
+
*/
|
|
2228
|
+
interface ResolvedExtensions {
|
|
2229
|
+
/** `updated-at`: `blocks["updated-at"].options`. */
|
|
2230
|
+
readonly timestamps: {
|
|
2231
|
+
readonly createdAt: string;
|
|
2232
|
+
readonly updatedAt: string;
|
|
2233
|
+
} | undefined;
|
|
2234
|
+
/** `trash`: `blocks.trash.options.deletedAt`. */
|
|
2235
|
+
readonly softDelete: {
|
|
2236
|
+
readonly column: string;
|
|
2237
|
+
} | undefined;
|
|
2238
|
+
/**
|
|
2239
|
+
* `memberships`, or `auth.organization.column` without it: the organization
|
|
2240
|
+
* column and how a request's organization is resolved.
|
|
2241
|
+
*/
|
|
2242
|
+
readonly tenant: {
|
|
2243
|
+
readonly column: string;
|
|
2244
|
+
readonly onMissing?: "error" | "skip";
|
|
2245
|
+
readonly header?: string;
|
|
2246
|
+
} | undefined;
|
|
2247
|
+
/** `created-by`: `blocks["created-by"].options`. */
|
|
2248
|
+
readonly actor: {
|
|
2249
|
+
readonly createdBy: string;
|
|
2250
|
+
readonly updatedBy: string;
|
|
2251
|
+
readonly impersonatedBy: string;
|
|
2252
|
+
} | undefined;
|
|
2253
|
+
}
|
|
2254
|
+
//#endregion
|
|
2255
|
+
//#region src/config/types/codegen.d.ts
|
|
2256
|
+
/**
|
|
2257
|
+
* Where codegen reads the database from. Without any of these, `$DATABASE_URL`,
|
|
2258
|
+
* `$SUPABASE_DB_URL` and then the local stack (`supabase start`) are used.
|
|
2259
|
+
*/
|
|
2260
|
+
interface SourceConfig {
|
|
2261
|
+
/** Postgres connection string. */
|
|
2262
|
+
readonly dbUrl?: string;
|
|
2263
|
+
/**
|
|
2264
|
+
* Hosted project ref. Read through the Management API's read-only SQL
|
|
2265
|
+
* endpoint, so no database password is needed.
|
|
2266
|
+
*/
|
|
2267
|
+
readonly projectRef?: string;
|
|
2268
|
+
/**
|
|
2269
|
+
* Management API token for `projectRef`. Defaults to
|
|
2270
|
+
* `$SUPABASE_ACCESS_TOKEN`; prefer the env var over committing a token.
|
|
2271
|
+
*/
|
|
2272
|
+
readonly accessToken?: string;
|
|
2273
|
+
/**
|
|
2274
|
+
* Read a saved `better-supabase gen --save-snapshot` snapshot instead of
|
|
2275
|
+
* connecting.
|
|
2276
|
+
*/
|
|
2277
|
+
readonly snapshot?: string;
|
|
2278
|
+
/**
|
|
2279
|
+
* Read a Supabase Lite project's schema the way Lite runs it, from `[db]
|
|
2280
|
+
* driver` in `supabase/config.toml`. On by default when that key is present;
|
|
2281
|
+
* `false` reads the database like any other project.
|
|
2282
|
+
*/
|
|
2283
|
+
readonly lite?: boolean;
|
|
2284
|
+
}
|
|
2285
|
+
/**
|
|
2286
|
+
* A JSON Schema object, or a Standard JSON Schema value (zod 4, valibot,
|
|
2287
|
+
* arktype, ...) that can produce one.
|
|
2288
|
+
*/
|
|
2289
|
+
type JsonSchemaSource = Readonly<Record<string, unknown>> | {
|
|
2290
|
+
readonly "~standard": {
|
|
2291
|
+
readonly jsonSchema: {
|
|
2292
|
+
readonly input: (options: {
|
|
2293
|
+
readonly target: string;
|
|
2294
|
+
}) => Record<string, unknown>;
|
|
2295
|
+
};
|
|
2296
|
+
};
|
|
2297
|
+
};
|
|
2298
|
+
type JsonTypeConfig = ({
|
|
2299
|
+
readonly import: string;
|
|
2300
|
+
} | {
|
|
2301
|
+
readonly type: string;
|
|
2302
|
+
}) & {
|
|
2303
|
+
/**
|
|
2304
|
+
* Enforced in the database by `better-supabase add jsonb-schemas`
|
|
2305
|
+
* (pg_jsonschema).
|
|
2306
|
+
*/
|
|
2307
|
+
readonly schema?: JsonSchemaSource;
|
|
2308
|
+
};
|
|
2309
|
+
interface TableConfig {
|
|
2310
|
+
readonly casing?: Casing;
|
|
2311
|
+
/** Leave the table out of the generated models. */
|
|
2312
|
+
readonly exclude?: boolean;
|
|
2313
|
+
/**
|
|
2314
|
+
* Keep the table off the Data API on purpose: only `service_role` reaches it.
|
|
2315
|
+
* The models are still generated for admin clients, and doctor (BS106) checks
|
|
2316
|
+
* that `anon` and `authenticated` have no grants instead of requiring them.
|
|
2317
|
+
*/
|
|
2318
|
+
readonly serviceRole?: boolean;
|
|
2319
|
+
/** Rename generated relations: `{ primaryContact: 'contact' }`. */
|
|
2320
|
+
readonly relations?: Readonly<Record<string, string>>;
|
|
2321
|
+
/**
|
|
2322
|
+
* Database names of not-null columns an insert may leave out because the
|
|
2323
|
+
* database fills them, for example from a `before insert` trigger. `gen`
|
|
2324
|
+
* makes them optional in `InsertOf` and the insert validators.
|
|
2325
|
+
*/
|
|
2326
|
+
readonly insertOptional?: readonly string[];
|
|
2327
|
+
}
|
|
2328
|
+
interface FunctionConfig {
|
|
2329
|
+
/**
|
|
2330
|
+
* `true`, or the `returns table` columns (database names) that are never
|
|
2331
|
+
* null.
|
|
2332
|
+
*/
|
|
2333
|
+
readonly notNull?: true | readonly string[];
|
|
2334
|
+
}
|
|
2335
|
+
/** Claim names shared by the SQL modules, codegen and the runtime defaults. */
|
|
2336
|
+
interface ClaimsConfig {
|
|
2337
|
+
/** Top-level claim holding the active tenant id. Defaults to `tenant_id`. */
|
|
2338
|
+
readonly tenant?: string;
|
|
2339
|
+
/**
|
|
2340
|
+
* `scope` of the tenant entries `membership_claims()` writes. Defaults to
|
|
2341
|
+
* `tenant`.
|
|
2342
|
+
*/
|
|
2343
|
+
readonly scope?: string;
|
|
2344
|
+
/**
|
|
2345
|
+
* Claim holding plan features per tenant (`{ [tenantId]: string[] }`).
|
|
2346
|
+
* Defaults to `features`.
|
|
2347
|
+
*/
|
|
2348
|
+
readonly features?: string;
|
|
2349
|
+
/**
|
|
2350
|
+
* Claim the memberships hook (`membership_claims()` or the provider's)
|
|
2351
|
+
* writes. Defaults to `memberships`.
|
|
2352
|
+
*/
|
|
2353
|
+
readonly memberships?: string;
|
|
2354
|
+
}
|
|
2355
|
+
/**
|
|
2356
|
+
* Runtime types for columns whose JSON form loses information. Defaults match
|
|
2357
|
+
* `supabase gen types`: timestamps as ISO strings, `int8` and `numeric` as
|
|
2358
|
+
* numbers.
|
|
2359
|
+
*/
|
|
2360
|
+
interface CodecsConfig {
|
|
2361
|
+
/**
|
|
2362
|
+
* `'instant'` decodes `timestamptz` columns to `Temporal.Instant` and
|
|
2363
|
+
* `timestamp` columns to `Temporal.PlainDateTime`. `'utc'` keeps
|
|
2364
|
+
* `timestamptz` columns as strings, always in UTC as ISO 8601 with a `Z` and
|
|
2365
|
+
* every fraction digit (`2026-10-21T05:10:00.123456Z`).
|
|
2366
|
+
*/
|
|
2367
|
+
readonly timestamptz?: "string" | "instant" | "utc";
|
|
2368
|
+
/** `'bigint'` or `'string'` read `int8` exactly (above 2^53). */
|
|
2369
|
+
readonly int8?: "number" | "string" | "bigint";
|
|
2370
|
+
/** `'string'` reads `numeric` exactly. */
|
|
2371
|
+
readonly numeric?: "number" | "string";
|
|
2372
|
+
}
|
|
2373
|
+
interface GeneratedFile {
|
|
2374
|
+
/** Path relative to the project root. */
|
|
2375
|
+
readonly path: string;
|
|
2376
|
+
readonly contents: string;
|
|
2377
|
+
/**
|
|
2378
|
+
* The file exports `validators` (`TableValidators`): `gen` imports them into
|
|
2379
|
+
* the generated schema and installs `validation`, so writes are checked.
|
|
2380
|
+
*/
|
|
2381
|
+
readonly validators?: boolean;
|
|
2382
|
+
}
|
|
2383
|
+
interface GeneratorInput {
|
|
2384
|
+
readonly meta: SchemaMeta;
|
|
2385
|
+
/**
|
|
2386
|
+
* The `@supabase/postgrest-typegen` metadata for the configured schemas, the
|
|
2387
|
+
* same contract `supabase gen types` is built on.
|
|
2388
|
+
*/
|
|
2389
|
+
readonly introspection: GeneratorMetadata;
|
|
2390
|
+
/** Constraints, indexes, policies, triggers and grants typegen leaves out. */
|
|
2391
|
+
readonly extras: SnapshotExtras;
|
|
2392
|
+
readonly config: ResolvedConfig;
|
|
2393
|
+
/** Absolute path of the main generated module. */
|
|
2394
|
+
readonly output: string;
|
|
2395
|
+
/** Import path from `from` (a generated file) to `to`, with extension. */
|
|
2396
|
+
readonly importPath: (from: string, to: string) => string;
|
|
2397
|
+
/**
|
|
2398
|
+
* Where generated files import `better-supabase` runtime helpers from.
|
|
2399
|
+
* Defaults to `better-supabase`.
|
|
2400
|
+
*/
|
|
2401
|
+
readonly runtimeImport?: string;
|
|
2402
|
+
/**
|
|
2403
|
+
* The tables and enums `gen` emits, with the TypeScript type it wrote for
|
|
2404
|
+
* each column (after `json` overrides, codecs and enum unions). Frozen.
|
|
2405
|
+
*/
|
|
2406
|
+
readonly model: GeneratorModel;
|
|
2407
|
+
}
|
|
2408
|
+
interface GeneratorColumn {
|
|
2409
|
+
/** Name in rows, after casing. */
|
|
2410
|
+
readonly app: string;
|
|
2411
|
+
/** Database name. */
|
|
2412
|
+
readonly db: string;
|
|
2413
|
+
/** TypeScript type without `| null`. */
|
|
2414
|
+
readonly tsType: string;
|
|
2415
|
+
readonly nullable: boolean;
|
|
2416
|
+
/** Optional on insert. */
|
|
2417
|
+
readonly optional: boolean;
|
|
2418
|
+
/** Generated or identity always: never written. */
|
|
2419
|
+
readonly readonly: boolean;
|
|
2420
|
+
/** Enum or check-constraint values, when the column has a closed set. */
|
|
2421
|
+
readonly values: readonly string[] | undefined;
|
|
2422
|
+
readonly json: boolean;
|
|
2423
|
+
}
|
|
2424
|
+
interface GeneratorTable {
|
|
2425
|
+
/** Key in `schema.tables` and on the client. */
|
|
2426
|
+
readonly key: string;
|
|
2427
|
+
readonly schema: string;
|
|
2428
|
+
readonly name: string;
|
|
2429
|
+
readonly casing: Casing;
|
|
2430
|
+
readonly columns: readonly GeneratorColumn[];
|
|
2431
|
+
}
|
|
2432
|
+
interface GeneratorFunctionArg {
|
|
2433
|
+
readonly name: string;
|
|
2434
|
+
/** TypeScript type, as `$rpc` takes it. */
|
|
2435
|
+
readonly tsType: string;
|
|
2436
|
+
/** Has a default, so callers may leave it out. */
|
|
2437
|
+
readonly optional: boolean;
|
|
2438
|
+
/** Enum values, when the argument is an enum (or an array of one). */
|
|
2439
|
+
readonly values: readonly string[] | undefined;
|
|
2440
|
+
}
|
|
2441
|
+
/** A function `$rpc` calls, with the types `gen` wrote for it. */
|
|
2442
|
+
interface GeneratorFunction {
|
|
2443
|
+
/** Name on `$rpc`. */
|
|
2444
|
+
readonly key: string;
|
|
2445
|
+
readonly schema: string;
|
|
2446
|
+
readonly args: readonly GeneratorFunctionArg[];
|
|
2447
|
+
/** TypeScript type of the result, as `$rpc` returns it. */
|
|
2448
|
+
readonly returns: string;
|
|
2449
|
+
readonly returnsSet: boolean;
|
|
2450
|
+
readonly volatility: "immutable" | "stable" | "volatile";
|
|
2451
|
+
}
|
|
2452
|
+
/** JSON Schema (draft 2020-12) for one value. */
|
|
2453
|
+
type GeneratorJsonSchema = Readonly<Record<string, unknown>>;
|
|
2454
|
+
/**
|
|
2455
|
+
* One field of a block input schema: its scalar kind with the flags and bounds
|
|
2456
|
+
* `entitySchema` takes. It never carries a nested `schema`.
|
|
2457
|
+
*/
|
|
2458
|
+
type GeneratorField = FieldSpec;
|
|
2459
|
+
/** One of a block's input schemas, in the block's default names. */
|
|
2460
|
+
interface GeneratorInputSchema {
|
|
2461
|
+
/** The type it validates (`WorkItemInput`). */
|
|
2462
|
+
readonly title: string;
|
|
2463
|
+
readonly fields: Readonly<Record<string, GeneratorField>>;
|
|
2464
|
+
/** The same schema as JSON Schema (draft 2020-12), in its wire form. */
|
|
2465
|
+
readonly jsonSchema: GeneratorJsonSchema;
|
|
2466
|
+
}
|
|
2467
|
+
/**
|
|
2468
|
+
* The inputs a block's client takes for one entity. Each is absent when the
|
|
2469
|
+
* block declares none.
|
|
2470
|
+
*/
|
|
2471
|
+
interface GeneratorEntitySchemas {
|
|
2472
|
+
/** What creating one takes (`WorkItemInput`). */
|
|
2473
|
+
readonly input?: GeneratorInputSchema;
|
|
2474
|
+
/** What updating one takes (`WorkItemChange`). */
|
|
2475
|
+
readonly change?: GeneratorInputSchema;
|
|
2476
|
+
/** What listing them takes (`WorkItemListOptions`). */
|
|
2477
|
+
readonly listFilter?: GeneratorInputSchema;
|
|
2478
|
+
}
|
|
2479
|
+
interface GeneratorNoun {
|
|
2480
|
+
readonly singular: string;
|
|
2481
|
+
readonly plural: string;
|
|
2482
|
+
}
|
|
2483
|
+
/** One of an installed block's entities, under the name the config gives it. */
|
|
2484
|
+
interface GeneratorBlockEntity {
|
|
2485
|
+
/** The entity's key in the block's manifest: its default singular noun. */
|
|
2486
|
+
readonly key: string;
|
|
2487
|
+
/** The block's own noun (`work_item`). */
|
|
2488
|
+
readonly from: GeneratorNoun;
|
|
2489
|
+
/** The noun `blocks.<name>.names` gives it (`task`). */
|
|
2490
|
+
readonly to: GeneratorNoun;
|
|
2491
|
+
readonly primary: boolean;
|
|
2492
|
+
/** The table that holds it, as the SQL names it; undefined when none. */
|
|
2493
|
+
readonly table: string | undefined;
|
|
2494
|
+
/** `blocks.<name>.names.<entity>.url`, with column placeholders. */
|
|
2495
|
+
readonly url: string | undefined;
|
|
2496
|
+
readonly schemas: GeneratorEntitySchemas;
|
|
2497
|
+
}
|
|
2498
|
+
/** An installed block, with its final names. */
|
|
2499
|
+
interface GeneratorBlock {
|
|
2500
|
+
readonly name: string;
|
|
2501
|
+
/** The schema its tables and functions live in. */
|
|
2502
|
+
readonly schema: string;
|
|
2503
|
+
/**
|
|
2504
|
+
* The block's client in `blocks.generated.ts` (`tasksBlock`) and the subpath
|
|
2505
|
+
* its default export comes from, or undefined for blocks with only SQL.
|
|
2506
|
+
*/
|
|
2507
|
+
readonly client: {
|
|
2508
|
+
readonly export: string;
|
|
2509
|
+
readonly subpath: string;
|
|
2510
|
+
} | undefined;
|
|
2511
|
+
readonly entities: readonly GeneratorBlockEntity[];
|
|
2512
|
+
}
|
|
2513
|
+
interface GeneratorModel {
|
|
2514
|
+
readonly tables: readonly GeneratorTable[];
|
|
2515
|
+
readonly enums: readonly {
|
|
2516
|
+
readonly schema: string;
|
|
2517
|
+
readonly name: string;
|
|
2518
|
+
readonly values: readonly string[];
|
|
2519
|
+
}[];
|
|
2520
|
+
/** The functions `$rpc` calls, one entry per overload. */
|
|
2521
|
+
readonly functions: readonly GeneratorFunction[];
|
|
2522
|
+
/** The installed blocks, in config order. */
|
|
2523
|
+
readonly blocks: readonly GeneratorBlock[];
|
|
2524
|
+
}
|
|
2525
|
+
/**
|
|
2526
|
+
* Codegen extension point. First-party generators: `zod()`, `valibot()`,
|
|
2527
|
+
* `jsonSchema()`, `standardSchema()`. Prove custom ones with `testGenerator`.
|
|
2528
|
+
*/
|
|
2529
|
+
interface Generator {
|
|
2530
|
+
/** The generator contract it targets. `gen` refuses versions it doesn't know. */
|
|
2531
|
+
readonly apiVersion?: 1;
|
|
2532
|
+
readonly name: string;
|
|
2533
|
+
generate(input: GeneratorInput): readonly GeneratedFile[] | Promise<readonly GeneratedFile[]>;
|
|
2534
|
+
}
|
|
2535
|
+
interface RelationsConfig {
|
|
2536
|
+
/**
|
|
2537
|
+
* Type a to-one include as `| null` when the related table has row level
|
|
2538
|
+
* security, even over a `not null` foreign key, since a policy can hide the
|
|
2539
|
+
* related row. `required: true` on the include keeps it non-null. Defaults to
|
|
2540
|
+
* `false`.
|
|
2541
|
+
*/
|
|
2542
|
+
readonly nullableUnderRls?: boolean;
|
|
2543
|
+
}
|
|
2544
|
+
//#endregion
|
|
2545
|
+
//#region src/config/json.d.ts
|
|
2546
|
+
/**
|
|
2547
|
+
* The JSON Schema document for a `json[...].schema` entry. A Standard Schema
|
|
2548
|
+
* converts for `target` (2020-12 by default); a JSON Schema object is returned
|
|
2549
|
+
* as it is.
|
|
2550
|
+
*/
|
|
2551
|
+
declare function resolveJsonSchema(source: JsonSchemaSource, target?: "draft-2020-12" | "draft-07" | "openapi-3.0"): Readonly<Record<string, unknown>>;
|
|
2552
|
+
//#endregion
|
|
2553
|
+
//#region src/preset/resolve.d.ts
|
|
2554
|
+
/** One block in a resolved preset, with why it is there. */
|
|
2555
|
+
interface ResolvedPresetBlock {
|
|
2556
|
+
readonly name: string;
|
|
2557
|
+
readonly title: string;
|
|
2558
|
+
readonly category: BlockCategory;
|
|
2559
|
+
/** Whether the preset names it, rather than another block requiring it. */
|
|
2560
|
+
readonly selected: boolean;
|
|
2561
|
+
/** The blocks in the set that require it. */
|
|
2562
|
+
readonly requiredBy: readonly string[];
|
|
2563
|
+
/** "selected", or "required by comments and tags". */
|
|
2564
|
+
readonly reason: string;
|
|
2565
|
+
}
|
|
2566
|
+
/** A soft integration between two blocks that are both in the set. */
|
|
2567
|
+
interface PresetIntegration {
|
|
2568
|
+
/** The block that works with `to`. */
|
|
2569
|
+
readonly from: string;
|
|
2570
|
+
readonly to: string;
|
|
2571
|
+
}
|
|
2572
|
+
/** Something in the preset that can't install, and why. */
|
|
2573
|
+
interface PresetConflict {
|
|
2574
|
+
readonly block?: string;
|
|
2575
|
+
readonly field?: PresetFieldKey;
|
|
2576
|
+
readonly reason: string;
|
|
2577
|
+
}
|
|
2578
|
+
/** What `resolvePreset` returns. */
|
|
2579
|
+
interface ResolvedPreset {
|
|
2580
|
+
readonly preset: Preset;
|
|
2581
|
+
/** Every block to install, in install order; conflicting blocks are left out. */
|
|
2582
|
+
readonly blocks: readonly ResolvedPresetBlock[];
|
|
2583
|
+
/** The soft integrations active between blocks in the set. */
|
|
2584
|
+
readonly integrations: readonly PresetIntegration[];
|
|
2585
|
+
readonly conflicts: readonly PresetConflict[];
|
|
2586
|
+
/** The manifests that cover `blocks`, for `lib/blocks.ts`. */
|
|
2587
|
+
readonly manifests: readonly PresetCatalogManifest[];
|
|
2588
|
+
}
|
|
2589
|
+
/** "a", "a and b", "a, b and c". */
|
|
2590
|
+
declare function listNames(names: readonly string[]): string;
|
|
2591
|
+
/**
|
|
2592
|
+
* Why `name` can't install with the preset's conventions, or undefined.
|
|
2593
|
+
* `/create` disables a block with this reason before it is selected.
|
|
2594
|
+
*/
|
|
2595
|
+
declare function presetBlockConflict(preset: Pick<Preset, "access" | "scope">, name: string, catalog?: PresetCatalog): string | undefined;
|
|
2596
|
+
/**
|
|
2597
|
+
* The full block set for a preset: the selected blocks and what they require, a
|
|
2598
|
+
* reason per block, the soft integrations active between them, and what can't
|
|
2599
|
+
* install. It reads the generated catalog, never the SQL renderers, so it runs
|
|
2600
|
+
* in the browser.
|
|
2601
|
+
*/
|
|
2602
|
+
declare function resolvePreset(preset: Preset, catalog?: PresetCatalog): ResolvedPreset;
|
|
2603
|
+
//#endregion
|
|
2604
|
+
//#region src/preset/config.d.ts
|
|
2605
|
+
/** A named preset, a `/create?preset=` URL, or a preset object. */
|
|
2606
|
+
type PresetInput = string | (Partial<Preset> & {
|
|
2607
|
+
readonly blocks?: readonly string[];
|
|
2608
|
+
});
|
|
2609
|
+
/**
|
|
2610
|
+
* Reads a named preset, a `/create?preset=<name>` URL or a preset object
|
|
2611
|
+
* (`PresetSpec`) into a `Preset`. A preset code from 0.14 throws, naming the
|
|
2612
|
+
* codemod that converts it.
|
|
2613
|
+
*/
|
|
2614
|
+
declare function presetOf(input: PresetInput): Preset;
|
|
2615
|
+
/**
|
|
2616
|
+
* The conventions that map onto config keys; `tenantName` takes any name
|
|
2617
|
+
* `blocks.memberships.names.organization` allows.
|
|
2618
|
+
*/
|
|
2619
|
+
type ConfigConventions = Pick<Preset, "casing" | "idType" | "scope" | "access" | "api"> & {
|
|
2620
|
+
readonly tenantName: string;
|
|
2621
|
+
};
|
|
2622
|
+
/**
|
|
2623
|
+
* The config keys conventions set without a preset: `casing`, `sql`,
|
|
2624
|
+
* `blocks.permissions` when the access model or id type differ from the
|
|
2625
|
+
* defaults, and `blocks.memberships` when the tenant has another name.
|
|
2626
|
+
*/
|
|
2627
|
+
declare function conventionConfig(conventions: ConfigConventions): Pick<FlatConfig, "casing" | "sql"> & {
|
|
2628
|
+
readonly blocks?: {
|
|
2629
|
+
readonly permissions?: AccessBlockConfig;
|
|
2630
|
+
readonly memberships?: BlockConfig;
|
|
2631
|
+
};
|
|
2632
|
+
};
|
|
2633
|
+
/**
|
|
2634
|
+
* The config keys a resolved preset sets: its blocks and the conventions that
|
|
2635
|
+
* differ from the defaults.
|
|
2636
|
+
*/
|
|
2637
|
+
declare function presetConfig(resolved: ResolvedPreset): Pick<FlatConfig, "casing" | "sql" | "integrations"> & {
|
|
2638
|
+
readonly blocks: BlocksConfig;
|
|
2639
|
+
};
|
|
2640
|
+
/**
|
|
2641
|
+
* A literal config after `defineConfig`: the same type without a preset, and
|
|
2642
|
+
* with one, every key but `blocks`, `database`, `gen` and `adapters` as
|
|
2643
|
+
* written, those merged with the preset's.
|
|
2644
|
+
*/
|
|
2645
|
+
type ExpandedConfig<C extends BetterSupabaseConfig> = C extends {
|
|
2646
|
+
readonly preset: NonNullable<BetterSupabaseConfig["preset"]>;
|
|
2647
|
+
} ? Omit<C, "blocks" | "database" | "gen" | "adapters"> & Pick<BetterSupabaseConfig, "blocks" | "database" | "gen" | "adapters"> : C;
|
|
2648
|
+
/**
|
|
2649
|
+
* `config` with its `preset` expanded: the preset's blocks (and what they
|
|
2650
|
+
* require) and conventions first, then the config's own keys over them, so
|
|
2651
|
+
* explicit config wins. A block in both keeps the preset's settings that the
|
|
2652
|
+
* config's entry leaves unset. Expanding twice gives the same config.
|
|
2653
|
+
*/
|
|
2654
|
+
declare function expandPreset<const C extends BetterSupabaseConfig>(config: C): ExpandedConfig<C>;
|
|
2655
|
+
//#endregion
|
|
2656
|
+
//#region src/config/references.d.ts
|
|
2657
|
+
/**
|
|
2658
|
+
* A logical table of a block the registry knows, as `tables` columns reference
|
|
2659
|
+
* it: `{ block: "tasks", table: "items" }`.
|
|
2660
|
+
*/
|
|
2661
|
+
type BlockTableReference = { readonly [M in keyof BlockNameRegistry]: {
|
|
2662
|
+
readonly block: M;
|
|
2663
|
+
readonly table: TablesOf<M>;
|
|
2664
|
+
}; }[keyof BlockNameRegistry];
|
|
2665
|
+
type AppTablesOf<C> = C extends {
|
|
2666
|
+
readonly tables: infer T extends object;
|
|
2667
|
+
} ? T : Record<never, never>;
|
|
2668
|
+
/** The app tables a literal config declares, or `string` without any. */
|
|
2669
|
+
type AppTableNames<C> = [keyof AppTablesOf<C>] extends [never] ? string : (keyof AppTablesOf<C> & string) | "auth.users";
|
|
2670
|
+
/** What a column of `C`'s app tables may reference. */
|
|
2671
|
+
type TypedReference<C> = ({
|
|
2672
|
+
readonly table: AppTableNames<C>;
|
|
2673
|
+
} | BlockTableReference) & {
|
|
2674
|
+
readonly onDelete?: AppOnDeleteAction;
|
|
2675
|
+
};
|
|
2676
|
+
type ColumnsOfTable<T> = T extends {
|
|
2677
|
+
readonly columns: infer K extends object;
|
|
2678
|
+
} ? K : Record<never, never>;
|
|
2679
|
+
type AppTableReferences<C> = { readonly [T in keyof AppTablesOf<C>]?: {
|
|
2680
|
+
readonly columns?: { readonly [K in keyof ColumnsOfTable<AppTablesOf<C>[T]>]?: ColumnsOfTable<AppTablesOf<C>[T]>[K] extends {
|
|
2681
|
+
readonly references: unknown;
|
|
2682
|
+
} ? {
|
|
2683
|
+
readonly references?: TypedReference<C>;
|
|
2684
|
+
} : unknown; };
|
|
2685
|
+
}; };
|
|
2686
|
+
type RolesOf<C> = C extends {
|
|
2687
|
+
readonly blocks: {
|
|
2688
|
+
readonly permissions: {
|
|
2689
|
+
readonly roles: infer R extends object;
|
|
2690
|
+
};
|
|
2691
|
+
};
|
|
2692
|
+
} ? keyof R & string : never;
|
|
2693
|
+
/**
|
|
2694
|
+
* The roles `blocks.permissions.roles` declares, or `string` when the config
|
|
2695
|
+
* leaves them to the default list or another access model.
|
|
2696
|
+
*/
|
|
2697
|
+
type RoleNames<C> = [RolesOf<C>] extends [never] ? string : RolesOf<C>;
|
|
2698
|
+
type BucketsOf<C> = C extends {
|
|
2699
|
+
readonly database: {
|
|
2700
|
+
readonly buckets: infer B extends object;
|
|
2701
|
+
};
|
|
2702
|
+
} ? keyof B & string : never;
|
|
2703
|
+
/**
|
|
2704
|
+
* A bucket `gen.storagePaths` names: a `database.buckets` key, suggested first,
|
|
2705
|
+
* or the id of a bucket the config doesn't declare.
|
|
2706
|
+
*/
|
|
2707
|
+
type BucketName<C> = BucketsOf<C> | (string & {});
|
|
2708
|
+
type RoleReferences<C> = [RolesOf<C>] extends [never] ? unknown : {
|
|
2709
|
+
readonly blocks?: {
|
|
2710
|
+
readonly sso?: {
|
|
2711
|
+
readonly options?: {
|
|
2712
|
+
readonly defaultRole?: RoleNames<C>;
|
|
2713
|
+
readonly roleOrder?: readonly RoleNames<C>[];
|
|
2714
|
+
};
|
|
2715
|
+
};
|
|
2716
|
+
readonly billing?: {
|
|
2717
|
+
readonly options?: {
|
|
2718
|
+
readonly seatRoles?: readonly RoleNames<C>[];
|
|
2719
|
+
};
|
|
2720
|
+
};
|
|
2721
|
+
};
|
|
2722
|
+
};
|
|
2723
|
+
type BlocksOf<C> = C extends {
|
|
2724
|
+
readonly blocks: infer B extends object;
|
|
2725
|
+
} ? B extends readonly string[] ? Record<never, never> : B : Record<never, never>;
|
|
2726
|
+
/** The instance keys a literal config declares in `blocks`. */
|
|
2727
|
+
type InstanceNames<C> = keyof BlocksOf<C> & string;
|
|
2728
|
+
/**
|
|
2729
|
+
* Each named instance checked against the block it names in `block`, and every
|
|
2730
|
+
* `uses` value against the config's instances.
|
|
2731
|
+
*/
|
|
2732
|
+
type InstanceReferences<C> = {
|
|
2733
|
+
readonly blocks?: { readonly [K in keyof BlocksOf<C>]?: (BlocksOf<C>[K] extends {
|
|
2734
|
+
readonly block: infer B extends BlockName;
|
|
2735
|
+
} ? BlockInput<BlockConfigOf<B>> : unknown) & {
|
|
2736
|
+
readonly on?: InstanceOn;
|
|
2737
|
+
readonly uses?: Readonly<Record<string, InstanceNames<C>>>;
|
|
2738
|
+
}; };
|
|
2739
|
+
};
|
|
2740
|
+
/**
|
|
2741
|
+
* What `defineConfig` checks a literal config against: block tables in `tables`
|
|
2742
|
+
* references, app table names, bucket names in `gen.storagePaths`, the role
|
|
2743
|
+
* names other blocks take from `blocks.permissions.roles`, and each named
|
|
2744
|
+
* instance's options and `uses`.
|
|
2745
|
+
*/
|
|
2746
|
+
type ConfigReferences<C> = {
|
|
2747
|
+
readonly tables?: AppTableReferences<C>;
|
|
2748
|
+
readonly gen?: {
|
|
2749
|
+
readonly storagePaths?: Readonly<Record<string, BucketName<C>>>;
|
|
2750
|
+
};
|
|
2751
|
+
} & RoleReferences<C> & InstanceReferences<C>;
|
|
2752
|
+
//#endregion
|
|
2753
|
+
//#region src/config/resolve.d.ts
|
|
2754
|
+
declare const CONFIG_SCHEMA_URL = "https://unpkg.com/better-supabase/schemas/config-v1.json";
|
|
2755
|
+
/**
|
|
2756
|
+
* Types `better-supabase.config.ts` and returns it with its literal types. With
|
|
2757
|
+
* `preset`, it expands the preset into `blocks` and its conventions first, and
|
|
2758
|
+
* the keys you set win. It checks the references between keys against the
|
|
2759
|
+
* config itself: block tables and app tables in `tables` references, the
|
|
2760
|
+
* `database.buckets` in `gen.storagePaths`, and the `blocks.permissions.roles`
|
|
2761
|
+
* other blocks name.
|
|
2762
|
+
*/
|
|
2763
|
+
declare function defineConfig<const C extends BetterSupabaseConfig>(config: C & NoInfer<ConfigReferences<C>>): ExpandedConfig<C>;
|
|
2764
|
+
/** Applies defaults. Paths stay relative to `root`. */
|
|
2765
|
+
declare function resolveConfig(input: BetterSupabaseConfig, root: string): ResolvedConfig;
|
|
2766
|
+
//#endregion
|
|
2767
|
+
//#region src/config/groups.d.ts
|
|
2768
|
+
type Entries = Record<string, unknown>;
|
|
2769
|
+
type Pairs = readonly (readonly [grouped: string, flat: string])[];
|
|
2770
|
+
/** The flat keys each group holds. `gen` and `auth` also keep their own keys. */
|
|
2771
|
+
declare const CONFIG_GROUPS: Readonly<Record<string, readonly string[]>>;
|
|
2772
|
+
/** Top-level keys renamed by the regrouping: the grouped name, then the flat. */
|
|
2773
|
+
declare const RENAMED_CONFIG_KEYS: Pairs;
|
|
2774
|
+
/** Keys renamed inside `blocks.<name>`: the grouped name, then the flat. */
|
|
2775
|
+
declare const RENAMED_BLOCK_KEYS: Pairs;
|
|
2776
|
+
/** A resolved block entry with the key names a config file writes. */
|
|
2777
|
+
declare function blockEntrySource(entry: object): Entries;
|
|
2778
|
+
/**
|
|
2779
|
+
* The grouped config in the flat shape `resolveConfig` reads: every group's
|
|
2780
|
+
* keys at the top level, `records`, `tables` and `adapters` under their flat
|
|
2781
|
+
* names, `auth.organization` as `claims.tenant` and `organization`, and the
|
|
2782
|
+
* renamed block and app table keys under their flat names.
|
|
2783
|
+
*/
|
|
2784
|
+
declare function flattenConfig(config: BetterSupabaseConfig): FlatConfig;
|
|
2785
|
+
/**
|
|
2786
|
+
* Whether a top-level `tables` is the generator overrides of a config written
|
|
2787
|
+
* before 0.15 rather than the app tables of a grouped one.
|
|
2788
|
+
*/
|
|
2789
|
+
declare function hasFlatTables(keys: readonly string[]): boolean;
|
|
2790
|
+
/** A flat config in the grouped shape: the inverse of `flattenConfig`. */
|
|
2791
|
+
declare function groupConfig(config: FlatConfig): BetterSupabaseConfig;
|
|
2792
|
+
/**
|
|
2793
|
+
* Any object with the keys of a config written before 0.15, grouped: the keys
|
|
2794
|
+
* it doesn't know stay where they are. `$env` blocks are grouped the same way.
|
|
2795
|
+
* The 0.15 codemod uses it for JSON configs.
|
|
2796
|
+
*/
|
|
2797
|
+
declare function groupEntries(config: object): Entries;
|
|
2798
|
+
//#endregion
|
|
2799
|
+
//#region src/config/block-subjects.d.ts
|
|
2800
|
+
/**
|
|
2801
|
+
* The entities `blocks.<module>.names` gives a new name, such as `work_item` to
|
|
2802
|
+
* `task`, for the block's TypeScript client (`blocks.generated.ts`). Empty when
|
|
2803
|
+
* the module renames none.
|
|
2804
|
+
*/
|
|
2805
|
+
declare function blockEntityRenames(module: string, blocks: AnyBlocksConfig): readonly EntityRename[];
|
|
2806
|
+
/** One installed block's entity under the name the config gives it. */
|
|
2807
|
+
interface BlockEntity {
|
|
2808
|
+
/** The entity's key in the block's manifest: its default singular noun. */
|
|
2809
|
+
readonly key: string;
|
|
2810
|
+
readonly from: EntityNoun;
|
|
2811
|
+
readonly to: EntityNoun;
|
|
2812
|
+
readonly primary: boolean;
|
|
2813
|
+
/**
|
|
2814
|
+
* The table that holds it as the SQL writes it (`tasks`, or the
|
|
2815
|
+
* `blocks.<name>.tables` mapping), or undefined when it has none.
|
|
2816
|
+
*/
|
|
2817
|
+
readonly table: string | undefined;
|
|
2818
|
+
/** `blocks.<name>.names.<entity>.url`, with column placeholders. */
|
|
2819
|
+
readonly url: string | undefined;
|
|
2820
|
+
}
|
|
2821
|
+
/** The entities one installed block declares, with their final names. */
|
|
2822
|
+
declare function blockEntities(module: string, blocks: AnyBlocksConfig): readonly BlockEntity[];
|
|
2823
|
+
/**
|
|
2824
|
+
* The entities of every installed block that registers one (work items, deals,
|
|
2825
|
+
* companies and people, products, employees), under their renamed type, then
|
|
2826
|
+
* `subjects`. Throws when `subjects` already has a block's type.
|
|
2827
|
+
*/
|
|
2828
|
+
/** The subject types one installed block registers, by renamed entity. */
|
|
2829
|
+
declare function blockSubjectTypes(module: string, blocks: AnyBlocksConfig): readonly string[];
|
|
2830
|
+
//#endregion
|
|
2831
|
+
//#region src/core/claims.d.ts
|
|
2832
|
+
declare const DEFAULT_CLAIMS: ClaimsMeta;
|
|
2833
|
+
/**
|
|
2834
|
+
* Where an adapter reads each claim the SQL modules and the provider's hook
|
|
2835
|
+
* write.
|
|
2836
|
+
*/
|
|
2837
|
+
interface ClaimPaths {
|
|
2838
|
+
/**
|
|
2839
|
+
* The active tenant: the top-level claim, then the same key in
|
|
2840
|
+
* `app_metadata`.
|
|
2841
|
+
*/
|
|
2842
|
+
readonly tenant: readonly [string, string];
|
|
2843
|
+
/** `{ [tenantId]: string[] }` of plan features. */
|
|
2844
|
+
readonly features: string;
|
|
2845
|
+
/**
|
|
2846
|
+
* The caller's memberships, a list of `{ scope, id, roles }` or a map of
|
|
2847
|
+
* tenant id to role.
|
|
2848
|
+
*/
|
|
2849
|
+
readonly memberships: string;
|
|
2850
|
+
/** The `scope` of tenant entries in the memberships list. */
|
|
2851
|
+
readonly scope: string;
|
|
2852
|
+
}
|
|
2853
|
+
/**
|
|
2854
|
+
* The claim paths for `config.claims`, with defaults. For a generated schema,
|
|
2855
|
+
* pass `claimsOf(meta)`.
|
|
2856
|
+
*/
|
|
2857
|
+
declare function claimPaths(claims?: Partial<ClaimsMeta>): ClaimPaths;
|
|
2858
|
+
/**
|
|
2859
|
+
* Where the active tenant is read from: the top-level claim, then
|
|
2860
|
+
* `app_metadata`.
|
|
2861
|
+
*/
|
|
2862
|
+
declare function tenantClaimPaths(tenant?: string): readonly [string, string];
|
|
2863
|
+
//#endregion
|
|
2864
|
+
//#region src/generators/extras.d.ts
|
|
2865
|
+
/** A schema for a function's arguments or one of a block's inputs. */
|
|
2866
|
+
interface ExtraSchema {
|
|
2867
|
+
/** Export name: `listTasksArgs`, `taskInput`. */
|
|
2868
|
+
readonly name: string;
|
|
2869
|
+
readonly title: string;
|
|
2870
|
+
readonly description?: string;
|
|
2871
|
+
readonly fields: Readonly<Record<string, FieldSpec>>;
|
|
2872
|
+
}
|
|
2873
|
+
/** What a function returns, when it is a table row or a scalar. */
|
|
2874
|
+
interface ResultSchema {
|
|
2875
|
+
/** Export name: `listTasksResult`. */
|
|
2876
|
+
readonly name: string;
|
|
2877
|
+
readonly title: string;
|
|
2878
|
+
/** The function returns a set: the schema is an array. */
|
|
2879
|
+
readonly set: boolean;
|
|
2880
|
+
/** A single result may be `null`; for sets, each scalar item may be. */
|
|
2881
|
+
readonly nullable: boolean;
|
|
2882
|
+
readonly of: {
|
|
2883
|
+
readonly kind: "row";
|
|
2884
|
+
readonly table: string;
|
|
2885
|
+
} | {
|
|
2886
|
+
readonly kind: "scalar";
|
|
2887
|
+
readonly scalar: ScalarKind;
|
|
2888
|
+
};
|
|
2889
|
+
}
|
|
2890
|
+
interface ExtraSchemas {
|
|
2891
|
+
readonly inputs: readonly ExtraSchema[];
|
|
2892
|
+
readonly results: readonly ResultSchema[];
|
|
2893
|
+
}
|
|
2894
|
+
//#endregion
|
|
2895
|
+
//#region src/generators/json-schema-target.d.ts
|
|
2896
|
+
/** The JSON Schema dialects the generators and MCP emit. */
|
|
2897
|
+
type JsonSchemaTarget = "draft-2020-12" | "draft-07" | "openapi-3.0";
|
|
2898
|
+
//#endregion
|
|
2899
|
+
//#region src/generators/shared.d.ts
|
|
2900
|
+
/** What field planning reads: the metadata and the typed-jsonb config. */
|
|
2901
|
+
interface SchemaSource {
|
|
2902
|
+
readonly meta: SchemaMeta;
|
|
2903
|
+
readonly config: {
|
|
2904
|
+
readonly json: Readonly<Record<string, unknown>>;
|
|
2905
|
+
};
|
|
2906
|
+
readonly runtimeImport?: string;
|
|
2907
|
+
}
|
|
2908
|
+
interface CommentEntry {
|
|
2909
|
+
readonly id: number;
|
|
2910
|
+
readonly schema: string;
|
|
2911
|
+
readonly name: string;
|
|
2912
|
+
readonly comment: string | null;
|
|
2913
|
+
}
|
|
2914
|
+
/**
|
|
2915
|
+
* The catalog parts docs read: `GeneratorInput` satisfies it. Runtime callers
|
|
2916
|
+
* that only have `meta` (OpenAPI, MCP) pass none and get no docs.
|
|
2917
|
+
*/
|
|
2918
|
+
interface DocsSource extends SchemaSource {
|
|
2919
|
+
readonly introspection?: {
|
|
2920
|
+
readonly tables: readonly CommentEntry[];
|
|
2921
|
+
readonly views: readonly CommentEntry[];
|
|
2922
|
+
readonly materializedViews?: readonly CommentEntry[];
|
|
2923
|
+
readonly columns: readonly {
|
|
2924
|
+
readonly table_id: number;
|
|
2925
|
+
readonly name: string;
|
|
2926
|
+
readonly comment: string | null;
|
|
2927
|
+
readonly check: string | null;
|
|
2928
|
+
}[];
|
|
2929
|
+
};
|
|
2930
|
+
readonly extras?: {
|
|
2931
|
+
readonly tables: readonly {
|
|
2932
|
+
readonly schema: string;
|
|
2933
|
+
readonly name: string;
|
|
2934
|
+
readonly checks: readonly {
|
|
2935
|
+
readonly definition: string;
|
|
2936
|
+
}[];
|
|
2937
|
+
}[];
|
|
2938
|
+
};
|
|
2939
|
+
}
|
|
2940
|
+
//#endregion
|
|
2941
|
+
//#region src/generators/json-schema.d.ts
|
|
2942
|
+
interface JsonSchemaGeneratorOptions {
|
|
2943
|
+
/**
|
|
2944
|
+
* Output path relative to the project root. Defaults to
|
|
2945
|
+
* `<output>.schema.json`.
|
|
2946
|
+
*/
|
|
2947
|
+
readonly output?: string;
|
|
2948
|
+
/** `$id` of the document. */
|
|
2949
|
+
readonly id?: string;
|
|
2950
|
+
/**
|
|
2951
|
+
* The dialect. `draft-2020-12` (the default) writes `$defs`; `draft-07` and
|
|
2952
|
+
* `openapi-3.0` (`nullable`, `example`) write `definitions`.
|
|
2953
|
+
*/
|
|
2954
|
+
readonly target?: JsonSchemaTarget;
|
|
2955
|
+
/**
|
|
2956
|
+
* Give each writable field a `title` label (from a short column comment or
|
|
2957
|
+
* its name), for form builders that read JSON Schema.
|
|
2958
|
+
*/
|
|
2959
|
+
readonly fieldMeta?: boolean;
|
|
2960
|
+
}
|
|
2961
|
+
type JsonSchema = Record<string, unknown>;
|
|
2962
|
+
/**
|
|
2963
|
+
* JSON Schema `$defs` for every table: `customersRow`, `customersInsert`, ...
|
|
2964
|
+
* `target` lowers the document to draft-07 or the OpenAPI 3.0 dialect, which
|
|
2965
|
+
* keep the schemas under `definitions`.
|
|
2966
|
+
*/
|
|
2967
|
+
declare function buildJsonSchema(input: DocsSource, id?: string, target?: JsonSchemaTarget, extras?: ExtraSchemas): JsonSchema;
|
|
2968
|
+
/** Writes the JSON Schema document; `createOpenApi` reuses the same `$defs`. */
|
|
2969
|
+
declare function jsonSchema(options?: JsonSchemaGeneratorOptions): Generator;
|
|
2970
|
+
//#endregion
|
|
2971
|
+
//#region src/generators/factories.d.ts
|
|
2972
|
+
interface FactoriesGeneratorOptions {
|
|
2973
|
+
/**
|
|
2974
|
+
* Output path relative to the project root. Defaults to
|
|
2975
|
+
* `<output>.factories.ts`.
|
|
2976
|
+
*/
|
|
2977
|
+
readonly output?: string;
|
|
2978
|
+
/**
|
|
2979
|
+
* The table keys to write factories for. Defaults to every table, block
|
|
2980
|
+
* tables included under their final names.
|
|
2981
|
+
*/
|
|
2982
|
+
readonly tables?: readonly string[];
|
|
2983
|
+
/**
|
|
2984
|
+
* Where the file imports the factory runtime from. Defaults to
|
|
2985
|
+
* `better-supabase/testing` (under `runtimeImport`).
|
|
2986
|
+
*/
|
|
2987
|
+
readonly testingImport?: string;
|
|
2988
|
+
}
|
|
2989
|
+
/**
|
|
2990
|
+
* Test factories, one per table: `factories.customers({ name })` returns an
|
|
2991
|
+
* insert row with valid defaults for the required columns. Defaults respect
|
|
2992
|
+
* enums, check-constraint bounds and `StoragePath` buckets. A foreign key takes
|
|
2993
|
+
* the parent row or its id, and a column without a safe default is a required
|
|
2994
|
+
* input. Block entities also get a factory under their singular noun
|
|
2995
|
+
* (`factories.task`). The file imports `better-supabase/testing`.
|
|
2996
|
+
*/
|
|
2997
|
+
declare function factories(options?: FactoriesGeneratorOptions): Generator;
|
|
2998
|
+
//#endregion
|
|
2999
|
+
//#region src/generators/nuqs.d.ts
|
|
3000
|
+
interface NuqsGeneratorOptions {
|
|
3001
|
+
/** Output path relative to the project root. Defaults to `<output>.nuqs.ts`. */
|
|
3002
|
+
readonly output?: string;
|
|
3003
|
+
/**
|
|
3004
|
+
* The table keys to write search params for (`tasks`, `customerTags`).
|
|
3005
|
+
* Defaults to every table, block tables included under their final names.
|
|
3006
|
+
*/
|
|
3007
|
+
readonly tables?: readonly string[];
|
|
3008
|
+
/** The page size `limit` defaults to. Defaults to 25. */
|
|
3009
|
+
readonly limit?: number;
|
|
3010
|
+
}
|
|
3011
|
+
/**
|
|
3012
|
+
* Search-param parsers for nuqs, one set per table list: a filter for every
|
|
3013
|
+
* column with a closed set of values, `orderBy` over the sortable columns,
|
|
3014
|
+
* `direction`, `cursor` and `limit`, with a cache, a loader and a serializer.
|
|
3015
|
+
* The file imports `nuqs/server`, which the app installs.
|
|
3016
|
+
*/
|
|
3017
|
+
declare function nuqs(options?: NuqsGeneratorOptions): Generator;
|
|
3018
|
+
//#endregion
|
|
3019
|
+
//#region src/generators/standard-schema.d.ts
|
|
3020
|
+
interface StandardSchemaGeneratorOptions {
|
|
3021
|
+
/**
|
|
3022
|
+
* Output path relative to the project root. Defaults to
|
|
3023
|
+
* `<output>.standard.ts`.
|
|
3024
|
+
*/
|
|
3025
|
+
readonly output?: string;
|
|
3026
|
+
/**
|
|
3027
|
+
* Standard Schemas for typed jsonb columns: `{ 'customers.metadata':
|
|
3028
|
+
* './schemas.ts#metadata' }`.
|
|
3029
|
+
*/
|
|
3030
|
+
readonly json?: Readonly<Record<string, string>>;
|
|
3031
|
+
/**
|
|
3032
|
+
* Also export `fieldMeta`: a label, a required flag, enum options and bounds
|
|
3033
|
+
* for each writable field, for building forms.
|
|
3034
|
+
*/
|
|
3035
|
+
readonly fieldMeta?: boolean;
|
|
3036
|
+
}
|
|
3037
|
+
/**
|
|
3038
|
+
* Standard Schemas for every table's Row, Insert and Update shape, with no
|
|
3039
|
+
* validation library. Each one also converts to JSON Schema (Standard JSON
|
|
3040
|
+
* Schema), and `validators` is what the generated schema checks writes with.
|
|
3041
|
+
*/
|
|
3042
|
+
declare function standardSchema(options?: StandardSchemaGeneratorOptions): Generator;
|
|
3043
|
+
//#endregion
|
|
3044
|
+
//#region src/generators/valibot.d.ts
|
|
3045
|
+
interface ValibotGeneratorOptions {
|
|
3046
|
+
/**
|
|
3047
|
+
* Output path relative to the project root. Defaults to
|
|
3048
|
+
* `<output>.valibot.ts`.
|
|
3049
|
+
*/
|
|
3050
|
+
readonly output?: string;
|
|
3051
|
+
/**
|
|
3052
|
+
* Schemas for typed jsonb columns: `{ 'customers.metadata':
|
|
3053
|
+
* './schemas.ts#metadata' }`.
|
|
3054
|
+
*/
|
|
3055
|
+
readonly json?: Readonly<Record<string, string>>;
|
|
3056
|
+
/**
|
|
3057
|
+
* Also export `fieldMeta`: a label, a required flag, enum options and bounds
|
|
3058
|
+
* for each writable field, for building forms.
|
|
3059
|
+
*/
|
|
3060
|
+
readonly fieldMeta?: boolean;
|
|
3061
|
+
}
|
|
3062
|
+
/** Valibot schemas for every table's Row, Insert and Update shape. */
|
|
3063
|
+
declare function valibot(options?: ValibotGeneratorOptions): Generator;
|
|
3064
|
+
//#endregion
|
|
3065
|
+
//#region src/generators/zod.d.ts
|
|
3066
|
+
interface ZodGeneratorOptions {
|
|
3067
|
+
/** Output path relative to the project root. Defaults to `<output>.zod.ts`. */
|
|
3068
|
+
readonly output?: string;
|
|
3069
|
+
/**
|
|
3070
|
+
* Schemas for typed jsonb columns: `{ 'customers.metadata':
|
|
3071
|
+
* './schemas.ts#metadata' }`.
|
|
3072
|
+
*/
|
|
3073
|
+
readonly json?: Readonly<Record<string, string>>;
|
|
3074
|
+
/**
|
|
3075
|
+
* `classic` (the default) imports `zod` and chains methods; `mini` imports
|
|
3076
|
+
* `zod/mini` and uses its functional API (`z.nullable(...)`, `.check(...)`),
|
|
3077
|
+
* which tree-shakes to a smaller bundle. Both need zod 4.
|
|
3078
|
+
*/
|
|
3079
|
+
readonly flavor?: ZodFlavor;
|
|
3080
|
+
/**
|
|
3081
|
+
* Also export `fieldMeta`: a label, a required flag, enum options and bounds
|
|
3082
|
+
* for each writable field, for building forms.
|
|
3083
|
+
*/
|
|
3084
|
+
readonly fieldMeta?: boolean;
|
|
3085
|
+
}
|
|
3086
|
+
type ZodFlavor = "classic" | "mini";
|
|
3087
|
+
/**
|
|
3088
|
+
* Zod 4 schemas for every table's Row, Insert and Update shape, for `zod` or,
|
|
3089
|
+
* with `flavor: 'mini'`, `zod/mini`.
|
|
3090
|
+
*/
|
|
3091
|
+
declare function zod(options?: ZodGeneratorOptions): Generator;
|
|
3092
|
+
//#endregion
|
|
3093
|
+
//#region src/sql/modules/entitlements-checks.d.ts
|
|
3094
|
+
/** `entitlements.claim`: what `feature_claims` puts in the token. */
|
|
3095
|
+
type FeatureClaimOption = false | {
|
|
3096
|
+
/** At most this many tenants, the lowest ids first. */
|
|
3097
|
+
readonly maxTenants?: number;
|
|
3098
|
+
/** Short codes written instead of the feature keys: `{ exports: "x" }`. */
|
|
3099
|
+
readonly keys?: Readonly<Record<string, string>>;
|
|
3100
|
+
};
|
|
3101
|
+
//#endregion
|
|
3102
|
+
//#region src/sql/modules/entitlements-source.d.ts
|
|
3103
|
+
/** The table holding each tenant's Stripe customer id. */
|
|
3104
|
+
interface EntitlementsSource {
|
|
3105
|
+
/** `table` or `schema.table`; unset uses the `organizations` module's. */
|
|
3106
|
+
readonly table?: string;
|
|
3107
|
+
/** Column with the Stripe customer id (`cus_...`). */
|
|
3108
|
+
readonly column?: string;
|
|
3109
|
+
/** Column with the tenant id. */
|
|
3110
|
+
readonly key: string;
|
|
3111
|
+
/**
|
|
3112
|
+
* Where entitlements come from; the customer lookups are for `stripe-sync`
|
|
3113
|
+
* only.
|
|
3114
|
+
*/
|
|
3115
|
+
readonly source?: "stripe-sync" | "custom" | EntitlementPlansSource;
|
|
3116
|
+
readonly claim?: FeatureClaimOption;
|
|
3117
|
+
}
|
|
3118
|
+
//#endregion
|
|
3119
|
+
//#region src/sql/modules/grants.d.ts
|
|
3120
|
+
/** Privileges one role gets on a table or view. */
|
|
3121
|
+
interface TableGrant {
|
|
3122
|
+
/** `table` or `schema.table`. */
|
|
3123
|
+
readonly table: string;
|
|
3124
|
+
readonly role: "anon" | "authenticated" | "service_role";
|
|
3125
|
+
readonly privileges: readonly string[];
|
|
3126
|
+
}
|
|
3127
|
+
/** The roles that may execute a function. */
|
|
3128
|
+
interface FunctionGrant {
|
|
3129
|
+
/** `name(argument types)` or `schema.name(argument types)`. */
|
|
3130
|
+
readonly function: string;
|
|
3131
|
+
readonly roles: readonly ("anon" | "authenticated" | "service_role")[];
|
|
3132
|
+
}
|
|
3133
|
+
//#endregion
|
|
3134
|
+
//#region src/sql/modules/vector-search.d.ts
|
|
3135
|
+
/** An embedding column `db.$search` can query. */
|
|
3136
|
+
interface VectorSearchTable {
|
|
3137
|
+
/** `table` or `schema.table`. */
|
|
3138
|
+
readonly table: string;
|
|
3139
|
+
readonly column: string;
|
|
3140
|
+
readonly distance: "cosine" | "l2" | "inner_product";
|
|
3141
|
+
/** The column's type: pgvector's `vector` (default) or `halfvec`. */
|
|
3142
|
+
readonly type?: "vector" | "halfvec";
|
|
3143
|
+
/** The primary key column the scores function returns. Defaults to `id`. */
|
|
3144
|
+
readonly key?: string;
|
|
3145
|
+
/** Full-text ranking fused with the vector ranking (reciprocal rank fusion). */
|
|
3146
|
+
readonly hybrid?: {
|
|
3147
|
+
readonly tsvector: string;
|
|
3148
|
+
/** The text search configuration of the query. Defaults to `simple`. */
|
|
3149
|
+
readonly config?: string;
|
|
3150
|
+
/** The RRF constant. Defaults to 60. */
|
|
3151
|
+
readonly k?: number;
|
|
3152
|
+
};
|
|
3153
|
+
/**
|
|
3154
|
+
* A SQL expression over the row `t` the score is multiplied by, such as
|
|
3155
|
+
* `t.priority`.
|
|
3156
|
+
*/
|
|
3157
|
+
readonly boost?: string;
|
|
3158
|
+
/** Columns `filter` narrows before ranking, such as `organization_id`. */
|
|
3159
|
+
readonly prefilter?: readonly string[];
|
|
3160
|
+
/** A SQL condition over the row `t` every candidate must meet. */
|
|
3161
|
+
readonly predicate?: string;
|
|
3162
|
+
/** How `boost` combines with the score. Defaults to `multiply`. */
|
|
3163
|
+
readonly boostMode?: "multiply" | "add";
|
|
3164
|
+
/** A SQL `order by` list over the row `t` that breaks score ties. */
|
|
3165
|
+
readonly order?: string;
|
|
3166
|
+
}
|
|
3167
|
+
//#endregion
|
|
3168
|
+
//#region src/sql/shared.d.ts
|
|
3169
|
+
/**
|
|
3170
|
+
* The name `addNotNullCheck` gives the check on `column` of `table`, both
|
|
3171
|
+
* quoted or bare, the table with or without its schema:
|
|
3172
|
+
* `<table>_<column>_not_null`, shortened with a hash past 63 bytes.
|
|
3173
|
+
*/
|
|
3174
|
+
declare function notNullCheckName(table: string, column: string): string;
|
|
3175
|
+
/**
|
|
3176
|
+
* A `pg_jsonschema` check on a jsonb column, for the `jsonb-schemas` module and
|
|
3177
|
+
* key-value tables.
|
|
3178
|
+
*/
|
|
3179
|
+
interface JsonSchemaCheck {
|
|
3180
|
+
/** `table` or `schema.table`. */
|
|
3181
|
+
readonly table: string;
|
|
3182
|
+
readonly column: string;
|
|
3183
|
+
readonly schema: Readonly<Record<string, unknown>>;
|
|
3184
|
+
/**
|
|
3185
|
+
* Checks only rows whose `where.column` equals `where.value` (a settings
|
|
3186
|
+
* key).
|
|
3187
|
+
*/
|
|
3188
|
+
readonly where?: {
|
|
3189
|
+
readonly column: string;
|
|
3190
|
+
readonly value: string;
|
|
3191
|
+
};
|
|
3192
|
+
}
|
|
3193
|
+
//#endregion
|
|
3194
|
+
//#region src/sql/module-types.d.ts
|
|
3195
|
+
/** The step from one module version to the next, for `upgrade`. */
|
|
3196
|
+
interface BlockSqlUpgrade {
|
|
3197
|
+
/** The installed version this step upgrades from. */
|
|
3198
|
+
readonly from: number;
|
|
3199
|
+
readonly description: string;
|
|
3200
|
+
/** SQL run before the module's current file, e.g. renames and backfills. */
|
|
3201
|
+
readonly sql: (ctx: BlockSqlContext) => string;
|
|
3202
|
+
}
|
|
3203
|
+
/**
|
|
3204
|
+
* A renamed module symbol. It keeps a compatibility wrapper for at least one
|
|
3205
|
+
* minor release, then is removed; doctor reports uses of both (BS309), and the
|
|
3206
|
+
* name stays reserved.
|
|
3207
|
+
*/
|
|
3208
|
+
interface BlockSqlDeprecation {
|
|
3209
|
+
readonly kind: "function" | "claim" | "table" | "column";
|
|
3210
|
+
/**
|
|
3211
|
+
* The old name: `schema.function`, a claim name, `schema.table` or
|
|
3212
|
+
* `table.column`.
|
|
3213
|
+
*/
|
|
3214
|
+
readonly symbol: string;
|
|
3215
|
+
/** What to use instead. */
|
|
3216
|
+
readonly use: string;
|
|
3217
|
+
/** The package version that deprecated it. */
|
|
3218
|
+
readonly since: string;
|
|
3219
|
+
/** The package version that removed it; until then `wrapper` is written. */
|
|
3220
|
+
readonly removed?: string;
|
|
3221
|
+
/**
|
|
3222
|
+
* The compatibility wrapper the module file keeps, e.g. a function with the
|
|
3223
|
+
* old name that calls the new one and a `comment on function ... is
|
|
3224
|
+
* 'deprecated: use X'`.
|
|
3225
|
+
*/
|
|
3226
|
+
readonly wrapper?: (ctx: BlockSqlContext) => string;
|
|
3227
|
+
}
|
|
3228
|
+
/**
|
|
3229
|
+
* SQL modules for `better-supabase add`. Every module is idempotent (`create or
|
|
3230
|
+
* replace`, `if not exists`), so re-running it upgrades in place.
|
|
3231
|
+
*/
|
|
3232
|
+
interface BlockSql {
|
|
3233
|
+
readonly name: string;
|
|
3234
|
+
readonly title: string;
|
|
3235
|
+
readonly description: string;
|
|
3236
|
+
/** Modules this one needs, added along with it. */
|
|
3237
|
+
readonly requires: readonly string[];
|
|
3238
|
+
/**
|
|
3239
|
+
* The scopes the module runs in. A module that needs tenants declares
|
|
3240
|
+
* `["tenant"]`; unset, it runs in every scope. Outside `tenant` scope a
|
|
3241
|
+
* module needs neither `tenant` nor `access`, so they drop from `requires`.
|
|
3242
|
+
*/
|
|
3243
|
+
readonly scopes?: readonly BlockScope[];
|
|
3244
|
+
/**
|
|
3245
|
+
* A module this one renders and is numbered ahead of, for a module that owns
|
|
3246
|
+
* a subject table the `case` checks of `comments` or `attachments` name, or
|
|
3247
|
+
* that `search` puts its index trigger on. The file takes the number before
|
|
3248
|
+
* it, so later files keep theirs.
|
|
3249
|
+
*/
|
|
3250
|
+
readonly before?: string;
|
|
3251
|
+
/** What it needs instead when an authorization provider supplies memberships. */
|
|
3252
|
+
readonly providerRequires?: readonly string[];
|
|
3253
|
+
/**
|
|
3254
|
+
* The optional `authorization.functions` templates it calls under the
|
|
3255
|
+
* `provider` access model, such as `idsWithFor` to check another user. Doctor
|
|
3256
|
+
* warns (BS411) when the provider doesn't set one.
|
|
3257
|
+
*/
|
|
3258
|
+
readonly providerFunctions?: readonly (keyof AuthorizationFunctions)[];
|
|
3259
|
+
/**
|
|
3260
|
+
* Modules it works with when they are installed, without needing them.
|
|
3261
|
+
* `ctx.installed` and `ctx.of` accept only these and what it requires;
|
|
3262
|
+
* `record` reaches the outbox and the audit log without listing them. `*`
|
|
3263
|
+
* stands for every module, for one that reads them all (`data-lifecycle`).
|
|
3264
|
+
*/
|
|
3265
|
+
readonly integrates?: readonly string[];
|
|
3266
|
+
/**
|
|
3267
|
+
* What it adds to generic blocks (approvals, bulk actions, share links and
|
|
3268
|
+
* the subject functions) that read it without naming it. Each function gets
|
|
3269
|
+
* this block's context and the generic block's.
|
|
3270
|
+
*/
|
|
3271
|
+
readonly contributes?: BlockContributes;
|
|
3272
|
+
/**
|
|
3273
|
+
* What it needs for this layout, e.g. per `blocks.permissions.model`;
|
|
3274
|
+
* overrides both.
|
|
3275
|
+
*/
|
|
3276
|
+
readonly dependencies?: (layout: BlockSqlLayout) => readonly string[];
|
|
3277
|
+
/** `schema` files go with your schemas; `test` files go to `supabase/tests`. */
|
|
3278
|
+
readonly target: "schema" | "test";
|
|
3279
|
+
/** The module built for the default layout. */
|
|
3280
|
+
readonly sql: string;
|
|
3281
|
+
/** Bumped when installed databases need an upgrade step. Defaults to 1. */
|
|
3282
|
+
readonly version?: number;
|
|
3283
|
+
/** The modes `blocks.<name>.ownership` accepts. Defaults to `managed` only. */
|
|
3284
|
+
readonly modes?: readonly BlockMode[];
|
|
3285
|
+
/**
|
|
3286
|
+
* The logical tables and columns `blocks.<name>.tables` and `columns` map. A
|
|
3287
|
+
* table's entry is its spec; its `app` says whether it can be a table the app
|
|
3288
|
+
* already has (`BlockSqlAppTable`).
|
|
3289
|
+
*/
|
|
3290
|
+
readonly names?: BlockSqlNames;
|
|
3291
|
+
/** The functions other modules and the TypeScript side call. */
|
|
3292
|
+
readonly contract?: (ctx: BlockSqlContext) => readonly BlockSqlContractFunction[];
|
|
3293
|
+
/** Renders the module for a layout. */
|
|
3294
|
+
readonly build: (ctx: BlockSqlContext, layout: BlockSqlLayout) => string;
|
|
3295
|
+
/**
|
|
3296
|
+
* SQL appended after the module's body that depends on the whole layout, for
|
|
3297
|
+
* example the grants for the tables in `expose`. Unlike `build`, it stays out
|
|
3298
|
+
* of what `api` wrappers and extension scans read.
|
|
3299
|
+
*/
|
|
3300
|
+
readonly extras?: (ctx: BlockSqlContext, layout: BlockSqlLayout) => string;
|
|
3301
|
+
readonly upgrades?: readonly BlockSqlUpgrade[];
|
|
3302
|
+
readonly deprecated?: readonly BlockSqlDeprecation[];
|
|
3303
|
+
/**
|
|
3304
|
+
* Rows, role settings and calls that a schema diff doesn't capture. They go
|
|
3305
|
+
* to `better-supabase-data/` next to the schema folder and a migration (`sql
|
|
3306
|
+
* data`) instead of the schema file.
|
|
3307
|
+
*/
|
|
3308
|
+
readonly data?: (ctx: BlockSqlContext, layout: BlockSqlLayout) => string;
|
|
3309
|
+
/**
|
|
3310
|
+
* PgTAP files for this layout, written to the tests folder next to the
|
|
3311
|
+
* `pgtap` module's.
|
|
3312
|
+
*/
|
|
3313
|
+
readonly tests?: (ctx: BlockSqlContext, layout: BlockSqlLayout) => readonly BlockSqlTestFile[];
|
|
3314
|
+
readonly topics?: (ctx: BlockSqlContext) => readonly string[];
|
|
3315
|
+
readonly permissionKeys?: (ctx: BlockSqlContext) => readonly {
|
|
3316
|
+
readonly action: string;
|
|
3317
|
+
readonly key: string;
|
|
3318
|
+
readonly scope: "tenant" | "platform";
|
|
3319
|
+
readonly setting: string;
|
|
3320
|
+
}[];
|
|
3321
|
+
/**
|
|
3322
|
+
* Functions granted to `anon` or `authenticated` only so the module's
|
|
3323
|
+
* policies and triggers can call them as the client. `api` writes no entry
|
|
3324
|
+
* point for them.
|
|
3325
|
+
*/
|
|
3326
|
+
readonly internal?: readonly string[];
|
|
3327
|
+
/**
|
|
3328
|
+
* Soft-delete columns, as logical `table.column`: a write can set them to
|
|
3329
|
+
* hide a row but never clear them again, so doctor BS213 doesn't count them
|
|
3330
|
+
* as columns that grant access.
|
|
3331
|
+
*/
|
|
3332
|
+
readonly hidingColumns?: readonly string[];
|
|
3333
|
+
/** The app's tables outside `names.tables` that the module writes columns of. */
|
|
3334
|
+
readonly appSubjectTables?: (ctx: BlockSqlContext) => readonly BlockSqlAppSubjectTable[];
|
|
3335
|
+
}
|
|
3336
|
+
/**
|
|
3337
|
+
* How one of a module's tables can be a table the app already has (ADR 0098).
|
|
3338
|
+
* It sits on the table's entry in `names.tables` (`app`), next to `columns`,
|
|
3339
|
+
* `optional` and `typed`, which together make the table's spec:
|
|
3340
|
+
*
|
|
3341
|
+
* - The required columns are those in `columns` that aren't `optional` or
|
|
3342
|
+
* `unused`. The module adds each one the app's table lacks with `add column
|
|
3343
|
+
* if not exists`, nullable unless it has a default, and doctor (BS330) and
|
|
3344
|
+
* `add --adopt` check and propose them.
|
|
3345
|
+
* - The optional columns may be mapped to `null` in `blocks.<name>.columns`; the
|
|
3346
|
+
* module then leaves out the feature that needs them.
|
|
3347
|
+
* - The `typed` columns may be an enum or a domain on the app's table; the module
|
|
3348
|
+
* writes them through `ctx.cast`.
|
|
3349
|
+
*
|
|
3350
|
+
* When `layout.ownTables` has the table, `ctx.owns(table)` is false: the module
|
|
3351
|
+
* skips its `create table` and lays its functions, policies, triggers and
|
|
3352
|
+
* indexes over the app's table. A table whose entry has no `app` is always the
|
|
3353
|
+
* module's: it creates it, and a table of that name in the app's schema is an
|
|
3354
|
+
* error.
|
|
3355
|
+
*/
|
|
3356
|
+
interface BlockSqlAppTable {
|
|
3357
|
+
/**
|
|
3358
|
+
* The app's table only when `blocks.<name>.tables` maps it. Unmapped, the
|
|
3359
|
+
* module creates its own, so an app table with the default name is an error.
|
|
3360
|
+
*/
|
|
3361
|
+
readonly onlyWhenMapped?: boolean;
|
|
3362
|
+
/**
|
|
3363
|
+
* Logical columns this configuration doesn't use, such as the secret column
|
|
3364
|
+
* when secrets live in Vault. They are neither required nor checked.
|
|
3365
|
+
*/
|
|
3366
|
+
readonly unused?: (ctx: BlockSqlContext) => readonly string[];
|
|
3367
|
+
}
|
|
3368
|
+
/**
|
|
3369
|
+
* A table of the app's outside `names.tables` that a module writes columns of,
|
|
3370
|
+
* such as a subject table that `blocks.<name>.on.<type>` names. A null column
|
|
3371
|
+
* is mapped away; doctor and `upgrade` check the others exist.
|
|
3372
|
+
*/
|
|
3373
|
+
interface BlockSqlAppSubjectTable {
|
|
3374
|
+
readonly logical: string;
|
|
3375
|
+
readonly schema: string;
|
|
3376
|
+
readonly table: string;
|
|
3377
|
+
readonly columns: Readonly<Record<string, string | null>>;
|
|
3378
|
+
}
|
|
3379
|
+
/** A pgTAP file a module writes for the layout, e.g. one per audited table. */
|
|
3380
|
+
interface BlockSqlTestFile {
|
|
3381
|
+
/** The file name's suffix, after the module's slug. */
|
|
3382
|
+
readonly name: string;
|
|
3383
|
+
readonly sql: string;
|
|
3384
|
+
}
|
|
3385
|
+
declare const blockSqlVersion: (module: BlockSql) => number;
|
|
3386
|
+
interface BlockSqlFile {
|
|
3387
|
+
readonly module: string;
|
|
3388
|
+
/** The instance, when it installs `module` under another name. */
|
|
3389
|
+
readonly instance?: string;
|
|
3390
|
+
/** `schema` and `test` files are diffed; `data` files go in a migration too. */
|
|
3391
|
+
readonly kind: "schema" | "data" | "test";
|
|
3392
|
+
readonly path: string;
|
|
3393
|
+
readonly contents: string;
|
|
3394
|
+
}
|
|
3395
|
+
interface BlockSqlLayout {
|
|
3396
|
+
/**
|
|
3397
|
+
* `config.instances`. An instance that installs a block under another name
|
|
3398
|
+
* renders its own files; `modules` holds the instances named after their
|
|
3399
|
+
* block.
|
|
3400
|
+
*/
|
|
3401
|
+
readonly instances?: Readonly<Record<string, ResolvedInstance>>;
|
|
3402
|
+
/** Directory for schema modules. Defaults to `supabase/schemas`. */
|
|
3403
|
+
readonly dir?: string;
|
|
3404
|
+
/**
|
|
3405
|
+
* The declarative schema folder the diff engine loads. Defaults to
|
|
3406
|
+
* `supabase/schemas`.
|
|
3407
|
+
*/
|
|
3408
|
+
readonly schemasDir?: string;
|
|
3409
|
+
/** File prefix. Defaults to `900_better_supabase`. */
|
|
3410
|
+
readonly prefix?: string;
|
|
3411
|
+
/** Directory for pgTAP files. Defaults to `supabase/tests`. */
|
|
3412
|
+
readonly testsDir?: string;
|
|
3413
|
+
/**
|
|
3414
|
+
* The `better_supabase.audit(...)` calls in the SQL files: the `audit` module
|
|
3415
|
+
* writes a pgTAP file per table.
|
|
3416
|
+
*/
|
|
3417
|
+
readonly auditedTables?: readonly AuditedTable[];
|
|
3418
|
+
/**
|
|
3419
|
+
* Ignored: the header names only the module, so a release doesn't rewrite
|
|
3420
|
+
* every file. The `@bsb-block name@N` marker carries the module version.
|
|
3421
|
+
*
|
|
3422
|
+
* @deprecated Remove it; it has no effect.
|
|
3423
|
+
*/
|
|
3424
|
+
readonly version?: string;
|
|
3425
|
+
/**
|
|
3426
|
+
* `config.realtime.tables`: registered at the end of the `realtime-tables`
|
|
3427
|
+
* module.
|
|
3428
|
+
*/
|
|
3429
|
+
readonly realtimeTables?: readonly string[];
|
|
3430
|
+
/** `config.realtime.global`: tables registered with `tenant_column => null`. */
|
|
3431
|
+
readonly realtimeGlobal?: readonly string[];
|
|
3432
|
+
/** `config.realtime.users`: tables registered with `user_column`. */
|
|
3433
|
+
readonly realtimeUsers?: Readonly<Record<string, string>>;
|
|
3434
|
+
/** Tenant column passed to `track_realtime` for the other tables. */
|
|
3435
|
+
readonly tenantColumn?: string;
|
|
3436
|
+
/** Check constraints for the `jsonb-schemas` module. */
|
|
3437
|
+
readonly jsonSchemas?: readonly JsonSchemaCheck[];
|
|
3438
|
+
/** `config.expose`: the grants the `grants` module writes. */
|
|
3439
|
+
readonly grants?: readonly TableGrant[];
|
|
3440
|
+
/** `config.expose` functions: the roles that may execute each one. */
|
|
3441
|
+
readonly functionGrants?: readonly FunctionGrant[];
|
|
3442
|
+
/**
|
|
3443
|
+
* Grants the permissive policies in the schema files imply, for
|
|
3444
|
+
* `blocks['grants'].options.fromPolicies`. Tables in `grants` keep their
|
|
3445
|
+
* listed privileges.
|
|
3446
|
+
*/
|
|
3447
|
+
readonly policyGrants?: readonly TableGrant[];
|
|
3448
|
+
/**
|
|
3449
|
+
* The tables the schema files create, for
|
|
3450
|
+
* `blocks['sessions'].options.policies`.
|
|
3451
|
+
*/
|
|
3452
|
+
readonly declaredTables?: readonly string[];
|
|
3453
|
+
/**
|
|
3454
|
+
* `schema.table` of each table the app already has, to the schema file that
|
|
3455
|
+
* creates it or `database`. A block leaves these tables alone and adds only
|
|
3456
|
+
* the columns it needs, and an app table refuses their names.
|
|
3457
|
+
*/
|
|
3458
|
+
readonly ownTables?: Readonly<Record<string, string>>;
|
|
3459
|
+
/** The columns of the tables in `ownTables`, where they are known. */
|
|
3460
|
+
readonly ownColumns?: Readonly<Record<string, readonly string[]>>;
|
|
3461
|
+
/**
|
|
3462
|
+
* The trigger that already keeps `updated_at` current on a table in
|
|
3463
|
+
* `ownTables`, by `schema.table`. A block adds no `updated_at` trigger
|
|
3464
|
+
* there.
|
|
3465
|
+
*/
|
|
3466
|
+
readonly ownUpdatedAtTriggers?: Readonly<Record<string, string>>;
|
|
3467
|
+
/**
|
|
3468
|
+
* The app's own policies on a table in `ownTables`, by `schema.table`. A
|
|
3469
|
+
* block adds no permissive policy that one of them already covers.
|
|
3470
|
+
*/
|
|
3471
|
+
readonly ownPolicies?: Readonly<Record<string, readonly CatalogPolicy[]>>;
|
|
3472
|
+
/**
|
|
3473
|
+
* The declared tables with row level security on, for tables `fromPolicies`
|
|
3474
|
+
* makes service-only.
|
|
3475
|
+
*/
|
|
3476
|
+
readonly rlsTables?: readonly string[];
|
|
3477
|
+
/**
|
|
3478
|
+
* The foreign keys the schema files declare, for
|
|
3479
|
+
* `blocks.memberships.options.sameTenant.auto`.
|
|
3480
|
+
*/
|
|
3481
|
+
readonly foreignKeys?: readonly DeclaredForeignKey[];
|
|
3482
|
+
/**
|
|
3483
|
+
* Each declared table's columns, `schema.table` to names, for
|
|
3484
|
+
* `sameTenant.auto`.
|
|
3485
|
+
*/
|
|
3486
|
+
readonly declaredColumns?: Readonly<Record<string, readonly string[]>>;
|
|
3487
|
+
/** `config.readSets`, compiled: the functions the `read-sets` module writes. */
|
|
3488
|
+
readonly readSets?: readonly {
|
|
3489
|
+
readonly name: string;
|
|
3490
|
+
readonly sql: string;
|
|
3491
|
+
}[];
|
|
3492
|
+
/**
|
|
3493
|
+
* `config.entitlements`: where the `entitlements` module finds each tenant's
|
|
3494
|
+
* Stripe customer.
|
|
3495
|
+
*/
|
|
3496
|
+
readonly entitlements?: EntitlementsSource;
|
|
3497
|
+
/**
|
|
3498
|
+
* `config.vectorSearch`: the tables the `vector-search` module writes a
|
|
3499
|
+
* search function for.
|
|
3500
|
+
*/
|
|
3501
|
+
readonly vectorSearch?: readonly VectorSearchTable[];
|
|
3502
|
+
readonly vectorSchema?: string;
|
|
3503
|
+
/** `config.claims`: claim names the modules read and write. */
|
|
3504
|
+
readonly claims?: ClaimsMeta;
|
|
3505
|
+
/**
|
|
3506
|
+
* The authorization provider's memberships: `entitlements` reads them instead
|
|
3507
|
+
* of `tenant`'s.
|
|
3508
|
+
*/
|
|
3509
|
+
readonly entitlementsProvider?: BlockSqlEntitlementsProvider;
|
|
3510
|
+
/** The authorization provider the `access` module's `provider` model calls. */
|
|
3511
|
+
readonly accessProvider?: BlockSqlAccessProvider;
|
|
3512
|
+
/** `config.blocks`: modes, names and permission keys per module. */
|
|
3513
|
+
readonly modules?: AnyBlocksConfig;
|
|
3514
|
+
/** `sql.scope`: the scope of every block that sets none. Defaults to `tenant`. */
|
|
3515
|
+
readonly scope?: BlockScope;
|
|
3516
|
+
/** `config.records`: the app-wide subject registry (ADR 0020). */
|
|
3517
|
+
readonly subjects?: SubjectsConfig;
|
|
3518
|
+
/**
|
|
3519
|
+
* `config.appTables`: the tables the app owns, rendered after the blocks (ADR
|
|
3520
|
+
* 0040).
|
|
3521
|
+
*/
|
|
3522
|
+
readonly appTables?: AppTablesConfig;
|
|
3523
|
+
/** The authorization provider's permission keys, for `api-keys` scopes. */
|
|
3524
|
+
readonly permissionCatalog?: readonly string[];
|
|
3525
|
+
/**
|
|
3526
|
+
* `authorization.delegation.scopes`: the access module's `scope_permissions`
|
|
3527
|
+
* (with `blocks.permissions.scopes` merged over it).
|
|
3528
|
+
*/
|
|
3529
|
+
readonly delegationScopes?: Readonly<Record<string, readonly string[]>>;
|
|
3530
|
+
}
|
|
3531
|
+
/**
|
|
3532
|
+
* Where the `entitlements` module reads the provider's memberships, and the
|
|
3533
|
+
* tables behind them.
|
|
3534
|
+
*/
|
|
3535
|
+
interface BlockSqlEntitlementsProvider {
|
|
3536
|
+
/** The provider's name, for comments. */
|
|
3537
|
+
readonly name: string;
|
|
3538
|
+
/** The provider scope tenants are, e.g. `organization`. */
|
|
3539
|
+
readonly scope: string;
|
|
3540
|
+
readonly idType: BlockSqlIdType;
|
|
3541
|
+
/** `authorization.functions.memberIds`. */
|
|
3542
|
+
readonly memberIds: string;
|
|
3543
|
+
/** `authorization.functions.memberIdsFor`. */
|
|
3544
|
+
readonly memberIdsFor: string;
|
|
3545
|
+
readonly memberships: readonly AuthorizationMembership[];
|
|
3546
|
+
}
|
|
3547
|
+
/** What the `access` module's `provider` model calls. */
|
|
3548
|
+
interface BlockSqlAccessProvider {
|
|
3549
|
+
/** The provider's name, for comments and errors. */
|
|
3550
|
+
readonly name: string;
|
|
3551
|
+
/** The provider scope tenants are. */
|
|
3552
|
+
readonly scope: string;
|
|
3553
|
+
/** Every scope it declares, for `on.<type>.scope`. */
|
|
3554
|
+
readonly scopes?: readonly string[];
|
|
3555
|
+
readonly idType: BlockSqlIdType;
|
|
3556
|
+
readonly functions: AuthorizationFunctions;
|
|
3557
|
+
/** The access module's `disabled` setting defaults to these. */
|
|
3558
|
+
readonly suspension?: {
|
|
3559
|
+
readonly user?: DisabledRow;
|
|
3560
|
+
readonly tenant?: DisabledRow;
|
|
3561
|
+
};
|
|
3562
|
+
/**
|
|
3563
|
+
* An adopted `tenant` module on one of these tables reads role names the same
|
|
3564
|
+
* way.
|
|
3565
|
+
*/
|
|
3566
|
+
readonly roleSources?: readonly AuthorizationRoleSource[];
|
|
3567
|
+
/** How `ai-chat` applies `functions.canApprove`. */
|
|
3568
|
+
readonly approvals?: {
|
|
3569
|
+
readonly distinctApprover?: boolean;
|
|
3570
|
+
};
|
|
3571
|
+
/** The provider's operations table; `operationPermission` reads it. */
|
|
3572
|
+
readonly operations?: Readonly<Record<string, AuthorizationOperation>>;
|
|
3573
|
+
}
|
|
3574
|
+
//#endregion
|
|
3575
|
+
//#region src/sql/resolved-names.d.ts
|
|
3576
|
+
/** One of a module's entities with the name the config gives it. */
|
|
3577
|
+
interface ResolvedEntity {
|
|
3578
|
+
readonly key: string;
|
|
3579
|
+
/** The logical table that holds it; global entities may have none. */
|
|
3580
|
+
readonly table?: string;
|
|
3581
|
+
readonly from: EntityNoun;
|
|
3582
|
+
readonly to: EntityNoun;
|
|
3583
|
+
readonly primary: boolean;
|
|
3584
|
+
/** Renamed in every module (the tenant). */
|
|
3585
|
+
readonly global: boolean;
|
|
3586
|
+
/** `blocks.<name>.entities.<entity>.url`, with logical column placeholders. */
|
|
3587
|
+
readonly url?: string;
|
|
3588
|
+
/**
|
|
3589
|
+
* What makes the entity a subject, or undefined when it isn't one or the
|
|
3590
|
+
* config sets `subject: false`.
|
|
3591
|
+
*/
|
|
3592
|
+
readonly subject?: BlockSqlEntitySubject;
|
|
3593
|
+
}
|
|
3594
|
+
/**
|
|
3595
|
+
* A module's final names for one config: its entities as renamed and the
|
|
3596
|
+
* renamer every name goes through (the tenant rename, then the module's own).
|
|
3597
|
+
*/
|
|
3598
|
+
interface ResolvedNames {
|
|
3599
|
+
readonly module: string;
|
|
3600
|
+
readonly entities: Readonly<Record<string, ResolvedEntity>>;
|
|
3601
|
+
/** The tenant's noun, `organization` unless the tenant block renames it. */
|
|
3602
|
+
readonly tenant: EntityNoun;
|
|
3603
|
+
/** Tables, columns, functions, hooks and triggers: tenant and own entities. */
|
|
3604
|
+
readonly naming: EntityNames;
|
|
3605
|
+
/**
|
|
3606
|
+
* Event types, payload keys, subjects, permission keys and TypeScript names:
|
|
3607
|
+
* the module's own entities. The tenant rename leaves them alone, as it
|
|
3608
|
+
* always has.
|
|
3609
|
+
*/
|
|
3610
|
+
readonly entityNaming: EntityNames;
|
|
3611
|
+
}
|
|
3612
|
+
//#endregion
|
|
3613
|
+
//#region src/sql/scope.d.ts
|
|
3614
|
+
/**
|
|
3615
|
+
* How a module checks who may reach a row, for the block's scope. Modules call
|
|
3616
|
+
* these instead of naming the access contract (`can`, `tenant_ids_with`,
|
|
3617
|
+
* `is_platform`) or the tenant module's helpers, so the same module runs per
|
|
3618
|
+
* tenant, per user or in one shared space. In `tenant` scope each one renders
|
|
3619
|
+
* the access contract call it replaces.
|
|
3620
|
+
*/
|
|
3621
|
+
interface BlockSqlScope {
|
|
3622
|
+
readonly kind: BlockScope;
|
|
3623
|
+
/**
|
|
3624
|
+
* The type of a scope id: the tenant id type, or `uuid` (a user id) in `user`
|
|
3625
|
+
* scope.
|
|
3626
|
+
*/
|
|
3627
|
+
readonly idType: BlockSqlIdType;
|
|
3628
|
+
/**
|
|
3629
|
+
* The type of a managed table's scope column: `<idType> not null` per tenant,
|
|
3630
|
+
* nullable outside it (`uuid default auth.uid()` per user).
|
|
3631
|
+
*/
|
|
3632
|
+
column(): string;
|
|
3633
|
+
/** True when the caller holds `permission` (a SQL expression) in scope `id`. */
|
|
3634
|
+
can(id: string, permission: string): string;
|
|
3635
|
+
/** True when `user` (a uuid expression) holds `permission` in scope `id`. */
|
|
3636
|
+
canUser(user: string, id: string, permission: string): string;
|
|
3637
|
+
/**
|
|
3638
|
+
* PL/pgSQL that sets the scope id parameter `param` for the scope: the
|
|
3639
|
+
* caller's id per user (the service role keeps what it passes), null in the
|
|
3640
|
+
* shared space. Empty per tenant.
|
|
3641
|
+
*/
|
|
3642
|
+
bind(param: string): string;
|
|
3643
|
+
/**
|
|
3644
|
+
* A scope id argument as an expression: as passed per tenant, the caller's id
|
|
3645
|
+
* when it is null per user, null in the shared space.
|
|
3646
|
+
*/
|
|
3647
|
+
value(param: string): string;
|
|
3648
|
+
/**
|
|
3649
|
+
* A set-returning call of the scope ids the caller holds `permission` in,
|
|
3650
|
+
* usable as `select ...`, `x in (select ...)` and `from ... x`.
|
|
3651
|
+
*/
|
|
3652
|
+
ids(permission: string): string;
|
|
3653
|
+
/** A row policy check: `column` is a scope the caller holds `permission` in. */
|
|
3654
|
+
check(column: string, permission: string): string;
|
|
3655
|
+
/** `a = b` for scope ids, null-safe in `none` scope where they are null. */
|
|
3656
|
+
eq(a: string, b: string): string;
|
|
3657
|
+
/**
|
|
3658
|
+
* `is_platform(permission)`: whether the caller is platform staff holding
|
|
3659
|
+
* `permission`. `false` outside `tenant` scope without the access module.
|
|
3660
|
+
*/
|
|
3661
|
+
platform(permission: string): string;
|
|
3662
|
+
/** A set-returning call of the tenants the caller is a member of. */
|
|
3663
|
+
members(): string;
|
|
3664
|
+
/**
|
|
3665
|
+
* True when the caller holds a guest grant for `action` on record `type`/`id`
|
|
3666
|
+
* in tenant `tenant` (ADR 0070). A guest is not a member, so `can` stays
|
|
3667
|
+
* false for them. `false` without the `guests` module and without a provider
|
|
3668
|
+
* that answers for guests, and outside `tenant` scope.
|
|
3669
|
+
*/
|
|
3670
|
+
guest(tenant: string, type: string, id: string, action: GuestAction): string;
|
|
3671
|
+
/**
|
|
3672
|
+
* True when the caller is a guest of tenant `tenant` who represents the party
|
|
3673
|
+
* `type`/`id`, such as the customer an invoice is addressed to. `false` where
|
|
3674
|
+
* `guest` is.
|
|
3675
|
+
*/
|
|
3676
|
+
guestParty(tenant: string, type: string, id: string): string;
|
|
3677
|
+
}
|
|
3678
|
+
//#endregion
|
|
3679
|
+
//#region src/sql/context.d.ts
|
|
3680
|
+
/** The scope id types SQL modules render. */
|
|
3681
|
+
declare const MODULE_ID_TYPES: readonly ["uuid", "text", "bigint", "integer"];
|
|
3682
|
+
type BlockSqlIdType = (typeof MODULE_ID_TYPES)[number];
|
|
3683
|
+
declare const isBlockSqlIdType: (value: string) => value is BlockSqlIdType;
|
|
3684
|
+
/**
|
|
3685
|
+
* A Postgres type name as one of `MODULE_ID_TYPES`: case and spacing are
|
|
3686
|
+
* normalised and aliases such as `int8` resolved. `undefined` for any other
|
|
3687
|
+
* type, so callers refuse it instead of guessing.
|
|
3688
|
+
*/
|
|
3689
|
+
declare function moduleIdType(value: string): BlockSqlIdType | undefined;
|
|
3690
|
+
/** One logical table of a module: its default name and logical columns. */
|
|
3691
|
+
interface BlockSqlTableSpec {
|
|
3692
|
+
/** Default name, in the module's schema. */
|
|
3693
|
+
readonly name: string;
|
|
3694
|
+
/** Logical column to default column name. */
|
|
3695
|
+
readonly columns: Readonly<Record<string, string>>;
|
|
3696
|
+
/**
|
|
3697
|
+
* Logical columns an adopted table may lack (mapped to `null`): the module
|
|
3698
|
+
* leaves out the feature that needs them.
|
|
3699
|
+
*/
|
|
3700
|
+
readonly optional?: readonly string[];
|
|
3701
|
+
/** The app may lack the whole table (`blocks.<name>.tables.<table>: null`). */
|
|
3702
|
+
readonly optionalTable?: boolean;
|
|
3703
|
+
/**
|
|
3704
|
+
* How the table can be a table the app already has (ADR 0098). Without it the
|
|
3705
|
+
* module always creates the table.
|
|
3706
|
+
*/
|
|
3707
|
+
readonly app?: BlockSqlAppTable;
|
|
3708
|
+
readonly lifecycle?: BlockSqlTableLifecycle;
|
|
3709
|
+
/**
|
|
3710
|
+
* Text columns an adopted table may declare with another type, such as an
|
|
3711
|
+
* enum: the module writes and compares them through `ctx.cast`.
|
|
3712
|
+
*/
|
|
3713
|
+
readonly typed?: readonly string[];
|
|
3714
|
+
}
|
|
3715
|
+
interface BlockSqlTableLifecycle {
|
|
3716
|
+
readonly user?: string;
|
|
3717
|
+
readonly tenant?: string;
|
|
3718
|
+
readonly purge?: boolean;
|
|
3719
|
+
readonly omit?: readonly string[];
|
|
3720
|
+
readonly export?: boolean;
|
|
3721
|
+
/**
|
|
3722
|
+
* Columns that hold a `credential_ref`. Exports leave them out, and the
|
|
3723
|
+
* organization purger revokes each ref that carries the row's tenant through
|
|
3724
|
+
* the `CredentialProvider` before the purge deletes the row.
|
|
3725
|
+
*/
|
|
3726
|
+
readonly credentials?: readonly string[];
|
|
3727
|
+
/** Revoke for the row's `user` instead of the app. Default `app`. */
|
|
3728
|
+
readonly credentialSubject?: "app" | "user";
|
|
3729
|
+
}
|
|
3730
|
+
/**
|
|
3731
|
+
* What makes an entity a `config.records` entry when the block is installed.
|
|
3732
|
+
* Columns are the table's logical columns; permissions are module actions.
|
|
3733
|
+
*/
|
|
3734
|
+
interface BlockSqlEntitySubject {
|
|
3735
|
+
readonly title: string;
|
|
3736
|
+
readonly deletedAt?: string;
|
|
3737
|
+
readonly permissions: {
|
|
3738
|
+
readonly read: string;
|
|
3739
|
+
readonly write: string;
|
|
3740
|
+
/**
|
|
3741
|
+
* The action whose key `attachments` checks for files on the entity, in
|
|
3742
|
+
* place of `attachments.upload`. Set it when the table's own write policies
|
|
3743
|
+
* check more than tenant membership (doctor BS345).
|
|
3744
|
+
*/
|
|
3745
|
+
readonly upload?: string;
|
|
3746
|
+
};
|
|
3747
|
+
readonly rank?: {
|
|
3748
|
+
readonly column: string;
|
|
3749
|
+
readonly group: string;
|
|
3750
|
+
};
|
|
3751
|
+
readonly search?: {
|
|
3752
|
+
readonly title: string;
|
|
3753
|
+
readonly body: readonly string[];
|
|
3754
|
+
};
|
|
3755
|
+
readonly url?: string;
|
|
3756
|
+
readonly cascade?: boolean;
|
|
3757
|
+
}
|
|
3758
|
+
/**
|
|
3759
|
+
* A noun the module names its tables, functions, events, permissions and hooks
|
|
3760
|
+
* after (`work_item`), renamed through `blocks.<name>.entities`.
|
|
3761
|
+
*/
|
|
3762
|
+
interface BlockSqlEntitySpec {
|
|
3763
|
+
/** The logical table that holds the entity; global entities may have none. */
|
|
3764
|
+
readonly table?: string;
|
|
3765
|
+
readonly singular: string;
|
|
3766
|
+
/** Defaults to the English plural of `singular`. */
|
|
3767
|
+
readonly plural?: string;
|
|
3768
|
+
/** The entity `entities: "<noun>"` renames. */
|
|
3769
|
+
readonly primary?: boolean;
|
|
3770
|
+
/** Renamed in every module, not only this one (the tenant). */
|
|
3771
|
+
readonly global?: boolean;
|
|
3772
|
+
readonly subject?: BlockSqlEntitySubject;
|
|
3773
|
+
}
|
|
3774
|
+
interface BlockSqlNames {
|
|
3775
|
+
readonly tables: Readonly<Record<string, BlockSqlTableSpec>>;
|
|
3776
|
+
readonly entities?: Readonly<Record<string, BlockSqlEntitySpec>>;
|
|
3777
|
+
/**
|
|
3778
|
+
* The `before_*` and `after_*` hooks the module calls, so
|
|
3779
|
+
* `blocks.<name>.hooks.functions` is checked.
|
|
3780
|
+
*/
|
|
3781
|
+
readonly hooks?: readonly string[];
|
|
3782
|
+
/**
|
|
3783
|
+
* The `blocks.<name>.options` keys the module reads; any other key is
|
|
3784
|
+
* rejected.
|
|
3785
|
+
*/
|
|
3786
|
+
readonly options?: readonly string[];
|
|
3787
|
+
/**
|
|
3788
|
+
* The events the module records, typed against its block's event map
|
|
3789
|
+
* (`BlockSqlEvents<MessagingEvents>`); `record` rejects any other type.
|
|
3790
|
+
*/
|
|
3791
|
+
readonly events?: Readonly<Record<string, CheckedEventSpec | undefined>>;
|
|
3792
|
+
/**
|
|
3793
|
+
* Tables and columns the module renamed between versions. `upgrade` renames
|
|
3794
|
+
* them on installs below `from + 1`, after the config's entity and table
|
|
3795
|
+
* renames, so a declared move needs no hand-written upgrade step.
|
|
3796
|
+
*/
|
|
3797
|
+
readonly migrations?: readonly BlockSqlNameMigration[];
|
|
3798
|
+
}
|
|
3799
|
+
/**
|
|
3800
|
+
* One version's table and column moves. Old names are the module's default
|
|
3801
|
+
* names before the move; they go through the entity renames like every other
|
|
3802
|
+
* name.
|
|
3803
|
+
*/
|
|
3804
|
+
interface BlockSqlNameMigration {
|
|
3805
|
+
/** The installed version this move upgrades from. */
|
|
3806
|
+
readonly from: number;
|
|
3807
|
+
readonly description: string;
|
|
3808
|
+
/** The logical table, under its current key. */
|
|
3809
|
+
readonly table: string;
|
|
3810
|
+
/** The table's default name before the move, when the move renamed it. */
|
|
3811
|
+
readonly was?: string;
|
|
3812
|
+
/** Logical column to its default name before the move. */
|
|
3813
|
+
readonly columns?: Readonly<Record<string, string>>;
|
|
3814
|
+
}
|
|
3815
|
+
interface CheckedEventSpec {
|
|
3816
|
+
readonly subject: string;
|
|
3817
|
+
readonly payload: readonly string[];
|
|
3818
|
+
readonly retries?: boolean;
|
|
3819
|
+
}
|
|
3820
|
+
/** An event a module writes to the outbox, as SQL expressions. */
|
|
3821
|
+
interface BlockSqlEmit {
|
|
3822
|
+
/** The event type, e.g. `organization.created`. */
|
|
3823
|
+
readonly type: string;
|
|
3824
|
+
/** A `jsonb` expression. */
|
|
3825
|
+
readonly payload: string;
|
|
3826
|
+
/** A `text` expression, e.g. `'organizations/' || new_organization`. */
|
|
3827
|
+
readonly subject?: string;
|
|
3828
|
+
/** The tenant id expression; it is cast to text. */
|
|
3829
|
+
readonly tenant?: string;
|
|
3830
|
+
/** A `text` idempotency key expression. */
|
|
3831
|
+
readonly key?: string;
|
|
3832
|
+
}
|
|
3833
|
+
/**
|
|
3834
|
+
* The categories module actions are audited under. An adopted log with its own
|
|
3835
|
+
* names maps them through `blocks.audit.options.values.category`.
|
|
3836
|
+
*/
|
|
3837
|
+
declare const AUDIT_CATEGORIES: readonly ["membership", "access", "security", "configuration", "billing", "data", "ai", "integration", "read"];
|
|
3838
|
+
type AuditCategory = (typeof AUDIT_CATEGORIES)[number];
|
|
3839
|
+
/** How `record` writes an action to the audit log, as SQL expressions. */
|
|
3840
|
+
interface BlockSqlAudit {
|
|
3841
|
+
/** The audit category, mapped through `blocks.audit.options.values`. */
|
|
3842
|
+
readonly category: AuditCategory;
|
|
3843
|
+
/** What the action changed, e.g. `user` or `api_key`. */
|
|
3844
|
+
readonly targetType?: string;
|
|
3845
|
+
/** A `text` expression for the changed record's id. */
|
|
3846
|
+
readonly recordId?: string;
|
|
3847
|
+
/** A `text` expression people recognize the target by. */
|
|
3848
|
+
readonly targetLabel?: string;
|
|
3849
|
+
/** A `text` expression that says what happened. */
|
|
3850
|
+
readonly summary?: string;
|
|
3851
|
+
/** A `jsonb` expression; defaults to the event payload. */
|
|
3852
|
+
readonly metadata?: string;
|
|
3853
|
+
/** A `uuid` expression for the actor; defaults to the caller. */
|
|
3854
|
+
readonly actor?: string;
|
|
3855
|
+
/**
|
|
3856
|
+
* A `uuid` expression for the support session the action belongs to. Defaults
|
|
3857
|
+
* to the session in the caller's `act` claim, which wins when set.
|
|
3858
|
+
*/
|
|
3859
|
+
readonly supportSession?: string;
|
|
3860
|
+
/**
|
|
3861
|
+
* A `uuid` expression for the admin acting as the user; defaults to
|
|
3862
|
+
* `act.sub`.
|
|
3863
|
+
*/
|
|
3864
|
+
readonly impersonatedBy?: string;
|
|
3865
|
+
/**
|
|
3866
|
+
* A `text` expression for why the admin acts as the user; defaults to
|
|
3867
|
+
* `act.reason`.
|
|
3868
|
+
*/
|
|
3869
|
+
readonly impersonationReason?: string;
|
|
3870
|
+
}
|
|
3871
|
+
/**
|
|
3872
|
+
* An action a module records once: the outbox gets it as an event and the audit
|
|
3873
|
+
* log as an entry, each when its module is installed.
|
|
3874
|
+
*/
|
|
3875
|
+
interface BlockSqlAction extends BlockSqlEmit {
|
|
3876
|
+
/**
|
|
3877
|
+
* How the action is audited, or `false` for an event that is not an audited
|
|
3878
|
+
* action, such as a chat message or a run status.
|
|
3879
|
+
*/
|
|
3880
|
+
readonly audit: BlockSqlAudit | false;
|
|
3881
|
+
}
|
|
3882
|
+
/**
|
|
3883
|
+
* A function of a module's contract: what other modules and the TypeScript side
|
|
3884
|
+
* call.
|
|
3885
|
+
*/
|
|
3886
|
+
interface BlockSqlContractFunction {
|
|
3887
|
+
readonly name: string;
|
|
3888
|
+
/** Argument types; `{id}` stands for the module's id type. */
|
|
3889
|
+
readonly args: readonly string[];
|
|
3890
|
+
readonly returns: string;
|
|
3891
|
+
}
|
|
3892
|
+
/** What a module's `build` reads: resolved names for one layout. */
|
|
3893
|
+
interface BlockSqlContext {
|
|
3894
|
+
readonly module: string;
|
|
3895
|
+
/**
|
|
3896
|
+
* The instance being rendered: the module's name, or the `blocks` key of an
|
|
3897
|
+
* instance that installs the module under another name.
|
|
3898
|
+
*/
|
|
3899
|
+
readonly instance: string;
|
|
3900
|
+
/**
|
|
3901
|
+
* `blocks.<instance>.on`: the record types the instance attaches to, as a
|
|
3902
|
+
* list or keyed by type with settings. Unset, it attaches to every one.
|
|
3903
|
+
*/
|
|
3904
|
+
readonly on: InstanceOn | undefined;
|
|
3905
|
+
readonly mode: BlockMode;
|
|
3906
|
+
readonly config: ResolvedBlock;
|
|
3907
|
+
/** The quoted schema of the module's functions and managed tables. */
|
|
3908
|
+
readonly schema: string;
|
|
3909
|
+
readonly schemaName: string;
|
|
3910
|
+
readonly idType: BlockSqlIdType;
|
|
3911
|
+
readonly claims: ClaimsMeta;
|
|
3912
|
+
readonly modules: AnyBlocksConfig;
|
|
3913
|
+
/** The app-wide subject registry (`config.records`). */
|
|
3914
|
+
readonly subjects: SubjectsConfig;
|
|
3915
|
+
/**
|
|
3916
|
+
* The names of `config.appTables`, created in `public` after every block
|
|
3917
|
+
* file, so a block can't put a trigger on one (ADR 0043).
|
|
3918
|
+
*/
|
|
3919
|
+
readonly appTables: ReadonlySet<string>;
|
|
3920
|
+
/**
|
|
3921
|
+
* Who the module's rows belong to, and the checks for it: the port every
|
|
3922
|
+
* tenant, user or shared-space check goes through.
|
|
3923
|
+
*/
|
|
3924
|
+
readonly scope: BlockSqlScope;
|
|
3925
|
+
/**
|
|
3926
|
+
* The module's final names: its entities as `blocks.<name>.entities` and
|
|
3927
|
+
* `blocks.memberships.names.organization` rename them.
|
|
3928
|
+
*/
|
|
3929
|
+
readonly resolved: ResolvedNames;
|
|
3930
|
+
/** The renamer every default name goes through (`resolved.naming`). */
|
|
3931
|
+
readonly naming: EntityNames;
|
|
3932
|
+
/**
|
|
3933
|
+
* Every configured block's entity renames as one, for names that span blocks,
|
|
3934
|
+
* such as the permission keys in the default roles.
|
|
3935
|
+
*/
|
|
3936
|
+
blockNaming(): EntityNames;
|
|
3937
|
+
/**
|
|
3938
|
+
* The entity renames of each block installed under another name, such as
|
|
3939
|
+
* `tickets` from `tasks`, for the permission keys each instance adds.
|
|
3940
|
+
*/
|
|
3941
|
+
instanceNamings(): readonly EntityNames[];
|
|
3942
|
+
/**
|
|
3943
|
+
* What the installed instances whose `uses` names this instance add to it
|
|
3944
|
+
* through `contributes`, in block order. Custom-mode instances add nothing.
|
|
3945
|
+
*/
|
|
3946
|
+
contributions<K extends keyof BlockContributions>(block: K): readonly BlockContributions[K][];
|
|
3947
|
+
/**
|
|
3948
|
+
* `schema.name` of a module function, quoted. The name is the default one;
|
|
3949
|
+
* `blocks.<name>.entities` and `blocks.<name>.functions` rename it.
|
|
3950
|
+
*/
|
|
3951
|
+
fn(name: string): string;
|
|
3952
|
+
/** The unquoted name a module function is written under (see `fn`). */
|
|
3953
|
+
fnName(name: string): string;
|
|
3954
|
+
/** `blocks.<name>.functions` keys no `fn` call has asked for yet. */
|
|
3955
|
+
unusedFunctions(): readonly string[];
|
|
3956
|
+
/** Default name to written name, for every function `fn` renamed so far. */
|
|
3957
|
+
functionRenames(): ReadonlyMap<string, string>;
|
|
3958
|
+
/** `schema.table` of a logical table, quoted. */
|
|
3959
|
+
table(logical: string): string;
|
|
3960
|
+
/** The unquoted schema and name of a logical table. */
|
|
3961
|
+
tableName(logical: string): {
|
|
3962
|
+
readonly schema: string;
|
|
3963
|
+
readonly name: string;
|
|
3964
|
+
};
|
|
3965
|
+
/** A logical column, quoted. Throws when an adopted table lacks it. */
|
|
3966
|
+
col(table: string, column: string): string;
|
|
3967
|
+
/** A logical column, unquoted. Throws when an adopted table lacks it. */
|
|
3968
|
+
colName(table: string, column: string): string;
|
|
3969
|
+
/** Whether a logical column exists (adopted tables can map it to `null`). */
|
|
3970
|
+
has(table: string, column: string): boolean;
|
|
3971
|
+
/**
|
|
3972
|
+
* `value`, a text expression, as the type of a logical column the table spec
|
|
3973
|
+
* lists in `typed`. On a table the app has, the column may be an enum or
|
|
3974
|
+
* another type with a text input, so the value goes through
|
|
3975
|
+
* `better_supabase.as_column_type`; on the module's own table it stays as it
|
|
3976
|
+
* is.
|
|
3977
|
+
*/
|
|
3978
|
+
cast(table: string, column: string, value: string): string;
|
|
3979
|
+
/** Whether an optional logical table exists (it can be mapped to `null`). */
|
|
3980
|
+
hasTable(table: string): boolean;
|
|
3981
|
+
/** Whether the module renders its managed SQL (not adopt or custom mode). */
|
|
3982
|
+
readonly manages: boolean;
|
|
3983
|
+
/** Whether the module creates `table`, which the app doesn't have. */
|
|
3984
|
+
owns(table: string): boolean;
|
|
3985
|
+
/** The logical tables the app has; the module only adds their columns. */
|
|
3986
|
+
readonly appOwned: readonly string[];
|
|
3987
|
+
readonly names: BlockSqlNames;
|
|
3988
|
+
readonly installedModules: readonly string[];
|
|
3989
|
+
/** The permission key for a module action, as a SQL literal. */
|
|
3990
|
+
permission(action: string, fallback: string): string;
|
|
3991
|
+
/** The permission key for a module action. */
|
|
3992
|
+
permissionKey(action: string, fallback: string): string;
|
|
3993
|
+
/** A trigger name with the module's prefix, quoted. */
|
|
3994
|
+
trigger(name: string): string;
|
|
3995
|
+
/** Whether `module` is installed alongside this one. */
|
|
3996
|
+
installed(module: string): boolean;
|
|
3997
|
+
/** The context of another module in the same layout. */
|
|
3998
|
+
of(module: string): BlockSqlContext;
|
|
3999
|
+
/** A string module option (`blocks.<name>.options`). */
|
|
4000
|
+
text(name: string, fallback: string): string;
|
|
4001
|
+
number(name: string, fallback: number): number;
|
|
4002
|
+
flag(name: string, fallback: boolean): boolean;
|
|
4003
|
+
/** A module option that is a list of strings. */
|
|
4004
|
+
list(name: string, fallback: readonly string[]): readonly string[];
|
|
4005
|
+
/** A declared module option as configured, for object-shaped options. */
|
|
4006
|
+
option(name: string): unknown;
|
|
4007
|
+
/**
|
|
4008
|
+
* `options.extraColumns` (column name to SQL type), checked: names are
|
|
4009
|
+
* lower-case identifiers, types are SQL types, and no name shadows one of
|
|
4010
|
+
* `table`'s mapped columns or a key in `reserved`, the stable keys the
|
|
4011
|
+
* module's read functions return next to them.
|
|
4012
|
+
*/
|
|
4013
|
+
extraColumns(table: string, reserved?: readonly string[]): readonly ExtraColumn[];
|
|
4014
|
+
/**
|
|
4015
|
+
* PL/pgSQL that calls the app's hook function when it exists, with `[type,
|
|
4016
|
+
* expression]` arguments: `if to_regprocedure(...) is not null then execute
|
|
4017
|
+
* format(...) using ...; end if;`. The name comes from `to_regprocedure`
|
|
4018
|
+
* rather than a literal: plpgsql_check (`supabase db lint`) checks constant
|
|
4019
|
+
* dynamic SQL and fails when the hook is missing.
|
|
4020
|
+
*/
|
|
4021
|
+
hook(name: string, args: readonly (readonly [string, string])[]): string;
|
|
4022
|
+
/** The app function a hook calls, quoted, for hooks that return a value. */
|
|
4023
|
+
hookTarget(name: string): string;
|
|
4024
|
+
/**
|
|
4025
|
+
* PL/pgSQL that writes the event to the outbox (`emit_event`) when the
|
|
4026
|
+
* `outbox` module is installed and `blocks.<name>.events` isn't false;
|
|
4027
|
+
* otherwise an empty string. `record` without the audit entry.
|
|
4028
|
+
*/
|
|
4029
|
+
emit(event: BlockSqlEmit): string;
|
|
4030
|
+
/**
|
|
4031
|
+
* PL/pgSQL that writes the action to the outbox (as `emit` does) and, when it
|
|
4032
|
+
* carries `audit` and the `audit` module is installed, to the audit log
|
|
4033
|
+
* (`audit_event`), with `key` as the idempotency key of both. `null;` when
|
|
4034
|
+
* neither applies, so it is always a valid statement.
|
|
4035
|
+
*/
|
|
4036
|
+
record(action: BlockSqlAction): string;
|
|
4037
|
+
/**
|
|
4038
|
+
* PL/pgSQL that writes the action to the audit log only, with no outbox
|
|
4039
|
+
* event, for reads that leave no change behind. `null;` without the `audit`
|
|
4040
|
+
* module or when `audit` is `false`.
|
|
4041
|
+
*/
|
|
4042
|
+
audit(action: BlockSqlAction): string;
|
|
4043
|
+
/**
|
|
4044
|
+
* PL/pgSQL that calls `notify(fields)` as the service role, which `notify()`
|
|
4045
|
+
* requires, then restores the caller's claims. The function declares
|
|
4046
|
+
* `v_claims text`. `null;` without the `notifications` module.
|
|
4047
|
+
*/
|
|
4048
|
+
notify(fields: string, options?: {
|
|
4049
|
+
readonly indent?: string;
|
|
4050
|
+
}): string;
|
|
4051
|
+
/**
|
|
4052
|
+
* PL/pgSQL that enqueues a job (`enqueue_job`); `null;` without the `jobs`
|
|
4053
|
+
* module. `delay` is an integer expression of seconds before it runs.
|
|
4054
|
+
*/
|
|
4055
|
+
enqueue(queue: string, payload: string, dedupe: string, options?: {
|
|
4056
|
+
readonly delay?: string;
|
|
4057
|
+
}): string;
|
|
4058
|
+
/**
|
|
4059
|
+
* Row SQL for `data` that ships an automation as a default rule
|
|
4060
|
+
* (`rule_defaults`): every organization gets its own copy, which it may turn
|
|
4061
|
+
* off or edit. The trigger and subject type follow the module's entity
|
|
4062
|
+
* renames. `''` without the `automations` module or a block in `requires`.
|
|
4063
|
+
*/
|
|
4064
|
+
automation(spec: DefaultAutomation): string;
|
|
4065
|
+
/**
|
|
4066
|
+
* The `text[]` of a tenant's entitlements, or `fallback` without the
|
|
4067
|
+
* `entitlements` module.
|
|
4068
|
+
*/
|
|
4069
|
+
entitlements(tenant: string): string | undefined;
|
|
4070
|
+
entitlements(tenant: string, fallback: string): string;
|
|
4071
|
+
/**
|
|
4072
|
+
* How long rows of `kind` are kept for `tenant` (SQL expressions): the
|
|
4073
|
+
* data-lifecycle policy for the tenant, its plan or every tenant, else
|
|
4074
|
+
* `fallback`; just `fallback` without the `data-lifecycle` module.
|
|
4075
|
+
*/
|
|
4076
|
+
retention(kind: string, tenant: string, fallback: string): string;
|
|
4077
|
+
/**
|
|
4078
|
+
* Whether a legal hold covers `kind` for `tenant`; `false` without the
|
|
4079
|
+
* `data-lifecycle` module.
|
|
4080
|
+
*/
|
|
4081
|
+
held(kind: string, tenant: string): string;
|
|
4082
|
+
/**
|
|
4083
|
+
* The condition a purge deletes on: the row's timestamp `at` is past
|
|
4084
|
+
* `retention` and no hold covers it. With data-lifecycle it first bounds `at`
|
|
4085
|
+
* by the shortest policy, so the timestamp index still serves.
|
|
4086
|
+
*/
|
|
4087
|
+
expired(kind: string, row: {
|
|
4088
|
+
readonly at: string;
|
|
4089
|
+
readonly tenant: string;
|
|
4090
|
+
readonly fallback: string;
|
|
4091
|
+
}): string;
|
|
4092
|
+
/**
|
|
4093
|
+
* Before when every tenant's rows of `kind` may go (a timestamptz
|
|
4094
|
+
* expression), for dropping whole partitions: null under any hold on the
|
|
4095
|
+
* kind, else the longest policy or `fallback`; `now() - fallback` without the
|
|
4096
|
+
* `data-lifecycle` module.
|
|
4097
|
+
*/
|
|
4098
|
+
cutoff(kind: string, fallback: string): string;
|
|
4099
|
+
/**
|
|
4100
|
+
* PL/pgSQL that broadcasts on a Realtime topic when `realtime.send` exists:
|
|
4101
|
+
* projects without Realtime skip it.
|
|
4102
|
+
*/
|
|
4103
|
+
broadcast(topic: string, event: string, payload: string, options?: {
|
|
4104
|
+
readonly indent?: string;
|
|
4105
|
+
}): string;
|
|
4106
|
+
/**
|
|
4107
|
+
* `coalesce(better_supabase.can(scope, id, permission), false)`; `permission`
|
|
4108
|
+
* is a SQL expression. The `tenant` scope goes through `scope.can`.
|
|
4109
|
+
*/
|
|
4110
|
+
can(scope: string, id: string, permission: string): string;
|
|
4111
|
+
/**
|
|
4112
|
+
* True for the service role and platform staff holding `permission` (a SQL
|
|
4113
|
+
* expression); the service role only without the `access` module.
|
|
4114
|
+
*/
|
|
4115
|
+
staff(permission: string): string;
|
|
4116
|
+
}
|
|
4117
|
+
/** A column from `options.extraColumns`. */
|
|
4118
|
+
interface ExtraColumn {
|
|
4119
|
+
/** The column name, as reads return it. */
|
|
4120
|
+
readonly name: string;
|
|
4121
|
+
/** The name, quoted. */
|
|
4122
|
+
readonly ident: string;
|
|
4123
|
+
/** Its SQL type, such as `text not null default 'en'`. */
|
|
4124
|
+
readonly type: string;
|
|
4125
|
+
}
|
|
4126
|
+
/** The contract's argument list with `{id}` resolved, as Postgres prints it. */
|
|
4127
|
+
declare function contractSignature(fn: BlockSqlContractFunction, idType: string): string;
|
|
4128
|
+
//#endregion
|
|
4129
|
+
export { flattenConfig as $, APP_COLUMN_FORMATS as $n, PresetCatalog as $r, ApiConfig as $t, valibot as A, GEN_TASKS as Ai, ExposeRole as An, CatalogPolicy as Ar, Generator as At, JsonSchemaTarget as B, PRESET_GROUPS as Bn, Snapshot as Br, GeneratorJsonSchema as Bt, blockSqlVersion as C, GenTask as Ci, TopicTriggerTopicConfig as Cn, CatalogColumnGrant as Cr, listNames as Ct, ZodGeneratorOptions as D, OpenApiConfig as Di, ColumnPrivilege as Dn, CatalogFunctionArg as Dr, ClaimsConfig as Dt, ZodFlavor as E, MigrationSafetyConfig as Ei, VectorSearchConfig as En, CatalogFunction as Er, resolveJsonSchema as Et, FactoriesGeneratorOptions as F, presetOfSpec as Fn, ExtrasFunction as Fr, GeneratorField as Ft, BlockEntity as G, isPresetName as Gn, PostgresFunction as Gr, JsonTypeConfig as Gt, DEFAULT_CLAIMS as H, PresetGroup as Hn, SnapshotExtras as Hr, GeneratorNoun as Ht, factories as I, presetSpec as In, ExtrasHook as Ir, GeneratorFunction as It, blockSubjectTypes as J, DeclaredForeignKey as Jn, RpcFunctionArg as Jr, TableConfig as Jt, blockEntities as K, namedPreset as Kn, PostgresFunctionArg as Kr, RelationsConfig as Kt, JsonSchemaGeneratorOptions as L, DEFAULT_PRESET_NAME as Ln, ExtrasHookFunction as Lr, GeneratorFunctionArg as Lt, standardSchema as M, INTEGRATION_NAMES as Mi, ResolvedExpose as Mn, CatalogTrigger as Mr, GeneratorBlockEntity as Mt, NuqsGeneratorOptions as N, IntegrationInfo as Ni, PresetSpec as Nn, CatalogUnique as Nr, GeneratorColumn as Nt, zod as O, SkillsAgent as Oi, ExposeConfig as On, CatalogGrant as Or, CodecsConfig as Ot, nuqs as P, SKILLS_AGENTS as Pi, presetFromSpec as Pn, ExtrasDomain as Pr, GeneratorEntitySchemas as Pt, blockEntrySource as Q, APP_COLUMN_ACCESS as Qn, RpcTypeReference as Qr, ResolvedExtensions as Qt, buildJsonSchema as R, NamedPreset as Rn, ExtrasTable as Rr, GeneratorInput as Rt, BlockSqlUpgrade as S, GenConfig as Si, TopicTriggerPayloadValueConfig as Sn, CatalogColumn as Sr, ResolvedPresetBlock as St, TableGrant as T, KeysConfig as Ti, VectorDistance as Tn, CatalogForeignKey as Tr, resolvePreset as Tt, claimPaths as U, PresetName as Un, GeneratorMetadata as Ur, GeneratorTable as Ut, ClaimPaths as V, PRESET_NAMES as Vn, SnapshotBucket as Vr, GeneratorModel as Vt, tenantClaimPaths as W, defaultPreset as Wn, PostgresColumn as Wr, JsonSchemaSource as Wt, RENAMED_BLOCK_KEYS as X, AuditedTable as Xn, RpcFunctionReturns as Xr, FlatConfig as Xt, CONFIG_GROUPS as Y, sameTenantLayout as Yn, RpcFunctionOverload as Yr, DataHooksFramework as Yt, RENAMED_CONFIG_KEYS as Z, auditRegistrations as Zn, RpcReturnColumn as Zr, ResolvedConfig as Zt, BlockSqlDeprecation as _, integrationsForFramework as _i, SeedConfig as _n, AppTableSubject as _r, presetConfig as _t, BlockSqlContext as a, PRESET_FRAMEWORKS as ai, BlocksInput as an, AppColumnConfig as ar, resolveConfig as at, BlockSqlLayout as b, DoctorConfig as bi, TopicTriggerConfig as bn, Catalog as br, PresetIntegration as bt, BlockSqlIdType as c, PresetAccess as ci, GenGroupConfig as cn, AppLookupConfig as cr, BucketName as ct, MODULE_ID_TYPES as d, PresetFieldKey as di, ToolingConfig as dn, AppReferenceTarget as dr, TypedReference as dt, PresetCatalogBlock as ei, AppTableInput as en, APP_COLUMN_TYPES as er, groupConfig as et, contractSignature as f, PresetFieldValue as fi, EntitlementPlansSource as fn, AppRollupAggregate as fr, ConfigConventions as ft, BlockSqlAccessProvider as g, PresetValueInfo as gi, ResolvedSqlConfig as gn, AppTableEvents as gr, expandPreset as gt, BlockSql as h, PresetScope as hi, RealtimeConfig as hn, AppTableEventKind as hr, conventionConfig as ht, BlockSqlAudit as i, DEFAULT_CONVENTIONS as ii, BlockInput as in, AppColumnAccess as ir, defineConfig as it, StandardSchemaGeneratorOptions as j, INTEGRATION_INFO as ji, Privilege as jn, CatalogTable as jr, GeneratorBlock as jt, ValibotGeneratorOptions as k, SkillsConfig as ki, ExposePrivilege as kn, CatalogIndex as kr, GeneratedFile as kt, BlockSqlNames as l, PresetConventions as li, OrganizationConfig as ln, AppOnDeleteAction as lr, ConfigReferences as lt, moduleIdType as m, PresetPlatforms as mi, BucketConfig as mn, AppTableConfig as mr, PresetInput as mt, AuditCategory as n, PresetGlueItem as ni, AuthConfig as nn, APP_ROLLUP_AGGREGATES as nr, hasFlatTables as nt, BlockSqlContractFunction as o, PRESET_TENANT_NAMES as oi, DatabaseConfig as on, AppColumnFormat as or, AppTableNames as ot, isBlockSqlIdType as p, PresetFramework as pi, EntitlementsConfig as pn, AppRollupConfig as pr, ExpandedConfig as pt, blockEntityRenames as q, CONFIG_DEFAULTS as qn, RpcFunction as qr, SourceConfig as qt, BlockSqlAction as r, CONVENTION_FIELDS as ri, BetterSupabaseConfig as rn, APP_TABLE_EVENT_KINDS as rr, CONFIG_SCHEMA_URL as rt, BlockSqlEmit as s, Preset as si, EnvironmentConfig as sn, AppColumnType as sr, BlockTableReference as st, AUDIT_CATEGORIES as t, PresetCatalogManifest as ti, AppTablesInput as tn, APP_ON_DELETE_ACTIONS as tr, groupEntries as tt, BlockSqlTableSpec as u, PresetField as ui, SqlInput as un, AppReference as ur, RoleNames as ut, BlockSqlEntitlementsProvider as v, presetField as vi, SqlConfig as vn, AppTableVersions as vr, presetOf as vt, notNullCheckName as w, IntegrationName as wi, TopicTriggerValueConfig as wn, CatalogEnum as wr, presetBlockConflict as wt, BlockSqlTestFile as x, EnvFileConfig as xi, TopicTriggerLookupConfig as xn, CatalogCheck as xr, ResolvedPreset as xt, BlockSqlFile as y, presetValueLabel as yi, SqlWorkflow as yn, AppTablesConfig as yr, PresetConflict as yt, jsonSchema as z, PRESETS as zn, ForeignKeyAction as zr, GeneratorInputSchema as zt };
|