better-supabase 0.52.0 → 0.53.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-DVntbgJf.js → access-sql-DH2LbcQe.js} +2 -1
- package/dist/{adapter-iCMh_XnC.js → adapter-CJa5ys5O.js} +46 -11
- package/dist/{agents-C_VAKJ_s.d.ts → agents-BrLBg0gC.d.ts} +2 -2
- package/dist/{agents-CkRsaxAr.js → agents-CEna9P0O.js} +1 -1
- package/dist/{ai-cache-DV8O7Kav.js → ai-cache-CqNHapwf.js} +1 -1
- package/dist/{ai-files-BD6YE9TZ.js → ai-files-C8n2QKlX.js} +1 -1
- package/dist/{ai-schedules-BMM-ZHOC.d.ts → ai-schedules-Dfbcor59.d.ts} +1 -1
- package/dist/ai-sdk/agents/index.d.ts +1 -1
- package/dist/ai-sdk/agents/index.js +1 -1
- package/dist/ai-sdk/cache/index.js +1 -1
- package/dist/ai-sdk/embeddings/index.js +1 -1
- package/dist/ai-sdk/files/index.js +1 -1
- package/dist/ai-sdk/workflow/index.d.ts +1 -1
- package/dist/ai-sdk/workflow/index.js +1 -1
- package/dist/{api-YjQpioTT.d.ts → api-CGYctFBt.d.ts} +1 -1
- package/dist/{api-keys-mfwDRWHv.d.ts → api-keys-COJAXdGF.d.ts} +1 -1
- package/dist/{app-tables-D2uN1feV.d.ts → app-tables-CZLNOXeA.d.ts} +1 -1
- package/dist/{approvals-BSweHvij.js → approvals-DCLl96Xf.js} +1 -1
- package/dist/astro/index.d.ts +3 -3
- package/dist/astro/index.js +2 -2
- package/dist/{attachments-DqQ61LfS.js → attachments-Djs8uyat.js} +1 -1
- package/dist/{auth-reply-CgXF76sz.js → auth-reply-CimDH13K.js} +4 -1
- package/dist/{authorization-hk0TAA6-.d.ts → authorization-UYejwQsk.d.ts} +70 -9
- package/dist/{automations-CrdULEET.js → automations-DChuvKPy.js} +1 -1
- package/dist/better-result/index.d.ts +2 -2
- package/dist/{bind-CEN9Us3B.d.ts → bind-D4qLTlY4.d.ts} +11 -7
- package/dist/{block-env-CvQj4rbD.d.ts → block-env-BLBr90is.d.ts} +4 -4
- package/dist/{block-hooks-BIRJauOk.js → block-hooks-Bd5bRM9B.js} +1 -0
- package/dist/{block-subjects-SKkp3d_Q.js → block-subjects-Cvd-RaMY.js} +2 -2
- package/dist/{block-tables-BR6Ckm_1.d.ts → block-tables-BkgafSZd.d.ts} +1 -1
- package/dist/blocks/access-requests/index.d.ts +1 -1
- package/dist/blocks/access-requests/index.js +10 -10
- package/dist/blocks/accounting/index.d.ts +1 -1
- package/dist/blocks/accounting/index.js +2 -2
- package/dist/blocks/acknowledgements/index.d.ts +1 -1
- package/dist/blocks/acknowledgements/index.js +1 -1
- package/dist/blocks/activities/index.d.ts +2 -2
- package/dist/blocks/activities/index.js +2 -2
- package/dist/blocks/advisories/index.d.ts +1 -1
- package/dist/blocks/advisories/index.js +16 -16
- package/dist/blocks/agent-checkout/index.d.ts +1 -1
- package/dist/blocks/agent-checkout/index.js +11 -11
- package/dist/blocks/agents/index.d.ts +1 -1
- package/dist/blocks/agents/index.js +11 -11
- package/dist/blocks/ai-cache/index.d.ts +1 -1
- package/dist/blocks/ai-cache/index.js +3 -3
- package/dist/blocks/ai-chat/index.d.ts +1 -1
- package/dist/blocks/ai-chat/index.js +10 -10
- package/dist/blocks/ai-evals/index.d.ts +1 -1
- package/dist/blocks/ai-evals/index.js +3 -3
- package/dist/blocks/ai-files/index.d.ts +1 -1
- package/dist/blocks/ai-files/index.js +3 -3
- package/dist/blocks/ai-guardrails/index.d.ts +1 -1
- package/dist/blocks/ai-guardrails/index.js +5 -5
- package/dist/blocks/ai-keys/index.d.ts +1 -1
- package/dist/blocks/ai-keys/index.js +8 -8
- package/dist/blocks/ai-schedules/index.d.ts +2 -2
- package/dist/blocks/ai-schedules/index.js +3 -3
- package/dist/blocks/announcements/index.d.ts +4 -4
- package/dist/blocks/announcements/index.js +8 -8
- package/dist/blocks/api-keys/index.d.ts +2 -2
- package/dist/blocks/api-keys/index.js +1 -1
- package/dist/blocks/appraisals/index.d.ts +1 -1
- package/dist/blocks/appraisals/index.js +12 -12
- package/dist/blocks/approvals/index.d.ts +1 -1
- package/dist/blocks/approvals/index.js +2 -2
- package/dist/blocks/assets/index.d.ts +2 -2
- package/dist/blocks/assets/index.js +2 -2
- package/dist/blocks/assignment/index.d.ts +1 -1
- package/dist/blocks/assignment/index.js +2 -2
- package/dist/blocks/attachments/index.d.ts +5 -5
- package/dist/blocks/attachments/index.js +2 -2
- package/dist/blocks/audit/index.d.ts +2 -2
- package/dist/blocks/audit/index.js +1 -1
- package/dist/blocks/automations/index.d.ts +3 -3
- package/dist/blocks/automations/index.js +12 -12
- package/dist/blocks/banking/index.d.ts +1 -1
- package/dist/blocks/banking/index.js +2 -2
- package/dist/blocks/billable-time/index.d.ts +1 -1
- package/dist/blocks/billable-time/index.js +2 -2
- package/dist/blocks/billing/index.d.ts +3 -3
- package/dist/blocks/billing/index.js +1 -1
- package/dist/blocks/bookings/index.d.ts +2 -2
- package/dist/blocks/bookings/index.js +1 -1
- package/dist/blocks/bulk/index.d.ts +1 -1
- package/dist/blocks/bulk/index.js +5 -5
- package/dist/blocks/calendar/index.d.ts +3 -3
- package/dist/blocks/calendar/index.js +1 -1
- package/dist/blocks/care/index.d.ts +27 -27
- package/dist/blocks/care/index.js +37 -46
- package/dist/blocks/care-plans/index.d.ts +3 -3
- package/dist/blocks/care-plans/index.js +2 -2
- package/dist/blocks/cases/index.d.ts +3 -3
- package/dist/blocks/cases/index.js +2 -2
- package/dist/blocks/catalog/index.d.ts +2 -2
- package/dist/blocks/catalog/index.js +2 -2
- package/dist/blocks/channels/index.d.ts +1 -1
- package/dist/blocks/channels/index.js +7 -7
- package/dist/blocks/clinical-decision-support/index.d.ts +1 -1
- package/dist/blocks/clinical-decision-support/index.js +11 -11
- package/dist/blocks/cms/index.d.ts +5 -5
- package/dist/blocks/cms/index.js +7 -7
- package/dist/blocks/collaboration/index.d.ts +6 -6
- package/dist/blocks/collaboration/index.js +8 -8
- package/dist/blocks/collections/index.d.ts +1 -1
- package/dist/blocks/collections/index.js +10 -10
- package/dist/blocks/comments/index.d.ts +2 -2
- package/dist/blocks/comments/index.js +1 -1
- package/dist/blocks/commerce/index.d.ts +5 -5
- package/dist/blocks/commerce/index.js +7 -7
- package/dist/blocks/commissions/index.d.ts +1 -1
- package/dist/blocks/commissions/index.js +11 -11
- package/dist/blocks/compliance/index.d.ts +1 -1
- package/dist/blocks/compliance/index.js +11 -11
- package/dist/blocks/connectors/index.d.ts +1 -1
- package/dist/blocks/connectors/index.js +11 -11
- package/dist/blocks/consents/index.d.ts +2 -2
- package/dist/blocks/consents/index.js +2 -2
- package/dist/blocks/contacts/index.d.ts +2 -2
- package/dist/blocks/contacts/index.js +2 -2
- package/dist/blocks/content/index.d.ts +2 -2
- package/dist/blocks/content/index.js +2 -2
- package/dist/blocks/contracts/index.d.ts +1 -1
- package/dist/blocks/contracts/index.js +12 -12
- package/dist/blocks/courses/index.d.ts +3 -3
- package/dist/blocks/courses/index.js +2 -2
- package/dist/blocks/created-by/index.d.ts +2 -2
- package/dist/blocks/created-by/index.js +2 -2
- package/dist/blocks/crm/index.d.ts +17 -17
- package/dist/blocks/crm/index.js +19 -19
- package/dist/blocks/custom-fields/index.d.ts +1 -1
- package/dist/blocks/custom-fields/index.js +11 -11
- package/dist/blocks/dam/index.d.ts +2 -2
- package/dist/blocks/dam/index.js +11 -11
- package/dist/blocks/data-lifecycle/index.d.ts +2 -2
- package/dist/blocks/data-lifecycle/index.js +1 -1
- package/dist/blocks/deals/index.d.ts +1 -1
- package/dist/blocks/deals/index.js +2 -2
- package/dist/blocks/dispatch/index.d.ts +2 -2
- package/dist/blocks/dispatch/index.js +2 -2
- package/dist/blocks/document-templates/index.d.ts +1 -1
- package/dist/blocks/document-templates/index.js +10 -10
- package/dist/blocks/documents/index.d.ts +1 -1
- package/dist/blocks/documents/index.js +9 -9
- package/dist/blocks/domains/index.d.ts +1 -1
- package/dist/blocks/domains/index.js +10 -10
- package/dist/blocks/donations/index.d.ts +1 -1
- package/dist/blocks/donations/index.js +12 -12
- package/dist/blocks/drive/index.d.ts +5 -5
- package/dist/blocks/drive/index.js +4 -4
- package/dist/blocks/e-prescribing/index.d.ts +1 -1
- package/dist/blocks/e-prescribing/index.js +11 -11
- package/dist/blocks/employees/index.d.ts +1 -1
- package/dist/blocks/employees/index.js +2 -2
- package/dist/blocks/enrichment/index.d.ts +1 -1
- package/dist/blocks/enrichment/index.js +2 -2
- package/dist/blocks/enrollments/index.d.ts +2 -2
- package/dist/blocks/enrollments/index.js +2 -2
- package/dist/blocks/entitlements/index.d.ts +3 -3
- package/dist/blocks/entitlements/index.js +2 -2
- package/dist/blocks/events/index.d.ts +3 -3
- package/dist/blocks/events/index.js +5 -5
- package/dist/blocks/expenses/index.d.ts +1 -1
- package/dist/blocks/expenses/index.js +18 -18
- package/dist/blocks/field-history/index.d.ts +1 -1
- package/dist/blocks/field-history/index.js +2 -2
- package/dist/blocks/filespace/index.d.ts +8 -8
- package/dist/blocks/filespace/index.js +9 -9
- package/dist/blocks/finance/index.d.ts +5 -5
- package/dist/blocks/finance/index.js +7 -7
- package/dist/blocks/flags/index.d.ts +1 -1
- package/dist/blocks/flags/index.js +9 -9
- package/dist/blocks/forecasts/index.d.ts +1 -1
- package/dist/blocks/forecasts/index.js +2 -2
- package/dist/blocks/forms/index.d.ts +3 -3
- package/dist/blocks/forms/index.js +1 -1
- package/dist/blocks/funding/index.d.ts +2 -2
- package/dist/blocks/funding/index.js +2 -2
- package/dist/blocks/goals/index.d.ts +1 -1
- package/dist/blocks/goals/index.js +2 -2
- package/dist/blocks/governance/index.d.ts +4 -4
- package/dist/blocks/governance/index.js +6 -6
- package/dist/blocks/guests/index.d.ts +1 -1
- package/dist/blocks/guests/index.js +2 -2
- package/dist/blocks/hiring/index.d.ts +1 -1
- package/dist/blocks/hiring/index.js +2 -2
- package/dist/blocks/identities/index.d.ts +1 -1
- package/dist/blocks/identities/index.js +3 -3
- package/dist/blocks/imports/index.d.ts +2 -2
- package/dist/blocks/imports/index.js +8 -8
- package/dist/blocks/inbox/index.d.ts +6 -6
- package/dist/blocks/inbox/index.js +1 -1
- package/dist/blocks/incidents/index.d.ts +1 -1
- package/dist/blocks/incidents/index.js +12 -12
- package/dist/blocks/index.d.ts +6 -6
- package/dist/blocks/index.js +8 -7
- package/dist/blocks/inspections/index.d.ts +2 -2
- package/dist/blocks/inspections/index.js +19 -19
- package/dist/blocks/inventory/index.d.ts +1 -1
- package/dist/blocks/inventory/index.js +2 -2
- package/dist/blocks/invoices/index.d.ts +1 -1
- package/dist/blocks/invoices/index.js +2 -2
- package/dist/blocks/knowledge/index.d.ts +1 -1
- package/dist/blocks/knowledge/index.js +2 -2
- package/dist/blocks/lead-scoring/index.d.ts +2 -2
- package/dist/blocks/lead-scoring/index.js +2 -2
- package/dist/blocks/learning/index.d.ts +3 -3
- package/dist/blocks/learning/index.js +5 -5
- package/dist/blocks/leases/index.d.ts +1 -1
- package/dist/blocks/leases/index.js +11 -11
- package/dist/blocks/leave/index.d.ts +1 -1
- package/dist/blocks/leave/index.js +2 -2
- package/dist/blocks/ledger/index.d.ts +1 -1
- package/dist/blocks/ledger/index.js +12 -12
- package/dist/blocks/legal-entities/index.d.ts +2 -2
- package/dist/blocks/legal-entities/index.js +7 -7
- package/dist/blocks/lims/index.d.ts +2 -2
- package/dist/blocks/lims/index.js +14 -14
- package/dist/blocks/mail-sync/index.d.ts +3 -3
- package/dist/blocks/mail-sync/index.js +2 -2
- package/dist/blocks/maintenance/index.d.ts +2 -2
- package/dist/blocks/maintenance/index.js +2 -2
- package/dist/blocks/manufacturing/index.d.ts +2 -2
- package/dist/blocks/manufacturing/index.js +9 -9
- package/dist/blocks/medications/index.d.ts +1 -1
- package/dist/blocks/medications/index.js +2 -2
- package/dist/blocks/meetings/index.d.ts +3 -3
- package/dist/blocks/meetings/index.js +2 -2
- package/dist/blocks/memberships/index.d.ts +2 -2
- package/dist/blocks/memberships/index.js +2 -2
- package/dist/blocks/memory/index.d.ts +1 -1
- package/dist/blocks/memory/index.js +4 -4
- package/dist/blocks/messaging/index.d.ts +5 -5
- package/dist/blocks/messaging/index.js +14 -14
- package/dist/blocks/metrics/index.d.ts +1 -1
- package/dist/blocks/metrics/index.js +3 -3
- package/dist/blocks/mfa/index.d.ts +2 -2
- package/dist/blocks/mfa/index.js +3 -3
- package/dist/blocks/moderation/index.d.ts +2 -2
- package/dist/blocks/moderation/index.js +14 -14
- package/dist/blocks/notifications/index.d.ts +5 -5
- package/dist/blocks/notifications/index.js +2 -2
- package/dist/blocks/numbering/index.d.ts +1 -1
- package/dist/blocks/numbering/index.js +1 -1
- package/dist/blocks/oauth-server/index.d.ts +1 -1
- package/dist/blocks/oauth-server/index.js +9 -9
- package/dist/blocks/observations/index.d.ts +2 -2
- package/dist/blocks/observations/index.js +2 -2
- package/dist/blocks/onboarding/index.d.ts +2 -2
- package/dist/blocks/onboarding/index.js +1 -1
- package/dist/blocks/orders/index.d.ts +1 -1
- package/dist/blocks/orders/index.js +2 -2
- package/dist/blocks/organizations/index.d.ts +2 -2
- package/dist/blocks/organizations/index.js +3 -3
- package/dist/blocks/outbox/index.d.ts +1 -1
- package/dist/blocks/outbox/index.js +1 -1
- package/dist/blocks/passes/index.d.ts +2 -2
- package/dist/blocks/passes/index.js +2 -2
- package/dist/blocks/payroll-export/index.d.ts +2 -2
- package/dist/blocks/payroll-export/index.js +2 -2
- package/dist/blocks/people/index.d.ts +7 -7
- package/dist/blocks/people/index.js +9 -9
- package/dist/blocks/periods/index.d.ts +1 -1
- package/dist/blocks/periods/index.js +9 -9
- package/dist/blocks/permissions/index.d.ts +3 -3
- package/dist/blocks/permissions/index.js +3 -3
- package/dist/blocks/pipelines/index.d.ts +1 -1
- package/dist/blocks/pipelines/index.js +2 -2
- package/dist/blocks/posts/index.d.ts +2 -2
- package/dist/blocks/posts/index.js +13 -13
- package/dist/blocks/procurement/index.d.ts +5 -5
- package/dist/blocks/procurement/index.js +7 -7
- package/dist/blocks/profiles/index.d.ts +1 -1
- package/dist/blocks/profiles/index.js +2 -2
- package/dist/blocks/projects/index.d.ts +7 -7
- package/dist/blocks/projects/index.js +9 -9
- package/dist/blocks/promotions/index.d.ts +1 -1
- package/dist/blocks/promotions/index.js +2 -2
- package/dist/blocks/prompts/index.d.ts +1 -1
- package/dist/blocks/prompts/index.js +3 -3
- package/dist/blocks/push/index.d.ts +2 -2
- package/dist/blocks/push/index.js +7 -7
- package/dist/blocks/qualifications/index.d.ts +2 -2
- package/dist/blocks/qualifications/index.js +2 -2
- package/dist/blocks/queue/index.d.ts +2 -2
- package/dist/blocks/queue/index.js +2 -2
- package/dist/blocks/quotes/index.d.ts +1 -1
- package/dist/blocks/quotes/index.js +2 -2
- package/dist/blocks/rank/index.d.ts +1 -1
- package/dist/blocks/rank/index.js +3 -3
- package/dist/blocks/reactions/index.d.ts +4 -4
- package/dist/blocks/reactions/index.js +1 -1
- package/dist/blocks/recruiting/index.d.ts +4 -4
- package/dist/blocks/recruiting/index.js +6 -6
- package/dist/blocks/referrals/index.d.ts +1 -1
- package/dist/blocks/referrals/index.js +10 -10
- package/dist/blocks/relations/index.d.ts +1 -1
- package/dist/blocks/relations/index.js +8 -8
- package/dist/blocks/reminders/index.d.ts +1 -1
- package/dist/blocks/reminders/index.js +1 -1
- package/dist/blocks/reviews/index.d.ts +1 -1
- package/dist/blocks/reviews/index.js +10 -10
- package/dist/blocks/rfqs/index.d.ts +2 -2
- package/dist/blocks/rfqs/index.js +2 -2
- package/dist/blocks/risks/index.d.ts +2 -2
- package/dist/blocks/risks/index.js +14 -14
- package/dist/blocks/saas/index.d.ts +13 -13
- package/dist/blocks/saas/index.js +14 -14
- package/dist/blocks/sales/index.d.ts +1 -1
- package/dist/blocks/sales/index.js +1 -1
- package/dist/blocks/saved-views/index.d.ts +3 -3
- package/dist/blocks/saved-views/index.js +8 -8
- package/dist/blocks/scheduling/index.d.ts +4 -4
- package/dist/blocks/scheduling/index.js +6 -6
- package/dist/blocks/scores/index.d.ts +2 -2
- package/dist/blocks/scores/index.js +10 -10
- package/dist/blocks/search/index.d.ts +3 -3
- package/dist/blocks/search/index.js +1 -1
- package/dist/blocks/security-events/index.d.ts +1 -1
- package/dist/blocks/security-events/index.js +8 -8
- package/dist/blocks/segments/index.d.ts +2 -2
- package/dist/blocks/segments/index.js +2 -2
- package/dist/blocks/sequences/index.d.ts +3 -3
- package/dist/blocks/sequences/index.js +2 -2
- package/dist/blocks/service/index.d.ts +7 -7
- package/dist/blocks/service/index.js +9 -9
- package/dist/blocks/service-accounts/index.d.ts +1 -1
- package/dist/blocks/service-accounts/index.js +8 -8
- package/dist/blocks/sessions/index.d.ts +2 -2
- package/dist/blocks/sessions/index.js +4 -4
- package/dist/blocks/settings/index.d.ts +2 -2
- package/dist/blocks/settings/index.js +2 -2
- package/dist/blocks/share-links/index.d.ts +1 -1
- package/dist/blocks/share-links/index.js +1 -1
- package/dist/blocks/shifts/index.d.ts +2 -2
- package/dist/blocks/shifts/index.js +2 -2
- package/dist/blocks/shipments/index.d.ts +2 -2
- package/dist/blocks/shipments/index.js +10 -10
- package/dist/blocks/signatures/index.d.ts +2 -2
- package/dist/blocks/signatures/index.js +1 -1
- package/dist/blocks/signing-keys/index.d.ts +1 -1
- package/dist/blocks/signing-keys/index.js +7 -7
- package/dist/blocks/sla/index.d.ts +1 -1
- package/dist/blocks/sla/index.js +2 -2
- package/dist/blocks/sso/index.d.ts +2 -2
- package/dist/blocks/sso/index.js +20 -20
- package/dist/blocks/state-machine/index.d.ts +1 -1
- package/dist/blocks/state-machine/index.js +1 -1
- package/dist/blocks/subjects/index.d.ts +2 -2
- package/dist/blocks/subjects/index.js +1 -1
- package/dist/blocks/support/index.d.ts +5 -5
- package/dist/blocks/support/index.js +7 -7
- package/dist/blocks/tags/index.d.ts +2 -2
- package/dist/blocks/tags/index.js +1 -1
- package/dist/blocks/tasks/index.d.ts +2 -2
- package/dist/blocks/tasks/index.js +2 -2
- package/dist/blocks/tax/index.d.ts +2 -2
- package/dist/blocks/tax/index.js +2 -2
- package/dist/blocks/teams/index.d.ts +1 -1
- package/dist/blocks/teams/index.js +1 -1
- package/dist/blocks/templates/index.d.ts +1 -1
- package/dist/blocks/templates/index.js +7 -7
- package/dist/blocks/tills/index.d.ts +1 -1
- package/dist/blocks/tills/index.js +12 -12
- package/dist/blocks/time-tracking/index.d.ts +2 -2
- package/dist/blocks/time-tracking/index.js +1 -1
- package/dist/blocks/timeline/index.d.ts +1 -1
- package/dist/blocks/timeline/index.js +1 -1
- package/dist/blocks/trash/index.d.ts +1 -1
- package/dist/blocks/trash/index.js +1 -1
- package/dist/blocks/undo/index.d.ts +2 -2
- package/dist/blocks/undo/index.js +3 -3
- package/dist/blocks/updated-at/index.d.ts +2 -2
- package/dist/blocks/updated-at/index.js +2 -2
- package/dist/blocks/usage/index.d.ts +2 -2
- package/dist/blocks/usage/index.js +3 -3
- package/dist/blocks/vercel-marketplace/index.d.ts +1 -1
- package/dist/blocks/vercel-marketplace/index.js +9 -9
- package/dist/blocks/versions/index.d.ts +1 -1
- package/dist/blocks/versions/index.js +1 -1
- package/dist/blocks/waitlist/index.d.ts +1 -1
- package/dist/blocks/waitlist/index.js +10 -10
- package/dist/blocks/warehouse/index.d.ts +1 -1
- package/dist/blocks/warehouse/index.js +12 -12
- package/dist/blocks/webhooks/index.d.ts +2 -2
- package/dist/blocks/webhooks/index.js +19 -19
- package/dist/blocks/workflow-editor/index.d.ts +4 -4
- package/dist/blocks/workflow-editor/index.js +7 -7
- package/dist/blocks/workflows/index.d.ts +4 -4
- package/dist/blocks/workflows/index.js +8 -8
- package/dist/{blocks-C_ArClZU.d.ts → blocks-EFj0duwB.d.ts} +18 -5
- package/dist/{build-k56UjnbK.js → build-OCuu29wd.js} +1 -0
- package/dist/{cache-tags-JJWT0mkn.d.ts → cache-tags-TT8h2zMg.d.ts} +1 -1
- package/dist/claims/index.d.ts +3 -3
- package/dist/cli/{account-CBDO_E5S.js → account-C1vKOJOX.js} +1 -1
- package/dist/cli/{account-D7bjOpRN.js → account-MSvhufSp.js} +1 -1
- package/dist/cli/{add-7mEozwbY.js → add-C3yGPSQS.js} +14 -14
- package/dist/cli/add-C4B2wdfz.js +1 -0
- package/dist/cli/{add-Cn03PJzF.js → add-DlucpPCL.js} +4 -4
- package/dist/cli/{app-table-files-C50U5rM-.js → app-table-files-CC5n8Si8.js} +4 -4
- package/dist/cli/{app-tables-CvY1qzV7.js → app-tables-C-Rk_GnI.js} +3 -3
- package/dist/cli/{authorization-DJkkOjjG.js → authorization-DAYgx04b.js} +3 -1
- package/dist/cli/{automations-Mx4gbtJf.js → automations-0G37FqXw.js} +1 -1
- package/dist/cli/{backfill-D8xu2ME9.js → backfill-DbqA8coR.js} +4 -4
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{blocks-C-bZ2mX9.js → blocks-BBBpNbQD.js} +1 -1
- package/dist/cli/{blocks-CFYBoQVe.js → blocks-BFlOktiM.js} +3 -3
- package/dist/cli/{cache-vvJW9h-r.js → cache-BgNWPD9a.js} +1 -1
- package/dist/cli/{codemod-CR3I3yN9.js → codemod-B4DpCiqX.js} +34 -4
- package/dist/cli/{command-CJomeJg-.js → command-CLvgELKk.js} +6 -0
- package/dist/cli/{completion-BbBXWoj-.js → completion-BrARDcFB.js} +1 -1
- package/dist/cli/{completion-CxG9ycKP.js → completion-CifzoO8f.js} +2 -2
- package/dist/cli/{completion-CN2g0Fy_.js → completion-Q1M-cdP-.js} +2 -2
- package/dist/cli/{config-CP9zs7sG.js → config-COfXd-G3.js} +1 -1
- package/dist/cli/{config-C0aclGpw.js → config-FN5Cp861.js} +30 -5
- package/dist/cli/{config-BxiYiAN6.js → config-U32Vo0h6.js} +1 -1
- package/dist/cli/{content-mapper-BPtXLD3N.js → content-mapper-BaJhpTQA.js} +2 -2
- package/dist/cli/{db-kIWj4SJu.js → db-T8u160uM.js} +3 -3
- package/dist/cli/{doctor-0vyTC81z.js → doctor-Dnq5J_p_.js} +293 -103
- package/dist/cli/env-BMQqBhS_.js +1 -0
- package/dist/cli/{env-D8ndoCoC.js → env-G6fCEgJi.js} +1 -1
- package/dist/cli/{gen-CxJYiySd.js → gen-Bf9cVgpR.js} +16 -16
- package/dist/cli/index.d.ts +18 -1
- package/dist/cli/index.js +9 -9
- package/dist/cli/{init-CHBWJGSc.js → init-_IFg5fe6.js} +11 -11
- package/dist/cli/{keys-DjNcartA.js → keys-BnVLA3NK.js} +1 -1
- package/dist/cli/{live-De6AKObd.js → live-pq1yvvsl.js} +2 -2
- package/dist/cli/{mcp-Bw7PKU4b.js → mcp-YD0Ap6ok.js} +3 -3
- package/dist/cli/{metadata-BRrfdS8c.js → metadata-CfauXPW0.js} +3 -3
- package/dist/cli/{migrate-CR7e0qjQ.js → migrate-DWCu2Nny.js} +2 -2
- package/dist/cli/{migration-safety-Cy-T3xws.js → migration-safety-rjlsDMDU.js} +3 -3
- package/dist/cli/{migrations-C6DXXH2j.js → migrations-BRCqeu8k.js} +2 -2
- package/dist/cli/{module-migration-B-VqMxE-.js → module-migration-BpptcXiB.js} +2 -2
- package/dist/cli/{moved-CC2yanOJ.js → moved-B_XzRpRE.js} +1 -1
- package/dist/cli/{parse-BaW3_Itq.js → parse-BwGYCpEv.js} +1 -1
- package/dist/cli/powersync-BejxIowk.js +1 -0
- package/dist/cli/{powersync-CK8AR-WC.js → powersync-DsbJBuTR.js} +4 -4
- package/dist/cli/{print-DnZdC-oy.js → print-A9UGTj_t.js} +2 -2
- package/dist/cli/{providers-WCZgGeBy.js → providers-MlTm8nMs.js} +2 -2
- package/dist/cli/{prune-workflows-B69exaiW.js → prune-workflows-B6sqjrR0.js} +4 -4
- package/dist/cli/{remove-8f3luaAm.js → remove-BpY-E_l4.js} +8 -8
- package/dist/cli/{render-CZw4nKPe.js → render-8qD7j0se.js} +173 -64
- package/dist/cli/{run-BEKT_kd3.js → run-CAvLtfJG.js} +2 -2
- package/dist/cli/{run-R1XanA6K.js → run-DHRA46qf.js} +53 -52
- package/dist/cli/{run-C7VeseCS.js → run-Dl1TZGsM.js} +45 -11
- package/dist/cli/{seed-Q0D1Vr2S.js → seed-BgpovbwF.js} +4 -4
- package/dist/cli/seed-CRD1tYPA.js +1 -0
- package/dist/cli/{shared-B4Lw35PY.js → shared-B77Q9x0E.js} +1 -1
- package/dist/cli/{skills-BGn6lqa3.js → skills-aC7X7bhq.js} +1 -1
- package/dist/cli/{snapshot-Cj8BlMTz.js → snapshot-_roTbSZM.js} +26 -5
- package/dist/cli/{source-D1s75o6g.js → source-BseR3sy9.js} +1 -1
- package/dist/cli/{source-args-B3Po6qsn.js → source-args-DC8snM7e.js} +1 -1
- package/dist/cli/{spec-L6nabkxl.js → spec-Ct3i4drt.js} +3 -3
- package/dist/cli/{spec-CvKK1F-_.js → spec-n6QRlBOJ.js} +1 -1
- package/dist/cli/{sql-layout-D2H2DL4t.js → sql-layout-D_fJsw3B.js} +11 -4
- package/dist/cli/{stack-DzA4tS9O.js → stack-DINh7KWu.js} +1 -1
- package/dist/cli/{sync-6b06cM1c.js → sync-DqBQi0QQ.js} +6 -6
- package/dist/cli/{table-CSiri9RG.js → table-Cup45iWj.js} +1 -1
- package/dist/cli/{upgrade-C91Jw5xZ.js → upgrade-MRqrFaO1.js} +3 -3
- package/dist/cli/{upgrade-c7oPXvNG.js → upgrade-y3Iv4wl8.js} +5 -5
- package/dist/cli/{version-_XjqP_ML.js → version-CiE6Pt0K.js} +1 -1
- package/dist/client/index.d.ts +5 -5
- package/dist/client/index.js +1 -1
- package/dist/client/native/index.d.ts +4 -4
- package/dist/client/native/index.js +1 -1
- package/dist/{composite-DuN-BnSc.js → composite-CgxTMZTK.js} +1 -1
- package/dist/{composite-B3L12SH4.d.ts → composite-CvlcYj8Y.d.ts} +4 -4
- package/dist/{composite-reads-MV2aCxBz.js → composite-reads-B99Cfmcf.js} +1 -1
- package/dist/{composite-reads-BIUJE_Rs.d.ts → composite-reads-CEI-IJ5A.d.ts} +1 -1
- package/dist/config/index.d.ts +5 -5
- package/dist/config/index.js +4 -4
- package/dist/{config-BOc24DLJ.js → config-B1m2PpjB.js} +1 -1
- package/dist/{config-7TP5XUaX.js → config-BWYT86yp.js} +3 -3
- package/dist/{context-DyXTQUb_.d.ts → context-DcHcHc2b.d.ts} +38 -4
- package/dist/contract/index.d.ts +6 -6
- package/dist/{controller-BHEUaOKo.d.ts → controller-BrTPi8Po.d.ts} +1 -1
- package/dist/{controller-o6DleXLi.js → controller-DvihM19C.js} +1 -1
- package/dist/{conversion-BBIeUsfd.d.ts → conversion-t1F0y--Y.d.ts} +1 -1
- package/dist/{copy-DurB738g.js → copy-DJBlRqH6.js} +1 -1
- package/dist/create/index.d.ts +4 -4
- package/dist/create/index.js +3 -3
- package/dist/create/lite/index.d.ts +19 -2
- package/dist/create/lite/index.js +55 -3
- package/dist/{create-blocks-C6Ty49vp.js → create-blocks-CkhSm4iX.js} +117 -5
- package/dist/credentials/index.js +4 -4
- package/dist/{db-blocks-CFqt-e4_.d.ts → db-blocks-Dp-4qbYN.d.ts} +18 -0
- package/dist/{define-C2OUEXIf.js → define-UhyrfLYX.js} +147 -100
- package/dist/{define-block-DHOCtKKS.d.ts → define-block-B2um61Uj.d.ts} +65 -6
- package/dist/{define-block-DyZiZQrx.js → define-block-D3uNVp2k.js} +1 -0
- package/dist/{drive-C2o3Xx_i.d.ts → drive-BSp7gloI.d.ts} +1 -1
- package/dist/edge/index.d.ts +5 -5
- package/dist/edge/index.js +3 -3
- package/dist/{embeddings-yvAeg_C7.js → embeddings-BamT6vln.js} +1 -1
- package/dist/{entitlements-Ckadglcj.js → entitlements-B2rEDiKh.js} +1 -1
- package/dist/{entitlements-DIVgwFPk.d.ts → entitlements-DuNBTDsH.d.ts} +1 -1
- package/dist/error-kind-Bkmljt19.js +40 -0
- package/dist/eve/index.js +1 -1
- package/dist/{event-map-DxfsFgQT.js → event-map-DLajpFiJ.js} +2 -0
- package/dist/events/index.js +1 -1
- package/dist/events-CCw0FE_F.js +25 -0
- package/dist/{executor-BN24zqcr.js → executor-Bed-RLhP.js} +3 -3
- package/dist/{executor-CTiacxbx.js → executor-DhQDDIqq.js} +1 -1
- package/dist/{executor-ClpWppJK.d.ts → executor-RNhfR91D.d.ts} +2 -2
- package/dist/expo/index.d.ts +2 -2
- package/dist/expo/index.js +2 -2
- package/dist/{extract-CrOX8i1t.d.ts → extract-DvU_lPRQ.d.ts} +1 -1
- package/dist/{field-errors-B9cPS36j.d.ts → field-errors-Mo8dzoyA.d.ts} +6 -6
- package/dist/{framework-GAR2no7D.js → framework-BfP8NwDY.js} +1 -1
- package/dist/{framework-G-kFZ_Zu.d.ts → framework-BoDTo47q.d.ts} +3 -3
- package/dist/hono/index.d.ts +4 -4
- package/dist/hono/index.js +2 -2
- package/dist/{index-OXEh0xet.d.ts → index-46Mwoxp8.d.ts} +4 -4
- package/dist/{index-70sHeLK0.d.ts → index-B2zDRJMB.d.ts} +1 -1
- package/dist/{index-Cq91CC2i.d.ts → index-BDEwjrNn.d.ts} +1 -1
- package/dist/{index-Bh-mcFvM.d.ts → index-BFw-iTQT.d.ts} +1 -1
- package/dist/{index-DS1cREWV.d.ts → index-BGje-MeF.d.ts} +1 -1
- package/dist/{index-C9rUCq13.d.ts → index-BLRLF6iG.d.ts} +1 -1
- package/dist/{index-WdVPDjby.d.ts → index-BLpP1czF.d.ts} +1 -1
- package/dist/{index-CekZhXD2.d.ts → index-BMt0EVnl.d.ts} +1 -1
- package/dist/{index-DX0AQN4S.d.ts → index-BPz1IGUB.d.ts} +1 -1
- package/dist/{index-Cu7TSSiT.d.ts → index-Bdd-8C1P.d.ts} +2 -2
- package/dist/{index-xaSPPgB7.d.ts → index-BpCBGOVF.d.ts} +3 -3
- package/dist/{index-Bl44eUq9.d.ts → index-Bxu7m8vw.d.ts} +1 -1
- package/dist/{index--qIecGmt.d.ts → index-C2ilfaOF.d.ts} +1 -1
- package/dist/{index-A9U5y90N.d.ts → index-C3pOr989.d.ts} +1 -1
- package/dist/{index-Rj_9oAEO.d.ts → index-C8-8-t1s.d.ts} +2 -2
- package/dist/{index-Dfm7cQdw.d.ts → index-CNNGDSxy.d.ts} +2 -2
- package/dist/{index--qWRLdDu.d.ts → index-CV7Ibpek.d.ts} +1 -1
- package/dist/{index-Bo_5VFCD.d.ts → index-C_Ilif3i.d.ts} +1 -1
- package/dist/{index-DOPaoauk.d.ts → index-CaMHCzBp.d.ts} +1 -1
- package/dist/{index-XhmH0QFF.d.ts → index-CnQ27iFg.d.ts} +2 -2
- package/dist/{index-DGPYJUsm.d.ts → index-DLKMzlbR.d.ts} +1 -1
- package/dist/{index-Csx1g10j.d.ts → index-DNdYTori.d.ts} +2 -2
- package/dist/{index-DXlGFVDA.d.ts → index-DTqpt8XQ.d.ts} +1 -1
- package/dist/{index-C0MuI4v1.d.ts → index-DaClvzRy.d.ts} +4 -4
- package/dist/{index-CVOgOU3Z.d.ts → index-DfuF_8Ph.d.ts} +1 -1
- package/dist/{index-DL-X_e7F.d.ts → index-Dndo_is2.d.ts} +6 -5
- package/dist/{index-DxRrnBQR.d.ts → index-ISihFGu9.d.ts} +7 -7
- package/dist/{index-Cq6sRJPI.d.ts → index-OHQg8Sdx.d.ts} +3 -3
- package/dist/{index-BU5ifSPf.d.ts → index-PeaYXjhx.d.ts} +1 -1
- package/dist/{index-AAC2eWs-.d.ts → index-TNNEpcgG.d.ts} +4 -4
- package/dist/{index-Bksw5AoY.d.ts → index-Xsu3egx_.d.ts} +20 -9
- package/dist/{index-CUS-3XG1.d.ts → index-YgUHItkp.d.ts} +1 -1
- package/dist/{index-DERMRibg.d.ts → index-Zf3t4MuL.d.ts} +17 -10
- package/dist/{index-BKsK1OFh.d.ts → index-bOWESOEm.d.ts} +2 -2
- package/dist/{index-CqtV72-L.d.ts → index-kKkGf0_-.d.ts} +3 -3
- package/dist/{index-BFCUcLda.d.ts → index-s1IQy8sK.d.ts} +2 -2
- package/dist/{index-3QwzddR3.d.ts → index-xA8WHuDE.d.ts} +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/{instances-B3gBKh8G.js → instances-CFXFHQMK.js} +2 -1
- package/dist/{knowledge-CJhz_QTb.js → knowledge-5Qz_NTXw.js} +1 -1
- package/dist/list/index.d.ts +1 -1
- package/dist/{list-query-yg-W4BlQ.d.ts → list-query-CREBmVkm.d.ts} +1 -1
- package/dist/{manifest-BoOhT_Sh.d.ts → manifest-09aHVu5Q.d.ts} +1 -1
- package/dist/{manifest-CnyT7c1s.d.ts → manifest-0PeNUYcv.d.ts} +1 -1
- package/dist/{manifest-Q9_hEoaz.js → manifest-0UcJEkVv.js} +10 -10
- package/dist/{manifest-C6Tpng5m.js → manifest-5f_9qQnw.js} +9 -9
- package/dist/{manifest-CVL8uWZM.js → manifest-8oyDNj1x.js} +10 -10
- package/dist/{manifest-BGfX8wev.js → manifest-B-GhBRkt.js} +10 -10
- package/dist/{manifest-Dy1YssHm.js → manifest-B-LuM8VG.js} +7 -7
- package/dist/{manifest-Btbo698t.js → manifest-B-wRV_0N.js} +13 -13
- package/dist/{manifest-DGWojJC1.js → manifest-B1CzCbIE.js} +13 -13
- package/dist/{manifest-DDd8ppp7.d.ts → manifest-B3RgCccj.d.ts} +1 -1
- package/dist/{manifest-vUGVlXLh.d.ts → manifest-B3YkuXKR.d.ts} +1 -1
- package/dist/{manifest-H9u744d9.js → manifest-B3b2Y84h.js} +3 -3
- package/dist/{manifest-3bD3TaDt.d.ts → manifest-B3xj3-ew.d.ts} +1 -1
- package/dist/{manifest-BO4rlrML.d.ts → manifest-B4HXWUh8.d.ts} +1 -1
- package/dist/{manifest-CAwbcrJO.d.ts → manifest-B5vPAt-u.d.ts} +1 -1
- package/dist/{manifest-xoePLm1M.js → manifest-B7-Numjr.js} +13 -13
- package/dist/{manifest-Cc3wO1KI.js → manifest-BEeu_r4Y.js} +3 -3
- package/dist/{manifest-urrijhoM.d.ts → manifest-BFXybbMn.d.ts} +1 -1
- package/dist/{manifest-BY60j47w.js → manifest-BHAaE8V8.js} +5 -5
- package/dist/{manifest-D-Cq1TTO.js → manifest-BKJXc9sY.js} +3 -3
- package/dist/{manifest-D3sWX05O.d.ts → manifest-BLOufikB.d.ts} +1 -1
- package/dist/{manifest-D_wDGSVQ.js → manifest-BNT_WDkt.js} +5 -5
- package/dist/{manifest-N4AW74PT.js → manifest-BQhSqR4D.js} +14 -14
- package/dist/{manifest-Bc10Mthq.js → manifest-BRFen7mE.js} +31 -31
- package/dist/{manifest-CS9W2n9y.js → manifest-BSaRwzEH.js} +12 -12
- package/dist/{manifest-BvTS58t8.js → manifest-BUktyXMR.js} +22 -22
- package/dist/{manifest-BHthvzO5.d.ts → manifest-BUrKk2Ww.d.ts} +1 -1
- package/dist/{manifest-BhL35Pr2.js → manifest-BVAHowRk.js} +12 -12
- package/dist/{manifest-gA_niypr.js → manifest-BWh9leJI.js} +8 -8
- package/dist/{manifest-DKZEyfK6.js → manifest-BXN6WKgs.js} +3 -3
- package/dist/{manifest-Cds0y0r4.d.ts → manifest-BYUIgwGb.d.ts} +1 -1
- package/dist/{manifest-B4E33DXF.d.ts → manifest-Bc_2t9mY.d.ts} +1 -1
- package/dist/{manifest-CQOdY5Cc.d.ts → manifest-BdcBkznK.d.ts} +1 -1
- package/dist/{manifest-CkeHPwD_.d.ts → manifest-Bg1swpdk.d.ts} +1 -1
- package/dist/{manifest-DgsbIFLv.js → manifest-BhKkBdlV.js} +11 -11
- package/dist/{manifest-D25mxZdE.js → manifest-BnFuyvL7.js} +8 -8
- package/dist/{manifest-eUnjSmkX.js → manifest-BnJqvwXA.js} +14 -14
- package/dist/{manifest-Cw3Ak4ac.js → manifest-BnmxgXet.js} +4 -4
- package/dist/{manifest-S2EhG5Gw.js → manifest-BpAI3Me7.js} +34 -34
- package/dist/{manifest-D-D1xDw2.d.ts → manifest-BpiZFLbl.d.ts} +1 -1
- package/dist/{manifest-C4oqpEqj.js → manifest-BrkF61-W.js} +8 -8
- package/dist/{manifest-Cl13wY3u.d.ts → manifest-BwYOds2o.d.ts} +1 -1
- package/dist/{manifest-B2HCw2CH.js → manifest-BwZjGHRu.js} +14 -14
- package/dist/{manifest-CiSSfthq.d.ts → manifest-Bwv273Tb.d.ts} +1 -1
- package/dist/{manifest-D6jxUviz.js → manifest-C-QxTuzM.js} +3 -3
- package/dist/{manifest-CNNWN9Rr.js → manifest-C15_YXQV.js} +3 -3
- package/dist/{manifest-C9kzPc3l.d.ts → manifest-C4CIOVkt.d.ts} +2 -2
- package/dist/{manifest-cLGmrzgW.js → manifest-C692l8af.js} +12 -12
- package/dist/{manifest-C8AENKFu.js → manifest-C8_k9anI.js} +8 -8
- package/dist/{manifest-dOdQx0hy.d.ts → manifest-C9Kn7gwK.d.ts} +1 -1
- package/dist/{manifest-Dry8RIXq.js → manifest-C9fN2qRW.js} +12 -12
- package/dist/{manifest-CM5RhlxN.js → manifest-CBFQeKg6.js} +12 -12
- package/dist/{manifest-oZ1s2HoJ.d.ts → manifest-CDK8R8Ze.d.ts} +1 -1
- package/dist/{manifest-Dsi1aOKw.d.ts → manifest-CF-LsgEw.d.ts} +1 -1
- package/dist/{manifest-CWnpnTcL.js → manifest-CF92Kiog.js} +3 -3
- package/dist/{manifest-B3VjTLRv.d.ts → manifest-CFFaunME.d.ts} +1 -1
- package/dist/{manifest-Bgx1ETpN.js → manifest-CMnr9qpi.js} +10 -10
- package/dist/{manifest-C3fDS3NG.d.ts → manifest-CNcJxi93.d.ts} +1 -1
- package/dist/{manifest-CaKD48WX.d.ts → manifest-COoFT2vY.d.ts} +1 -1
- package/dist/{manifest-CMjAfphZ.js → manifest-CQ9I_8q2.js} +8 -8
- package/dist/{manifest-Bq11rIm6.js → manifest-CScOn17C.js} +12 -12
- package/dist/{manifest-CyMaBCGq.d.ts → manifest-CW47rgqj.d.ts} +1 -1
- package/dist/{manifest-DKqcq-LB.d.ts → manifest-C_ZDkBv4.d.ts} +1 -1
- package/dist/{manifest-Cg6iafYQ.js → manifest-C__pecuF.js} +14 -14
- package/dist/{manifest-DlRpMwfK.d.ts → manifest-CaKVpJZM.d.ts} +1 -1
- package/dist/{manifest-Dv8Hfpym.d.ts → manifest-CazVMbdf.d.ts} +1 -1
- package/dist/{manifest-DpUGCrdL.d.ts → manifest-Ccn2k0vb.d.ts} +1 -1
- package/dist/{manifest-oSaeMiYm.js → manifest-Cg25x0rD.js} +11 -11
- package/dist/{manifest-D5AuRrMx.d.ts → manifest-CgCpK4Wm.d.ts} +1 -1
- package/dist/{manifest-DqVGGnLa.d.ts → manifest-CgP-MDb3.d.ts} +1 -1
- package/dist/{manifest-CBzq9IhS.d.ts → manifest-CiOcPFFy.d.ts} +1 -1
- package/dist/{manifest-DsLlJTUa.js → manifest-CmSVpPBS.js} +7 -7
- package/dist/{manifest-BQzebb6B.js → manifest-CmquAtQC.js} +8 -8
- package/dist/{manifest-BbrSRrrB.js → manifest-CnSZ16xc.js} +3 -3
- package/dist/{manifest-BDEAP2_6.d.ts → manifest-Cnb5QGMK.d.ts} +1 -1
- package/dist/{manifest-eIWKtbU-.d.ts → manifest-CnkVWwAg.d.ts} +1 -1
- package/dist/{manifest-B5JVSm7q.js → manifest-CnlgJJDS.js} +10 -10
- package/dist/{manifest-qO6Dn0Rf.js → manifest-D0DK7Gdu.js} +12 -12
- package/dist/{manifest-BYIGiQA0.d.ts → manifest-D0KUPw4L.d.ts} +1 -1
- package/dist/{manifest-D5bH3Mec.d.ts → manifest-D1-lCZro.d.ts} +1 -1
- package/dist/{manifest-BeMK5Uir.js → manifest-D1VrUJOA.js} +5 -5
- package/dist/{manifest-C0BV1Dqr.js → manifest-D3LeYpRm.js} +13 -13
- package/dist/{manifest-CTjhS3_I.js → manifest-D3To2MLR.js} +6 -6
- package/dist/{manifest-3ImEz2CE.js → manifest-D46SY8Og.js} +17 -17
- package/dist/{manifest-57rK1ngY.d.ts → manifest-D6ZukDGm.d.ts} +1 -1
- package/dist/{manifest-CoGArkb4.js → manifest-D8teMyal.js} +11 -11
- package/dist/{manifest-DA8v7QwQ.js → manifest-DAZuHpm2.js} +14 -14
- package/dist/{manifest-DFDQCoIR.d.ts → manifest-DBSs1jJ_.d.ts} +1 -1
- package/dist/{manifest-DPQ1ECvV.js → manifest-DEx8OSZK.js} +8 -8
- package/dist/{manifest-Cs_BBJMk.d.ts → manifest-DF49Pt6Q.d.ts} +1 -1
- package/dist/{manifest-nghaYPXC.js → manifest-DFoZF4CI.js} +14 -14
- package/dist/{manifest-CTH_3PQ8.js → manifest-DHfYjJMJ.js} +12 -12
- package/dist/{manifest-_5YD_7qt.js → manifest-DIC1MsM0.js} +15 -15
- package/dist/{manifest-DFhs8tTZ.js → manifest-DKthWXiw.js} +9 -9
- package/dist/{manifest-DisFKYTB.js → manifest-DLsq8M80.js} +5 -5
- package/dist/{manifest-D7zENukq.d.ts → manifest-DMTmTHBy.d.ts} +1 -1
- package/dist/{manifest-t0UobwxV.d.ts → manifest-DQwFCQkG.d.ts} +1 -1
- package/dist/{manifest-CXRuupEQ.js → manifest-DWGEzte4.js} +18 -18
- package/dist/{manifest-CMwKGDuJ.js → manifest-DWLGd0FS.js} +8 -8
- package/dist/{manifest-D9ldgISN.js → manifest-DYpXtqzm.js} +8 -8
- package/dist/{manifest-CRrS1eXB.js → manifest-DcI69zyP.js} +12 -12
- package/dist/{manifest-DpUU_GQF.d.ts → manifest-Dh3kIEzu.d.ts} +1 -1
- package/dist/{manifest-CPGq3poM.js → manifest-DiPqog2j.js} +3 -3
- package/dist/{manifest-B0PJg-oT.js → manifest-Dj7bGfoy.js} +11 -11
- package/dist/{manifest-BpCVzhPX.js → manifest-DkI--7fx.js} +14 -14
- package/dist/{manifest-B2nCtBhS.js → manifest-Dm822kx0.js} +9 -9
- package/dist/{manifest-BWuJw7AI.js → manifest-DnSvthaM.js} +10 -10
- package/dist/{manifest-CehK0epY.d.ts → manifest-DpoO491p.d.ts} +1 -1
- package/dist/{manifest-CVQW9Vcl.js → manifest-DsJukV9d.js} +18 -18
- package/dist/{manifest-BYiCfDfW.d.ts → manifest-Du_-0ruw.d.ts} +1 -1
- package/dist/{manifest-CcErLbUW.d.ts → manifest-Dvhqz3qo.d.ts} +1 -1
- package/dist/{manifest-BEE8kXlc.js → manifest-DxPMUjhY.js} +17 -17
- package/dist/{manifest-CFEY-PSe.d.ts → manifest-Dy5_Rc0q.d.ts} +1 -1
- package/dist/{manifest-BdWn7BTX.d.ts → manifest-DyZcERh_.d.ts} +1 -1
- package/dist/{manifest-DqbXAQwZ.d.ts → manifest-ETlyMx6o.d.ts} +1 -1
- package/dist/{manifest-Cu1zCdXg.js → manifest-EcWk4ytT.js} +9 -9
- package/dist/{manifest-CPecIPI5.js → manifest-EwHcMCiW.js} +4 -4
- package/dist/{manifest-amQk8j7Y.js → manifest-FXQp4dob.js} +13 -13
- package/dist/{manifest-Y1Z5L2T3.js → manifest-Gi6V1g3E.js} +12 -12
- package/dist/{manifest-e7ZbaKYF.js → manifest-H65OlXiB.js} +15 -15
- package/dist/{manifest-DyjQZh7Z.js → manifest-IZ9GQI7f.js} +13 -13
- package/dist/{manifest-Hm1-O138.d.ts → manifest-JdAQqp5w.d.ts} +3 -3
- package/dist/{manifest-D8iIf1Kb.js → manifest-Lasq6DPg.js} +10 -10
- package/dist/{manifest-0F7lof-8.d.ts → manifest-Lsz6rH3B.d.ts} +1 -1
- package/dist/{manifest-DSGLUrYq.js → manifest-MTW4mY5N.js} +10 -10
- package/dist/{manifest-B_6NoKFg.d.ts → manifest-RAijfop2.d.ts} +1 -1
- package/dist/{manifest-DAxxMf9a.js → manifest-X24lr5XH.js} +3 -3
- package/dist/{manifest-Hr6MyREb.d.ts → manifest-XZV2sKgk.d.ts} +1 -1
- package/dist/{manifest-BLnVv55R.js → manifest-YB3ZtXEb.js} +11 -11
- package/dist/{manifest-gSko__Wn.d.ts → manifest-a0YxYgo0.d.ts} +1 -1
- package/dist/{manifest-CgMNtyTZ.d.ts → manifest-aJOA6D9w.d.ts} +1 -1
- package/dist/{manifest-CwJZGhJ8.d.ts → manifest-c8mlNzOv.d.ts} +1 -1
- package/dist/{manifest-KUbi4IKj.d.ts → manifest-dLThrKqV.d.ts} +1 -1
- package/dist/{manifest-Bde5xCaP.d.ts → manifest-dlqXYOfB.d.ts} +1 -1
- package/dist/{manifest-BUFE6Vda.js → manifest-jLh9Rwsh.js} +11 -11
- package/dist/{manifest-iKyF53SI.d.ts → manifest-jb384ocG.d.ts} +1 -1
- package/dist/{manifest-DBu84LST.d.ts → manifest-jiaWr0x4.d.ts} +1 -1
- package/dist/{manifest-t-8upuXv.js → manifest-kZCtkWqj.js} +9 -9
- package/dist/{manifest-BGhS_IRb.js → manifest-kbSJq3sR.js} +17 -17
- package/dist/{manifest-oVRDNj7t.d.ts → manifest-pLJIrNwi.d.ts} +1 -1
- package/dist/{manifest-DlK0gus-.js → manifest-rHukkAIC.js} +16 -16
- package/dist/{manifest-NSNQGS0I.js → manifest-wlx1-yvJ.js} +5 -5
- package/dist/{manifest-BUvqSThC.d.ts → manifest-xAeOKTub.d.ts} +3 -3
- package/dist/{manifest-CbXBkXqf.d.ts → manifest-y2y5xPQC.d.ts} +1 -1
- package/dist/{manifest-MleiBHu4.js → manifest-yLshQDXw.js} +6 -6
- package/dist/mapper/bin.js +6 -6
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/sdk/index.d.ts +2 -2
- package/dist/mcp/sdk/index.js +1 -1
- package/dist/{mcp-DAJ7WsQb.js → mcp-Cu-bD9KQ.js} +1 -1
- package/dist/next/client/index.d.ts +1 -1
- package/dist/next/index.d.ts +92 -35
- package/dist/next/index.js +123 -44
- package/dist/{operations-Cqx3ghVP.d.ts → operations-_3oh-CEO.d.ts} +1 -1
- package/dist/{options-PM7IaIFP.js → options-B1rQBo1M.js} +4 -1
- package/dist/orpc/index.d.ts +4 -4
- package/dist/orpc/index.js +1 -1
- package/dist/otel/index.js +4 -4
- package/dist/{parse-B1g9TF99.js → parse-BRW-aTQQ.js} +1 -1
- package/dist/{payroll-export-CrEznq6i.js → payroll-export-CNji28TX.js} +1 -1
- package/dist/{permissions-cKhOwOuj.d.ts → permissions-u_qqedin.d.ts} +1 -1
- package/dist/{ports-DEC5OfLy.js → ports-BhCn6uGk.js} +1 -1
- package/dist/{ports-zqXSEoFP.d.ts → ports-DT5zRdYx.d.ts} +1 -1
- package/dist/postgres/index.js +2 -2
- package/dist/{postgrest-executor-DaDNeFDr.js → postgrest-executor-BMNA_O9-.js} +1 -1
- package/dist/powersync/index.d.ts +3 -3
- package/dist/powersync/index.js +1 -1
- package/dist/preset/index.d.ts +4 -4
- package/dist/preset/index.js +3 -3
- package/dist/{preset-BILsEo24.js → preset--1OMwypM.js} +4 -3
- package/dist/{preview-DN0JKESa.d.ts → preview-BBA-VaEZ.d.ts} +2 -2
- package/dist/{preview-DsrEvLWG.js → preview-Bd7ZBtf2.js} +2 -2
- package/dist/{project-C23WlGy4.js → project-BhE6_64F.js} +5 -5
- package/dist/{push-token-DZACGqYX.d.ts → push-token-hs6_Vt-I.d.ts} +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/query/index.js +1 -1
- package/dist/rate-limit/index.js +1 -1
- package/dist/{rate-limit-DSOwe_Re.js → rate-limit-ruAG2w45.js} +1 -1
- package/dist/react/index.d.ts +6 -6
- package/dist/react/index.js +2 -2
- package/dist/react/native/index.d.ts +1 -1
- package/dist/react/server.d.ts +10 -6
- package/dist/react/server.js +6 -2
- package/dist/{react-oftUdRLD.js → react-olMpD8et.js} +31 -24
- package/dist/react-router/index.d.ts +3 -3
- package/dist/react-router/index.js +2 -2
- package/dist/{read-set-Vqn_XdqV.js → read-set-4EsAPjII.js} +2 -1
- package/dist/realtime/index.d.ts +3 -3
- package/dist/realtime/index.js +1 -1
- package/dist/{record-form-S1-QnCI_.d.ts → record-form-Cze5j1OB.d.ts} +1 -1
- package/dist/{record-type-uD8JMf0g.js → record-type-BPUobukL.js} +1 -0
- package/dist/records/index.d.ts +7 -7
- package/dist/records/index.js +3 -3
- package/dist/{resource-execute-y2wGRwTn.d.ts → resource-execute-D2cJfrKu.d.ts} +1 -1
- package/dist/{resource-types-B8ocsWgZ.d.ts → resource-types-Cs1zWvrn.d.ts} +1 -1
- package/dist/{resources-DS3fQtwv.d.ts → resources-DyP9cP9i.d.ts} +1 -1
- package/dist/{sales-DKOs8F12.js → sales-BCArDSEX.js} +9 -9
- package/dist/{scores-Dfes6BDr.js → scores-D3fvLQGX.js} +1 -1
- package/dist/server/index.d.ts +13 -13
- package/dist/server/index.js +9 -9
- package/dist/{server-types-CXNFIjFU.d.ts → server-types-Bpxk5UWh.d.ts} +32 -10
- package/dist/{session-CDkvmd52.d.ts → session-DQ5huqEw.d.ts} +2 -2
- package/dist/{session-status-PE2_AdYA.d.ts → session-status-DDPrDS36.d.ts} +1 -1
- package/dist/{settings-CqhQrT3a.js → settings-DhzIPgTN.js} +1 -1
- package/dist/{shared-B0clSLXG.js → shared-BTf7Qrnk.js} +1 -1
- package/dist/{sign-in-BRT-0QYF.js → sign-in-03gtm616.js} +34 -9
- package/dist/{signing-keys-hgspu0oB.js → signing-keys-sEdfxGbZ.js} +1 -1
- package/dist/solid/index.d.ts +13 -6
- package/dist/solid/index.js +10 -3
- package/dist/solid-start/index.d.ts +3 -3
- package/dist/solid-start/index.js +2 -2
- package/dist/spec/index.d.ts +1 -1
- package/dist/{spec-CGD_BzCF.js → spec-BSc8n34a.js} +1 -1
- package/dist/sql/index.d.ts +5 -5
- package/dist/sql/index.js +3 -3
- package/dist/{sql-DUonzxhb.js → sql-B0t41P1F.js} +2 -2
- package/dist/{sql-DWsHDJ3c.js → sql-BVUbNexh.js} +581 -242
- package/dist/sqlite/index.d.ts +1 -1
- package/dist/sqlite/index.js +1 -1
- package/dist/{sso-CSfrymeX.js → sso-fXXdjhyz.js} +1 -1
- package/dist/ssr/index.d.ts +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/{support-DLms-JZd.d.ts → support-tDhEwXbu.d.ts} +18 -9
- package/dist/svelte/index.d.ts +13 -6
- package/dist/svelte/index.js +10 -3
- package/dist/sveltekit/index.d.ts +4 -4
- package/dist/sveltekit/index.js +2 -2
- package/dist/{tags-BGwWAMVB.d.ts → tags-CBASI98_.d.ts} +1 -1
- package/dist/tanstack-db/index.d.ts +1 -1
- package/dist/tanstack-start/index.d.ts +3 -3
- package/dist/tanstack-start/index.js +2 -2
- package/dist/{tenant-DNoe5dUa.d.ts → tenant-c_6qMyFI.d.ts} +1 -1
- package/dist/testing/index.d.ts +111 -10
- package/dist/testing/index.js +217 -7
- package/dist/{timeline-Dy099qKD.d.ts → timeline-DvZ7C5zf.d.ts} +3 -3
- package/dist/{topic-CqSqDnjb.js → topic-CW7sraaQ.js} +1 -1
- package/dist/{topic-EkhjfSPH.d.ts → topic-fwPlelNI.d.ts} +2 -2
- package/dist/{types-CkLE9lwr.d.ts → types-Cwai2qe4.d.ts} +2 -2
- package/dist/{undo-CnWDmntn.js → undo-DhLhQlyY.js} +1 -1
- package/dist/{verify-Dh2MQQze.d.ts → verify-CupKPoHW.d.ts} +1 -1
- package/dist/vue/index.d.ts +13 -6
- package/dist/vue/index.js +10 -3
- package/dist/{watch-topic-B4eLrVUl.d.ts → watch-topic-D4AzYs9E.d.ts} +1 -1
- package/dist/{webhook-inbox-_7ApdH2q.js → webhook-inbox-TA5H3ti3.js} +1 -1
- package/dist/webmcp/index.d.ts +1 -1
- package/dist/webmcp/index.js +1 -1
- package/dist/yjs/index.d.ts +1 -1
- package/dist/yjs/index.js +1 -1
- package/package.json +1 -1
- package/schemas/config-v1.json +89 -0
- package/schemas/doctor-report-v1.json +12 -0
- package/skills/better-supabase/references/ui-recipes.md +13 -13
- package/dist/cli/add-TZa-GEt2.js +0 -1
- package/dist/cli/env-DWtI_scC.js +0 -1
- package/dist/cli/powersync-DfiIdCgd.js +0 -1
- package/dist/cli/seed-DsoWExFu.js +0 -1
- package/dist/events-BRKIxVQD.js +0 -25
- package/dist/cli/{orphans-CPcR85QN.js → orphans-ByB0gKOp.js} +1 -1
|
@@ -2,22 +2,22 @@ import { n as isRecord$1 } from "./guards-CsRa6v57.js";
|
|
|
2
2
|
import { d as temporalText } from "./temporal-DKTdGK9i.js";
|
|
3
3
|
import { r as NEGATIVE, t as FILTER_OPERATORS } from "./filter-query-Ds7Z6lgZ.js";
|
|
4
4
|
import { a as ok } from "./result-DrBaeIVt.js";
|
|
5
|
-
import { a as hasPlaceholder, l as splitPlaceholders, r as containsPlaceholder, s as placeholderOf } from "./read-set-
|
|
6
|
-
import { r as isFunctionSpec } from "./spec-
|
|
5
|
+
import { a as hasPlaceholder, l as splitPlaceholders, r as containsPlaceholder, s as placeholderOf } from "./read-set-4EsAPjII.js";
|
|
6
|
+
import { r as isFunctionSpec } from "./spec-BSc8n34a.js";
|
|
7
7
|
import { a as OPERATION_RENAMES, c as PROGRAM_EVENT_MOVES, f as configuredAction, g as isOldPermissionKey, i as EVENT_TYPE_SPLITS, m as currentPermissionKeys, o as PERMISSION_KEY_RENAMES, p as currentEventTypes, r as EVENT_TYPE_RENAMES, s as PERMISSION_KEY_SPLITS, t as ENTITY_KEY_RENAMES, u as SUBJECT_TYPE_RENAMES } from "./renames-PnqMkqit.js";
|
|
8
8
|
import { t as SPEC_PINS } from "./spec-pins-Dlz8OVqi.js";
|
|
9
|
-
import { _ as resolveJsonSchema, a as blockFormerSubjectTypes, d as freesTableName, f as tableBase, g as clientFunctions, h as resolveNames, l as blockColumnName, m as entityType, p as tableMoves, s as installedBlockSubjects, u as columnRenamer, v as CONFIG_DEFAULTS } from "./block-subjects-
|
|
9
|
+
import { _ as resolveJsonSchema, a as blockFormerSubjectTypes, d as freesTableName, f as tableBase, g as clientFunctions, h as resolveNames, l as blockColumnName, m as entityType, p as tableMoves, s as installedBlockSubjects, u as columnRenamer, v as CONFIG_DEFAULTS } from "./block-subjects-Cvd-RaMY.js";
|
|
10
10
|
import { t as DEFAULT_CLAIMS } from "./claims-CqTr_N1n.js";
|
|
11
11
|
import { o as tenantNames, r as composeNames } from "./entity-naming-BES3pkQI.js";
|
|
12
|
-
import { B as resolveBlock, C as columnsWithAccess, E as hiddenColumns, I as PRESET_CATALOG, L as BLOCK_SCOPES, N as createdFromLink, P as link, S as hasComputed, T as hasColumnAccess, V as tenantNameOf, a as isRenamedInstance, g as appTableVersions, i as instancePrefix, l as APP_RANK_COLUMN, m as appTableEventKinds, s as APP_DELETED_AT_COLUMN, w as encryptedColumns, y as lookupColumn } from "./instances-
|
|
12
|
+
import { B as resolveBlock, C as columnsWithAccess, E as hiddenColumns, I as PRESET_CATALOG, L as BLOCK_SCOPES, N as createdFromLink, P as link, S as hasComputed, T as hasColumnAccess, V as tenantNameOf, a as isRenamedInstance, g as appTableVersions, i as instancePrefix, l as APP_RANK_COLUMN, m as appTableEventKinds, s as APP_DELETED_AT_COLUMN, w as encryptedColumns, y as lookupColumn } from "./instances-CFXFHQMK.js";
|
|
13
13
|
import { i as FIELD_FORMATS, n as CUSTOM_FIELD_FORM_TYPES, o as FIELD_FORMAT_VALIDATORS, r as CUSTOM_FIELD_TYPES, s as RATING_BOUNDS, t as CUSTOM_FIELD_CHECKED_FORMATS } from "./field-formats-sLYMh1ZK.js";
|
|
14
14
|
import { t as isSqlType } from "./sql-type-XWMeZRAl.js";
|
|
15
15
|
import { a as sqlString, i as sqlIdent$1 } from "./template-1e2akYYK.js";
|
|
16
|
-
import { i as fillTemplate, u as templatePlaceholders } from "./access-sql-
|
|
16
|
+
import { i as fillTemplate, u as templatePlaceholders } from "./access-sql-DH2LbcQe.js";
|
|
17
17
|
import { a as readGrants, c as renderPolicy, i as policy$1, n as closingParen$1, o as readPolicies, r as maskSql, s as readPolicy$6, t as catalogPolicy } from "./policy-B9UWDXMF.js";
|
|
18
18
|
import { t as MAX_BATCH$1 } from "./batch-limit-DqQ3d6op.js";
|
|
19
19
|
import { $ as updateExtraColumns, A as membershipDisabledAt, B as registerPartitions, C as extraFieldsJson, D as jwtClaim, E as jsonSchemaChecks, F as pageSize, G as serviceGrant, H as replaceColumnCheck, I as quotedTable, J as shortHash, K as serviceOnly$1, L as raise$1, M as notNullCheckName, N as organizationMissing, O as lockTable, P as ownRowPolicies, Q as triggerGrant, R as readLine, S as extraFieldsArg, T as insertExtraColumns, U as revokeTable, V as renameSql, W as schemaPreamble, X as transitionActorSql, Y as splitTable$1, Z as transitionReasonSql, _ as defaultPartitionName, a as SCHEMA$6, b as dropExpiredPartitions, c as activeMembership, d as addForeignKey, et as updatedAt, f as addNotNullCheck, g as defaultPartition, h as columnsObject, i as PARTITION_VARIABLES, j as membershipSuspended, k as memberAddedRecord, l as addCheck, m as columnRef, n as MONTHLY_PARTITIONS, nt as withExtraFields, o as SERVICE_CALLER$1, p as batchFunction, q as sha256HexSql, r as NOTHING, rt as writeExtraColumns, s as accessDefinesDisabledHelpers, t as EQUIVALENT_TRIGGERS, tt as userGrant, u as addExtraColumns, v as disabledHelpers, w as fail$1, x as ensureCheck, y as disabledHelpersNeedLaterTables, z as recordTrigger } from "./shared-DwShIqeQ.js";
|
|
20
|
-
import { $ as qualifiedTable$2, A as editableContracts, B as entryEnded, C as leaveOwner, D as recordOwner, E as ownerIsEmployee, F as splitName, G as boundSubjectMatch, H as lockedColumns, I as feedOptions, J as liveShareLink, K as boundSubjects$1, L as feedWindow, M as majorSalary, N as overlappingContracts, O as FLAT_DETAILS, P as reportsMoveUp, Q as onSettings, R as byEmployee, S as leaveConfidentialReader, T as leavePartsMapped, U as timeOwner, V as entrySubjects, W as boundRowSubject, X as touchShareLink, Y as shareLinkRow, Z as andSubjectAction, _ as leaveBalancesTable, a as leaveEndPart, at as subjectTableBindings, b as leaveConfidentialFilter, c as leavePartial, ct as payrollExportSqlOptions, d as leaveTeamFeedSubject, dt as withColumnTypeFunction, et as subjectAccess, f as leaveTypeKey, g as leaveAutoApproveMapped, h as leaveAutoApprove, it as subjectReadable, j as flatDetails, k as denyOverlaps, l as leaveRequestUser, lt as asColumnType, m as halfDays, nt as subjectCascades, o as leaveFeed, ot as subjectTypeGuard, p as dropSignatures, q as SHARE_LINKS, rt as subjectIdMatches, s as leaveFeedSubject, st as subjectsOption, t as PAYROLL_EXPORT, tt as subjectActionCheck, u as leaveStartPart, ut as tryColumnType, v as leaveByEmployee, w as leaveParts, x as leaveConfidentialKey, y as leaveConfidential, z as durationEntries } from "./payroll-export-
|
|
20
|
+
import { $ as qualifiedTable$2, A as editableContracts, B as entryEnded, C as leaveOwner, D as recordOwner, E as ownerIsEmployee, F as splitName, G as boundSubjectMatch, H as lockedColumns, I as feedOptions, J as liveShareLink, K as boundSubjects$1, L as feedWindow, M as majorSalary, N as overlappingContracts, O as FLAT_DETAILS, P as reportsMoveUp, Q as onSettings, R as byEmployee, S as leaveConfidentialReader, T as leavePartsMapped, U as timeOwner, V as entrySubjects, W as boundRowSubject, X as touchShareLink, Y as shareLinkRow, Z as andSubjectAction, _ as leaveBalancesTable, a as leaveEndPart, at as subjectTableBindings, b as leaveConfidentialFilter, c as leavePartial, ct as payrollExportSqlOptions, d as leaveTeamFeedSubject, dt as withColumnTypeFunction, et as subjectAccess, f as leaveTypeKey, g as leaveAutoApproveMapped, h as leaveAutoApprove, it as subjectReadable, j as flatDetails, k as denyOverlaps, l as leaveRequestUser, lt as asColumnType, m as halfDays, nt as subjectCascades, o as leaveFeed, ot as subjectTypeGuard, p as dropSignatures, q as SHARE_LINKS, rt as subjectIdMatches, s as leaveFeedSubject, st as subjectsOption, t as PAYROLL_EXPORT, tt as subjectActionCheck, u as leaveStartPart, ut as tryColumnType, v as leaveByEmployee, w as leaveParts, x as leaveConfidentialKey, y as leaveConfidential, z as durationEntries } from "./payroll-export-CNji28TX.js";
|
|
21
21
|
import { n as blockOptions, r as option, t as NO_OPTIONS } from "./options-Z-bd_H1E.js";
|
|
22
22
|
import { t as accessRequestsSqlOptions } from "./options-Cl7lLI30.js";
|
|
23
23
|
import { t as accountingSqlOptions } from "./options-C3FFnaE-.js";
|
|
@@ -31,7 +31,7 @@ import { t as aiGuardrailsSqlOptions } from "./options-feqG502e.js";
|
|
|
31
31
|
import { t as aiKeysSqlOptions } from "./options-DQkhhBLy.js";
|
|
32
32
|
import { t as aiSchedulesSqlOptions } from "./options-BgCS5ODi.js";
|
|
33
33
|
import { t as announcementsSqlOptions } from "./options-Bs2dC-at.js";
|
|
34
|
-
import { t as apiKeysSqlOptions } from "./options-
|
|
34
|
+
import { t as apiKeysSqlOptions } from "./options-B1rQBo1M.js";
|
|
35
35
|
import { t as approvalsSqlOptions } from "./options-DLJTiX29.js";
|
|
36
36
|
import { t as assetsSqlOptions } from "./options-BLn1PFyu.js";
|
|
37
37
|
import { t as attachmentsSqlOptions } from "./options-B_26uE3i.js";
|
|
@@ -179,7 +179,7 @@ import { i as TILL_SESSION_STATUSES, n as TILL_MOVEMENT_INFLOWS, r as TILL_MOVEM
|
|
|
179
179
|
import { n as PICK_LIST_STATUSES, r as PICK_WAVE_STATUSES, t as PICK_LINE_STATUSES } from "./warehouse-values-CyoqvWRp.js";
|
|
180
180
|
import { n as WORKFLOW_SDK_WORLD } from "./workflow-sdk-C-rVKZTS.js";
|
|
181
181
|
import { s as permissionMatches } from "./delegation-D0IcjvtS.js";
|
|
182
|
-
import { n as quoteIdent, t as compileSql } from "./sql-
|
|
182
|
+
import { n as quoteIdent, t as compileSql } from "./sql-B0t41P1F.js";
|
|
183
183
|
// src/sql/actor-guard.ts
|
|
184
184
|
/**
|
|
185
185
|
* Functions granted to `authenticated` that write, but a read-only support or
|
|
@@ -435,10 +435,14 @@ function signatures(sql, schema) {
|
|
|
435
435
|
const rest = sql.slice(close + 1);
|
|
436
436
|
const returns = /^\s*returns\s+([\s\S]*?)\n(?=\s*(?:language|stable|volatile|immutable|security|set|as|strict|parallel|cost|rows)\b)/i.exec(rest);
|
|
437
437
|
if (!returns) continue;
|
|
438
|
+
const header = /^[\s\S]*?\n\s*as\s+(?:\$|')/i.exec(rest)?.[0] ?? "";
|
|
439
|
+
const declared = /\n\s*(?:language\s+\w+\s+)?(stable|immutable)\b/i.exec(header)?.[1]?.toLowerCase();
|
|
440
|
+
const volatility = declared === "stable" || declared === "immutable" ? declared : void 0;
|
|
438
441
|
found.push({
|
|
439
442
|
name: match[1] ?? match[2],
|
|
440
443
|
args: splitTopLevel$1(sql.slice(open + 1, close)).map(argument$1),
|
|
441
|
-
returns: returns[1].trim()
|
|
444
|
+
returns: returns[1].trim(),
|
|
445
|
+
...volatility === void 0 ? {} : { volatility }
|
|
442
446
|
});
|
|
443
447
|
}
|
|
444
448
|
return found;
|
|
@@ -474,7 +478,7 @@ function wrapper(signature, source, api, grant) {
|
|
|
474
478
|
const revoked = ["public", ...[...API_ROLES].filter((role) => !grant.roles.includes(role))].join(", ");
|
|
475
479
|
return `create or replace function ${target}(${signature.args.map((arg) => arg.declaration).join(", ")})
|
|
476
480
|
returns ${signature.returns}
|
|
477
|
-
language sql
|
|
481
|
+
language sql${signature.volatility === void 0 ? "" : `\n${signature.volatility}`}
|
|
478
482
|
security invoker
|
|
479
483
|
set search_path = ''
|
|
480
484
|
as $$ select ${set ? "* from " : ""}${call} $$;
|
|
@@ -2889,7 +2893,7 @@ function withProviderDefaults(layout) {
|
|
|
2889
2893
|
* to `null`, with the required columns they lack.
|
|
2890
2894
|
*/
|
|
2891
2895
|
function viewColumnsOf(layout) {
|
|
2892
|
-
return viewColumns(layout, withProviderRoles(layout, withProviderSuspension(layout)), (module) => registry$1().modules[module]?.names);
|
|
2896
|
+
return viewColumns(layout, withProviderPlatformRoles(layout, withProviderDisabledAt(layout, withProviderRoles(layout, withProviderSuspension(layout)))), (module) => registry$1().modules[module]?.names);
|
|
2893
2897
|
}
|
|
2894
2898
|
/**
|
|
2895
2899
|
* `blocks.permissions.disabled` from the provider's `suspension` under the
|
|
@@ -2915,6 +2919,52 @@ function withProviderSuspension(layout) {
|
|
|
2915
2919
|
}
|
|
2916
2920
|
};
|
|
2917
2921
|
}
|
|
2922
|
+
/**
|
|
2923
|
+
* `blocks.memberships.columns.memberships.disabledAt` from the provider's
|
|
2924
|
+
* membership table, unless the config maps it.
|
|
2925
|
+
*/
|
|
2926
|
+
function withProviderDisabledAt(layout, modules) {
|
|
2927
|
+
const members = layout.accessProvider?.memberships;
|
|
2928
|
+
const tenant = modules?.["memberships"];
|
|
2929
|
+
if (!modules || !members || tenant === void 0 || tenant.mode === "custom" || tenant.columns?.["memberships"]?.["disabledAt"] !== void 0) return modules;
|
|
2930
|
+
const mapped = tenant.tables?.["memberships"];
|
|
2931
|
+
if (typeof mapped !== "string") return modules;
|
|
2932
|
+
const table = mapped.includes(".") ? mapped : `${tenant.schema ?? "better_supabase"}.${mapped}`;
|
|
2933
|
+
const disabledAt = members.find((entry) => entry.table === table)?.disabledAt;
|
|
2934
|
+
if (disabledAt === void 0 || layout.ownTables?.[table] === void 0) return modules;
|
|
2935
|
+
return {
|
|
2936
|
+
...modules,
|
|
2937
|
+
memberships: {
|
|
2938
|
+
...tenant,
|
|
2939
|
+
columns: {
|
|
2940
|
+
...tenant.columns,
|
|
2941
|
+
memberships: {
|
|
2942
|
+
...tenant.columns?.["memberships"],
|
|
2943
|
+
disabledAt
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
};
|
|
2948
|
+
}
|
|
2949
|
+
/**
|
|
2950
|
+
* `blocks.invitations.options.platformRoles` from the provider's
|
|
2951
|
+
* `platformRoles` under the `provider` model, unless the config sets it.
|
|
2952
|
+
*/
|
|
2953
|
+
function withProviderPlatformRoles(layout, modules) {
|
|
2954
|
+
const platform = layout.accessProvider?.platformRoles;
|
|
2955
|
+
const invitations = modules?.["invitations"];
|
|
2956
|
+
if (!modules || !platform || modules.permissions?.model !== "provider" || invitations === void 0 || invitations.mode === "custom" || invitations.options?.["platformRoles"] !== void 0) return modules;
|
|
2957
|
+
return {
|
|
2958
|
+
...modules,
|
|
2959
|
+
invitations: {
|
|
2960
|
+
...invitations,
|
|
2961
|
+
options: {
|
|
2962
|
+
...invitations.options,
|
|
2963
|
+
platformRoles: platform
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
};
|
|
2967
|
+
}
|
|
2918
2968
|
function withProviderRoles(layout, modules) {
|
|
2919
2969
|
const sources = layout.accessProvider?.roleSources;
|
|
2920
2970
|
const tenant = modules?.["memberships"];
|
|
@@ -17463,6 +17513,31 @@ ${lockTable(t.harness)}
|
|
|
17463
17513
|
-- service role reads it, through load_ai_harness_session.
|
|
17464
17514
|
drop policy if exists ai_harness_sessions_owner_read on ${t.harness};`;
|
|
17465
17515
|
}
|
|
17516
|
+
// src/sql/memo.ts
|
|
17517
|
+
/**
|
|
17518
|
+
* A memo for one transaction, over a transaction-local setting. PostgREST runs
|
|
17519
|
+
* one request in one transaction, so a policy helper can compute a value once
|
|
17520
|
+
* and every later call in the statement reads it (ADR 0230). The empty string
|
|
17521
|
+
* reads as unset.
|
|
17522
|
+
*/
|
|
17523
|
+
const MEMO_FUNCTIONS = `
|
|
17524
|
+
create or replace function better_supabase.memo_get(key text)
|
|
17525
|
+
returns text
|
|
17526
|
+
language sql
|
|
17527
|
+
volatile
|
|
17528
|
+
set search_path = ''
|
|
17529
|
+
as $$
|
|
17530
|
+
select nullif(pg_catalog.current_setting('better_supabase.memo.' || key, true), '')
|
|
17531
|
+
$$;
|
|
17532
|
+
|
|
17533
|
+
create or replace function better_supabase.memo_set(key text, value text)
|
|
17534
|
+
returns text
|
|
17535
|
+
language sql
|
|
17536
|
+
volatile
|
|
17537
|
+
set search_path = ''
|
|
17538
|
+
as $$
|
|
17539
|
+
select pg_catalog.set_config('better_supabase.memo.' || key, value, true)
|
|
17540
|
+
$$;`;
|
|
17466
17541
|
// src/sql/modules/approvals-items.ts
|
|
17467
17542
|
/** The most items one request carries. */
|
|
17468
17543
|
const MAX_ITEMS = 200;
|
|
@@ -19168,6 +19243,51 @@ $$;
|
|
|
19168
19243
|
revoke execute on function ${fn("approval_settle")}(text, text, text, text, uuid, text) from public, anon, authenticated;
|
|
19169
19244
|
`;
|
|
19170
19245
|
}
|
|
19246
|
+
// src/sql/modules/approvals-tests.ts
|
|
19247
|
+
/**
|
|
19248
|
+
* Checks that `approval_eligible_ids()` returns the pending requests
|
|
19249
|
+
* `approval_eligible` accepts, for each user of the database in turn.
|
|
19250
|
+
*/
|
|
19251
|
+
function approvalTests(ctx) {
|
|
19252
|
+
const requests = ctx.table("requests");
|
|
19253
|
+
const id = ctx.col("requests", "id");
|
|
19254
|
+
return [{
|
|
19255
|
+
name: "eligible_ids",
|
|
19256
|
+
sql: `begin;
|
|
19257
|
+
create extension if not exists pgtap with schema extensions;
|
|
19258
|
+
select extensions.plan(1);
|
|
19259
|
+
|
|
19260
|
+
do $$
|
|
19261
|
+
declare
|
|
19262
|
+
u record;
|
|
19263
|
+
bad bigint := 0;
|
|
19264
|
+
begin
|
|
19265
|
+
for u in select a.id from auth.users a order by a.id limit 25 loop
|
|
19266
|
+
perform set_config('request.jwt.claims', jsonb_build_object('sub', u.id, 'role', 'authenticated')::text, true);
|
|
19267
|
+
if (
|
|
19268
|
+
select coalesce(array_agg(r.${id} order by r.${id}), '{}') from ${requests} r
|
|
19269
|
+
where r.${ctx.col("requests", "status")} = 'pending' and ${ctx.fn("approval_eligible")}(r.${id})
|
|
19270
|
+
) is distinct from (
|
|
19271
|
+
select coalesce(array_agg(x order by x), '{}') from ${ctx.fn("approval_eligible_ids")}() x
|
|
19272
|
+
) then
|
|
19273
|
+
bad := bad + 1;
|
|
19274
|
+
end if;
|
|
19275
|
+
end loop;
|
|
19276
|
+
perform set_config('request.jwt.claims', '', true);
|
|
19277
|
+
perform set_config('bsb.parity', bad::text, true);
|
|
19278
|
+
end;
|
|
19279
|
+
$$;
|
|
19280
|
+
|
|
19281
|
+
select extensions.is(
|
|
19282
|
+
current_setting('bsb.parity')::bigint,
|
|
19283
|
+
0::bigint,
|
|
19284
|
+
'approval_eligible_ids returns the pending requests approval_eligible accepts, for every user'
|
|
19285
|
+
);
|
|
19286
|
+
|
|
19287
|
+
select * from extensions.finish();
|
|
19288
|
+
rollback;`
|
|
19289
|
+
}];
|
|
19290
|
+
}
|
|
19171
19291
|
// src/sql/modules/approver.ts
|
|
19172
19292
|
/** The `{kind}` of an AI tool call that waits for approval. */
|
|
19173
19293
|
const AI_TOOL_APPROVAL = "ai-tool";
|
|
@@ -23182,7 +23302,7 @@ function build$144(ctx, layout) {
|
|
|
23182
23302
|
select t.id::text from ${memberIdsFor("delegate_approval.to_user")} as t(id)
|
|
23183
23303
|
)`;
|
|
23184
23304
|
const teams = ctx.installed("teams") && ctx.of("teams").mode !== "custom" ? ctx.of("teams") : void 0;
|
|
23185
|
-
const teamMatch = (member) => teams === void 0 ? "false" : `exists (select 1 from ${teams.table("members")} tm where tm.${teams.col("members", "team")}::text =
|
|
23305
|
+
const teamMatch = (member, team) => teams === void 0 ? "false" : `exists (select 1 from ${teams.table("members")} tm where tm.${teams.col("members", "team")}::text = ${team} and tm.${teams.col("members", "user")} = ${member})`;
|
|
23186
23306
|
const teamMembers = teams === void 0 ? "" : `
|
|
23187
23307
|
union
|
|
23188
23308
|
select tm.${teams.col("members", "user")} from ${teams.table("members")} tm
|
|
@@ -23192,19 +23312,34 @@ function build$144(ctx, layout) {
|
|
|
23192
23312
|
const managerMember = manager === void 0 ? "" : `
|
|
23193
23313
|
union
|
|
23194
23314
|
select ${manager} where coalesce((v_approvers ->> 'manager')::boolean, false)`;
|
|
23195
|
-
const
|
|
23196
|
-
|
|
23197
|
-
|
|
23315
|
+
const factTenant = "approval_fact.tenant";
|
|
23316
|
+
const factValue = "approval_fact.value";
|
|
23317
|
+
const permissionMatch = tenantless ? `case when v_req.${c("tenant")} is null then ${ctx.staff("v_approvers ->> 'permission'")} else ${ctx.can("tenant", `v_req.${c("tenant")}`, "v_approvers ->> 'permission'")} end` : ctx.can("tenant", `v_req.${c("tenant")}`, "v_approvers ->> 'permission'");
|
|
23318
|
+
const roleFact = `exists (
|
|
23198
23319
|
select 1 from ${members.table("memberships")} m
|
|
23199
|
-
where m.${mt} =
|
|
23200
|
-
)
|
|
23201
|
-
|
|
23202
|
-
|
|
23203
|
-
|
|
23204
|
-
tenant: `v_req.${c("tenant")}`,
|
|
23320
|
+
where m.${mt} = ${factTenant} and m.${mu} = v_me and m.${mr} = ${roleValue(ctx, factValue, factTenant)}
|
|
23321
|
+
)`;
|
|
23322
|
+
const managerFact = manager === void 0 ? "false" : managerMatch(ctx, {
|
|
23323
|
+
requester: "approval_fact.requester",
|
|
23324
|
+
tenant: factTenant,
|
|
23205
23325
|
user: "v_me",
|
|
23206
|
-
...managerEmployee === void 0 ? {} : { employee:
|
|
23207
|
-
})
|
|
23326
|
+
...managerEmployee === void 0 ? {} : { employee: factValue }
|
|
23327
|
+
});
|
|
23328
|
+
const fact = (kind, value, requester = "null") => `${fn("approval_fact")}(v_req.${c("tenant")}, ${sqlString(kind)}, ${value}, ${requester})`;
|
|
23329
|
+
const approverMatch = `((coalesce(v_approvers -> 'users', '[]'::jsonb) ? v_me::text)
|
|
23330
|
+
or (v_approvers ->> 'permission' is not null and ${permissionMatch})
|
|
23331
|
+
or (v_approvers ->> 'role' is not null and ${fact("role", "v_approvers ->> 'role'")})
|
|
23332
|
+
or (v_approvers ->> 'team' is not null and ${fact("team", "v_approvers ->> 'team'")})${manager === void 0 ? "" : `
|
|
23333
|
+
or (coalesce((v_approvers ->> 'manager')::boolean, false) and ${fact("manager", managerEmployee ?? "null", `v_req.${c("requestedBy")}`)})`})`;
|
|
23334
|
+
const through = roleThrough(members);
|
|
23335
|
+
const rolesTable = through ? through.table : accessModel(ctx) === "catalog" ? ctx.of("permissions").table("roles") : void 0;
|
|
23336
|
+
const memoTriggers = [
|
|
23337
|
+
members.table("memberships"),
|
|
23338
|
+
...rolesTable === void 0 ? [] : [rolesTable],
|
|
23339
|
+
...teams === void 0 ? [] : [teams.table("members")]
|
|
23340
|
+
].map((table) => `drop trigger if exists ${ctx.trigger("approval_memo")} on ${table};
|
|
23341
|
+
create trigger ${ctx.trigger("approval_memo")} after insert or update or delete on ${table}
|
|
23342
|
+
for each statement execute function ${fn("approval_memo_bump")}();`).join("\n");
|
|
23208
23343
|
const notFound = fail$1("APPROVAL_NOT_FOUND", "approval request not found", "P0002");
|
|
23209
23344
|
const queues = [...new Set(policies.flatMap((policy) => policy.run?.kind === "queue" ? [policy.run.queue] : []))];
|
|
23210
23345
|
const queueRun = queues.length === 0 ? "" : `
|
|
@@ -23405,12 +23540,57 @@ as $$
|
|
|
23405
23540
|
$$;
|
|
23406
23541
|
${userGrant(`${fn("approval_policy")}(text, text)`)}
|
|
23407
23542
|
|
|
23543
|
+
${MEMO_FUNCTIONS.trim()}
|
|
23544
|
+
|
|
23545
|
+
create or replace function ${fn("approval_memo_bump")}()
|
|
23546
|
+
returns trigger
|
|
23547
|
+
language plpgsql
|
|
23548
|
+
security definer
|
|
23549
|
+
set search_path = ''
|
|
23550
|
+
as $$
|
|
23551
|
+
begin
|
|
23552
|
+
perform better_supabase.memo_set('approvals.gen', (coalesce(better_supabase.memo_get('approvals.gen'), '0')::bigint + 1)::text);
|
|
23553
|
+
return null;
|
|
23554
|
+
end;
|
|
23555
|
+
$$;
|
|
23556
|
+
${triggerGrant(`${fn("approval_memo_bump")}()`)}
|
|
23557
|
+
${memoTriggers}
|
|
23558
|
+
|
|
23559
|
+
create or replace function ${fn("approval_fact")}(tenant ${ctx.idType}, kind text, value text, requester uuid default null)
|
|
23560
|
+
returns boolean
|
|
23561
|
+
language plpgsql
|
|
23562
|
+
stable
|
|
23563
|
+
security definer
|
|
23564
|
+
set search_path = ''
|
|
23565
|
+
as $$
|
|
23566
|
+
declare
|
|
23567
|
+
v_me uuid := auth.uid();
|
|
23568
|
+
v_key text := 'approvals.f' || md5(format('%s|%s|%s|%s|%s', v_me, approval_fact.tenant, approval_fact.kind, approval_fact.value, approval_fact.requester));
|
|
23569
|
+
v_stamp text := statement_timestamp()::text || '/' || coalesce(better_supabase.memo_get('approvals.gen'), '0');
|
|
23570
|
+
v_hit text := better_supabase.memo_get(v_key);
|
|
23571
|
+
v_result boolean;
|
|
23572
|
+
begin
|
|
23573
|
+
if v_hit is not null and split_part(v_hit, '|', 1) = v_stamp then
|
|
23574
|
+
return split_part(v_hit, '|', 2) = 't';
|
|
23575
|
+
end if;
|
|
23576
|
+
v_result := coalesce(case approval_fact.kind
|
|
23577
|
+
when 'role' then ${roleFact}
|
|
23578
|
+
when 'team' then ${teamMatch("v_me", factValue)}
|
|
23579
|
+
when 'manager' then ${managerFact}
|
|
23580
|
+
else false
|
|
23581
|
+
end, false);
|
|
23582
|
+
perform better_supabase.memo_set(v_key, v_stamp || '|' || case when v_result then 't' else 'f' end);
|
|
23583
|
+
return v_result;
|
|
23584
|
+
end;
|
|
23585
|
+
$$;
|
|
23586
|
+
${triggerGrant(`${fn("approval_fact")}(${ctx.idType}, text, text, uuid)`)}
|
|
23587
|
+
|
|
23408
23588
|
-- Whether the caller may decide the request's current step: a named user,
|
|
23409
23589
|
-- a holder of the permission, a member with the role or in the team, or a
|
|
23410
23590
|
-- delegate. The requester can't, unless the policy allows self-approval.${provider ? `
|
|
23411
23591
|
-- A user the provider's isApprover allows for kind <subject type>.<action>
|
|
23412
23592
|
-- may decide as well, never the requester.` : ""}
|
|
23413
|
-
create or replace function ${fn("approval_eligible")}(
|
|
23593
|
+
create or replace function ${fn("approval_eligible")}(request ${requests})
|
|
23414
23594
|
returns boolean
|
|
23415
23595
|
language plpgsql
|
|
23416
23596
|
stable
|
|
@@ -23418,13 +23598,12 @@ security definer
|
|
|
23418
23598
|
set search_path = ''
|
|
23419
23599
|
as $$
|
|
23420
23600
|
declare
|
|
23421
|
-
v_req ${requests}%rowtype;
|
|
23601
|
+
v_req ${requests}%rowtype := approval_eligible.request;
|
|
23422
23602
|
v_step jsonb;
|
|
23423
23603
|
v_approvers jsonb;
|
|
23424
23604
|
v_me uuid := auth.uid();
|
|
23425
23605
|
begin
|
|
23426
|
-
|
|
23427
|
-
if not found or v_me is null or v_req.${c("status")} <> 'pending' then
|
|
23606
|
+
if v_req.${c("id")} is null or v_me is null or v_req.${c("status")} <> 'pending' then
|
|
23428
23607
|
return false;
|
|
23429
23608
|
end if;
|
|
23430
23609
|
if exists (
|
|
@@ -23459,8 +23638,45 @@ begin
|
|
|
23459
23638
|
)`] : [], ...provider ? [`(v_me is distinct from v_req.${c("requestedBy")} and coalesce((${provider.sql}), false))`] : []].join("\n or ") || "false"};
|
|
23460
23639
|
end;
|
|
23461
23640
|
$$;
|
|
23641
|
+
${userGrant(`${fn("approval_eligible")}(${requests})`)}
|
|
23642
|
+
|
|
23643
|
+
create or replace function ${fn("approval_eligible")}(request_id uuid)
|
|
23644
|
+
returns boolean
|
|
23645
|
+
language plpgsql
|
|
23646
|
+
stable
|
|
23647
|
+
security definer
|
|
23648
|
+
set search_path = ''
|
|
23649
|
+
as $$
|
|
23650
|
+
declare
|
|
23651
|
+
v_req ${requests}%rowtype;
|
|
23652
|
+
begin
|
|
23653
|
+
select * into v_req from ${requests} r where r.${c("id")} = approval_eligible.request_id;
|
|
23654
|
+
if not found then
|
|
23655
|
+
return false;
|
|
23656
|
+
end if;
|
|
23657
|
+
return ${fn("approval_eligible")}(v_req);
|
|
23658
|
+
end;
|
|
23659
|
+
$$;
|
|
23462
23660
|
${userGrant(`${fn("approval_eligible")}(uuid)`)}
|
|
23463
23661
|
|
|
23662
|
+
-- The pending requests the caller may decide, as a set, for a policy or a list
|
|
23663
|
+
-- (\`id in (select ${fn("approval_eligible_ids")}())\`): Postgres evaluates the set once per
|
|
23664
|
+
-- statement, not once per row. It calls approval_eligible for each pending
|
|
23665
|
+
-- request, so the two never disagree. Pass a tenant to read one tenant's.
|
|
23666
|
+
create or replace function ${fn("approval_eligible_ids")}(tenant ${ctx.idType} default null)
|
|
23667
|
+
returns setof uuid
|
|
23668
|
+
language sql
|
|
23669
|
+
stable
|
|
23670
|
+
security definer
|
|
23671
|
+
set search_path = ''
|
|
23672
|
+
as $$
|
|
23673
|
+
select r.${c("id")} from ${requests} r
|
|
23674
|
+
where r.${c("status")} = 'pending'
|
|
23675
|
+
and (approval_eligible_ids.tenant is null or r.${c("tenant")} = approval_eligible_ids.tenant)
|
|
23676
|
+
and ${fn("approval_eligible")}(r)
|
|
23677
|
+
$$;
|
|
23678
|
+
${userGrant(`${fn("approval_eligible_ids")}(${ctx.idType})`)}
|
|
23679
|
+
|
|
23464
23680
|
-- Notifies the current step's approvers (requested, reminder), its fallback
|
|
23465
23681
|
-- approvers (escalated), a delegate (delegated) or the requester (approved,
|
|
23466
23682
|
-- rejected, expired).
|
|
@@ -23683,8 +23899,8 @@ begin
|
|
|
23683
23899
|
and (list_approvals.subject_id is null or x.${c("subjectId")} = list_approvals.subject_id)
|
|
23684
23900
|
and (list_approvals.before is null or x.${c("createdAt")} < list_approvals.before)
|
|
23685
23901
|
and case
|
|
23686
|
-
when list_approvals.assigned then
|
|
23687
|
-
else x.${c("requestedBy")} = auth.uid() or (v_read and (${SERVICE_CALLER$1} or ${readable("x")})) or
|
|
23902
|
+
when list_approvals.assigned then x.${c("id")} in (select ${fn("approval_eligible_ids")}(list_approvals.tenant))
|
|
23903
|
+
else x.${c("requestedBy")} = auth.uid() or (v_read and (${SERVICE_CALLER$1} or ${readable("x")})) or x.${c("id")} in (select ${fn("approval_eligible_ids")}(list_approvals.tenant))
|
|
23688
23904
|
end
|
|
23689
23905
|
order by x.${c("createdAt")} desc, x.${c("id")}
|
|
23690
23906
|
limit ${pageSize("list_approvals.page_size", 50, 200)}
|
|
@@ -23800,7 +24016,7 @@ const APPROVALS$1 = {
|
|
|
23800
24016
|
from ${own.table("requests")} r
|
|
23801
24017
|
where ${r("status")} = 'pending'${own.has("requests", "expiresAt") ? `\n and (${r("expiresAt")} is null or ${r("expiresAt")} > now())` : ""}
|
|
23802
24018
|
and ${myWorkTenant(r("tenant"))}
|
|
23803
|
-
and ${own.fn("approval_eligible")}(
|
|
24019
|
+
and ${own.fn("approval_eligible")}(r)` }];
|
|
23804
24020
|
}
|
|
23805
24021
|
},
|
|
23806
24022
|
name: "approvals",
|
|
@@ -23825,15 +24041,28 @@ const APPROVALS$1 = {
|
|
|
23825
24041
|
],
|
|
23826
24042
|
target: "schema",
|
|
23827
24043
|
modes: ["managed", "custom"],
|
|
23828
|
-
version:
|
|
24044
|
+
version: 4,
|
|
23829
24045
|
names: APPROVALS_NAMES,
|
|
23830
|
-
upgrades: [
|
|
23831
|
-
|
|
23832
|
-
|
|
23833
|
-
|
|
23834
|
-
|
|
24046
|
+
upgrades: [
|
|
24047
|
+
{
|
|
24048
|
+
from: 1,
|
|
24049
|
+
description: "Adds approval_items and the item functions; decide_approval refuses a request that has items.",
|
|
24050
|
+
sql: () => ""
|
|
24051
|
+
},
|
|
24052
|
+
{
|
|
24053
|
+
from: 2,
|
|
24054
|
+
description: "Adds approval_eligible_ids(tenant), the set of pending requests the caller may decide; list_approvals reads it once per statement.",
|
|
24055
|
+
sql: () => ""
|
|
24056
|
+
},
|
|
24057
|
+
{
|
|
24058
|
+
from: 3,
|
|
24059
|
+
description: "Adds approval_eligible(approval_requests) and approval_fact, which reads the caller's permission, role, team and manager approvals once per statement.",
|
|
24060
|
+
sql: () => ""
|
|
24061
|
+
}
|
|
24062
|
+
],
|
|
23835
24063
|
contract: contract$125,
|
|
23836
|
-
build: build$144
|
|
24064
|
+
build: build$144,
|
|
24065
|
+
tests: approvalTests
|
|
23837
24066
|
};
|
|
23838
24067
|
// src/sql/modules/ai-chat-extras.ts
|
|
23839
24068
|
/**
|
|
@@ -39601,6 +39830,28 @@ function tenantLabel(ctx, tenant) {
|
|
|
39601
39830
|
if (!organizations.has("organizations", "name")) return "null";
|
|
39602
39831
|
return `(select o.${organizations.col("organizations", "name")}::text from ${organizations.table("organizations")} o where o.${organizations.col("organizations", "id")} = ${tenant})`;
|
|
39603
39832
|
}
|
|
39833
|
+
/**
|
|
39834
|
+
* The row trigger's insert values with the tenant label read from a transaction
|
|
39835
|
+
* memo: one lookup per tenant and transaction, not per row.
|
|
39836
|
+
*/
|
|
39837
|
+
function memoizedTenantLabel(ctx, values) {
|
|
39838
|
+
const label = tenantLabel(ctx, "row_tenant");
|
|
39839
|
+
if (label === "null" || !values.includes(label)) return {
|
|
39840
|
+
values,
|
|
39841
|
+
sql: ""
|
|
39842
|
+
};
|
|
39843
|
+
return {
|
|
39844
|
+
values: values.replaceAll(label, "v_label"),
|
|
39845
|
+
sql: `
|
|
39846
|
+
if row_tenant is not null then
|
|
39847
|
+
v_label := better_supabase.memo_get('audit.tenant_label.t' || replace(row_tenant::text, '-', ''));
|
|
39848
|
+
if v_label is null then
|
|
39849
|
+
v_label := ${label};
|
|
39850
|
+
perform better_supabase.memo_set('audit.tenant_label.t' || replace(row_tenant::text, '-', ''), coalesce(v_label, ''));
|
|
39851
|
+
end if;
|
|
39852
|
+
end if;`
|
|
39853
|
+
};
|
|
39854
|
+
}
|
|
39604
39855
|
// src/sql/modules/audit-api.ts
|
|
39605
39856
|
/** Logical log column to the key `list_audit_events` returns it under. */
|
|
39606
39857
|
const ENTRY_KEYS = [
|
|
@@ -40726,6 +40977,51 @@ function recordedMarkSql() {
|
|
|
40726
40977
|
perform pg_catalog.set_config('bsb.recorded', coalesce(pg_catalog.current_setting('bsb.recorded', true), '') || E'\\n' || audit_event.target_type || ':' || audit_event.record_id, true);
|
|
40727
40978
|
end if;`;
|
|
40728
40979
|
}
|
|
40980
|
+
// src/sql/modules/audit-event-args.ts
|
|
40981
|
+
/** `audit_event`'s argument types. */
|
|
40982
|
+
const EVENT_ARGS = (id) => `text, text, text, text, text, text, ${id}, jsonb, text, jsonb, uuid, text, text, text, text, text, inet, text, text, text, text, uuid, uuid, text`;
|
|
40983
|
+
/** `audit_event`'s arguments, as the keys of an `audit_event_many` element. */
|
|
40984
|
+
const EVENT_KEYS$1 = (id) => [
|
|
40985
|
+
["event_type", "text"],
|
|
40986
|
+
["category", "text"],
|
|
40987
|
+
[
|
|
40988
|
+
"outcome",
|
|
40989
|
+
"text",
|
|
40990
|
+
"'success'"
|
|
40991
|
+
],
|
|
40992
|
+
["source", "text"],
|
|
40993
|
+
["target_type", "text"],
|
|
40994
|
+
["record_id", "text"],
|
|
40995
|
+
["tenant", id],
|
|
40996
|
+
[
|
|
40997
|
+
"metadata",
|
|
40998
|
+
"jsonb",
|
|
40999
|
+
"'{}'"
|
|
41000
|
+
],
|
|
41001
|
+
["idempotency_key", "text"],
|
|
41002
|
+
["restricted", "jsonb"],
|
|
41003
|
+
["actor_id", "uuid"],
|
|
41004
|
+
["summary", "text"],
|
|
41005
|
+
["target_label", "text"],
|
|
41006
|
+
["correlation_id", "text"],
|
|
41007
|
+
["actor_kind", "text"],
|
|
41008
|
+
["actor_label", "text"],
|
|
41009
|
+
["ip", "inet"],
|
|
41010
|
+
["user_agent", "text"],
|
|
41011
|
+
["session_id", "text"],
|
|
41012
|
+
["request_id", "text"],
|
|
41013
|
+
["scope", "text"],
|
|
41014
|
+
["support_session", "uuid"],
|
|
41015
|
+
["impersonated_by", "uuid"],
|
|
41016
|
+
["impersonation_reason", "text"]
|
|
41017
|
+
];
|
|
41018
|
+
const PREVIOUS_EVENT_ARGS = (id) => [
|
|
41019
|
+
`text, text, text, text, text, text, ${id}, jsonb, text, jsonb, uuid, text, text, text`,
|
|
41020
|
+
`text, text, text, text, text, text, ${id}, jsonb, text, jsonb, uuid, text, text, text, text, text, inet, text, text`,
|
|
41021
|
+
`text, text, text, text, text, text, ${id}, jsonb, text, jsonb, uuid, text, text, text, text, text, inet, text, text, text, text`
|
|
41022
|
+
];
|
|
41023
|
+
/** `audit_event_trusted`'s signatures before the current one. */
|
|
41024
|
+
const PREVIOUS_TRUSTED_ARGS = (id) => [`text, text, text, text, text, text, ${id}, jsonb, text, jsonb, uuid, text, text, text, text, text, inet, text, text, text, text`];
|
|
40729
41025
|
// src/sql/modules/audit-metadata.ts
|
|
40730
41026
|
/**
|
|
40731
41027
|
* `blocks.audit.options.metadataColumns`: an adopted log's own columns and the
|
|
@@ -41146,87 +41442,6 @@ function rowPairs(ctx, snapshots, expr, context) {
|
|
|
41146
41442
|
...context
|
|
41147
41443
|
];
|
|
41148
41444
|
}
|
|
41149
|
-
// src/sql/modules/audit-statement.ts
|
|
41150
|
-
/**
|
|
41151
|
-
* The trigger reads the JWT and the request headers once per call, not once per
|
|
41152
|
-
* column that uses them.
|
|
41153
|
-
*/
|
|
41154
|
-
function once(sql) {
|
|
41155
|
-
return sql.replaceAll("auth.jwt()", "v_jwt").replaceAll(/better_supabase\.request_header\(('[^']*')\)/g, "(v_headers ->> $1)");
|
|
41156
|
-
}
|
|
41157
|
-
const KEY$4 = (row) => `(select string_agg(to_jsonb(${row}) ->> k.name, ',' order by k.ord) from unnest(entry.key_columns) with ordinality k(name, ord))`;
|
|
41158
|
-
/**
|
|
41159
|
-
* `audit_statement_change()`: the trigger function of a table audited with
|
|
41160
|
-
* `statement => true`. It reads the transition tables once and writes every
|
|
41161
|
-
* entry of the statement in one insert, instead of one insert per row.
|
|
41162
|
-
*/
|
|
41163
|
-
function statementFunction$1(ctx, parts) {
|
|
41164
|
-
const write = (source) => `with src as (
|
|
41165
|
-
${source}
|
|
41166
|
-
), paired as (
|
|
41167
|
-
select case when s.old_row is null then 'insert' when s.new_row is null then 'delete' else 'update' end as op,
|
|
41168
|
-
coalesce(s.new_row, s.old_row) as row_data,
|
|
41169
|
-
s.old_row - entry.ignore as old_row, s.new_row - entry.ignore as new_row
|
|
41170
|
-
from src s
|
|
41171
|
-
), changed as (
|
|
41172
|
-
select p.*, case when p.op = 'update' then (
|
|
41173
|
-
select array_agg(e.key order by e.key) from jsonb_each(p.new_row) e
|
|
41174
|
-
where e.value is distinct from p.old_row -> e.key
|
|
41175
|
-
) end as changed_columns
|
|
41176
|
-
from paired p
|
|
41177
|
-
), kept as (
|
|
41178
|
-
select c.*, ${parts.tenantValue} as row_tenant
|
|
41179
|
-
from changed c
|
|
41180
|
-
where (c.op <> 'update' or c.changed_columns is not null)
|
|
41181
|
-
and not (${recordedPredicate()})
|
|
41182
|
-
), final as (
|
|
41183
|
-
select k.op, k.row_data, k.changed_columns, k.row_tenant,
|
|
41184
|
-
k.old_row || coalesce((select jsonb_object_agg(r, '"[redacted]"'::jsonb) from unnest(entry.redact) r where k.old_row ? r), '{}') as old_row,
|
|
41185
|
-
k.new_row || coalesce((select jsonb_object_agg(r, '"[redacted]"'::jsonb) from unnest(entry.redact) r where k.new_row ? r), '{}') as new_row
|
|
41186
|
-
from kept k
|
|
41187
|
-
)
|
|
41188
|
-
insert into ${ctx.table("log")} (${parts.insert.columns})
|
|
41189
|
-
select ${once(parts.insert.values)}
|
|
41190
|
-
from final;`;
|
|
41191
|
-
const sides = {
|
|
41192
|
-
insert: "select null::jsonb as old_row, to_jsonb(n) as new_row from new_rows n",
|
|
41193
|
-
delete: "select to_jsonb(o) as old_row, null::jsonb as new_row from old_rows o",
|
|
41194
|
-
update: `select o.j as old_row, n.j as new_row
|
|
41195
|
-
from (select to_jsonb(r) as j, ${KEY$4("r")} as k from old_rows r) o
|
|
41196
|
-
full join (select to_jsonb(r) as j, ${KEY$4("r")} as k from new_rows r) n on o.k = n.k`
|
|
41197
|
-
};
|
|
41198
|
-
return `-- Statement-level audit (audit(..., statement => true)): the transition tables
|
|
41199
|
-
-- hold every row the statement changed, so the whole statement is audited with
|
|
41200
|
-
-- one insert. An update that changes a key column is audited as a delete and an
|
|
41201
|
-
-- insert.
|
|
41202
|
-
create or replace function better_supabase.audit_statement_change()
|
|
41203
|
-
returns trigger
|
|
41204
|
-
language plpgsql
|
|
41205
|
-
security definer
|
|
41206
|
-
set search_path = ''
|
|
41207
|
-
as $$
|
|
41208
|
-
declare
|
|
41209
|
-
entry record;
|
|
41210
|
-
settings jsonb;
|
|
41211
|
-
v_jwt jsonb := auth.jwt();
|
|
41212
|
-
v_headers jsonb := better_supabase.request_headers();
|
|
41213
|
-
begin
|
|
41214
|
-
if current_setting('better_supabase.import_audit', true) = 'summary' and better_supabase.import_run() is not null then
|
|
41215
|
-
return null;
|
|
41216
|
-
end if;
|
|
41217
|
-
${entryLoadSql(ctx)}
|
|
41218
|
-
if tg_op = 'INSERT' then
|
|
41219
|
-
${write(sides.insert)}
|
|
41220
|
-
elsif tg_op = 'DELETE' then
|
|
41221
|
-
${write(sides.delete)}
|
|
41222
|
-
else
|
|
41223
|
-
${write(sides.update)}
|
|
41224
|
-
end if;
|
|
41225
|
-
return null;
|
|
41226
|
-
end;
|
|
41227
|
-
$$;
|
|
41228
|
-
${parts.grant}`;
|
|
41229
|
-
}
|
|
41230
41445
|
// src/sql/modules/audit-subjects.ts
|
|
41231
41446
|
const HEADER = /^[a-z0-9-]+$/;
|
|
41232
41447
|
const COLUMN$8 = /^[a-z_][a-z0-9_]*$/;
|
|
@@ -41340,12 +41555,14 @@ create index if not exists ${sqlIdent$1(`audit_events_${name}_idx`)} on ${log} (
|
|
|
41340
41555
|
}
|
|
41341
41556
|
/**
|
|
41342
41557
|
* How the caller acted: service, support, impersonation, oauth-client, staff
|
|
41343
|
-
* (with `staffClaim`), user or system.
|
|
41558
|
+
* (with `staffClaim`), user or system. `import_run()` sits in a scalar
|
|
41559
|
+
* subselect, so a statement-level insert reads it once, not once per row.
|
|
41344
41560
|
*/
|
|
41561
|
+
const INTEGRATION_TEST = "(select better_supabase.import_run()) is not null";
|
|
41345
41562
|
function actorKind(ctx) {
|
|
41346
41563
|
const staff = staffTest(ctx);
|
|
41347
41564
|
return `case
|
|
41348
|
-
when
|
|
41565
|
+
when ${INTEGRATION_TEST} then 'integration'
|
|
41349
41566
|
when coalesce(auth.jwt() ->> 'role', '') = 'service_role' then 'service'
|
|
41350
41567
|
when auth.jwt() -> 'act' ->> 'kind' = 'support' then 'support'
|
|
41351
41568
|
when auth.jwt() -> 'act' is not null then 'impersonation'
|
|
@@ -41354,9 +41571,101 @@ function actorKind(ctx) {
|
|
|
41354
41571
|
else 'system'
|
|
41355
41572
|
end`;
|
|
41356
41573
|
}
|
|
41574
|
+
// src/sql/modules/audit-statement.ts
|
|
41575
|
+
/**
|
|
41576
|
+
* The trigger reads the JWT and the request headers once per call, not once per
|
|
41577
|
+
* column that uses them.
|
|
41578
|
+
*/
|
|
41579
|
+
function once(sql) {
|
|
41580
|
+
return sql.replaceAll(INTEGRATION_TEST, "v_integration").replaceAll("auth.jwt()", "v_jwt").replaceAll(/better_supabase\.request_header\(('[^']*')\)/g, "(v_headers ->> $1)");
|
|
41581
|
+
}
|
|
41582
|
+
const KEY$4 = (row) => `(select string_agg(to_jsonb(${row}) ->> k.name, ',' order by k.ord) from unnest(entry.key_columns) with ordinality k(name, ord))`;
|
|
41583
|
+
/**
|
|
41584
|
+
* `audit_statement_change()`: the trigger function of a table audited with
|
|
41585
|
+
* `statement => true`. It reads the transition tables once and writes every
|
|
41586
|
+
* entry of the statement in one insert, instead of one insert per row.
|
|
41587
|
+
*/
|
|
41588
|
+
function statementFunction$1(ctx, parts) {
|
|
41589
|
+
const label = tenantLabel(ctx, "row_tenant");
|
|
41590
|
+
const labels = label !== "null" && parts.insert.values.includes(label);
|
|
41591
|
+
const values = labels ? parts.insert.values.replaceAll(label, "l.label") : parts.insert.values;
|
|
41592
|
+
const write = (source) => `with src as (
|
|
41593
|
+
${source}
|
|
41594
|
+
), paired as (
|
|
41595
|
+
select case when s.old_row is null then 'insert' when s.new_row is null then 'delete' else 'update' end as op,
|
|
41596
|
+
coalesce(s.new_row, s.old_row) as row_data,
|
|
41597
|
+
s.old_row - entry.ignore as old_row, s.new_row - entry.ignore as new_row
|
|
41598
|
+
from src s
|
|
41599
|
+
), changed as (
|
|
41600
|
+
select p.*, case when p.op = 'update' then (
|
|
41601
|
+
select array_agg(e.key order by e.key) from jsonb_each(p.new_row) e
|
|
41602
|
+
where e.value is distinct from p.old_row -> e.key
|
|
41603
|
+
) end as changed_columns
|
|
41604
|
+
from paired p
|
|
41605
|
+
), kept as (
|
|
41606
|
+
select c.*, ${parts.tenantValue} as row_tenant
|
|
41607
|
+
from changed c
|
|
41608
|
+
where (c.op <> 'update' or c.changed_columns is not null)
|
|
41609
|
+
and not (${recordedPredicate()})
|
|
41610
|
+
), final as (
|
|
41611
|
+
select k.op, k.row_data, k.changed_columns, k.row_tenant,
|
|
41612
|
+
k.old_row || coalesce((select jsonb_object_agg(r, '"[redacted]"'::jsonb) from unnest(entry.redact) r where k.old_row ? r), '{}') as old_row,
|
|
41613
|
+
k.new_row || coalesce((select jsonb_object_agg(r, '"[redacted]"'::jsonb) from unnest(entry.redact) r where k.new_row ? r), '{}') as new_row
|
|
41614
|
+
from kept k
|
|
41615
|
+
)${labels ? `, labels as (
|
|
41616
|
+
select t.row_tenant as tenant_key, ${tenantLabel(ctx, "t.row_tenant")} as label
|
|
41617
|
+
from (select distinct row_tenant from kept) t
|
|
41618
|
+
)` : ""}
|
|
41619
|
+
insert into ${ctx.table("log")} (${parts.insert.columns})
|
|
41620
|
+
select ${once(values)}
|
|
41621
|
+
from final${labels ? "\n left join labels l on l.tenant_key is not distinct from final.row_tenant" : ""};`;
|
|
41622
|
+
const sides = {
|
|
41623
|
+
insert: "select null::jsonb as old_row, to_jsonb(n) as new_row from new_rows n",
|
|
41624
|
+
delete: "select to_jsonb(o) as old_row, null::jsonb as new_row from old_rows o",
|
|
41625
|
+
update: `select o.j as old_row, n.j as new_row
|
|
41626
|
+
from (select to_jsonb(r) as j, ${KEY$4("r")} as k from old_rows r) o
|
|
41627
|
+
full join (select to_jsonb(r) as j, ${KEY$4("r")} as k from new_rows r) n on o.k = n.k`
|
|
41628
|
+
};
|
|
41629
|
+
return `-- Statement-level audit (audit(..., statement => true)): the transition tables
|
|
41630
|
+
-- hold every row the statement changed, so the whole statement is audited with
|
|
41631
|
+
-- one insert. An update that changes a key column is audited as a delete and an
|
|
41632
|
+
-- insert.
|
|
41633
|
+
create or replace function better_supabase.audit_statement_change()
|
|
41634
|
+
returns trigger
|
|
41635
|
+
language plpgsql
|
|
41636
|
+
security definer
|
|
41637
|
+
set search_path = ''
|
|
41638
|
+
as $$
|
|
41639
|
+
declare
|
|
41640
|
+
entry record;
|
|
41641
|
+
settings jsonb;
|
|
41642
|
+
v_jwt jsonb := auth.jwt();
|
|
41643
|
+
v_headers jsonb := better_supabase.request_headers();
|
|
41644
|
+
v_integration boolean := better_supabase.import_run() is not null;
|
|
41645
|
+
begin
|
|
41646
|
+
if v_integration and current_setting('better_supabase.import_audit', true) = 'summary' then
|
|
41647
|
+
return null;
|
|
41648
|
+
end if;
|
|
41649
|
+
${entryLoadSql(ctx)}
|
|
41650
|
+
if tg_op = 'INSERT' then
|
|
41651
|
+
${write(sides.insert)}
|
|
41652
|
+
elsif tg_op = 'DELETE' then
|
|
41653
|
+
${write(sides.delete)}
|
|
41654
|
+
else
|
|
41655
|
+
${write(sides.update)}
|
|
41656
|
+
end if;
|
|
41657
|
+
return null;
|
|
41658
|
+
end;
|
|
41659
|
+
$$;
|
|
41660
|
+
${parts.grant}`;
|
|
41661
|
+
}
|
|
41357
41662
|
// src/sql/modules/audit-tests.ts
|
|
41358
|
-
|
|
41359
|
-
|
|
41663
|
+
/**
|
|
41664
|
+
* Each table gets its own probe name: the log keeps an earlier probe's entries
|
|
41665
|
+
* for the whole transaction.
|
|
41666
|
+
*/
|
|
41667
|
+
const probeTable = (index) => `bsb_audit_probe_${String(index)}`;
|
|
41668
|
+
const probeName = (index) => `(select n.nspname from pg_catalog.pg_namespace n where n.oid = pg_catalog.pg_my_temp_schema()) || '.${probeTable(index)}'`;
|
|
41360
41669
|
const textArray$8 = (names) => `${sqlString(`{${names.map((name) => `"${name.replaceAll("\"", "\\\"")}"`).join(",")}}`)}::text[]`;
|
|
41361
41670
|
/** A quoted identifier for `schema.table` from its unquoted parts. */
|
|
41362
41671
|
const quotedTarget = (target) => {
|
|
@@ -41369,7 +41678,7 @@ const quotedTarget = (target) => {
|
|
|
41369
41678
|
* carries the same registration as the table, so the trigger writes the same
|
|
41370
41679
|
* entries the table's rows would.
|
|
41371
41680
|
*/
|
|
41372
|
-
const probe = (table) => `create temp table
|
|
41681
|
+
const probe = (table, index) => `create temp table ${probeTable(index)} (like ${quotedTarget(table.target)} including defaults including identity including generated) on commit drop;
|
|
41373
41682
|
do $$
|
|
41374
41683
|
declare
|
|
41375
41684
|
col record;
|
|
@@ -41377,13 +41686,13 @@ declare
|
|
|
41377
41686
|
begin
|
|
41378
41687
|
for col in
|
|
41379
41688
|
select a.attname from pg_catalog.pg_attribute a
|
|
41380
|
-
where a.attrelid = '
|
|
41689
|
+
where a.attrelid = 'pg_temp.${probeTable(index)}'::regclass and a.attnum > 0 and not a.attisdropped
|
|
41381
41690
|
and a.attnotnull and a.attidentity = ''
|
|
41382
41691
|
loop
|
|
41383
|
-
execute format('alter table
|
|
41692
|
+
execute format('alter table pg_temp.${probeTable(index)} alter column %I drop not null', col.attname);
|
|
41384
41693
|
end loop;
|
|
41385
|
-
perform better_supabase.audit('
|
|
41386
|
-
insert into
|
|
41694
|
+
perform better_supabase.audit('pg_temp.${probeTable(index)}', ignore => ${textArray$8(table.ignore)}, redact => ${textArray$8(table.redact)});
|
|
41695
|
+
insert into pg_temp.${probeTable(index)} default values;
|
|
41387
41696
|
select string_agg(format('%I = %s', a.attname, v.value), ', ') into sets
|
|
41388
41697
|
from pg_catalog.pg_attribute a
|
|
41389
41698
|
join pg_catalog.pg_type t on t.oid = a.atttypid
|
|
@@ -41402,20 +41711,20 @@ begin
|
|
|
41402
41711
|
when t.typcategory = 'A' then quote_literal('{}') || '::' || format_type(t.oid, null)
|
|
41403
41712
|
end as value
|
|
41404
41713
|
) v
|
|
41405
|
-
where a.attrelid = '
|
|
41714
|
+
where a.attrelid = 'pg_temp.${probeTable(index)}'::regclass and a.attnum > 0 and not a.attisdropped
|
|
41406
41715
|
and a.attidentity = '' and a.attgenerated = '' and v.value is not null;
|
|
41407
41716
|
if sets is not null then
|
|
41408
|
-
execute format('update
|
|
41717
|
+
execute format('update pg_temp.${probeTable(index)} set %s', sets);
|
|
41409
41718
|
end if;
|
|
41410
|
-
delete from
|
|
41719
|
+
delete from pg_temp.${probeTable(index)};
|
|
41411
41720
|
end;
|
|
41412
41721
|
$$;`;
|
|
41413
41722
|
/**
|
|
41414
|
-
* The
|
|
41723
|
+
* The section for one audited table: the trigger and registration match the
|
|
41415
41724
|
* `audit()` call, and inserts, updates and deletes on a copy of the table write
|
|
41416
41725
|
* entries without the ignored columns and with the redacted values masked.
|
|
41417
41726
|
*/
|
|
41418
|
-
function
|
|
41727
|
+
function auditTableSection(ctx, table, restricted, index) {
|
|
41419
41728
|
const dot = table.target.indexOf(".");
|
|
41420
41729
|
const schema = sqlString(table.target.slice(0, dot));
|
|
41421
41730
|
const name = sqlString(table.target.slice(dot + 1));
|
|
@@ -41428,16 +41737,12 @@ function auditTableTest(ctx, table, restricted) {
|
|
|
41428
41737
|
`select extensions.is(array(select jsonb_array_elements_text(coalesce(better_supabase.audit_settings(${regclass}) -> 'ignore', '[]'))), ${textArray$8(table.ignore)}, ${sqlString(`${table.target} is registered with its ignored columns`)});`,
|
|
41429
41738
|
`select extensions.is(array(select jsonb_array_elements_text(coalesce(better_supabase.audit_settings(${regclass}) -> 'redact', '[]'))), ${textArray$8(table.redact)}, ${sqlString(`${table.target} is registered with its redacted columns`)});`
|
|
41430
41739
|
];
|
|
41431
|
-
if (!(ctx.has("log", "table") && ctx.has("log", "op"))) return
|
|
41432
|
-
|
|
41433
|
-
|
|
41434
|
-
|
|
41435
|
-
${checks.join("\n")}
|
|
41436
|
-
|
|
41437
|
-
select * from extensions.finish();
|
|
41438
|
-
rollback;`;
|
|
41740
|
+
if (!(ctx.has("log", "table") && ctx.has("log", "op"))) return {
|
|
41741
|
+
setup: "",
|
|
41742
|
+
checks
|
|
41743
|
+
};
|
|
41439
41744
|
const joined = restricted && ctx.hasTable("restricted");
|
|
41440
|
-
const entries = `from ${log} l${joined ? ` left join ${ctx.table("restricted")} r on r.${ctx.col("restricted", "entry")} = l.${c("id")}` : ""} where l.${c("table")} = ${
|
|
41745
|
+
const entries = `from ${log} l${joined ? ` left join ${ctx.table("restricted")} r on r.${ctx.col("restricted", "entry")} = l.${c("id")}` : ""} where l.${c("table")} = ${probeName(index)}`;
|
|
41441
41746
|
const side = (logical) => {
|
|
41442
41747
|
if (joined) return ctx.has("restricted", logical) ? `r.${ctx.col("restricted", logical)}` : void 0;
|
|
41443
41748
|
return ctx.has("log", logical) ? `l.${c(logical)}` : void 0;
|
|
@@ -41450,23 +41755,35 @@ rollback;`;
|
|
|
41450
41755
|
}
|
|
41451
41756
|
const after = side("new");
|
|
41452
41757
|
if (table.redact.length > 0 && after !== void 0) checks.push(`select extensions.is((select count(*)::int ${entries} and l.${c("op")} <> 'delete' and exists (select 1 from unnest(${textArray$8(table.redact)}) k where ${after} ? k and ${after} ->> k is distinct from '[redacted]')), 0, ${sqlString(`entries for ${table.target} mask ${table.redact.join(", ")}`)});`);
|
|
41453
|
-
return
|
|
41758
|
+
return {
|
|
41759
|
+
setup: probe(table, index),
|
|
41760
|
+
checks
|
|
41761
|
+
};
|
|
41762
|
+
}
|
|
41763
|
+
/**
|
|
41764
|
+
* One pgTAP file for every table in `audited`, with each table's assertion
|
|
41765
|
+
* names. Each table has its own numbered probe copy, dropped after its checks.
|
|
41766
|
+
*/
|
|
41767
|
+
function auditTests(ctx, audited, restricted) {
|
|
41768
|
+
if (audited.length === 0) return [];
|
|
41769
|
+
const sections = audited.map((table, index) => auditTableSection(ctx, table, restricted, index));
|
|
41770
|
+
const total = sections.reduce((sum, each) => sum + each.checks.length, 0);
|
|
41771
|
+
const body = sections.map(({ setup, checks }, index) => [
|
|
41772
|
+
setup,
|
|
41773
|
+
...checks,
|
|
41774
|
+
...setup === "" ? [] : [`drop table pg_temp.${probeTable(index)};`]
|
|
41775
|
+
].filter((part) => part !== "").join("\n")).join("\n\n");
|
|
41776
|
+
return [{
|
|
41777
|
+
name: "tables",
|
|
41778
|
+
sql: `begin;
|
|
41454
41779
|
create extension if not exists pgtap with schema extensions;
|
|
41455
|
-
select extensions.plan(${String(
|
|
41780
|
+
select extensions.plan(${String(total)});
|
|
41456
41781
|
|
|
41457
|
-
${
|
|
41458
|
-
|
|
41459
|
-
${checks.join("\n")}
|
|
41782
|
+
${body}
|
|
41460
41783
|
|
|
41461
41784
|
select * from extensions.finish();
|
|
41462
|
-
rollback
|
|
41463
|
-
}
|
|
41464
|
-
/** One pgTAP file per table in `audited`, named after the table. */
|
|
41465
|
-
function auditTests(ctx, audited, restricted) {
|
|
41466
|
-
return audited.map((table) => ({
|
|
41467
|
-
name: table.target.toLowerCase().replaceAll(/[^a-z0-9]+/g, "_"),
|
|
41468
|
-
sql: auditTableTest(ctx, table, restricted)
|
|
41469
|
-
}));
|
|
41785
|
+
rollback;`
|
|
41786
|
+
}];
|
|
41470
41787
|
}
|
|
41471
41788
|
// src/sql/modules/audit-upgrades.ts
|
|
41472
41789
|
/** The audit module's `upgrade` steps, from each installed version. */
|
|
@@ -41863,6 +42180,7 @@ function triggerFunction(ctx, tenantColumn, restricted) {
|
|
|
41863
42180
|
))
|
|
41864
42181
|
into changed_values
|
|
41865
42182
|
from unnest(coalesce(changed_columns, array(select jsonb_object_keys(coalesce(new_row, old_row))))) k;` : "";
|
|
42183
|
+
const memo = memoizedTenantLabel(ctx, insert.values);
|
|
41866
42184
|
return `create or replace function better_supabase.audit_row_change()
|
|
41867
42185
|
returns trigger
|
|
41868
42186
|
language plpgsql
|
|
@@ -41881,17 +42199,19 @@ declare
|
|
|
41881
42199
|
row_tenant ${ctx.idType};
|
|
41882
42200
|
v_jwt jsonb := auth.jwt();
|
|
41883
42201
|
v_headers jsonb := better_supabase.request_headers();
|
|
42202
|
+
v_integration boolean := better_supabase.import_run() is not null;
|
|
42203
|
+
v_label text;
|
|
41884
42204
|
path_value text;
|
|
41885
42205
|
path_step jsonb;
|
|
41886
42206
|
begin
|
|
41887
42207
|
-- An import run with imports.audit 'summary' audits one entry per entity at
|
|
41888
42208
|
-- its end instead of one per row (ADR 0141).
|
|
41889
|
-
if current_setting('better_supabase.import_audit', true) = 'summary'
|
|
42209
|
+
if v_integration and current_setting('better_supabase.import_audit', true) = 'summary' then
|
|
41890
42210
|
return null;
|
|
41891
42211
|
end if;
|
|
41892
42212
|
${entrySql$1(ctx)}
|
|
41893
42213
|
row_tenant := ${tenantValue};
|
|
41894
|
-
${tenantFallbackSql(ctx.idType)}
|
|
42214
|
+
${tenantFallbackSql(ctx.idType)}${memo.sql}
|
|
41895
42215
|
old_row := old_row - entry.ignore;
|
|
41896
42216
|
new_row := new_row - entry.ignore;
|
|
41897
42217
|
if tg_op = 'UPDATE' then
|
|
@@ -41907,7 +42227,7 @@ ${tenantFallbackSql(ctx.idType)}
|
|
|
41907
42227
|
new_row := new_row || coalesce((select jsonb_object_agg(k, '"[redacted]"'::jsonb) from unnest(entry.redact) k where new_row ? k), '{}');${changedValues}
|
|
41908
42228
|
insert into ${ctx.table("log")} (${insert.columns})
|
|
41909
42229
|
values (
|
|
41910
|
-
${once(
|
|
42230
|
+
${once(memo.values)}
|
|
41911
42231
|
)
|
|
41912
42232
|
returning ${ctx.col("log", "id")} into entry_id;${once(restrictedInsert(ctx, restricted, {
|
|
41913
42233
|
old: "old_row",
|
|
@@ -41935,50 +42255,6 @@ function statementTrigger(ctx, tenantColumn, restricted) {
|
|
|
41935
42255
|
grant: triggerGrant("better_supabase.audit_statement_change()")
|
|
41936
42256
|
});
|
|
41937
42257
|
}
|
|
41938
|
-
/** `audit_event`'s argument types. */
|
|
41939
|
-
const EVENT_ARGS = (id) => `text, text, text, text, text, text, ${id}, jsonb, text, jsonb, uuid, text, text, text, text, text, inet, text, text, text, text, uuid, uuid, text`;
|
|
41940
|
-
/** `audit_event`'s arguments, as the keys of an `audit_event_many` element. */
|
|
41941
|
-
const EVENT_KEYS$1 = (id) => [
|
|
41942
|
-
["event_type", "text"],
|
|
41943
|
-
["category", "text"],
|
|
41944
|
-
[
|
|
41945
|
-
"outcome",
|
|
41946
|
-
"text",
|
|
41947
|
-
"'success'"
|
|
41948
|
-
],
|
|
41949
|
-
["source", "text"],
|
|
41950
|
-
["target_type", "text"],
|
|
41951
|
-
["record_id", "text"],
|
|
41952
|
-
["tenant", id],
|
|
41953
|
-
[
|
|
41954
|
-
"metadata",
|
|
41955
|
-
"jsonb",
|
|
41956
|
-
"'{}'"
|
|
41957
|
-
],
|
|
41958
|
-
["idempotency_key", "text"],
|
|
41959
|
-
["restricted", "jsonb"],
|
|
41960
|
-
["actor_id", "uuid"],
|
|
41961
|
-
["summary", "text"],
|
|
41962
|
-
["target_label", "text"],
|
|
41963
|
-
["correlation_id", "text"],
|
|
41964
|
-
["actor_kind", "text"],
|
|
41965
|
-
["actor_label", "text"],
|
|
41966
|
-
["ip", "inet"],
|
|
41967
|
-
["user_agent", "text"],
|
|
41968
|
-
["session_id", "text"],
|
|
41969
|
-
["request_id", "text"],
|
|
41970
|
-
["scope", "text"],
|
|
41971
|
-
["support_session", "uuid"],
|
|
41972
|
-
["impersonated_by", "uuid"],
|
|
41973
|
-
["impersonation_reason", "text"]
|
|
41974
|
-
];
|
|
41975
|
-
const PREVIOUS_EVENT_ARGS = (id) => [
|
|
41976
|
-
`text, text, text, text, text, text, ${id}, jsonb, text, jsonb, uuid, text, text, text`,
|
|
41977
|
-
`text, text, text, text, text, text, ${id}, jsonb, text, jsonb, uuid, text, text, text, text, text, inet, text, text`,
|
|
41978
|
-
`text, text, text, text, text, text, ${id}, jsonb, text, jsonb, uuid, text, text, text, text, text, inet, text, text, text, text`
|
|
41979
|
-
];
|
|
41980
|
-
/** `audit_event_trusted`'s signatures before the current one. */
|
|
41981
|
-
const PREVIOUS_TRUSTED_ARGS = (id) => [`text, text, text, text, text, text, ${id}, jsonb, text, jsonb, uuid, text, text, text, text, text, inet, text, text, text, text`];
|
|
41982
42258
|
function auditEvent(ctx, restricted) {
|
|
41983
42259
|
const id = ctx.idType;
|
|
41984
42260
|
const extra = metadataColumns$1(ctx);
|
|
@@ -42062,10 +42338,11 @@ set search_path = ''
|
|
|
42062
42338
|
as $$
|
|
42063
42339
|
declare
|
|
42064
42340
|
existing text;
|
|
42341
|
+
v_integration boolean := better_supabase.import_run() is not null;
|
|
42065
42342
|
entry_id ${log}.${c("id")}%type;${extra.length > 0 ? "\n entry_row jsonb;\n entry_columns text;" : ""}
|
|
42066
42343
|
begin${noRestricted}
|
|
42067
42344
|
-- imports.audit 'summary' (ADR 0141): the run audits per entity at its end.
|
|
42068
|
-
if current_setting('better_supabase.import_audit', true) = 'summary'
|
|
42345
|
+
if v_integration and current_setting('better_supabase.import_audit', true) = 'summary' then
|
|
42069
42346
|
return null;
|
|
42070
42347
|
end if;
|
|
42071
42348
|
${trusted ? "actor_id := coalesce(actor_id, auth.uid());" : `if not (${SERVICE_CALLER$1}) then
|
|
@@ -42088,7 +42365,7 @@ begin${noRestricted}
|
|
|
42088
42365
|
return entry_id::text;
|
|
42089
42366
|
end;
|
|
42090
42367
|
$$;
|
|
42091
|
-
`.replaceAll("audit_event.", `${name}.`);
|
|
42368
|
+
`.replaceAll("audit_event.", `${name}.`).replaceAll(INTEGRATION_TEST, "v_integration");
|
|
42092
42369
|
return `-- Records a semantic app event (invoice.sent, member.invited) next to the
|
|
42093
42370
|
-- row changes. A repeated idempotency_key returns the first entry's id.
|
|
42094
42371
|
-- actor_id, actor_kind, actor_label, ip, user_agent, session_id, request_id
|
|
@@ -42192,6 +42469,7 @@ function auditSql$1(ctx, layout) {
|
|
|
42192
42469
|
const tenantColumn = ctx.text("tenantColumn", layout.tenantColumn ?? "organization_id");
|
|
42193
42470
|
return [
|
|
42194
42471
|
SCHEMA$6,
|
|
42472
|
+
MEMO_FUNCTIONS.trim(),
|
|
42195
42473
|
registry(ctx),
|
|
42196
42474
|
requestIpSql(ctx),
|
|
42197
42475
|
ctx.manages ? managedTables(ctx, restricted) : "",
|
|
@@ -99497,7 +99775,7 @@ begin
|
|
|
99497
99775
|
${ctx.hook("before_employee_create", [[ctx.idType, "create_employee.tenant"], ["jsonb", "create_employee.attrs"]])}
|
|
99498
99776
|
begin
|
|
99499
99777
|
v_status := ${status};
|
|
99500
|
-
if v_status
|
|
99778
|
+
if ${ctx.is("employees", "status", "v_status", ["offboarded"])} then
|
|
99501
99779
|
${fail$1("EMPLOYEE_STATUS_INVALID", "create the employee, then offboard them", "22023")}
|
|
99502
99780
|
end if;
|
|
99503
99781
|
insert into ${table} (${insertColumns.join(", ")}${extrasInsert.columns})
|
|
@@ -100595,7 +100873,16 @@ ${triggerGrant(`better_supabase.${guardName}()`)}
|
|
|
100595
100873
|
drop trigger if exists ${guardName} on ${t("employees")};
|
|
100596
100874
|
create trigger ${guardName} before insert or update of ${e("manager")} on ${t("employees")}
|
|
100597
100875
|
for each row execute function better_supabase.${guardName}();
|
|
100598
|
-
${mirror}`;
|
|
100876
|
+
${mirror}${approvalMemo(ctx, t("employees"))}`;
|
|
100877
|
+
}
|
|
100878
|
+
function approvalMemo(ctx, table) {
|
|
100879
|
+
if (!ctx.installed("approvals") || ctx.of("approvals").mode === "custom") return "";
|
|
100880
|
+
const approvals = ctx.of("approvals");
|
|
100881
|
+
return `
|
|
100882
|
+
drop trigger if exists ${approvals.trigger("approval_memo")} on ${table};
|
|
100883
|
+
create trigger ${approvals.trigger("approval_memo")} after insert or update or delete on ${table}
|
|
100884
|
+
for each statement execute function ${approvals.fn("approval_memo_bump")}();
|
|
100885
|
+
`;
|
|
100599
100886
|
}
|
|
100600
100887
|
function optionalKey(ctx, action) {
|
|
100601
100888
|
const key = ctx.config.permissions[action];
|
|
@@ -100737,7 +101024,8 @@ const EMPLOYEES = {
|
|
|
100737
101024
|
"outbox",
|
|
100738
101025
|
"relations",
|
|
100739
101026
|
"hiring",
|
|
100740
|
-
"time-tracking"
|
|
101027
|
+
"time-tracking",
|
|
101028
|
+
"approvals"
|
|
100741
101029
|
],
|
|
100742
101030
|
target: "schema",
|
|
100743
101031
|
modes: ["managed", "custom"],
|
|
@@ -169324,10 +169612,10 @@ const PERIODS = {
|
|
|
169324
169612
|
const PGTAP = {
|
|
169325
169613
|
name: "pgtap",
|
|
169326
169614
|
title: "pgTAP helpers",
|
|
169327
|
-
description: "tests.create_user, tests.authenticate_as and catalog checks (every_table_has_rls, policies_use, no_anon_policies, every_table_audited, partitions_have_rls) for `supabase test db`. Written to supabase/tests, never to your schema.",
|
|
169615
|
+
description: "tests.create_user, tests.authenticate_as (by id or email), tests.authenticate_as_issued and catalog checks (every_table_has_rls, policies_use, no_anon_policies, every_table_audited, partitions_have_rls) for `supabase test db`. Written to supabase/tests, never to your schema.",
|
|
169328
169616
|
requires: [],
|
|
169329
169617
|
target: "test",
|
|
169330
|
-
build: () => `-- Runs first (000_) and commits, so later test files can use the helpers.
|
|
169618
|
+
build: (_ctx, layout) => `-- Runs first (000_) and commits, so later test files can use the helpers.
|
|
169331
169619
|
create extension if not exists pgtap with schema extensions;
|
|
169332
169620
|
create schema if not exists tests;
|
|
169333
169621
|
grant usage on schema tests to anon, authenticated, service_role;
|
|
@@ -169377,6 +169665,55 @@ begin
|
|
|
169377
169665
|
end;
|
|
169378
169666
|
$$;
|
|
169379
169667
|
|
|
169668
|
+
-- The same by email address: tests.authenticate_as('member@acme.test'). An
|
|
169669
|
+
-- untyped literal or parameter resolves to this overload, so a uuid string
|
|
169670
|
+
-- is taken as the user's id.
|
|
169671
|
+
create or replace function tests.authenticate_as(user_email text)
|
|
169672
|
+
returns void
|
|
169673
|
+
language plpgsql
|
|
169674
|
+
set search_path = ''
|
|
169675
|
+
as $$
|
|
169676
|
+
declare
|
|
169677
|
+
found_id uuid;
|
|
169678
|
+
begin
|
|
169679
|
+
if user_email ~* '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$' then
|
|
169680
|
+
perform tests.authenticate_as(user_email::uuid);
|
|
169681
|
+
return;
|
|
169682
|
+
end if;
|
|
169683
|
+
select u.id into found_id from auth.users u where u.email = user_email;
|
|
169684
|
+
if found_id is null then
|
|
169685
|
+
raise exception 'tests.authenticate_as: no user with email %', user_email;
|
|
169686
|
+
end if;
|
|
169687
|
+
perform tests.authenticate_as(found_id);
|
|
169688
|
+
end;
|
|
169689
|
+
$$;
|
|
169690
|
+
|
|
169691
|
+
-- Runs as this user with the claims your custom access token hook issues, as a
|
|
169692
|
+
-- real sign-in does. The hook defaults to auth.hook.custom_access_token of
|
|
169693
|
+
-- config.toml at the time of gen; pass another as 'public.my_hook'.
|
|
169694
|
+
create or replace function tests.authenticate_as_issued(user_id uuid, hook text default ${layout.customAccessTokenHook === void 0 ? "null" : sqlString(layout.customAccessTokenHook)})
|
|
169695
|
+
returns void
|
|
169696
|
+
language plpgsql
|
|
169697
|
+
set search_path = ''
|
|
169698
|
+
as $$
|
|
169699
|
+
declare
|
|
169700
|
+
issued jsonb;
|
|
169701
|
+
base_claims jsonb;
|
|
169702
|
+
begin
|
|
169703
|
+
if hook is null then
|
|
169704
|
+
raise exception 'tests.authenticate_as_issued: set auth.hook.custom_access_token in config.toml, or pass the hook';
|
|
169705
|
+
end if;
|
|
169706
|
+
select jsonb_build_object('sub', u.id, 'role', 'authenticated', 'email', u.email, 'aud', 'authenticated', 'app_metadata', u.raw_app_meta_data, 'user_metadata', u.raw_user_meta_data)
|
|
169707
|
+
into base_claims from auth.users u where u.id = authenticate_as_issued.user_id;
|
|
169708
|
+
if base_claims is null then
|
|
169709
|
+
raise exception 'tests.authenticate_as_issued: no user %', user_id;
|
|
169710
|
+
end if;
|
|
169711
|
+
execute format('select (%s(%L::jsonb)) -> ''claims''', hook, jsonb_build_object('user_id', user_id, 'claims', base_claims, 'authentication_method', 'password')::text) into issued;
|
|
169712
|
+
perform set_config('request.jwt.claims', issued::text, true);
|
|
169713
|
+
set local role authenticated;
|
|
169714
|
+
end;
|
|
169715
|
+
$$;
|
|
169716
|
+
|
|
169380
169717
|
create or replace function tests.authenticate_as_anon()
|
|
169381
169718
|
returns void
|
|
169382
169719
|
language plpgsql
|
|
@@ -190540,12 +190877,14 @@ function isReadSetsRef(value) {
|
|
|
190540
190877
|
* a read set (the function `public.rs_<name>`), or to `{ readSets, shell? }`,
|
|
190541
190878
|
* where the caller picks one of the read sets per call.
|
|
190542
190879
|
*/
|
|
190543
|
-
function subjectOf(name, subject) {
|
|
190544
|
-
if (subject === void 0) return;
|
|
190880
|
+
function subjectOf(name, subject, fallback) {
|
|
190881
|
+
if (subject === void 0) return fallback;
|
|
190882
|
+
if (subject === false) return;
|
|
190545
190883
|
if (typeof subject !== "string" || !FUNCTION_NAME.test(subject)) throw new TypeError(`${WHERE$4}.${name}.subject must name a function as schema.function`);
|
|
190546
190884
|
return subject;
|
|
190547
190885
|
}
|
|
190548
|
-
function bootstrapFunctions(ctx) {
|
|
190886
|
+
function bootstrapFunctions(ctx, layout) {
|
|
190887
|
+
const fallback = layout.accessProvider?.functions.subject;
|
|
190549
190888
|
const raw = ctx.option("bootstrap");
|
|
190550
190889
|
if (raw === void 0) return [];
|
|
190551
190890
|
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) throw new TypeError(`${WHERE$4} must map names to functions, e.g. { home: "app.home_data" } or { home: { readSet: "home" } }`);
|
|
@@ -190558,7 +190897,7 @@ function bootstrapFunctions(ctx) {
|
|
|
190558
190897
|
name,
|
|
190559
190898
|
fn: fn.shell,
|
|
190560
190899
|
readSets: fn.readSets,
|
|
190561
|
-
subject: subjectOf(name, fn.subject)
|
|
190900
|
+
subject: subjectOf(name, fn.subject, fallback)
|
|
190562
190901
|
};
|
|
190563
190902
|
}
|
|
190564
190903
|
if (isReadSetRef(fn)) {
|
|
@@ -190567,14 +190906,15 @@ function bootstrapFunctions(ctx) {
|
|
|
190567
190906
|
name,
|
|
190568
190907
|
fn: `public.rs_${fn.readSet}`,
|
|
190569
190908
|
readSets: [],
|
|
190570
|
-
subject: subjectOf(name, fn.subject)
|
|
190909
|
+
subject: subjectOf(name, fn.subject, fallback)
|
|
190571
190910
|
};
|
|
190572
190911
|
}
|
|
190573
190912
|
if (typeof fn !== "string" || !FUNCTION_NAME.test(fn)) throw new TypeError(`${WHERE$4}.${name} must name a function as schema.function, e.g. "app.home_data"`);
|
|
190574
190913
|
return {
|
|
190575
190914
|
name,
|
|
190576
190915
|
fn,
|
|
190577
|
-
readSets: []
|
|
190916
|
+
readSets: [],
|
|
190917
|
+
subject: fallback
|
|
190578
190918
|
};
|
|
190579
190919
|
});
|
|
190580
190920
|
}
|
|
@@ -190594,7 +190934,7 @@ function hasVersionSource(ctx, layout) {
|
|
|
190594
190934
|
* `token_authz_version` is the token's.
|
|
190595
190935
|
*/
|
|
190596
190936
|
function bootstrapWrappers(ctx, layout) {
|
|
190597
|
-
const functions = bootstrapFunctions(ctx);
|
|
190937
|
+
const functions = bootstrapFunctions(ctx, layout);
|
|
190598
190938
|
if (functions.length === 0) return "";
|
|
190599
190939
|
const live = hasVersionSource(ctx, layout) ? "to_jsonb(better_supabase.caller_authz_version())" : "auth.jwt() -> 'authz_ver'";
|
|
190600
190940
|
return `
|
|
@@ -190911,6 +191251,30 @@ $$;
|
|
|
190911
191251
|
revoke execute on function better_supabase.last_sign_ins(uuid[]) from public, anon, authenticated;
|
|
190912
191252
|
grant execute on function better_supabase.last_sign_ins(uuid[]) to service_role;
|
|
190913
191253
|
|
|
191254
|
+
-- Deletes every session and refresh token of a user and returns how many
|
|
191255
|
+
-- sessions went. Only the service role calls this, over SQL or the Data API.
|
|
191256
|
+
create or replace function better_supabase.end_sessions(p_user uuid)
|
|
191257
|
+
returns int
|
|
191258
|
+
language plpgsql
|
|
191259
|
+
volatile
|
|
191260
|
+
security definer
|
|
191261
|
+
set search_path = ''
|
|
191262
|
+
as $$
|
|
191263
|
+
declare
|
|
191264
|
+
ended int;
|
|
191265
|
+
begin
|
|
191266
|
+
with gone as (
|
|
191267
|
+
delete from auth.sessions s where s.user_id = end_sessions.p_user returning s.id
|
|
191268
|
+
)
|
|
191269
|
+
select count(*)::int into ended from gone;
|
|
191270
|
+
delete from auth.refresh_tokens t where t.user_id = end_sessions.p_user::text;
|
|
191271
|
+
return ended;
|
|
191272
|
+
end;
|
|
191273
|
+
$$;
|
|
191274
|
+
|
|
191275
|
+
revoke execute on function better_supabase.end_sessions(uuid) from public, anon, authenticated;
|
|
191276
|
+
grant execute on function better_supabase.end_sessions(uuid) to service_role;
|
|
191277
|
+
|
|
190914
191278
|
-- The caller's own unexpired sessions, most recently active first, with the
|
|
190915
191279
|
-- one behind the current token marked.
|
|
190916
191280
|
create or replace function better_supabase.list_my_sessions()
|
|
@@ -207700,31 +208064,6 @@ const ACTIVITY = {
|
|
|
207700
208064
|
contract: contract$6,
|
|
207701
208065
|
build: build$7
|
|
207702
208066
|
};
|
|
207703
|
-
// src/sql/memo.ts
|
|
207704
|
-
/**
|
|
207705
|
-
* A memo for one transaction, over a transaction-local setting. PostgREST runs
|
|
207706
|
-
* one request in one transaction, so a policy helper can compute a value once
|
|
207707
|
-
* and every later call in the statement reads it (ADR 0230). The empty string
|
|
207708
|
-
* reads as unset.
|
|
207709
|
-
*/
|
|
207710
|
-
const MEMO_FUNCTIONS = `
|
|
207711
|
-
create or replace function better_supabase.memo_get(key text)
|
|
207712
|
-
returns text
|
|
207713
|
-
language sql
|
|
207714
|
-
volatile
|
|
207715
|
-
set search_path = ''
|
|
207716
|
-
as $$
|
|
207717
|
-
select nullif(pg_catalog.current_setting('better_supabase.memo.' || key, true), '')
|
|
207718
|
-
$$;
|
|
207719
|
-
|
|
207720
|
-
create or replace function better_supabase.memo_set(key text, value text)
|
|
207721
|
-
returns text
|
|
207722
|
-
language sql
|
|
207723
|
-
volatile
|
|
207724
|
-
set search_path = ''
|
|
207725
|
-
as $$
|
|
207726
|
-
select pg_catalog.set_config('better_supabase.memo.' || key, value, true)
|
|
207727
|
-
$$;`;
|
|
207728
208067
|
// src/sql/modules/updated-at.ts
|
|
207729
208068
|
const UPDATED_AT = {
|
|
207730
208069
|
name: "updated-at",
|
|
@@ -215603,9 +215942,9 @@ create table if not exists ${n.table("deliveries")} (
|
|
|
215603
215942
|
...n.partitioned ? [`primary key (${v("id")}, ${v("createdAt")})`] : []
|
|
215604
215943
|
].join(",\n ")}
|
|
215605
215944
|
)${n.partitioned ? ` partition by range (${v("createdAt")});\n${defaultPartition(n.table("deliveries"), fallback)}` : ";"}
|
|
215606
|
-
${added(n, "deliveries", [["subject", "text"]])}create index if not exists webhook_deliveries_due_idx on ${n.table("deliveries")} (${v("availableAt")}, ${v("leasedUntil")}) where ${v("status")} in (
|
|
215945
|
+
${added(n, "deliveries", [["subject", "text"]])}create index if not exists webhook_deliveries_due_idx on ${n.table("deliveries")} (${v("availableAt")}, ${v("leasedUntil")}) where ${v("status")} in (${n.status("pending")}, ${n.status("retrying")}, ${n.status("delivering")});
|
|
215607
215946
|
create index if not exists webhook_deliveries_endpoint_idx on ${n.table("deliveries")} (${v("endpoint")}, ${v("createdAt")} desc);
|
|
215608
|
-
create index if not exists webhook_deliveries_open_idx on ${n.table("deliveries")} (${v("endpoint")}) where ${v("status")} in (
|
|
215947
|
+
create index if not exists webhook_deliveries_open_idx on ${n.table("deliveries")} (${v("endpoint")}) where ${v("status")} in (${n.status("pending")}, ${n.status("retrying")});
|
|
215609
215948
|
create index if not exists webhook_deliveries_finished_idx on ${n.table("deliveries")} (${v("createdAt")}) where ${v("status")} in (${n.status("succeeded")}, ${n.status("canceled")}, ${n.status("dead")});${n.has("deliveries", "tenant") ? `
|
|
215610
215949
|
create index if not exists webhook_deliveries_tenant_created_idx on ${n.table("deliveries")} (${v("tenant")}, ${v("createdAt")} desc);` : ""}${n.has("deliveries", "event") ? `
|
|
215611
215950
|
create ${n.partitioned ? "" : "unique "}index if not exists webhook_deliveries_endpoint_event_idx on ${n.table("deliveries")} (${v("endpoint")}, ${v("event")}) where ${v("event")} is not null;` : ""}
|