better-supabase 0.30.0 → 0.32.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/dist/access-sql-Dao1C0fz.js +383 -0
- package/dist/actor-B5b0i1Fs.js +149 -0
- package/dist/actor-DseNR02I.d.ts +104 -0
- package/dist/adapter-CPPN80mx.js +2231 -0
- package/dist/agents-BEiBtYmh.d.ts +115 -0
- package/dist/ai-cache-D9D36eh4.js +86 -0
- package/dist/ai-cache-FMYzw7lW.d.ts +80 -0
- package/dist/ai-chat-B_P--Ie2.d.ts +532 -0
- package/dist/ai-files-DCMVGSds.js +337 -0
- package/dist/ai-message-cnroprVB.js +13 -0
- package/dist/ai-schedules-D_q1iclL.d.ts +164 -0
- package/dist/ai-sdk/agents/index.d.ts +8 -12
- package/dist/ai-sdk/agents/index.js +10 -12
- package/dist/ai-sdk/batches/index.d.ts +12 -7
- package/dist/ai-sdk/batches/index.js +16 -9
- package/dist/ai-sdk/cache/index.d.ts +2 -4
- package/dist/ai-sdk/cache/index.js +3 -4
- package/dist/ai-sdk/chat/index.d.ts +77 -2
- package/dist/ai-sdk/chat/index.js +179 -28
- package/dist/ai-sdk/embeddings/index.d.ts +2 -2
- package/dist/ai-sdk/embeddings/index.js +1 -1
- package/dist/ai-sdk/files/index.d.ts +3 -5
- package/dist/ai-sdk/files/index.js +5 -6
- package/dist/ai-sdk/index.d.ts +75 -21
- package/dist/ai-sdk/index.js +112 -66
- package/dist/ai-sdk/mcp/index.d.ts +28 -13
- package/dist/ai-sdk/mcp/index.js +56 -17
- package/dist/ai-sdk/memory/index.d.ts +3 -5
- package/dist/ai-sdk/memory/index.js +3 -4
- package/dist/ai-sdk/react/index.d.ts +2 -2
- package/dist/ai-sdk/react/index.js +3 -1
- package/dist/ai-sdk/react/server.d.ts +7 -4
- package/dist/ai-sdk/react/server.js +10 -3
- package/dist/ai-sdk/workflow/index.d.ts +12 -13
- package/dist/ai-sdk/workflow/index.js +17 -17
- package/dist/ai-sdk/workflow/react/index.d.ts +1 -3
- package/dist/ai-sdk/workflow/react/index.js +3 -3
- package/dist/ai-sdk/workflow/react/server.d.ts +1 -3
- package/dist/ai-sdk/workflow/react/server.js +1 -2
- package/dist/anchors-sCLvYj-8.d.ts +36 -0
- package/dist/api-CwzVbbw4.d.ts +483 -0
- package/dist/api-keys-u2sXB-CZ.d.ts +211 -0
- package/dist/api-wwix_K5c.js +691 -0
- package/dist/app-tables-DomvYx5b.d.ts +26 -0
- package/dist/approvals-Da4uAANx.js +166 -0
- package/dist/approvals-idpuhILk.d.ts +127 -0
- package/dist/assistant-CMKsaeJd.d.ts +209 -0
- package/dist/astro/index.d.ts +8 -10
- package/dist/astro/index.js +8 -9
- package/dist/attachments-BWtUQgsL.js +375 -0
- package/dist/attributes-BZNkR2z2.js +51 -0
- package/dist/auth-link-BmJsQG4a.js +117 -0
- package/dist/auth-link-DRjtI1Ky.d.ts +102 -0
- package/dist/auth-module-CVo86UKh.js +50 -0
- package/dist/auth-reply-BMPJQssh.d.ts +9 -0
- package/dist/auth-reply-Cnwn3I_q.js +30 -0
- package/dist/auth-wFlGgwTZ.js +19 -0
- package/dist/authorization-CYu_UKX4.d.ts +3723 -0
- package/dist/authorization-hooks-CldgvzBZ.d.ts +219 -0
- package/dist/authorizer-AswD5q6g.d.ts +116 -0
- package/dist/authorizer-D6po_XZA.js +171 -0
- package/dist/automation-acq3iK9y.js +74 -0
- package/dist/automations-BfH8GJqv.js +27 -0
- package/dist/automations-Bw5cX7oj.js +29 -0
- package/dist/automations-CCc5RUw-.js +31 -0
- package/dist/automations-Dou1t3lt.js +313 -0
- package/dist/availability-CebEOfMN.d.ts +236 -0
- package/dist/base64-CVyKHBBw.js +41 -0
- package/dist/batch-limit-DqQ3d6op.js +4 -0
- package/dist/before-route-Ra3OhI2x.js +29 -0
- package/dist/better-result/index.d.ts +4 -6
- package/dist/better-result/index.js +2 -3
- package/dist/bind-8LYVJE5W.d.ts +102 -0
- package/dist/block-authors-C5z3tGVu.d.ts +10 -0
- package/dist/block-authors-DCQ4zl8e.js +13 -0
- package/dist/block-env-BsLgZL2l.d.ts +30 -0
- package/dist/block-event-listener-DCi7c89M.js +15 -0
- package/dist/block-events-Bp6GPIBN.js +82 -0
- package/dist/block-fields-Bjcv6_zc.js +139 -0
- package/dist/block-fields-Puv5m5D3.d.ts +56 -0
- package/dist/block-helpers-I7UzjNEf.js +435 -0
- package/dist/block-helpers-JxiD1iw4.d.ts +56 -0
- package/dist/block-hooks-CJP5kGEa.d.ts +115 -0
- package/dist/block-hooks-CadxQ9-_.js +129 -0
- package/dist/block-method-DIbWG4Mj.js +20 -0
- package/dist/block-method-QSaPsL2P.d.ts +12 -0
- package/dist/block-subjects-SyJwfgrX.d.ts +4 -0
- package/dist/block-subjects-cRlVtKDO.js +54 -0
- package/dist/block-tenant-Bun03JuO.js +13 -0
- package/dist/block-transport-Bbf1ZZre.d.ts +67 -0
- package/dist/blocks/access-requests/index.d.ts +9 -15
- package/dist/blocks/access-requests/index.js +11 -14
- package/dist/blocks/activities/index.d.ts +13 -21
- package/dist/blocks/activities/index.js +16 -21
- package/dist/blocks/agents/index.d.ts +4 -8
- package/dist/blocks/agents/index.js +11 -14
- package/dist/blocks/ai-cache/index.d.ts +3 -5
- package/dist/blocks/ai-cache/index.js +5 -6
- package/dist/blocks/ai-chat/index.d.ts +10 -19
- package/dist/blocks/ai-chat/index.js +20 -28
- package/dist/blocks/ai-files/index.d.ts +5 -9
- package/dist/blocks/ai-files/index.js +5 -6
- package/dist/blocks/ai-keys/index.d.ts +4 -10
- package/dist/blocks/ai-keys/index.js +14 -18
- package/dist/blocks/ai-schedules/index.d.ts +3 -5
- package/dist/blocks/ai-schedules/index.js +14 -16
- package/dist/blocks/announcements/index.d.ts +12 -20
- package/dist/blocks/announcements/index.js +12 -16
- package/dist/blocks/api-keys/index.d.ts +8 -16
- package/dist/blocks/api-keys/index.js +17 -22
- package/dist/blocks/approvals/index.d.ts +4 -8
- package/dist/blocks/approvals/index.js +7 -173
- package/dist/blocks/assets/index.d.ts +9 -17
- package/dist/blocks/assets/index.js +13 -17
- package/dist/blocks/assignment/index.d.ts +9 -17
- package/dist/blocks/assignment/index.js +10 -14
- package/dist/blocks/attachments/index.d.ts +6 -18
- package/dist/blocks/attachments/index.js +19 -24
- package/dist/blocks/audit/index.d.ts +15 -31
- package/dist/blocks/audit/index.js +27 -35
- package/dist/blocks/automations/index.d.ts +14 -26
- package/dist/blocks/automations/index.js +18 -23
- package/dist/blocks/billable-time/index.d.ts +9 -19
- package/dist/blocks/billable-time/index.js +15 -20
- package/dist/blocks/billing/index.d.ts +12 -22
- package/dist/blocks/billing/index.js +19 -24
- package/dist/blocks/bookings/index.d.ts +8 -18
- package/dist/blocks/bookings/index.js +17 -23
- package/dist/blocks/bulk/index.d.ts +6 -12
- package/dist/blocks/bulk/index.js +10 -13
- package/dist/blocks/calendar/index.d.ts +18 -24
- package/dist/blocks/calendar/index.js +39 -32
- package/dist/blocks/catalog/index.d.ts +12 -20
- package/dist/blocks/catalog/index.js +17 -21
- package/dist/blocks/channels/index.d.ts +9 -17
- package/dist/blocks/channels/index.js +11 -15
- package/dist/blocks/collections/index.d.ts +11 -17
- package/dist/blocks/collections/index.js +13 -16
- package/dist/blocks/comments/index.d.ts +16 -26
- package/dist/blocks/comments/index.js +21 -26
- package/dist/blocks/compliance/index.d.ts +9 -17
- package/dist/blocks/compliance/index.js +13 -17
- package/dist/blocks/connectors/index.d.ts +4 -8
- package/dist/blocks/connectors/index.js +13 -16
- package/dist/blocks/contacts/index.d.ts +10 -18
- package/dist/blocks/contacts/index.js +12 -16
- package/dist/blocks/content/index.d.ts +8 -16
- package/dist/blocks/content/index.js +13 -17
- package/dist/blocks/contracts/index.d.ts +11 -21
- package/dist/blocks/contracts/index.js +17 -22
- package/dist/blocks/courses/index.d.ts +11 -21
- package/dist/blocks/courses/index.js +17 -22
- package/dist/blocks/created-by/index.d.ts +3 -7
- package/dist/blocks/created-by/index.js +4 -5
- package/dist/blocks/custom-fields/index.d.ts +10 -16
- package/dist/blocks/custom-fields/index.js +13 -16
- package/dist/blocks/data-lifecycle/index.d.ts +10 -26
- package/dist/blocks/data-lifecycle/index.js +17 -23
- package/dist/blocks/deals/index.d.ts +12 -20
- package/dist/blocks/deals/index.js +18 -22
- package/dist/blocks/dispatch/index.d.ts +11 -23
- package/dist/blocks/dispatch/index.js +19 -24
- package/dist/blocks/documents/index.d.ts +4 -8
- package/dist/blocks/documents/index.js +9 -12
- package/dist/blocks/domains/index.d.ts +8 -14
- package/dist/blocks/domains/index.js +12 -15
- package/dist/blocks/donations/index.d.ts +13 -23
- package/dist/blocks/donations/index.js +21 -26
- package/dist/blocks/drive/index.d.ts +116 -20
- package/dist/blocks/drive/index.js +138 -26
- package/dist/blocks/employees/index.d.ts +13 -23
- package/dist/blocks/employees/index.js +19 -27
- package/dist/blocks/enrichment/index.d.ts +8 -16
- package/dist/blocks/enrichment/index.js +11 -15
- package/dist/blocks/enrollments/index.d.ts +9 -17
- package/dist/blocks/enrollments/index.js +13 -17
- package/dist/blocks/entitlements/index.d.ts +8 -14
- package/dist/blocks/entitlements/index.js +8 -11
- package/dist/blocks/expenses/index.d.ts +22 -19
- package/dist/blocks/expenses/index.js +25 -23
- package/dist/blocks/field-history/index.d.ts +6 -10
- package/dist/blocks/field-history/index.js +5 -7
- package/dist/blocks/flags/index.d.ts +49 -20
- package/dist/blocks/flags/index.js +65 -19
- package/dist/blocks/forecasts/index.d.ts +10 -16
- package/dist/blocks/forecasts/index.js +11 -14
- package/dist/blocks/forms/index.d.ts +11 -25
- package/dist/blocks/forms/index.js +17 -24
- package/dist/blocks/goals/index.d.ts +8 -12
- package/dist/blocks/goals/index.js +9 -11
- package/dist/blocks/guests/index.d.ts +9 -19
- package/dist/blocks/guests/index.js +14 -19
- package/dist/blocks/hiring/index.d.ts +10 -18
- package/dist/blocks/hiring/index.js +12 -15
- package/dist/blocks/identities/index.d.ts +7 -11
- package/dist/blocks/identities/index.js +7 -9
- package/dist/blocks/imports/index.d.ts +8 -18
- package/dist/blocks/imports/index.js +11 -16
- package/dist/blocks/inbox/index.d.ts +11 -21
- package/dist/blocks/inbox/index.js +26 -23
- package/dist/blocks/incidents/index.d.ts +9 -17
- package/dist/blocks/incidents/index.js +14 -18
- package/dist/blocks/index.d.ts +14 -20
- package/dist/blocks/index.js +17 -20
- package/dist/blocks/inventory/index.d.ts +11 -17
- package/dist/blocks/inventory/index.js +12 -15
- package/dist/blocks/invoices/index.d.ts +34 -21
- package/dist/blocks/invoices/index.js +31 -18
- package/dist/blocks/knowledge/index.d.ts +3 -5
- package/dist/blocks/knowledge/index.js +5 -6
- package/dist/blocks/lead-scoring/index.d.ts +10 -14
- package/dist/blocks/lead-scoring/index.js +11 -13
- package/dist/blocks/leases/index.d.ts +11 -21
- package/dist/blocks/leases/index.js +20 -25
- package/dist/blocks/leave/index.d.ts +50 -17
- package/dist/blocks/leave/index.js +35 -14
- package/dist/blocks/ledger/index.d.ts +9 -17
- package/dist/blocks/ledger/index.js +13 -17
- package/dist/blocks/mail-sync/index.d.ts +6 -12
- package/dist/blocks/mail-sync/index.js +26 -25
- package/dist/blocks/memberships/index.d.ts +5 -9
- package/dist/blocks/memberships/index.js +4 -5
- package/dist/blocks/memory/index.d.ts +4 -8
- package/dist/blocks/memory/index.js +12 -15
- package/dist/blocks/messaging/index.d.ts +14 -24
- package/dist/blocks/messaging/index.js +19 -24
- package/dist/blocks/metrics/index.d.ts +9 -17
- package/dist/blocks/metrics/index.js +14 -18
- package/dist/blocks/mfa/index.d.ts +5 -9
- package/dist/blocks/mfa/index.js +7 -9
- package/dist/blocks/moderation/index.d.ts +9 -17
- package/dist/blocks/moderation/index.js +13 -17
- package/dist/blocks/notifications/index.d.ts +18 -34
- package/dist/blocks/notifications/index.js +36 -84
- package/dist/blocks/numbering/index.d.ts +6 -12
- package/dist/blocks/numbering/index.js +8 -11
- package/dist/blocks/oauth-server/index.d.ts +7 -13
- package/dist/blocks/oauth-server/index.js +12 -15
- package/dist/blocks/onboarding/index.d.ts +7 -13
- package/dist/blocks/onboarding/index.js +8 -11
- package/dist/blocks/orders/index.d.ts +17 -29
- package/dist/blocks/orders/index.js +22 -28
- package/dist/blocks/organizations/index.d.ts +43 -40
- package/dist/blocks/organizations/index.js +21 -20
- package/dist/blocks/outbox/index.d.ts +4 -6
- package/dist/blocks/outbox/index.js +11 -13
- package/dist/blocks/passes/index.d.ts +12 -22
- package/dist/blocks/passes/index.js +20 -25
- package/dist/blocks/permissions/index.d.ts +74 -15
- package/dist/blocks/permissions/index.js +119 -18
- package/dist/blocks/pipelines/index.d.ts +12 -18
- package/dist/blocks/pipelines/index.js +12 -15
- package/dist/blocks/posts/index.d.ts +10 -18
- package/dist/blocks/posts/index.js +15 -19
- package/dist/blocks/profiles/index.d.ts +8 -12
- package/dist/blocks/profiles/index.js +9 -11
- package/dist/blocks/promotions/index.d.ts +11 -17
- package/dist/blocks/promotions/index.js +13 -16
- package/dist/blocks/push/index.d.ts +19 -17
- package/dist/blocks/push/index.js +33 -20
- package/dist/blocks/queue/index.d.ts +187 -39
- package/dist/blocks/queue/index.js +226 -60
- package/dist/blocks/quotes/index.d.ts +13 -21
- package/dist/blocks/quotes/index.js +14 -17
- package/dist/blocks/rank/index.d.ts +7 -13
- package/dist/blocks/rank/index.js +8 -10
- package/dist/blocks/reactions/index.d.ts +11 -19
- package/dist/blocks/reactions/index.js +13 -17
- package/dist/blocks/relations/index.d.ts +11 -21
- package/dist/blocks/relations/index.js +18 -23
- package/dist/blocks/reminders/index.d.ts +12 -22
- package/dist/blocks/reminders/index.js +21 -25
- package/dist/blocks/reviews/index.d.ts +9 -15
- package/dist/blocks/reviews/index.js +11 -14
- package/dist/blocks/saved-views/index.d.ts +11 -21
- package/dist/blocks/saved-views/index.js +16 -21
- package/dist/blocks/scores/index.d.ts +6 -12
- package/dist/blocks/scores/index.js +10 -13
- package/dist/blocks/search/index.d.ts +9 -19
- package/dist/blocks/search/index.js +15 -19
- package/dist/blocks/security-events/index.d.ts +10 -24
- package/dist/blocks/security-events/index.js +17 -23
- package/dist/blocks/segments/index.d.ts +10 -18
- package/dist/blocks/segments/index.js +11 -15
- package/dist/blocks/sequences/index.d.ts +9 -17
- package/dist/blocks/sequences/index.js +15 -19
- package/dist/blocks/service-accounts/index.d.ts +9 -15
- package/dist/blocks/service-accounts/index.js +11 -14
- package/dist/blocks/sessions/index.d.ts +4 -8
- package/dist/blocks/sessions/index.js +9 -11
- package/dist/blocks/settings/index.d.ts +8 -16
- package/dist/blocks/settings/index.js +14 -18
- package/dist/blocks/share-links/index.d.ts +9 -17
- package/dist/blocks/share-links/index.js +16 -20
- package/dist/blocks/shipments/index.d.ts +14 -24
- package/dist/blocks/shipments/index.js +25 -31
- package/dist/blocks/signatures/index.d.ts +10 -16
- package/dist/blocks/signatures/index.js +10 -13
- package/dist/blocks/signing-keys/index.d.ts +5 -9
- package/dist/blocks/signing-keys/index.js +8 -10
- package/dist/blocks/sla/index.d.ts +11 -19
- package/dist/blocks/sla/index.js +17 -21
- package/dist/blocks/sso/index.d.ts +7 -19
- package/dist/blocks/sso/index.js +14 -21
- package/dist/blocks/state-machine/index.d.ts +7 -13
- package/dist/blocks/state-machine/index.js +9 -12
- package/dist/blocks/subjects/index.d.ts +7 -11
- package/dist/blocks/subjects/index.js +12 -14
- package/dist/blocks/tags/index.d.ts +11 -21
- package/dist/blocks/tags/index.js +20 -25
- package/dist/blocks/tasks/index.d.ts +13 -27
- package/dist/blocks/tasks/index.js +22 -29
- package/dist/blocks/teams/index.d.ts +15 -15
- package/dist/blocks/teams/index.js +17 -19
- package/dist/blocks/templates/index.d.ts +12 -22
- package/dist/blocks/templates/index.js +16 -21
- package/dist/blocks/time-tracking/index.d.ts +31 -25
- package/dist/blocks/time-tracking/index.js +29 -29
- package/dist/blocks/timeline/index.d.ts +10 -14
- package/dist/blocks/timeline/index.js +11 -13
- package/dist/blocks/trash/index.d.ts +10 -18
- package/dist/blocks/trash/index.js +11 -14
- package/dist/blocks/undo/index.d.ts +4 -8
- package/dist/blocks/undo/index.js +6 -8
- package/dist/blocks/updated-at/index.d.ts +3 -7
- package/dist/blocks/updated-at/index.js +4 -5
- package/dist/blocks/usage/index.d.ts +6 -10
- package/dist/blocks/usage/index.js +10 -13
- package/dist/blocks/vercel-marketplace/index.d.ts +9 -17
- package/dist/blocks/vercel-marketplace/index.js +17 -21
- package/dist/blocks/versions/index.d.ts +10 -20
- package/dist/blocks/versions/index.js +17 -22
- package/dist/blocks/waitlist/index.d.ts +10 -16
- package/dist/blocks/waitlist/index.js +11 -14
- package/dist/blocks/webhooks/index.d.ts +16 -34
- package/dist/blocks/webhooks/index.js +33 -44
- package/dist/blocks/workflow-editor/index.d.ts +13 -21
- package/dist/blocks/workflow-editor/index.js +21 -27
- package/dist/blocks/workflows/index.d.ts +8 -14
- package/dist/blocks/workflows/index.js +14 -18
- package/dist/bookings-DG443336.d.ts +285 -0
- package/dist/bucket-Clq5xINQ.d.ts +693 -0
- package/dist/build-Ckxct2EX.js +2065 -0
- package/dist/build-D1-V9dd8.js +732 -0
- package/dist/carrier-D2b_028L.d.ts +165 -0
- package/dist/casing-DQzG9ANZ.js +15 -0
- package/dist/channel-B_kufDZy.d.ts +101 -0
- package/dist/channels-BxeTTtCY.js +113 -0
- package/dist/chat-sdk/index.d.ts +174 -41
- package/dist/chat-sdk/index.js +425 -83
- package/dist/claims-DRmafYVK.js +90 -0
- package/dist/claims-DouHL7ZL.js +62 -0
- package/dist/cli/_format-Ba0DoWjl.js +99 -0
- package/dist/cli/add-ChoHyBhz.js +1222 -0
- package/dist/cli/add-DlYL-1mF.js +1 -0
- package/dist/cli/add-fzRPyIED.js +98 -0
- package/dist/cli/agent-59XWXsRi.js +184 -0
- package/dist/cli/app-table-files-C0OtdUVu.js +343 -0
- package/dist/cli/arazzo-1.0-D3OaSeZw.js +531 -0
- package/dist/cli/arazzo-1.1-DaT2KAkP.js +704 -0
- package/dist/cli/args-_ZVgRBkx.js +26 -0
- package/dist/cli/asyncapi-3.0.0-Ca-UwtUW.js +5592 -0
- package/dist/cli/asyncapi-3.1.0-DUxf5zNu.js +5832 -0
- package/dist/cli/backfill-Dq2XMXf9.js +292 -0
- package/dist/cli/bin.js +5 -5
- package/dist/cli/blocks-CCzp0eAH.js +155 -0
- package/dist/cli/blocks-DVhJOzFj.js +1 -0
- package/dist/cli/cache-CoC-1i1O.js +643 -0
- package/dist/cli/codemod-block-renames-Dt3X1Wvg.js +238 -0
- package/dist/cli/codemod-pyf6HmS9.js +2883 -0
- package/dist/cli/command-BpZ4AuhR.js +1021 -0
- package/dist/cli/compare-yl4sSwVn.js +8 -0
- package/dist/cli/completion-B08Q0xB3.js +29 -0
- package/dist/cli/completion-CwL7e93t.js +210 -0
- package/dist/cli/completion-DHTT6rjI.js +1 -0
- package/dist/cli/config-D-Upz3jV.js +46 -0
- package/dist/cli/config-D0m2rQqk.js +1 -0
- package/dist/cli/config-Dyl3iX3u.js +2029 -0
- package/dist/cli/config-edit-C6sQ1MqT.js +619 -0
- package/dist/cli/config-group-D4JWh4kG.js +388 -0
- package/dist/cli/content-mapper-ChSVT9Tq.js +181 -0
- package/dist/cli/db-B8zfxjl2.js +77 -0
- package/dist/cli/db-dFzhcozO.js +246 -0
- package/dist/cli/detect-BcUDaO8I.js +83 -0
- package/dist/cli/dist-CYnD1kyT.js +128 -0
- package/dist/cli/dist-MKwjiW2w.js +1114 -0
- package/dist/cli/doctor-BKZsztFV.js +4647 -0
- package/dist/cli/env-BAJn6wCA.js +142 -0
- package/dist/cli/env-BCuUsWOh.js +1109 -0
- package/dist/cli/env-D70ihdbB.js +1 -0
- package/dist/cli/env-UN6PJFX6.js +1 -0
- package/dist/cli/errors-DcJ_PayO.js +97 -0
- package/dist/cli/exec-CXBufciC.js +461 -0
- package/dist/cli/fastest-levenshtein-B_QF6At5.js +119 -0
- package/dist/cli/files-DQayErI8.js +999 -0
- package/dist/cli/fresh-import-CdO2oQaQ.js +39 -0
- package/dist/cli/gen-BN_eh6rE.js +390 -0
- package/dist/cli/guards-DxwRG0Uv.js +7 -0
- package/dist/cli/in-stack-diff-huI7fGMX.js +185 -0
- package/dist/cli/index.d.ts +1 -53
- package/dist/cli/index.js +10 -11
- package/dist/cli/init-CaDDt8F6.js +556 -0
- package/dist/cli/io-CQzy8PEZ.js +36 -0
- package/dist/cli/json5-DhsZB2va.js +784 -0
- package/dist/cli/jsonc-DU9Clnrz.js +1 -0
- package/dist/cli/jsonc-u_UiXFxs.js +43 -0
- package/dist/cli/keys-CxajkV_7.js +105 -0
- package/dist/cli/legacy-prefix-D8Jfku6I.js +153 -0
- package/dist/cli/live-KU41LMGE.js +339 -0
- package/dist/cli/mcp-C_m-TpLJ.js +240 -0
- package/dist/cli/metadata-Bq4ra7zo.js +149 -0
- package/dist/cli/migrate-DHG2Qz_K.js +45 -0
- package/dist/cli/migration-safety-STVbiKhz.js +925 -0
- package/dist/cli/migrations-O1QZoMiH.js +116 -0
- package/dist/cli/module-migration-DB9ntWM-.js +118 -0
- package/dist/cli/moved-BAFPdJz_.js +253 -0
- package/dist/cli/ohash-imLR_J5Y.js +276 -0
- package/dist/cli/openapi-3.0-BJiTNq_x.js +927 -0
- package/dist/cli/openapi-3.1-BcWCoii2.js +869 -0
- package/dist/cli/openapi-3.2-MXPkeoTk.js +1030 -0
- package/dist/cli/orphans-CPcR85QN.js +27 -0
- package/dist/cli/parse-BueItuNJ.js +181 -0
- package/dist/cli/powersync-CN3QPF2K.js +375 -0
- package/dist/cli/powersync-DfeGl5N1.js +1 -0
- package/dist/cli/preset-BQnjDCSR.js +100 -0
- package/dist/cli/print-DG7TRCi8.js +66 -0
- package/dist/cli/prompts-D9b6uf21.js +1133 -0
- package/dist/cli/providers-DpfoF3VC.js +298 -0
- package/dist/cli/prune-workflows-DcNJUS1m.js +153 -0
- package/dist/cli/redact--zOGdWzo.js +37 -0
- package/dist/cli/remove-BpfYqP45.js +237 -0
- package/dist/cli/render-Q7jnLn_C.js +2213 -0
- package/dist/cli/rolldown-runtime-DegdyBIC.js +25 -0
- package/dist/cli/run-9NfabanB.js +703 -0
- package/dist/cli/run-D6K-qQIX.js +1450 -0
- package/dist/cli/run-dY9uOC3W.js +62 -0
- package/dist/cli/seed-B4H0Lco9.js +187 -0
- package/dist/cli/seed-BIB6-WPa.js +1 -0
- package/dist/cli/shared-PrvYREVy.js +150 -0
- package/dist/cli/shell-C1U618XA.js +9 -0
- package/dist/cli/skills-jZThjL3B.js +120 -0
- package/dist/cli/snapshot-UfJsqfys.js +728 -0
- package/dist/cli/source-F3YTVvFo.js +317 -0
- package/dist/cli/source-args-DJMrW_jW.js +58 -0
- package/dist/cli/spec-DsLQuJKp.js +7449 -0
- package/dist/cli/spec-HQOBVbEO.js +1 -0
- package/dist/cli/sql-layout-CZ66pY8j.js +260 -0
- package/dist/cli/stack-147NqctC.js +134 -0
- package/dist/cli/stack-env-BQhbUFa7.js +92 -0
- package/dist/cli/stack-status-Mxgqb3I4.js +45 -0
- package/dist/cli/stacks-C5YL6Un9.js +230 -0
- package/dist/cli/style-B5-nByxb.js +34 -0
- package/dist/cli/supabase-toml-B6-eEV5p.js +1155 -0
- package/dist/cli/sync-B12wbtFd.js +318 -0
- package/dist/cli/table-D9FbJS8h.js +88 -0
- package/dist/cli/toml-VX0BsvYq.js +422 -0
- package/dist/cli/topics-Cdg0V7Tt.js +29 -0
- package/dist/cli/trace-D3TNqWBg.js +6 -0
- package/dist/cli/upgrade-AgUXFDo6.js +270 -0
- package/dist/cli/upgrade-C20z49De.js +40 -0
- package/dist/cli/validate-C_WTnX1U.js +7426 -0
- package/dist/cli/version-DEUWW8cv.js +3 -0
- package/dist/cli/yaml-JsusTbcC.js +2250 -0
- package/dist/client/index.d.ts +7 -7
- package/dist/client/index.js +9 -12
- package/dist/client/native/index.d.ts +7 -23
- package/dist/client/native/index.js +15 -22
- package/dist/client-BLor58Je.js +290 -0
- package/dist/clone-H_gCsL29.js +32 -0
- package/dist/cloud-event-CLvsaPqH.js +62 -0
- package/dist/cloud-event-bcaMqEbN.d.ts +62 -0
- package/dist/codecs-B1VO2BGL.d.ts +220 -0
- package/dist/codecs-B9v5Y5HH.js +357 -0
- package/dist/commerce/index.d.ts +5 -13
- package/dist/commerce/index.js +13 -16
- package/dist/compiler-CWishtY2.d.ts +12 -0
- package/dist/compose-BRBlPSEY.js +52 -0
- package/dist/composite-BZMkWNOQ.js +125 -0
- package/dist/composite-ClLWZIwX.d.ts +79 -0
- package/dist/config/index.d.ts +6 -6
- package/dist/config/index.js +7 -7
- package/dist/config-BhExAhNK.js +1102 -0
- package/dist/config-MDRA2sre.js +1672 -0
- package/dist/connectors-BImAu75R.d.ts +145 -0
- package/dist/context-DSevnLrT.js +40 -0
- package/dist/context-DcxfrCml.d.ts +4267 -0
- package/dist/controller-BJmh7gFm.js +78 -0
- package/dist/controller-D_UJBaEU.d.ts +50 -0
- package/dist/controller-y1kSMuCU.js +72 -0
- package/dist/conversion-7U1WeLxK.d.ts +84 -0
- package/dist/conversion-Bj9j3KnG.js +76 -0
- package/dist/cookie-DDkqvqe4.d.ts +3 -0
- package/dist/cookie-DJI6xXJ9.js +4 -0
- package/dist/cors-9SDsndtb.d.ts +13 -0
- package/dist/cors-DrDFLMNn.js +23 -0
- package/dist/create/index.d.ts +4 -28
- package/dist/create/index.js +9 -15
- package/dist/create/lite/index.d.ts +5 -25
- package/dist/create/lite/index.js +14 -24
- package/dist/create/oauth/index.d.ts +1 -1
- package/dist/create/oauth/index.js +1 -2
- package/dist/create/supabase/index.d.ts +2 -4
- package/dist/create/supabase/index.js +3 -6
- package/dist/create-blocks-D7q1boXV.js +367 -0
- package/dist/credentials/index.d.ts +6 -10
- package/dist/credentials/index.js +11 -12
- package/dist/cron-BD8VrQQl.js +147 -0
- package/dist/cron-route-DSITg1yC.js +23 -0
- package/dist/csv-Bwn9insJ.js +88 -0
- package/dist/csv-Dd1iKsk-.d.ts +26 -0
- package/dist/data-engine-B-D6bdyx.d.ts +269 -0
- package/dist/data-engine-BbqQwso_.js +174 -0
- package/dist/data-hooks-BToeAcQ_.js +277 -0
- package/dist/db-exception-Dv18UZ-I.js +30 -0
- package/dist/deal-forecast-CN_BEy9s.d.ts +21 -0
- package/dist/deal-forecast-DsVFoMkJ.js +38 -0
- package/dist/define-3RbqoF1S.d.ts +1242 -0
- package/dist/define-B6D55cO0.js +2073 -0
- package/dist/define-block-22Jv4U_-.js +63 -0
- package/dist/define-block-B_i9VPcc.d.ts +1669 -0
- package/dist/delegation-BRHHXERz.js +152 -0
- package/dist/delivery-CWcbh87x.d.ts +69 -0
- package/dist/delivery-SmPHu2_H.js +28 -0
- package/dist/delivery-events-0mAEuscm.js +52 -0
- package/dist/documents-6ov2gWh3.d.ts +150 -0
- package/dist/edge/index.d.ts +17 -23
- package/dist/edge/index.js +18 -22
- package/dist/elysia/index.d.ts +2 -6
- package/dist/elysia/index.js +4 -6
- package/dist/email-BRm6wMWQ.d.ts +40 -0
- package/dist/embeddings--v4BJdUL.js +127 -0
- package/dist/embeddings-K0lH--nt.d.ts +76 -0
- package/dist/ended-CCoE7XXY.d.ts +22 -0
- package/dist/entitlements-XwpuBbKN.d.ts +52 -0
- package/dist/entitlements-sLoj3M6Y.js +44 -0
- package/dist/entity-naming-BES3pkQI.js +130 -0
- package/dist/entity-schema-DEIz0I8i.js +38 -0
- package/dist/env/index.d.ts +1 -1
- package/dist/env/index.js +1 -2
- package/dist/envelope-DAtaFJue.js +89 -0
- package/dist/errors-B7tCfCvX.js +327 -0
- package/dist/errors-BdjHv5SV.js +43 -0
- package/dist/errors-D3-4c-XF.js +102 -0
- package/dist/escape-like-CK6L7gkj.d.ts +26 -0
- package/dist/escape-like-gxNXs145.js +6 -0
- package/dist/eve/index.d.ts +247 -16
- package/dist/eve/index.js +334 -26
- package/dist/eve-Cf-QRGij.d.ts +213 -0
- package/dist/event-calendar-DUtFyRrv.d.ts +63 -0
- package/dist/event-map-DxfsFgQT.js +18 -0
- package/dist/events/index.d.ts +3 -3
- package/dist/events/index.js +7 -8
- package/dist/events-BRKIxVQD.js +25 -0
- package/dist/events-CfDdOwqg.d.ts +850 -0
- package/dist/events-Da482tiF.js +81 -0
- package/dist/executor-BDMqPbVU.js +482 -0
- package/dist/executor-C0_TT717.js +840 -0
- package/dist/executor-CAhykadW.d.ts +168 -0
- package/dist/executor-CbDX34I9.d.ts +99 -0
- package/dist/executor-Dc4Pl44u.js +207 -0
- package/dist/executor-ynEwaUZy.d.ts +35 -0
- package/dist/expo/index.d.ts +5 -9
- package/dist/expo/index.js +10 -11
- package/dist/extension-DQ9-oOVC.js +58 -0
- package/dist/extension-LgaDPMJs.js +120 -0
- package/dist/extension-WdHd5uqI.js +102 -0
- package/dist/extension-rdpYvpyN.js +52 -0
- package/dist/extension-shared-DJb_PfD4.js +59 -0
- package/dist/extra-Dz9n5y1s.js +9 -0
- package/dist/field-errors-tQr-anYL.d.ts +208 -0
- package/dist/field-formats-Cap-V7UP.js +101 -0
- package/dist/field-formats-DVukMbRa.d.ts +36 -0
- package/dist/fields-AKKMirg_.d.ts +76 -0
- package/dist/fields-BBcdKD-S.js +107 -0
- package/dist/filter-evaluate-Bhq99aEN.d.ts +35 -0
- package/dist/filter-evaluate-D_LLfdtE.js +216 -0
- package/dist/filter-query-B7A4l2xn.d.ts +131 -0
- package/dist/filter-query-Ds7Z6lgZ.js +565 -0
- package/dist/flags-B5B4mkZV.d.ts +315 -0
- package/dist/flags-D0npSE-5.js +361 -0
- package/dist/flags-sdk/index.d.ts +217 -28
- package/dist/flags-sdk/index.js +255 -35
- package/dist/form-definition-8cCCt5zj.js +362 -0
- package/dist/form-definition-BN8shngm.d.ts +117 -0
- package/dist/format-BT0Z3V54.d.ts +77 -0
- package/dist/framework-B1h-uquj.js +57 -0
- package/dist/framework-CyDn_SXR.d.ts +45 -0
- package/dist/function-contract-Bf6llTkE.js +7 -0
- package/dist/function-contract-DgDBYbXu.d.ts +25 -0
- package/dist/gateway-Cg_MgGen.d.ts +120 -0
- package/dist/gateway-options-DQGQzdkD.js +26 -0
- package/dist/gateway-options-Mut8jih_.d.ts +27 -0
- package/dist/guards-CsRa6v57.js +11 -0
- package/dist/guest-actions-CEwttioE.js +8 -0
- package/dist/guest-actions-DfHHp98H.d.ts +3 -0
- package/dist/h3/index.d.ts +2 -6
- package/dist/h3/index.js +4 -6
- package/dist/h3/v1/index.d.ts +3 -5
- package/dist/h3/v1/index.js +4 -5
- package/dist/history-6KiVNWdH.js +269 -0
- package/dist/hmac-DNcfpmI9.js +22 -0
- package/dist/hono/index.d.ts +14 -19
- package/dist/hono/index.js +14 -16
- package/dist/http-BDC1IvBX.js +27 -0
- package/dist/http-BRUI3qim.js +140 -0
- package/dist/http-D4lH1xqY.js +39 -0
- package/dist/image-url-bsGeybeg.js +83 -0
- package/dist/impersonation-BOCJcsmS.d.ts +26 -0
- package/dist/impersonation-D-quM36V.js +61 -0
- package/dist/inbox-BmSA9K01.d.ts +326 -0
- package/dist/index-8w4OB5En.d.ts +102 -0
- package/dist/index-B2871MHr.d.ts +234 -0
- package/dist/index-B5_J-MaK.d.ts +152 -0
- package/dist/index-BWR29Vvw.d.ts +76 -0
- package/dist/index-CRrBZtKm.d.ts +326 -0
- package/dist/index-CTpEQvIv.d.ts +291 -0
- package/dist/index-D2BGCjIz.d.ts +570 -0
- package/dist/index-D66_dYVi.d.ts +667 -0
- package/dist/index-Dj4VKpYZ.d.ts +49 -0
- package/dist/index-DzBFdI9I.d.ts +145 -0
- package/dist/index-lazpPVr0.d.ts +402 -0
- package/dist/index-xCpjvDVm.d.ts +637 -0
- package/dist/index.d.ts +13 -41
- package/dist/index.js +29 -34
- package/dist/instance-property-BlH7QSDl.js +6 -0
- package/dist/instances-D31jrmKh.js +16636 -0
- package/dist/invalidate-DAB9CaPm.d.ts +19 -0
- package/dist/iso4217-oKsif_hW.js +175 -0
- package/dist/json-O5vFw243.js +21 -0
- package/dist/json-schema-D9eVL_xi.js +884 -0
- package/dist/jwks-cache-IZaiICAV.js +48 -0
- package/dist/jws-B8p0ppgh.js +204 -0
- package/dist/jws-CxgTsbgG.d.ts +64 -0
- package/dist/kit-CJKo0soh.d.ts +92 -0
- package/dist/kit-CVZDd1X9.js +132 -0
- package/dist/knowledge-BUwbpS8I.d.ts +215 -0
- package/dist/knowledge-DdZzUTQ-.js +299 -0
- package/dist/lint/index.d.ts +1 -5
- package/dist/lint/index.js +8 -10
- package/dist/list/index.d.ts +3 -3
- package/dist/list/index.js +3 -3
- package/dist/list-query-CZ-K5aHX.d.ts +220 -0
- package/dist/list-query-D-tgs1eY.js +558 -0
- package/dist/live-BVi3q4bX.js +277 -0
- package/dist/logger-0LfhvwE4.d.ts +16 -0
- package/dist/logger-BkF8ukXV.js +20 -0
- package/dist/lookup-upE-e1zw.js +17 -0
- package/dist/management-DtX4ic1F.d.ts +55 -0
- package/dist/mapper/bin.js +13 -17
- package/dist/mcp/index.d.ts +8 -18
- package/dist/mcp/index.js +24 -29
- package/dist/mcp/sdk/index.d.ts +7 -11
- package/dist/mcp/sdk/index.js +12 -14
- package/dist/message-Cc4bkdNw.d.ts +97 -0
- package/dist/messages-CRk1g6oe.js +512 -0
- package/dist/messaging-DMhtGxVv.d.ts +295 -0
- package/dist/methods-BjfDv4Gy.js +9 -0
- package/dist/metric-definition-2KQYeUZ1.d.ts +67 -0
- package/dist/metric-definition-D4H6IQT7.js +116 -0
- package/dist/mfa-CM5r904M.d.ts +34 -0
- package/dist/model-Lxa_mOzB.d.ts +338 -0
- package/dist/model-messages-BcrkjsPE.js +205 -0
- package/dist/model-messages-CGSUU450.d.ts +32 -0
- package/dist/money-BgpAd7d3.d.ts +89 -0
- package/dist/money-DH--bbYr.js +196 -0
- package/dist/money-codec-SKPm8FPw.js +40 -0
- package/dist/my-work-kinds-DNPq3ccL.js +10 -0
- package/dist/nestjs/index.d.ts +3 -5
- package/dist/nestjs/index.js +5 -6
- package/dist/next/client/index.d.ts +1 -5
- package/dist/next/client/index.js +2 -4
- package/dist/next/image/index.d.ts +1 -3
- package/dist/next/image/index.js +2 -3
- package/dist/next/index.d.ts +149 -92
- package/dist/next/index.js +167 -114
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +6 -7
- package/dist/node-headers-C3FExlg9.js +54 -0
- package/dist/node-headers-TnS4T7V_.d.ts +25 -0
- package/dist/nuxt/index.d.ts +0 -2
- package/dist/nuxt/index.js +1 -2
- package/dist/operations-BNFbWv1t.js +28 -0
- package/dist/operations-D51ONRvR.d.ts +4 -0
- package/dist/optional-peer-5SOYr3lL.js +31 -0
- package/dist/options--rohtkkC.js +4 -0
- package/dist/options-1iHDmlZ5.js +8 -0
- package/dist/options-2QJXZPPS.js +4 -0
- package/dist/options-B-JqrC61.d.ts +8 -0
- package/dist/options-B3xH2JvJ.js +8 -0
- package/dist/options-B4sTqDrt.js +4 -0
- package/dist/options-B56njigZ.js +19 -0
- package/dist/options-B5A3UmKY.d.ts +17 -0
- package/dist/options-B6m9gYRH.d.ts +11 -0
- package/dist/options-B7Pl708M.js +8 -0
- package/dist/options-B7YrdiUc.js +11 -0
- package/dist/options-B8c2_hIB.js +9 -0
- package/dist/options-B9w_Y08G.d.ts +6 -0
- package/dist/options-BDF60ouf.js +4 -0
- package/dist/options-BDMPjyrI.js +4 -0
- package/dist/options-BHdHuY5r.js +14 -0
- package/dist/options-BLMeCbtT.js +31 -0
- package/dist/options-BLQePOPy.d.ts +8 -0
- package/dist/options-BLn1PFyu.js +4 -0
- package/dist/options-BMO-FnOT.js +7 -0
- package/dist/options-BNRvoEkj.js +4 -0
- package/dist/options-BPQOiVx2.js +7 -0
- package/dist/options-BSTJmfX4.js +10 -0
- package/dist/options-BTRH26MJ.js +9 -0
- package/dist/options-BTaQszYn.js +9 -0
- package/dist/options-BYo7hMHK.js +10 -0
- package/dist/options-B_bxCZYM.js +7 -0
- package/dist/options-BaBaVWS-.js +10 -0
- package/dist/options-BamaRO-q.d.ts +12 -0
- package/dist/options-BcBdiPSZ.js +7 -0
- package/dist/options-BfY4pyQE.js +23 -0
- package/dist/options-BgCS5ODi.js +9 -0
- package/dist/options-Bi96Lzuf.js +9 -0
- package/dist/options-BjEsSoFp.js +17 -0
- package/dist/options-Bkx8vwip.js +4 -0
- package/dist/options-BmFSI07A.js +4 -0
- package/dist/options-BmwDdKwE.js +7 -0
- package/dist/options-Bn3NjXfn.js +7 -0
- package/dist/options-BqK4xV67.js +13 -0
- package/dist/options-Bs2dC-at.js +11 -0
- package/dist/options-BvttpM1M.js +4 -0
- package/dist/options-Bwrwb8do.d.ts +10 -0
- package/dist/options-BxdqA2Ex.js +19 -0
- package/dist/options-BzxR82Tu.js +9 -0
- package/dist/options-C-NFS6e3.js +13 -0
- package/dist/options-C13-dVMH.js +7 -0
- package/dist/options-C1RIyAe1.js +7 -0
- package/dist/options-C1kZ3qLd.js +8 -0
- package/dist/options-C2RjdunU.js +27 -0
- package/dist/options-C4kpi6HE.js +8 -0
- package/dist/options-C5MfwOAO.js +8 -0
- package/dist/options-C5fKQ3EJ.d.ts +10 -0
- package/dist/options-CJR59q8s.js +17 -0
- package/dist/options-CJVYQue3.d.ts +10 -0
- package/dist/options-CLy7CcMn.js +8 -0
- package/dist/options-COfEYic3.js +8 -0
- package/dist/options-CRwTY_q2.d.ts +58 -0
- package/dist/options-CcW7h8mv.js +9 -0
- package/dist/options-Ceu2j1vv.js +7 -0
- package/dist/options-CgBKgmI8.js +7 -0
- package/dist/options-CgMiQGOF.js +9 -0
- package/dist/options-CptvcSmF.js +11 -0
- package/dist/options-CsLUAt04.js +8 -0
- package/dist/options-CtyjhSGk.js +15 -0
- package/dist/options-CuPWezcV.js +7 -0
- package/dist/options-CyDOOWlk.js +7 -0
- package/dist/options-CyYZvdSy.js +10 -0
- package/dist/options-CzIPn0fF.js +4 -0
- package/dist/options-CzWjw2HY.js +10 -0
- package/dist/options-CztbWdz9.js +4 -0
- package/dist/options-D4LuPM8a.js +4 -0
- package/dist/options-D4dxMGHF.js +7 -0
- package/dist/options-D5a9CHgP.js +7 -0
- package/dist/options-D6tpMRvp.d.ts +13 -0
- package/dist/options-D848Os4l.js +10 -0
- package/dist/options-DCZPW5gR.d.ts +15 -0
- package/dist/options-DFSHZFLN.js +4 -0
- package/dist/options-DFemc2im.js +9 -0
- package/dist/options-DFgHHwzD.js +12 -0
- package/dist/options-DNZ9r_Vo.d.ts +8 -0
- package/dist/options-DP7NwQPZ.js +4 -0
- package/dist/options-DPQaafyc.js +7 -0
- package/dist/options-DQkhhBLy.js +4 -0
- package/dist/options-DTTz33na.js +9 -0
- package/dist/options-DToWdVqW.js +4 -0
- package/dist/options-DUNUGuhM.js +4 -0
- package/dist/options-DWgpi5ns.js +7 -0
- package/dist/options-DeamnVOY.d.ts +12 -0
- package/dist/options-Dg7eK-_J.d.ts +8 -0
- package/dist/options-DiIlMZpc.js +8 -0
- package/dist/options-DjFbIRgV.js +16 -0
- package/dist/options-DjtCYRWb.js +4 -0
- package/dist/options-Dk6D88Zx.d.ts +6 -0
- package/dist/options-DpwRG4tO.js +8 -0
- package/dist/options-DvgKdZ2K.js +9 -0
- package/dist/options-DwIoRvic.js +4 -0
- package/dist/options-GwwLsKf5.js +8 -0
- package/dist/options-I1ZHfDP0.d.ts +58 -0
- package/dist/options-Itq7QYoW.js +20 -0
- package/dist/options-JnPEVbBJ.js +17 -0
- package/dist/options-Jwux4JDX.js +7 -0
- package/dist/options-Lg76d-cV.js +7 -0
- package/dist/options-Lh6uxepF.d.ts +24 -0
- package/dist/options-Oki2W_c3.js +4 -0
- package/dist/options-PM7IaIFP.js +10 -0
- package/dist/options-PTLBl6QT.js +7 -0
- package/dist/options-PheFo4JY.js +10 -0
- package/dist/options-SlC_jZ7y.js +4 -0
- package/dist/options-Sq4bYbf5.js +13 -0
- package/dist/options-XiD_Y3oK.js +14 -0
- package/dist/options-Z-bd_H1E.js +88 -0
- package/dist/options-ax_ssX_m.js +4 -0
- package/dist/options-bNB8_nlW.js +23 -0
- package/dist/options-eIEk0vqV.js +4 -0
- package/dist/options-eLIedotm.js +7 -0
- package/dist/options-jg0FMHA5.js +4 -0
- package/dist/options-mypVYaqR.js +9 -0
- package/dist/options-ompJjxkV.js +4 -0
- package/dist/options-pbc4H8_A.js +7 -0
- package/dist/options-uUGi0Phf.d.ts +14 -0
- package/dist/options-yRwYr4up.js +4 -0
- package/dist/options-z2Zhi97E.js +9 -0
- package/dist/options-zYV6M0vr.js +8 -0
- package/dist/orpc/index.d.ts +13 -19
- package/dist/orpc/index.js +20 -22
- package/dist/otel/index.d.ts +4 -6
- package/dist/otel/index.js +8 -10
- package/dist/outbox-C44Aa94K.d.ts +197 -0
- package/dist/payments-B4JchZuJ.js +15 -0
- package/dist/payments-BBGSGRQ7.d.ts +112 -0
- package/dist/permissions-B9aZZ9LR.js +43 -0
- package/dist/permissions-controller-B4uI5IPH.js +33 -0
- package/dist/pg-error-D92B6jlF.js +25 -0
- package/dist/plugin-Ca2qBiFZ.js +47 -0
- package/dist/pool-Bji4lnQM.d.ts +121 -0
- package/dist/pool-errors-JrZie6u3.js +26 -0
- package/dist/ports-C-hdygkZ.js +150 -0
- package/dist/ports-zFqRNXVJ.d.ts +87 -0
- package/dist/postgres/index.d.ts +5 -11
- package/dist/postgres/index.js +7 -9
- package/dist/postgrest-2WjRrtmX.d.ts +51 -0
- package/dist/postgrest-executor-lf8Mt4J0.js +1064 -0
- package/dist/powersync/index.d.ts +203 -21
- package/dist/powersync/index.js +369 -22
- package/dist/preset/index.d.ts +3 -3
- package/dist/preset/index.js +3 -3
- package/dist/preset-om2rbdYw.js +1038 -0
- package/dist/problem-C0SVHhd3.js +161 -0
- package/dist/problem-NGBjN-TO.d.ts +77 -0
- package/dist/project-oNHntJ6T.js +1749 -0
- package/dist/provider-B6qpleR9.js +56 -0
- package/dist/provider-CH8McX3b.d.ts +142 -0
- package/dist/providers-C9sBIBYE.js +62 -0
- package/dist/push-token-CO28k46S.js +15 -0
- package/dist/push-token-a3Ev1U3L.d.ts +22 -0
- package/dist/queries-BLrxg_GL.js +238 -0
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +11 -15
- package/dist/range-BN3kpJAE.d.ts +6 -0
- package/dist/range-Nrh_qtb_.js +6 -0
- package/dist/rank-keys-CEBzd9Xa.js +59 -0
- package/dist/rank-result-B_xLQCBV.d.ts +12 -0
- package/dist/rank-result-DzaTKKhH.js +17 -0
- package/dist/rate-limit-C89Yzwd9.d.ts +48 -0
- package/dist/rate-limit-CRhlLFhP.js +380 -0
- package/dist/rate-limit-DXJbLVg0.js +48 -0
- package/dist/ratelimit-headers-CpB-cDD6.js +61 -0
- package/dist/react/index.d.ts +11 -11
- package/dist/react/index.js +6 -6
- package/dist/react/native/index.d.ts +3 -5
- package/dist/react/native/index.js +5 -5
- package/dist/react/server.d.ts +13 -15
- package/dist/react/server.js +9 -10
- package/dist/react/session.d.ts +4 -6
- package/dist/react/session.js +2 -3
- package/dist/react-C40oomj7.js +1006 -0
- package/dist/react-CqOVutZj.js +80 -0
- package/dist/react-router/index.d.ts +8 -12
- package/dist/react-router/index.js +9 -11
- package/dist/read-set-DEDoIHMM.js +198 -0
- package/dist/realtime/index.d.ts +7 -7
- package/dist/realtime/index.js +6 -7
- package/dist/realtime-status-CocmAOPv.js +10 -0
- package/dist/realtime-status-D3oUx3o4.d.ts +6 -0
- package/dist/record-bindings-jTZw-GVe.js +25 -0
- package/dist/record-form-DCIui2Ol.d.ts +80 -0
- package/dist/record-type-oQxekQTX.js +219 -0
- package/dist/recordings-Dlpq8jUG.d.ts +117 -0
- package/dist/records/index.d.ts +10 -14
- package/dist/records/index.js +13 -16
- package/dist/refresh-B8t_KE3s.js +142 -0
- package/dist/refresh-BK9epzeC.d.ts +52 -0
- package/dist/refusal-DEuFVi4s.d.ts +30 -0
- package/dist/refusal-DhX7Xpfp.js +63 -0
- package/dist/relay-CllqA-lV.js +248 -0
- package/dist/resolve-DVOtYTAc.d.ts +287 -0
- package/dist/resolve-FW8oeXvh.js +927 -0
- package/dist/resolved-names-DYYyh35i.js +130 -0
- package/dist/resource-BfsTJnxZ.d.ts +119 -0
- package/dist/resource-Cn6Bn-_o.js +517 -0
- package/dist/resource-DQ4kIBpa.js +104 -0
- package/dist/resource-execute-DQRS7PFt.d.ts +13 -0
- package/dist/resource-schemas-Bq0g2RCQ.js +81 -0
- package/dist/resource-types-DF6KDAZM.d.ts +155 -0
- package/dist/resources-B0Vy7_wv.js +63 -0
- package/dist/resources-CeY53FiJ.d.ts +5 -0
- package/dist/respond-C2qvP1wv.js +106 -0
- package/dist/respond-CkwkvFdZ.d.ts +108 -0
- package/dist/result-8xza7w5W.js +145 -0
- package/dist/result-DTOQRyGY.d.ts +347 -0
- package/dist/rows-Ce8dsmfM.js +79 -0
- package/dist/rows-D-RqIsRz.js +38 -0
- package/dist/rrule-BLpe2449.js +289 -0
- package/dist/run-keys-BnzqxtYc.d.ts +59 -0
- package/dist/run-state-D0Tbl-nM.d.ts +11 -0
- package/dist/run-state-DGiyDQxH.js +12 -0
- package/dist/run-watch-DJk4Q603.js +52 -0
- package/dist/runtime-qslVrC9l.js +43 -0
- package/dist/sales-lines-Bde9cV5F.d.ts +36 -0
- package/dist/sales-lines-axwWhnLk.js +44 -0
- package/dist/sales-shared-CY3s_wBx.js +21 -0
- package/dist/sandboxes-DDWuD9fh.d.ts +85 -0
- package/dist/schemas-CpoEiAeT.js +213 -0
- package/dist/scope-dD_OAgRU.js +89 -0
- package/dist/scores-Bql-ABl0.d.ts +172 -0
- package/dist/scores-Bvk_JgXL.js +176 -0
- package/dist/search-DtbkD0h0.js +8 -0
- package/dist/server/index.d.ts +35 -69
- package/dist/server/index.js +51 -59
- package/dist/server-types-C3p3jUqr.d.ts +583 -0
- package/dist/session-BOch2y2z.d.ts +96 -0
- package/dist/session-status-DRBRnZHx.d.ts +80 -0
- package/dist/shared-Bmcnxwie.js +16 -0
- package/dist/shared-Ci1g9nl4.js +90 -0
- package/dist/shared-DsBcvj6q.d.ts +9 -0
- package/dist/sign-in-BmigClRh.js +730 -0
- package/dist/sign-in-C9pZE1kM.d.ts +53 -0
- package/dist/sign-in-CXOg2Dwb.js +399 -0
- package/dist/sign-in-Dxyi4aKu.d.ts +83 -0
- package/dist/signatures-CBn7w4VR.js +144 -0
- package/dist/signatures-jPr9JXyw.d.ts +41 -0
- package/dist/signers-Cz5ZhTHH.d.ts +380 -0
- package/dist/signing-keys-BC5_hJN5.js +163 -0
- package/dist/signing-keys-DS-rIVzz.d.ts +117 -0
- package/dist/simplify-BzThKn5b.js +82 -0
- package/dist/solid/index.d.ts +12 -22
- package/dist/solid/index.js +10 -16
- package/dist/solid-start/index.d.ts +7 -9
- package/dist/solid-start/index.js +8 -9
- package/dist/spec/index.d.ts +6 -48
- package/dist/spec/index.js +23 -39
- package/dist/spec-6Vr7sc0Z.js +123 -0
- package/dist/spec-pins-CuQ2anBw.d.ts +125 -0
- package/dist/spec-pins-FKUzgF6K.js +61 -0
- package/dist/sql/index.d.ts +4 -4
- package/dist/sql/index.js +4 -4
- package/dist/sql-BPV51R3A.js +140626 -0
- package/dist/sql-C1K5JALb.js +420 -0
- package/dist/sql-type-XWMeZRAl.js +33 -0
- package/dist/sqlite/index.d.ts +3 -9
- package/dist/sqlite/index.js +5 -8
- package/dist/sso-BEvNf1oW.d.ts +159 -0
- package/dist/sso-CRnaFJh0.js +216 -0
- package/dist/ssr/index.d.ts +5 -5
- package/dist/ssr/index.js +3 -3
- package/dist/standard-BD2aOUsf.js +24 -0
- package/dist/standard-DRX6Ch1j.d.ts +5 -0
- package/dist/stats-BTJgRMEp.js +82 -0
- package/dist/statuses-BTrQ5H4S.js +27 -0
- package/dist/statuses-Bv-0XoYC.js +27 -0
- package/dist/storage/index.d.ts +3 -3
- package/dist/storage/index.js +27 -40
- package/dist/storage-api-COQr77e8.js +9 -0
- package/dist/store-CKKzmsWB.js +68 -0
- package/dist/store-c7QxUHX-.d.ts +81 -0
- package/dist/streams/index.d.ts +3 -7
- package/dist/streams/index.js +5 -6
- package/dist/streams/redis/index.d.ts +1 -3
- package/dist/streams/redis/index.js +6 -7
- package/dist/stripe/index.d.ts +1 -3
- package/dist/stripe/index.js +3 -4
- package/dist/stripe-Bl-sjnl6.d.ts +154 -0
- package/dist/stripe-DKRwRWew.js +31 -0
- package/dist/subject-readers-BARV5rNp.js +48 -0
- package/dist/subject-readers-DWkVSbFr.d.ts +19 -0
- package/dist/subject-type-BarjdHZV.js +7 -0
- package/dist/subjects-BGwLJ3IB.d.ts +148 -0
- package/dist/subjects-vci6Wufh.d.ts +86 -0
- package/dist/subscribers-C57054Pc.js +32 -0
- package/dist/summaries-CUemsYwV.d.ts +67 -0
- package/dist/supabase-mcp-DY32eoax.d.ts +44 -0
- package/dist/supabase-mcp-QvebHckf.js +27 -0
- package/dist/support-rZbdU35s.d.ts +351 -0
- package/dist/support-view-CvDEgyGY.js +17 -0
- package/dist/support-view-WY4Y-A40.d.ts +15 -0
- package/dist/svelte/index.d.ts +11 -21
- package/dist/svelte/index.js +9 -15
- package/dist/sveltekit/index.d.ts +10 -14
- package/dist/sveltekit/index.js +12 -14
- package/dist/table-schema-CwXg7oBz.d.ts +77 -0
- package/dist/table-schema-D-ss9ozY.js +291 -0
- package/dist/tables-BSiVuKKx.js +72 -0
- package/dist/tags-BVLELhOf.d.ts +28 -0
- package/dist/tags-CW-KvjdL.js +38 -0
- package/dist/tanstack-db/index.d.ts +4 -8
- package/dist/tanstack-db/index.js +4 -6
- package/dist/tanstack-start/index.d.ts +8 -12
- package/dist/tanstack-start/index.js +8 -10
- package/dist/tax-BD9dN1rx.d.ts +168 -0
- package/dist/tax-BwckP5dv.js +139 -0
- package/dist/tee-CVOMhEX-.js +100 -0
- package/dist/template-CNq9xcfx.js +125 -0
- package/dist/temporal-DKTdGK9i.js +94 -0
- package/dist/temporal-required-w_2u4EDp.js +19 -0
- package/dist/tenant-BR7fvPj7.js +26 -0
- package/dist/tenant-RKvGBB-U.d.ts +15 -0
- package/dist/tenant-source-46lMuMEn.js +7 -0
- package/dist/testing/index.d.ts +87 -124
- package/dist/testing/index.js +158 -128
- package/dist/timeline-Bs-FGMIJ.js +49 -0
- package/dist/timeline-Ck8OFuAN.d.ts +147 -0
- package/dist/timing-B6yHayKA.js +94 -0
- package/dist/topic-BBBCVLyS.js +640 -0
- package/dist/topic-Dr8VYE4D.d.ts +411 -0
- package/dist/transport-CS4cVH4S.js +30 -0
- package/dist/ttl-cache-C5S0L2wx.js +31 -0
- package/dist/types-BiedVwz_.d.ts +192 -0
- package/dist/types-CCmW3MqI.d.ts +449 -0
- package/dist/types-CL-z0A4K.d.ts +660 -0
- package/dist/types-CvlJNzX4.d.ts +215 -0
- package/dist/types-D9FY9qSJ.d.ts +247 -0
- package/dist/types-DWZubmwk.d.ts +648 -0
- package/dist/types-DnrJ_crV.js +28 -0
- package/dist/types-Pv5WPfIC.d.ts +175 -0
- package/dist/types-WZUVlTXs.d.ts +907 -0
- package/dist/undo-BdoEJ6Ot.d.ts +44 -0
- package/dist/undo-Dki6Ujak.js +43 -0
- package/dist/upload-claim-Bo2mpBz4.js +32 -0
- package/dist/usage-D27Uw426.d.ts +230 -0
- package/dist/user-change-Ngy8z1fZ.js +133 -0
- package/dist/variants-BaMleC56.js +51 -0
- package/dist/vault-Dx0LaNMX.d.ts +60 -0
- package/dist/vercel-connect/index.d.ts +194 -20
- package/dist/vercel-connect/index.js +265 -33
- package/dist/vercel-sandbox/index.d.ts +166 -0
- package/dist/vercel-sandbox/index.js +171 -0
- package/dist/verify-DY_j4GPZ.js +129 -0
- package/dist/verify-DnL0Fgu0.d.ts +144 -0
- package/dist/view-DmEZA1fL.d.ts +95 -0
- package/dist/view-YnesSUEa.js +244 -0
- package/dist/vue/index.d.ts +12 -22
- package/dist/vue/index.js +10 -16
- package/dist/watch-topic-BB7T05sc.d.ts +29 -0
- package/dist/watch-topic-C2KxpeaB.js +56 -0
- package/dist/wire-DIoLA8VL.js +90 -0
- package/dist/wiring-DJBSLdyF.js +12 -0
- package/dist/workflow-sdk/builder/index.d.ts +12 -14
- package/dist/workflow-sdk/builder/index.js +12 -11
- package/dist/workflow-sdk/index.d.ts +62 -6
- package/dist/workflow-sdk/index.js +75 -10
- package/dist/workflow-sdk/world/index.d.ts +13 -20
- package/dist/workflow-sdk/world/index.js +115 -26
- package/dist/workflow-sdk-BL3wzkdp.js +2749 -0
- package/dist/workflow-sdk-D5zRSwxh.js +302 -0
- package/dist/workflow-sdk-DMpVSMB7.d.ts +171 -0
- package/dist/workflows-DKTw2PZo.d.ts +256 -0
- package/dist/yjs/index.d.ts +3 -5
- package/dist/yjs/index.js +6 -7
- package/package.json +45 -31
- package/schemas/config-v1.json +66 -4
- package/schemas/doctor-report-v1.json +1 -0
- package/schemas/snapshot-v2.json +7 -0
- package/skills/better-supabase/SKILL.md +4 -4
- package/skills/better-supabase/references/block-extensions.md +2 -2
- package/skills/better-supabase/references/troubleshooting.md +1 -1
- package/skills/better-supabase/references/ui-recipes.md +591 -325
- package/skills/better-supabase-api/SKILL.md +1 -1
- package/skills/better-supabase-api/references/adapters.md +3 -3
- package/skills/better-supabase-api/references/ai.md +8 -0
- package/skills/better-supabase-api/references/powersync.md +16 -0
- package/skills/better-supabase-auth/SKILL.md +22 -19
- package/skills/better-supabase-auth/references/authorization-providers.md +1 -1
- package/dist/access-sql-CTDNuxRv.js +0 -385
- package/dist/actor-CoveJgya.d.ts +0 -106
- package/dist/actor-go7p9-CJ.js +0 -150
- package/dist/adapter-D4aNBxhm.js +0 -2301
- package/dist/agents-CM_cCtcr.d.ts +0 -117
- package/dist/ai-cache-BFRKxgZ4.js +0 -87
- package/dist/ai-cache-BTGqckta.d.ts +0 -82
- package/dist/ai-chat-B7_vQvxU.d.ts +0 -619
- package/dist/ai-files-m_2z3rH1.js +0 -339
- package/dist/ai-message-DfaP8sis.js +0 -14
- package/dist/ai-schedules-CZEfo-_M.d.ts +0 -166
- package/dist/anchors-7F34QyHa.d.ts +0 -40
- package/dist/api-3C0AWFeP.js +0 -696
- package/dist/api-59rv5hL6.d.ts +0 -495
- package/dist/api-keys-JE-aykZE.d.ts +0 -213
- package/dist/app-tables-yyVncXEt.d.ts +0 -28
- package/dist/approvals-BfEafAzt.d.ts +0 -129
- package/dist/assistant-B49qATbj.d.ts +0 -157
- package/dist/attachments-BXbLnNxm.js +0 -376
- package/dist/attributes-Bzf51_nc.js +0 -47
- package/dist/auth-DyF_LRxd.js +0 -20
- package/dist/auth-link-B4NL84XU.d.ts +0 -104
- package/dist/auth-link-D3-bU6yz.js +0 -118
- package/dist/auth-module-BbmX-N4L.js +0 -52
- package/dist/auth-reply-Dj124sbX.d.ts +0 -11
- package/dist/auth-reply-tlXB2FQ9.js +0 -31
- package/dist/authorization-CDU9tYA_.d.ts +0 -3860
- package/dist/authorization-hooks-BWhkMZfH.d.ts +0 -221
- package/dist/authorizer-B6X09otb.d.ts +0 -118
- package/dist/authorizer-BGhXaDmo.js +0 -172
- package/dist/automation-D41DXyvT.js +0 -75
- package/dist/automations-8L3NEuoq.js +0 -29
- package/dist/automations-BKjJpktQ.js +0 -33
- package/dist/automations-BMuqwZZn.js +0 -314
- package/dist/automations-EzXteupo.js +0 -31
- package/dist/availability-BdeKCHpl.d.ts +0 -236
- package/dist/base64-B9Wlsdj7.js +0 -42
- package/dist/batch-limit-DKVQDz4o.js +0 -5
- package/dist/before-route-B23K2zYU.js +0 -30
- package/dist/bind-p7asfI6H.d.ts +0 -104
- package/dist/block-authors-Bw3zdzgl.js +0 -14
- package/dist/block-authors-DzXLUiIq.d.ts +0 -12
- package/dist/block-env-B8wG3xeh.d.ts +0 -32
- package/dist/block-event-listener-Bu6G0TFH.js +0 -16
- package/dist/block-events-IWAyafO3.js +0 -83
- package/dist/block-fields-BE7pInWZ.d.ts +0 -58
- package/dist/block-fields-BjXgX_5c.js +0 -140
- package/dist/block-helpers-B0f0ZVb5.js +0 -437
- package/dist/block-helpers-D5emQ2O6.d.ts +0 -62
- package/dist/block-hooks-B8itxzEE.d.ts +0 -117
- package/dist/block-hooks-DKtz0HRh.js +0 -130
- package/dist/block-method-C9hWdHom.js +0 -21
- package/dist/block-method-CiVa2G-J.d.ts +0 -14
- package/dist/block-subjects-C1_9DkSA.d.ts +0 -6
- package/dist/block-subjects-DFSuFY1a.js +0 -55
- package/dist/block-tenant-DHp7subc.js +0 -14
- package/dist/block-transport-9EUA3q_I.d.ts +0 -69
- package/dist/bookings-xsmM2TA_.d.ts +0 -289
- package/dist/bucket-SvRQwYS4.d.ts +0 -705
- package/dist/build-CH2N3Yf0.js +0 -2073
- package/dist/build-DbIRFcHQ.js +0 -735
- package/dist/carrier-KzeYXVrW.d.ts +0 -169
- package/dist/casing-DdFWEtqr.js +0 -16
- package/dist/channel-JcMd5lNP.d.ts +0 -105
- package/dist/channels-CfcFPuo_.js +0 -114
- package/dist/claims-Bp9My7XP.js +0 -88
- package/dist/claims-DTy6R6my.js +0 -63
- package/dist/cli/_format-Cax5EsM9.js +0 -101
- package/dist/cli/add-BdhGOwkB.js +0 -1
- package/dist/cli/add-D4w-Axib.js +0 -1231
- package/dist/cli/add-Dggyehsy.js +0 -99
- package/dist/cli/agent-CbuPvI2x.js +0 -185
- package/dist/cli/app-table-files-CiGuwLkO.js +0 -346
- package/dist/cli/arazzo-1.0-BalU61-_.js +0 -532
- package/dist/cli/arazzo-1.1-Bnfasbun.js +0 -705
- package/dist/cli/args-UEwg0l-N.js +0 -27
- package/dist/cli/asyncapi-3.0.0-C78dBjR6.js +0 -5593
- package/dist/cli/asyncapi-3.1.0-g-7aIfV1.js +0 -5833
- package/dist/cli/backfill-DjVjXW_P.js +0 -293
- package/dist/cli/blocks-Bbmb6W_F.js +0 -1
- package/dist/cli/blocks-jRL9K1R8.js +0 -156
- package/dist/cli/cache-BuoIFlUJ.js +0 -607
- package/dist/cli/codemod-DRavXBCb.js +0 -2435
- package/dist/cli/codemod-block-renames-BuSaTE_G.js +0 -239
- package/dist/cli/command-DIPmo0wh.js +0 -997
- package/dist/cli/compare-BmIWVEui.js +0 -9
- package/dist/cli/completion-DxPxMtyP.js +0 -211
- package/dist/cli/completion-DyLMSjOD.js +0 -1
- package/dist/cli/completion-FUgqm2-N.js +0 -30
- package/dist/cli/config-BfapErxs.js +0 -47
- package/dist/cli/config-Cskysxp-.js +0 -2000
- package/dist/cli/config-Df5cXWNN.js +0 -1
- package/dist/cli/config-edit-CrWfk8s3.js +0 -621
- package/dist/cli/config-group-CP-B9uRt.js +0 -390
- package/dist/cli/content-mapper-BCtyfKXl.js +0 -182
- package/dist/cli/db-CQCLx7cx.js +0 -78
- package/dist/cli/db-CWvH1_46.js +0 -247
- package/dist/cli/detect-D9JaAX20.js +0 -84
- package/dist/cli/dist-D_VbPAMR.js +0 -129
- package/dist/cli/dist-DuiMMRbJ.js +0 -1112
- package/dist/cli/doctor-Di2ZekfN.js +0 -4659
- package/dist/cli/env-B2CbnbzD.js +0 -143
- package/dist/cli/env-BK0xKMeU.js +0 -1113
- package/dist/cli/env-Bat6ogep.js +0 -1
- package/dist/cli/env-CynGCICL.js +0 -1
- package/dist/cli/errors-BTe6A15O.js +0 -98
- package/dist/cli/exec-Ca5s-ygi.js +0 -463
- package/dist/cli/fastest-levenshtein-dhRRvrM2.js +0 -120
- package/dist/cli/files-CX71yBm8.js +0 -1010
- package/dist/cli/fresh-import-DzgsGHkX.js +0 -40
- package/dist/cli/gen-STKC9vkK.js +0 -394
- package/dist/cli/guards-CUlDNYZs.js +0 -8
- package/dist/cli/in-stack-diff-Cp-tVPj2.js +0 -186
- package/dist/cli/init-DW6_nIwj.js +0 -559
- package/dist/cli/io-DH1kcmmP.js +0 -37
- package/dist/cli/json5-ChRycquj.js +0 -787
- package/dist/cli/jsonc-C8M0EhHB.js +0 -1
- package/dist/cli/jsonc-D5Fu67jw.js +0 -45
- package/dist/cli/keys-V-HcO-21.js +0 -106
- package/dist/cli/legacy-prefix-R7UChFFl.js +0 -154
- package/dist/cli/live-0G4Plw3K.js +0 -341
- package/dist/cli/mcp-flKS8iU5.js +0 -241
- package/dist/cli/metadata-VARUbXEe.js +0 -150
- package/dist/cli/migrate-Bkq07XcT.js +0 -46
- package/dist/cli/migration-safety-BfVeza5j.js +0 -928
- package/dist/cli/migrations-BCq7Zs2E.js +0 -117
- package/dist/cli/module-migration-lbeUrsYv.js +0 -119
- package/dist/cli/moved-DNOtp9LA.js +0 -254
- package/dist/cli/ohash-BjQY1cBb.js +0 -277
- package/dist/cli/openapi-3.0-t7xwkuRH.js +0 -928
- package/dist/cli/openapi-3.1-CVze7tBS.js +0 -870
- package/dist/cli/openapi-3.2-CFoMYM01.js +0 -1031
- package/dist/cli/orphans-BAboqyVM.js +0 -28
- package/dist/cli/parse-BPf3kGnc.js +0 -182
- package/dist/cli/powersync-B15CfH5Y.js +0 -284
- package/dist/cli/powersync-DnBsDchT.js +0 -1
- package/dist/cli/preset-BwmIfFnh.js +0 -101
- package/dist/cli/print-DjxpBRnv.js +0 -68
- package/dist/cli/prompts-jqnr94b9.js +0 -1140
- package/dist/cli/providers-dyxcHQY3.js +0 -301
- package/dist/cli/redact-KGAk2Ul9.js +0 -38
- package/dist/cli/remove-BLq5gbal.js +0 -239
- package/dist/cli/render-CizUf3RW.js +0 -2225
- package/dist/cli/rolldown-runtime-kJ_i4yPo.js +0 -26
- package/dist/cli/run-ChEjR7yw.js +0 -63
- package/dist/cli/run-ChOY6s4o.js +0 -1459
- package/dist/cli/run-MwM__teL.js +0 -705
- package/dist/cli/seed-BOun22-k.js +0 -1
- package/dist/cli/seed-CDnL4Tnc.js +0 -188
- package/dist/cli/shared-DV5wIv-7.js +0 -151
- package/dist/cli/shell-Btv_4Yhe.js +0 -10
- package/dist/cli/skills-DM3oeIxY.js +0 -121
- package/dist/cli/snapshot-B5LXkVMC.js +0 -729
- package/dist/cli/source-BoLNG_2A.js +0 -320
- package/dist/cli/source-args-v8ljFDfc.js +0 -59
- package/dist/cli/spec-D6QeE2Zx.js +0 -1
- package/dist/cli/spec-Dz-PGCaM.js +0 -7530
- package/dist/cli/sql-layout-zo02f3Dm.js +0 -261
- package/dist/cli/stack-ClESAZYf.js +0 -135
- package/dist/cli/stack-env-3ziggrU3.js +0 -93
- package/dist/cli/stack-status-BkkYRlXG.js +0 -46
- package/dist/cli/stacks-CiDBH1dB.js +0 -232
- package/dist/cli/style-Bm2X5JrN.js +0 -35
- package/dist/cli/supabase-toml-CncmQbO0.js +0 -1164
- package/dist/cli/sync-m-oZ_SyI.js +0 -322
- package/dist/cli/table-dyKddjwo.js +0 -89
- package/dist/cli/toml-DB-MNnFs.js +0 -424
- package/dist/cli/topics-BpdnYmWb.js +0 -30
- package/dist/cli/trace-VbdO6bcN.js +0 -7
- package/dist/cli/upgrade-C9sgVZ5z.js +0 -272
- package/dist/cli/upgrade-WwEJaX3i.js +0 -41
- package/dist/cli/validate-B3lF3-jB.js +0 -7522
- package/dist/cli/version-D2BQuqta.js +0 -4
- package/dist/cli/yaml-CYCbJ6et.js +0 -2252
- package/dist/client-C_mlji5R.js +0 -288
- package/dist/clone-CkG0-hlI.js +0 -33
- package/dist/cloud-event-0pQ9vFNS.d.ts +0 -64
- package/dist/cloud-event-XsM53POL.js +0 -63
- package/dist/codecs-CMWlhHZ0.d.ts +0 -222
- package/dist/codecs-CSUFGrdP.js +0 -358
- package/dist/compiler-BEeVWXPS.d.ts +0 -14
- package/dist/compose-DKW0Tr3e.js +0 -53
- package/dist/composite-BJ9s-IJJ.d.ts +0 -83
- package/dist/composite-CBRbvn5j.js +0 -130
- package/dist/config-bqKaPjst.js +0 -1679
- package/dist/config-r7njjNgh.js +0 -1111
- package/dist/connectors-uC5baoFV.d.ts +0 -147
- package/dist/context-DBicfUNz.js +0 -41
- package/dist/context-nbYYjv7U.d.ts +0 -4344
- package/dist/controller-BEliOBOv.js +0 -79
- package/dist/controller-TRocodqG.d.ts +0 -52
- package/dist/controller-qG-B1eDn.js +0 -73
- package/dist/conversion-Dq1S7xzE.js +0 -77
- package/dist/conversion-g8HzH9My.d.ts +0 -86
- package/dist/cors-h_v7TPxl.js +0 -24
- package/dist/cors-kLq6VM06.d.ts +0 -15
- package/dist/create-blocks-BfrDUSM6.js +0 -370
- package/dist/cron-DdT4ti8a.js +0 -148
- package/dist/cron-route-FjKgRvTY.js +0 -24
- package/dist/csv-2rXGPNtP.js +0 -89
- package/dist/csv-DhHQS2x_.d.ts +0 -28
- package/dist/data-engine-D1BkmBoR.js +0 -173
- package/dist/data-engine-rvbR2C4F.d.ts +0 -273
- package/dist/data-hooks-CdcZfVS1.js +0 -280
- package/dist/db-exception-Lngc1W49.js +0 -31
- package/dist/deal-forecast-CKBnRodz.js +0 -39
- package/dist/deal-forecast-LwO-Z4_C.d.ts +0 -23
- package/dist/define-D-dLADd5.js +0 -2084
- package/dist/define-D8_9X5fZ.d.ts +0 -1263
- package/dist/define-block-BGqOO8B3.js +0 -64
- package/dist/define-block-DWVZSZv1.d.ts +0 -1687
- package/dist/delegation-C7eWP2r8.d.ts +0 -14
- package/dist/delegation-DGOIiT8k.js +0 -153
- package/dist/delivery-Bm0jxmzI.js +0 -29
- package/dist/delivery-n6lZGuGx.d.ts +0 -71
- package/dist/documents-BbwYyynk.d.ts +0 -152
- package/dist/email-B3YxEzwC.d.ts +0 -42
- package/dist/embeddings-I3s5sTDt.d.ts +0 -78
- package/dist/embeddings-vVzseUw0.js +0 -128
- package/dist/ended-EZzN9QTM.d.ts +0 -26
- package/dist/entitlements-B1i1-wfe.d.ts +0 -54
- package/dist/entitlements-tGL6-69B.js +0 -45
- package/dist/entity-naming-Dtyq5sKE.js +0 -131
- package/dist/entity-schema-B1YmMtP8.js +0 -39
- package/dist/envelope-DEI2iX-d.js +0 -90
- package/dist/errors-BVFgt8BZ.js +0 -328
- package/dist/errors-CyxMxzlu.js +0 -44
- package/dist/escape-like-DHfx6jRr.js +0 -7
- package/dist/escape-like-PReMbEEU.d.ts +0 -30
- package/dist/eve-BfhVFV33.d.ts +0 -157
- package/dist/event-calendar-DVLs2wUO.d.ts +0 -65
- package/dist/event-map-CtPFhcOp.js +0 -19
- package/dist/events-B2qbZps6.d.ts +0 -854
- package/dist/events-D6IZ5CE8.js +0 -82
- package/dist/events-DuLhzjP6.js +0 -26
- package/dist/executor-BfirBzOr.d.ts +0 -174
- package/dist/executor-BlS0kCrN.d.ts +0 -104
- package/dist/executor-C2Ne-Scm.js +0 -208
- package/dist/executor-DXQIx4sW.d.ts +0 -37
- package/dist/executor-DqIci3Jb.js +0 -486
- package/dist/executor-WolvKszH.js +0 -843
- package/dist/extension-DTaHjwdc.js +0 -59
- package/dist/extension-DeAd_MqI.js +0 -121
- package/dist/extension-DzCc0IOd.js +0 -103
- package/dist/extension-mGylYROs.js +0 -53
- package/dist/extension-shared-Djm8mGHD.js +0 -60
- package/dist/extra-CGQ2_q3S.js +0 -10
- package/dist/field-errors-tJvehEFc.d.ts +0 -216
- package/dist/field-formats-C6QKA3UR.js +0 -102
- package/dist/field-formats-CAFNkKSN.d.ts +0 -38
- package/dist/fields-BBm49w-E.js +0 -108
- package/dist/fields-snbaZ14h.d.ts +0 -78
- package/dist/filter-evaluate-BRpNiNPG.d.ts +0 -37
- package/dist/filter-evaluate-lCToXzZI.js +0 -217
- package/dist/filter-query-CQ6d5GnQ.js +0 -566
- package/dist/filter-query-DBt7OKuH.d.ts +0 -133
- package/dist/flags-DDKTThrO.d.ts +0 -246
- package/dist/flags-DF_SCqp5.js +0 -279
- package/dist/form-definition-BTpM_tz1.js +0 -363
- package/dist/form-definition-BjEtH8BT.d.ts +0 -119
- package/dist/format-u-65igKI.d.ts +0 -79
- package/dist/framework-DVYTtQXA.d.ts +0 -47
- package/dist/framework-DYEUraqt.js +0 -58
- package/dist/function-contract-DxFNOmsm.d.ts +0 -27
- package/dist/function-contract-pEmsaUIf.js +0 -8
- package/dist/gateway-Ve7cByEr.d.ts +0 -115
- package/dist/gateway-options-BlVCqgb8.d.ts +0 -29
- package/dist/gateway-options-Cl74B7k6.js +0 -27
- package/dist/guards-6F2bCtQR.js +0 -12
- package/dist/guest-actions-1T1DeS5Y.d.ts +0 -5
- package/dist/guest-actions-B7zdhfnh.js +0 -9
- package/dist/history-GH1HJWQV.js +0 -271
- package/dist/hmac-B3CTTlfv.js +0 -23
- package/dist/http-7-UvHjQe.js +0 -28
- package/dist/http-BjjojWg3.js +0 -40
- package/dist/http-DzbloBR-.js +0 -141
- package/dist/image-url-_d7xYsXK.js +0 -84
- package/dist/impersonation-DM3oWNoD.js +0 -62
- package/dist/impersonation-YTa9dZUv.d.ts +0 -28
- package/dist/inbox-c8B86Trp.d.ts +0 -321
- package/dist/index-8US7qlvW.d.ts +0 -158
- package/dist/index-B4wttiLh.d.ts +0 -407
- package/dist/index-BKrxynq9.d.ts +0 -240
- package/dist/index-BM6NmKSc.d.ts +0 -588
- package/dist/index-BkzXwuIN.d.ts +0 -338
- package/dist/index-CWAQRWY8.d.ts +0 -729
- package/dist/index-Cxsnd-OL.d.ts +0 -305
- package/dist/index-DbyDZZlc.d.ts +0 -53
- package/dist/index-NRMMhhEi.d.ts +0 -104
- package/dist/index-X2fkPUwb.d.ts +0 -51
- package/dist/index-pZn6S_iq.d.ts +0 -149
- package/dist/index-zsgNmE8m.d.ts +0 -665
- package/dist/instance-property-hRh88y_s.js +0 -7
- package/dist/instances-C7qUTjhJ.js +0 -16603
- package/dist/invalidate-DMp4eqfF.d.ts +0 -21
- package/dist/iso4217-B-durg_y.js +0 -176
- package/dist/json-DaByVJpw.js +0 -22
- package/dist/json-schema-DHJxiizN.js +0 -888
- package/dist/jwks-cache-DEsKI0hJ.js +0 -49
- package/dist/jws-D0toeQlA.d.ts +0 -66
- package/dist/jws-DOgHJKHb.js +0 -205
- package/dist/kit-B8yWCRN7.d.ts +0 -94
- package/dist/kit-Bcd9wYCV.js +0 -133
- package/dist/knowledge-CsLPACGJ.d.ts +0 -217
- package/dist/knowledge-tCrrU99q.js +0 -300
- package/dist/list-query-BcU8NnNL.d.ts +0 -222
- package/dist/list-query-BnpA2BDg.js +0 -559
- package/dist/live-C21DgbsD.js +0 -275
- package/dist/logger-DWVYUmwi.d.ts +0 -18
- package/dist/logger-glM28NVN.js +0 -21
- package/dist/lookup-BaP5bI27.js +0 -18
- package/dist/management-wtecfrNf.d.ts +0 -57
- package/dist/message-Bg4TKA12.d.ts +0 -99
- package/dist/messages-ecPW_nOv.js +0 -492
- package/dist/messaging-DQP09JsY.d.ts +0 -297
- package/dist/methods-Cund9ZBe.js +0 -11
- package/dist/metric-definition-BjxVn4R5.js +0 -117
- package/dist/metric-definition-EAYI1r2n.d.ts +0 -69
- package/dist/mfa-oIOYTpvc.d.ts +0 -36
- package/dist/model-hwpvole9.d.ts +0 -340
- package/dist/model-messages-CkZSDDHP.js +0 -206
- package/dist/model-messages-DrR4lZ_c.d.ts +0 -34
- package/dist/money-BNRdJQzA.d.ts +0 -91
- package/dist/money-BZl985O-.js +0 -197
- package/dist/money-codec-BJuS2zEW.js +0 -41
- package/dist/my-work-kinds-BU3SlA-6.js +0 -11
- package/dist/node-headers-BPtMP4_V.d.ts +0 -27
- package/dist/node-headers-C71zNQHe.js +0 -55
- package/dist/operations-CB9atU2e.d.ts +0 -6
- package/dist/operations-DVHRHvv6.js +0 -29
- package/dist/optional-peer-C1NbBRJm.js +0 -32
- package/dist/options-3OYOU56e.js +0 -11
- package/dist/options-56zYYXxc.js +0 -10
- package/dist/options-5WvWOkAm.d.ts +0 -26
- package/dist/options-62woPFn3.js +0 -12
- package/dist/options-7ixoOoap.js +0 -10
- package/dist/options-9dSU5RML.js +0 -5
- package/dist/options-B0YZtAkb.d.ts +0 -15
- package/dist/options-B2Kz_tCx.js +0 -10
- package/dist/options-B5E2MGIz.js +0 -15
- package/dist/options-B685YSzQ.js +0 -5
- package/dist/options-B692WoK6.js +0 -9
- package/dist/options-BHU1wc74.js +0 -5
- package/dist/options-BHy0Z5Zd.js +0 -5
- package/dist/options-BJtdsK7b.js +0 -8
- package/dist/options-BKBy5wM_.js +0 -16
- package/dist/options-BKDxrPvE.js +0 -5
- package/dist/options-BLfymS4s.js +0 -5
- package/dist/options-BOCRbzh3.js +0 -5
- package/dist/options-BOqfYsM1.js +0 -13
- package/dist/options-BQWJqwHO.js +0 -9
- package/dist/options-BQunK6_Y.js +0 -8
- package/dist/options-BQyrZjwM.js +0 -28
- package/dist/options-BR9xTHZW.js +0 -5
- package/dist/options-BRUdd5jY.js +0 -8
- package/dist/options-BSsYXjhC.js +0 -9
- package/dist/options-BTmaRzx2.d.ts +0 -60
- package/dist/options-BUCQYAeJ.d.ts +0 -10
- package/dist/options-B_NrjVDt.d.ts +0 -12
- package/dist/options-BawzwlmC.js +0 -11
- package/dist/options-BbLDAp7G.d.ts +0 -10
- package/dist/options-BfPsL7E2.js +0 -9
- package/dist/options-Bfmwwc78.js +0 -8
- package/dist/options-BhsdveDk.js +0 -21
- package/dist/options-BomoTH-8.js +0 -5
- package/dist/options-BtjkzIVh.js +0 -8
- package/dist/options-Bvi9bl4H.js +0 -5
- package/dist/options-BwKNmaJo.js +0 -5
- package/dist/options-BxpLtyk-.js +0 -18
- package/dist/options-BzB2QxL3.js +0 -5
- package/dist/options-C078wBP0.js +0 -5
- package/dist/options-C3AdsFJ6.js +0 -9
- package/dist/options-C7C5OhmL.d.ts +0 -8
- package/dist/options-C87u6eSa.js +0 -10
- package/dist/options-CBAEGxwS.js +0 -8
- package/dist/options-CDSCkYxu.d.ts +0 -14
- package/dist/options-CDUr8zzX.js +0 -8
- package/dist/options-CFjGxfa8.js +0 -5
- package/dist/options-CI6P0xhV.js +0 -10
- package/dist/options-CJFMK9A_.js +0 -8
- package/dist/options-CLpgx7en.js +0 -10
- package/dist/options-COo7_3MX.js +0 -10
- package/dist/options-CSCXNYJO.d.ts +0 -8
- package/dist/options-CTXHj9zr.js +0 -16
- package/dist/options-CTl8T88w.js +0 -11
- package/dist/options-CUIOOv4z.js +0 -15
- package/dist/options-CZDmtsbV.js +0 -8
- package/dist/options-CZTscdPB.js +0 -5
- package/dist/options-CZdKndeo.js +0 -9
- package/dist/options-C_7g9TTq.d.ts +0 -12
- package/dist/options-Cb2FOFj5.js +0 -5
- package/dist/options-CbOstLa7.js +0 -5
- package/dist/options-CcXgWlvm.js +0 -24
- package/dist/options-CfVPctAw.js +0 -89
- package/dist/options-Cjgaf8ub.js +0 -8
- package/dist/options-CoSPgWKy.js +0 -9
- package/dist/options-CpZ2HlSU.js +0 -32
- package/dist/options-CsSe8Nba.js +0 -8
- package/dist/options-CsvJR-r2.js +0 -9
- package/dist/options-Cucv6sWP.js +0 -12
- package/dist/options-CyjL9lTf.js +0 -5
- package/dist/options-D-OOO9V2.d.ts +0 -10
- package/dist/options-D0Y6ZMe8.js +0 -5
- package/dist/options-D0bzZx9a.d.ts +0 -10
- package/dist/options-D0sj5abR.js +0 -9
- package/dist/options-D1hSuf50.d.ts +0 -12
- package/dist/options-D610Fa6T.js +0 -5
- package/dist/options-D96dScev.js +0 -24
- package/dist/options-DFpyP1bg.js +0 -5
- package/dist/options-DJEcS4DX.js +0 -5
- package/dist/options-DJbN3bi9.js +0 -11
- package/dist/options-DKoQoRCy.js +0 -13
- package/dist/options-DM1qaMMQ.js +0 -9
- package/dist/options-DNgSwhsm.js +0 -11
- package/dist/options-DOIwzRXL.js +0 -16
- package/dist/options-DRIgHh4O.d.ts +0 -16
- package/dist/options-DRrZmJyI.js +0 -8
- package/dist/options-DUMUsvml.js +0 -5
- package/dist/options-DWwL5Kaz.js +0 -9
- package/dist/options-DZHZYlpD.js +0 -10
- package/dist/options-DZLkeqWn.js +0 -9
- package/dist/options-DZRpXKQE.js +0 -5
- package/dist/options-DZen3UiC.js +0 -14
- package/dist/options-D_9Vxx7f.js +0 -8
- package/dist/options-DcHl59RC.js +0 -11
- package/dist/options-Dcaql09y.js +0 -11
- package/dist/options-DcnBNYmV.js +0 -8
- package/dist/options-DdpM-fiP.js +0 -9
- package/dist/options-DhoLMknl.js +0 -10
- package/dist/options-DlohRAYd.d.ts +0 -13
- package/dist/options-Dpy-Ruo-.js +0 -14
- package/dist/options-DsVuVRH3.d.ts +0 -17
- package/dist/options-DtAJxfHS.js +0 -8
- package/dist/options-Dz9Yo52Z.js +0 -8
- package/dist/options-HnfETSHr.d.ts +0 -19
- package/dist/options-LqUXTpML.js +0 -8
- package/dist/options-MsloEAIB.js +0 -5
- package/dist/options-P2FxqYpd.js +0 -17
- package/dist/options-_1gAIMq7.d.ts +0 -60
- package/dist/options-aT89JqlB.js +0 -5
- package/dist/options-cVKZu9b0.js +0 -9
- package/dist/options-eTepQ1rZ.js +0 -15
- package/dist/options-fkShrmGQ.js +0 -8
- package/dist/options-gUvfr3no.js +0 -11
- package/dist/options-hynwKWuf.js +0 -20
- package/dist/options-jsOCvLUz.js +0 -10
- package/dist/options-o5wCw8H7.d.ts +0 -14
- package/dist/options-p49DFg3H.js +0 -8
- package/dist/options-pYNpXKcg.js +0 -8
- package/dist/options-qtETCHzW.js +0 -10
- package/dist/options-rnKlqYEr.js +0 -5
- package/dist/options-sU_zGkiV.js +0 -10
- package/dist/options-xq4MXG1M.js +0 -5
- package/dist/options-zzlznRA7.js +0 -10
- package/dist/outbox-BZ712Z3X.d.ts +0 -199
- package/dist/payments-BXvabJOw.js +0 -16
- package/dist/payments-BYcN34Fp.d.ts +0 -114
- package/dist/permissions-controller-BMsqIE5T.js +0 -34
- package/dist/pg-error-B5QLDcbG.js +0 -26
- package/dist/plugin-AKwwe2gF.js +0 -48
- package/dist/pool-DDR1ndk7.d.ts +0 -123
- package/dist/pool-errors-JUBcGrre.js +0 -27
- package/dist/ports-DvpNseap.js +0 -152
- package/dist/ports-hpbyMySO.d.ts +0 -89
- package/dist/postgrest-AJc8hnJU.d.ts +0 -53
- package/dist/postgrest-executor-B_Uezhrm.js +0 -1068
- package/dist/preset-DCdEnJj9.js +0 -1042
- package/dist/problem-Bf0cJ7tk.js +0 -162
- package/dist/problem-DNwN8iGz.d.ts +0 -79
- package/dist/project-B32wb5J6.js +0 -1760
- package/dist/provider-B6g7rBZX.js +0 -57
- package/dist/provider-CWjzAIX9.d.ts +0 -112
- package/dist/push-token-D6REHMMw.js +0 -16
- package/dist/push-token-DQ1ycFPU.d.ts +0 -24
- package/dist/queries-BWYYS9um.js +0 -239
- package/dist/range-DwpWe8e7.js +0 -7
- package/dist/range-p5V4rBhZ.d.ts +0 -8
- package/dist/rank-keys-DcPMt_Jk.js +0 -60
- package/dist/rank-result-BBJIK-k_.js +0 -18
- package/dist/rank-result-Bwe7igy-.d.ts +0 -14
- package/dist/rate-limit-BWKGlhTM.js +0 -49
- package/dist/rate-limit-Bztf32cl.d.ts +0 -50
- package/dist/rate-limit-fZ_d8gSE.js +0 -380
- package/dist/ratelimit-headers-kEcXyO3H.js +0 -62
- package/dist/react-BKCnIuZs.js +0 -79
- package/dist/react-CcrQQl0_.js +0 -1016
- package/dist/read-set-B1sDib5O.js +0 -199
- package/dist/realtime-status-BhNkb-Ow.d.ts +0 -8
- package/dist/realtime-status-asHvhiOh.js +0 -11
- package/dist/record-bindings-Z51mGfhB.js +0 -26
- package/dist/record-form-CubgBrtI.d.ts +0 -82
- package/dist/record-type-DRbnlj5q.js +0 -221
- package/dist/recordings-DeZYx-Kv.d.ts +0 -119
- package/dist/refresh-D02Pbf5B.d.ts +0 -54
- package/dist/refusal-B0VmlAxF.d.ts +0 -32
- package/dist/refusal-DDlInPff.js +0 -64
- package/dist/relay-CIKcAVjf.js +0 -248
- package/dist/replicas-Dyoh3CEg.js +0 -94
- package/dist/resolve-B0mW2m7f.js +0 -932
- package/dist/resolve-CtX6T0c0.d.ts +0 -288
- package/dist/resolved-names-iLBOUaib.js +0 -133
- package/dist/resource-BUJcZKiW.js +0 -520
- package/dist/resource-DvgXqZB_.js +0 -105
- package/dist/resource-WxN0IsvB.d.ts +0 -123
- package/dist/resource-execute-BzqR8DdD.d.ts +0 -15
- package/dist/resource-schemas-up6bKOUi.js +0 -82
- package/dist/resource-types-BVbHgTPg.d.ts +0 -157
- package/dist/resources-BSbRa0Ab.d.ts +0 -7
- package/dist/resources-jb3R6rEa.js +0 -64
- package/dist/respond-CZMWbUs3.js +0 -107
- package/dist/respond-Dzu_-EPH.d.ts +0 -112
- package/dist/result-DZeA5KS6.d.ts +0 -351
- package/dist/result-ntFBW2p2.js +0 -146
- package/dist/rows-BdqXmiB-.js +0 -80
- package/dist/rows-jijHLVE_.js +0 -39
- package/dist/rrule-C9Ot6ax8.js +0 -290
- package/dist/run-state-BMCD_1Lt.d.ts +0 -13
- package/dist/run-state-CgBKzYMW.js +0 -13
- package/dist/run-watch-B-LoK5m1.js +0 -53
- package/dist/runtime-CoKxZibd.js +0 -45
- package/dist/sales-lines-BsmrNHe9.d.ts +0 -38
- package/dist/sales-lines-DO7oRu1o.js +0 -45
- package/dist/sales-shared-BuTA8JK7.js +0 -22
- package/dist/schemas-CLOTvdsC.js +0 -216
- package/dist/scope-DgWjuXUw.js +0 -90
- package/dist/scores-Y8TvyJi1.d.ts +0 -174
- package/dist/scores-bY2Is0kx.js +0 -177
- package/dist/search-Cn_DGluL.js +0 -9
- package/dist/server-types-BkTIxW_H.d.ts +0 -597
- package/dist/session-BOzx2qHC.d.ts +0 -100
- package/dist/session-status-BP8eYVnA.d.ts +0 -82
- package/dist/shared-BeHTi8Fu.js +0 -17
- package/dist/shared-Bf-I13Ht.js +0 -91
- package/dist/shared-CRRfQAKG.d.ts +0 -11
- package/dist/sign-in-BzihC_8k.d.ts +0 -50
- package/dist/sign-in-CmPK1AgM.js +0 -402
- package/dist/sign-in-Cyj3ZlFX.js +0 -703
- package/dist/sign-in-D54FLMQy.d.ts +0 -55
- package/dist/signatures-CX1b4WHa.js +0 -145
- package/dist/signatures-Dkx9OE8j.d.ts +0 -43
- package/dist/signers-ZmxO1I05.d.ts +0 -390
- package/dist/signing-keys-CWtpMask.js +0 -164
- package/dist/signing-keys-udgP7Aod.d.ts +0 -119
- package/dist/simplify-DDO0j0LI.js +0 -83
- package/dist/spec-BMvCCNnd.js +0 -124
- package/dist/spec-pins-BZkKfwY8.d.ts +0 -127
- package/dist/spec-pins-D3zDek-u.js +0 -62
- package/dist/sql-CYt7EhH0.js +0 -421
- package/dist/sql-CyeDg3Yh.js +0 -138146
- package/dist/sql-type-iUSZpaUu.js +0 -34
- package/dist/sso-CkU_4mtK.d.ts +0 -161
- package/dist/sso-DdDpJQzw.js +0 -217
- package/dist/standard-BA3mLh6w.js +0 -25
- package/dist/standard-DBV730sF.d.ts +0 -7
- package/dist/stats-BHl1-zj9.js +0 -83
- package/dist/statuses-Alll5Ip6.js +0 -29
- package/dist/statuses-zRcc2TeZ.js +0 -28
- package/dist/storage-api-Dg78Wqsg.js +0 -10
- package/dist/store-CpheI-lN.d.ts +0 -83
- package/dist/store-McN-2esd.js +0 -69
- package/dist/stripe-BJUfp5jM.js +0 -32
- package/dist/stripe-X22LjuH-.d.ts +0 -156
- package/dist/subject-readers-CB5Te02u.d.ts +0 -21
- package/dist/subject-readers-VHcrWhmq.js +0 -49
- package/dist/subject-type-BRnK7Av3.js +0 -8
- package/dist/subjects-BYCL-6hA.d.ts +0 -145
- package/dist/subjects-CiBNKy2y.d.ts +0 -90
- package/dist/subscribers-BvZxcd63.js +0 -33
- package/dist/summaries-8jQTELIX.d.ts +0 -69
- package/dist/supabase-mcp-Dz9DgrKP.js +0 -28
- package/dist/supabase-mcp-Z4vtsuoO.d.ts +0 -46
- package/dist/support-BxyPOFk4.d.ts +0 -357
- package/dist/support-view-g4YLBeqX.js +0 -18
- package/dist/support-view-nqUWKHEs.d.ts +0 -17
- package/dist/table-schema-BlF6k62Q.d.ts +0 -81
- package/dist/table-schema-C80xItaV.js +0 -293
- package/dist/tables-Cb-3_VWc.js +0 -73
- package/dist/tags-CIZTqtlY.js +0 -39
- package/dist/tags-Cm48BsOa.d.ts +0 -30
- package/dist/tax-BkCNWWMc.js +0 -140
- package/dist/tax-DPShHual.d.ts +0 -170
- package/dist/tee-V97_v1ZS.js +0 -101
- package/dist/template-Drgg3v2J.js +0 -126
- package/dist/temporal-Dbo0fLzc.js +0 -95
- package/dist/temporal-required-DcLhnDhQ.js +0 -20
- package/dist/tenant-BgIiMQpo.js +0 -27
- package/dist/tenant-C9YE_kqK.d.ts +0 -17
- package/dist/tenant-source-bqWpSr86.js +0 -8
- package/dist/timeline--VU3A1e4.js +0 -50
- package/dist/timeline-DvXtXq5q.d.ts +0 -151
- package/dist/timing-dypS0nxW.js +0 -95
- package/dist/topic-DnsNG4Kj.js +0 -643
- package/dist/topic-breZqx_4.d.ts +0 -415
- package/dist/ttl-cache-Bhr9swjT.js +0 -32
- package/dist/types-B-D6fYx2.d.ts +0 -194
- package/dist/types-C3I7S51U.d.ts +0 -461
- package/dist/types-CK2X2wCB.d.ts +0 -618
- package/dist/types-CPl9uJ0G.d.ts +0 -912
- package/dist/types-CwQgFo8c.d.ts +0 -177
- package/dist/types-DMihLukJ.d.ts +0 -251
- package/dist/types-R6syp1el.js +0 -29
- package/dist/types-iCyZ3lMx.d.ts +0 -217
- package/dist/types-nspa5I-a.d.ts +0 -664
- package/dist/undo-0HkWXASn.d.ts +0 -46
- package/dist/undo-BbftL9-4.js +0 -44
- package/dist/upload-claim-B1ZU8ydB.js +0 -33
- package/dist/usage-BkWAPkg2.d.ts +0 -232
- package/dist/user-change-DgWC6RRC.js +0 -135
- package/dist/variants-Cy--Ub-a.js +0 -53
- package/dist/vault-BkdPmL7f.d.ts +0 -62
- package/dist/verify-41mZmspj.d.ts +0 -146
- package/dist/verify-7EucfCnv.js +0 -130
- package/dist/view-C8Ve14ja.js +0 -247
- package/dist/view-C8_xvD-j.d.ts +0 -97
- package/dist/watch-topic-CuaWfCuv.js +0 -57
- package/dist/watch-topic-ItO3dz8m.d.ts +0 -31
- package/dist/wire-ChYn1g21.js +0 -91
- package/dist/wiring-CDNuQoJJ.js +0 -13
- package/dist/workflow-sdk-BWPsdzVK.js +0 -2534
- package/dist/workflow-sdk-Cf0LAOFF.js +0 -242
- package/dist/workflow-sdk-rg3IbCZC.d.ts +0 -163
- package/dist/workflows-xL6t0TXx.d.ts +0 -258
|
@@ -0,0 +1,1749 @@
|
|
|
1
|
+
import { a as presetOf, d as resolvePreset } from "./config-MDRA2sre.js";
|
|
2
|
+
import { M as PRESET_CATALOG, b as isAppDefault, d as appIdentifierError, f as appNameLengthError, p as appReservedColumns, y as appDefaultError } from "./instances-D31jrmKh.js";
|
|
3
|
+
import { c as resolveConfig } from "./config-BhExAhNK.js";
|
|
4
|
+
import { D as designOf, M as parseDesign, j as jsonPointer, k as encodeDesign, v as DesignParseError, w as designConfig, y as DesignTooLongError } from "./preset-om2rbdYw.js";
|
|
5
|
+
import { F as renderBlocks, S as moduleLayout, nt as SQL_MODULES } from "./sql-BPV51R3A.js";
|
|
6
|
+
// src/create/column-keys.ts
|
|
7
|
+
/** The most options a select takes, and the longest option. */
|
|
8
|
+
const MAX_OPTIONS = 100;
|
|
9
|
+
const MAX_OPTION = 100;
|
|
10
|
+
const AUTH_USERS$2 = "auth.users";
|
|
11
|
+
/** The column types each format fits, as `appTables` checks them. */
|
|
12
|
+
const FORMAT_TYPES = {
|
|
13
|
+
email: ["text"],
|
|
14
|
+
url: ["text"],
|
|
15
|
+
phone: ["text"],
|
|
16
|
+
long_text: ["text"],
|
|
17
|
+
color: ["text"],
|
|
18
|
+
rating: ["integer", "bigint"],
|
|
19
|
+
percent: ["integer", "numeric"],
|
|
20
|
+
currency: ["bigint"]
|
|
21
|
+
};
|
|
22
|
+
const FORMAT_LABELS = {
|
|
23
|
+
email: "email",
|
|
24
|
+
url: "url",
|
|
25
|
+
phone: "phone",
|
|
26
|
+
long_text: "long text",
|
|
27
|
+
color: "color",
|
|
28
|
+
rating: "rating",
|
|
29
|
+
percent: "percent",
|
|
30
|
+
currency: "money"
|
|
31
|
+
};
|
|
32
|
+
const NUMBER_TYPES = /* @__PURE__ */ new Set([
|
|
33
|
+
"integer",
|
|
34
|
+
"bigint",
|
|
35
|
+
"numeric"
|
|
36
|
+
]);
|
|
37
|
+
const CONTROL = /\p{Cc}/u;
|
|
38
|
+
/**
|
|
39
|
+
* Whether a column signed-in users can't write is required with no default,
|
|
40
|
+
* which `appTables` refuses: nobody but the server could insert a row.
|
|
41
|
+
*/
|
|
42
|
+
function lockedWithoutDefault(column) {
|
|
43
|
+
return column.access !== void 0 && column.nullable === false && column.default === void 0 && column.identity !== true;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Whether a column can be encrypted: not a `text[]`, and no unique key,
|
|
47
|
+
* reference or identity, which only work on the stored value.
|
|
48
|
+
*/
|
|
49
|
+
function encryptable(column) {
|
|
50
|
+
return column.type !== "text[]" && column.unique !== true && column.references === void 0 && column.identity !== true;
|
|
51
|
+
}
|
|
52
|
+
/** Whether `min` and `max` apply to a `type` column, as a value or a length. */
|
|
53
|
+
function takesBounds(type) {
|
|
54
|
+
return type === "text" || NUMBER_TYPES.has(type);
|
|
55
|
+
}
|
|
56
|
+
/** Whether a bound of a `type` column has to be a whole number. */
|
|
57
|
+
function wholeBounds(type) {
|
|
58
|
+
return type !== "numeric";
|
|
59
|
+
}
|
|
60
|
+
function fitsBound(type, value) {
|
|
61
|
+
return value !== void 0 && takesBounds(type) && (!wholeBounds(type) || Number.isInteger(value)) && (type !== "text" || value >= 0);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A column without the keys its type can't take: a format of another type,
|
|
65
|
+
* options outside text and text[], bounds that don't apply, an identity outside
|
|
66
|
+
* integer and bigint, and a default an identity or the type refuses.
|
|
67
|
+
*/
|
|
68
|
+
function fitted(column) {
|
|
69
|
+
const { format, options, min, max, identity, default: fallback, nullable, encrypted, ...rest } = column;
|
|
70
|
+
const { type } = column;
|
|
71
|
+
const counted = identity === true && (type === "integer" || type === "bigint");
|
|
72
|
+
const next = { ...rest };
|
|
73
|
+
if (nullable !== void 0 && !(counted && nullable)) next.nullable = nullable;
|
|
74
|
+
if (fallback !== void 0 && !counted && isAppDefault(type, fallback)) next.default = fallback;
|
|
75
|
+
if (format !== void 0 && FORMAT_TYPES[format].includes(type)) next.format = format;
|
|
76
|
+
if (options !== void 0 && (type === "text" || type === "text[]")) next.options = options;
|
|
77
|
+
if (fitsBound(type, min)) next.min = min;
|
|
78
|
+
if (fitsBound(type, max)) next.max = max;
|
|
79
|
+
if (counted) next.identity = true;
|
|
80
|
+
if (encrypted === true && encryptable(next)) next.encrypted = true;
|
|
81
|
+
return next;
|
|
82
|
+
}
|
|
83
|
+
/** Why `option` can't join a select's `options`, or `undefined` when it can. */
|
|
84
|
+
function optionError(options, option) {
|
|
85
|
+
if (option === "") return "Enter an option.";
|
|
86
|
+
if (option.length > MAX_OPTION) return `Use at most ${MAX_OPTION} characters.`;
|
|
87
|
+
if (CONTROL.test(option)) return "Leave out line breaks and tabs.";
|
|
88
|
+
if (options.includes(option)) return `${option} is already an option.`;
|
|
89
|
+
if (options.length >= MAX_OPTIONS) return `A select takes at most ${MAX_OPTIONS} options.`;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Why `value` can't be a bound of `column`, or `undefined` when it can (an
|
|
93
|
+
* empty value clears it).
|
|
94
|
+
*/
|
|
95
|
+
function boundError(column, side, value) {
|
|
96
|
+
const trimmed = value.trim();
|
|
97
|
+
if (trimmed === "") return;
|
|
98
|
+
const number = Number(trimmed);
|
|
99
|
+
if (!Number.isFinite(number)) return "Enter a number.";
|
|
100
|
+
if (column.type === "text" && (!Number.isInteger(number) || number < 0)) return "A length is a whole number of 0 or more.";
|
|
101
|
+
if (wholeBounds(column.type) && !Number.isInteger(number)) return `A ${column.type} bound is a whole number.`;
|
|
102
|
+
if (side === "min" && column.max !== void 0 && number > column.max) return `Keep it at or below the largest value, ${column.max}.`;
|
|
103
|
+
if (side === "max" && column.min !== void 0 && number < column.min) return `Keep it at or above the smallest value, ${column.min}.`;
|
|
104
|
+
}
|
|
105
|
+
/** `column` with its bounds replaced; a bound left out is removed. */
|
|
106
|
+
function withBounds(column, bounds) {
|
|
107
|
+
const { min: _min, max: _max, ...rest } = column;
|
|
108
|
+
const next = { ...rest };
|
|
109
|
+
if (bounds.min !== void 0) next.min = bounds.min;
|
|
110
|
+
if (bounds.max !== void 0) next.max = bounds.max;
|
|
111
|
+
return next;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* What the canvas shows for a column that is more than its type, such as an
|
|
115
|
+
* email or a select.
|
|
116
|
+
*/
|
|
117
|
+
function columnLabel(column) {
|
|
118
|
+
if (column.identity === true) return "autonumber";
|
|
119
|
+
if (column.options !== void 0) return column.type === "text[]" ? "multi-select" : "select";
|
|
120
|
+
if (column.references?.block === void 0 && column.references?.table === AUTH_USERS$2) return "person";
|
|
121
|
+
return column.format === void 0 ? void 0 : FORMAT_LABELS[column.format];
|
|
122
|
+
}
|
|
123
|
+
// src/create/design-scope.ts
|
|
124
|
+
const AUTH_USERS$1 = "auth.users";
|
|
125
|
+
/**
|
|
126
|
+
* The column that scopes an app table's rows, or `null` for `scope: "none"` and
|
|
127
|
+
* unscoped presets.
|
|
128
|
+
*/
|
|
129
|
+
function scopeColumnOf(table, preset) {
|
|
130
|
+
const scope = table.scope ?? "inherit";
|
|
131
|
+
if (scope === "none") return null;
|
|
132
|
+
if (scope === "inherit" && preset.scope === "tenant") return {
|
|
133
|
+
name: `${preset.tenantName}_id`,
|
|
134
|
+
type: preset.idType,
|
|
135
|
+
nullable: false,
|
|
136
|
+
default: null,
|
|
137
|
+
unique: false
|
|
138
|
+
};
|
|
139
|
+
if (scope === "user" || preset.scope === "user") return {
|
|
140
|
+
name: "user_id",
|
|
141
|
+
type: "uuid",
|
|
142
|
+
nullable: false,
|
|
143
|
+
default: "auth.uid()",
|
|
144
|
+
unique: false
|
|
145
|
+
};
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
// src/create/design-subject.ts
|
|
149
|
+
/**
|
|
150
|
+
* The columns `subject` adds: `rank` for manual order and `deleted_at` for
|
|
151
|
+
* trash.
|
|
152
|
+
*/
|
|
153
|
+
function subjectColumns(subject) {
|
|
154
|
+
const columns = [];
|
|
155
|
+
if (subject?.rank !== void 0) columns.push({
|
|
156
|
+
name: "rank",
|
|
157
|
+
type: "text",
|
|
158
|
+
nullable: false,
|
|
159
|
+
default: "'V'",
|
|
160
|
+
unique: false
|
|
161
|
+
});
|
|
162
|
+
if (subject?.softDelete === true) columns.push({
|
|
163
|
+
name: "deleted_at",
|
|
164
|
+
type: "timestamptz",
|
|
165
|
+
nullable: true,
|
|
166
|
+
default: null,
|
|
167
|
+
unique: false
|
|
168
|
+
});
|
|
169
|
+
return columns;
|
|
170
|
+
}
|
|
171
|
+
/** The subject with the columns it names renamed or dropped by `edit`. */
|
|
172
|
+
function subjectColumnsEdited(subject, edit) {
|
|
173
|
+
const { title, search, rank, versions, ...rest } = subject;
|
|
174
|
+
const next = { ...rest };
|
|
175
|
+
const [nextTitle] = title === void 0 ? [] : edit([title]);
|
|
176
|
+
if (nextTitle !== void 0) next.title = nextTitle;
|
|
177
|
+
if (search !== void 0) {
|
|
178
|
+
const nextSearch = {};
|
|
179
|
+
const [searchTitle] = search.title === void 0 ? [] : edit([search.title]);
|
|
180
|
+
const body = edit(search.body ?? []);
|
|
181
|
+
if (searchTitle !== void 0) nextSearch.title = searchTitle;
|
|
182
|
+
if (body.length > 0) nextSearch.body = body;
|
|
183
|
+
next.search = nextSearch;
|
|
184
|
+
}
|
|
185
|
+
if (versions === true) next.versions = true;
|
|
186
|
+
else if (versions !== void 0) {
|
|
187
|
+
const { columns, ...options } = versions;
|
|
188
|
+
const kept = columns === void 0 ? void 0 : edit(columns);
|
|
189
|
+
next.versions = kept === void 0 || kept.length === 0 ? options : {
|
|
190
|
+
...options,
|
|
191
|
+
columns: kept
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
if (rank === true) next.rank = true;
|
|
195
|
+
else if (rank !== void 0) {
|
|
196
|
+
const [group] = rank.group === void 0 ? [] : edit([rank.group]);
|
|
197
|
+
next.rank = group === void 0 ? true : { group };
|
|
198
|
+
}
|
|
199
|
+
return next;
|
|
200
|
+
}
|
|
201
|
+
const SUBJECT_TYPE = /^[a-z][a-z0-9_]*$/u;
|
|
202
|
+
/**
|
|
203
|
+
* Why `type` can't be the subject type of the app table `table`, or `undefined`
|
|
204
|
+
* when it can.
|
|
205
|
+
*/
|
|
206
|
+
function subjectTypeError(design, table, type) {
|
|
207
|
+
if (!SUBJECT_TYPE.test(type)) return "Use lowercase letters, digits and underscores, starting with a letter.";
|
|
208
|
+
const owner = Object.entries(design.appTables ?? {}).find(([name, each]) => name !== table && each.subject?.type === type)?.[0];
|
|
209
|
+
return owner === void 0 ? void 0 : `${owner} already has the subject type ${type}.`;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* App table events with `edit` applied to the payload columns, dropping an
|
|
213
|
+
* empty list.
|
|
214
|
+
*/
|
|
215
|
+
function eventsColumnsEdited(events, edit) {
|
|
216
|
+
if (events === true) return true;
|
|
217
|
+
const { include, ...rest } = events;
|
|
218
|
+
const kept = include === void 0 ? [] : edit(include);
|
|
219
|
+
return kept.length === 0 ? rest : {
|
|
220
|
+
...rest,
|
|
221
|
+
include: kept
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
// src/create/design-computed.ts
|
|
225
|
+
/** The aggregates a rollup takes (`APP_ROLLUP_AGGREGATES`). */
|
|
226
|
+
const ROLLUP_AGGREGATES = [
|
|
227
|
+
"count",
|
|
228
|
+
"sum",
|
|
229
|
+
"min",
|
|
230
|
+
"max",
|
|
231
|
+
"avg"
|
|
232
|
+
];
|
|
233
|
+
const NUMBERS = /* @__PURE__ */ new Set([
|
|
234
|
+
"integer",
|
|
235
|
+
"bigint",
|
|
236
|
+
"numeric"
|
|
237
|
+
]);
|
|
238
|
+
const ORDERED = /* @__PURE__ */ new Set([
|
|
239
|
+
...NUMBERS,
|
|
240
|
+
"date",
|
|
241
|
+
"timestamptz",
|
|
242
|
+
"text"
|
|
243
|
+
]);
|
|
244
|
+
function isRollupAggregate(value) {
|
|
245
|
+
return ROLLUP_AGGREGATES.some((each) => each === value);
|
|
246
|
+
}
|
|
247
|
+
/** The columns of `table` a rollup or lookup can read, with their types. */
|
|
248
|
+
function readableColumns(table) {
|
|
249
|
+
return [...Object.entries(table.columns ?? {}).map(([name, column]) => [name, column.type]), ...table.timestamps === false ? [] : [["created_at", "timestamptz"], ["updated_at", "timestamptz"]]];
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The columns `aggregate` can read: numbers for sum and avg, ordered types for
|
|
253
|
+
* min and max, none for count.
|
|
254
|
+
*/
|
|
255
|
+
function rollupColumns(child, aggregate) {
|
|
256
|
+
if (aggregate === "count") return [];
|
|
257
|
+
const fits = aggregate === "sum" || aggregate === "avg" ? NUMBERS : ORDERED;
|
|
258
|
+
return readableColumns(child).filter(([, type]) => fits.has(type)).map(([name]) => name);
|
|
259
|
+
}
|
|
260
|
+
/** The select columns of `child` (text with options) a rollup can filter on. */
|
|
261
|
+
function filterColumns(child) {
|
|
262
|
+
return Object.entries(child.columns ?? {}).flatMap(([name, column]) => column.type === "text" && column.options !== void 0 ? [[name, column.options]] : []);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Each app table column that references `parent`, as `{ table, via }`: what a
|
|
266
|
+
* rollup on `parent` can aggregate.
|
|
267
|
+
*/
|
|
268
|
+
function rollupSources(tables, parent) {
|
|
269
|
+
return Object.entries(tables).flatMap(([table, config]) => Object.entries(config.columns ?? {}).filter(([, column]) => column.references !== void 0 && column.references.block === void 0 && column.references.table === parent).map(([via]) => ({
|
|
270
|
+
table,
|
|
271
|
+
via
|
|
272
|
+
})));
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Each column of `name` that references another app table, with that table:
|
|
276
|
+
* what a lookup can follow.
|
|
277
|
+
*/
|
|
278
|
+
function lookupSources(tables, name) {
|
|
279
|
+
return Object.entries(tables[name]?.columns ?? {}).flatMap(([via, column]) => column.references !== void 0 && column.references.block === void 0 && Object.hasOwn(tables, column.references.table) ? [{
|
|
280
|
+
via,
|
|
281
|
+
target: column.references.table
|
|
282
|
+
}] : []);
|
|
283
|
+
}
|
|
284
|
+
function rollupValid(tables, parent, rollup) {
|
|
285
|
+
const child = tables[rollup.table];
|
|
286
|
+
if (child === void 0 || !rollupSources(tables, parent).some((each) => each.table === rollup.table && each.via === rollup.via)) return false;
|
|
287
|
+
const column = rollup.aggregate === "count" ? rollup.column === void 0 : rollup.column !== void 0 && rollupColumns(child, rollup.aggregate).includes(rollup.column);
|
|
288
|
+
const where = rollup.where === void 0 || filterColumns(child).some(([name, options]) => name === rollup.where?.column && options.includes(rollup.where.equals));
|
|
289
|
+
return column && where;
|
|
290
|
+
}
|
|
291
|
+
function lookupValid(tables, name, lookup) {
|
|
292
|
+
const source = lookupSources(tables, name).find((each) => each.via === lookup.via);
|
|
293
|
+
const target = source === void 0 ? void 0 : tables[source.target];
|
|
294
|
+
return target !== void 0 && readableColumns(target).some(([column]) => column === lookup.column);
|
|
295
|
+
}
|
|
296
|
+
function kept(record, keep) {
|
|
297
|
+
if (record === void 0) return;
|
|
298
|
+
const entries = Object.entries(record).filter(([name, value]) => keep(name, value));
|
|
299
|
+
return entries.length === 0 ? void 0 : Object.fromEntries(entries);
|
|
300
|
+
}
|
|
301
|
+
/** `table` with its rollups and lookups replaced, leaving out an empty set. */
|
|
302
|
+
function withComputed(table, rollups, lookups) {
|
|
303
|
+
const { rollups: _rollups, lookups: _lookups, ...rest } = table;
|
|
304
|
+
const next = { ...rest };
|
|
305
|
+
if (rollups !== void 0 && Object.keys(rollups).length > 0) next.rollups = rollups;
|
|
306
|
+
if (lookups !== void 0 && Object.keys(lookups).length > 0) next.lookups = lookups;
|
|
307
|
+
return next;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* `table` with a rollup or lookup set under `name`, replacing `previous` in its
|
|
311
|
+
* place.
|
|
312
|
+
*/
|
|
313
|
+
function tableWithComputed(table, name, computed, previous) {
|
|
314
|
+
const placed = (record, value) => {
|
|
315
|
+
const entries = Object.entries(record ?? {});
|
|
316
|
+
const added = [name, value];
|
|
317
|
+
return Object.fromEntries(entries.some(([each]) => each === previous) ? entries.map(([each, config]) => each === previous ? added : [each, config]) : [...entries, added]);
|
|
318
|
+
};
|
|
319
|
+
return "rollup" in computed ? withComputed(table, placed(table.rollups, computed.rollup), table.lookups) : withComputed(table, table.rollups, placed(table.lookups, computed.lookup));
|
|
320
|
+
}
|
|
321
|
+
/** `table` without the rollup or lookup `name`. */
|
|
322
|
+
function tableWithoutComputed(table, name) {
|
|
323
|
+
return withComputed(table, kept(table.rollups, (each) => each !== name), kept(table.lookups, (each) => each !== name));
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* The tables with every rollup and lookup that no longer fits dropped: one
|
|
327
|
+
* whose table, link or column was deleted or retyped, or whose name a column
|
|
328
|
+
* now uses. `upgrade` would refuse them, and the design code would not encode.
|
|
329
|
+
*/
|
|
330
|
+
function prunedComputed(tables) {
|
|
331
|
+
return Object.fromEntries(Object.entries(tables).map(([name, table]) => {
|
|
332
|
+
const own = new Set(Object.keys(table.columns ?? {}));
|
|
333
|
+
const rollups = kept(table.rollups, (column, rollup) => !own.has(column) && rollupValid(tables, name, rollup));
|
|
334
|
+
return [name, withComputed(table, rollups, kept(table.lookups, (column, lookup) => !own.has(column) && rollups?.[column] === void 0 && lookupValid(tables, name, lookup)))];
|
|
335
|
+
}));
|
|
336
|
+
}
|
|
337
|
+
/** The rollups that aggregate `from`, pointed at `to`. */
|
|
338
|
+
function computedTableRenamed(tables, from, to) {
|
|
339
|
+
return Object.fromEntries(Object.entries(tables).map(([name, table]) => [name, table.rollups === void 0 ? table : {
|
|
340
|
+
...table,
|
|
341
|
+
rollups: Object.fromEntries(Object.entries(table.rollups).map(([column, rollup]) => [column, rollup.table === from ? {
|
|
342
|
+
...rollup,
|
|
343
|
+
table: to
|
|
344
|
+
} : rollup]))
|
|
345
|
+
}]));
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* The rollup fitted to a new source or aggregate: a column the aggregate can
|
|
349
|
+
* read, and a filter the child still has.
|
|
350
|
+
*/
|
|
351
|
+
function fittedRollup(tables, rollup) {
|
|
352
|
+
const child = tables[rollup.table] ?? {};
|
|
353
|
+
const columns = rollupColumns(child, rollup.aggregate);
|
|
354
|
+
const aggregate = rollup.aggregate !== "count" && columns.length === 0 ? "count" : rollup.aggregate;
|
|
355
|
+
const column = aggregate === "count" ? void 0 : rollup.column !== void 0 && columns.includes(rollup.column) ? rollup.column : columns[0];
|
|
356
|
+
const where = rollup.where !== void 0 && filterColumns(child).some(([name, options]) => name === rollup.where?.column && options.includes(rollup.where.equals)) ? rollup.where : void 0;
|
|
357
|
+
const next = {
|
|
358
|
+
table: rollup.table,
|
|
359
|
+
via: rollup.via,
|
|
360
|
+
aggregate
|
|
361
|
+
};
|
|
362
|
+
if (column !== void 0) next.column = column;
|
|
363
|
+
if (where !== void 0) next.where = where;
|
|
364
|
+
return next;
|
|
365
|
+
}
|
|
366
|
+
function rollupRenamed(rollup, swap) {
|
|
367
|
+
const next = {
|
|
368
|
+
...rollup,
|
|
369
|
+
via: swap(rollup.via)
|
|
370
|
+
};
|
|
371
|
+
if (rollup.column !== void 0) next.column = swap(rollup.column);
|
|
372
|
+
if (rollup.where !== void 0) next.where = {
|
|
373
|
+
...rollup.where,
|
|
374
|
+
column: swap(rollup.where.column)
|
|
375
|
+
};
|
|
376
|
+
return next;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Every rollup and lookup that reads `table.from`, reading `table.to`. The
|
|
380
|
+
* tables already have the column renamed, so a lookup finds its target through
|
|
381
|
+
* the renamed link.
|
|
382
|
+
*/
|
|
383
|
+
function computedColumnRenamed(tables, table, from, to) {
|
|
384
|
+
const swap = (column) => column === from ? to : column;
|
|
385
|
+
const lookupTarget = (owner, via) => {
|
|
386
|
+
const reference = tables[owner]?.columns?.[via]?.references;
|
|
387
|
+
return reference?.block === void 0 ? reference?.table : void 0;
|
|
388
|
+
};
|
|
389
|
+
return Object.fromEntries(Object.entries(tables).map(([name, config]) => {
|
|
390
|
+
return [name, withComputed(config, config.rollups === void 0 ? void 0 : Object.fromEntries(Object.entries(config.rollups).map(([column, rollup]) => [column, rollup.table === table ? rollupRenamed(rollup, swap) : rollup])), config.lookups === void 0 ? void 0 : Object.fromEntries(Object.entries(config.lookups).map(([column, lookup]) => {
|
|
391
|
+
const via = name === table ? swap(lookup.via) : lookup.via;
|
|
392
|
+
return [column, {
|
|
393
|
+
via,
|
|
394
|
+
column: lookupTarget(name, via) === table ? swap(lookup.column) : lookup.column
|
|
395
|
+
}];
|
|
396
|
+
})))];
|
|
397
|
+
}));
|
|
398
|
+
}
|
|
399
|
+
function rollupSummary(rollup) {
|
|
400
|
+
const what = rollup.aggregate === "count" ? `count of ${rollup.table}` : `${rollup.aggregate} of ${rollup.table}.${rollup.column ?? ""}`;
|
|
401
|
+
return rollup.where === void 0 ? what : `${what} where ${rollup.where.column} = ${rollup.where.equals}`;
|
|
402
|
+
}
|
|
403
|
+
/** The rollups and lookups of an app table, in the view's column order. */
|
|
404
|
+
function computedRows(table) {
|
|
405
|
+
return [...Object.entries(table.rollups ?? {}).map(([name, rollup]) => ({
|
|
406
|
+
name,
|
|
407
|
+
kind: "rollup",
|
|
408
|
+
summary: rollupSummary(rollup),
|
|
409
|
+
label: rollup.aggregate
|
|
410
|
+
})), ...Object.entries(table.lookups ?? {}).map(([name, lookup]) => {
|
|
411
|
+
return {
|
|
412
|
+
name,
|
|
413
|
+
kind: "lookup",
|
|
414
|
+
summary: `${table.columns?.[lookup.via]?.references?.table ?? lookup.via}.${lookup.column} through ${lookup.via}`,
|
|
415
|
+
label: "lookup"
|
|
416
|
+
};
|
|
417
|
+
})];
|
|
418
|
+
}
|
|
419
|
+
// src/create/design.ts
|
|
420
|
+
const EMPTY_DESIGN = {};
|
|
421
|
+
/** The schema app tables go in. */
|
|
422
|
+
const APP_SCHEMA = "public";
|
|
423
|
+
/** The module name app tables carry in the diagram. */
|
|
424
|
+
const APP_MODULE = "app-tables";
|
|
425
|
+
/** Column names every app table creates itself. */
|
|
426
|
+
const IMPLICIT_COLUMNS = /* @__PURE__ */ new Set([
|
|
427
|
+
"id",
|
|
428
|
+
"created_at",
|
|
429
|
+
"updated_at"
|
|
430
|
+
]);
|
|
431
|
+
function appTableId(name) {
|
|
432
|
+
return `${APP_SCHEMA}.${name}`;
|
|
433
|
+
}
|
|
434
|
+
function isAppTable(table) {
|
|
435
|
+
return table.module === APP_MODULE;
|
|
436
|
+
}
|
|
437
|
+
function isEmptyDesign(design) {
|
|
438
|
+
return Object.keys(design.appTables ?? {}).length === 0 && Object.keys(design.extraColumns ?? {}).length === 0 && Object.keys(design.positions ?? {}).length === 0;
|
|
439
|
+
}
|
|
440
|
+
/** Why `name` can't name an app table or column, by the library's rules. */
|
|
441
|
+
function identifierError(name) {
|
|
442
|
+
return appIdentifierError(name);
|
|
443
|
+
}
|
|
444
|
+
/** The names of an app table's columns, its implicit ones included. */
|
|
445
|
+
function columnNamesOf(table, preset) {
|
|
446
|
+
const scope = scopeColumnOf(table, preset);
|
|
447
|
+
return [
|
|
448
|
+
"id",
|
|
449
|
+
...scope === null ? [] : [scope.name],
|
|
450
|
+
...Object.keys(table.columns ?? {}),
|
|
451
|
+
...table.timestamps === false ? [] : ["created_at", "updated_at"],
|
|
452
|
+
...computedRows(table).map((row) => row.name)
|
|
453
|
+
];
|
|
454
|
+
}
|
|
455
|
+
/** Why a column can't be added to an app table, or `undefined` when it can. */
|
|
456
|
+
function columnError(table, name, preset) {
|
|
457
|
+
const invalid = identifierError(name);
|
|
458
|
+
if (invalid !== void 0) return invalid;
|
|
459
|
+
if (IMPLICIT_COLUMNS.has(name) || columnNamesOf(table, preset).includes(name)) return `The table already has a ${name} column.`;
|
|
460
|
+
if (appReservedColumns(preset.tenantName).includes(name)) return `${name} is a column every app table can get from its scope. Choose another name.`;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Why `value` can't be the default of `column` (its type, options and bounds),
|
|
464
|
+
* or `undefined` when it can or is empty.
|
|
465
|
+
*/
|
|
466
|
+
function defaultError(column, value) {
|
|
467
|
+
const trimmed = value.trim();
|
|
468
|
+
return trimmed === "" ? void 0 : appDefaultError(column, trimmed);
|
|
469
|
+
}
|
|
470
|
+
/** A column with its type changed, dropping the keys the new type can't take. */
|
|
471
|
+
function retyped(column, type) {
|
|
472
|
+
return fitted({
|
|
473
|
+
...column,
|
|
474
|
+
type
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
/** A free app table name: `base`, then `base_2`, `base_3` and so on. */
|
|
478
|
+
function freeTableName(design, taken, base = "items") {
|
|
479
|
+
const used = (name) => taken.has(appTableId(name)) || design.appTables?.[name] !== void 0;
|
|
480
|
+
if (!used(base)) return base;
|
|
481
|
+
let index = 2;
|
|
482
|
+
while (used(`${base}_${index}`)) index += 1;
|
|
483
|
+
return `${base}_${index}`;
|
|
484
|
+
}
|
|
485
|
+
function withAppTables(design, appTables) {
|
|
486
|
+
const { appTables: _drop, ...rest } = design;
|
|
487
|
+
return Object.keys(appTables).length === 0 ? rest : {
|
|
488
|
+
...rest,
|
|
489
|
+
appTables: prunedComputed(appTables)
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
function withPositions(design, positions) {
|
|
493
|
+
const { positions: _drop, ...rest } = design;
|
|
494
|
+
return Object.keys(positions).length === 0 ? rest : {
|
|
495
|
+
...rest,
|
|
496
|
+
positions
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
function omitKey(record, key) {
|
|
500
|
+
const { [key]: _drop, ...rest } = record ?? {};
|
|
501
|
+
return rest;
|
|
502
|
+
}
|
|
503
|
+
/** Adds an app table, placed at `position` when given. */
|
|
504
|
+
function addTable(design, name, table = {}, position) {
|
|
505
|
+
const next = withAppTables(design, {
|
|
506
|
+
...design.appTables,
|
|
507
|
+
[name]: table
|
|
508
|
+
});
|
|
509
|
+
return position === void 0 ? next : withPositions(next, {
|
|
510
|
+
...next.positions,
|
|
511
|
+
[appTableId(name)]: position
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Removes an app table, every app table column that references it (and those
|
|
516
|
+
* columns from key sets), and the rollups and lookups that read it.
|
|
517
|
+
*/
|
|
518
|
+
function deleteTable(design, name) {
|
|
519
|
+
const rest = omitKey(design.appTables, name);
|
|
520
|
+
return withPositions(withAppTables(design, Object.fromEntries(Object.entries(rest).map(([key, table]) => {
|
|
521
|
+
const dropped = new Set(Object.entries(table.columns ?? {}).filter(([, column]) => column.references?.block === void 0 && column.references?.table === name).map(([column]) => column));
|
|
522
|
+
return [key, dropped.size === 0 ? table : withKeySets({
|
|
523
|
+
...table,
|
|
524
|
+
columns: Object.fromEntries(Object.entries(table.columns ?? {}).filter(([column]) => !dropped.has(column)))
|
|
525
|
+
}, (columns) => columns.filter((column) => !dropped.has(column)))];
|
|
526
|
+
}))), omitKey(design.positions, appTableId(name)));
|
|
527
|
+
}
|
|
528
|
+
/** Renames an app table and the references to it. */
|
|
529
|
+
function renameTable(design, from, to) {
|
|
530
|
+
if (from === to || design.appTables?.[from] === void 0) return design;
|
|
531
|
+
const appTables = Object.fromEntries(Object.entries(design.appTables).map(([key, table]) => [key === from ? to : key, {
|
|
532
|
+
...table,
|
|
533
|
+
columns: Object.fromEntries(Object.entries(table.columns ?? {}).map(([name, column]) => [name, column.references?.block === void 0 && column.references?.table === from ? {
|
|
534
|
+
...column,
|
|
535
|
+
references: {
|
|
536
|
+
...column.references,
|
|
537
|
+
table: to
|
|
538
|
+
}
|
|
539
|
+
} : column]))
|
|
540
|
+
}]));
|
|
541
|
+
const position = design.positions?.[appTableId(from)];
|
|
542
|
+
const positions = omitKey(design.positions, appTableId(from));
|
|
543
|
+
return withPositions(withAppTables(design, computedTableRenamed(appTables, from, to)), position === void 0 ? positions : {
|
|
544
|
+
...positions,
|
|
545
|
+
[appTableId(to)]: position
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
const TABLE_PATCH_KEYS = [
|
|
549
|
+
"scope",
|
|
550
|
+
"timestamps",
|
|
551
|
+
"id",
|
|
552
|
+
"unique",
|
|
553
|
+
"indexes",
|
|
554
|
+
"comment",
|
|
555
|
+
"subject",
|
|
556
|
+
"events"
|
|
557
|
+
];
|
|
558
|
+
function patchKey(next, patch, key) {
|
|
559
|
+
if (!(key in patch)) return;
|
|
560
|
+
const value = patch[key];
|
|
561
|
+
if (value === void 0) delete next[key];
|
|
562
|
+
else next[key] = value;
|
|
563
|
+
}
|
|
564
|
+
/** Updates an app table's options; a key set to `undefined` is removed. */
|
|
565
|
+
function updateTable(design, name, patch) {
|
|
566
|
+
const table = design.appTables?.[name];
|
|
567
|
+
if (table === void 0) return design;
|
|
568
|
+
const next = { ...table };
|
|
569
|
+
for (const key of TABLE_PATCH_KEYS) patchKey(next, patch, key);
|
|
570
|
+
return withAppTables(design, {
|
|
571
|
+
...design.appTables,
|
|
572
|
+
[name]: next
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Sets an app table's id type and retypes the app table columns that reference
|
|
577
|
+
* it, since a key has the type of the id it points at.
|
|
578
|
+
*/
|
|
579
|
+
function setTableId(design, name, id) {
|
|
580
|
+
const next = updateTable(design, name, { id: id === "uuid" ? void 0 : id });
|
|
581
|
+
return withAppTables(next, Object.fromEntries(Object.entries(next.appTables ?? {}).map(([key, table]) => [key, {
|
|
582
|
+
...table,
|
|
583
|
+
columns: Object.fromEntries(Object.entries(table.columns ?? {}).map(([column, config]) => [column, config.references?.block === void 0 && config.references?.table === name ? retyped(config, id) : config]))
|
|
584
|
+
}])));
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* A table's composite key sets with `edit` applied to each, dropping empty sets
|
|
588
|
+
* and an empty list.
|
|
589
|
+
*/
|
|
590
|
+
function withKeySets(table, edit) {
|
|
591
|
+
const { unique, indexes, ...rest } = table;
|
|
592
|
+
const sets = (list) => {
|
|
593
|
+
const next = (list ?? []).map(edit).filter((columns) => columns.length > 0);
|
|
594
|
+
return next.length === 0 ? void 0 : next;
|
|
595
|
+
};
|
|
596
|
+
const next = { ...rest };
|
|
597
|
+
const nextUnique = sets(unique);
|
|
598
|
+
if (rest.subject !== void 0) next.subject = subjectColumnsEdited(rest.subject, edit);
|
|
599
|
+
if (rest.events !== void 0) next.events = eventsColumnsEdited(rest.events, edit);
|
|
600
|
+
const nextIndexes = sets(indexes);
|
|
601
|
+
if (nextUnique !== void 0) next.unique = nextUnique;
|
|
602
|
+
if (nextIndexes !== void 0) next.indexes = nextIndexes;
|
|
603
|
+
return next;
|
|
604
|
+
}
|
|
605
|
+
/** Sets (adds or replaces) an app table column. */
|
|
606
|
+
function setColumn(design, table, name, column) {
|
|
607
|
+
const current = design.appTables?.[table];
|
|
608
|
+
return current === void 0 ? design : withAppTables(design, {
|
|
609
|
+
...design.appTables,
|
|
610
|
+
[table]: {
|
|
611
|
+
...current,
|
|
612
|
+
columns: {
|
|
613
|
+
...current.columns,
|
|
614
|
+
[name]: column
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
/** Renames an app table column, keeping its place. */
|
|
620
|
+
function renameColumn(design, table, from, to) {
|
|
621
|
+
const current = design.appTables?.[table];
|
|
622
|
+
if (current === void 0 || from === to) return design;
|
|
623
|
+
return withAppTables(design, computedColumnRenamed({
|
|
624
|
+
...design.appTables,
|
|
625
|
+
[table]: withKeySets({
|
|
626
|
+
...current,
|
|
627
|
+
columns: Object.fromEntries(Object.entries(current.columns ?? {}).map(([name, column]) => [name === from ? to : name, column]))
|
|
628
|
+
}, (columns) => columns.map((column) => column === from ? to : column))
|
|
629
|
+
}, table, from, to));
|
|
630
|
+
}
|
|
631
|
+
/** Replaces an app table with `edit` applied to it, such as `tableWithComputed`. */
|
|
632
|
+
function editTable(design, table, edit) {
|
|
633
|
+
const current = design.appTables?.[table];
|
|
634
|
+
return current === void 0 ? design : withAppTables(design, {
|
|
635
|
+
...design.appTables,
|
|
636
|
+
[table]: edit(current)
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
function deleteColumn(design, table, name) {
|
|
640
|
+
const current = design.appTables?.[table];
|
|
641
|
+
return current === void 0 ? design : withAppTables(design, {
|
|
642
|
+
...design.appTables,
|
|
643
|
+
[table]: withKeySets({
|
|
644
|
+
...current,
|
|
645
|
+
columns: omitKey(current.columns, name)
|
|
646
|
+
}, (columns) => columns.filter((column) => column !== name))
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Sets an extra column on a block table
|
|
651
|
+
* (`blocks.<module>.options.extraColumns`).
|
|
652
|
+
*/
|
|
653
|
+
function setExtraColumn(design, module, name, type) {
|
|
654
|
+
return {
|
|
655
|
+
...design,
|
|
656
|
+
extraColumns: {
|
|
657
|
+
...design.extraColumns,
|
|
658
|
+
[module]: {
|
|
659
|
+
...design.extraColumns?.[module],
|
|
660
|
+
[name]: type
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
function deleteExtraColumn(design, module, name) {
|
|
666
|
+
const columns = omitKey(design.extraColumns?.[module], name);
|
|
667
|
+
const { extraColumns: _drop, ...rest } = design;
|
|
668
|
+
const extraColumns = Object.keys(columns).length === 0 ? omitKey(design.extraColumns, module) : {
|
|
669
|
+
...design.extraColumns,
|
|
670
|
+
[module]: columns
|
|
671
|
+
};
|
|
672
|
+
return Object.keys(extraColumns).length === 0 ? rest : {
|
|
673
|
+
...rest,
|
|
674
|
+
extraColumns
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
/** Copies an app table under a free name, next to the original. */
|
|
678
|
+
function duplicateTable(design, name, taken) {
|
|
679
|
+
const table = design.appTables?.[name];
|
|
680
|
+
if (table === void 0) return {
|
|
681
|
+
design,
|
|
682
|
+
name
|
|
683
|
+
};
|
|
684
|
+
const copy = freeTableName(design, taken, `${name}_copy`);
|
|
685
|
+
const position = design.positions?.[appTableId(name)];
|
|
686
|
+
return {
|
|
687
|
+
design: addTable(design, copy, table.subject === void 0 ? table : {
|
|
688
|
+
...table,
|
|
689
|
+
subject: {
|
|
690
|
+
...table.subject,
|
|
691
|
+
type: singular(copy)
|
|
692
|
+
}
|
|
693
|
+
}, position === void 0 ? void 0 : [position[0] + 40, position[1] + 40]),
|
|
694
|
+
name: copy
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
/** Moves tables (table id to its new top-left corner). */
|
|
698
|
+
function moveTables(design, moves) {
|
|
699
|
+
return withPositions(design, {
|
|
700
|
+
...design.positions,
|
|
701
|
+
...moves
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* The app table column behind a foreign key from `tableId`, when the canvas
|
|
706
|
+
* added it, or `undefined` when a block or the preset owns the key.
|
|
707
|
+
*/
|
|
708
|
+
function userConnection(design, tableId, column) {
|
|
709
|
+
const name = Object.keys(design.appTables ?? {}).find((each) => appTableId(each) === tableId);
|
|
710
|
+
if (name === void 0 || column === null) return;
|
|
711
|
+
return design.appTables?.[name]?.columns?.[column]?.references === void 0 ? void 0 : {
|
|
712
|
+
table: name,
|
|
713
|
+
column
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
/** Drops every saved position, so the automatic layout places every table again. */
|
|
717
|
+
function tidy(design) {
|
|
718
|
+
return withPositions(design, {});
|
|
719
|
+
}
|
|
720
|
+
const SINGULAR_ENDINGS = [
|
|
721
|
+
[/ies$/u, "y"],
|
|
722
|
+
[/(ss|us)$/u, "$1"],
|
|
723
|
+
[/s$/u, ""]
|
|
724
|
+
];
|
|
725
|
+
/** A naive English singular for a table name: `organizations` to `organization`. */
|
|
726
|
+
function singular(name) {
|
|
727
|
+
for (const [ending, replacement] of SINGULAR_ENDINGS) if (ending.test(name)) return name.replace(ending, replacement);
|
|
728
|
+
return name;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* The column types a foreign key can point at, from the target's primary key
|
|
732
|
+
* type.
|
|
733
|
+
*/
|
|
734
|
+
function referenceType(type) {
|
|
735
|
+
const normal = type.toLowerCase();
|
|
736
|
+
switch (normal) {
|
|
737
|
+
case "uuid":
|
|
738
|
+
case "text":
|
|
739
|
+
case "bigint":
|
|
740
|
+
case "integer": return normal;
|
|
741
|
+
case "int8":
|
|
742
|
+
case "bigserial": return "bigint";
|
|
743
|
+
case "int":
|
|
744
|
+
case "int4":
|
|
745
|
+
case "serial": return "integer";
|
|
746
|
+
default: return;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Adds a foreign key column from an app table to `target`. Only app tables get
|
|
751
|
+
* new columns. A self reference gets `parent_id`, and a second reference to the
|
|
752
|
+
* same table gets a role name (`owner_id`, `<target>_2_id`) the user can
|
|
753
|
+
* rename. A target without a single-column primary key, and the tenant table
|
|
754
|
+
* the scope column already references, are refused with a message.
|
|
755
|
+
*/
|
|
756
|
+
function connect(design, data, preset, connection) {
|
|
757
|
+
const source = data.tables.find((table) => table.id === connection.source);
|
|
758
|
+
if (source === void 0 || !isAppTable(source)) return {
|
|
759
|
+
ok: false,
|
|
760
|
+
error: "Block tables only accept connections. Drag from an app table."
|
|
761
|
+
};
|
|
762
|
+
if (design.appTables?.[source.name] === void 0) return {
|
|
763
|
+
ok: false,
|
|
764
|
+
error: `${source.name} is not in the design.`
|
|
765
|
+
};
|
|
766
|
+
if (source.tenantColumn !== null && connection.target === data.tenantTable) return {
|
|
767
|
+
ok: false,
|
|
768
|
+
error: `${source.name} already references ${connection.target} through ${source.tenantColumn}.`
|
|
769
|
+
};
|
|
770
|
+
return referenceFrom(design, data, preset, source.name, connection.target);
|
|
771
|
+
}
|
|
772
|
+
/** Second references to `auth.users`, in the order they are offered. */
|
|
773
|
+
const USER_ROLES = [
|
|
774
|
+
"owner_id",
|
|
775
|
+
"assignee_id",
|
|
776
|
+
"reviewer_id",
|
|
777
|
+
"approver_id"
|
|
778
|
+
];
|
|
779
|
+
/** The first column name for a reference that the table can still take. */
|
|
780
|
+
function referenceColumn(table, base, roles, preset) {
|
|
781
|
+
const stem = base.replace(/_id$/u, "");
|
|
782
|
+
return [
|
|
783
|
+
base,
|
|
784
|
+
...roles,
|
|
785
|
+
...Array.from({ length: 8 }, (_, index) => `${stem}_${index + 2}_id`)
|
|
786
|
+
].find((candidate) => columnError(table, candidate, preset) === void 0);
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Adds a key to `targetId` on the app table `name` in the design, which can be
|
|
790
|
+
* a table the schema doesn't have yet: `<target>_id`, `parent_id` for a self
|
|
791
|
+
* reference, or a free role name when that column is taken.
|
|
792
|
+
*/
|
|
793
|
+
function referenceFrom(design, data, preset, name, targetId) {
|
|
794
|
+
const table = design.appTables?.[name];
|
|
795
|
+
if (table === void 0) return {
|
|
796
|
+
ok: false,
|
|
797
|
+
error: `${name} is not in the design.`
|
|
798
|
+
};
|
|
799
|
+
const target = targetId === "auth.users" ? void 0 : data.tables.find((each) => each.id === targetId);
|
|
800
|
+
if (targetId !== "auth.users" && target === void 0) return {
|
|
801
|
+
ok: false,
|
|
802
|
+
error: "That table is not in the schema."
|
|
803
|
+
};
|
|
804
|
+
const keyType = target === void 0 ? "uuid" : target.primaryKey.length === 1 ? target.columns.find((column) => column.name === target.primaryKey[0])?.type : void 0;
|
|
805
|
+
const type = keyType === void 0 ? void 0 : referenceType(keyType);
|
|
806
|
+
if (type === void 0) return {
|
|
807
|
+
ok: false,
|
|
808
|
+
error: `${targetId} has no single uuid, text or integer key to reference.`
|
|
809
|
+
};
|
|
810
|
+
const references = target === void 0 ? { table: AUTH_USERS$1 } : isAppTable(target) ? { table: target.name } : data.blockTables[target.id];
|
|
811
|
+
if (references === void 0) return {
|
|
812
|
+
ok: false,
|
|
813
|
+
error: `${targetId} can't be referenced from an app table.`
|
|
814
|
+
};
|
|
815
|
+
const self = targetId === appTableId(name);
|
|
816
|
+
const user = target === void 0;
|
|
817
|
+
const column = referenceColumn(table, self ? "parent_id" : `${singular(user ? "user" : target.name)}_id`, user ? USER_ROLES : [], preset);
|
|
818
|
+
if (column === void 0) return {
|
|
819
|
+
ok: false,
|
|
820
|
+
error: `${name} already has every column name a reference to ${targetId} gets. Rename one first.`
|
|
821
|
+
};
|
|
822
|
+
return {
|
|
823
|
+
ok: true,
|
|
824
|
+
column,
|
|
825
|
+
design: setColumn(design, name, column, {
|
|
826
|
+
type,
|
|
827
|
+
nullable: true,
|
|
828
|
+
references: {
|
|
829
|
+
...references,
|
|
830
|
+
onDelete: self || user ? "set null" : "cascade"
|
|
831
|
+
}
|
|
832
|
+
})
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
function appColumn(name, column) {
|
|
836
|
+
const label = columnLabel(column);
|
|
837
|
+
const schemaColumn = {
|
|
838
|
+
name,
|
|
839
|
+
type: column.type,
|
|
840
|
+
nullable: column.identity === true ? false : column.nullable ?? true,
|
|
841
|
+
default: column.identity === true ? "identity" : column.default ?? null,
|
|
842
|
+
unique: column.unique ?? false
|
|
843
|
+
};
|
|
844
|
+
return label === void 0 ? schemaColumn : {
|
|
845
|
+
...schemaColumn,
|
|
846
|
+
label
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
const TIMESTAMP = {
|
|
850
|
+
type: "timestamptz",
|
|
851
|
+
nullable: false,
|
|
852
|
+
default: "now()",
|
|
853
|
+
unique: false
|
|
854
|
+
};
|
|
855
|
+
/**
|
|
856
|
+
* The id of the table a reference points at, or `undefined` when it is not in
|
|
857
|
+
* the schema.
|
|
858
|
+
*/
|
|
859
|
+
function referencedId(reference, data) {
|
|
860
|
+
if (reference.block === void 0) return reference.table === "auth.users" ? AUTH_USERS$1 : appTableId(reference.table);
|
|
861
|
+
return Object.entries(data.blockTables).find(([, each]) => each.block === reference.block && each.table === reference.table)?.[0];
|
|
862
|
+
}
|
|
863
|
+
function foreignKey(column, to, onDelete = "no action") {
|
|
864
|
+
const [schema = "", target = ""] = to.split(".");
|
|
865
|
+
return {
|
|
866
|
+
columns: [column],
|
|
867
|
+
target: {
|
|
868
|
+
schema,
|
|
869
|
+
table: target,
|
|
870
|
+
columns: []
|
|
871
|
+
},
|
|
872
|
+
onDelete
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
/** An app table as the diagram reads it. */
|
|
876
|
+
function appSchemaTable(name, table, data, preset) {
|
|
877
|
+
const scope = scopeColumnOf(table, preset);
|
|
878
|
+
const scopeTo = scope === null ? void 0 : scope.name === "user_id" ? AUTH_USERS$1 : data.tenantTable ?? void 0;
|
|
879
|
+
const columns = [
|
|
880
|
+
table.id === "bigint" ? {
|
|
881
|
+
name: "id",
|
|
882
|
+
type: "bigint",
|
|
883
|
+
nullable: false,
|
|
884
|
+
default: "identity",
|
|
885
|
+
unique: false
|
|
886
|
+
} : {
|
|
887
|
+
name: "id",
|
|
888
|
+
type: "uuid",
|
|
889
|
+
nullable: false,
|
|
890
|
+
default: "gen_random_uuid()",
|
|
891
|
+
unique: false
|
|
892
|
+
},
|
|
893
|
+
...scope === null ? [] : [scope],
|
|
894
|
+
...Object.entries(table.columns ?? {}).map(([key, column]) => appColumn(key, column)),
|
|
895
|
+
...subjectColumns(table.subject),
|
|
896
|
+
...table.timestamps === false ? [] : [{
|
|
897
|
+
name: "created_at",
|
|
898
|
+
...TIMESTAMP
|
|
899
|
+
}, {
|
|
900
|
+
name: "updated_at",
|
|
901
|
+
...TIMESTAMP
|
|
902
|
+
}]
|
|
903
|
+
];
|
|
904
|
+
const scopeKeys = scope === null || scopeTo === void 0 ? [] : [foreignKey(scope.name, scopeTo, "cascade")];
|
|
905
|
+
const columnKeys = Object.entries(table.columns ?? {}).flatMap(([key, column]) => {
|
|
906
|
+
const to = column.references === void 0 ? void 0 : referencedId(column.references, data);
|
|
907
|
+
return to === void 0 ? [] : [foreignKey(key, to, column.references?.onDelete)];
|
|
908
|
+
});
|
|
909
|
+
const schemaTable = {
|
|
910
|
+
id: appTableId(name),
|
|
911
|
+
schema: APP_SCHEMA,
|
|
912
|
+
name,
|
|
913
|
+
module: APP_MODULE,
|
|
914
|
+
primaryKey: ["id"],
|
|
915
|
+
foreignKeys: [...scopeKeys, ...columnKeys],
|
|
916
|
+
tenantColumn: scope !== null && scope.name !== "user_id" ? scope.name : null,
|
|
917
|
+
columns
|
|
918
|
+
};
|
|
919
|
+
const computed = computedRows(table);
|
|
920
|
+
return computed.length === 0 ? schemaTable : {
|
|
921
|
+
...schemaTable,
|
|
922
|
+
computed
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
/** The extra column names a block table got from the design. */
|
|
926
|
+
function extraColumnsOf(design, table, data) {
|
|
927
|
+
return data.extraColumns.includes(table.id) ? design.extraColumns?.[table.module] ?? {} : {};
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* The schema with the design applied: app tables added, extra columns appended
|
|
931
|
+
* to the block tables that accept them.
|
|
932
|
+
*/
|
|
933
|
+
function withDesign(data, design, preset) {
|
|
934
|
+
const tables = data.tables.map((table) => {
|
|
935
|
+
const extra = extraColumnsOf(design, table, data);
|
|
936
|
+
const names = new Set(table.columns.map((column) => column.name));
|
|
937
|
+
const added = Object.entries(extra).filter(([name]) => !names.has(name)).map(([name, type]) => ({
|
|
938
|
+
name,
|
|
939
|
+
type,
|
|
940
|
+
nullable: !/\bnot\s+null\b/iu.test(type),
|
|
941
|
+
default: null,
|
|
942
|
+
unique: false
|
|
943
|
+
}));
|
|
944
|
+
return added.length === 0 ? table : {
|
|
945
|
+
...table,
|
|
946
|
+
columns: [...table.columns, ...added]
|
|
947
|
+
};
|
|
948
|
+
});
|
|
949
|
+
const appTables = Object.entries(design.appTables ?? {}).map(([name, table]) => appSchemaTable(name, table, data, preset));
|
|
950
|
+
return {
|
|
951
|
+
...data,
|
|
952
|
+
tables: [...tables, ...appTables],
|
|
953
|
+
manifests: {
|
|
954
|
+
...data.manifests,
|
|
955
|
+
...Object.fromEntries(appTables.map((table) => [table.id, APP_MODULE]))
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
// src/create/design-issues.ts
|
|
960
|
+
/**
|
|
961
|
+
* What would stop `upgrade` from writing the design: a table name a block
|
|
962
|
+
* already uses, a reference to a table the preset no longer installs, a
|
|
963
|
+
* set-null delete on a required column, a composite key on a column the table
|
|
964
|
+
* doesn't have, and extra columns for a block that is gone or no longer takes
|
|
965
|
+
* them.
|
|
966
|
+
*/
|
|
967
|
+
function designIssues(design, data, preset) {
|
|
968
|
+
const issues = [];
|
|
969
|
+
const names = new Set(data.tables.filter((table) => !isAppTable(table)).map((table) => table.name));
|
|
970
|
+
const logical = new Set(Object.values(data.blockTables).map((each) => `${each.block}.${each.table}`));
|
|
971
|
+
const modules = new Set(data.tables.filter((table) => data.extraColumns.includes(table.id)).map((table) => table.module));
|
|
972
|
+
const subjectTypes = /* @__PURE__ */ new Map();
|
|
973
|
+
for (const [name, table] of Object.entries(design.appTables ?? {})) {
|
|
974
|
+
const type = table.subject?.type;
|
|
975
|
+
if (type !== void 0 && !subjectTypes.has(type)) subjectTypes.set(type, name);
|
|
976
|
+
}
|
|
977
|
+
for (const [name, table] of Object.entries(design.appTables ?? {})) {
|
|
978
|
+
const invalid = identifierError(name);
|
|
979
|
+
if (invalid !== void 0) issues.push({
|
|
980
|
+
severity: "error",
|
|
981
|
+
source: "rules",
|
|
982
|
+
code: "invalid_name",
|
|
983
|
+
path: jsonPointer("appTables", name),
|
|
984
|
+
table: name,
|
|
985
|
+
message: `The name ${name} is invalid. ${invalid}`
|
|
986
|
+
});
|
|
987
|
+
if (names.has(name)) issues.push({
|
|
988
|
+
severity: "error",
|
|
989
|
+
source: "rules",
|
|
990
|
+
code: "table_name_taken",
|
|
991
|
+
path: jsonPointer("appTables", name),
|
|
992
|
+
table: name,
|
|
993
|
+
message: `A block already creates a ${name} table. Rename this one.`
|
|
994
|
+
});
|
|
995
|
+
const long = appNameLengthError(name, table);
|
|
996
|
+
if (long !== void 0) issues.push({
|
|
997
|
+
severity: "error",
|
|
998
|
+
source: "rules",
|
|
999
|
+
code: "name_too_long",
|
|
1000
|
+
path: jsonPointer("appTables", name),
|
|
1001
|
+
table: name,
|
|
1002
|
+
message: `${long}.`
|
|
1003
|
+
});
|
|
1004
|
+
const type = table.subject?.type;
|
|
1005
|
+
if (type !== void 0 && subjectTypes.get(type) !== name) issues.push({
|
|
1006
|
+
severity: "error",
|
|
1007
|
+
source: "rules",
|
|
1008
|
+
code: "subject_type_taken",
|
|
1009
|
+
path: jsonPointer("appTables", name, "subject", "type"),
|
|
1010
|
+
table: name,
|
|
1011
|
+
message: `${subjectTypes.get(type)} already has the subject type ${type}. Choose another.`
|
|
1012
|
+
});
|
|
1013
|
+
for (const [column, config] of Object.entries(table.columns ?? {})) {
|
|
1014
|
+
const fallback = config.default === void 0 ? void 0 : defaultError(config, config.default);
|
|
1015
|
+
if (fallback !== void 0) issues.push({
|
|
1016
|
+
severity: "error",
|
|
1017
|
+
source: "rules",
|
|
1018
|
+
code: "invalid_default",
|
|
1019
|
+
path: jsonPointer("appTables", name, "columns", column, "default"),
|
|
1020
|
+
table: name,
|
|
1021
|
+
message: `${name}.${column}: ${fallback}`
|
|
1022
|
+
});
|
|
1023
|
+
if (lockedWithoutDefault(config)) issues.push({
|
|
1024
|
+
severity: "error",
|
|
1025
|
+
source: "rules",
|
|
1026
|
+
code: "default_required",
|
|
1027
|
+
path: jsonPointer("appTables", name, "columns", column),
|
|
1028
|
+
table: name,
|
|
1029
|
+
message: `${name}.${column} is required, and signed-in users can't write it, so give it a default.`
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
for (const column of subjectColumns(table.subject)) if (Object.hasOwn(table.columns ?? {}, column.name)) issues.push({
|
|
1033
|
+
severity: "error",
|
|
1034
|
+
source: "rules",
|
|
1035
|
+
code: "column_clash",
|
|
1036
|
+
path: jsonPointer("appTables", name, "columns", column.name),
|
|
1037
|
+
table: name,
|
|
1038
|
+
message: `${name}.${column.name} clashes with the column its record features add. Rename it.`
|
|
1039
|
+
});
|
|
1040
|
+
const known = /* @__PURE__ */ new Set([
|
|
1041
|
+
"id",
|
|
1042
|
+
...Object.keys(table.columns ?? {}),
|
|
1043
|
+
...table.timestamps === false ? [] : ["created_at", "updated_at"]
|
|
1044
|
+
]);
|
|
1045
|
+
const scope = scopeColumnOf(table, preset);
|
|
1046
|
+
if (scope !== null) known.add(scope.name);
|
|
1047
|
+
for (const [key, field, sets] of [[
|
|
1048
|
+
"unique key",
|
|
1049
|
+
"unique",
|
|
1050
|
+
table.unique
|
|
1051
|
+
], [
|
|
1052
|
+
"index",
|
|
1053
|
+
"indexes",
|
|
1054
|
+
table.indexes
|
|
1055
|
+
]]) for (const [index, columns] of (sets ?? []).entries()) {
|
|
1056
|
+
const gone = columns.filter((column) => !known.has(column));
|
|
1057
|
+
if (gone.length > 0) issues.push({
|
|
1058
|
+
severity: "error",
|
|
1059
|
+
source: "rules",
|
|
1060
|
+
code: "unknown_column",
|
|
1061
|
+
path: jsonPointer("appTables", name, field, index),
|
|
1062
|
+
table: name,
|
|
1063
|
+
message: `The ${key} on ${columns.join(", ")} names ${gone.join(", ")}, which ${name} doesn't have.`
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
for (const [column, config] of Object.entries(table.columns ?? {})) {
|
|
1067
|
+
const reference = config.references;
|
|
1068
|
+
if (reference === void 0) continue;
|
|
1069
|
+
if (reference.block === void 0 ? reference.table !== "auth.users" && design.appTables?.[reference.table] === void 0 : !logical.has(`${reference.block}.${reference.table}`)) issues.push({
|
|
1070
|
+
severity: "error",
|
|
1071
|
+
source: "rules",
|
|
1072
|
+
code: "missing_reference",
|
|
1073
|
+
path: jsonPointer("appTables", name, "columns", column, "references"),
|
|
1074
|
+
table: name,
|
|
1075
|
+
message: `${name}.${column} references ${reference.block === void 0 ? reference.table : `${reference.block}.${reference.table}`}, which the preset does not install.`
|
|
1076
|
+
});
|
|
1077
|
+
if (reference.onDelete === "set null" && config.nullable === false) issues.push({
|
|
1078
|
+
severity: "error",
|
|
1079
|
+
source: "rules",
|
|
1080
|
+
code: "set_null_required",
|
|
1081
|
+
path: jsonPointer("appTables", name, "columns", column, "references", "onDelete"),
|
|
1082
|
+
table: name,
|
|
1083
|
+
message: `${name}.${column} is required, so deleting the row it references can't set it to null.`
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
for (const block of Object.keys(design.extraColumns ?? {})) if (!modules.has(block)) issues.push({
|
|
1088
|
+
severity: "error",
|
|
1089
|
+
source: "rules",
|
|
1090
|
+
code: "block_not_installed",
|
|
1091
|
+
path: jsonPointer("extraColumns", block),
|
|
1092
|
+
table: block,
|
|
1093
|
+
message: `The extra columns for ${block} have no table: the block is not installed or takes no extra columns.`
|
|
1094
|
+
});
|
|
1095
|
+
return issues;
|
|
1096
|
+
}
|
|
1097
|
+
// src/create/preview-provider.ts
|
|
1098
|
+
/**
|
|
1099
|
+
* A stand-in for the app's authorization provider, so `/create` can render the
|
|
1100
|
+
* SQL and the diagram for `access: "provider"`. Its templates call functions in
|
|
1101
|
+
* a `provider` schema that no real project has: the preview says so next to the
|
|
1102
|
+
* output.
|
|
1103
|
+
*/
|
|
1104
|
+
function previewAccessProvider(preset) {
|
|
1105
|
+
return {
|
|
1106
|
+
name: "your authorization provider",
|
|
1107
|
+
scope: preset.tenantName,
|
|
1108
|
+
idType: preset.idType,
|
|
1109
|
+
functions: {
|
|
1110
|
+
idsWith: "provider.ids_with('{scope}', {permission})",
|
|
1111
|
+
idsWithFor: "provider.ids_with_for({user}, '{scope}', {permission})",
|
|
1112
|
+
isPlatform: "provider.is_platform({permission})",
|
|
1113
|
+
isPlatformFor: "provider.is_platform_for({user}, {permission})",
|
|
1114
|
+
memberIds: "provider.member_ids('{scope}')",
|
|
1115
|
+
memberIdsFor: "provider.member_ids_for({user}, '{scope}')"
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* The files `upgrade` writes for a config with only this preset and its
|
|
1121
|
+
* `/create` design (app tables and extra columns). With `access: "provider"`
|
|
1122
|
+
* the access functions come from `previewAccessProvider`.
|
|
1123
|
+
*/
|
|
1124
|
+
function previewFiles(input, design = {}, options = {}) {
|
|
1125
|
+
const preset = presetOf(input);
|
|
1126
|
+
const config = resolveConfig(Object.keys(design).length === 0 ? { preset: input } : designConfig(resolvePreset(preset), design), "/");
|
|
1127
|
+
const provider = preset.access === "provider" ? previewAccessProvider(preset) : void 0;
|
|
1128
|
+
const layout = moduleLayout(config, config.sql.testsDir, [], void 0, provider);
|
|
1129
|
+
return renderBlocks(config.blockNames, options.ownTables === void 0 ? layout : {
|
|
1130
|
+
...layout,
|
|
1131
|
+
ownTables: options.ownTables,
|
|
1132
|
+
...options.ownColumns ? { ownColumns: options.ownColumns } : {}
|
|
1133
|
+
}).map((file) => ({
|
|
1134
|
+
path: file.path,
|
|
1135
|
+
module: file.module,
|
|
1136
|
+
contents: file.contents
|
|
1137
|
+
}));
|
|
1138
|
+
}
|
|
1139
|
+
// src/create/schema-meta.ts
|
|
1140
|
+
const AUTH_USERS = "auth.users";
|
|
1141
|
+
/**
|
|
1142
|
+
* The tenant name the module defaults use, which a preset's tenant name
|
|
1143
|
+
* replaces.
|
|
1144
|
+
*/
|
|
1145
|
+
const DEFAULT_TENANT = "organization";
|
|
1146
|
+
/**
|
|
1147
|
+
* Finds the parsed table for a module's logical table by its default name, or
|
|
1148
|
+
* by that name with the tenant renamed (`organizations` is `workspaces` for the
|
|
1149
|
+
* `workspace` tenant).
|
|
1150
|
+
*/
|
|
1151
|
+
function indexTables(tables, tenantName) {
|
|
1152
|
+
const byName = new Map(tables.map((table) => [`${table.module}:${table.name}`, table]));
|
|
1153
|
+
return (module, name) => byName.get(`${module}:${name}`) ?? byName.get(`${module}:${name.replaceAll(DEFAULT_TENANT, tenantName)}`);
|
|
1154
|
+
}
|
|
1155
|
+
function moduleTables(module) {
|
|
1156
|
+
return Object.entries(SQL_MODULES[module]?.names?.tables ?? {});
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* The table the tenant columns point at: the target most foreign keys on a
|
|
1160
|
+
* tenant column share. `null` when no table has a tenant foreign key.
|
|
1161
|
+
*/
|
|
1162
|
+
function tenantTable(tables) {
|
|
1163
|
+
const counts = /* @__PURE__ */ new Map();
|
|
1164
|
+
for (const table of tables) for (const key of table.foreignKeys) if (table.tenantColumn !== null && key.columns.length === 1 && key.columns[0] === table.tenantColumn) {
|
|
1165
|
+
const to = `${key.target.schema}.${key.target.table}`;
|
|
1166
|
+
counts.set(to, (counts.get(to) ?? 0) + 1);
|
|
1167
|
+
}
|
|
1168
|
+
let best = null;
|
|
1169
|
+
let most = 0;
|
|
1170
|
+
for (const [id, count] of counts) if (count > most) {
|
|
1171
|
+
best = id;
|
|
1172
|
+
most = count;
|
|
1173
|
+
}
|
|
1174
|
+
return best;
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* The physical column a logical lifecycle column maps to. A tenant name renames
|
|
1178
|
+
* `organization_id`, so a default name the table lacks falls back to the
|
|
1179
|
+
* table's tenant column.
|
|
1180
|
+
*/
|
|
1181
|
+
function physicalColumn(table, name, tenant) {
|
|
1182
|
+
if (name === void 0) return;
|
|
1183
|
+
if (table.columns.some((column) => column.name === name)) return name;
|
|
1184
|
+
return tenant && table.tenantColumn !== null ? table.tenantColumn : void 0;
|
|
1185
|
+
}
|
|
1186
|
+
function hasForeignKey(table, column) {
|
|
1187
|
+
return table.foreignKeys.some((key) => key.columns.length === 1 && key.columns[0] === column);
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* The soft references in the tables: lifecycle tenant and user columns without
|
|
1191
|
+
* a foreign key, and `regclass` columns, which name any table.
|
|
1192
|
+
*/
|
|
1193
|
+
function softReferences(tables, tenantName = DEFAULT_TENANT) {
|
|
1194
|
+
const lookup = indexTables(tables, tenantName);
|
|
1195
|
+
const tenantTo = tenantTable(tables);
|
|
1196
|
+
const refs = [];
|
|
1197
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1198
|
+
const add = (ref) => {
|
|
1199
|
+
const key = `${ref.from}.${ref.column}`;
|
|
1200
|
+
if (!seen.has(key)) {
|
|
1201
|
+
seen.add(key);
|
|
1202
|
+
refs.push(ref);
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1205
|
+
for (const block of new Set(tables.map((table) => table.module))) for (const [, spec] of moduleTables(block)) {
|
|
1206
|
+
const table = lookup(block, spec.name);
|
|
1207
|
+
const lifecycle = spec.lifecycle;
|
|
1208
|
+
if (table === void 0 || lifecycle === void 0) continue;
|
|
1209
|
+
const tenant = physicalColumn(table, lifecycle.tenant === void 0 ? void 0 : spec.columns[lifecycle.tenant], true);
|
|
1210
|
+
if (tenant !== void 0 && tenantTo !== null && tenantTo !== table.id && !hasForeignKey(table, tenant)) add({
|
|
1211
|
+
from: table.id,
|
|
1212
|
+
column: tenant,
|
|
1213
|
+
to: tenantTo,
|
|
1214
|
+
kind: "tenant"
|
|
1215
|
+
});
|
|
1216
|
+
const user = physicalColumn(table, lifecycle.user === void 0 ? void 0 : spec.columns[lifecycle.user], false);
|
|
1217
|
+
if (user !== void 0 && !hasForeignKey(table, user)) add({
|
|
1218
|
+
from: table.id,
|
|
1219
|
+
column: user,
|
|
1220
|
+
to: AUTH_USERS,
|
|
1221
|
+
kind: "user"
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
for (const table of tables) for (const column of table.columns) if (column.type.toLowerCase() === "regclass") add({
|
|
1225
|
+
from: table.id,
|
|
1226
|
+
column: column.name,
|
|
1227
|
+
to: null,
|
|
1228
|
+
kind: "any"
|
|
1229
|
+
});
|
|
1230
|
+
return refs;
|
|
1231
|
+
}
|
|
1232
|
+
const MANIFEST_BY_MODULE = new Map(PRESET_CATALOG.blocks.map((block) => [block.name, block.manifest]));
|
|
1233
|
+
const EXTRA_TABLE_BY_MODULE = new Map(PRESET_CATALOG.blocks.flatMap((block) => block.extraColumns === void 0 ? [] : [[block.name, block.extraColumns]]));
|
|
1234
|
+
/** Each table's module and logical table name. */
|
|
1235
|
+
function blockTables(tables, lookup) {
|
|
1236
|
+
return Object.fromEntries(tables.flatMap((table) => {
|
|
1237
|
+
const logical = moduleTables(table.module).find(([, spec]) => lookup(table.module, spec.name) === table)?.[0];
|
|
1238
|
+
return logical === void 0 ? [] : [[table.id, {
|
|
1239
|
+
block: table.module,
|
|
1240
|
+
table: logical
|
|
1241
|
+
}]];
|
|
1242
|
+
}));
|
|
1243
|
+
}
|
|
1244
|
+
/** The table ids `blocks.<module>.options.extraColumns` adds columns to. */
|
|
1245
|
+
function extraColumnTables(tables, lookup) {
|
|
1246
|
+
const installed = new Set(tables.map((table) => table.module));
|
|
1247
|
+
return [...EXTRA_TABLE_BY_MODULE].flatMap(([module, logical]) => {
|
|
1248
|
+
const spec = SQL_MODULES[module]?.names?.tables[logical];
|
|
1249
|
+
const table = !installed.has(module) || spec === void 0 ? void 0 : lookup(module, spec.name);
|
|
1250
|
+
return table === void 0 ? [] : [table.id];
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* The tables plus the soft references, manifests and extra-column tables the
|
|
1255
|
+
* canvas draws.
|
|
1256
|
+
*/
|
|
1257
|
+
function schemaData(tables, tenantName = DEFAULT_TENANT) {
|
|
1258
|
+
const lookup = indexTables(tables, tenantName);
|
|
1259
|
+
return {
|
|
1260
|
+
tables,
|
|
1261
|
+
softRefs: softReferences(tables, tenantName),
|
|
1262
|
+
manifests: Object.fromEntries(tables.map((table) => [table.id, MANIFEST_BY_MODULE.get(table.module) ?? table.module])),
|
|
1263
|
+
extraColumns: extraColumnTables(tables, lookup),
|
|
1264
|
+
blockTables: blockTables(tables, lookup),
|
|
1265
|
+
tenantTable: tenantTable(tables)
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1268
|
+
// src/create/schema.ts
|
|
1269
|
+
/**
|
|
1270
|
+
* The columns a diagram shows before a table is expanded: keys, tenant and soft
|
|
1271
|
+
* references.
|
|
1272
|
+
*/
|
|
1273
|
+
function keyColumnsOf(table, softColumns = /* @__PURE__ */ new Set()) {
|
|
1274
|
+
const keys = /* @__PURE__ */ new Set([
|
|
1275
|
+
...table.primaryKey,
|
|
1276
|
+
...table.foreignKeys.flatMap((key) => key.columns),
|
|
1277
|
+
...table.tenantColumn === null ? [] : [table.tenantColumn],
|
|
1278
|
+
...softColumns
|
|
1279
|
+
]);
|
|
1280
|
+
return table.columns.filter((column) => keys.has(column.name));
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* The column the tenant blocks key rows by, from the preset's tenant name;
|
|
1284
|
+
* `null` without tenants.
|
|
1285
|
+
*/
|
|
1286
|
+
function tenantColumnOf(preset) {
|
|
1287
|
+
return preset.scope === "tenant" ? `${preset.tenantName}_id` : null;
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Every module's file creates this table to record the installed modules. It
|
|
1291
|
+
* holds no app data, so the diagram leaves it out.
|
|
1292
|
+
*/
|
|
1293
|
+
const BOOKKEEPING_TABLES = /* @__PURE__ */ new Set(["better_supabase.blocks"]);
|
|
1294
|
+
const IDENT = String.raw`(?:"(?:[^"]|"")+"|[A-Za-z_][A-Za-z0-9_$]*)`;
|
|
1295
|
+
const QNAME = String.raw`${IDENT}(?:\s*\.\s*${IDENT})?`;
|
|
1296
|
+
const CREATE_TABLE = /\bcreate\s+(?:(?:global\s+|local\s+)?(?:temp|temporary)\s+|unlogged\s+)?table\b/giu;
|
|
1297
|
+
const CREATE_HEAD = new RegExp(String.raw`^create\s+(?:(?:global\s+|local\s+)?(?:temp|temporary)\s+|unlogged\s+)?table\s+(?:if\s+not\s+exists\s+)?(${QNAME})\s*\(`, "iu");
|
|
1298
|
+
const ALTER_TABLE = new RegExp(String.raw`\balter\s+table\s+(?:if\s+exists\s+)?(?:only\s+)?(${QNAME})\s+([^;]*);`, "giu");
|
|
1299
|
+
const REFERENCES = new RegExp(String.raw`\breferences\s+(${QNAME})\s*(?:\(([^)]*)\))?`, "iu");
|
|
1300
|
+
const LEADING_IDENT = new RegExp(String.raw`^(${IDENT})\s*`, "u");
|
|
1301
|
+
const CONSTRAINT_NAME = new RegExp(String.raw`^constraint\s+${IDENT}\s+`, "iu");
|
|
1302
|
+
/** Words that end a column's type in its definition. */
|
|
1303
|
+
const TYPE_END = /\s+(?:not\b|null\b|primary\b|references\b|default\b|generated\b|unique\b|check\b|constraint\b|collate\b)/iu;
|
|
1304
|
+
function unquote(ident) {
|
|
1305
|
+
const trimmed = ident.trim();
|
|
1306
|
+
return trimmed.startsWith("\"") ? trimmed.slice(1, -1).replaceAll("\"\"", "\"") : trimmed.toLowerCase();
|
|
1307
|
+
}
|
|
1308
|
+
function qualified(name) {
|
|
1309
|
+
const [first = "", second] = (name.match(new RegExp(IDENT, "gu")) ?? []).map((each) => unquote(each));
|
|
1310
|
+
return second === void 0 ? {
|
|
1311
|
+
schema: "public",
|
|
1312
|
+
table: first
|
|
1313
|
+
} : {
|
|
1314
|
+
schema: first,
|
|
1315
|
+
table: second
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
function identList(list) {
|
|
1319
|
+
return (list ?? "").split(",").map((each) => each.trim()).filter((each) => each !== "").map((each) => unquote(each));
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* The SQL with comments removed and the inside of every single-quoted string
|
|
1323
|
+
* blanked, so a `create table` inside a string or a comment is not read and the
|
|
1324
|
+
* offsets still match the original text.
|
|
1325
|
+
*/
|
|
1326
|
+
function codeOnly(sql) {
|
|
1327
|
+
let out = "";
|
|
1328
|
+
let index = 0;
|
|
1329
|
+
while (index < sql.length) {
|
|
1330
|
+
const char = sql[index];
|
|
1331
|
+
const next = sql[index + 1];
|
|
1332
|
+
if (char === "-" && next === "-") {
|
|
1333
|
+
const end = sql.indexOf("\n", index);
|
|
1334
|
+
const stop = end === -1 ? sql.length : end;
|
|
1335
|
+
out += " ".repeat(stop - index);
|
|
1336
|
+
index = stop;
|
|
1337
|
+
} else if (char === "/" && next === "*") {
|
|
1338
|
+
const end = sql.indexOf("*/", index + 2);
|
|
1339
|
+
const stop = end === -1 ? sql.length : end + 2;
|
|
1340
|
+
out += sql.slice(index, stop).replaceAll(/[^\n]/gu, " ");
|
|
1341
|
+
index = stop;
|
|
1342
|
+
} else if (char === "'") {
|
|
1343
|
+
let stop = index + 1;
|
|
1344
|
+
while (stop < sql.length) if (sql[stop] === "'" && sql[stop + 1] === "'") stop += 2;
|
|
1345
|
+
else if (sql[stop] === "'") break;
|
|
1346
|
+
else stop += 1;
|
|
1347
|
+
out += `'${sql.slice(index + 1, stop).replaceAll(/[^\n]/gu, " ")}'`;
|
|
1348
|
+
index = stop + 1;
|
|
1349
|
+
} else {
|
|
1350
|
+
out += char;
|
|
1351
|
+
index += 1;
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
return out;
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* The text between the `(` at `open` and its matching `)`, or undefined when it
|
|
1358
|
+
* never closes.
|
|
1359
|
+
*/
|
|
1360
|
+
function balanced(text, open) {
|
|
1361
|
+
let depth = 0;
|
|
1362
|
+
for (let index = open; index < text.length; index += 1) if (text[index] === "(") depth += 1;
|
|
1363
|
+
else if (text[index] === ")") {
|
|
1364
|
+
depth -= 1;
|
|
1365
|
+
if (depth === 0) return text.slice(open + 1, index);
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* The comma-separated elements of `text` at depth 0, with `original` sliced at
|
|
1370
|
+
* the same offsets.
|
|
1371
|
+
*/
|
|
1372
|
+
function splitTopLevel(text, original = text) {
|
|
1373
|
+
const parts = [];
|
|
1374
|
+
let depth = 0;
|
|
1375
|
+
let start = 0;
|
|
1376
|
+
const push = (end) => {
|
|
1377
|
+
const code = text.slice(start, end);
|
|
1378
|
+
const lead = code.length - code.trimStart().length;
|
|
1379
|
+
const trimmed = code.trim();
|
|
1380
|
+
if (trimmed !== "") parts.push({
|
|
1381
|
+
code: trimmed,
|
|
1382
|
+
original: original.slice(start + lead, start + lead + trimmed.length)
|
|
1383
|
+
});
|
|
1384
|
+
};
|
|
1385
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
1386
|
+
const char = text[index];
|
|
1387
|
+
if (char === "(") depth += 1;
|
|
1388
|
+
else if (char === ")") depth -= 1;
|
|
1389
|
+
else if (char === "," && depth === 0) {
|
|
1390
|
+
push(index);
|
|
1391
|
+
start = index + 1;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
push(text.length);
|
|
1395
|
+
return parts;
|
|
1396
|
+
}
|
|
1397
|
+
function lineOf(text, offset) {
|
|
1398
|
+
return text.slice(0, offset).split("\n").length;
|
|
1399
|
+
}
|
|
1400
|
+
function target(match) {
|
|
1401
|
+
const { schema, table } = qualified(match[1] ?? "");
|
|
1402
|
+
return {
|
|
1403
|
+
schema,
|
|
1404
|
+
table,
|
|
1405
|
+
columns: identList(match[2])
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
const ON_DELETE = /\bon\s+delete\s+(cascade|restrict|set\s+null|set\s+default|no\s+action)\b/iu;
|
|
1409
|
+
/** The `on delete` action of a reference, `no action` when it names none. */
|
|
1410
|
+
function onDeleteOf(text) {
|
|
1411
|
+
return (ON_DELETE.exec(text)?.[1] ?? "no action").toLowerCase().replaceAll(/\s+/gu, " ");
|
|
1412
|
+
}
|
|
1413
|
+
/** Words that end a column's default expression at the top level. */
|
|
1414
|
+
const DEFAULT_END = /^(?:not\s+null|null|primary\s+key|references|unique|check|constraint|generated|collate)\b/iu;
|
|
1415
|
+
/**
|
|
1416
|
+
* The `default` expression of a column definition. `definition` is the code
|
|
1417
|
+
* with strings blanked and `original` the same text as written, so a keyword
|
|
1418
|
+
* inside a string never ends the expression.
|
|
1419
|
+
*/
|
|
1420
|
+
function defaultOf(definition, original) {
|
|
1421
|
+
const start = /\bdefault\s+/iu.exec(definition);
|
|
1422
|
+
if (start === null) return null;
|
|
1423
|
+
const from = start.index + start[0].length;
|
|
1424
|
+
let depth = 0;
|
|
1425
|
+
let end = definition.length;
|
|
1426
|
+
for (let index = from; index < definition.length; index += 1) {
|
|
1427
|
+
const char = definition[index];
|
|
1428
|
+
if (char === "(") depth += 1;
|
|
1429
|
+
else if (char === ")") depth -= 1;
|
|
1430
|
+
else if (depth === 0 && /\s/u.test(char ?? "") && DEFAULT_END.test(definition.slice(index).trimStart())) {
|
|
1431
|
+
end = index;
|
|
1432
|
+
break;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
return original.slice(from, end).trim();
|
|
1436
|
+
}
|
|
1437
|
+
/** Adds a column definition (`"name" type ...`) to the draft. */
|
|
1438
|
+
function addColumn(draft, definition, original = definition) {
|
|
1439
|
+
const head = definition.match(LEADING_IDENT);
|
|
1440
|
+
if (head === null) return;
|
|
1441
|
+
const name = unquote(head[1] ?? "");
|
|
1442
|
+
const rest = definition.slice(head[0].length);
|
|
1443
|
+
const typeEnd = rest.search(TYPE_END);
|
|
1444
|
+
const type = (typeEnd === -1 ? rest : rest.slice(0, typeEnd)).trim();
|
|
1445
|
+
if (draft.columns.some((column) => column.name === name)) return;
|
|
1446
|
+
const primary = /\bprimary\s+key\b/iu.test(rest);
|
|
1447
|
+
draft.columns.push({
|
|
1448
|
+
name,
|
|
1449
|
+
type,
|
|
1450
|
+
nullable: !primary && !/\bnot\s+null\b/iu.test(rest),
|
|
1451
|
+
default: defaultOf(definition, original),
|
|
1452
|
+
unique: /\bunique\b/iu.test(rest)
|
|
1453
|
+
});
|
|
1454
|
+
if (primary) draft.primaryKey = [name];
|
|
1455
|
+
const references = rest.match(REFERENCES);
|
|
1456
|
+
if (references !== null) draft.foreignKeys.push({
|
|
1457
|
+
columns: [name],
|
|
1458
|
+
target: target(references),
|
|
1459
|
+
onDelete: onDeleteOf(rest)
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Adds a table constraint (`primary key (...)`, `foreign key (...) references
|
|
1464
|
+
* ...`). Returns false when the element is not a constraint.
|
|
1465
|
+
*/
|
|
1466
|
+
function addConstraint(draft, element) {
|
|
1467
|
+
const body = element.replace(CONSTRAINT_NAME, "");
|
|
1468
|
+
const named = body !== element;
|
|
1469
|
+
const primary = /^primary\s+key\s*\(([^)]*)\)/iu.exec(body);
|
|
1470
|
+
if (primary !== null) {
|
|
1471
|
+
draft.primaryKey = identList(primary[1]);
|
|
1472
|
+
return true;
|
|
1473
|
+
}
|
|
1474
|
+
const foreign = /^foreign\s+key\s*\(([^)]*)\)\s*([\s\S]*)$/iu.exec(body);
|
|
1475
|
+
if (foreign !== null) {
|
|
1476
|
+
const references = (foreign[2] ?? "").match(REFERENCES);
|
|
1477
|
+
if (references !== null) draft.foreignKeys.push({
|
|
1478
|
+
columns: identList(foreign[1]),
|
|
1479
|
+
target: target(references),
|
|
1480
|
+
onDelete: onDeleteOf(foreign[2] ?? "")
|
|
1481
|
+
});
|
|
1482
|
+
return true;
|
|
1483
|
+
}
|
|
1484
|
+
return named || /^(?:unique|check|exclude)\b/iu.test(body);
|
|
1485
|
+
}
|
|
1486
|
+
function finish(draft, tenantColumn) {
|
|
1487
|
+
const tenant = tenantColumn !== null && draft.columns.some((column) => column.name === tenantColumn) ? tenantColumn : null;
|
|
1488
|
+
const primary = new Set(draft.primaryKey);
|
|
1489
|
+
return {
|
|
1490
|
+
id: `${draft.schema}.${draft.name}`,
|
|
1491
|
+
schema: draft.schema,
|
|
1492
|
+
name: draft.name,
|
|
1493
|
+
module: draft.module,
|
|
1494
|
+
primaryKey: draft.primaryKey,
|
|
1495
|
+
foreignKeys: draft.foreignKeys,
|
|
1496
|
+
tenantColumn: tenant,
|
|
1497
|
+
columns: draft.columns.map((column) => primary.has(column.name) ? {
|
|
1498
|
+
...column,
|
|
1499
|
+
nullable: false
|
|
1500
|
+
} : column)
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* The tables in rendered module SQL: every `create table`, plus the columns and
|
|
1505
|
+
* foreign keys later `alter table ... add` statements give them. A `create
|
|
1506
|
+
* table` it can't read throws with the file and line, so a new SQL shape fails
|
|
1507
|
+
* the tests instead of dropping a table from the diagram.
|
|
1508
|
+
*/
|
|
1509
|
+
function parseSchema(files, options = {}) {
|
|
1510
|
+
const drafts = /* @__PURE__ */ new Map();
|
|
1511
|
+
const code = files.map((file) => ({
|
|
1512
|
+
file,
|
|
1513
|
+
text: codeOnly(file.contents)
|
|
1514
|
+
}));
|
|
1515
|
+
for (const { file, text } of code) for (const match of text.matchAll(CREATE_TABLE)) {
|
|
1516
|
+
const offset = match.index;
|
|
1517
|
+
const head = text.slice(offset).match(CREATE_HEAD);
|
|
1518
|
+
const open = head === null ? -1 : offset + head[0].length - 1;
|
|
1519
|
+
const body = open === -1 ? void 0 : balanced(text, open);
|
|
1520
|
+
const original = body === void 0 ? "" : file.contents.slice(open + 1, open + 1 + body.length);
|
|
1521
|
+
if (head === null || body === void 0) throw new Error(`parseSchema can't read the create table at ${file.path}:${lineOf(text, offset)}.`);
|
|
1522
|
+
const { schema, table } = qualified(head[1] ?? "");
|
|
1523
|
+
const id = `${schema}.${table}`;
|
|
1524
|
+
if (drafts.has(id)) continue;
|
|
1525
|
+
const draft = {
|
|
1526
|
+
schema,
|
|
1527
|
+
name: table,
|
|
1528
|
+
module: file.module,
|
|
1529
|
+
columns: [],
|
|
1530
|
+
primaryKey: [],
|
|
1531
|
+
foreignKeys: []
|
|
1532
|
+
};
|
|
1533
|
+
for (const element of splitTopLevel(body, original)) if (!addConstraint(draft, element.code)) addColumn(draft, element.code, element.original);
|
|
1534
|
+
drafts.set(id, draft);
|
|
1535
|
+
}
|
|
1536
|
+
for (const { file, text } of code) for (const match of text.matchAll(ALTER_TABLE)) {
|
|
1537
|
+
const { schema, table } = qualified(match[1] ?? "");
|
|
1538
|
+
const draft = drafts.get(`${schema}.${table}`);
|
|
1539
|
+
if (draft === void 0) continue;
|
|
1540
|
+
const actions = match[2] ?? "";
|
|
1541
|
+
const start = match.index + match[0].lastIndexOf(actions);
|
|
1542
|
+
const original = file.contents.slice(start, start + actions.length);
|
|
1543
|
+
for (const action of splitTopLevel(actions, original)) {
|
|
1544
|
+
const column = /^add\s+column\s+(?:if\s+not\s+exists\s+)?/iu.exec(action.code);
|
|
1545
|
+
if (column !== null) addColumn(draft, action.code.slice(column[0].length), action.original.slice(column[0].length));
|
|
1546
|
+
else if (/^add\s+/iu.test(action.code)) addConstraint(draft, action.code.replace(/^add\s+/iu, ""));
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
const tenantColumn = options.tenantColumn ?? null;
|
|
1550
|
+
return [...drafts.entries()].filter(([id]) => !BOOKKEEPING_TABLES.has(id)).map(([, draft]) => finish(draft, tenantColumn));
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* The statements that shape one table, as written: its `create table` and the
|
|
1554
|
+
* `alter table` statements after it. Empty when no file creates it.
|
|
1555
|
+
*/
|
|
1556
|
+
function tableStatements(files, id) {
|
|
1557
|
+
const statements = [];
|
|
1558
|
+
for (const file of files) {
|
|
1559
|
+
const text = codeOnly(file.contents);
|
|
1560
|
+
for (const match of text.matchAll(CREATE_TABLE)) {
|
|
1561
|
+
const head = text.slice(match.index).match(CREATE_HEAD);
|
|
1562
|
+
if (head === null) continue;
|
|
1563
|
+
const { schema, table } = qualified(head[1] ?? "");
|
|
1564
|
+
const open = match.index + head[0].length - 1;
|
|
1565
|
+
const body = balanced(text, open);
|
|
1566
|
+
if (`${schema}.${table}` !== id || body === void 0) continue;
|
|
1567
|
+
const end = text.indexOf(";", open + body.length + 1);
|
|
1568
|
+
statements.push(file.contents.slice(match.index, end === -1 ? text.length : end + 1));
|
|
1569
|
+
}
|
|
1570
|
+
for (const match of text.matchAll(ALTER_TABLE)) {
|
|
1571
|
+
const { schema, table } = qualified(match[1] ?? "");
|
|
1572
|
+
if (`${schema}.${table}` === id) statements.push(file.contents.slice(match.index, match.index + match[0].length));
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
return statements;
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* The foreign keys between tables, one per pair, with the targets outside the
|
|
1579
|
+
* schema named by id.
|
|
1580
|
+
*/
|
|
1581
|
+
function schemaRelations(tables) {
|
|
1582
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1583
|
+
return tables.flatMap((table) => table.foreignKeys.flatMap((key) => {
|
|
1584
|
+
const to = `${key.target.schema}.${key.target.table}`;
|
|
1585
|
+
const pair = `${table.id}>${to}`;
|
|
1586
|
+
if (to === table.id || seen.has(pair)) return [];
|
|
1587
|
+
seen.add(pair);
|
|
1588
|
+
return [{
|
|
1589
|
+
from: table.id,
|
|
1590
|
+
to
|
|
1591
|
+
}];
|
|
1592
|
+
}));
|
|
1593
|
+
}
|
|
1594
|
+
// src/create/check.ts
|
|
1595
|
+
const messageOf = (error) => error instanceof Error ? error.message : String(error);
|
|
1596
|
+
/** The issue for a design that failed to parse, with its code and path. */
|
|
1597
|
+
function parseIssue(error) {
|
|
1598
|
+
const { code, path } = error instanceof DesignParseError ? error : {
|
|
1599
|
+
code: "invalid_design",
|
|
1600
|
+
path: ""
|
|
1601
|
+
};
|
|
1602
|
+
return {
|
|
1603
|
+
code,
|
|
1604
|
+
severity: "error",
|
|
1605
|
+
source: "design",
|
|
1606
|
+
path,
|
|
1607
|
+
table: tableAt(path),
|
|
1608
|
+
message: messageOf(error)
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
/** The app table or block module a design path is in, or `design`. */
|
|
1612
|
+
function tableAt(path) {
|
|
1613
|
+
const [, key, name] = path.split("/");
|
|
1614
|
+
return (key === "appTables" || key === "extraColumns") && name !== void 0 ? name.replaceAll("~1", "/").replaceAll("~0", "~") : "design";
|
|
1615
|
+
}
|
|
1616
|
+
async function designFrom(input) {
|
|
1617
|
+
if (typeof input !== "string") return parseDesign(input);
|
|
1618
|
+
const design = await designOf(input);
|
|
1619
|
+
if (design === void 0) throw new DesignParseError("invalid_code", "", `design: "${input.slice(0, 40)}" is neither a design code nor a /create URL with &design=`);
|
|
1620
|
+
return design;
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Checks a design against a preset with every rule the canvas and `upgrade`
|
|
1624
|
+
* apply, so a server, an MCP tool and the canvas share one answer. `input` is a
|
|
1625
|
+
* design object, a design code or a `/create` URL with `&design=`. It never
|
|
1626
|
+
* throws for a bad design or preset: each problem is an issue.
|
|
1627
|
+
*/
|
|
1628
|
+
async function checkDesign(input, preset) {
|
|
1629
|
+
let design;
|
|
1630
|
+
try {
|
|
1631
|
+
design = await designFrom(input);
|
|
1632
|
+
} catch (error) {
|
|
1633
|
+
return {
|
|
1634
|
+
ok: false,
|
|
1635
|
+
issues: [parseIssue(error)]
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
let resolvedPreset;
|
|
1639
|
+
try {
|
|
1640
|
+
resolvedPreset = presetOf(preset);
|
|
1641
|
+
} catch (error) {
|
|
1642
|
+
return {
|
|
1643
|
+
ok: false,
|
|
1644
|
+
issues: [{
|
|
1645
|
+
code: "invalid_preset",
|
|
1646
|
+
severity: "error",
|
|
1647
|
+
source: "design",
|
|
1648
|
+
path: "",
|
|
1649
|
+
table: "preset",
|
|
1650
|
+
message: messageOf(error)
|
|
1651
|
+
}]
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
const resolved = resolvePreset(resolvedPreset);
|
|
1655
|
+
if (resolved.conflicts.length > 0) return {
|
|
1656
|
+
ok: false,
|
|
1657
|
+
issues: resolved.conflicts.map((conflict) => ({
|
|
1658
|
+
code: "preset_conflict",
|
|
1659
|
+
severity: "error",
|
|
1660
|
+
source: "design",
|
|
1661
|
+
path: "",
|
|
1662
|
+
table: "preset",
|
|
1663
|
+
message: `${conflict.block ?? conflict.field ?? "preset"}: ${conflict.reason}`
|
|
1664
|
+
}))
|
|
1665
|
+
};
|
|
1666
|
+
try {
|
|
1667
|
+
designConfig(resolved, design);
|
|
1668
|
+
} catch (error) {
|
|
1669
|
+
return {
|
|
1670
|
+
ok: false,
|
|
1671
|
+
issues: [parseIssue(error)]
|
|
1672
|
+
};
|
|
1673
|
+
}
|
|
1674
|
+
const data = schemaData(parseSchema(previewFiles(resolvedPreset), { tenantColumn: tenantColumnOf(resolvedPreset) }), resolvedPreset.tenantName);
|
|
1675
|
+
const issues = designIssues(design, data, resolvedPreset);
|
|
1676
|
+
if (issues.length > 0) return {
|
|
1677
|
+
ok: false,
|
|
1678
|
+
issues
|
|
1679
|
+
};
|
|
1680
|
+
try {
|
|
1681
|
+
return {
|
|
1682
|
+
ok: true,
|
|
1683
|
+
design,
|
|
1684
|
+
fitsUrl: true,
|
|
1685
|
+
code: await encodeDesign(design)
|
|
1686
|
+
};
|
|
1687
|
+
} catch (error) {
|
|
1688
|
+
if (error instanceof DesignTooLongError) return {
|
|
1689
|
+
ok: true,
|
|
1690
|
+
design,
|
|
1691
|
+
fitsUrl: false,
|
|
1692
|
+
code: null
|
|
1693
|
+
};
|
|
1694
|
+
return {
|
|
1695
|
+
ok: false,
|
|
1696
|
+
issues: [parseIssue(error)]
|
|
1697
|
+
};
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
// src/create/project.ts
|
|
1701
|
+
/**
|
|
1702
|
+
* Reads a project from a design object, a design code or a `/create` URL with
|
|
1703
|
+
* `&design=`, with the preset inside the design or in `options.preset`. It
|
|
1704
|
+
* never throws for a bad project: each problem is an `Issue`.
|
|
1705
|
+
*/
|
|
1706
|
+
async function loadProject(input, options = {}) {
|
|
1707
|
+
const fallback = options.preset ?? "saas";
|
|
1708
|
+
const checked = await checkDesign(input, fallback);
|
|
1709
|
+
if (!checked.ok) return {
|
|
1710
|
+
ok: false,
|
|
1711
|
+
issues: checked.issues
|
|
1712
|
+
};
|
|
1713
|
+
const preset = presetOf(checked.design.preset ?? fallback);
|
|
1714
|
+
try {
|
|
1715
|
+
return {
|
|
1716
|
+
ok: true,
|
|
1717
|
+
project: {
|
|
1718
|
+
preset,
|
|
1719
|
+
design: checked.design,
|
|
1720
|
+
files: previewFiles(preset, checked.design, options),
|
|
1721
|
+
...options.ownTables === void 0 ? {} : { ownTables: options.ownTables }
|
|
1722
|
+
}
|
|
1723
|
+
};
|
|
1724
|
+
} catch (error) {
|
|
1725
|
+
return {
|
|
1726
|
+
ok: false,
|
|
1727
|
+
issues: [{
|
|
1728
|
+
code: "invalid_design",
|
|
1729
|
+
severity: "error",
|
|
1730
|
+
source: "design",
|
|
1731
|
+
path: "",
|
|
1732
|
+
table: "design",
|
|
1733
|
+
message: error instanceof Error ? error.message : String(error)
|
|
1734
|
+
}]
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Every problem in a project, as one list of `Issue`: the design rules (names,
|
|
1740
|
+
* references, keys, defaults), then the SQL Postgres rejects when `options.sql`
|
|
1741
|
+
* runs it. An empty list means the project can be written.
|
|
1742
|
+
*/
|
|
1743
|
+
async function checkProject(project, options = {}) {
|
|
1744
|
+
const data = schemaData(parseSchema(previewFiles(project.preset), { tenantColumn: tenantColumnOf(project.preset) }), project.preset.tenantName);
|
|
1745
|
+
const issues = [...designIssues(project.design, data, project.preset)];
|
|
1746
|
+
if (options.sql !== void 0) issues.push(...await options.sql(project.files));
|
|
1747
|
+
return issues;
|
|
1748
|
+
}
|
|
1749
|
+
export { tableWithComputed as $, referenceFrom as A, withDesign as B, duplicateTable as C, isAppTable as D, identifierError as E, setTableId as F, filterColumns as G, computedColumnRenamed as H, singular as I, lookupSources as J, fittedRollup as K, tidy as L, renameTable as M, setColumn as N, isEmptyDesign as O, setExtraColumn as P, rollupSources as Q, updateTable as R, deleteTable as S, freeTableName as T, computedRows as U, ROLLUP_AGGREGATES as V, computedTableRenamed as W, readableColumns as X, prunedComputed as Y, rollupColumns as Z, columnError as _, parseSchema as a, boundError as at, deleteColumn as b, tenantColumnOf as c, fitted as ct, previewFiles as d, takesBounds as dt, tableWithoutComputed as et, designIssues as f, withBounds as ft, appTableId as g, addTable as h, keyColumnsOf as i, subjectTypeError as it, renameColumn as j, moveTables as k, schemaData as l, lockedWithoutDefault as lt, EMPTY_DESIGN as m, loadProject as n, subjectColumns as nt, schemaRelations as o, columnLabel as ot, APP_MODULE as p, isRollupAggregate as q, checkDesign as r, subjectColumnsEdited as rt, tableStatements as s, encryptable as st, checkProject as t, eventsColumnsEdited as tt, previewAccessProvider as u, optionError as ut, connect as v, editTable as w, deleteExtraColumn as x, defaultError as y, userConnection as z };
|