better-supabase 0.35.0 → 0.37.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/{adapter-CWzyKepA.js → adapter-ddQ9Hzka.js} +126 -91
- package/dist/{agents-DXiOPB3V.d.ts → agents-BwUHtvD6.d.ts} +4 -4
- package/dist/{ai-cache-CLiAXCPH.d.ts → ai-cache-CPOP2PYz.d.ts} +4 -4
- package/dist/{ai-chat-DlcBdOhJ.d.ts → ai-chat-BZhfCHHr.d.ts} +106 -25
- package/dist/{ai-schedules-Drx2KRTn.d.ts → ai-schedules-ChJkI2jo.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 +2 -2
- package/dist/ai-sdk/chat/index.js +3 -272
- 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/index.js +2 -3
- 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 +6 -5
- package/dist/ai-sdk/workflow/index.js +9 -9
- package/dist/{api-myq2e9t5.d.ts → api-CbY2qdzT.d.ts} +5 -5
- package/dist/{api-keys-DbIbkGxx.d.ts → api-keys-BncNDlWG.d.ts} +4 -4
- package/dist/{app-tables-X3yzJljM.d.ts → app-tables-BlhdqqHf.d.ts} +1 -1
- package/dist/{approvals-DZoGtNFv.d.ts → approvals-CXW3yFWZ.d.ts} +101 -7
- package/dist/{approvals-Da4uAANx.js → approvals-D8gR1R8R.js} +95 -11
- package/dist/{assistant-BEbRPjhn.d.ts → assistant-5heV2GeR.d.ts} +7 -3
- package/dist/assistant-BHZ6fqBR.js +300 -0
- package/dist/astro/index.d.ts +7 -7
- package/dist/astro/index.js +5 -5
- package/dist/{auth-module-CqXdm8qD.js → auth-module-DkqapRZJ.js} +1 -1
- package/dist/{authorization-D1P3VBOd.d.ts → authorization-C7yjZttV.d.ts} +155 -54
- package/dist/{authorization-hooks-CxwsRnfV.d.ts → authorization-hooks-CR8TVvqo.d.ts} +8 -2
- package/dist/authz-topic-D7fPUY4P.js +13 -0
- package/dist/{availability-CebEOfMN.d.ts → availability-CZlcrkqD.d.ts} +49 -8
- package/dist/{base64-CVyKHBBw.js → base64-CEBz6-Jj.js} +9 -2
- package/dist/better-result/index.d.ts +3 -3
- package/dist/{bind-Bvv-Zrdh.d.ts → bind-BspFMDdW.d.ts} +7 -7
- package/dist/{block-env-h_uPl2f_.d.ts → block-env-CLco8YUl.d.ts} +4 -4
- package/dist/{block-helpers-disoUWCp.d.ts → block-helpers-BNtM1tqy.d.ts} +1 -1
- package/dist/{block-hooks-DrA_d1dJ.d.ts → block-hooks-CtMsgLQr.d.ts} +2 -2
- package/dist/{block-subjects-Br2MQNFn.d.ts → block-subjects-Bkieh2Xk.d.ts} +1 -1
- package/dist/{block-tables-pj3eHfoP.d.ts → block-tables-DfomofFv.d.ts} +1 -1
- package/dist/{block-transport-BEtC_Kis.d.ts → block-transport-CDmOUuLZ.d.ts} +2 -2
- package/dist/blocks/access-requests/index.d.ts +5 -5
- package/dist/blocks/activities/index.d.ts +9 -9
- 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 +8 -8
- package/dist/blocks/ai-chat/index.js +80 -20
- 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 +3 -3
- package/dist/blocks/approvals/index.d.ts +16 -5
- package/dist/blocks/approvals/index.js +7 -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/audit/index.js +1 -1
- 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/billing/index.js +1 -1
- package/dist/blocks/bookings/index.d.ts +6 -6
- package/dist/blocks/bulk/index.d.ts +4 -4
- package/dist/blocks/calendar/index.d.ts +46 -8
- package/dist/blocks/calendar/index.js +306 -47
- package/dist/blocks/catalog/index.d.ts +58 -17
- package/dist/blocks/catalog/index.js +65 -16
- package/dist/blocks/channels/index.d.ts +7 -7
- package/dist/blocks/collections/index.d.ts +6 -6
- 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 +6 -6
- 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/data-lifecycle/index.d.ts +8 -8
- package/dist/blocks/deals/index.d.ts +6 -6
- package/dist/blocks/dispatch/index.d.ts +6 -6
- package/dist/blocks/documents/index.d.ts +4 -4
- package/dist/blocks/documents/index.js +1 -1
- 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 +6 -6
- package/dist/blocks/employees/index.d.ts +8 -8
- package/dist/blocks/enrichment/index.d.ts +6 -6
- package/dist/blocks/enrollments/index.d.ts +74 -9
- package/dist/blocks/enrollments/index.js +67 -3
- package/dist/blocks/entitlements/index.d.ts +6 -6
- package/dist/blocks/expenses/index.d.ts +93 -6
- package/dist/blocks/expenses/index.js +95 -4
- 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 +6 -6
- 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 +11 -11
- package/dist/blocks/inbox/index.js +56 -1
- package/dist/blocks/incidents/index.d.ts +5 -5
- package/dist/blocks/index.d.ts +9 -9
- package/dist/blocks/inventory/index.d.ts +175 -14
- package/dist/blocks/inventory/index.js +206 -13
- package/dist/blocks/invoices/index.d.ts +26 -10
- package/dist/blocks/invoices/index.js +23 -7
- package/dist/blocks/knowledge/index.d.ts +4 -4
- package/dist/blocks/knowledge/index.js +1 -1
- 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 +88 -15
- package/dist/blocks/leave/index.js +65 -14
- 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 +5 -5
- package/dist/blocks/memory/index.js +30 -5
- 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 +11 -11
- 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/oauth-server/index.js +1 -1
- package/dist/blocks/onboarding/index.d.ts +5 -5
- package/dist/blocks/orders/index.d.ts +84 -17
- package/dist/blocks/orders/index.js +63 -4
- package/dist/blocks/organizations/index.d.ts +8 -8
- package/dist/blocks/outbox/index.d.ts +4 -4
- package/dist/blocks/outbox/index.js +1 -1
- package/dist/blocks/passes/index.d.ts +8 -8
- package/dist/blocks/passes/index.js +2 -2
- package/dist/blocks/permissions/index.d.ts +7 -7
- 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 +6 -6
- package/dist/blocks/promotions/index.js +1 -1
- package/dist/blocks/push/index.d.ts +7 -7
- package/dist/blocks/queue/index.d.ts +6 -6
- package/dist/blocks/queue/index.js +2 -2
- package/dist/blocks/quotes/index.d.ts +119 -27
- package/dist/blocks/quotes/index.js +111 -17
- package/dist/blocks/rank/index.d.ts +4 -4
- 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 +78 -11
- package/dist/blocks/reminders/index.js +118 -6
- 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 +7 -7
- package/dist/blocks/security-events/index.d.ts +7 -7
- package/dist/blocks/security-events/index.js +1 -1
- package/dist/blocks/segments/index.d.ts +7 -7
- 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/sessions/index.js +1 -1
- 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 +77 -8
- package/dist/blocks/shipments/index.js +58 -5
- package/dist/blocks/signatures/index.d.ts +5 -5
- package/dist/blocks/signing-keys/index.d.ts +4 -4
- package/dist/blocks/signing-keys/index.js +2 -2
- 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 +34 -7
- package/dist/blocks/state-machine/index.js +9 -2
- 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 +9 -9
- package/dist/blocks/teams/index.d.ts +4 -4
- package/dist/blocks/templates/index.d.ts +125 -12
- package/dist/blocks/templates/index.js +157 -7
- package/dist/blocks/time-tracking/index.d.ts +7 -7
- package/dist/blocks/timeline/index.d.ts +13 -11
- package/dist/blocks/timeline/index.js +3 -1
- 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/vercel-marketplace/index.js +3 -3
- package/dist/blocks/versions/index.d.ts +6 -6
- package/dist/blocks/waitlist/index.d.ts +5 -5
- package/dist/blocks/waitlist/index.js +1 -1
- package/dist/blocks/webhooks/index.d.ts +13 -13
- package/dist/blocks/webhooks/index.js +5 -5
- package/dist/blocks/workflow-editor/index.d.ts +10 -10
- package/dist/blocks/workflow-editor/index.js +65 -2
- package/dist/blocks/workflows/index.d.ts +7 -7
- package/dist/{bookings-Br0VXzaf.d.ts → bookings-Dj5cvXKv.d.ts} +4 -4
- package/dist/{bucket-DvG66r5G.d.ts → bucket-CrsJNHzi.d.ts} +1 -1
- package/dist/{carrier-D2b_028L.d.ts → carrier-B2eytEjR.d.ts} +10 -1
- package/dist/chat-sdk/index.d.ts +6 -6
- package/dist/claims/index.d.ts +6 -6
- package/dist/claims/index.js +2 -2
- package/dist/cli/add-8zKWiO0X.js +1 -0
- package/dist/cli/{add-DzgsOE8V.js → add-Buuy7BSU.js} +2 -2
- package/dist/cli/{add-CYreXA68.js → add-DqfJVb1F.js} +16 -14
- package/dist/cli/{agent-59XWXsRi.js → agent-Tqq3MAqx.js} +26 -1
- package/dist/cli/{app-table-files-BnISa3uY.js → app-table-files-Ku-4tPUu.js} +2 -2
- package/dist/cli/app-tables-Dg0sh4dH.js +42 -0
- package/dist/cli/{backfill-BLLTSDSa.js → backfill-Dspz6kVJ.js} +3 -3
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{blocks-CpRvI7x8.js → blocks-B8LAph-w.js} +1 -1
- package/dist/cli/{blocks-uzh1g_0v.js → blocks-CqVBlc4L.js} +2 -2
- package/dist/cli/{cache-BPWC7tGD.js → cache-BbuuCIRU.js} +1 -1
- package/dist/cli/{codemod-CbJVS_kG.js → codemod-DIAy8uXt.js} +139 -4
- package/dist/cli/{command-BpZ4AuhR.js → command-67WobzTC.js} +12 -0
- package/dist/cli/{completion-CwL7e93t.js → completion-C3nMZgUZ.js} +2 -2
- package/dist/cli/{completion-DHTT6rjI.js → completion-DSrus7H1.js} +1 -1
- package/dist/cli/{completion-B08Q0xB3.js → completion-Dm0S3ub0.js} +2 -2
- package/dist/cli/{config-D-Upz3jV.js → config-cbK-wiNs.js} +1 -1
- package/dist/cli/{content-mapper-Cjkm2Sg3.js → content-mapper-NXfJ5VkP.js} +2 -2
- package/dist/cli/{db-Diy1OebO.js → db-bK5eCLaE.js} +2 -2
- package/dist/cli/{doctor-D94FEJZs.js → doctor-CUOyLE0c.js} +386 -49
- package/dist/cli/env-AFfMXxWw.js +1 -0
- package/dist/cli/{env-BAJn6wCA.js → env-CCT-dMFm.js} +1 -1
- package/dist/cli/{gen-Cd0VNDjE.js → gen-s9canfdC.js} +14 -14
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +7 -7
- package/dist/cli/{init-Co1N9ZoA.js → init-Zs0Ca5on.js} +9 -9
- package/dist/cli/{keys-CxajkV_7.js → keys-Dj5sJNj7.js} +1 -1
- package/dist/cli/{live-NFNeZsP7.js → live-BaLsNove.js} +2 -2
- package/dist/cli/{mcp-WZ8t7NMz.js → mcp-ST7bVpJD.js} +4 -4
- package/dist/cli/{metadata-BzMkmrZR.js → metadata-aOvlCOOg.js} +3 -3
- package/dist/cli/{migrate-C9gyDAV7.js → migrate-ClBx3Ggx.js} +2 -2
- package/dist/cli/{migration-safety-BNi8PIiM.js → migration-safety-mjm1pghO.js} +1 -1
- package/dist/cli/{migrations-Ds0J_TmZ.js → migrations-tzItvwxT.js} +2 -2
- package/dist/cli/{module-migration-hFrlzQZ5.js → module-migration-D0Rjdvdx.js} +2 -2
- package/dist/cli/{moved-BAFPdJz_.js → moved-CY0yDtAr.js} +1 -1
- package/dist/cli/{parse-BueItuNJ.js → parse-yAC-NFMq.js} +1 -1
- package/dist/cli/{powersync-oFiwgsBi.js → powersync-DryX_DMG.js} +4 -4
- package/dist/cli/powersync-vvu2-72V.js +1 -0
- package/dist/cli/{print-BtreoJSm.js → print-fOUnKwA9.js} +2 -2
- package/dist/cli/{providers-Be2dgyuR.js → providers-BR1d_5jA.js} +1 -1
- package/dist/cli/{prune-workflows-BPxgRrqY.js → prune-workflows-CCjzNrxl.js} +3 -3
- package/dist/cli/{remove-B4ad996E.js → remove-B_0OIusa.js} +6 -6
- package/dist/cli/{render-C-Mfq-o3.js → render-BCJKDX3c.js} +18 -4
- package/dist/cli/{run-D2nuyyPo.js → run-4VUQTR-R.js} +12 -48
- package/dist/cli/{run-cLdnJHH0.js → run-BctvQX_g.js} +45 -43
- package/dist/cli/{run-dY9uOC3W.js → run-DX4X7xqV.js} +2 -2
- package/dist/cli/seed-CLlvrV8I.js +1 -0
- package/dist/cli/{seed-BpaqqyO8.js → seed-DSC6f0oh.js} +2 -2
- package/dist/cli/{shared-DCHxLAEL.js → shared-oY7PGamd.js} +1 -1
- package/dist/cli/{skills-jZThjL3B.js → skills-B5p6bDwe.js} +1 -1
- package/dist/cli/{snapshot-CloKPNxv.js → snapshot-CWtER9-4.js} +2 -2
- package/dist/cli/{source-Bwyp18Rj.js → source-D4uav_v9.js} +1 -1
- package/dist/cli/{spec-DsVq4_qV.js → spec-BPsyEzqH.js} +1 -1
- package/dist/cli/{spec-DAUF4ybu.js → spec-DTnBeaCD.js} +3 -3
- package/dist/cli/{sql-layout-CHpEL0oq.js → sql-layout-DbhEQqq0.js} +2 -2
- package/dist/cli/{stack-147NqctC.js → stack-CQXLe5j0.js} +3 -2
- package/dist/cli/{sync-DZu1r34s.js → sync-CazH5FX4.js} +4 -4
- package/dist/cli/{table-D9FbJS8h.js → table-BIQA9Hdt.js} +1 -1
- package/dist/cli/{upgrade-Bpvi70zm.js → upgrade-Cyx6ESpc.js} +5 -5
- package/dist/cli/{upgrade-A-BALvp3.js → upgrade-Dyb4-f0Q.js} +3 -3
- package/dist/cli/{version-B59mZJoy.js → version-D1ZKUFng.js} +1 -1
- package/dist/client/index.d.ts +6 -6
- package/dist/client/index.js +1 -1
- package/dist/client/native/index.d.ts +5 -5
- package/dist/client/native/index.js +2 -2
- package/dist/{client-Bky2z09B.js → client-DrejIxsu.js} +1 -1
- package/dist/{cloud-event-DXWmXrus.d.ts → cloud-event-BjgxkfJJ.d.ts} +1 -1
- package/dist/{codecs-B9v5Y5HH.js → codecs-D_pOvjvD.js} +1 -0
- package/dist/{codecs-B1VO2BGL.d.ts → codecs-DaP45ETv.d.ts} +1 -1
- package/dist/commerce/index.js +1 -1
- package/dist/{compiler-qlXlokKn.d.ts → compiler-BOW4yPcW.d.ts} +2 -2
- package/dist/{composite-D2JnIiHt.js → composite-BidYZWZY.js} +3 -3
- package/dist/{composite-CIxjVcL1.d.ts → composite-DPN4SFud.d.ts} +7 -7
- package/dist/config/index.d.ts +3 -3
- package/dist/config/index.js +4 -4
- package/dist/{config-DQP0IvDX.js → config-Dx3bEPlX.js} +1 -1
- package/dist/{config-BZWSFxkG.js → config-uSliwPS6.js} +3 -3
- package/dist/{connectors-Cf2LeAuZ.d.ts → connectors-DDsdz-cn.d.ts} +4 -4
- package/dist/{context-CderJRZf.d.ts → context-D6OZQdcT.d.ts} +3 -3
- package/dist/contract/index.d.ts +9 -9
- package/dist/{controller-DaWA9eWS.d.ts → controller-DhcSXkAC.d.ts} +1 -1
- package/dist/{conversion-C9rndpEI.d.ts → conversion-CLBBITW5.d.ts} +1 -1
- package/dist/create/index.d.ts +3 -3
- package/dist/create/index.js +3 -3
- package/dist/create/lite/index.d.ts +4 -4
- package/dist/create/lite/index.js +2 -2
- package/dist/credentials/index.d.ts +4 -4
- package/dist/credentials/index.js +1 -1
- package/dist/{cron-route-DSITg1yC.js → cron-route-uTsC2BD0.js} +1 -1
- package/dist/{data-engine-CMENsp3d.d.ts → data-engine-CX1oYDZl.d.ts} +1 -1
- package/dist/{define-ITQA71fw.d.ts → define-C_He1bQO.d.ts} +5 -5
- package/dist/{define-B6D55cO0.js → define-Duh2mMYk.js} +1 -1
- package/dist/{define-block-COmMkx2x.d.ts → define-block-CDw9YGVh.d.ts} +12 -12
- package/dist/{documents-DeZw83ue.d.ts → documents-Btk0MhC0.d.ts} +3 -3
- package/dist/edge/index.d.ts +9 -9
- package/dist/edge/index.js +7 -7
- package/dist/elysia/index.d.ts +1 -1
- package/dist/elysia/index.js +1 -1
- package/dist/{embeddings-rVR2AKVz.d.ts → embeddings-CI6P_mtD.d.ts} +1 -1
- package/dist/{ended-NC_ZesY4.d.ts → ended-BwpmNC5k.d.ts} +8 -3
- package/dist/{entitlements-BefkpQIz.d.ts → entitlements-Bi4y8w8e.d.ts} +2 -2
- package/dist/env/index.d.ts +1 -1
- package/dist/{messages-CRk1g6oe.js → errors-0Qid9fGz.js} +107 -3
- package/dist/eve/index.d.ts +9 -9
- package/dist/eve/index.js +3 -3
- package/dist/{eve-DIKjuPp5.d.ts → eve-DleYrhwj.d.ts} +2 -2
- package/dist/{event-calendar-DUtFyRrv.d.ts → event-calendar-DPMcqy7Q.d.ts} +1 -1
- package/dist/events/index.d.ts +3 -3
- package/dist/{events-DVt3Z9hw.d.ts → events-DddDlibJ.d.ts} +9 -1
- package/dist/{executor-CHnoKOxk.d.ts → executor-CxMHiDp_.d.ts} +4 -4
- package/dist/{executor-CFmee_nV.d.ts → executor-DoSNec_H.d.ts} +1 -1
- package/dist/{executor-BDMqPbVU.js → executor-RYiR4z47.js} +71 -37
- package/dist/{executor-DqNRrFxx.d.ts → executor-uNDJBzT8.d.ts} +16 -2
- package/dist/expo/index.d.ts +4 -4
- package/dist/expo/index.js +7 -7
- package/dist/{field-errors-D1meOs_H.d.ts → field-errors-CJ_i6HFg.d.ts} +10 -10
- package/dist/{fields-CAVk9dxX.d.ts → fields-CP46SPNE.d.ts} +1 -1
- package/dist/{filter-evaluate-Bz3Fzhz2.d.ts → filter-evaluate-Bkbb0nuQ.d.ts} +1 -1
- package/dist/{filter-query-DV-x8fio.d.ts → filter-query-Xj40B5KT.d.ts} +1 -1
- package/dist/{flags-6emyAXly.d.ts → flags-Cuew4tGx.d.ts} +2 -2
- package/dist/flags-sdk/index.d.ts +2 -2
- package/dist/{framework-BFlaPuvv.d.ts → framework-B6JAPr1i.d.ts} +8 -8
- package/dist/{framework-ChzJYkJW.js → framework-z3KTPRjk.js} +4 -4
- package/dist/{gateway-DaekJ_Me.d.ts → gateway-B9k89AC4.d.ts} +3 -3
- package/dist/h3/index.d.ts +1 -1
- package/dist/h3/index.js +1 -1
- package/dist/h3/v1/index.d.ts +1 -1
- package/dist/h3/v1/index.js +1 -1
- package/dist/hono/index.d.ts +9 -10
- package/dist/hono/index.js +8 -8
- package/dist/{inbox-DavCzW7b.d.ts → inbox-yGfUVQr2.d.ts} +61 -6
- package/dist/{index-Dvpu22CJ.d.ts → index-1uV69AZq.d.ts} +1 -1
- package/dist/{index-ChLuLxy-.d.ts → index-Bc5t2QRU.d.ts} +14 -14
- package/dist/{index-BbDiBiKt.d.ts → index-Bm1ftdBA.d.ts} +4 -4
- package/dist/{index-C13UgV67.d.ts → index-C71uHfVj.d.ts} +5 -5
- package/dist/{index-BQlLxOj5.d.ts → index-CRwpDGxd.d.ts} +1 -1
- package/dist/{index-DXUiRyEk.d.ts → index-Cbwvf4yE.d.ts} +5 -5
- package/dist/{index-D9aV0Fvx.d.ts → index-ChvuVimY.d.ts} +6 -6
- package/dist/{index-M1izbwbN.d.ts → index-CvLTqmdq.d.ts} +1 -1
- package/dist/{index-BIAtapnD.d.ts → index-DAS_5OfK.d.ts} +5 -5
- package/dist/{index-D18su_r5.d.ts → index-DjJUamhw.d.ts} +10 -5
- package/dist/{index-ZQZMQF4l.d.ts → index-DrDCN45q.d.ts} +6 -6
- package/dist/{index-8w4OB5En.d.ts → index-F6lsRlsr.d.ts} +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1 -1
- package/dist/{instances-D9YrkoAy.js → instances-DKULdpWB.js} +291 -17
- package/dist/jwks-cache-CBKtICNV.js +114 -0
- package/dist/{jws-B8p0ppgh.js → jws-De9qjIPV.js} +1 -1
- package/dist/{kit-9pZP5iLU.js → kit-D5rRAKWJ.js} +2 -2
- package/dist/{kit-OgFOW9rX.d.ts → kit-lHFpu2_1.d.ts} +4 -4
- package/dist/{knowledge-DdZzUTQ-.js → knowledge-CJnZOaix.js} +67 -7
- package/dist/{knowledge-BBC2sfAY.d.ts → knowledge-DWXAxvkN.d.ts} +82 -11
- package/dist/lint/index.d.ts +1 -1
- package/dist/list/index.d.ts +3 -3
- package/dist/{list-query-C7V8kUaD.d.ts → list-query-BkbLV-Yc.d.ts} +3 -3
- package/dist/mapper/bin.js +5 -5
- package/dist/mcp/index.d.ts +3 -3
- package/dist/mcp/index.js +5 -5
- package/dist/mcp/sdk/index.d.ts +6 -6
- package/dist/mcp/sdk/index.js +2 -2
- package/dist/{messaging-D5z2TR37.d.ts → messaging-Bfe4p9Pm.d.ts} +4 -4
- package/dist/{model-messages-BcrkjsPE.js → model-messages-CIHqP7Z3.js} +1 -1
- package/dist/nestjs/index.d.ts +2 -2
- package/dist/nestjs/index.js +1 -1
- package/dist/next/client/index.d.ts +1 -1
- package/dist/next/index.d.ts +331 -79
- package/dist/next/index.js +520 -105
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +1 -1
- package/dist/{operations-t_hlXkS4.d.ts → operations-BDjgCmT9.d.ts} +1 -1
- package/dist/{options-D4dxMGHF.js → options-Bgnm4pTD.js} +1 -0
- package/dist/{options-C9bp3SEA.js → options-CEwoGUk_.js} +3 -1
- package/dist/{options-yRwYr4up.js → options-CGQC7Wue.js} +4 -1
- package/dist/{options-C13-dVMH.js → options-D-jiqb0l.js} +2 -0
- package/dist/{options-CuPWezcV.js → options-RYbyaVhv.js} +3 -1
- package/dist/options-SOjQVgfS.js +37 -0
- package/dist/{options-JnPEVbBJ.js → options-ScQ6Hnxo.js} +2 -1
- package/dist/{options-CuaWhsQS.js → options-X61tvckX.js} +2 -1
- package/dist/orpc/index.d.ts +8 -8
- package/dist/orpc/index.js +6 -6
- package/dist/otel/index.d.ts +2 -2
- package/dist/otel/index.js +4 -4
- package/dist/{outbox-7zgh-7nw.d.ts → outbox-DikdzUKf.d.ts} +4 -4
- package/dist/{permissions-C8p6RlIZ.d.ts → permissions-BGx22GP3.d.ts} +1 -1
- package/dist/{pool-D-4HyhuW.d.ts → pool-BJAjQcrJ.d.ts} +3 -3
- package/dist/{ports-CmEXVqhg.js → ports-CkygVOeE.js} +2 -2
- package/dist/{ports-C-8uduFM.d.ts → ports-D63bA3p4.d.ts} +1 -1
- package/dist/postgres/index.d.ts +4 -4
- package/dist/{postgrest-DZtM2nIS.d.ts → postgrest-Bjain6nf.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-B_sSI9vg.js → preset-oc_liUHz.js} +2 -2
- package/dist/{project-DVlXQGEp.js → project-Cs0kz5OP.js} +5 -5
- package/dist/{provider-BI0KC4u5.d.ts → provider-CVlXXbda.d.ts} +1 -1
- package/dist/{push-token-D41lOoE8.d.ts → push-token-BsyX0KlT.d.ts} +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/{rate-limit-CRhlLFhP.js → rate-limit-BJ4EMdAy.js} +1 -1
- package/dist/react/index.d.ts +9 -9
- package/dist/react/index.js +3 -3
- package/dist/react/native/index.d.ts +1 -1
- package/dist/react/native/index.js +1 -1
- package/dist/react/server.d.ts +9 -9
- package/dist/react/server.js +2 -2
- package/dist/react/session.d.ts +2 -32
- package/dist/react/session.js +1 -37
- package/dist/{react-COIov1yC.js → react-DZ7AW2yf.js} +2 -2
- package/dist/react-router/index.d.ts +6 -6
- package/dist/react-router/index.js +5 -5
- package/dist/realtime/index.d.ts +6 -6
- package/dist/{record-form-DU2EoVsv.d.ts → record-form-C-gIxGXe.d.ts} +1 -1
- package/dist/{recordings-D69Va7gP.d.ts → recordings-Bw5LoocX.d.ts} +1 -1
- package/dist/records/index.d.ts +9 -9
- package/dist/{refusal-CGi-0Q18.d.ts → refusal-CjUUBfhY.d.ts} +3 -3
- package/dist/{refusal-5c6UMpUP.js → refusal-rnbr6RZD.js} +2 -2
- package/dist/{refresh-B8t_KE3s.js → request-kind-tNDM5Z_o.js} +15 -31
- package/dist/{resolve-FW8oeXvh.js → resolve-CZV31iCm.js} +402 -392
- package/dist/{resolve--LfVoOMg.d.ts → resolve-XlMQRUeG.d.ts} +97 -36
- package/dist/{resolved-names-h-3UbKcw.js → resolved-names-sd6RuTju.js} +1 -1
- package/dist/{resource-BbWk4hoP.js → resource-COaS9_i8.js} +1 -1
- package/dist/{resource-DWllVW8k.d.ts → resource-CaYpB07K.d.ts} +1 -1
- package/dist/{resource-execute-DUBYKTYU.d.ts → resource-execute-B7-QaS6R.d.ts} +2 -2
- package/dist/{resource-types-RgaljPs0.d.ts → resource-types-CF3Uc6OW.d.ts} +4 -4
- package/dist/{resources-DYSx9NYM.js → resources-DhiK3yLO.js} +1 -1
- package/dist/{resources-Bki1J4jy.d.ts → resources-DnHSmJIM.d.ts} +2 -2
- package/dist/{respond-DLH4tD2d.js → respond-8A3EOo61.js} +1 -1
- package/dist/{respond-BYOV7KZp.d.ts → respond-D7kUatjc.d.ts} +15 -19
- package/dist/{sales-lines-DuNVoKHA.d.ts → sales-lines-wQHuL-pa.d.ts} +1 -1
- package/dist/{sandboxes-B2hBoBvJ.d.ts → sandboxes-BF9RxxCU.d.ts} +1 -1
- package/dist/{scores-FAORS4qU.d.ts → scores-Ce8MxQX9.d.ts} +5 -5
- package/dist/server/index.d.ts +58 -36
- package/dist/server/index.js +35 -41
- package/dist/{server-types-C2hlvhP4.d.ts → server-types-DpI82uNq.d.ts} +19 -17
- package/dist/session-BjPYE4dT.js +180 -0
- package/dist/session-JV1z0kxa.d.ts +77 -0
- package/dist/{session-B4VasaAA.d.ts → session-s-mUZ8RQ.d.ts} +11 -12
- package/dist/{session-status-D8CBxCqv.d.ts → session-status-CJjTuFtA.d.ts} +4 -3
- package/dist/{sign-in-CX1a5i2P.d.ts → sign-in-D5Bg7R47.d.ts} +16 -4
- package/dist/{sign-in-CxdoTEp5.js → sign-in-djgvab1X.js} +3 -3
- package/dist/{sign-in-BMm1xhKq.js → sign-in-k2lXELeC.js} +2 -2
- package/dist/{signatures-CBn7w4VR.js → signatures-DK01D2S7.js} +1 -1
- package/dist/{signers-6ih6i9aq.d.ts → signers-Dw9DBZjJ.d.ts} +4 -4
- package/dist/{signing-keys-De09WNJ3.d.ts → signing-keys-FglIQ6iL.d.ts} +2 -2
- package/dist/{signing-keys-BC5_hJN5.js → signing-keys-sGaXklwD.js} +1 -1
- package/dist/{snapshot-CVMSyTHH.js → snapshot-BOA7lkRg.js} +9 -17
- package/dist/solid/index.d.ts +10 -10
- package/dist/solid/index.js +1 -1
- package/dist/solid-start/index.d.ts +6 -6
- package/dist/solid-start/index.js +5 -5
- package/dist/spec/index.d.ts +2 -2
- package/dist/sql/index.d.ts +5 -5
- package/dist/sql/index.js +3 -3
- package/dist/{sql-C9nO-Mat.js → sql-CWYbu_6y.js} +11090 -2788
- package/dist/sqlite/index.d.ts +3 -3
- package/dist/{sso-CuzAjsc8.d.ts → sso-B7w7h8RJ.d.ts} +3 -3
- package/dist/ssr/index.d.ts +5 -6
- package/dist/ssr/index.js +3 -3
- package/dist/{statuses-BTrQ5H4S.js → statuses-Qqpzda35.js} +12 -1
- package/dist/stock-detail-BMqvwq1q.js +12 -0
- package/dist/stock-detail-BRIt7CjU.d.ts +19 -0
- 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-BlD8tALG.d.ts → subject-readers-D1Km_Q42.d.ts} +2 -2
- package/dist/{subjects-Bv2dPflD.d.ts → subjects-CVjAE7nz.d.ts} +3 -3
- package/dist/{support-DxYI6sDM.d.ts → support-Dj5V2WTs.d.ts} +4 -4
- package/dist/{support-view-DSmCett7.d.ts → support-view-DKZkZeM5.d.ts} +1 -1
- package/dist/svelte/index.d.ts +9 -9
- package/dist/svelte/index.js +1 -1
- package/dist/sveltekit/index.d.ts +7 -7
- package/dist/sveltekit/index.js +5 -5
- package/dist/{tags--k2fbPfO.d.ts → tags-BihwKkTT.d.ts} +1 -1
- package/dist/tanstack-db/index.d.ts +3 -3
- package/dist/tanstack-start/index.d.ts +6 -6
- package/dist/tanstack-start/index.js +5 -5
- package/dist/{tenant-gezshhcs.d.ts → tenant-DqnE50Ju.d.ts} +1 -1
- package/dist/testing/index.d.ts +28 -29
- package/dist/testing/index.js +6 -6
- package/dist/{timeline-Bq658xsi.d.ts → timeline-c6I3uxya.d.ts} +5 -5
- package/dist/{topic-BVq5RdsI.d.ts → topic-Dp7VGPd-.d.ts} +5 -5
- package/dist/{types-C8UyJOPJ.d.ts → types-6PMaLIyw.d.ts} +3 -3
- package/dist/{types-BBqP9H6w.d.ts → types-BXLiM6VM.d.ts} +4 -4
- package/dist/{types-Dh2OGEW5.d.ts → types-BdhE7I8Z.d.ts} +5 -5
- package/dist/{types-BkYEUWdz.d.ts → types-BzIYSSWK.d.ts} +16 -1
- package/dist/{types-DCoqai8o.d.ts → types-C7K8mu9B.d.ts} +45 -15
- package/dist/{types-TH3zlMiM.d.ts → types-D5uf0l4_.d.ts} +1 -1
- package/dist/{types-hTj5OuFo.d.ts → types-DLXTmZtm.d.ts} +2 -2
- package/dist/{types-d0JBRTAg.d.ts → types-DtiDatvu.d.ts} +128 -13
- package/dist/{undo-22ofP6Zp.d.ts → undo-CdKp5_2X.d.ts} +2 -2
- package/dist/{usage-CNCT6_3D.d.ts → usage-DZ8j5Tm_.d.ts} +4 -4
- package/dist/{vault-yGQD5Rdl.d.ts → vault-CbhvnoVC.d.ts} +2 -2
- package/dist/vercel-connect/index.d.ts +1 -1
- package/dist/vercel-sandbox/index.d.ts +2 -2
- package/dist/{verify-DY_j4GPZ.js → verify-96j8d5ps.js} +1 -1
- package/dist/{verify-BQu3eBNW.d.ts → verify-Cpc1upDA.d.ts} +2 -2
- package/dist/{view-BfEqjZJ_.js → view-Ch0Qtr36.js} +1 -1
- package/dist/{view-Cy2XxYp1.d.ts → view-eHgOOyRS.d.ts} +1 -1
- package/dist/vue/index.d.ts +10 -10
- package/dist/vue/index.js +1 -1
- package/dist/{watch-topic-BOclyLFd.d.ts → watch-topic-CtJAkWT4.d.ts} +1 -1
- package/dist/workflow-sdk/builder/index.d.ts +29 -5
- package/dist/workflow-sdk/builder/index.js +39 -12
- package/dist/workflow-sdk/index.d.ts +1 -1
- package/dist/workflow-sdk/index.js +2 -2
- package/dist/workflow-sdk/world/index.d.ts +1 -1
- package/dist/workflow-sdk/world/index.js +1 -1
- package/dist/{workflow-sdk-yIkECybp.d.ts → workflow-sdk-CUt0E4v6.d.ts} +3 -3
- package/dist/{workflow-sdk-BL3wzkdp.js → workflow-sdk-pB1jCLIL.js} +26 -1
- package/dist/{workflows-BljkWRxE.d.ts → workflows-BI4yKqFh.d.ts} +3 -3
- package/dist/yjs/index.d.ts +2 -2
- package/dist/yjs/index.js +1 -1
- package/package.json +1 -1
- package/schemas/config-v1.json +131 -0
- package/schemas/doctor-report-v1.json +4 -0
- package/skills/better-supabase-auth/SKILL.md +45 -11
- package/dist/cli/add-BaB3y1lv.js +0 -1
- package/dist/cli/env-UN6PJFX6.js +0 -1
- package/dist/cli/powersync-J2Kms2NT.js +0 -1
- package/dist/cli/seed-ByLneY1H.js +0 -1
- package/dist/errors-D3-4c-XF.js +0 -102
- package/dist/http-BDC1IvBX.js +0 -27
- package/dist/jwks-cache-IZaiICAV.js +0 -48
- package/dist/options-Itq7QYoW.js +0 -20
- package/dist/refresh-BtbC2rZe.d.ts +0 -52
- package/dist/snapshot-BGsJw9xn.d.ts +0 -83
|
@@ -10,15 +10,15 @@ import { loadEnv } from "./env/index.js";
|
|
|
10
10
|
import { i as userContext, t as actClaim } from "./impersonation-D-quM36V.js";
|
|
11
11
|
import { t as fromPgError } from "./pg-error-D92B6jlF.js";
|
|
12
12
|
import { a as narrowCap, i as delegatedClaims, r as contextClaims } from "./delegation-C2rLpkHO.js";
|
|
13
|
-
import { o as sessionMemo, s as snapshotOf, t as authOfSnapshot } from "./snapshot-
|
|
14
|
-
import { c as
|
|
13
|
+
import { o as sessionMemo, s as snapshotOf, t as authOfSnapshot } from "./snapshot-BOA7lkRg.js";
|
|
14
|
+
import { c as replicaState, l as routedExecutor, o as pinnedUntil, r as refreshFor, s as primaryCookieWrite, t as isDocumentLoad, u as withPrimaryPin } from "./request-kind-tNDM5Z_o.js";
|
|
15
15
|
import { t as authContext } from "./context-DSevnLrT.js";
|
|
16
|
-
import { c as
|
|
16
|
+
import { c as parseCookies, d as sessionCookieName, n as prefetchJwks, o as clearCookieSession, r as resolveAuth, u as serializeCookie } from "./resolve-CZV31iCm.js";
|
|
17
17
|
import { s as requestMemo, t as bindAuthorizer } from "./authorizer-BtIPDO-c.js";
|
|
18
18
|
import { t as credentialProviderOf } from "./provider-B6qpleR9.js";
|
|
19
|
-
import { i as guard, n as defaultExpose, o as respond, r as defaultPrefetchJwks, t as assertCookieRefresh } from "./respond-
|
|
20
|
-
import { createClient } from "@supabase/supabase-js";
|
|
19
|
+
import { i as guard, n as defaultExpose, o as respond, r as defaultPrefetchJwks, t as assertCookieRefresh } from "./respond-8A3EOo61.js";
|
|
21
20
|
import { defineMiddleware, getEnv, pipeline, seedContext } from "@supabase/middleware";
|
|
21
|
+
import { createAdminClient, createContextClient } from "@supabase/server/core";
|
|
22
22
|
import { PostgrestClient } from "@supabase/postgrest-js";
|
|
23
23
|
// src/server/delete-account.ts
|
|
24
24
|
const REMOVE_BATCH = 1e3;
|
|
@@ -288,18 +288,41 @@ function hooksApiProblem(hooks) {
|
|
|
288
288
|
return `authorization hooks "${typeof hooks.name === "string" ? hooks.name : "provider"}" target API ${String(hooks.apiVersion)}; this better-supabase supports 1.`;
|
|
289
289
|
}
|
|
290
290
|
// src/server/clients.ts
|
|
291
|
-
const STATELESS = {
|
|
292
|
-
persistSession: false,
|
|
293
|
-
autoRefreshToken: false,
|
|
294
|
-
detectSessionInUrl: false
|
|
295
|
-
};
|
|
296
291
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
292
|
+
* Clients never verify a token; a key set here keeps `@supabase/server` from
|
|
293
|
+
* reading the JWKS variables on every client it builds.
|
|
294
|
+
*/
|
|
295
|
+
const NO_KEYS = Object.freeze({ keys: [] });
|
|
296
|
+
/**
|
|
297
|
+
* A client built on its first property read, `in` check or key enumeration,
|
|
298
|
+
* like the one `withSupabaseAdminClient` puts on its context. Methods are bound
|
|
299
|
+
* to the built client, so its private fields stay reachable.
|
|
300
|
+
*/
|
|
301
|
+
function lazyClient(build) {
|
|
302
|
+
let client;
|
|
303
|
+
const instance = () => client ??= build();
|
|
304
|
+
return new Proxy({}, {
|
|
305
|
+
get: (_target, property) => {
|
|
306
|
+
const target = instance();
|
|
307
|
+
const value = target[property];
|
|
308
|
+
if (typeof value !== "function") return value;
|
|
309
|
+
return value.bind(target);
|
|
310
|
+
},
|
|
311
|
+
set: (_target, property, value) => Reflect.set(instance(), property, value),
|
|
312
|
+
has: (_target, property) => Reflect.has(instance(), property),
|
|
313
|
+
getPrototypeOf: () => Reflect.getPrototypeOf(instance()),
|
|
314
|
+
ownKeys: () => Reflect.ownKeys(instance()),
|
|
315
|
+
getOwnPropertyDescriptor: (_target, property) => Reflect.getOwnPropertyDescriptor(instance(), property)
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* The Supabase and PostgREST clients of one server: a shared admin client and
|
|
320
|
+
* anon client for the primary, per-request context clients for users.
|
|
321
|
+
* supabase-js clients come from `createContextClient` and `createAdminClient`
|
|
322
|
+
* (`@supabase/server/core`); queries skip them for a bare `PostgrestClient`.
|
|
299
323
|
*/
|
|
300
324
|
function createClients(input) {
|
|
301
|
-
const { options, env, definitionExecutor, lite
|
|
302
|
-
let adminClient;
|
|
325
|
+
const { options, env, definitionExecutor, lite } = input;
|
|
303
326
|
let anonClient;
|
|
304
327
|
const secretKey = () => {
|
|
305
328
|
const key = env().secretKey;
|
|
@@ -314,10 +337,6 @@ function createClients(input) {
|
|
|
314
337
|
...urlLengthLimit === void 0 ? {} : { urlLengthLimit }
|
|
315
338
|
};
|
|
316
339
|
const dbOptions = Object.keys(db).length > 0 ? { db } : {};
|
|
317
|
-
const sharedGlobal = {
|
|
318
|
-
...customFetch ? { global: customFetch } : {},
|
|
319
|
-
...dbOptions
|
|
320
|
-
};
|
|
321
340
|
/**
|
|
322
341
|
* Postgrest-js options a bare `PostgrestClient` takes; `timeout` is the
|
|
323
342
|
* executor's.
|
|
@@ -336,53 +355,61 @@ function createClients(input) {
|
|
|
336
355
|
};
|
|
337
356
|
/** Set when `db` options or the backend need an executor built with them. */
|
|
338
357
|
const tunedExecutor = options.db !== void 0 || rpcUnavailable !== void 0;
|
|
358
|
+
/** Supabase-js options shared by every client, plus request headers. */
|
|
359
|
+
const supabaseOptions = (headers, token) => ({
|
|
360
|
+
...customFetch || Object.keys(headers).length > 0 ? { global: {
|
|
361
|
+
headers: { ...headers },
|
|
362
|
+
...customFetch
|
|
363
|
+
} } : {},
|
|
364
|
+
...token === void 0 ? {} : { realtime: { accessToken: () => Promise.resolve(token) } },
|
|
365
|
+
...dbOptions
|
|
366
|
+
});
|
|
367
|
+
const contextClientAt = (url, headers, token) => createContextClient({
|
|
368
|
+
...token === void 0 ? {} : { auth: { token } },
|
|
369
|
+
env: {
|
|
370
|
+
url,
|
|
371
|
+
publishableKeys: { default: env().publishableKey },
|
|
372
|
+
jwks: NO_KEYS
|
|
373
|
+
},
|
|
374
|
+
supabaseOptions: supabaseOptions(headers, token)
|
|
375
|
+
});
|
|
376
|
+
const adminClientAt = (url, headers) => createAdminClient({
|
|
377
|
+
env: {
|
|
378
|
+
url,
|
|
379
|
+
secretKeys: { default: secretKey() },
|
|
380
|
+
jwks: NO_KEYS
|
|
381
|
+
},
|
|
382
|
+
supabaseOptions: supabaseOptions(headers)
|
|
383
|
+
});
|
|
384
|
+
const sharedAdmin = lazyClient(() => adminClientAt(env().url, {}));
|
|
385
|
+
/**
|
|
386
|
+
* The shared admin client, built on first use. The key is checked now, so a
|
|
387
|
+
* missing `SUPABASE_SECRET_KEY` throws where the client is asked for.
|
|
388
|
+
*/
|
|
339
389
|
const serviceClient = () => {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
...sharedGlobal
|
|
343
|
-
});
|
|
344
|
-
return adminClient;
|
|
390
|
+
secretKey();
|
|
391
|
+
return sharedAdmin;
|
|
345
392
|
};
|
|
346
393
|
const readUrl = () => options.readUrl === false ? void 0 : options.readUrl?.replace(/\/+$/, "") ?? env().readUrl;
|
|
347
394
|
const apiKeyClient = () => {
|
|
348
395
|
throw new TypeError("ctx.supabase and ctx.db.$client are not available for an API key: ctx.db and ctx.sql run over direct Postgres with the key's claims");
|
|
349
396
|
};
|
|
350
|
-
/** Clients for the primary share the
|
|
397
|
+
/** Clients for the primary share the admin and anon clients; others don't. */
|
|
351
398
|
const supabaseAt = (url, auth, headers = {}) => {
|
|
352
|
-
const
|
|
353
|
-
const global = custom ? {
|
|
354
|
-
global: {
|
|
355
|
-
headers,
|
|
356
|
-
...customFetch
|
|
357
|
-
},
|
|
358
|
-
...dbOptions
|
|
359
|
-
} : sharedGlobal;
|
|
360
|
-
const shared = !custom && url === env().url;
|
|
399
|
+
const shared = Object.keys(headers).length === 0 && url === env().url;
|
|
361
400
|
switch (auth.kind) {
|
|
362
|
-
case "user": return
|
|
363
|
-
|
|
364
|
-
...global
|
|
365
|
-
});
|
|
366
|
-
case "secret": return shared ? serviceClient() : createClient(url, secretKey(), {
|
|
367
|
-
auth: STATELESS,
|
|
368
|
-
...global
|
|
369
|
-
});
|
|
401
|
+
case "user": return contextClientAt(url, headers, auth.token);
|
|
402
|
+
case "secret": return shared ? serviceClient() : adminClientAt(url, headers);
|
|
370
403
|
case "none":
|
|
371
404
|
case "invalid":
|
|
372
|
-
if (!shared) return
|
|
373
|
-
|
|
374
|
-
...global
|
|
375
|
-
});
|
|
376
|
-
anonClient ??= createClient(url, env().publishableKey, {
|
|
377
|
-
auth: STATELESS,
|
|
378
|
-
...sharedGlobal
|
|
379
|
-
});
|
|
405
|
+
if (!shared) return contextClientAt(url, headers);
|
|
406
|
+
anonClient ??= contextClientAt(url, headers);
|
|
380
407
|
return anonClient;
|
|
381
408
|
case "apiKey": return apiKeyClient();
|
|
382
409
|
default: return auth;
|
|
383
410
|
}
|
|
384
411
|
};
|
|
385
|
-
const
|
|
412
|
+
const contextClient = (auth, headers = {}) => supabaseAt(env().url, auth, headers);
|
|
386
413
|
const restUrls = /* @__PURE__ */ new Map();
|
|
387
414
|
const restUrl = (url) => {
|
|
388
415
|
let rest = restUrls.get(url);
|
|
@@ -431,7 +458,7 @@ function createClients(input) {
|
|
|
431
458
|
serviceClient,
|
|
432
459
|
readUrl,
|
|
433
460
|
apiKeyClient,
|
|
434
|
-
|
|
461
|
+
contextClient,
|
|
435
462
|
restAt
|
|
436
463
|
};
|
|
437
464
|
}
|
|
@@ -501,7 +528,7 @@ function withServerContext(core) {
|
|
|
501
528
|
// src/server/entries/session.ts
|
|
502
529
|
function checkFor(policy, request) {
|
|
503
530
|
if (policy === void 0 || typeof policy === "boolean") return policy ?? false;
|
|
504
|
-
return policy === "
|
|
531
|
+
return policy === "document" ? isDocumentLoad(request) : policy(request);
|
|
505
532
|
}
|
|
506
533
|
/**
|
|
507
534
|
* Runs `hook` for a resolution with an outage and returns its response when the
|
|
@@ -522,12 +549,17 @@ async function outageResponse(hook, resolution, request, logger) {
|
|
|
522
549
|
* Appends `Max-Age=0` writes for the session cookie at the old scopes, and the
|
|
523
550
|
* no-store headers.
|
|
524
551
|
*/
|
|
525
|
-
function clearOldScopes(response, request, name, scopes) {
|
|
526
|
-
const writes =
|
|
552
|
+
async function clearOldScopes(response, request, name, scopes) {
|
|
553
|
+
const { writes, headers: noStore } = await clearCookieSession({
|
|
554
|
+
cookieName: name,
|
|
555
|
+
cookies: parseCookies(request.headers.get("cookie")),
|
|
556
|
+
scopes,
|
|
557
|
+
current: false
|
|
558
|
+
});
|
|
527
559
|
if (writes.length === 0) return response;
|
|
528
560
|
const headers = new Headers(response.headers);
|
|
529
561
|
for (const write of writes) headers.append("set-cookie", serializeCookie(write));
|
|
530
|
-
for (const [key, value] of Object.entries(
|
|
562
|
+
for (const [key, value] of Object.entries(noStore)) headers.set(key, value);
|
|
531
563
|
return new Response(response.body, {
|
|
532
564
|
status: response.status,
|
|
533
565
|
statusText: response.statusText,
|
|
@@ -559,7 +591,7 @@ function withSession(core, config = {}) {
|
|
|
559
591
|
try {
|
|
560
592
|
const response = yield { session };
|
|
561
593
|
const applied = session.apply(response);
|
|
562
|
-
return config.cookieScopes?.length ? clearOldScopes(applied, request, core.sessionCookie(), config.cookieScopes) : applied;
|
|
594
|
+
return config.cookieScopes?.length ? await clearOldScopes(applied, request, core.sessionCookie(), config.cookieScopes) : applied;
|
|
563
595
|
} finally {
|
|
564
596
|
if (config.waitUntil && core.events.pending) config.waitUntil(core.events.settled());
|
|
565
597
|
}
|
|
@@ -726,34 +758,37 @@ function authFor(session) {
|
|
|
726
758
|
};
|
|
727
759
|
return source;
|
|
728
760
|
}
|
|
729
|
-
/** The members of `BetterServer` that the verified-
|
|
761
|
+
/** The members of `BetterServer` that the verified-token memo backs. */
|
|
730
762
|
function serverSessions(options) {
|
|
731
|
-
const
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
763
|
+
const { memo } = options;
|
|
764
|
+
/** A memo hit returns the stored user, so its snapshot is built once. */
|
|
765
|
+
const snapshots = /* @__PURE__ */ new WeakMap();
|
|
766
|
+
/** Loaders of one request share its resolution until an eviction. */
|
|
767
|
+
let byRequest = /* @__PURE__ */ new WeakMap();
|
|
768
|
+
const build = async (request) => {
|
|
769
|
+
const { auth } = await options.resolve(request, { refresh: false });
|
|
770
|
+
let found = snapshots.get(auth);
|
|
771
|
+
if (found === void 0) {
|
|
772
|
+
found = snapshotOf(auth);
|
|
773
|
+
snapshots.set(auth, found);
|
|
774
|
+
}
|
|
775
|
+
return found;
|
|
739
776
|
};
|
|
740
|
-
const snapshot =
|
|
741
|
-
|
|
742
|
-
if (!
|
|
743
|
-
|
|
744
|
-
|
|
777
|
+
const snapshot = (request) => {
|
|
778
|
+
let found = byRequest.get(request);
|
|
779
|
+
if (!found) {
|
|
780
|
+
found = build(request);
|
|
781
|
+
byRequest.set(request, found);
|
|
745
782
|
}
|
|
746
|
-
return
|
|
747
|
-
const resolution = await options.resolve(request, { refresh: false });
|
|
748
|
-
return verified(resolution.auth, token);
|
|
749
|
-
}))?.snapshot ?? null;
|
|
783
|
+
return found;
|
|
750
784
|
};
|
|
751
785
|
const contextFromSession = (session, contextOptions) => {
|
|
752
786
|
const auth = session ? authFor(session) : ANON;
|
|
753
787
|
return Promise.resolve(options.contextFor(auth, contextOptions ?? {}));
|
|
754
788
|
};
|
|
755
789
|
const evict = (userId) => {
|
|
756
|
-
|
|
790
|
+
byRequest = /* @__PURE__ */ new WeakMap();
|
|
791
|
+
memo?.evict((user) => user.user.id === userId);
|
|
757
792
|
};
|
|
758
793
|
return {
|
|
759
794
|
snapshot,
|
|
@@ -765,11 +800,13 @@ function serverSessions(options) {
|
|
|
765
800
|
size: 0
|
|
766
801
|
},
|
|
767
802
|
seed: async (auth) => {
|
|
768
|
-
|
|
769
|
-
if (found && memo) await memo.seed(found.auth.token, found);
|
|
803
|
+
if (auth.kind === "user" && auth.token !== "" && memo) await memo.seed(auth.token, auth);
|
|
770
804
|
},
|
|
771
805
|
evict,
|
|
772
|
-
clear: () =>
|
|
806
|
+
clear: () => {
|
|
807
|
+
byRequest = /* @__PURE__ */ new WeakMap();
|
|
808
|
+
memo?.clear();
|
|
809
|
+
}
|
|
773
810
|
},
|
|
774
811
|
evictSession: async (userId) => {
|
|
775
812
|
evict(userId);
|
|
@@ -1629,12 +1666,11 @@ function createServer(betterSupabase, options = {}) {
|
|
|
1629
1666
|
env: env()
|
|
1630
1667
|
});
|
|
1631
1668
|
} catch {}
|
|
1632
|
-
const { executorOptions, tunedExecutor, serviceClient, readUrl, apiKeyClient,
|
|
1669
|
+
const { executorOptions, tunedExecutor, serviceClient, readUrl, apiKeyClient, contextClient, restAt } = createClients({
|
|
1633
1670
|
options,
|
|
1634
1671
|
env,
|
|
1635
1672
|
definitionExecutor: betterSupabase.executorOptions(),
|
|
1636
|
-
lite
|
|
1637
|
-
createClient
|
|
1673
|
+
lite
|
|
1638
1674
|
});
|
|
1639
1675
|
/** `$client` stays the full Supabase client, built when first read. */
|
|
1640
1676
|
const withLazyClient = (db, client) => Object.defineProperty(db, "$client", {
|
|
@@ -1645,7 +1681,7 @@ function createServer(betterSupabase, options = {}) {
|
|
|
1645
1681
|
const dbFor = (auth, context = {}) => {
|
|
1646
1682
|
let supabase;
|
|
1647
1683
|
const rest = restAt(env().url, auth);
|
|
1648
|
-
const storage = { from: (bucket) => (supabase ??=
|
|
1684
|
+
const storage = { from: (bucket) => (supabase ??= contextClient(auth)).storage.from(bucket) };
|
|
1649
1685
|
const db = betterSupabase.connect(rest, {
|
|
1650
1686
|
...authContext(auth),
|
|
1651
1687
|
...context
|
|
@@ -1656,7 +1692,7 @@ function createServer(betterSupabase, options = {}) {
|
|
|
1656
1692
|
executor: postgrestExecutor(rest, executorOptions),
|
|
1657
1693
|
storage
|
|
1658
1694
|
} : { storage });
|
|
1659
|
-
return withLazyClient(db, () => supabase ??=
|
|
1695
|
+
return withLazyClient(db, () => supabase ??= contextClient(auth));
|
|
1660
1696
|
};
|
|
1661
1697
|
const sqlFor = (claims, context, stats, session, storage) => {
|
|
1662
1698
|
if (!options.postgres) throw new TypeError("Direct Postgres access needs createServer(betterSupabase, { postgres: createPostgres() })");
|
|
@@ -1867,7 +1903,7 @@ function createServer(betterSupabase, options = {}) {
|
|
|
1867
1903
|
let db;
|
|
1868
1904
|
let sql;
|
|
1869
1905
|
const sqlClaims = auth.kind === "user" ? auth.claims : auth.kind === "none" ? { role: "anon" } : void 0;
|
|
1870
|
-
const client = () => supabase ??=
|
|
1906
|
+
const client = () => supabase ??= contextClient(auth, sharesClient ? clientHeaders : headers);
|
|
1871
1907
|
let replica;
|
|
1872
1908
|
const replicaUrl = () => {
|
|
1873
1909
|
const url = readUrl();
|
|
@@ -1913,11 +1949,14 @@ function createServer(betterSupabase, options = {}) {
|
|
|
1913
1949
|
};
|
|
1914
1950
|
};
|
|
1915
1951
|
const fromResolution = (resolution, request, contextOptions, tenant) => contextFor(resolution, options.headers?.(request) ?? {}, contextOptions.stats, contextOptions.pinnedUntil ?? (readUrl() ? pinnedUntil(resolution.requestCookies) : 0), tenant, contextOptions.support, scopeIds(request, contextOptions));
|
|
1952
|
+
/** The one verified-token memo: the proxy, contexts and `getClaims` share it. */
|
|
1953
|
+
const verifiedTokens = options.sessions === false ? void 0 : sessionMemo((user) => user.expiresAt, options.sessions);
|
|
1916
1954
|
const resolve = async (request, resolveOptions = {}) => {
|
|
1917
1955
|
const claims = options.auth?.claims ?? betterSupabase.claimsSchema;
|
|
1918
1956
|
const userMetadata = betterSupabase.userMetadataSchema;
|
|
1919
1957
|
const resolution = await resolveAuth(request, {
|
|
1920
1958
|
logger: betterSupabase.events.logger,
|
|
1959
|
+
...verifiedTokens ? { memo: verifiedTokens } : {},
|
|
1921
1960
|
...lite ? lite.auth() : options.auth,
|
|
1922
1961
|
...claims ? { claims } : {},
|
|
1923
1962
|
...userMetadata ? { userMetadata } : {},
|
|
@@ -1956,13 +1995,9 @@ function createServer(betterSupabase, options = {}) {
|
|
|
1956
1995
|
*/
|
|
1957
1996
|
const contextMemo = /* @__PURE__ */ new WeakMap();
|
|
1958
1997
|
const authorizer = bindAuthorizer(options.authorizer, options.versions ? { versions: options.versions } : {});
|
|
1959
|
-
const custom = lite !== void 0 || (options.auth?.resolvers?.length ?? 0) > 0;
|
|
1960
1998
|
const { snapshot, contextFromSession, sessions, evictSession } = serverSessions({
|
|
1961
1999
|
resolve,
|
|
1962
|
-
|
|
1963
|
-
cookies: options.auth?.cookies !== false,
|
|
1964
|
-
custom,
|
|
1965
|
-
memo: options.sessions,
|
|
2000
|
+
memo: verifiedTokens,
|
|
1966
2001
|
versions: options.versions,
|
|
1967
2002
|
contextFor: (auth, contextOptions) => contextFor({
|
|
1968
2003
|
auth,
|
|
@@ -1985,7 +2020,7 @@ function createServer(betterSupabase, options = {}) {
|
|
|
1985
2020
|
sessions,
|
|
1986
2021
|
evictSession,
|
|
1987
2022
|
resolve,
|
|
1988
|
-
|
|
2023
|
+
contextClient,
|
|
1989
2024
|
dbFor: (auth, context, dbOptions) => dbOptions?.support ? supportContextFor({
|
|
1990
2025
|
auth,
|
|
1991
2026
|
cookies: [],
|
|
@@ -2029,7 +2064,7 @@ function createServer(betterSupabase, options = {}) {
|
|
|
2029
2064
|
},
|
|
2030
2065
|
contextFromResolution: (resolution, request, contextOptions = {}) => fromResolution(resolution, request, contextOptions, contextOptions.tenant ?? syncTenant(request, resolution.auth)),
|
|
2031
2066
|
admin: (context = {}, adminOptions = {}) => {
|
|
2032
|
-
const client = adminOptions.as === void 0 ? serviceClient() :
|
|
2067
|
+
const client = adminOptions.as === void 0 ? serviceClient() : contextClient({
|
|
2033
2068
|
kind: "secret",
|
|
2034
2069
|
keyName: "secret"
|
|
2035
2070
|
}, { [ACTOR_HEADER]: adminOptions.as });
|
|
@@ -3,10 +3,10 @@ import { T as ErrorMapper, t as AsyncResult } from "./result-DTOQRyGY.js";
|
|
|
3
3
|
import { t as StandardSchemaV1 } from "./standard-DRX6Ch1j.js";
|
|
4
4
|
import { r as FieldsOf } from "./block-fields-Puv5m5D3.js";
|
|
5
5
|
import { n as Logger } from "./logger-0LfhvwE4.js";
|
|
6
|
-
import { r as BlockTemporalOptions } from "./block-helpers-
|
|
7
|
-
import { t as BlockTransport } from "./block-transport-
|
|
8
|
-
import { n as BlockHooks } from "./block-hooks-
|
|
9
|
-
import { u as KnowledgeScope } from "./knowledge-
|
|
6
|
+
import { r as BlockTemporalOptions } from "./block-helpers-BNtM1tqy.js";
|
|
7
|
+
import { t as BlockTransport } from "./block-transport-CDmOUuLZ.js";
|
|
8
|
+
import { n as BlockHooks } from "./block-hooks-CtMsgLQr.js";
|
|
9
|
+
import { u as KnowledgeScope } from "./knowledge-DWXAxvkN.js";
|
|
10
10
|
type AgentVisibility = "private" | "organization" | "public";
|
|
11
11
|
/** A knowledge scope an agent searches: its own (`agent`) or another one. */
|
|
12
12
|
interface AgentKnowledgeScope {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { T as ErrorMapper, t as AsyncResult } from "./result-DTOQRyGY.js";
|
|
3
3
|
import { n as Logger } from "./logger-0LfhvwE4.js";
|
|
4
|
-
import { r as BlockTemporalOptions } from "./block-helpers-
|
|
5
|
-
import { t as BlockTransport } from "./block-transport-
|
|
6
|
-
import { n as BlockHooks } from "./block-hooks-
|
|
7
|
-
import { _ as JobHandler } from "./types-
|
|
4
|
+
import { r as BlockTemporalOptions } from "./block-helpers-BNtM1tqy.js";
|
|
5
|
+
import { t as BlockTransport } from "./block-transport-CDmOUuLZ.js";
|
|
6
|
+
import { n as BlockHooks } from "./block-hooks-CtMsgLQr.js";
|
|
7
|
+
import { _ as JobHandler } from "./types-BdhE7I8Z.js";
|
|
8
8
|
/**
|
|
9
9
|
* What an entry caches: a whole generation, a replayable stream, embeddings, or
|
|
10
10
|
* anything else.
|
|
@@ -3,12 +3,12 @@ import { T as ErrorMapper, t as AsyncResult } from "./result-DTOQRyGY.js";
|
|
|
3
3
|
import { t as StandardSchemaV1 } from "./standard-DRX6Ch1j.js";
|
|
4
4
|
import { r as FieldsOf } from "./block-fields-Puv5m5D3.js";
|
|
5
5
|
import { n as Logger } from "./logger-0LfhvwE4.js";
|
|
6
|
-
import { r as BlockTemporalOptions } from "./block-helpers-
|
|
7
|
-
import { t as BlockTransport } from "./block-transport-
|
|
8
|
-
import { n as BlockHooks } from "./block-hooks-
|
|
6
|
+
import { r as BlockTemporalOptions } from "./block-helpers-BNtM1tqy.js";
|
|
7
|
+
import { t as BlockTransport } from "./block-transport-CDmOUuLZ.js";
|
|
8
|
+
import { n as BlockHooks } from "./block-hooks-CtMsgLQr.js";
|
|
9
9
|
import { i as AiMessage, s as AiMessageRole } from "./message-Cc4bkdNw.js";
|
|
10
10
|
import { n as FinalRunState, r as RunState } from "./run-state-D0Tbl-nM.js";
|
|
11
|
-
import { i as AiSandboxes } from "./sandboxes-
|
|
11
|
+
import { i as AiSandboxes } from "./sandboxes-BF9RxxCU.js";
|
|
12
12
|
/** Where a run is: written by `runs.claim`, `release` and `stop`. */
|
|
13
13
|
type AiRunState = Exclude<RunState, "waiting">;
|
|
14
14
|
/** One generation of a chat, as `ai_runs` stores it. */
|
|
@@ -132,7 +132,8 @@ declare function createHarnessSessions(options: AiChatOptions): AiHarnessSession
|
|
|
132
132
|
type AiChatVisibility = "private" | "organization";
|
|
133
133
|
interface AiChatRecord {
|
|
134
134
|
readonly id: string;
|
|
135
|
-
|
|
135
|
+
/** `undefined` for a chat outside a tenant (`options.tenant: false`). */
|
|
136
|
+
readonly organizationId: string | undefined;
|
|
136
137
|
readonly ownerId: string;
|
|
137
138
|
readonly projectId: string | undefined;
|
|
138
139
|
readonly agentId: string | undefined;
|
|
@@ -193,7 +194,7 @@ interface AiChatPage<F extends object = Record<never, never>> {
|
|
|
193
194
|
}
|
|
194
195
|
interface AiProject {
|
|
195
196
|
readonly id: string;
|
|
196
|
-
readonly organizationId: string;
|
|
197
|
+
readonly organizationId: string | undefined;
|
|
197
198
|
readonly ownerId: string;
|
|
198
199
|
readonly name: string;
|
|
199
200
|
readonly instructions: string;
|
|
@@ -213,10 +214,19 @@ interface AiProjectInput {
|
|
|
213
214
|
type AiStoredMessageStatus = "complete" | "aborted" | "error";
|
|
214
215
|
/** A message as the tree stores it: the canonical fields plus its place. */
|
|
215
216
|
interface AiStoredMessage extends AiMessage {
|
|
217
|
+
/** The message before it: its parent in a tree, the one before in a list. */
|
|
216
218
|
readonly parentId: string | undefined;
|
|
217
|
-
/**
|
|
219
|
+
/** The user who wrote it; `undefined` for an answer. */
|
|
220
|
+
readonly authorId: string | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* `canonical`, the format `native` holds (such as `ai-sdk-ui`), or `native`
|
|
223
|
+
* when the row's own parts are the SDK's (`options.messages.parts`).
|
|
224
|
+
*/
|
|
218
225
|
readonly format: string;
|
|
219
|
-
/**
|
|
226
|
+
/**
|
|
227
|
+
* The SDK's own message: the stored copy when `path(..., { native: true })`
|
|
228
|
+
* asks for it, or the row itself when `format` is `native`.
|
|
229
|
+
*/
|
|
220
230
|
readonly native: unknown;
|
|
221
231
|
readonly model: string | undefined;
|
|
222
232
|
readonly status: AiStoredMessageStatus;
|
|
@@ -241,6 +251,8 @@ interface AiAppendResult {
|
|
|
241
251
|
}
|
|
242
252
|
interface AiAssistantMessageOptions {
|
|
243
253
|
readonly parentId: string;
|
|
254
|
+
/** Values for the message table's extra columns, keyed by column name. */
|
|
255
|
+
readonly fields?: Readonly<Record<string, unknown>>;
|
|
244
256
|
readonly status?: AiStoredMessageStatus;
|
|
245
257
|
readonly model?: string;
|
|
246
258
|
/** The format of `native`, such as `ai-sdk-ui`. */
|
|
@@ -373,7 +385,7 @@ type AiModerationStage = "input" | "output" | "tool";
|
|
|
373
385
|
type AiModerationAction = "allow" | "flag" | "redact" | "block";
|
|
374
386
|
interface AiModerationEvent {
|
|
375
387
|
readonly id: string;
|
|
376
|
-
readonly organizationId: string;
|
|
388
|
+
readonly organizationId: string | undefined;
|
|
377
389
|
readonly chatId: string | undefined;
|
|
378
390
|
readonly messageId: string | undefined;
|
|
379
391
|
readonly userId: string | undefined;
|
|
@@ -385,7 +397,8 @@ interface AiModerationEvent {
|
|
|
385
397
|
readonly createdAt: Temporal.Instant;
|
|
386
398
|
}
|
|
387
399
|
interface AiModerationInput {
|
|
388
|
-
|
|
400
|
+
/** Leave it out for a chat outside a tenant. */
|
|
401
|
+
readonly organizationId?: string | undefined;
|
|
389
402
|
readonly stage: AiModerationStage;
|
|
390
403
|
readonly action: AiModerationAction;
|
|
391
404
|
readonly category: string;
|
|
@@ -394,6 +407,47 @@ interface AiModerationInput {
|
|
|
394
407
|
readonly userId?: string;
|
|
395
408
|
readonly score?: number;
|
|
396
409
|
}
|
|
410
|
+
/** Who besides the owner takes part in a chat. */
|
|
411
|
+
type AiChatParticipantRole = "viewer" | "editor";
|
|
412
|
+
/**
|
|
413
|
+
* A participant: a viewer reads the chat, an editor also sends messages, stops
|
|
414
|
+
* an answer and switches branches.
|
|
415
|
+
*/
|
|
416
|
+
interface AiChatParticipant {
|
|
417
|
+
readonly chatId: string;
|
|
418
|
+
readonly userId: string;
|
|
419
|
+
readonly role: AiChatParticipantRole;
|
|
420
|
+
readonly addedBy: string | undefined;
|
|
421
|
+
readonly createdAt: Temporal.Instant | undefined;
|
|
422
|
+
/** The participant table's extra columns. */
|
|
423
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
424
|
+
}
|
|
425
|
+
interface AiUserMessageOptions {
|
|
426
|
+
readonly trigger?: AiUserMessageTrigger;
|
|
427
|
+
readonly messageId?: string;
|
|
428
|
+
/**
|
|
429
|
+
* The SDK's own message (such as a `UIMessage`). With `messages: { parts:
|
|
430
|
+
* "native" }` it is stored instead of `message`.
|
|
431
|
+
*/
|
|
432
|
+
readonly native?: unknown;
|
|
433
|
+
/** Values for the message table's extra columns, keyed by column name. */
|
|
434
|
+
readonly fields?: Readonly<Record<string, unknown>>;
|
|
435
|
+
}
|
|
436
|
+
/** `blocks.ai-chat.options.messages`: how the message table is keyed and shaped. */
|
|
437
|
+
interface AiChatMessageStorage {
|
|
438
|
+
/**
|
|
439
|
+
* `uuid` keys messages by uuid; client ids must then be uuids. Default
|
|
440
|
+
* `text`.
|
|
441
|
+
*/
|
|
442
|
+
readonly key?: "text" | "uuid";
|
|
443
|
+
/**
|
|
444
|
+
* `false` keeps one linear list per chat. Default: a tree when `parent_id`
|
|
445
|
+
* exists.
|
|
446
|
+
*/
|
|
447
|
+
readonly tree?: boolean;
|
|
448
|
+
/** `native` stores the SDK's own parts. Default `canonical`. */
|
|
449
|
+
readonly parts?: "canonical" | "native";
|
|
450
|
+
}
|
|
397
451
|
interface AiChatOptions<S extends StandardSchemaV1 | undefined = undefined> extends BlockTemporalOptions {
|
|
398
452
|
/**
|
|
399
453
|
* A Standard Schema for the chat columns the app adds
|
|
@@ -402,6 +456,13 @@ interface AiChatOptions<S extends StandardSchemaV1 | undefined = undefined> exte
|
|
|
402
456
|
* `chats.update`, which return a `validation` error for a bad value.
|
|
403
457
|
*/
|
|
404
458
|
readonly fields?: S;
|
|
459
|
+
/**
|
|
460
|
+
* The message shape `blocks.ai-chat.options.messages` installs, which
|
|
461
|
+
* `defineBlocks` passes from `blocks.generated.ts`. With `parts: "native"`
|
|
462
|
+
* the client stores the SDK's own message (the `native` of `appendUser` and
|
|
463
|
+
* `saveAssistant`) in place of the canonical one.
|
|
464
|
+
*/
|
|
465
|
+
readonly messages?: AiChatMessageStorage;
|
|
405
466
|
/** `withBlockHooks` hooks around the client's methods. */
|
|
406
467
|
readonly hooks?: NoInfer<BlockHooks<AiChat<FieldsOf<S>>>>;
|
|
407
468
|
/** Receives the errors `after` hooks throw. Default: `console`. */
|
|
@@ -424,8 +485,11 @@ interface AiChatOptions<S extends StandardSchemaV1 | undefined = undefined> exte
|
|
|
424
485
|
/** `F` is the extra chat fields `options.fields` describes. */
|
|
425
486
|
interface AiChat<F extends object = Record<never, never>> {
|
|
426
487
|
readonly chats: {
|
|
427
|
-
/**
|
|
428
|
-
|
|
488
|
+
/**
|
|
489
|
+
* Keys besides the input's own are the chat's extra columns. `null` makes a
|
|
490
|
+
* chat outside a tenant, with `options.tenant: false`.
|
|
491
|
+
*/
|
|
492
|
+
create(organizationId: string | null, input?: AiChatInput & Partial<F>): AsyncResult<AiChatRecord & F>;
|
|
429
493
|
get(chatId: string): AsyncResult<AiChatRecord & F>;
|
|
430
494
|
list(query?: AiChatQuery): AsyncResult<AiChatPage<F>>;
|
|
431
495
|
update(chatId: string, patch: AiChatPatch & Partial<F>): AsyncResult<AiChatRecord & F>;
|
|
@@ -434,23 +498,36 @@ interface AiChat<F extends object = Record<never, never>> {
|
|
|
434
498
|
purge(batch?: number): AsyncResult<number>;
|
|
435
499
|
};
|
|
436
500
|
readonly projects: {
|
|
437
|
-
|
|
501
|
+
/**
|
|
502
|
+
* `null` makes a project outside a tenant. Keys of `fields` are the project
|
|
503
|
+
* table's extra columns.
|
|
504
|
+
*/
|
|
505
|
+
create(organizationId: string | null, input: AiProjectInput & {
|
|
438
506
|
readonly name: string;
|
|
439
|
-
}): AsyncResult<AiProject>;
|
|
440
|
-
update(projectId: string, input: AiProjectInput): AsyncResult<AiProject>;
|
|
441
|
-
list(organizationId: string): AsyncResult<readonly AiProject[]>;
|
|
507
|
+
}, fields?: Readonly<Record<string, unknown>>): AsyncResult<AiProject>;
|
|
508
|
+
update(projectId: string, input: AiProjectInput, fields?: Readonly<Record<string, unknown>>): AsyncResult<AiProject>;
|
|
509
|
+
list(organizationId: string | null): AsyncResult<readonly AiProject[]>;
|
|
442
510
|
remove(projectId: string): AsyncResult<boolean>;
|
|
443
511
|
};
|
|
512
|
+
/** The people besides the owner who take part in a chat. */
|
|
513
|
+
readonly participants: {
|
|
514
|
+
/** Adds someone, or changes their role (the owner, or the service role). */
|
|
515
|
+
add(chatId: string, userId: string, options?: {
|
|
516
|
+
readonly role?: AiChatParticipantRole;
|
|
517
|
+
readonly fields?: Readonly<Record<string, unknown>>;
|
|
518
|
+
}): AsyncResult<AiChatParticipant>;
|
|
519
|
+
/** The owner removes anyone; a participant removes themselves. */
|
|
520
|
+
remove(chatId: string, userId: string): AsyncResult<boolean>;
|
|
521
|
+
list(chatId: string): AsyncResult<readonly AiChatParticipant[]>;
|
|
522
|
+
};
|
|
444
523
|
readonly messages: {
|
|
445
524
|
/**
|
|
446
525
|
* Stores the user's message under the chat's leaf. A retry with the same id
|
|
447
|
-
* is a no-op
|
|
448
|
-
* with a fresh id
|
|
526
|
+
* is a no-op. In a tree the same id with other parts is an edit, stored as
|
|
527
|
+
* a sibling with a fresh id; in a linear list it replaces the message and
|
|
528
|
+
* deletes the ones after it.
|
|
449
529
|
*/
|
|
450
|
-
appendUser(chatId: string, message: AiMessage, options?:
|
|
451
|
-
readonly trigger?: AiUserMessageTrigger;
|
|
452
|
-
readonly messageId?: string;
|
|
453
|
-
}): AsyncResult<AiAppendResult>;
|
|
530
|
+
appendUser(chatId: string, message: AiMessage, options?: AiUserMessageOptions): AsyncResult<AiAppendResult>;
|
|
454
531
|
/** Stores an answer (service role); a retry with the same id updates it. */
|
|
455
532
|
saveAssistant(chatId: string, message: AiMessage, options: AiAssistantMessageOptions): AsyncResult<AiSaveResult>;
|
|
456
533
|
/** The messages from the root to `leafId`, default the chat's leaf. */
|
|
@@ -459,7 +536,10 @@ interface AiChat<F extends object = Record<never, never>> {
|
|
|
459
536
|
readonly native?: boolean;
|
|
460
537
|
}): AsyncResult<readonly AiStoredMessage[]>;
|
|
461
538
|
siblings(chatId: string, messageId: string): AsyncResult<readonly AiMessageSibling[]>;
|
|
462
|
-
/**
|
|
539
|
+
/**
|
|
540
|
+
* Shows the branch through `messageId`; returns the new leaf. A linear list
|
|
541
|
+
* has no branches and answers `AI_CHAT_LINEAR`.
|
|
542
|
+
*/
|
|
463
543
|
switchBranch(chatId: string, messageId: string): AsyncResult<string>;
|
|
464
544
|
};
|
|
465
545
|
/**
|
|
@@ -520,7 +600,8 @@ interface AiChat<F extends object = Record<never, never>> {
|
|
|
520
600
|
}): AsyncResult<number>;
|
|
521
601
|
};
|
|
522
602
|
readonly moderation: {
|
|
523
|
-
|
|
603
|
+
/** Keys of `fields` are the moderation table's extra columns. */
|
|
604
|
+
record(event: AiModerationInput, fields?: Readonly<Record<string, unknown>>): AsyncResult<AiModerationEvent>;
|
|
524
605
|
list(organizationId: string, size?: number): AsyncResult<readonly AiModerationEvent[]>;
|
|
525
606
|
};
|
|
526
607
|
}
|
|
@@ -529,4 +610,4 @@ declare function aiChatTopic(chatId: string, prefix?: string): string;
|
|
|
529
610
|
/** The topic that tells a user their chat list changed. */
|
|
530
611
|
declare function aiChatListTopic(userId: string, prefix?: string): string;
|
|
531
612
|
declare function createAiChat<S extends StandardSchemaV1 | undefined = undefined>(options: AiChatOptions<S>): AiChat<FieldsOf<S>>;
|
|
532
|
-
export {
|
|
613
|
+
export { createHarnessSessions as $, AiRunStatus as A, SharedAiChat as B, AiModerationInput as C, AiProject as D, AiPendingInputRequest as E, AiStreamClaim as F, AiPendingApproval as G, AiHarnessSessionPatch as H, AiToolApproval as I, AiRunState as J, AiRun as K, AiToolApprovalRequest as L, AiShareLink as M, AiStoredMessage as N, AiProjectInput as O, AiStoredMessageStatus as P, AiRuns as Q, AiToolPolicy as R, AiModerationEvent as S, AiPendingInput as T, AiHarnessSessions as U, AiHarnessSession as V, AiHarnessStatus as W, AiRunStepInput as X, AiRunStep as Y, AiRunStepStatus as Z, AiFeedback as _, createAiChat as a, AiModelInput as b, AiAssistantMessageOptions as c, AiChatPage as d, AiChatPatch as f, AiChatVisibility as g, AiChatShare as h, aiChatTopic as i, AiSaveResult as j, AiRunRelease as k, AiChatInput as l, AiChatRecord as m, AiChatOptions as n, AiAppendResult as o, AiChatQuery as p, AiRunQuery as q, aiChatListTopic as r, AiApprovalDecision as s, AiChat as t, AiChatMessageStorage as u, AiMessageSibling as v, AiModerationStage as w, AiModerationAction as x, AiModel as y, AiUserMessageTrigger as z };
|