better-supabase 0.25.0 → 0.29.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-bjWFUWlk.js → access-sql-CTDNuxRv.js} +177 -12
- package/dist/{agents-CMIB3802.d.ts → agents-CM_cCtcr.d.ts} +4 -4
- package/dist/{ai-cache-2LGgaT7F.d.ts → ai-cache-BTGqckta.d.ts} +4 -4
- package/dist/{ai-chat-BCaKsvLW.d.ts → ai-chat-B7_vQvxU.d.ts} +4 -4
- package/dist/{ai-schedules-yGZH-vQb.d.ts → ai-schedules-CZEfo-_M.d.ts} +5 -5
- package/dist/ai-sdk/agents/index.d.ts +6 -6
- package/dist/ai-sdk/batches/index.d.ts +3 -3
- package/dist/ai-sdk/cache/index.d.ts +1 -1
- package/dist/ai-sdk/chat/index.d.ts +1 -1
- package/dist/ai-sdk/embeddings/index.d.ts +2 -2
- package/dist/ai-sdk/files/index.d.ts +1 -1
- package/dist/ai-sdk/index.d.ts +5 -5
- package/dist/ai-sdk/mcp/index.d.ts +3 -3
- package/dist/ai-sdk/memory/index.d.ts +3 -3
- package/dist/ai-sdk/workflow/index.d.ts +3 -3
- package/dist/{api-B1OkIWdx.d.ts → api-59rv5hL6.d.ts} +5 -5
- package/dist/{api-keys-ClhKBDcc.d.ts → api-keys-JE-aykZE.d.ts} +4 -4
- package/dist/{app-tables-xij_MI5H.d.ts → app-tables-DekyKNQ8.d.ts} +1 -1
- package/dist/{approvals-C5fmPLsH.d.ts → approvals-BfEafAzt.d.ts} +5 -5
- package/dist/{assistant-ndGdOBax.d.ts → assistant-B49qATbj.d.ts} +2 -2
- package/dist/astro/index.d.ts +7 -7
- package/dist/{authorization-BJV2i8xB.d.ts → authorization-C7nuWMuB.d.ts} +27 -6
- package/dist/{authorization-hooks-DtzreCAq.d.ts → authorization-hooks-BWhkMZfH.d.ts} +2 -2
- package/dist/better-result/index.d.ts +3 -3
- package/dist/{bind-vKDmdu_4.d.ts → bind-DmUGUsBd.d.ts} +7 -7
- package/dist/{block-env-wVLz0KMV.d.ts → block-env-DWtZsqhH.d.ts} +4 -4
- package/dist/{block-helpers-CRpAHrp_.d.ts → block-helpers-D5emQ2O6.d.ts} +1 -1
- package/dist/{block-hooks-DZN2w69m.d.ts → block-hooks-B8itxzEE.d.ts} +2 -2
- package/dist/{block-subjects-CphkQPxp.d.ts → block-subjects-C1_9DkSA.d.ts} +1 -1
- package/dist/{block-transport-DWZSJrwN.d.ts → block-transport-9EUA3q_I.d.ts} +2 -2
- package/dist/blocks/access-requests/index.d.ts +5 -5
- package/dist/blocks/activities/index.d.ts +10 -10
- package/dist/blocks/activities/index.js +1 -1
- package/dist/blocks/agents/index.d.ts +4 -4
- package/dist/blocks/ai-cache/index.d.ts +3 -3
- package/dist/blocks/ai-chat/index.d.ts +7 -7
- package/dist/blocks/ai-files/index.d.ts +3 -3
- package/dist/blocks/ai-keys/index.d.ts +4 -4
- package/dist/blocks/ai-schedules/index.d.ts +3 -3
- package/dist/blocks/announcements/index.d.ts +8 -8
- package/dist/blocks/api-keys/index.d.ts +6 -6
- package/dist/blocks/approvals/index.d.ts +4 -4
- package/dist/blocks/assets/index.d.ts +6 -6
- package/dist/blocks/assignment/index.d.ts +7 -7
- package/dist/blocks/attachments/index.d.ts +4 -4
- package/dist/blocks/audit/index.d.ts +13 -13
- package/dist/blocks/automations/index.d.ts +12 -12
- package/dist/blocks/billable-time/index.d.ts +6 -6
- package/dist/blocks/billing/index.d.ts +9 -9
- package/dist/blocks/bookings/index.d.ts +4 -4
- package/dist/blocks/bulk/index.d.ts +4 -4
- package/dist/blocks/calendar/index.d.ts +5 -5
- package/dist/blocks/catalog/index.d.ts +6 -6
- package/dist/blocks/channels/index.d.ts +7 -7
- package/dist/blocks/collections/index.d.ts +12 -12
- package/dist/blocks/collections/index.js +1 -1
- package/dist/blocks/comments/index.d.ts +10 -10
- package/dist/blocks/compliance/index.d.ts +5 -5
- package/dist/blocks/connectors/index.d.ts +4 -4
- package/dist/blocks/contacts/index.d.ts +7 -7
- package/dist/blocks/contacts/index.js +1 -1
- package/dist/blocks/content/index.d.ts +5 -5
- package/dist/blocks/contracts/index.d.ts +6 -6
- package/dist/blocks/courses/index.d.ts +5 -5
- package/dist/blocks/created-by/index.d.ts +2 -2
- package/dist/blocks/custom-fields/index.d.ts +6 -6
- package/dist/blocks/custom-fields/index.js +1 -1
- package/dist/blocks/data-lifecycle/index.d.ts +8 -8
- package/dist/blocks/deals/index.d.ts +6 -6
- package/dist/blocks/dispatch/index.d.ts +7 -7
- package/dist/blocks/documents/index.d.ts +4 -4
- package/dist/blocks/domains/index.d.ts +6 -6
- package/dist/blocks/donations/index.d.ts +6 -6
- package/dist/blocks/drive/index.d.ts +7 -7
- package/dist/blocks/employees/index.d.ts +8 -8
- package/dist/blocks/employees/index.js +1 -1
- package/dist/blocks/enrichment/index.d.ts +6 -6
- package/dist/blocks/enrollments/index.d.ts +6 -6
- package/dist/blocks/entitlements/index.d.ts +6 -6
- package/dist/blocks/expenses/index.d.ts +5 -5
- package/dist/blocks/field-history/index.d.ts +4 -4
- package/dist/blocks/flags/index.d.ts +5 -5
- package/dist/blocks/forecasts/index.d.ts +6 -6
- package/dist/blocks/forms/index.d.ts +6 -6
- package/dist/blocks/goals/index.d.ts +4 -4
- package/dist/blocks/guests/index.d.ts +6 -6
- package/dist/blocks/hiring/index.d.ts +7 -7
- package/dist/blocks/identities/index.d.ts +5 -5
- package/dist/blocks/imports/index.d.ts +5 -5
- package/dist/blocks/inbox/index.d.ts +10 -10
- package/dist/blocks/incidents/index.d.ts +5 -5
- package/dist/blocks/index.d.ts +9 -9
- package/dist/blocks/inventory/index.d.ts +7 -7
- package/dist/blocks/invoices/index.d.ts +8 -8
- package/dist/blocks/knowledge/index.d.ts +3 -3
- package/dist/blocks/lead-scoring/index.d.ts +7 -7
- package/dist/blocks/leases/index.d.ts +6 -6
- package/dist/blocks/leave/index.d.ts +5 -5
- package/dist/blocks/ledger/index.d.ts +6 -6
- package/dist/blocks/mail-sync/index.d.ts +5 -5
- package/dist/blocks/memberships/index.d.ts +2 -2
- package/dist/blocks/memory/index.d.ts +4 -4
- package/dist/blocks/messaging/index.d.ts +11 -11
- package/dist/blocks/metrics/index.d.ts +6 -6
- package/dist/blocks/mfa/index.d.ts +2 -2
- package/dist/blocks/moderation/index.d.ts +6 -6
- package/dist/blocks/notifications/index.d.ts +12 -12
- package/dist/blocks/notifications/index.js +1 -1
- package/dist/blocks/numbering/index.d.ts +4 -4
- package/dist/blocks/oauth-server/index.d.ts +5 -5
- package/dist/blocks/onboarding/index.d.ts +5 -5
- package/dist/blocks/orders/index.d.ts +7 -7
- package/dist/blocks/organizations/index.d.ts +8 -8
- package/dist/blocks/outbox/index.d.ts +4 -4
- package/dist/blocks/passes/index.d.ts +8 -8
- package/dist/blocks/permissions/index.d.ts +6 -6
- package/dist/blocks/pipelines/index.d.ts +6 -6
- package/dist/blocks/posts/index.d.ts +5 -5
- package/dist/blocks/profiles/index.d.ts +4 -4
- package/dist/blocks/promotions/index.d.ts +5 -5
- package/dist/blocks/push/index.d.ts +6 -6
- package/dist/blocks/queue/index.d.ts +6 -6
- package/dist/blocks/quotes/index.d.ts +8 -8
- package/dist/blocks/rank/index.d.ts +5 -5
- package/dist/blocks/reactions/index.d.ts +9 -9
- package/dist/blocks/relations/index.d.ts +7 -7
- package/dist/blocks/reminders/index.d.ts +9 -9
- package/dist/blocks/reminders/index.js +1 -1
- package/dist/blocks/reviews/index.d.ts +5 -5
- package/dist/blocks/saved-views/index.d.ts +6 -6
- package/dist/blocks/scores/index.d.ts +5 -5
- package/dist/blocks/search/index.d.ts +8 -8
- package/dist/blocks/security-events/index.d.ts +7 -7
- package/dist/blocks/segments/index.d.ts +8 -8
- package/dist/blocks/sequences/index.d.ts +6 -6
- package/dist/blocks/service-accounts/index.d.ts +5 -5
- package/dist/blocks/sessions/index.d.ts +2 -2
- package/dist/blocks/settings/index.d.ts +6 -6
- package/dist/blocks/share-links/index.d.ts +5 -5
- package/dist/blocks/shipments/index.d.ts +6 -6
- package/dist/blocks/signatures/index.d.ts +5 -5
- package/dist/blocks/signing-keys/index.d.ts +4 -4
- package/dist/blocks/sla/index.d.ts +7 -7
- package/dist/blocks/sso/index.d.ts +6 -6
- package/dist/blocks/state-machine/index.d.ts +5 -5
- package/dist/blocks/subjects/index.d.ts +6 -6
- package/dist/blocks/tags/index.d.ts +6 -6
- package/dist/blocks/tasks/index.d.ts +10 -10
- package/dist/blocks/tasks/index.js +1 -1
- package/dist/blocks/teams/index.d.ts +4 -4
- package/dist/blocks/templates/index.d.ts +7 -7
- package/dist/blocks/time-tracking/index.d.ts +7 -7
- package/dist/blocks/timeline/index.d.ts +8 -8
- package/dist/blocks/trash/index.d.ts +6 -6
- package/dist/blocks/undo/index.d.ts +4 -4
- package/dist/blocks/updated-at/index.d.ts +2 -2
- package/dist/blocks/usage/index.d.ts +4 -4
- package/dist/blocks/vercel-marketplace/index.d.ts +5 -5
- package/dist/blocks/versions/index.d.ts +6 -6
- package/dist/blocks/waitlist/index.d.ts +5 -5
- package/dist/blocks/webhooks/index.d.ts +14 -14
- package/dist/blocks/webhooks/index.js +1 -1
- package/dist/blocks/workflow-editor/index.d.ts +9 -9
- package/dist/blocks/workflows/index.d.ts +7 -7
- package/dist/{bookings-CVw5-Q0Z.d.ts → bookings-xsmM2TA_.d.ts} +3 -3
- package/dist/{bucket-vc-QRrva.d.ts → bucket-SvRQwYS4.d.ts} +1 -1
- package/dist/chat-sdk/index.d.ts +6 -6
- package/dist/cli/{add-C2pNvVpu.js → add-BKkV99g9.js} +2 -2
- package/dist/cli/{add-BTVrOGJF.js → add-CrQ3jS7t.js} +55 -88
- package/dist/cli/add-CwhrRJz5.js +1 -0
- package/dist/cli/app-table-files-PnPOpuB4.js +346 -0
- package/dist/cli/{backfill-BicVPugb.js → backfill-DDDLhinm.js} +4 -4
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{blocks-sScN-ik-.js → blocks-BCVcjvbm.js} +1 -1
- package/dist/cli/{blocks-BmYOH4T-.js → blocks-tRfYx_mh.js} +2 -2
- package/dist/cli/{cache-1TfBy2K4.js → cache-DQZ09YOg.js} +1 -1
- package/dist/cli/{codemod-ylE6wGLo.js → codemod-HKuwQmi_.js} +5 -5
- package/dist/cli/{command-BWEEXmtz.js → command-DIPmo0wh.js} +37 -1
- package/dist/cli/{completion-Bt7LMypX.js → completion-DxPxMtyP.js} +2 -2
- package/dist/cli/{completion-8EDK21xj.js → completion-DyLMSjOD.js} +1 -1
- package/dist/cli/{completion-BfnKI4QZ.js → completion-FUgqm2-N.js} +2 -2
- package/dist/cli/{config-WKDixoGK.js → config-BfapErxs.js} +1 -1
- package/dist/cli/{config-BVfeG3A5.js → config-Cskysxp-.js} +327 -16
- package/dist/cli/{config-CeaQMrvS.js → config-Df5cXWNN.js} +1 -1
- package/dist/cli/{config-group-C8tjut39.js → config-group-CP-B9uRt.js} +2 -3
- package/dist/cli/{content-mapper-hUW2nb92.js → content-mapper-B0ehR7K-.js} +2 -2
- package/dist/cli/{db-DwjyUbAh.js → db-CWvH1_46.js} +38 -14
- package/dist/cli/{doctor-D3WKFBSv.js → doctor-CXJOhwLB.js} +36 -33
- package/dist/cli/{env-DMgjB_4y.js → env-BK0xKMeU.js} +1 -2
- package/dist/cli/{env-BCgVZkcb.js → env-BM242BCV.js} +2 -2
- package/dist/cli/{env-C-Bl6Awn.js → env-Bat6ogep.js} +1 -1
- package/dist/cli/env-uqfUbUzk.js +1 -0
- package/dist/cli/{exec--Q1ZEWUW.js → exec-Ca5s-ygi.js} +1 -1
- package/dist/cli/{gen-CqsUdsB2.js → gen-B7rw4j19.js} +16 -16
- package/dist/cli/in-stack-diff-Cp-tVPj2.js +186 -0
- package/dist/cli/index.d.ts +9 -3
- package/dist/cli/index.js +8 -8
- package/dist/cli/{init-DryZ5Mp1.js → init-C1bXXB_P.js} +131 -12
- package/dist/cli/{keys-CbaL0lnw.js → keys-V-HcO-21.js} +1 -1
- package/dist/cli/{live-Di45imoV.js → live-PpAh9pAc.js} +2 -2
- package/dist/cli/{mcp-BklC-3eK.js → mcp-BRNAchdH.js} +6 -14
- package/dist/cli/{metadata-7PsBF5Xw.js → metadata-dAAKb_kR.js} +3 -3
- package/dist/cli/migrate-BWYXFnaW.js +46 -0
- package/dist/cli/{migration-safety-Doy9qYO8.js → migration-safety-DGQswWZy.js} +2 -2
- package/dist/cli/migrations-Cqk-lJwu.js +117 -0
- package/dist/cli/{module-migration-ZIn1NCMi.js → module-migration-8-hMiZtW.js} +2 -2
- package/dist/cli/{moved-DVwgE8lV.js → moved-DNOtp9LA.js} +1 -1
- package/dist/cli/{parse-B079x40m.js → parse-BPf3kGnc.js} +1 -1
- package/dist/cli/{powersync-BRGXOCJ0.js → powersync-BWQ-8T3G.js} +4 -3
- package/dist/cli/powersync-CbYxLsjv.js +1 -0
- package/dist/cli/{print-Dfqd4DB-.js → print-DSTnq5xz.js} +2 -2
- package/dist/cli/{migrations-JtsPYv8g.js → providers-Cjf5iOp5.js} +4 -116
- package/dist/cli/{remove-CQzSCYTu.js → remove-CwG8cPv1.js} +7 -7
- package/dist/cli/{render-DWRz-uPQ.js → render-B18iAdsT.js} +9 -6
- package/dist/cli/{run-DPLedqTF.js → run-C2Yg5MWt.js} +42 -40
- package/dist/cli/{run-DmOTMa44.js → run-CvPl8iQd.js} +4 -4
- package/dist/cli/{run-j54rk2w-.js → run-Wx_2Acgv.js} +11 -11
- package/dist/cli/seed-BOun22-k.js +1 -0
- package/dist/cli/{seed-BMynpMPy.js → seed-CDnL4Tnc.js} +3 -3
- package/dist/cli/{shared-CslNcs-R.js → shared-BHbtUOvh.js} +1 -1
- package/dist/cli/{skills-FXAVPLzp.js → skills-DM3oeIxY.js} +1 -1
- package/dist/cli/{snapshot-DdN5GlhH.js → snapshot-CXgsUPGj.js} +3 -3
- package/dist/cli/{source-COARbqch.js → source-B6aMAoEK.js} +1 -1
- package/dist/cli/{source-args-CDmmFmFG.js → source-args-v8ljFDfc.js} +1 -1
- package/dist/cli/{spec-CgLNZc_C.js → spec-BcYic005.js} +3 -3
- package/dist/cli/{spec-DIhBQlBF.js → spec-EO0TP84d.js} +1 -1
- package/dist/cli/{sql-layout-8jrP5gIa.js → sql-layout-CkxDNVEH.js} +21 -7
- package/dist/cli/{stack-DgASZP0K.js → stack-ClESAZYf.js} +3 -3
- package/dist/cli/{stack-status-B_Ipd_-z.js → stack-status-BkkYRlXG.js} +1 -1
- package/dist/cli/{stacks-BYlQ96WS.js → stacks-CiDBH1dB.js} +1 -1
- package/dist/cli/{sync-SqyVHRSJ.js → sync-pq6gmlhG.js} +4 -3
- package/dist/cli/table-dyKddjwo.js +89 -0
- package/dist/cli/{upgrade-D0aLhluU.js → upgrade-BoHb4h9P.js} +3 -3
- package/dist/cli/{upgrade-CY-vj_qh.js → upgrade-Dp9p7A69.js} +5 -4
- package/dist/cli/{version-Bhca9D6q.js → version-CQHFm-ak.js} +1 -1
- package/dist/client/index.d.ts +6 -6
- package/dist/client/native/index.d.ts +5 -5
- package/dist/{cloud-event-DcJwder2.d.ts → cloud-event-0pQ9vFNS.d.ts} +1 -1
- package/dist/{compiler-D3UmE7ao.d.ts → compiler-BEeVWXPS.d.ts} +2 -2
- package/dist/{composite-CWJvZgni.d.ts → composite-BJ9s-IJJ.d.ts} +7 -7
- package/dist/config/index.d.ts +5 -5
- package/dist/config/index.js +5 -5
- package/dist/{config-C19McoGo.js → config-bqKaPjst.js} +7 -28
- package/dist/{config-CP-WaboC.js → config-r7njjNgh.js} +3 -3
- package/dist/{connectors-CHGiffYH.d.ts → connectors-uC5baoFV.d.ts} +4 -4
- package/dist/{context-BJoHD20l.d.ts → context-B4TsE2gY.d.ts} +138 -52
- package/dist/{controller-CwGXms17.d.ts → controller-CtwAsnVV.d.ts} +1 -1
- package/dist/{conversion-DlfStnln.d.ts → conversion-g8HzH9My.d.ts} +1 -1
- package/dist/create/index.d.ts +62 -3
- package/dist/create/index.js +67 -4
- package/dist/create/lite/index.d.ts +141 -4
- package/dist/create/lite/index.js +399 -47
- package/dist/credentials/index.d.ts +4 -4
- package/dist/{data-engine-BWoz9lED.d.ts → data-engine-rvbR2C4F.d.ts} +1 -1
- package/dist/{define-BLP6XtoL.d.ts → define-D8_9X5fZ.d.ts} +5 -5
- package/dist/{define-block-DibVN37N.d.ts → define-block-DWVZSZv1.d.ts} +12 -12
- package/dist/{documents-Cup1rpjF.d.ts → documents-BbwYyynk.d.ts} +3 -3
- package/dist/edge/index.d.ts +9 -9
- package/dist/elysia/index.d.ts +1 -1
- package/dist/{embeddings-D_RsS6ow.d.ts → embeddings-I3s5sTDt.d.ts} +1 -1
- package/dist/{ended-B8RyuUXF.d.ts → ended-EZzN9QTM.d.ts} +2 -2
- package/dist/{entitlements-CsZcfllV.d.ts → entitlements-Bw3eYGKJ.d.ts} +2 -2
- package/dist/eve/index.d.ts +5 -5
- package/dist/{eve-B7jxYPCw.d.ts → eve-BfhVFV33.d.ts} +2 -2
- package/dist/events/index.d.ts +3 -3
- package/dist/{events-Cc9DDQWH.d.ts → events-B2qbZps6.d.ts} +1 -1
- package/dist/{executor-DNPm13a9.d.ts → executor-BfirBzOr.d.ts} +4 -4
- package/dist/{executor-C-Ox9eKq.d.ts → executor-BlS0kCrN.d.ts} +1 -1
- package/dist/{executor-hGjrop3A.d.ts → executor-DXQIx4sW.d.ts} +1 -1
- package/dist/expo/index.d.ts +4 -4
- package/dist/{field-errors-6BVg31Yp.d.ts → field-errors-DkzFduux.d.ts} +10 -10
- package/dist/{fields-C3q2ypnO.d.ts → fields-snbaZ14h.d.ts} +1 -1
- package/dist/{filter-evaluate-CPxeae5X.d.ts → filter-evaluate-BRpNiNPG.d.ts} +1 -1
- package/dist/{filter-query-BXLs72G9.d.ts → filter-query-DBt7OKuH.d.ts} +1 -1
- package/dist/{flags-C01PLMJ-.d.ts → flags-DDKTThrO.d.ts} +2 -2
- package/dist/flags-sdk/index.d.ts +1 -1
- package/dist/{framework-GlxXiotm.d.ts → framework-DVYTtQXA.d.ts} +7 -7
- package/dist/{gateway-DzI687yd.d.ts → gateway-Ve7cByEr.d.ts} +3 -3
- package/dist/h3/index.d.ts +1 -1
- package/dist/h3/v1/index.d.ts +1 -1
- package/dist/hono/index.d.ts +9 -9
- package/dist/{inbox-NDKwSk_H.d.ts → inbox-c8B86Trp.d.ts} +5 -5
- package/dist/{index-C_qlBJ3k.d.ts → index-B4wttiLh.d.ts} +4 -4
- package/dist/{index-BfYDY6eh.d.ts → index-BM6NmKSc.d.ts} +5 -5
- package/dist/{index-CbUCGMqj.d.ts → index-BNgpz_BV.d.ts} +5 -5
- package/dist/{index-C0QuN9_P.d.ts → index-BxckmAFc.d.ts} +106 -121
- package/dist/{index-Cagz4Z2k.d.ts → index-CB66nl14.d.ts} +4 -3
- package/dist/{index-DOHx3JuB.d.ts → index-CBQT_nXf.d.ts} +5 -5
- package/dist/{index-D01wHGSN.d.ts → index-Cw5gGSP8.d.ts} +14 -14
- package/dist/{index-CQhPHHDF.d.ts → index-Cxsnd-OL.d.ts} +1 -1
- package/dist/{index-D1ckLbUM.d.ts → index-pZn6S_iq.d.ts} +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/{instances-qz2MCMyK.js → instances-C7qUTjhJ.js} +1 -1
- package/dist/{kit-Dxx3MT8m.d.ts → kit-B8yWCRN7.d.ts} +3 -3
- package/dist/{knowledge-F1IhRI4Q.d.ts → knowledge-CsLPACGJ.d.ts} +5 -5
- package/dist/lint/index.d.ts +1 -1
- package/dist/list/index.d.ts +3 -3
- package/dist/{list-query-XHoYDlRN.d.ts → list-query-BcU8NnNL.d.ts} +3 -3
- package/dist/mapper/bin.js +7 -7
- package/dist/mcp/index.d.ts +6 -6
- package/dist/mcp/sdk/index.d.ts +6 -6
- package/dist/{messaging-C_Pr9tGx.d.ts → messaging-DQP09JsY.d.ts} +4 -4
- package/dist/nestjs/index.d.ts +2 -2
- package/dist/next/client/index.d.ts +1 -1
- package/dist/next/index.d.ts +22 -22
- package/dist/node/index.d.ts +2 -2
- package/dist/{operations-CPhOcuzl.d.ts → operations-CqmQrTKw.d.ts} +1 -1
- package/dist/{options-BOGo1qCA.js → options-B5E2MGIz.js} +3 -1
- package/dist/{options-D2s7fT1s.js → options-COo7_3MX.js} +2 -1
- package/dist/{options-D32-YxnO.js → options-DhoLMknl.js} +3 -1
- package/dist/orpc/index.d.ts +8 -8
- package/dist/otel/index.d.ts +2 -2
- package/dist/otel/index.js +4 -4
- package/dist/{outbox-DxZgoKwp.d.ts → outbox-BZ712Z3X.d.ts} +4 -4
- package/dist/{pool-wjbAMqc1.d.ts → pool-DDR1ndk7.d.ts} +3 -3
- package/dist/{ports-Bw7uxPd_.d.ts → ports-6LBgr1Aa.d.ts} +1 -1
- package/dist/postgres/index.d.ts +4 -4
- package/dist/{postgrest-z-T0l23T.d.ts → postgrest-AJc8hnJU.d.ts} +1 -1
- package/dist/powersync/index.d.ts +6 -6
- package/dist/preset/index.d.ts +3 -3
- package/dist/preset/index.js +3 -3
- package/dist/{preset-BbSWLoXM.js → preset-DCdEnJj9.js} +9 -14
- package/dist/{project-TN03XDsA.js → project-C4NA_van.js} +5 -5
- package/dist/{provider-ClrIplXa.d.ts → provider-CWjzAIX9.d.ts} +1 -1
- package/dist/{push-token-vykw2JXT.d.ts → push-token-BXsrJ7W9.d.ts} +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/react/index.d.ts +8 -8
- package/dist/react/native/index.d.ts +1 -1
- package/dist/react/server.d.ts +8 -8
- package/dist/react/session.d.ts +2 -2
- package/dist/react-router/index.d.ts +6 -6
- package/dist/realtime/index.d.ts +6 -6
- package/dist/realtime/index.js +2 -2
- package/dist/{record-form-D2-F4IwS.d.ts → record-form-CubgBrtI.d.ts} +1 -1
- package/dist/{recordings-BBSJt_YV.d.ts → recordings-DeZYx-Kv.d.ts} +1 -1
- package/dist/records/index.d.ts +9 -9
- package/dist/{refresh-CCKB1Wa6.d.ts → refresh-D02Pbf5B.d.ts} +1 -1
- package/dist/{refusal-D_tklIEb.d.ts → refusal-B0VmlAxF.d.ts} +2 -2
- package/dist/{resolve-Bj1qD7Dy.d.ts → resolve-CtX6T0c0.d.ts} +1 -1
- package/dist/{resolved-names-Dsf28_Dr.js → resolved-names-iLBOUaib.js} +2 -2
- package/dist/{resource-D8pzB5Qf.d.ts → resource-WxN0IsvB.d.ts} +1 -1
- package/dist/{resource-execute-BSTIfp1D.d.ts → resource-execute-BzqR8DdD.d.ts} +2 -2
- package/dist/{resource-types-D5WEvYtV.d.ts → resource-types-BVbHgTPg.d.ts} +4 -4
- package/dist/{resources-CsZ7RhZC.d.ts → resources-BSbRa0Ab.d.ts} +2 -2
- package/dist/{respond-BzRG-0qc.d.ts → respond-Dzu_-EPH.d.ts} +1 -1
- package/dist/{sales-lines-KxxStRzU.d.ts → sales-lines-BsmrNHe9.d.ts} +1 -1
- package/dist/{scores-B2BiNuVJ.d.ts → scores-Y8TvyJi1.d.ts} +5 -5
- package/dist/server/index.d.ts +24 -24
- package/dist/server/index.js +1 -1
- package/dist/{server-types-BlDiY-ya.d.ts → server-types-BkTIxW_H.d.ts} +11 -11
- package/dist/{session-BGP98Rgj.d.ts → session-BOzx2qHC.d.ts} +6 -6
- package/dist/{session-status-C4t7kbSn.d.ts → session-status-BP8eYVnA.d.ts} +2 -2
- package/dist/{sign-in-CAadgm33.d.ts → sign-in-CfwJAJJL.d.ts} +2 -2
- package/dist/{signers-BKgmVh6A.d.ts → signers-ZmxO1I05.d.ts} +4 -4
- package/dist/{signing-keys-BNDUxpQL.d.ts → signing-keys-udgP7Aod.d.ts} +2 -2
- package/dist/solid/index.d.ts +10 -10
- package/dist/solid-start/index.d.ts +6 -6
- package/dist/spec/index.d.ts +2 -2
- package/dist/sql/index.d.ts +5 -5
- package/dist/sql/index.js +5 -5
- package/dist/{sql-Dg3W1ENk.js → sql-CoBySj2F.js} +3617 -1285
- package/dist/sqlite/index.d.ts +3 -3
- package/dist/{sso-B0Txid2-.d.ts → sso-CkU_4mtK.d.ts} +3 -3
- package/dist/ssr/index.d.ts +5 -5
- package/dist/storage/index.d.ts +3 -3
- package/dist/storage/index.js +1 -1
- package/dist/streams/index.d.ts +1 -1
- package/dist/{subject-readers-DJbzlm8a.d.ts → subject-readers-CB5Te02u.d.ts} +5 -5
- package/dist/{subject-readers-CeeJJOQ4.js → subject-readers-VHcrWhmq.js} +2 -2
- package/dist/{subjects-NomQg6Eg.d.ts → subjects-BYCL-6hA.d.ts} +15 -1
- package/dist/{subjects-BpIEN1MS.d.ts → subjects-CiBNKy2y.d.ts} +4 -4
- package/dist/{support-D7CMbhRT.d.ts → support-BxyPOFk4.d.ts} +4 -4
- package/dist/{support-view-CIDXF3_H.d.ts → support-view-nqUWKHEs.d.ts} +1 -1
- package/dist/svelte/index.d.ts +9 -9
- package/dist/sveltekit/index.d.ts +7 -7
- package/dist/{tags-Dg4Ywmqp.d.ts → tags-Cm48BsOa.d.ts} +1 -1
- package/dist/tanstack-db/index.d.ts +3 -3
- package/dist/tanstack-start/index.d.ts +6 -6
- package/dist/{tenant-BRmKZ7aq.d.ts → tenant-Ded341Qz.d.ts} +2 -2
- package/dist/testing/index.d.ts +25 -25
- package/dist/testing/index.js +2 -2
- package/dist/{timeline-Cjl-1hiA.d.ts → timeline-DvXtXq5q.d.ts} +5 -5
- package/dist/{topic-F0FKzJyQ.js → topic-DnsNG4Kj.js} +1 -1
- package/dist/{topic-CpsKVBot.d.ts → topic-XDdKzlrn.d.ts} +5 -5
- package/dist/{types-Dp3UCr1e.d.ts → types-B-D6fYx2.d.ts} +1 -1
- package/dist/{types-CjRwmCRP.d.ts → types-BFwB-E1j.d.ts} +2 -2
- package/dist/{types-Czq9Xtpa.d.ts → types-CK2X2wCB.d.ts} +5 -5
- package/dist/{types-DFdg_4yN.d.ts → types-CPl9uJ0G.d.ts} +2 -2
- package/dist/{types-DR1MHh7N.d.ts → types-CwQgFo8c.d.ts} +4 -4
- package/dist/{types-Dr9wZgNy.d.ts → types-DMihLukJ.d.ts} +3 -3
- package/dist/{types-A4yyKEsg.d.ts → types-iCyZ3lMx.d.ts} +4 -4
- package/dist/{types-BdaBfYIw.d.ts → types-nspa5I-a.d.ts} +7 -7
- package/dist/{undo-B1jwnVyN.d.ts → undo-0HkWXASn.d.ts} +2 -2
- package/dist/{usage-Dp45V42p.d.ts → usage-BkWAPkg2.d.ts} +4 -4
- package/dist/{vault-BghaujrZ.d.ts → vault-BkdPmL7f.d.ts} +2 -2
- package/dist/vercel-connect/index.d.ts +1 -1
- package/dist/{verify-CI8LgSpv.d.ts → verify-41mZmspj.d.ts} +2 -2
- package/dist/{view-BvNA7EOC.d.ts → view-C8_xvD-j.d.ts} +1 -1
- package/dist/vue/index.d.ts +10 -10
- package/dist/{watch-topic-BaMZX139.d.ts → watch-topic-DpN_GEoS.d.ts} +1 -1
- package/dist/workflow-sdk/builder/index.d.ts +3 -3
- package/dist/workflow-sdk/index.d.ts +1 -1
- package/dist/workflow-sdk/world/index.d.ts +1 -1
- package/dist/workflow-sdk/world/index.js +1 -1
- package/dist/{workflow-sdk-CE8sEK57.js → workflow-sdk-CaEw822d.js} +25 -4
- package/dist/{workflow-sdk-BNsZrcVg.d.ts → workflow-sdk-rg3IbCZC.d.ts} +3 -3
- package/dist/{workflows-B0ZPAQu0.d.ts → workflows-xL6t0TXx.d.ts} +7 -4
- package/dist/yjs/index.d.ts +2 -2
- package/dist/yjs/index.js +1 -1
- package/package.json +11 -2
- package/schemas/config-v1.json +45 -351
- package/skills/better-supabase/references/ui-recipes.md +5 -5
- package/dist/cli/add-Bf1fyCWm.js +0 -1
- package/dist/cli/env-xhwXk5Ri.js +0 -1
- package/dist/cli/in-stack-diff-DQTW53Vf.js +0 -257
- package/dist/cli/powersync-Dq-txa0_.js +0 -1
- package/dist/cli/seed-CO3j_bly.js +0 -1
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
2
|
+
import { h as subjectTagArgs } from "./config-Cskysxp-.js";
|
|
3
|
+
import { r as layoutFor } from "./providers-Cjf5iOp5.js";
|
|
4
|
+
import { d as readSupabaseToml, n as declarativeSchemasDir } from "./supabase-toml-CncmQbO0.js";
|
|
5
|
+
import { r as literal } from "./live-PpAh9pAc.js";
|
|
6
|
+
import { join, resolve, sep } from "node:path";
|
|
7
|
+
import { FIELD_FORMATS } from "better-supabase/config";
|
|
8
|
+
import { APP_TABLES_MODULE, renderBlocks, setTableFeature } from "better-supabase/sql";
|
|
9
|
+
/**
|
|
10
|
+
* The domain for a format on a column type, or undefined when the format has no
|
|
11
|
+
* pattern or bounds to check. The first type a format fits takes the plain
|
|
12
|
+
* name; the others add the type (`rating_bigint`).
|
|
13
|
+
*/
|
|
14
|
+
function formatDomain(format, type) {
|
|
15
|
+
const spec = FIELD_FORMATS[format];
|
|
16
|
+
const index = spec.types.findIndex((each) => each === type);
|
|
17
|
+
if (index === -1 || spec.pattern === void 0 && spec.bounds === void 0) return;
|
|
18
|
+
const bare = index === 0 ? format : `${format}_${type}`;
|
|
19
|
+
const checks = [...spec.pattern === void 0 ? [] : [`value ~* ${literal(spec.pattern)}`], ...spec.bounds === void 0 ? [] : [`value >= ${String(spec.bounds[0])}`, `value <= ${String(spec.bounds[1])}`]];
|
|
20
|
+
return {
|
|
21
|
+
name: `bsb.${bare}`,
|
|
22
|
+
bare,
|
|
23
|
+
base: type,
|
|
24
|
+
sql: `create domain bsb.${bare} as ${type}\n constraint ${bare}_check check (${checks.join(" and ")});`
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** The domain a column takes, or undefined when it keeps its type and check. */
|
|
28
|
+
function domainOf(column) {
|
|
29
|
+
if (column.format === void 0 || column.options !== void 0 || column.encrypted === true || column.min !== void 0 || column.max !== void 0) return;
|
|
30
|
+
return formatDomain(column.format, column.type);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `tables` with each format column typed as its domain, and the domains they
|
|
34
|
+
* use. A column with its own `min`, `max` or `options` keeps the inline check,
|
|
35
|
+
* since a domain would tighten what the column allows.
|
|
36
|
+
*/
|
|
37
|
+
function withFormatDomains(tables) {
|
|
38
|
+
const used = /* @__PURE__ */ new Map();
|
|
39
|
+
return {
|
|
40
|
+
tables: Object.fromEntries(Object.entries(tables).map(([name, table]) => [name, {
|
|
41
|
+
...table,
|
|
42
|
+
columns: Object.fromEntries(Object.entries(table.columns ?? {}).map(([column, config]) => {
|
|
43
|
+
const domain = domainOf(config);
|
|
44
|
+
if (domain === void 0) return [column, config];
|
|
45
|
+
used.set(domain.name, domain);
|
|
46
|
+
return [column, {
|
|
47
|
+
...config,
|
|
48
|
+
domain: domain.name
|
|
49
|
+
}];
|
|
50
|
+
}))
|
|
51
|
+
}])),
|
|
52
|
+
domains: [...used.values()].toSorted((a, b) => a.name.localeCompare(b.name))
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/cli/sql/schema-first.ts
|
|
57
|
+
const NAME = String.raw`(?:"?public"?\.)?"?([a-z_][a-z0-9_]*)"?`;
|
|
58
|
+
const TABLE_TARGETS = [
|
|
59
|
+
new RegExp(String.raw`^create\s+table\s+(?:if\s+not\s+exists\s+)?${NAME}`, "iu"),
|
|
60
|
+
new RegExp(String.raw`^alter\s+table\s+(?:if\s+exists\s+)?(?:only\s+)?${NAME}`, "iu"),
|
|
61
|
+
new RegExp(String.raw`^create\s+(?:unique\s+)?index\s+(?:if\s+not\s+exists\s+)?\S+\s+on\s+(?:only\s+)?${NAME}`, "iu"),
|
|
62
|
+
new RegExp(String.raw`^create\s+policy\s+(?:"[^"]+"|\S+)\s+on\s+${NAME}`, "iu"),
|
|
63
|
+
new RegExp(String.raw`^drop\s+policy\s+(?:if\s+exists\s+)?(?:"[^"]+"|\S+)\s+on\s+${NAME}`, "iu"),
|
|
64
|
+
new RegExp(String.raw`^create\s+(?:or\s+replace\s+)?(?:constraint\s+)?trigger\s+\S+[\s\S]*?\son\s+${NAME}\s`, "iu"),
|
|
65
|
+
new RegExp(String.raw`^(?:grant|revoke)\s[\s\S]*?\son\s+(?:table\s+)?${NAME}\s+(?:to|from)\s`, "iu"),
|
|
66
|
+
new RegExp(String.raw`^comment\s+on\s+table\s+${NAME}\s+is`, "iu"),
|
|
67
|
+
new RegExp(String.raw`^drop\s+trigger\s+(?:if\s+exists\s+)?\S+\s+on\s+${NAME}`, "iu")
|
|
68
|
+
];
|
|
69
|
+
/** Statements about a view that sit next to its `create view`. */
|
|
70
|
+
const VIEW_TARGETS = [
|
|
71
|
+
new RegExp(String.raw`^(?:grant|revoke)\s[\s\S]*?\son\s+(?:table\s+)?${NAME}\s+(?:to|from)\s`, "iu"),
|
|
72
|
+
new RegExp(String.raw`^comment\s+on\s+view\s+${NAME}\s+is`, "iu"),
|
|
73
|
+
new RegExp(String.raw`^alter\s+view\s+(?:if\s+exists\s+)?${NAME}`, "iu")
|
|
74
|
+
];
|
|
75
|
+
const DROP_VIEW = new RegExp(String.raw`^drop\s+view\s+(?:if\s+exists\s+)?${NAME}`, "iu");
|
|
76
|
+
const VIEW = new RegExp(String.raw`^create\s+(?:or\s+replace\s+)?view\s+${NAME}`, "iu");
|
|
77
|
+
/** The statement without its leading comment lines. */
|
|
78
|
+
function bare(statement) {
|
|
79
|
+
return statement.replace(LEADING_COMMENTS, "").trim();
|
|
80
|
+
}
|
|
81
|
+
const LEADING_COMMENTS = /^(?:\s*--[^\n]*\n)+/u;
|
|
82
|
+
const DOLLAR_TAG = /^\$[A-Za-z_]*\$/u;
|
|
83
|
+
/**
|
|
84
|
+
* The statements of `sql`, split at semicolons outside quotes, dollar quotes
|
|
85
|
+
* and comments.
|
|
86
|
+
*/
|
|
87
|
+
function statements(sql) {
|
|
88
|
+
const found = [];
|
|
89
|
+
let start = 0;
|
|
90
|
+
let at = 0;
|
|
91
|
+
while (at < sql.length) {
|
|
92
|
+
const char = sql[at];
|
|
93
|
+
if (char === "-" && sql[at + 1] === "-") {
|
|
94
|
+
const end = sql.indexOf("\n", at);
|
|
95
|
+
at = end === -1 ? sql.length : end;
|
|
96
|
+
} else if (char === "/" && sql[at + 1] === "*") {
|
|
97
|
+
const end = sql.indexOf("*/", at + 2);
|
|
98
|
+
at = end === -1 ? sql.length : end + 2;
|
|
99
|
+
} else if (char === "'" || char === "\"") {
|
|
100
|
+
let end = at + 1;
|
|
101
|
+
while (end < sql.length && sql[end] !== char) end += 1;
|
|
102
|
+
at = end + 1;
|
|
103
|
+
} else if (char === "$") {
|
|
104
|
+
const tag = DOLLAR_TAG.exec(sql.slice(at))?.[0];
|
|
105
|
+
if (tag === void 0) at += 1;
|
|
106
|
+
else {
|
|
107
|
+
const end = sql.indexOf(tag, at + tag.length);
|
|
108
|
+
at = end === -1 ? sql.length : end + tag.length;
|
|
109
|
+
}
|
|
110
|
+
} else if (char === ";") {
|
|
111
|
+
found.push(sql.slice(start, at + 1));
|
|
112
|
+
start = at + 1;
|
|
113
|
+
at += 1;
|
|
114
|
+
} else at += 1;
|
|
115
|
+
}
|
|
116
|
+
if (sql.slice(start).trim() !== "") found.push(sql.slice(start));
|
|
117
|
+
return found;
|
|
118
|
+
}
|
|
119
|
+
/** The table or view a statement belongs to, or undefined for anything else. */
|
|
120
|
+
function targetOf(statement, tables, views) {
|
|
121
|
+
const text = statement;
|
|
122
|
+
for (const pattern of TABLE_TARGETS) {
|
|
123
|
+
const name = pattern.exec(text)?.[1];
|
|
124
|
+
if (name !== void 0 && tables.has(name)) return {
|
|
125
|
+
kind: "table",
|
|
126
|
+
name
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const dropped = DROP_VIEW.exec(text)?.[1];
|
|
130
|
+
if (dropped !== void 0 && views.has(dropped)) return {
|
|
131
|
+
kind: "dropped",
|
|
132
|
+
name: dropped
|
|
133
|
+
};
|
|
134
|
+
for (const pattern of VIEW_TARGETS) {
|
|
135
|
+
const name = pattern.exec(text)?.[1];
|
|
136
|
+
if (name !== void 0 && views.has(name)) return {
|
|
137
|
+
kind: "view",
|
|
138
|
+
name
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
const view = VIEW.exec(text)?.[1];
|
|
142
|
+
return view === void 0 ? void 0 : {
|
|
143
|
+
kind: "view",
|
|
144
|
+
name: view
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The tags `config` implies for `table`: `subject`, `realtime`,
|
|
149
|
+
* `vector-search`, `json`, `encrypted`, `server` and `events`. `audit`,
|
|
150
|
+
* `audit-reads` and `expose` change the table's SQL only, which the split keeps
|
|
151
|
+
* as written.
|
|
152
|
+
*/
|
|
153
|
+
function tagsFor(config, table) {
|
|
154
|
+
const tags = [];
|
|
155
|
+
for (const [type, subject] of Object.entries(config.subjects)) if (subject.table === table || subject.table === `public.${table}`) {
|
|
156
|
+
const args = subjectTagArgs(type, subject, table);
|
|
157
|
+
if (args !== void 0) tags.push({
|
|
158
|
+
feature: "subject",
|
|
159
|
+
tag: {
|
|
160
|
+
name: "subject",
|
|
161
|
+
args
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (config.realtime.tables.some((each) => each === table || each === `public.${table}`)) {
|
|
166
|
+
const user = config.realtime.users[table];
|
|
167
|
+
tags.push({
|
|
168
|
+
feature: "realtime",
|
|
169
|
+
tag: {
|
|
170
|
+
name: "realtime",
|
|
171
|
+
args: {
|
|
172
|
+
...config.realtime.global.includes(table) ? { global: true } : {},
|
|
173
|
+
...user === void 0 ? {} : { user }
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const vector = config.vectorSearch.find((each) => each.table === table || each.table === `public.${table}`);
|
|
179
|
+
if (vector !== void 0) tags.push({
|
|
180
|
+
feature: "vector-search",
|
|
181
|
+
tag: {
|
|
182
|
+
name: "vector-search",
|
|
183
|
+
args: {
|
|
184
|
+
column: vector.column,
|
|
185
|
+
distance: vector.distance
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
const jsonArgs = {};
|
|
190
|
+
for (const [key, entry] of Object.entries(config.json)) {
|
|
191
|
+
const column = [`${table}.`, `public.${table}.`].map((prefix) => key.startsWith(prefix) ? key.slice(prefix.length) : "").find((name) => name !== "" && !name.includes("."));
|
|
192
|
+
if (column !== void 0) jsonArgs[column] = "import" in entry ? `import:${entry.import}` : entry.type;
|
|
193
|
+
}
|
|
194
|
+
if (Object.keys(jsonArgs).length > 0) tags.push({
|
|
195
|
+
feature: "json",
|
|
196
|
+
tag: {
|
|
197
|
+
name: "json",
|
|
198
|
+
args: jsonArgs
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
const app = config.appTables[table];
|
|
202
|
+
const sealed = Object.entries(app?.columns ?? {}).flatMap(([name, column]) => column.encrypted === true ? [[name, column.type]] : []);
|
|
203
|
+
if (sealed.length > 0) tags.push({
|
|
204
|
+
feature: "encrypted",
|
|
205
|
+
tag: {
|
|
206
|
+
name: "encrypted",
|
|
207
|
+
args: Object.fromEntries(sealed)
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
const hidden = Object.entries(app?.columns ?? {}).flatMap(([name, column]) => column.access === "server" ? [name] : []);
|
|
211
|
+
if (hidden.length > 0) tags.push({
|
|
212
|
+
feature: "server",
|
|
213
|
+
tag: {
|
|
214
|
+
name: "server",
|
|
215
|
+
args: Object.fromEntries(hidden.map((name) => [name, true]))
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
const events = app?.events;
|
|
219
|
+
if (events !== void 0) {
|
|
220
|
+
const on = events === true ? void 0 : events.on;
|
|
221
|
+
const include = events === true ? void 0 : events.include;
|
|
222
|
+
tags.push({
|
|
223
|
+
feature: "events",
|
|
224
|
+
tag: {
|
|
225
|
+
name: "events",
|
|
226
|
+
args: {
|
|
227
|
+
...on === void 0 ? {} : { on: on.join(", ") },
|
|
228
|
+
...include === void 0 ? {} : { include: include.join(", ") }
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return tags;
|
|
234
|
+
}
|
|
235
|
+
function header(text) {
|
|
236
|
+
return `-- ${text}\n`;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Splits the rendered app tables file into the pg-delta export layout (ADR
|
|
240
|
+
* 0102): `public/tables/<name>.sql` holds a table's create, columns, keys,
|
|
241
|
+
* policies, grants, indexes and triggers, with the table's `@bsb` tags in its
|
|
242
|
+
* comment; `public/views/<name>.sql` holds each view; every other statement
|
|
243
|
+
* goes to `public/_custom/app_tables.sql`. Statements keep their order within a
|
|
244
|
+
* file. `tables` is the app table names.
|
|
245
|
+
*/
|
|
246
|
+
function splitAppTables(config, sql, tables) {
|
|
247
|
+
const known = new Set(tables);
|
|
248
|
+
const all = statements(sql).map((raw) => bare(raw));
|
|
249
|
+
const views = new Set(all.flatMap((statement) => {
|
|
250
|
+
const name = VIEW.exec(statement)?.[1];
|
|
251
|
+
return name === void 0 ? [] : [name];
|
|
252
|
+
}));
|
|
253
|
+
const byTable = /* @__PURE__ */ new Map();
|
|
254
|
+
const byView = /* @__PURE__ */ new Map();
|
|
255
|
+
const rest = [];
|
|
256
|
+
for (const statement of all) {
|
|
257
|
+
if (statement === "") continue;
|
|
258
|
+
const target = targetOf(statement, known, views);
|
|
259
|
+
if (target === void 0) rest.push(statement);
|
|
260
|
+
else if (target.kind !== "dropped") {
|
|
261
|
+
const group = target.kind === "table" ? byTable : byView;
|
|
262
|
+
group.set(target.name, [...group.get(target.name) ?? [], statement]);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const files = [];
|
|
266
|
+
for (const name of tables) {
|
|
267
|
+
const body = `${(byTable.get(name) ?? []).join("\n\n")}\n`;
|
|
268
|
+
const tagged = tagsFor(config, name).reduce((text, { feature, tag }) => setTableFeature(text, "public", name, feature, true, tag), body);
|
|
269
|
+
files.push({
|
|
270
|
+
path: `public/tables/${name}.sql`,
|
|
271
|
+
contents: `${header("Owned by you since `better-supabase migrate schema-first`.")}${tagged}`
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
for (const [name, statements] of byView) files.push({
|
|
275
|
+
path: `public/views/${name}.sql`,
|
|
276
|
+
contents: `${statements.join("\n\n")}\n`
|
|
277
|
+
});
|
|
278
|
+
if (rest.length > 0) files.push({
|
|
279
|
+
path: "public/_custom/app_tables.sql",
|
|
280
|
+
contents: `${header("Statements of the old app tables file that belong to no single table.")}${rest.join("\n\n")}\n`
|
|
281
|
+
});
|
|
282
|
+
return files;
|
|
283
|
+
}
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/cli/sql/app-table-files.ts
|
|
286
|
+
/**
|
|
287
|
+
* The deepest directory that holds both paths. A project in a monorepo keeps
|
|
288
|
+
* its `supabase` folder above its own root, and the plan may not leave `root`.
|
|
289
|
+
*/
|
|
290
|
+
function commonAncestor(first, second) {
|
|
291
|
+
const left = resolve(first).split(sep);
|
|
292
|
+
const right = resolve(second).split(sep);
|
|
293
|
+
const shared = [];
|
|
294
|
+
for (const [index, part] of left.entries()) {
|
|
295
|
+
if (part !== right[index]) break;
|
|
296
|
+
shared.push(part);
|
|
297
|
+
}
|
|
298
|
+
return shared.join(sep) || sep;
|
|
299
|
+
}
|
|
300
|
+
/** The `bsb` schema and one file per domain, in pg-delta's export layout. */
|
|
301
|
+
function domainFiles(domains) {
|
|
302
|
+
if (domains.length === 0) return [];
|
|
303
|
+
return [{
|
|
304
|
+
path: `bsb/schema.sql`,
|
|
305
|
+
contents: `-- Owned by you since \`better-supabase migrate schema-first\`.\ncreate schema if not exists bsb;\ngrant usage on schema bsb to anon, authenticated, service_role;\n`
|
|
306
|
+
}, ...domains.map((domain) => ({
|
|
307
|
+
path: `bsb/domains/${domain.bare}.sql`,
|
|
308
|
+
contents: `-- The ${domain.bare} format of a column. Owned by you.\n${domain.sql}\n`
|
|
309
|
+
}))];
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* The plan that writes the tables `config.appTables` renders as files you own
|
|
313
|
+
* under the declarative schemas folder (ADR 0102), with each table's features
|
|
314
|
+
* as `@bsb` tags in its comment. A file that exists stays as it is. The config
|
|
315
|
+
* only carries `appTables` from a Create design or an old config that `migrate
|
|
316
|
+
* schema-first` reads; the public config has no key for it.
|
|
317
|
+
*/
|
|
318
|
+
async function appTablePlan(config, regenerate) {
|
|
319
|
+
const tables = Object.keys(config.appTables);
|
|
320
|
+
if (tables.length === 0) return;
|
|
321
|
+
const typed = withFormatDomains(config.appTables);
|
|
322
|
+
const layout = await layoutFor({
|
|
323
|
+
...config,
|
|
324
|
+
appTables: typed.tables
|
|
325
|
+
}, {}, config.blockNames);
|
|
326
|
+
const source = renderBlocks(config.blockNames, layout).find((file) => file.module === APP_TABLES_MODULE && file.kind === "schema");
|
|
327
|
+
if (source === void 0) throw new CliError("usage", "The config renders no app tables file.");
|
|
328
|
+
const dir = join(config.root, declarativeSchemasDir(await readSupabaseToml(config.root)));
|
|
329
|
+
const split = [...splitAppTables(config, source.contents, tables), ...domainFiles(typed.domains)];
|
|
330
|
+
return {
|
|
331
|
+
tables,
|
|
332
|
+
files: split.map((file) => file.path),
|
|
333
|
+
plan: {
|
|
334
|
+
root: commonAncestor(config.root, dir),
|
|
335
|
+
base: config.root,
|
|
336
|
+
regenerate,
|
|
337
|
+
files: split.map((file) => ({
|
|
338
|
+
path: join(dir, file.path),
|
|
339
|
+
contents: file.contents,
|
|
340
|
+
policy: "create"
|
|
341
|
+
}))
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
//#endregion
|
|
346
|
+
export { appTablePlan as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
|
|
2
2
|
import { n as CliError, r as errorText } from "./errors-BTe6A15O.js";
|
|
3
3
|
import { i as isLocalDatabaseUrl, r as databaseHost } from "./agent-CbuPvI2x.js";
|
|
4
|
-
import { l as stdinDatabaseUrl, n as databaseUrl } from "./config-
|
|
4
|
+
import { l as stdinDatabaseUrl, n as databaseUrl } from "./config-Cskysxp-.js";
|
|
5
5
|
import { t as connect } from "./db-CQCLx7cx.js";
|
|
6
|
-
import { n as ident } from "./live-
|
|
7
|
-
import { r as STACK_ARG, t as DB_URL_STDIN_ARG } from "./source-args-
|
|
6
|
+
import { n as ident } from "./live-PpAh9pAc.js";
|
|
7
|
+
import { r as STACK_ARG, t as DB_URL_STDIN_ARG } from "./source-args-v8ljFDfc.js";
|
|
8
8
|
//#region src/cli/commands/backfill.ts
|
|
9
9
|
const DEFAULT_BATCH = 1e3;
|
|
10
10
|
const ARGS = {
|
package/dist/cli/bin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as blocksListCommand, r as blocksSearchCommand, i as blocksViewCommand } from "./blocks-
|
|
1
|
+
export { n as blocksListCommand, r as blocksSearchCommand, i as blocksViewCommand } from "./blocks-tRfYx_mh.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
|
|
2
2
|
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
3
3
|
import { t as SQL_ARGS } from "./args-UEwg0l-N.js";
|
|
4
|
-
import { n as listModules, t as printModule } from "./print-
|
|
4
|
+
import { n as listModules, t as printModule } from "./print-DSTnq5xz.js";
|
|
5
5
|
import { t as decodePresetInput } from "./preset-BwmIfFnh.js";
|
|
6
6
|
import { BLOCK_CATEGORIES } from "better-supabase/blocks";
|
|
7
7
|
import { PRESET_CATALOG, PRESET_NAMES, glueCommand } from "better-supabase/preset";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as VERSION } from "./version-
|
|
1
|
+
import { t as VERSION } from "./version-CQHFm-ak.js";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
|
|
2
2
|
import { i as plain } from "./style-Bm2X5JrN.js";
|
|
3
3
|
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
4
|
-
import { t as migrateCliCall } from "./moved-
|
|
4
|
+
import { t as migrateCliCall } from "./moved-DNOtp9LA.js";
|
|
5
5
|
import { t as isRecord$1 } from "./guards-CUlDNYZs.js";
|
|
6
6
|
import { a as changedFiles, i as changeLines, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
|
|
7
|
-
import { i as schemasDirOf, n as migrationsDir, o as writtenByBlocks } from "./sql-layout-
|
|
7
|
+
import { i as schemasDirOf, n as migrationsDir, o as writtenByBlocks } from "./sql-layout-CkxDNVEH.js";
|
|
8
8
|
import { a as configObject, c as mask, f as setPathInConfig, g as skipSpace, h as setPresetInJson, i as closingIndex, l as properties, m as setPresetInConfig, o as indentAt, p as setPathInJson, t as addBlocksToConfig, v as codeRanges } from "./config-edit-CrWfk8s3.js";
|
|
9
9
|
import { i as legacyPrefixNames, n as LEGACY_PREFIXES, t as LEGACY_CLAIMS } from "./legacy-prefix-R7UChFFl.js";
|
|
10
10
|
import { a as REVIEW_0_15, c as renameSubpaths, r as PLUGIN_IMPORT_RENAMES, s as SUBPATH_RENAMES_0_15, t as BLOCK_EXPORT_RENAMES } from "./codemod-block-renames-BuSaTE_G.js";
|
|
11
|
-
import { a as RECORD_BINDING_RENAMES, n as groupConfigJson, r as groupConfigSource, t as cutRange } from "./config-group-
|
|
11
|
+
import { a as RECORD_BINDING_RENAMES, n as groupConfigJson, r as groupConfigSource, t as cutRange } from "./config-group-CP-B9uRt.js";
|
|
12
12
|
import { existsSync } from "node:fs";
|
|
13
13
|
import { extname, join, relative, resolve } from "node:path";
|
|
14
14
|
import { readFile, readdir, stat } from "node:fs/promises";
|
|
@@ -1874,7 +1874,7 @@ const CODEMODS = {
|
|
|
1874
1874
|
},
|
|
1875
1875
|
{
|
|
1876
1876
|
pattern: /\bcomments\s*:\s*\{/,
|
|
1877
|
-
message: "With `config.
|
|
1877
|
+
message: "With `config.subjects` set and no `subjects` option, comments accept only the registered subject types and require read on the subject row"
|
|
1878
1878
|
}
|
|
1879
1879
|
]
|
|
1880
1880
|
},
|
|
@@ -417,6 +417,37 @@ const COMMANDS = [
|
|
|
417
417
|
}],
|
|
418
418
|
effects: [FILES]
|
|
419
419
|
},
|
|
420
|
+
{
|
|
421
|
+
name: "table",
|
|
422
|
+
description: "Turns a per-table feature on or off with its @bsb tag in the table comment, in the schema file that creates the table",
|
|
423
|
+
group: "setup",
|
|
424
|
+
docs: "/docs/cli/table",
|
|
425
|
+
examples: [{
|
|
426
|
+
command: "better-supabase table invoices enable realtime",
|
|
427
|
+
description: "Adds the realtime tag to the invoices table comment"
|
|
428
|
+
}, {
|
|
429
|
+
command: "better-supabase table public.invoices disable audit",
|
|
430
|
+
description: "Removes the audit tag and keeps the comment's text"
|
|
431
|
+
}],
|
|
432
|
+
effects: [FILES]
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
name: "migrate",
|
|
436
|
+
description: "Moves a project to a newer model: schema-first turns appTables into table files you own",
|
|
437
|
+
group: "maintain",
|
|
438
|
+
docs: "/docs/cli/migrate",
|
|
439
|
+
effects: [FILES],
|
|
440
|
+
subcommands: [{
|
|
441
|
+
name: "schema-first",
|
|
442
|
+
description: "Writes the tables appTables renders as files under supabase/schemas, with the per-table features as @bsb tags",
|
|
443
|
+
docs: "/docs/cli/migrate",
|
|
444
|
+
examples: [{
|
|
445
|
+
command: "better-supabase migrate schema-first --dry-run",
|
|
446
|
+
description: "Shows the table files without writing them"
|
|
447
|
+
}],
|
|
448
|
+
effects: [FILES]
|
|
449
|
+
}]
|
|
450
|
+
},
|
|
420
451
|
{
|
|
421
452
|
name: "upgrade",
|
|
422
453
|
description: "Brings the blocks' SQL up to the config and this release: upgrade steps for blocks behind, then every block's files",
|
|
@@ -883,6 +914,7 @@ const GLOBAL_ARGS = {
|
|
|
883
914
|
const LISTS = /* @__PURE__ */ new WeakMap();
|
|
884
915
|
const COMPLETIONS = /* @__PURE__ */ new WeakMap();
|
|
885
916
|
const RUNS_WITH_INVALID_CONFIG = /* @__PURE__ */ new WeakSet();
|
|
917
|
+
const READS_LEGACY_TABLES = /* @__PURE__ */ new WeakSet();
|
|
886
918
|
/** A citty command that receives the `CliContext` and returns a `CommandResult`. */
|
|
887
919
|
function defineCliCommand(def) {
|
|
888
920
|
const version = def.apiVersion ?? 1;
|
|
@@ -898,6 +930,7 @@ function defineCliCommand(def) {
|
|
|
898
930
|
LISTS.set(command, def.lists ?? []);
|
|
899
931
|
COMPLETIONS.set(command, def.completions ?? {});
|
|
900
932
|
if (def.runsWithInvalidConfig === true) RUNS_WITH_INVALID_CONFIG.add(command);
|
|
933
|
+
if (def.readsLegacyTables === true) READS_LEGACY_TABLES.add(command);
|
|
901
934
|
return Object.assign(command, { apiVersion: 1 });
|
|
902
935
|
}
|
|
903
936
|
/** The list options a command declared through `defineCliCommand`. */
|
|
@@ -911,6 +944,9 @@ function listArgs(command) {
|
|
|
911
944
|
function completionValues(command) {
|
|
912
945
|
return COMPLETIONS.get(command) ?? {};
|
|
913
946
|
}
|
|
947
|
+
function readsLegacyTables(command) {
|
|
948
|
+
return READS_LEGACY_TABLES.has(command);
|
|
949
|
+
}
|
|
914
950
|
function runsWithInvalidConfig(command) {
|
|
915
951
|
return RUNS_WITH_INVALID_CONFIG.has(command);
|
|
916
952
|
}
|
|
@@ -958,4 +994,4 @@ function cliContext(data) {
|
|
|
958
994
|
return data;
|
|
959
995
|
}
|
|
960
996
|
//#endregion
|
|
961
|
-
export { list as a,
|
|
997
|
+
export { list as a, runsWithInvalidConfig as c, DOCS_ORIGIN as d, GROUPS as f, runCommand as g, parseArgs$2 as h, joinRepeated as i, COMMANDS as l, commandMeta as m, completionValues as n, listArgs as o, RESERVED_NAMES as p, defineCliCommand as r, readsLegacyTables as s, GLOBAL_ARGS as t, COMPLETE_COMMAND as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as isVariadic, r as commandArgs } from "./parse-
|
|
1
|
+
import { n as completionValues, o as listArgs, t as GLOBAL_ARGS, u as COMPLETE_COMMAND } from "./command-DIPmo0wh.js";
|
|
2
|
+
import { o as isVariadic, r as commandArgs } from "./parse-BPf3kGnc.js";
|
|
3
3
|
//#region src/cli/core/completion.ts
|
|
4
4
|
const SHELLS = [
|
|
5
5
|
"bash",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as complete, r as completionLines } from "./completion-
|
|
1
|
+
export { n as complete, r as completionLines } from "./completion-DxPxMtyP.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
|
|
2
2
|
import { n as CliError } from "./errors-BTe6A15O.js";
|
|
3
|
-
import { a as isShell, i as completionScript, t as SHELLS } from "./completion-
|
|
3
|
+
import { a as isShell, i as completionScript, t as SHELLS } from "./completion-DxPxMtyP.js";
|
|
4
4
|
//#region src/cli/commands/completion.ts
|
|
5
5
|
const ARGS = { shell: {
|
|
6
6
|
type: "positional",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
|
|
2
2
|
import { n as redact, r as redactUrl } from "./redact-KGAk2Ul9.js";
|
|
3
3
|
import { t as display } from "./io-DH1kcmmP.js";
|
|
4
4
|
import { n as presetInfo } from "./preset-BwmIfFnh.js";
|