better-supabase 0.62.0 → 0.63.1
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/{activities-BMQuBkrQ.d.ts → activities-DFL2uhTK.d.ts} +1 -1
- package/dist/{agents-NaSREeo_.d.ts → agents-Bceu5a4z.d.ts} +1 -1
- package/dist/{agents-CRTcqx6K.d.ts → agents-C8BwEXD0.d.ts} +6 -6
- package/dist/{ai-cache-CKOJ9cLZ.d.ts → ai-cache-Dnj5iteF.d.ts} +1 -1
- package/dist/{ai-chat-C8FEgeTd.d.ts → ai-chat-CVmnJZcP.d.ts} +1 -1
- package/dist/{ai-schedules-DdoefSrp.d.ts → ai-schedules-j51dDzm3.d.ts} +2 -2
- package/dist/ai-sdk/agents/index.d.ts +2 -2
- package/dist/ai-sdk/batches/index.d.ts +1 -1
- package/dist/ai-sdk/cache/index.d.ts +1 -1
- package/dist/ai-sdk/chat/index.d.ts +2 -2
- package/dist/ai-sdk/embeddings/index.d.ts +2 -2
- package/dist/ai-sdk/index.d.ts +5 -5
- package/dist/ai-sdk/memory/index.d.ts +3 -3
- package/dist/ai-sdk/workflow/index.d.ts +4 -4
- package/dist/{api-C5GmF1ZU.js → api-C506eYSc.js} +1 -1
- package/dist/{app-tables-C0w_j1sJ.d.ts → app-tables-Br5Khxij.d.ts} +1 -1
- package/dist/{assistant-BQAjAXDe.d.ts → assistant-JXmSCGyW.d.ts} +2 -2
- package/dist/{authorization-DKxttkik.d.ts → authorization-k0Y3L701.d.ts} +1 -1
- package/dist/{bind-DiQyvXnj.d.ts → bind-CuRPlZYY.d.ts} +3 -3
- package/dist/{block-env-aG5V88tR.d.ts → block-env-hdFBj6FQ.d.ts} +4 -4
- package/dist/{block-tables-lpnW9xMs.d.ts → block-tables-1XNfpOPP.d.ts} +1 -1
- package/dist/blocks/access-requests/index.d.ts +1 -1
- package/dist/blocks/accounting/index.d.ts +1 -1
- package/dist/blocks/acknowledgements/index.d.ts +1 -1
- package/dist/blocks/activities/index.d.ts +3 -3
- package/dist/blocks/advisories/index.d.ts +1 -1
- package/dist/blocks/agent-checkout/index.d.ts +2 -2
- package/dist/blocks/agents/index.d.ts +3 -3
- package/dist/blocks/ai-cache/index.d.ts +2 -2
- package/dist/blocks/ai-chat/index.d.ts +3 -3
- package/dist/blocks/ai-evals/index.d.ts +1 -1
- package/dist/blocks/ai-files/index.d.ts +1 -1
- package/dist/blocks/ai-guardrails/index.d.ts +1 -1
- package/dist/blocks/ai-keys/index.d.ts +1 -1
- package/dist/blocks/ai-schedules/index.d.ts +2 -2
- package/dist/blocks/announcements/index.d.ts +4 -4
- package/dist/blocks/api-keys/index.d.ts +1 -1
- package/dist/blocks/appraisals/index.d.ts +1 -1
- package/dist/blocks/approvals/index.d.ts +1 -1
- package/dist/blocks/assets/index.d.ts +2 -2
- package/dist/blocks/assignment/index.d.ts +1 -1
- package/dist/blocks/attachments/index.d.ts +6 -6
- package/dist/blocks/audit/index.d.ts +2 -2
- package/dist/blocks/automations/index.d.ts +3 -3
- package/dist/blocks/banking/index.d.ts +1 -1
- package/dist/blocks/billable-time/index.d.ts +1 -1
- package/dist/blocks/billing/index.d.ts +2 -2
- package/dist/blocks/bookings/index.d.ts +3 -3
- package/dist/blocks/bulk-actions/index.d.ts +2 -2
- package/dist/blocks/calendar/index.d.ts +3 -3
- package/dist/blocks/care/index.d.ts +27 -27
- package/dist/blocks/care-plans/index.d.ts +3 -3
- package/dist/blocks/cases/index.d.ts +3 -3
- package/dist/blocks/catalog/index.d.ts +2 -2
- package/dist/blocks/channels/index.d.ts +1 -1
- package/dist/blocks/clinical-decision-support/index.d.ts +1 -1
- package/dist/blocks/cms/index.d.ts +5 -5
- package/dist/blocks/collaboration/index.d.ts +6 -6
- package/dist/blocks/collections/index.d.ts +1 -1
- package/dist/blocks/comments/index.d.ts +2 -2
- package/dist/blocks/commerce/index.d.ts +6 -6
- package/dist/blocks/commissions/index.d.ts +1 -1
- package/dist/blocks/compliance/index.d.ts +1 -1
- package/dist/blocks/connectors/index.d.ts +1 -1
- package/dist/blocks/consents/index.d.ts +2 -2
- package/dist/blocks/contacts/index.d.ts +2 -2
- package/dist/blocks/content/index.d.ts +2 -2
- package/dist/blocks/contracts/index.d.ts +1 -1
- package/dist/blocks/courses/index.d.ts +2 -2
- package/dist/blocks/created-by/index.d.ts +2 -2
- package/dist/blocks/crm/index.d.ts +16 -16
- package/dist/blocks/crm/index.js +1 -1
- package/dist/blocks/custom-fields/index.d.ts +1 -1
- package/dist/blocks/dam/index.d.ts +2 -2
- package/dist/blocks/data-lifecycle/index.d.ts +2 -2
- package/dist/blocks/deadlines/index.d.ts +1 -1
- package/dist/blocks/deals/index.d.ts +1 -1
- package/dist/blocks/dispatch/index.d.ts +2 -2
- package/dist/blocks/document-templates/index.d.ts +2 -2
- package/dist/blocks/documents/index.d.ts +1 -1
- package/dist/blocks/domains/index.d.ts +1 -1
- package/dist/blocks/donations/index.d.ts +1 -1
- package/dist/blocks/drive/index.d.ts +5 -5
- package/dist/blocks/e-prescribing/index.d.ts +1 -1
- package/dist/blocks/employees/index.d.ts +1 -1
- package/dist/blocks/enrichment/index.d.ts +1 -1
- package/dist/blocks/enrollments/index.d.ts +2 -2
- package/dist/blocks/entitlements/index.d.ts +3 -3
- package/dist/blocks/events/index.d.ts +4 -4
- package/dist/blocks/expenses/index.d.ts +1 -1
- package/dist/blocks/field-history/index.d.ts +1 -1
- package/dist/blocks/filespace/index.d.ts +8 -8
- package/dist/blocks/finance/index.d.ts +5 -5
- package/dist/blocks/flags/index.d.ts +1 -1
- package/dist/blocks/forecasts/index.d.ts +1 -1
- package/dist/blocks/forms/index.d.ts +3 -3
- package/dist/blocks/funding/index.d.ts +2 -2
- package/dist/blocks/goals/index.d.ts +1 -1
- package/dist/blocks/governance/index.d.ts +4 -4
- package/dist/blocks/guests/index.d.ts +1 -1
- package/dist/blocks/hiring/index.d.ts +1 -1
- package/dist/blocks/identities/index.d.ts +1 -1
- package/dist/blocks/imports/index.d.ts +2 -2
- package/dist/blocks/inbox/index.d.ts +6 -6
- package/dist/blocks/incidents/index.d.ts +1 -1
- package/dist/blocks/index.d.ts +3 -3
- package/dist/blocks/inspections/index.d.ts +2 -2
- package/dist/blocks/inventory/index.d.ts +1 -1
- package/dist/blocks/invoices/index.d.ts +1 -1
- package/dist/blocks/knowledge/index.d.ts +2 -2
- package/dist/blocks/lead-scoring/index.d.ts +2 -2
- package/dist/blocks/learning/index.d.ts +3 -3
- package/dist/blocks/leases/index.d.ts +1 -1
- package/dist/blocks/leave/index.d.ts +1 -1
- package/dist/blocks/ledger/index.d.ts +1 -1
- package/dist/blocks/legal-entities/index.d.ts +2 -2
- package/dist/blocks/lims/index.d.ts +2 -2
- package/dist/blocks/mail-sync/index.d.ts +3 -3
- package/dist/blocks/maintenance/index.d.ts +2 -2
- package/dist/blocks/manufacturing/index.d.ts +2 -2
- package/dist/blocks/medications/index.d.ts +1 -1
- package/dist/blocks/meetings/index.d.ts +3 -3
- package/dist/blocks/memberships/index.d.ts +2 -2
- package/dist/blocks/memory/index.d.ts +3 -3
- package/dist/blocks/messaging/index.d.ts +5 -5
- package/dist/blocks/metrics/index.d.ts +2 -2
- package/dist/blocks/mfa/index.d.ts +2 -2
- package/dist/blocks/moderation/index.d.ts +2 -2
- package/dist/blocks/notifications/index.d.ts +6 -6
- package/dist/blocks/notifications/index.js +1 -1
- package/dist/blocks/numbering/index.d.ts +1 -1
- package/dist/blocks/oauth-server/index.d.ts +1 -1
- package/dist/blocks/observations/index.d.ts +2 -2
- package/dist/blocks/onboarding/index.d.ts +2 -2
- package/dist/blocks/option-sets/index.d.ts +2 -2
- package/dist/blocks/orders/index.d.ts +2 -2
- package/dist/blocks/organizations/index.d.ts +2 -2
- package/dist/blocks/outbox/index.d.ts +1 -1
- package/dist/blocks/passes/index.d.ts +2 -2
- package/dist/blocks/payroll-export/index.d.ts +2 -2
- package/dist/blocks/people/index.d.ts +7 -7
- package/dist/blocks/periods/index.d.ts +1 -1
- package/dist/blocks/permissions/index.d.ts +3 -3
- package/dist/blocks/pipelines/index.d.ts +2 -2
- package/dist/blocks/posts/index.d.ts +2 -2
- package/dist/blocks/procurement/index.d.ts +5 -5
- package/dist/blocks/profiles/index.d.ts +1 -1
- package/dist/blocks/projects/index.d.ts +7 -7
- package/dist/blocks/promotions/index.d.ts +1 -1
- package/dist/blocks/prompts/index.d.ts +1 -1
- package/dist/blocks/push/index.d.ts +2 -2
- package/dist/blocks/qualifications/index.d.ts +2 -2
- package/dist/blocks/queue/index.d.ts +3 -3
- package/dist/blocks/queue/index.js +1 -1
- package/dist/blocks/quotes/index.d.ts +1 -1
- package/dist/blocks/rank/index.d.ts +2 -2
- package/dist/blocks/reactions/index.d.ts +4 -4
- package/dist/blocks/recruiting/index.d.ts +4 -4
- package/dist/blocks/referrals/index.d.ts +1 -1
- package/dist/blocks/relations/index.d.ts +1 -1
- package/dist/blocks/reminders/index.d.ts +1 -1
- package/dist/blocks/reviews/index.d.ts +1 -1
- package/dist/blocks/rfqs/index.d.ts +2 -2
- package/dist/blocks/risks/index.d.ts +2 -2
- package/dist/blocks/saas/index.d.ts +12 -12
- package/dist/blocks/saas/index.js +1 -1
- package/dist/blocks/sales/index.d.ts +1 -1
- package/dist/blocks/saved-views/index.d.ts +2 -2
- package/dist/blocks/scheduling/index.d.ts +5 -5
- package/dist/blocks/scores/index.d.ts +2 -2
- package/dist/blocks/search/index.d.ts +3 -3
- package/dist/blocks/security-events/index.d.ts +1 -1
- package/dist/blocks/segments/index.d.ts +2 -2
- package/dist/blocks/sequences/index.d.ts +3 -3
- package/dist/blocks/service/index.d.ts +7 -7
- package/dist/blocks/service-accounts/index.d.ts +1 -1
- package/dist/blocks/sessions/index.d.ts +2 -2
- package/dist/blocks/settings/index.d.ts +2 -2
- package/dist/blocks/share-links/index.d.ts +1 -1
- package/dist/blocks/shifts/index.d.ts +2 -2
- package/dist/blocks/shipments/index.d.ts +1 -1
- package/dist/blocks/signatures/index.d.ts +2 -2
- package/dist/blocks/signing-keys/index.d.ts +1 -1
- package/dist/blocks/sla/index.d.ts +1 -1
- package/dist/blocks/sso/index.d.ts +1 -1
- package/dist/blocks/state-machine/index.d.ts +1 -1
- package/dist/blocks/subjects/index.d.ts +2 -2
- package/dist/blocks/support/index.d.ts +5 -5
- package/dist/blocks/tags/index.d.ts +2 -2
- package/dist/blocks/tasks/index.d.ts +2 -2
- package/dist/blocks/tax/index.d.ts +2 -2
- package/dist/blocks/teams/index.d.ts +1 -1
- package/dist/blocks/templates/index.d.ts +2 -2
- package/dist/blocks/tills/index.d.ts +1 -1
- package/dist/blocks/time-entries/index.d.ts +2 -2
- package/dist/blocks/timeline/index.d.ts +1 -1
- package/dist/blocks/trash/index.d.ts +1 -1
- package/dist/blocks/undo/index.d.ts +2 -2
- package/dist/blocks/updated-at/index.d.ts +2 -2
- package/dist/blocks/usage/index.d.ts +3 -3
- package/dist/blocks/vercel-marketplace/index.d.ts +1 -1
- package/dist/blocks/versions/index.d.ts +1 -1
- package/dist/blocks/waitlist/index.d.ts +1 -1
- package/dist/blocks/warehouse/index.d.ts +1 -1
- package/dist/blocks/warranty/index.d.ts +1 -1
- package/dist/blocks/webhooks/index.d.ts +2 -2
- package/dist/blocks/workflow-editor/index.d.ts +4 -4
- package/dist/blocks/workflows/index.d.ts +4 -4
- package/dist/{blocks-BaVwMDrs.d.ts → blocks-C2F_SycJ.d.ts} +4 -4
- package/dist/{bookings-6dC83XE6.d.ts → bookings-DIQGDex_.d.ts} +1 -1
- package/dist/{build-C0BLapAI.js → build-DUasKASQ.js} +1 -1
- package/dist/claims/index.d.ts +5 -5
- package/dist/{claims-source-yTqGqUDc.d.ts → claims-source-fUk4pR24.d.ts} +1 -1
- package/dist/cli/{add-DLYO-lcP.js → add-B5Ras98V.js} +2 -2
- package/dist/cli/{add-DH4qqKNb.js → add-BymOCZ8D.js} +9 -9
- package/dist/cli/add-CEqHL96B.js +1 -0
- package/dist/cli/{app-table-files--ulI7C3Z.js → app-table-files-DAt5YA7_.js} +3 -3
- package/dist/cli/{app-tables-CQVNZglP.js → app-tables-CTZeU4F2.js} +2 -2
- package/dist/cli/{backfill-Byn-Pe2a.js → backfill-mm77568B.js} +1 -1
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{blocks-BATYI3l9.js → blocks-BHUYzWRT.js} +1 -1
- package/dist/cli/{blocks-D7DYKEOZ.js → blocks-D2Vir61A.js} +1 -1
- package/dist/cli/{cache-D6iHVy6b.js → cache-DKdjMfP9.js} +1 -1
- package/dist/cli/{codemod-PLqZ1YGz.js → codemod-Dne7b20w.js} +4 -4
- package/dist/cli/{codemod-naming-BgEIRJLM.js → codemod-naming-ByeMo_ll.js} +1 -1
- package/dist/cli/{column-renames-B1bMtdIF.js → column-renames-FlO8U6SA.js} +2 -2
- package/dist/cli/{content-mapper-BGus1ryq.js → content-mapper-VUqqAubX.js} +1 -1
- package/dist/cli/{dev-Bd6RJwLg.js → dev-CI10aUMK.js} +3 -3
- package/dist/cli/{doctor-DW_QzhsK.js → doctor-DwEBENcA.js} +32 -24
- package/dist/cli/{emit-DGhalWTA.js → emit-Ds-4pNsQ.js} +2 -2
- package/dist/cli/{gen-BjMSXpcG.js → gen-Dqnmr3yO.js} +3 -3
- package/dist/cli/{gen-tasks-D3kLr5we.js → gen-tasks-CaqMHY4E.js} +9 -9
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +7 -7
- package/dist/cli/{init-DeGm-42D.js → init-Dsi-1Q9D.js} +8 -8
- package/dist/cli/{live-CJ3gBXTW.js → live-gVsjEaEB.js} +2 -2
- package/dist/cli/{mcp-C7bG8fs9.js → mcp-DsTQAIyD.js} +2 -2
- package/dist/cli/{memo-backend-BbAaoaCp.js → memo-backend-DvchDMYn.js} +1 -1
- package/dist/cli/{metadata-Da7lPV1G.js → metadata-Dm63aecV.js} +4 -4
- package/dist/cli/{migrate-adO6TGQx.js → migrate-auWUrtTl.js} +1 -1
- package/dist/cli/{migration-safety-TjFxbPdK.js → migration-safety-QkRu7ef8.js} +1 -1
- package/dist/cli/{module-migration-BOwCFfuw.js → module-migration-Ddk92fRs.js} +1 -1
- package/dist/cli/{partition-Bi76oVvt.js → partition-BuX62VyM.js} +1 -1
- package/dist/cli/powersync-BEebY0Uf.js +1 -0
- package/dist/cli/{powersync-01LIe9WO.js → powersync-Cex4H5my.js} +3 -3
- package/dist/cli/{print-CoDV1AZr.js → print-D4XpS5Qp.js} +2 -2
- package/dist/cli/{providers-B3VKJOGS.js → providers-D7U-7DDW.js} +1 -1
- package/dist/cli/{prune-workflows-Ck7bPjbs.js → prune-workflows-CKW78AsP.js} +1 -1
- package/dist/cli/{remove-B0mcKNLX.js → remove-t4JoqycQ.js} +6 -6
- package/dist/cli/{render-g0u-8VRx.js → render-CIdg7VKj.js} +4 -4
- package/dist/cli/{render-cache-Dkkervpu.js → render-cache-Zjt3OgD_.js} +1 -1
- package/dist/cli/{run-DcjkMeLQ.js → run-BIT66ThJ.js} +30 -30
- package/dist/cli/{run-DKHipy0c.js → run-C-zh0kxb.js} +7 -7
- package/dist/cli/{shared-BL_SZdUw.js → shared-D5_5NsEI.js} +1 -1
- package/dist/cli/{source-BBn7ypvg.js → source-50A8IPu1.js} +1 -1
- package/dist/cli/{spec-COv0ojkG.js → spec-CiZPOLx8.js} +2 -2
- package/dist/cli/{spec-DH55djVx.js → spec-DvCBeVz2.js} +1 -1
- package/dist/cli/{sql-layout-ClqJfxAp.js → sql-layout-n5vgZ671.js} +2 -2
- package/dist/cli/{squash-Cit4Liiw.js → squash-PNv_rd5n.js} +1 -1
- package/dist/cli/{sync-Ba5EvTIT.js → sync-DNSR4TUL.js} +4 -4
- package/dist/cli/{upgrade-DI4ZTrXV.js → upgrade-B5LgLXX4.js} +5 -5
- package/dist/cli/{upgrade-BIuxR2Z-.js → upgrade-b477KsEI.js} +5 -5
- package/dist/cli/{version-D_miCSxz.js → version-CyIR9dhg.js} +1 -1
- package/dist/client/index.d.ts +5 -5
- package/dist/client/native/index.d.ts +4 -4
- package/dist/config/index.d.ts +4 -4
- package/dist/{context-C-msUG_m.d.ts → context-DtyeoCvj.d.ts} +3 -3
- package/dist/contract/index.d.ts +3 -3
- package/dist/{controller-DMoPjq2t.d.ts → controller-D6ZUjfhv.d.ts} +1 -1
- package/dist/{conversion-Cckh_HHY.d.ts → conversion-BiAEs9ja.d.ts} +1 -1
- package/dist/create/index.d.ts +4 -4
- package/dist/create/index.js +1 -1
- package/dist/create/lite/index.d.ts +3 -3
- package/dist/create/lite/index.js +2 -2
- package/dist/{define-block-ClbL68WH.d.ts → define-block-DpnCxELV.d.ts} +1 -1
- package/dist/{drive-DXU2QoV_.d.ts → drive-_xuMA2xw.d.ts} +1 -1
- package/dist/{embeddings-BriQ4hQ1.d.ts → embeddings-BhTNerJ8.d.ts} +2 -2
- package/dist/{entitlements-DKNLoLw3.d.ts → entitlements-Djh4bBdj.d.ts} +2 -2
- package/dist/eve/index.d.ts +3 -3
- package/dist/{eve-D-hvUFYE.d.ts → eve-DCA-YKQZ.d.ts} +2 -2
- package/dist/{extract-CzjhSs6g.d.ts → extract-DZznUgzb.d.ts} +3 -3
- package/dist/{extras-Ctnag4x3.d.ts → extras-Cb1ZUvNK.d.ts} +1 -1
- package/dist/{field-errors-D0vkq05i.d.ts → field-errors-DSEpFDCa.d.ts} +5 -5
- package/dist/{gateway-eFh5pEIu.d.ts → gateway-oivw0R3W.d.ts} +3 -3
- package/dist/generators/factories/index.d.ts +1 -1
- package/dist/generators/factories/index.js +1 -1
- package/dist/generators/index.d.ts +2 -2
- package/dist/generators/json-schema/index.d.ts +2 -2
- package/dist/generators/json-schema/index.js +1 -1
- package/dist/generators/nuqs/index.d.ts +1 -1
- package/dist/generators/nuqs/index.js +1 -1
- package/dist/generators/standard-schema/index.d.ts +1 -1
- package/dist/generators/standard-schema/index.js +1 -1
- package/dist/generators/valibot/index.d.ts +1 -1
- package/dist/generators/valibot/index.js +1 -1
- package/dist/generators/zod/index.d.ts +1 -1
- package/dist/generators/zod/index.js +1 -1
- package/dist/{index-bDmQ69hy.d.ts → index-1aGCqU0F.d.ts} +1 -1
- package/dist/{index-Bz-T_58c.d.ts → index-B2NJNoRd.d.ts} +8 -8
- package/dist/{index-B9kqCDKK.d.ts → index-BAccIXQt.d.ts} +2 -2
- package/dist/{index-C0rHOTr-.d.ts → index-BDq77p1R.d.ts} +2 -2
- package/dist/{index-BG1eY1KO.d.ts → index-BEVvxkvW.d.ts} +2 -2
- package/dist/{index-CfYIKxmO.d.ts → index-BIOLHETk.d.ts} +1 -1
- package/dist/{index-DwC5RgXo.d.ts → index-BKD8Lkn9.d.ts} +7 -7
- package/dist/{index-DewyE3_q.d.ts → index-BREewNqU.d.ts} +1 -1
- package/dist/{index-k-3GAYGO.d.ts → index-BeJMACah.d.ts} +2 -2
- package/dist/{index-JCe4Kgvs.d.ts → index-BiX0gNGQ.d.ts} +2 -2
- package/dist/{index-b_QoL2Xl.d.ts → index-Bt5jJrzR.d.ts} +1 -1
- package/dist/{index-C1rKo4z7.d.ts → index-Bx9qRuof.d.ts} +1 -1
- package/dist/{index-BO4gZI8-.d.ts → index-C-h2MrvD.d.ts} +1 -1
- package/dist/{index-DeJHUkru.d.ts → index-C8H6hpAP.d.ts} +2 -2
- package/dist/{index-CN9tlkaZ.d.ts → index-CaE6XZnq.d.ts} +3 -3
- package/dist/{index-BTgHDNoK.d.ts → index-CbKxPo6t.d.ts} +2 -2
- package/dist/{index-Cy-294dJ.d.ts → index-CjmtqiRE.d.ts} +1 -1
- package/dist/{index-M6PP_nv1.d.ts → index-CmHvVWGd.d.ts} +1 -1
- package/dist/{index-BNbcydCQ.d.ts → index-CygaT0GH.d.ts} +1 -1
- package/dist/{index-DMaROBj_.d.ts → index-D-LxyjmH.d.ts} +3 -3
- package/dist/{index-C-vdLX8y.d.ts → index-D9fhYtnp.d.ts} +2 -2
- package/dist/{index-CO_JEQpa.d.ts → index-DAYCCmVC.d.ts} +1 -1
- package/dist/{index-C7AEdCOx.d.ts → index-DEHVn5Ma.d.ts} +2 -2
- package/dist/{index-6L3fO1VW.d.ts → index-DIwhnfIi.d.ts} +2 -2
- package/dist/{index-xNtO4Cbv.d.ts → index-DUDYFfnG.d.ts} +1 -1
- package/dist/{index-OPLT30am.d.ts → index-DVmqH-jI.d.ts} +3 -3
- package/dist/{index-DLPEBVA3.d.ts → index-Dga-eftL.d.ts} +5 -5
- package/dist/{index-CaBdEfvB.d.ts → index-DitpSLYH.d.ts} +2 -2
- package/dist/{index-BwbFX9kz.d.ts → index-Dsb6-otF.d.ts} +1 -1
- package/dist/{index-tHzSmAVM.d.ts → index-DtGyj0RU.d.ts} +4 -4
- package/dist/{index-L9nFXemf.d.ts → index-RGXgZmyg.d.ts} +2 -2
- package/dist/{index-DHwwaa5c.d.ts → index-S6WKucTU.d.ts} +1 -1
- package/dist/{index-BIk7uOsB.d.ts → index-TkkZfmGg.d.ts} +1 -1
- package/dist/{index-BoidURQg.d.ts → index-_IFPpPG9.d.ts} +1 -1
- package/dist/{index-DPHg8c59.d.ts → index-bFOgwrCN.d.ts} +1 -1
- package/dist/{index-DTBxclC4.d.ts → index-jJ7Q-AYO.d.ts} +2 -2
- package/dist/{index-FfVEwPC7.d.ts → index-vOUlkC2o.d.ts} +1 -1
- package/dist/{json-schema-C8deWP59.js → json-schema-Cb5ORIIa.js} +1 -1
- package/dist/{knowledge-C7RZqwQu.d.ts → knowledge-CSWQouuC.d.ts} +1 -1
- package/dist/{manifest-BZNn8jSV.d.ts → manifest-4K_pRDrE.d.ts} +1 -1
- package/dist/{manifest-Dqths6WM.d.ts → manifest-4ZM88myP.d.ts} +1 -1
- package/dist/{manifest-BTdv7qf4.d.ts → manifest-4zuq-I0U.d.ts} +1 -1
- package/dist/{manifest-D5TAMdzY.d.ts → manifest-B-5cqXlx.d.ts} +1 -1
- package/dist/{manifest-CpqWpt8p.d.ts → manifest-B11QNHpO.d.ts} +1 -1
- package/dist/{manifest-DZwGgT_z.d.ts → manifest-B1R3o592.d.ts} +1 -1
- package/dist/{manifest-C71ANbeV.d.ts → manifest-B1bfLbzz.d.ts} +1 -1
- package/dist/{manifest-CsJCoSyK.d.ts → manifest-B5y82qsH.d.ts} +2 -2
- package/dist/{manifest-DdE8MnRN.d.ts → manifest-B9FkI5Za.d.ts} +1 -1
- package/dist/{manifest-DJuZGlHR.d.ts → manifest-BBQmMfq7.d.ts} +1 -1
- package/dist/{manifest-Bk8cjM0l.d.ts → manifest-BFc_Zpzf.d.ts} +1 -1
- package/dist/{manifest-C2PHEJ5z.d.ts → manifest-BGBYLCP-.d.ts} +1 -1
- package/dist/{manifest-DJIIa2Em.d.ts → manifest-BLVRM4WX.d.ts} +1 -1
- package/dist/{manifest-Cg8WeAdC.d.ts → manifest-BLkOEccx.d.ts} +1 -1
- package/dist/{manifest-CBlNPtFA.d.ts → manifest-BND77-ps.d.ts} +2 -2
- package/dist/{manifest-CFH-eOXg.d.ts → manifest-BQYkGxek.d.ts} +1 -1
- package/dist/{manifest-Cqt64tuH.d.ts → manifest-BTZI-Jq1.d.ts} +2 -2
- package/dist/{manifest-8h7Bi6Pu.d.ts → manifest-BYHJvkqX.d.ts} +1 -1
- package/dist/{manifest-DplQt5I6.d.ts → manifest-B__S-85Q.d.ts} +1 -1
- package/dist/{manifest-DLHnAPNS.d.ts → manifest-Bgc-jWOV.d.ts} +1 -1
- package/dist/{manifest-DbZYZpku.d.ts → manifest-BsuYq-pZ.d.ts} +1 -1
- package/dist/{manifest-CFsi-Ht5.d.ts → manifest-ByfZrxkk.d.ts} +1 -1
- package/dist/{manifest-YGFH2TL_.d.ts → manifest-C0-rnYge.d.ts} +1 -1
- package/dist/{manifest-BPriFiTU.d.ts → manifest-C02JeWGr.d.ts} +1 -1
- package/dist/{manifest-BAoLDoxK.d.ts → manifest-C3-OpYr0.d.ts} +1 -1
- package/dist/{manifest-DNx5sz8h.d.ts → manifest-C3qUn0ka.d.ts} +1 -1
- package/dist/{manifest-CLdp5_oL.d.ts → manifest-C46GM61W.d.ts} +1 -1
- package/dist/{manifest-C6ITivwS.d.ts → manifest-C9Cs9rtL.d.ts} +1 -1
- package/dist/{manifest-B5Tf88Uq.d.ts → manifest-CE4rGv9r.d.ts} +1 -1
- package/dist/{manifest-CJvaMP9x.d.ts → manifest-CGnYiIs8.d.ts} +1 -1
- package/dist/{manifest-CY_k3qjM.d.ts → manifest-CKbJBLaW.d.ts} +1 -1
- package/dist/{manifest-BLOaDsUW.d.ts → manifest-CQ1Xpja6.d.ts} +1 -1
- package/dist/{manifest-C0Wdg3J2.d.ts → manifest-CRe-o25G.d.ts} +2 -2
- package/dist/{manifest-BrGySkFX.d.ts → manifest-Ca6Rm4u6.d.ts} +1 -1
- package/dist/{manifest-DSA0yeuM.d.ts → manifest-Cf8__tMA.d.ts} +17 -4
- package/dist/{manifest-BHMX17A8.d.ts → manifest-CrO5Gwed.d.ts} +1 -1
- package/dist/{manifest-sOy_ZKWF.d.ts → manifest-CzErrA0R.d.ts} +1 -1
- package/dist/{manifest-cYotBkfZ.d.ts → manifest-D-IfkyQg.d.ts} +1 -1
- package/dist/{manifest-BO1W_e-B.d.ts → manifest-DCIvxvg9.d.ts} +1 -1
- package/dist/{manifest-b3PqBQa0.d.ts → manifest-DEf81vUp.d.ts} +1 -1
- package/dist/{manifest-C5l5bb08.d.ts → manifest-DF6MWZld.d.ts} +1 -1
- package/dist/{manifest-C2rmE8qa.d.ts → manifest-DFRP7LFo.d.ts} +1 -1
- package/dist/{manifest-CiMGJyOC.d.ts → manifest-DH1wX47F.d.ts} +1 -1
- package/dist/{manifest-CEXnXtGH.d.ts → manifest-DIsc4u7U.d.ts} +1 -1
- package/dist/{manifest-BBcaI1P8.js → manifest-DVuGZaJS.js} +20 -6
- package/dist/{manifest-BzO-6IJr.d.ts → manifest-DWS1Hszm.d.ts} +1 -1
- package/dist/{manifest-ChaCvq6y.d.ts → manifest-DYMvHTJ4.d.ts} +1 -1
- package/dist/{manifest-DSvRcUhd.d.ts → manifest-D_RJDjHz.d.ts} +2 -2
- package/dist/{manifest-DsxLVrmD.d.ts → manifest-D_u0Uhd9.d.ts} +1 -1
- package/dist/{manifest-BF-mU2bV.d.ts → manifest-DgVrJNgv.d.ts} +1 -1
- package/dist/{manifest-CK3rwqU_.d.ts → manifest-DiJKbgrM.d.ts} +1 -1
- package/dist/{manifest-D17W6_c7.d.ts → manifest-DpW-TJwu.d.ts} +1 -1
- package/dist/{manifest-CAnCtcFS.d.ts → manifest-DySuHx51.d.ts} +2 -2
- package/dist/{manifest-CrVJZ86G.d.ts → manifest-IWiafJCj.d.ts} +1 -1
- package/dist/{manifest-BTw7TOwu.d.ts → manifest-MIOw1h6u.d.ts} +1 -1
- package/dist/{manifest-DuBsaflS.d.ts → manifest-Qa7Oz8op.d.ts} +3 -3
- package/dist/{manifest-myniqe46.d.ts → manifest-YV2wB81I.d.ts} +1 -1
- package/dist/{manifest-CzDKrwRf.js → manifest-_xHwNjlQ.js} +13 -9
- package/dist/{manifest-BG1VIYZT.d.ts → manifest-iwcDpOkG.d.ts} +1 -1
- package/dist/{manifest-D_wapvtH.d.ts → manifest-nsV6ZrZ7.d.ts} +1 -1
- package/dist/{manifest-D1w2lSll.d.ts → manifest-rB3i09ej.d.ts} +1 -1
- package/dist/{manifest-Doi_y4XH.d.ts → manifest-rk3V9E0p.d.ts} +1 -1
- package/dist/{manifest-D-kHfhG5.d.ts → manifest-uAf9hw_t.d.ts} +1 -1
- package/dist/{manifest-Pny9-_9a.d.ts → manifest-z_JoPdSA.d.ts} +2 -2
- package/dist/mapper/bin.js +5 -5
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/{mcp-CZgh_ubo.js → mcp-DkcsgPP9.js} +1 -1
- package/dist/next/index.d.ts +5 -5
- package/dist/next/proxy/index.d.ts +2 -2
- package/dist/{operations-DAHER9Co.d.ts → operations-C4vxakMi.d.ts} +1 -1
- package/dist/{orders-BCR5H9Tz.d.ts → orders-DtiIfGI_.d.ts} +1 -1
- package/dist/otel/index.js +5 -5
- package/dist/{permissions-Ddma4Div.d.ts → permissions-CP5Cwz8h.d.ts} +1 -1
- package/dist/{ports-DPp4Fq_P.d.ts → ports-B1QMhbn5.d.ts} +1 -1
- package/dist/powersync/index.d.ts +3 -3
- package/dist/preset/index.d.ts +4 -4
- package/dist/{preview-nlRIsJni.d.ts → preview-ByZwgNq9.d.ts} +3 -3
- package/dist/{project-Bw5sWuoO.js → project-DYyr_iyu.js} +1 -1
- package/dist/{push-token-Dwlj0LIL.d.ts → push-token-BAcQAeb8.d.ts} +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/rate-limit/index.d.ts +1 -1
- package/dist/{rate-limit-Ddv4xmsH.d.ts → rate-limit-TxSt-_59.d.ts} +1 -1
- package/dist/react/index.d.ts +5 -5
- package/dist/react/native/index.d.ts +1 -1
- package/dist/react/server.d.ts +5 -5
- package/dist/realtime/index.d.ts +3 -3
- package/dist/{record-form-3eD-nwYk.d.ts → record-form-53Hzv9d9.d.ts} +1 -1
- package/dist/records/index.d.ts +7 -7
- package/dist/{sandboxes-BjvFi1Wh.d.ts → sandboxes-BJy3k0km.d.ts} +1 -1
- package/dist/server/index.d.ts +5 -5
- package/dist/{sign-in-Dtd2Bqgm.d.ts → sign-in-DbXRH5zh.d.ts} +4 -4
- package/dist/solid/index.d.ts +5 -5
- package/dist/spec/index.js +2 -2
- package/dist/sql/index.d.ts +5 -5
- package/dist/sql/index.js +1 -1
- package/dist/{sql-DLuqUuGO.js → sql-DPpcMNUF.js} +345 -122
- package/dist/ssr/index.d.ts +1 -1
- package/dist/svelte/index.d.ts +5 -5
- package/dist/{tenant-DLvOWwEG.d.ts → tenant-tAtS31r8.d.ts} +1 -1
- package/dist/testing/index.d.ts +9 -9
- package/dist/testing/index.js +1 -1
- package/dist/{timeline-ChkpN8Bw.d.ts → timeline-BoKhn-Ei.d.ts} +2 -2
- package/dist/{topic-Dw4CI2so.d.ts → topic-BdTuoZRL.d.ts} +1 -1
- package/dist/{types-Cikitezb.d.ts → types-BderwMCG.d.ts} +1 -1
- package/dist/{types-_hw_fdQp.d.ts → types-D4wgpab9.d.ts} +2 -2
- package/dist/{types-CID74uQG.d.ts → types-DerSPnBG.d.ts} +3 -1
- package/dist/{usage-CrTrlxoi.d.ts → usage-BMaJFesv.d.ts} +1 -1
- package/dist/vercel-sandbox/index.d.ts +1 -1
- package/dist/{version-CrTSdSoJ.js → version-BH2jtOjn.js} +1 -1
- package/dist/vue/index.d.ts +5 -5
- package/dist/{watch-topic-CPyTKYDb.d.ts → watch-topic-BjkFSiGe.d.ts} +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/package.json +1 -1
- package/dist/cli/add-8PulB0kB.js +0 -1
- package/dist/cli/powersync-BIncCNre.js +0 -1
|
@@ -497,7 +497,7 @@ const IDENT$14 = String.raw`(?:"(?:[^"]|"")+"|[A-Za-z_][\w$]*)`;
|
|
|
497
497
|
const TRIGGER$4 = /* @__PURE__ */ new RegExp(String.raw`\bcreate\s+(?:or\s+replace\s+)?(?:constraint\s+)?trigger\s+"?bsb?_audit"?\s+after\s+[\s\S]*?\bon\s+(${IDENT$14}(?:\s*\.\s*${IDENT$14})?)\s+(?:(?:not\s+)?deferrable(?:\s+initially\s+(?:deferred|immediate))?\s+)?for\s+each\s+row\s+(?:when\s*\([\s\S]*?\)\s+)?execute\s+(?:function|procedure)\s+better_supabase\s*\.\s*audit_row_change\s*\(`, "gi");
|
|
498
498
|
const TABLE_NAME$7 = String.raw`${IDENT$14}(?:\s*\.\s*${IDENT$14})?`;
|
|
499
499
|
const DROP$1 = /* @__PURE__ */ new RegExp(String.raw`\bdrop\s+table\s+(?:if\s+exists\s+)?(${TABLE_NAME$7}(?:\s*,\s*${TABLE_NAME$7})*)`, "gi");
|
|
500
|
-
const names$
|
|
500
|
+
const names$11 = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
501
501
|
function triggerRegistration(target, args) {
|
|
502
502
|
const text = args.length === 0 ? "{}" : literal$4(args[0]);
|
|
503
503
|
if (text === void 0) return;
|
|
@@ -510,8 +510,8 @@ function triggerRegistration(target, args) {
|
|
|
510
510
|
if (typeof settings !== "object" || settings === null) return;
|
|
511
511
|
return {
|
|
512
512
|
target: qualifiedName$1(target.replaceAll(/\s+/g, "")),
|
|
513
|
-
ignore: "ignore" in settings ? names$
|
|
514
|
-
redact: "redact" in settings ? names$
|
|
513
|
+
ignore: "ignore" in settings ? names$11(settings.ignore) : [],
|
|
514
|
+
redact: "redact" in settings ? names$11(settings.redact) : []
|
|
515
515
|
};
|
|
516
516
|
}
|
|
517
517
|
/**
|
|
@@ -13226,7 +13226,7 @@ const NOTE_OPTIONS = [
|
|
|
13226
13226
|
"lockAfterHours",
|
|
13227
13227
|
"lockTypes"
|
|
13228
13228
|
];
|
|
13229
|
-
function names$
|
|
13229
|
+
function names$10(ctx, option, fallback) {
|
|
13230
13230
|
const list = ctx.list(option, fallback);
|
|
13231
13231
|
if (list.some((item) => !NAME$9.test(item))) throw new TypeError(`blocks.activities.options.${option} must be a list of lowercase names`);
|
|
13232
13232
|
return list;
|
|
@@ -13236,8 +13236,8 @@ function noteRules(ctx) {
|
|
|
13236
13236
|
const on = (column) => ctx.has("activities", column);
|
|
13237
13237
|
const e = (column) => ctx.col("activities", column);
|
|
13238
13238
|
const l = (column) => ctx.col("links", column);
|
|
13239
|
-
const categories = names$
|
|
13240
|
-
const lockTypes = names$
|
|
13239
|
+
const categories = names$10(ctx, "noteCategories", NOTE_CATEGORIES);
|
|
13240
|
+
const lockTypes = names$10(ctx, "lockTypes", LOCK_TYPES);
|
|
13241
13241
|
const hours = ctx.number("lockAfterHours", 24);
|
|
13242
13242
|
if (!Number.isInteger(hours) || hours < 0 || hours > MAX_LOCK_HOURS) throw new TypeError(`blocks.activities.options.lockAfterHours must be a whole number of hours from 0 to ${MAX_LOCK_HOURS}`);
|
|
13243
13243
|
if (on("restrictedRoles") && !on("audience")) throw new TypeError("blocks.activities.columns.activities.restrictedRoles needs audience");
|
|
@@ -37933,7 +37933,7 @@ const NAMES$130 = {
|
|
|
37933
37933
|
}
|
|
37934
37934
|
}
|
|
37935
37935
|
};
|
|
37936
|
-
function names$
|
|
37936
|
+
function names$9(ctx) {
|
|
37937
37937
|
const keys = moduleOperations("assignment");
|
|
37938
37938
|
return {
|
|
37939
37939
|
fn: (name) => ctx.fn(name),
|
|
@@ -38292,7 +38292,7 @@ ${userGrant(`${fn("assignment_history")}(${ctx.idType}, text, text, integer)`)}
|
|
|
38292
38292
|
`;
|
|
38293
38293
|
}
|
|
38294
38294
|
function build$134(ctx) {
|
|
38295
|
-
const n = names$
|
|
38295
|
+
const n = names$9(ctx);
|
|
38296
38296
|
return `${schemaPreamble(ctx)}
|
|
38297
38297
|
-- Assignment: queues of members that pick an owner for new records, by
|
|
38298
38298
|
-- round robin or weight, within a territory of rule conditions.
|
|
@@ -93742,7 +93742,7 @@ const NAMES$99 = {
|
|
|
93742
93742
|
}
|
|
93743
93743
|
};
|
|
93744
93744
|
const NAME$5 = /^[a-z][a-z0-9_]{0,62}$/;
|
|
93745
|
-
function names$
|
|
93745
|
+
function names$8(ctx, option, fallback) {
|
|
93746
93746
|
const list = ctx.list(option, fallback);
|
|
93747
93747
|
if (list.length === 0 || list.some((item) => !NAME$5.test(item))) throw new TypeError(`blocks.deals.options.${option} must be a non-empty list of lowercase names`);
|
|
93748
93748
|
return `${sqlString(`{${list.join(",")}}`)}::text[]`;
|
|
@@ -94004,12 +94004,12 @@ function build$102(ctx, layout) {
|
|
|
94004
94004
|
write: ctx.permission("write", keys.write),
|
|
94005
94005
|
manage: ctx.permission("manage", keys.manage),
|
|
94006
94006
|
readAll,
|
|
94007
|
-
motions: names$
|
|
94007
|
+
motions: names$8(ctx, "motions", [
|
|
94008
94008
|
"new_logo",
|
|
94009
94009
|
"expansion",
|
|
94010
94010
|
"renewal"
|
|
94011
94011
|
]),
|
|
94012
|
-
priorities: names$
|
|
94012
|
+
priorities: names$8(ctx, "priorities", [
|
|
94013
94013
|
"hot",
|
|
94014
94014
|
"warm",
|
|
94015
94015
|
"cold"
|
|
@@ -107618,7 +107618,7 @@ const NAMES$91 = {
|
|
|
107618
107618
|
} }
|
|
107619
107619
|
};
|
|
107620
107620
|
const DOMAIN$1 = String.raw`^[a-z0-9.-]+\.[a-z]{2,}$`;
|
|
107621
|
-
function names$
|
|
107621
|
+
function names$7(ctx) {
|
|
107622
107622
|
const keys = moduleOperations("enrichment");
|
|
107623
107623
|
const parties = ctx.of("contacts");
|
|
107624
107624
|
return {
|
|
@@ -107899,7 +107899,7 @@ ${serviceGrant(`${fn("enrichment_due")}(text, integer, interval, text)`)}
|
|
|
107899
107899
|
`;
|
|
107900
107900
|
}
|
|
107901
107901
|
function build$93(ctx) {
|
|
107902
|
-
const n = names$
|
|
107902
|
+
const n = names$7(ctx);
|
|
107903
107903
|
return `${schemaPreamble(ctx)}
|
|
107904
107904
|
-- Enrichment: what a provider returned for a company or a person, one result
|
|
107905
107905
|
-- per provider, and the empty columns a match filled.
|
|
@@ -112883,7 +112883,7 @@ const NAMES$86 = {
|
|
|
112883
112883
|
}
|
|
112884
112884
|
}
|
|
112885
112885
|
};
|
|
112886
|
-
function names$
|
|
112886
|
+
function names$6(ctx) {
|
|
112887
112887
|
const keys = moduleOperations("forecasts");
|
|
112888
112888
|
const deals = ctx.of("deals");
|
|
112889
112889
|
const pipelines = ctx.of("pipelines");
|
|
@@ -113156,7 +113156,7 @@ ${userGrant(`${fn("forecast_changes")}(uuid, uuid)`)}
|
|
|
113156
113156
|
`;
|
|
113157
113157
|
}
|
|
113158
113158
|
function build$88(ctx) {
|
|
113159
|
-
const n = names$
|
|
113159
|
+
const n = names$6(ctx);
|
|
113160
113160
|
return `${schemaPreamble(ctx)}
|
|
113161
113161
|
-- Forecasts: snapshots of the forecast call over time, with the deals each
|
|
113162
113162
|
-- one counted, and what changed between two of them.
|
|
@@ -146681,7 +146681,7 @@ const NAMES$70 = {
|
|
|
146681
146681
|
}
|
|
146682
146682
|
} }
|
|
146683
146683
|
};
|
|
146684
|
-
function names$
|
|
146684
|
+
function names$5(ctx) {
|
|
146685
146685
|
const parties = ctx.of("contacts");
|
|
146686
146686
|
const scores = ctx.of("scores");
|
|
146687
146687
|
const keys = moduleOperations("scores");
|
|
@@ -146982,7 +146982,7 @@ create trigger ${trigger}
|
|
|
146982
146982
|
function build$71(ctx) {
|
|
146983
146983
|
if (ctx.mode === "custom") return "";
|
|
146984
146984
|
if (!ctx.of("scores").manages || !ctx.of("contacts").manages) throw new TypeError("lead-scoring needs the scores and parties modules in managed mode");
|
|
146985
|
-
const n = names$
|
|
146985
|
+
const n = names$5(ctx);
|
|
146986
146986
|
return `${schemaPreamble(ctx)}
|
|
146987
146987
|
${ctx.manages ? tables$29(ctx, n) : ""}
|
|
146988
146988
|
${functions$6(ctx, n)}
|
|
@@ -153027,7 +153027,7 @@ const NAMES$66 = {
|
|
|
153027
153027
|
}
|
|
153028
153028
|
};
|
|
153029
153029
|
const TYPE$2 = /^[a-z][a-z0-9_]{0,62}$/;
|
|
153030
|
-
function names$
|
|
153030
|
+
function names$4(ctx) {
|
|
153031
153031
|
const keys = moduleOperations("mail-sync");
|
|
153032
153032
|
const activityType = ctx.text("activityType", "email");
|
|
153033
153033
|
if (!TYPE$2.test(activityType)) throw new TypeError("blocks.mail-sync.options.activityType must be a lowercase activity type");
|
|
@@ -153211,7 +153211,7 @@ ${renderPolicy(policy$1({
|
|
|
153211
153211
|
`;
|
|
153212
153212
|
}
|
|
153213
153213
|
function build$66(ctx) {
|
|
153214
|
-
const n = names$
|
|
153214
|
+
const n = names$4(ctx);
|
|
153215
153215
|
return `${schemaPreamble(ctx)}
|
|
153216
153216
|
-- Gmail, Outlook and other mailboxes synced per member: threads and messages
|
|
153217
153217
|
-- linked to the people and companies they involve, logged as activities.
|
|
@@ -165907,6 +165907,155 @@ $$;
|
|
|
165907
165907
|
revoke execute on function ${fn}(interval, integer) from public, anon, authenticated;
|
|
165908
165908
|
grant execute on function ${fn}(interval, integer) to service_role;`;
|
|
165909
165909
|
}
|
|
165910
|
+
function names$3(n) {
|
|
165911
|
+
const e = (logical) => n.col("events", logical);
|
|
165912
|
+
const r = (logical) => n.col("recipients", logical);
|
|
165913
|
+
const resolved = n.has("recipients", "resolvedAt");
|
|
165914
|
+
const subjectType = n.has("events", "subjectType");
|
|
165915
|
+
return {
|
|
165916
|
+
e,
|
|
165917
|
+
r,
|
|
165918
|
+
resolved,
|
|
165919
|
+
subjectType,
|
|
165920
|
+
subjects: subjectType && n.has("events", "subjectId")
|
|
165921
|
+
};
|
|
165922
|
+
}
|
|
165923
|
+
function orders(n) {
|
|
165924
|
+
const { e, r, resolved } = names$3(n);
|
|
165925
|
+
const statusRank = resolved ? `case when rc.${r("resolvedAt")} is not null then 2 when rc.${r("readAt")} is null then 0 else 1 end` : `case when rc.${r("readAt")} is null then 0 else 1 end`;
|
|
165926
|
+
const newest = `rc.${r("createdAt")} desc, rc.${r("id")} desc`;
|
|
165927
|
+
return [
|
|
165928
|
+
["newest", newest],
|
|
165929
|
+
["oldest", `rc.${r("createdAt")}, rc.${r("id")}`],
|
|
165930
|
+
["type", `ev.${e("type")} collate "C", ${newest}`],
|
|
165931
|
+
["type_desc", `ev.${e("type")} collate "C" desc, ${newest}`],
|
|
165932
|
+
...n.has("events", "subjectLabel") ? [["subject", `lower(coalesce(ev.${e("subjectLabel")}, '')) collate "C", ${newest}`], ["subject_desc", `lower(coalesce(ev.${e("subjectLabel")}, '')) collate "C" desc, ${newest}`]] : [["subject", newest], ["subject_desc", newest]],
|
|
165933
|
+
["status", `${statusRank}, ${newest}`],
|
|
165934
|
+
["status_desc", `${statusRank} desc, ${newest}`]
|
|
165935
|
+
];
|
|
165936
|
+
}
|
|
165937
|
+
function pageFilters(n) {
|
|
165938
|
+
const { e, r, resolved, subjectType, subjects } = names$3(n);
|
|
165939
|
+
const fn = "notification_page";
|
|
165940
|
+
const flag = (key, column) => `case (g ->> '${key}')::boolean when true then 'rc.${column} is not null' when false then 'rc.${column} is null' end`;
|
|
165941
|
+
const list = (key, sql) => `case when g ? '${key}' then format(${sqlString(sql)}, array(select jsonb_array_elements_text(g -> '${key}'))) end`;
|
|
165942
|
+
const groups = [
|
|
165943
|
+
list("types", `ev.${e("type")} = any(%L::text[])`),
|
|
165944
|
+
list("exclude_types", `ev.${e("type")} <> all(%L::text[])`),
|
|
165945
|
+
...subjectType ? [list("subject_types", `ev.${e("subjectType")} = any(%L::text[])`)] : [],
|
|
165946
|
+
flag("read", r("readAt")),
|
|
165947
|
+
...resolved ? [flag("resolved", r("resolvedAt"))] : []
|
|
165948
|
+
];
|
|
165949
|
+
return `
|
|
165950
|
+
if ${fn}.exclude_types is not null then
|
|
165951
|
+
v_where := v_where || $q$ and ev.${e("type")} <> all($11)$q$;
|
|
165952
|
+
end if;${subjects ? `
|
|
165953
|
+
if ${fn}.subject_ids is not null then
|
|
165954
|
+
v_where := v_where || $q$ and ev.${e("subjectId")} = any($12)$q$;
|
|
165955
|
+
end if;` : ""}
|
|
165956
|
+
if ${fn}.any_of is not null then
|
|
165957
|
+
if jsonb_typeof(${fn}.any_of) <> 'array'
|
|
165958
|
+
or exists (select 1 from jsonb_array_elements(${fn}.any_of) g where jsonb_typeof(g) <> 'object') then
|
|
165959
|
+
raise exception 'any_of is an array of filter objects' using errcode = '22023';
|
|
165960
|
+
end if;
|
|
165961
|
+
select coalesce(string_agg('(' || concat_ws(' and ', 'true', ${groups.join(", ")}) || ')', ' or '), 'false')
|
|
165962
|
+
into v_any
|
|
165963
|
+
from jsonb_array_elements(${fn}.any_of) g;
|
|
165964
|
+
v_where := v_where || ' and (' || v_any || ')';
|
|
165965
|
+
end if;`;
|
|
165966
|
+
}
|
|
165967
|
+
function notificationPage(ctx, n, parts) {
|
|
165968
|
+
const { e, r } = names$3(n);
|
|
165969
|
+
const id = ctx.idType;
|
|
165970
|
+
const list = orders(n);
|
|
165971
|
+
return `create or replace function ${ctx.fn("notification_page")}(
|
|
165972
|
+
tenant ${id} default null,
|
|
165973
|
+
status text default 'all',
|
|
165974
|
+
types text[] default null,
|
|
165975
|
+
subject_types text[] default null,
|
|
165976
|
+
search text default null,
|
|
165977
|
+
max_items integer default 50,
|
|
165978
|
+
skip integer default 0,
|
|
165979
|
+
read boolean default null,
|
|
165980
|
+
resolved boolean default null,
|
|
165981
|
+
dismissed boolean default false,
|
|
165982
|
+
before timestamptz default null,
|
|
165983
|
+
before_id uuid default null,
|
|
165984
|
+
total_cap integer default 10000,
|
|
165985
|
+
exclude_types text[] default null,
|
|
165986
|
+
subject_ids text[] default null,
|
|
165987
|
+
any_of jsonb default null,
|
|
165988
|
+
order_by text default 'newest'
|
|
165989
|
+
)
|
|
165990
|
+
returns jsonb
|
|
165991
|
+
language plpgsql
|
|
165992
|
+
stable
|
|
165993
|
+
security definer
|
|
165994
|
+
set search_path = ''
|
|
165995
|
+
as $$
|
|
165996
|
+
declare
|
|
165997
|
+
v_where text;
|
|
165998
|
+
v_any text;
|
|
165999
|
+
v_limit integer := ${pageSize("notification_page.max_items", 50, 500)};
|
|
166000
|
+
v_order text;
|
|
166001
|
+
v_items jsonb;
|
|
166002
|
+
v_total bigint;
|
|
166003
|
+
v_args_cap integer := notification_page.total_cap;
|
|
166004
|
+
begin
|
|
166005
|
+
v_order := case coalesce(notification_page.order_by, 'newest')
|
|
166006
|
+
${list.map(([name, sql]) => ` when ${sqlString(name)} then ${sqlString(sql)}`).join("\n")}
|
|
166007
|
+
end;
|
|
166008
|
+
if v_order is null then
|
|
166009
|
+
raise exception 'order_by is one of ${list.map(([name]) => name).join(", ")}, not %', notification_page.order_by using errcode = '22023';
|
|
166010
|
+
end if;
|
|
166011
|
+
if notification_page.before is not null and coalesce(notification_page.order_by, 'newest') <> 'newest' then
|
|
166012
|
+
raise exception 'before pages the newest order; page another order with skip' using errcode = '22023';
|
|
166013
|
+
end if;
|
|
166014
|
+
${parts.where}
|
|
166015
|
+
-- One row more than the page says whether another page exists, and the
|
|
166016
|
+
-- total stops counting at total_cap (null counts every row), so a large
|
|
166017
|
+
-- inbox never counts all of it. Pass before and before_id to page by key
|
|
166018
|
+
-- instead of skip.
|
|
166019
|
+
execute $q$select coalesce(jsonb_agg(p.item order by p.n), '[]')
|
|
166020
|
+
from (
|
|
166021
|
+
select row_number() over () as n, q.item
|
|
166022
|
+
from (
|
|
166023
|
+
select ${itemJson(n)} as item
|
|
166024
|
+
from ${n.table("recipients")} rc
|
|
166025
|
+
join ${n.table("events")} ev on ev.${e("id")} = rc.${r("event")}
|
|
166026
|
+
where $q$ || v_where || $q$
|
|
166027
|
+
order by $q$ || v_order || $q$
|
|
166028
|
+
offset $13
|
|
166029
|
+
limit $14 + 1
|
|
166030
|
+
) q
|
|
166031
|
+
) p$q$
|
|
166032
|
+
into v_items
|
|
166033
|
+
using auth.uid(), notification_page.tenant, notification_page.types, notification_page.subject_types,
|
|
166034
|
+
${parts.search}, notification_page.read, notification_page.resolved, notification_page.dismissed,
|
|
166035
|
+
notification_page.before, coalesce(notification_page.before_id, '00000000-0000-0000-0000-000000000000'::uuid),
|
|
166036
|
+
notification_page.exclude_types, notification_page.subject_ids,
|
|
166037
|
+
greatest(coalesce(notification_page.skip, 0), 0), v_limit;
|
|
166038
|
+
execute $q$select count(*) from (
|
|
166039
|
+
select 1 from ${n.table("recipients")} rc
|
|
166040
|
+
join ${n.table("events")} ev on ev.${e("id")} = rc.${r("event")}
|
|
166041
|
+
where $q$ || v_where || case when v_args_cap is null then '' else format(' limit %s', greatest(v_args_cap, 1)) end || $q$
|
|
166042
|
+
) c$q$
|
|
166043
|
+
into v_total
|
|
166044
|
+
using auth.uid(), notification_page.tenant, notification_page.types, notification_page.subject_types,
|
|
166045
|
+
${parts.search}, notification_page.read, notification_page.resolved, notification_page.dismissed,
|
|
166046
|
+
notification_page.before, coalesce(notification_page.before_id, '00000000-0000-0000-0000-000000000000'::uuid),
|
|
166047
|
+
notification_page.exclude_types, notification_page.subject_ids;
|
|
166048
|
+
return jsonb_build_object(
|
|
166049
|
+
'items', coalesce((select jsonb_agg(x.value order by x.ordinality) from jsonb_array_elements(v_items) with ordinality x(value, ordinality) where x.ordinality <= v_limit), '[]'),
|
|
166050
|
+
'hasMore', jsonb_array_length(v_items) > v_limit,
|
|
166051
|
+
'limit', v_limit,
|
|
166052
|
+
'total', v_total,
|
|
166053
|
+
'totalCapped', v_args_cap is not null and v_total >= v_args_cap
|
|
166054
|
+
);
|
|
166055
|
+
end;
|
|
166056
|
+
$$;
|
|
166057
|
+
`;
|
|
166058
|
+
}
|
|
165910
166059
|
// src/sql/modules/notifications-readers.ts
|
|
165911
166060
|
function readers$1(ctx, n) {
|
|
165912
166061
|
const id = ctx.idType;
|
|
@@ -166329,6 +166478,18 @@ function inbox(ctx, n) {
|
|
|
166329
166478
|
const subjects = subjectType && n.has("events", "subjectId");
|
|
166330
166479
|
const settled = resolved ? `(rc.${r("resolvedAt")} is not null or rc.${r("dismissedAt")} is not null)` : `rc.${r("dismissedAt")} is not null`;
|
|
166331
166480
|
const haystack = ["summary", "subjectLabel"].filter((logical) => n.has("events", logical)).map((logical) => `ev.${e(logical)}`);
|
|
166481
|
+
const actorSearch = (() => {
|
|
166482
|
+
if (!ctx.installed("profiles") || !n.has("events", "actor")) return "";
|
|
166483
|
+
const profiles = ctx.of("profiles");
|
|
166484
|
+
const p = (logical) => profiles.col("profiles", logical);
|
|
166485
|
+
const names = [
|
|
166486
|
+
"username",
|
|
166487
|
+
"fullName",
|
|
166488
|
+
"firstName",
|
|
166489
|
+
"lastName"
|
|
166490
|
+
].filter((logical) => profiles.has("profiles", logical)).map((logical) => `pr.${p(logical)}`);
|
|
166491
|
+
return names.length === 0 ? "" : ` or exists (select 1 from ${profiles.table("profiles")} pr where pr.${p("key")} = ev.${e("actor")} and concat_ws(' ', ${names.join(", ")}) ilike $5)`;
|
|
166492
|
+
})();
|
|
166332
166493
|
const dynamicWhere = (fn, cursor) => {
|
|
166333
166494
|
const hasTenant = n.has("recipients", "tenant");
|
|
166334
166495
|
const haystackSql = [...haystack, `ev.${e("type")}`].join(", ");
|
|
@@ -166360,7 +166521,7 @@ function inbox(ctx, n) {
|
|
|
166360
166521
|
v_where := v_where || $q$ and ev.${e("subjectType")} = any($4)$q$;
|
|
166361
166522
|
end if;` : ""}
|
|
166362
166523
|
if btrim(coalesce(${fn}.search, '')) <> '' then
|
|
166363
|
-
v_where := v_where || $q$ and concat_ws(' ', ${haystackSql}) ilike $5$q$;
|
|
166524
|
+
v_where := v_where || $q$ and (concat_ws(' ', ${haystackSql}) ilike $5${actorSearch})$q$;
|
|
166364
166525
|
end if;
|
|
166365
166526
|
case coalesce(${fn}.status, 'all')
|
|
166366
166527
|
when 'unread' then v_where := v_where || $q$ and rc.${r("readAt")} is null$q$;
|
|
@@ -166381,6 +166542,7 @@ drop function if exists ${ctx.fn("list_notifications")}(${id}, text, text[], tim
|
|
|
166381
166542
|
drop function if exists ${ctx.fn("list_notifications")}(${id}, text, text[], timestamptz, integer, uuid, text[], text);
|
|
166382
166543
|
drop function if exists ${ctx.fn("notification_page")}(${id}, text, text[], text[], text, integer, integer);
|
|
166383
166544
|
drop function if exists ${ctx.fn("notification_page")}(${id}, text, text[], text[], text, integer, integer, boolean, boolean, boolean);
|
|
166545
|
+
drop function if exists ${ctx.fn("notification_page")}(${id}, text, text[], text[], text, integer, integer, boolean, boolean, boolean, timestamptz, uuid, integer);
|
|
166384
166546
|
drop function if exists ${ctx.fn("notification_counts")}(${id}, text[]);
|
|
166385
166547
|
${integerMutations(ctx)}
|
|
166386
166548
|
-- The signed-in user's notifications, newest first, without dismissed ones.
|
|
@@ -166423,77 +166585,15 @@ ${dynamicWhere("list_notifications", true)}
|
|
|
166423
166585
|
using auth.uid(), list_notifications.tenant, list_notifications.types, list_notifications.subject_types,
|
|
166424
166586
|
${searchPattern("list_notifications")}, list_notifications.read, list_notifications.resolved, list_notifications.dismissed,
|
|
166425
166587
|
list_notifications.before, coalesce(list_notifications.before_id, '00000000-0000-0000-0000-000000000000'::uuid),
|
|
166426
|
-
least(coalesce(list_notifications.max_items, 50),
|
|
166588
|
+
least(coalesce(list_notifications.max_items, 50), ${String(500)});
|
|
166427
166589
|
return result;
|
|
166428
166590
|
end;
|
|
166429
166591
|
$$;
|
|
166430
166592
|
|
|
166431
|
-
|
|
166432
|
-
|
|
166433
|
-
|
|
166434
|
-
|
|
166435
|
-
subject_types text[] default null,
|
|
166436
|
-
search text default null,
|
|
166437
|
-
max_items integer default 50,
|
|
166438
|
-
skip integer default 0,
|
|
166439
|
-
read boolean default null,
|
|
166440
|
-
resolved boolean default null,
|
|
166441
|
-
dismissed boolean default false,
|
|
166442
|
-
before timestamptz default null,
|
|
166443
|
-
before_id uuid default null,
|
|
166444
|
-
total_cap integer default 10000
|
|
166445
|
-
)
|
|
166446
|
-
returns jsonb
|
|
166447
|
-
language plpgsql
|
|
166448
|
-
stable
|
|
166449
|
-
security definer
|
|
166450
|
-
set search_path = ''
|
|
166451
|
-
as $$
|
|
166452
|
-
declare
|
|
166453
|
-
v_where text;
|
|
166454
|
-
v_limit integer := ${pageSize("notification_page.max_items", 50, 200)};
|
|
166455
|
-
v_items jsonb;
|
|
166456
|
-
v_total bigint;
|
|
166457
|
-
v_args_cap integer := notification_page.total_cap;
|
|
166458
|
-
begin
|
|
166459
|
-
${dynamicWhere("notification_page", true)}
|
|
166460
|
-
-- One row more than the page says whether an older page exists, and the
|
|
166461
|
-
-- total stops counting at total_cap (null counts every row), so a large
|
|
166462
|
-
-- inbox never counts all of it. Pass before and before_id to page by key
|
|
166463
|
-
-- instead of skip.
|
|
166464
|
-
execute $q$select coalesce(jsonb_agg(p.item order by p.created_at desc, p.id desc), '[]')
|
|
166465
|
-
from (
|
|
166466
|
-
select ${itemJson(n)} as item, rc.${r("createdAt")} as created_at, rc.${r("id")} as id
|
|
166467
|
-
from ${n.table("recipients")} rc
|
|
166468
|
-
join ${n.table("events")} ev on ev.${e("id")} = rc.${r("event")}
|
|
166469
|
-
where $q$ || v_where || $q$
|
|
166470
|
-
order by rc.${r("createdAt")} desc, rc.${r("id")} desc
|
|
166471
|
-
offset $11
|
|
166472
|
-
limit $12 + 1
|
|
166473
|
-
) p$q$
|
|
166474
|
-
into v_items
|
|
166475
|
-
using auth.uid(), notification_page.tenant, notification_page.types, notification_page.subject_types,
|
|
166476
|
-
${searchPattern("notification_page")}, notification_page.read, notification_page.resolved, notification_page.dismissed,
|
|
166477
|
-
notification_page.before, coalesce(notification_page.before_id, '00000000-0000-0000-0000-000000000000'::uuid),
|
|
166478
|
-
greatest(coalesce(notification_page.skip, 0), 0), v_limit;
|
|
166479
|
-
execute $q$select count(*) from (
|
|
166480
|
-
select 1 from ${n.table("recipients")} rc
|
|
166481
|
-
join ${n.table("events")} ev on ev.${e("id")} = rc.${r("event")}
|
|
166482
|
-
where $q$ || v_where || case when v_args_cap is null then '' else format(' limit %s', greatest(v_args_cap, 1)) end || $q$
|
|
166483
|
-
) c$q$
|
|
166484
|
-
into v_total
|
|
166485
|
-
using auth.uid(), notification_page.tenant, notification_page.types, notification_page.subject_types,
|
|
166486
|
-
${searchPattern("notification_page")}, notification_page.read, notification_page.resolved, notification_page.dismissed,
|
|
166487
|
-
notification_page.before, coalesce(notification_page.before_id, '00000000-0000-0000-0000-000000000000'::uuid);
|
|
166488
|
-
return jsonb_build_object(
|
|
166489
|
-
'items', coalesce((select jsonb_agg(x.value order by x.ordinality) from jsonb_array_elements(v_items) with ordinality x(value, ordinality) where x.ordinality <= v_limit), '[]'),
|
|
166490
|
-
'hasMore', jsonb_array_length(v_items) > v_limit,
|
|
166491
|
-
'total', v_total,
|
|
166492
|
-
'totalCapped', v_args_cap is not null and v_total >= v_args_cap
|
|
166493
|
-
);
|
|
166494
|
-
end;
|
|
166495
|
-
$$;
|
|
166496
|
-
|
|
166593
|
+
${notificationPage(ctx, n, {
|
|
166594
|
+
where: `${dynamicWhere("notification_page", true)}${pageFilters(n)}`,
|
|
166595
|
+
search: searchPattern("notification_page")
|
|
166596
|
+
})}
|
|
166497
166597
|
-- Unread and, for the types in actionable, unresolved counts. Each count stops
|
|
166498
166598
|
-- at cap (default 100, null counts every row), so a badge reads at most cap
|
|
166499
166599
|
-- rows through the unread index however large the inbox is.
|
|
@@ -166608,7 +166708,7 @@ as $$
|
|
|
166608
166708
|
$$;`];
|
|
166609
166709
|
const grants = [
|
|
166610
166710
|
`list_notifications(${id}, text, text[], timestamptz, integer, uuid, text[], text, boolean, boolean, boolean)`,
|
|
166611
|
-
`notification_page(${id}, text, text[], text[], text, integer, integer, boolean, boolean, boolean, timestamptz, uuid, integer)`,
|
|
166711
|
+
`notification_page(${id}, text, text[], text[], text, integer, integer, boolean, boolean, boolean, timestamptz, uuid, integer, text[], text[], jsonb, text)`,
|
|
166612
166712
|
`notification_counts(${id}, text[], integer)`,
|
|
166613
166713
|
`mark_notifications_unread(uuid[], ${id})`,
|
|
166614
166714
|
`mark_notifications_read(uuid[], ${id})`,
|
|
@@ -167529,7 +167629,7 @@ function contract$50(ctx) {
|
|
|
167529
167629
|
},
|
|
167530
167630
|
{
|
|
167531
167631
|
name: "notification_page",
|
|
167532
|
-
args: argTypes("{id} text text[] text[] text integer integer boolean boolean boolean timestamptz uuid integer"),
|
|
167632
|
+
args: argTypes("{id} text text[] text[] text integer integer boolean boolean boolean timestamptz uuid integer text[] text[] jsonb text"),
|
|
167533
167633
|
returns: "jsonb"
|
|
167534
167634
|
},
|
|
167535
167635
|
{
|
|
@@ -167648,7 +167748,7 @@ const NOTIFICATIONS = {
|
|
|
167648
167748
|
providerFunctions: ["idsWithFor"],
|
|
167649
167749
|
target: "schema",
|
|
167650
167750
|
modes: ["managed", "custom"],
|
|
167651
|
-
version:
|
|
167751
|
+
version: 11,
|
|
167652
167752
|
names: NAMES$58,
|
|
167653
167753
|
contract: contract$50,
|
|
167654
167754
|
upgrades: [
|
|
@@ -167700,6 +167800,11 @@ const NOTIFICATIONS = {
|
|
|
167700
167800
|
from: 9,
|
|
167701
167801
|
description: "Preferences gain a cadence (immediate, daily, weekly or off); a daily or weekly delivery is held, run_notification_digests (the digest_run job) folds held deliveries into notification_digests, and claim_notification_digests and complete_notification_digest are the sender's pair. set_notification_cadence is new. A notification may name a consent_purpose that the consents block checks.",
|
|
167702
167802
|
sql: (ctx) => digestUpgrade(ctx)
|
|
167803
|
+
},
|
|
167804
|
+
{
|
|
167805
|
+
from: 10,
|
|
167806
|
+
description: "notification_page sorts by order_by (newest, oldest, type, subject or status, each with a _desc form), filters on exclude_types, subject_ids and any_of groups, and returns the limit it applied; list_notifications and notification_page match search on the actor's name and return up to 500 items.",
|
|
167807
|
+
sql: (ctx) => `drop function if exists ${ctx.fn("notification_page")}(${ctx.idType}, text, text[], text[], text, integer, integer, boolean, boolean, boolean, timestamptz, uuid, integer);`
|
|
167703
167808
|
}
|
|
167704
167809
|
],
|
|
167705
167810
|
build: build$57,
|
|
@@ -177354,6 +177459,19 @@ as $$
|
|
|
177354
177459
|
returning ${n.k("cursor")}
|
|
177355
177460
|
$$;
|
|
177356
177461
|
|
|
177462
|
+
create or replace function ${ctx.fn("outbox_has_work")}()
|
|
177463
|
+
returns boolean
|
|
177464
|
+
language sql
|
|
177465
|
+
stable
|
|
177466
|
+
set search_path = ''
|
|
177467
|
+
as $$
|
|
177468
|
+
select exists (
|
|
177469
|
+
select 1 from ${n.c} c
|
|
177470
|
+
where (c.${n.k("retryAt")} is null or c.${n.k("retryAt")} <= now())
|
|
177471
|
+
and exists (select 1 from ${n.t} e where ${key("e")} > ${cursor("c")})
|
|
177472
|
+
)
|
|
177473
|
+
$$;
|
|
177474
|
+
|
|
177357
177475
|
-- Deletes a consumer and its cursor, so purge_outbox no longer waits for it.
|
|
177358
177476
|
create or replace function ${ctx.fn("outbox_unregister")}(consumer text)
|
|
177359
177477
|
returns boolean
|
|
@@ -177637,7 +177755,8 @@ ${service("outbox_ack", "text, text, bigint")}
|
|
|
177637
177755
|
${service("outbox_fail", "text, text, bigint, text, integer, interval")}
|
|
177638
177756
|
${service("outbox_dead_letters", "text, integer")}
|
|
177639
177757
|
${service("outbox_history", "text, text, bigint, integer")}
|
|
177640
|
-
${service("purge_outbox", "interval, integer, interval")}
|
|
177758
|
+
${service("purge_outbox", "interval, integer, interval")}
|
|
177759
|
+
${service("outbox_has_work", "")}`;
|
|
177641
177760
|
}
|
|
177642
177761
|
function tracking(ctx) {
|
|
177643
177762
|
const trigger = ctx.trigger("outbox_events");
|
|
@@ -177708,7 +177827,7 @@ const OUTBOX = {
|
|
|
177708
177827
|
requires: [],
|
|
177709
177828
|
target: "schema",
|
|
177710
177829
|
modes: ["managed", "custom"],
|
|
177711
|
-
version:
|
|
177830
|
+
version: 6,
|
|
177712
177831
|
integrates: ["data-lifecycle"],
|
|
177713
177832
|
names: NAMES$51,
|
|
177714
177833
|
upgrades: [
|
|
@@ -177731,6 +177850,11 @@ const OUTBOX = {
|
|
|
177731
177850
|
from: 4,
|
|
177732
177851
|
description: "outbox_row_event() is no longer executable by API roles. options.partitioned partitions a new events table by month on created_at, with a sequence for the position, and applies to new tables only.",
|
|
177733
177852
|
sql: () => ""
|
|
177853
|
+
},
|
|
177854
|
+
{
|
|
177855
|
+
from: 5,
|
|
177856
|
+
description: "outbox_has_work() says whether a consumer has events after its cursor, as the probe of the relay schedule.",
|
|
177857
|
+
sql: () => ""
|
|
177734
177858
|
}
|
|
177735
177859
|
],
|
|
177736
177860
|
contract: () => [
|
|
@@ -185675,7 +185799,8 @@ drop function if exists better_supabase.purge_job_archive(text, interval, intege
|
|
|
185675
185799
|
-- schedule_job before schedules had a tenant.
|
|
185676
185800
|
drop function if exists better_supabase.schedule_job(text, text, text, jsonb, text, timestamptz);
|
|
185677
185801
|
-- claim_due_schedules returns first_after now; create or replace can't change a return type.
|
|
185678
|
-
drop function if exists better_supabase.claim_due_schedules(integer, integer)
|
|
185802
|
+
drop function if exists better_supabase.claim_due_schedules(integer, integer);
|
|
185803
|
+
drop function if exists better_supabase.schedule_job(text, text, text, jsonb, text, timestamptz, text);`;
|
|
185679
185804
|
/**
|
|
185680
185805
|
* Opens purge_job_archive: nothing goes while a legal hold covers the archive,
|
|
185681
185806
|
* and a data-lifecycle retention policy replaces both intervals.
|
|
@@ -186070,6 +186195,30 @@ begin
|
|
|
186070
186195
|
return retried;
|
|
186071
186196
|
end;
|
|
186072
186197
|
$$;`;
|
|
186198
|
+
const PROBE_CHECK = ` if probe is not null and not exists (
|
|
186199
|
+
select 1 from pg_catalog.pg_proc p
|
|
186200
|
+
where p.oid = pg_catalog.to_regprocedure(probe || '()') and p.prorettype = 'boolean'::regtype
|
|
186201
|
+
) then
|
|
186202
|
+
raise exception 'The probe % is not a function without arguments that returns boolean', probe using errcode = '22023';
|
|
186203
|
+
end if;`;
|
|
186204
|
+
const SCHEDULE_HAS_WORK = `create or replace function better_supabase.schedule_has_work(probe text)
|
|
186205
|
+
returns boolean
|
|
186206
|
+
language plpgsql
|
|
186207
|
+
set search_path = ''
|
|
186208
|
+
as $$
|
|
186209
|
+
declare
|
|
186210
|
+
v_probe regprocedure := pg_catalog.to_regprocedure(probe || '()');
|
|
186211
|
+
v_work boolean;
|
|
186212
|
+
begin
|
|
186213
|
+
if v_probe is null then
|
|
186214
|
+
return true;
|
|
186215
|
+
end if;
|
|
186216
|
+
execute format('select %s()', v_probe::oid::regproc) into v_work;
|
|
186217
|
+
return coalesce(v_work, true);
|
|
186218
|
+
exception when others then
|
|
186219
|
+
return true;
|
|
186220
|
+
end;
|
|
186221
|
+
$$;`;
|
|
186073
186222
|
const ensureQueue = (backend) => backend === "pgmq" ? "\n perform better_supabase.ensure_job_queue(queue);" : "";
|
|
186074
186223
|
const PG_CRON = (backend) => `-- Recurring jobs with pg_cron, in cron.timezone (UTC unless the project changed it):
|
|
186075
186224
|
-- select better_supabase.schedule_job('nightly-digest', '0 3 * * *', 'emails', '{"kind": "digest"}');
|
|
@@ -186082,7 +186231,8 @@ create or replace function better_supabase.schedule_job(
|
|
|
186082
186231
|
payload jsonb default '{}',
|
|
186083
186232
|
timezone text default 'UTC',
|
|
186084
186233
|
next_run timestamptz default null,
|
|
186085
|
-
tenant text default null
|
|
186234
|
+
tenant text default null,
|
|
186235
|
+
probe text default null
|
|
186086
186236
|
)
|
|
186087
186237
|
returns bigint
|
|
186088
186238
|
language plpgsql
|
|
@@ -186104,9 +186254,11 @@ begin
|
|
|
186104
186254
|
if timezone <> 'UTC' then
|
|
186105
186255
|
raise exception 'pg_cron runs schedules in cron.timezone, not %; set blocks.queue.options.scheduler to "drain" for per-schedule time zones', timezone;
|
|
186106
186256
|
end if;${ensureQueue(backend)}
|
|
186257
|
+
${PROBE_CHECK}
|
|
186107
186258
|
execute format('select %s($1::text, $2::text, $3::text)', v_schedule::oid::regproc)
|
|
186108
186259
|
into v_id
|
|
186109
|
-
using job_name, schedule, format('select better_supabase.enqueue_job(%L, %L::jsonb)', queue, payload::text)
|
|
186260
|
+
using job_name, schedule, format('select better_supabase.enqueue_job(%L, %L::jsonb)', queue, payload::text)
|
|
186261
|
+
|| case when probe is null then '' else format(' where better_supabase.schedule_has_work(%L)', probe) end;
|
|
186110
186262
|
return v_id;
|
|
186111
186263
|
end;
|
|
186112
186264
|
$$;
|
|
@@ -186153,7 +186305,7 @@ $$;
|
|
|
186153
186305
|
-- pg_cron's jobs whose name starts with name_prefix. pg_cron keeps no queue,
|
|
186154
186306
|
-- payload, tenant or next run, so those are null.
|
|
186155
186307
|
create or replace function better_supabase.list_schedules(name_prefix text default null, for_tenant text default null)
|
|
186156
|
-
returns table (job_name text, schedule text, timezone text, queue text, tenant text, next_run timestamptz, last_run timestamptz, lock_expires_at timestamptz, created_at timestamptz, payload jsonb)
|
|
186308
|
+
returns table (job_name text, schedule text, timezone text, queue text, tenant text, next_run timestamptz, last_run timestamptz, lock_expires_at timestamptz, created_at timestamptz, payload jsonb, probe text)
|
|
186157
186309
|
language plpgsql
|
|
186158
186310
|
stable
|
|
186159
186311
|
security definer
|
|
@@ -186166,7 +186318,7 @@ begin
|
|
|
186166
186318
|
return;
|
|
186167
186319
|
end if;
|
|
186168
186320
|
return query execute format(
|
|
186169
|
-
'select j.jobname::text, j.schedule::text, ''UTC''::text, null::text, null::text, null::timestamptz, null::timestamptz, null::timestamptz, null::timestamptz, null::jsonb
|
|
186321
|
+
'select j.jobname::text, j.schedule::text, ''UTC''::text, null::text, null::text, null::timestamptz, null::timestamptz, null::timestamptz, null::timestamptz, null::jsonb, null::text
|
|
186170
186322
|
from %s j where $1 is null or starts_with(j.jobname, $1) order by j.jobname', v_jobs)
|
|
186171
186323
|
using name_prefix;
|
|
186172
186324
|
end;
|
|
@@ -186207,7 +186359,8 @@ create table if not exists ${schedules} (
|
|
|
186207
186359
|
-- The tenant a schedule runs for, so a tenant's schedules can be listed and
|
|
186208
186360
|
-- removed together (unschedule_tenant).
|
|
186209
186361
|
alter table ${schedules} add column if not exists ${c("tenant")} text;
|
|
186210
|
-
alter table ${schedules} add column if not exists ${c("firstAfter")} timestamptz
|
|
186362
|
+
alter table ${schedules} add column if not exists ${c("firstAfter")} timestamptz;
|
|
186363
|
+
alter table ${schedules} add column if not exists ${c("probe")} text;${legacy}${jobNameKey}
|
|
186211
186364
|
create index if not exists ${index("due_idx")} on ${schedules} (${c("nextRun")});
|
|
186212
186365
|
create index if not exists ${index("tenant_idx")} on ${schedules} (${c("tenant")}) where ${c("tenant")} is not null;
|
|
186213
186366
|
alter table ${schedules} enable row level security;
|
|
@@ -186224,7 +186377,8 @@ create or replace function better_supabase.schedule_job(
|
|
|
186224
186377
|
payload jsonb default '{}',
|
|
186225
186378
|
timezone text default 'UTC',
|
|
186226
186379
|
next_run timestamptz default null,
|
|
186227
|
-
tenant text default null
|
|
186380
|
+
tenant text default null,
|
|
186381
|
+
probe text default null
|
|
186228
186382
|
)
|
|
186229
186383
|
returns bigint
|
|
186230
186384
|
language plpgsql
|
|
@@ -186233,6 +186387,7 @@ set search_path = ''
|
|
|
186233
186387
|
as $$
|
|
186234
186388
|
#variable_conflict use_column
|
|
186235
186389
|
begin
|
|
186390
|
+
${PROBE_CHECK}
|
|
186236
186391
|
if not exists (select 1 from pg_catalog.pg_timezone_names z where z.name = timezone) then
|
|
186237
186392
|
raise exception 'Unknown time zone %', timezone;
|
|
186238
186393
|
end if;
|
|
@@ -186240,9 +186395,9 @@ begin
|
|
|
186240
186395
|
raise exception 'Invalid schedule %: expected five cron fields, a macro such as @daily, or an interval such as 5 minutes', schedule
|
|
186241
186396
|
using errcode = '22023';
|
|
186242
186397
|
end if;
|
|
186243
|
-
insert into ${schedules} as s (${c("jobName")}, ${c("schedule")}, ${c("timezone")}, ${c("queue")}, ${c("payload")}, ${c("nextRun")}, ${c("firstAfter")}, ${c("tenant")})
|
|
186398
|
+
insert into ${schedules} as s (${c("jobName")}, ${c("schedule")}, ${c("timezone")}, ${c("queue")}, ${c("payload")}, ${c("nextRun")}, ${c("firstAfter")}, ${c("tenant")}, ${c("probe")})
|
|
186244
186399
|
values (job_name, schedule, timezone, queue, payload, date_trunc('milliseconds', next_run),
|
|
186245
|
-
case when next_run is null then date_trunc('milliseconds', now()) end, tenant)
|
|
186400
|
+
case when next_run is null then date_trunc('milliseconds', now()) end, tenant, probe)
|
|
186246
186401
|
on conflict (${c("jobName")}) do update
|
|
186247
186402
|
set ${c("schedule")} = excluded.${c("schedule")},
|
|
186248
186403
|
${c("timezone")} = excluded.${c("timezone")},
|
|
@@ -186259,6 +186414,7 @@ begin
|
|
|
186259
186414
|
else excluded.${c("firstAfter")}
|
|
186260
186415
|
end,
|
|
186261
186416
|
${c("tenant")} = excluded.${c("tenant")},
|
|
186417
|
+
${c("probe")} = excluded.${c("probe")},
|
|
186262
186418
|
${c("lockedUntil")} = null;
|
|
186263
186419
|
return null;
|
|
186264
186420
|
end;
|
|
@@ -186267,13 +186423,13 @@ $$;
|
|
|
186267
186423
|
-- Schedules whose name starts with name_prefix and that run for for_tenant (either
|
|
186268
186424
|
-- filter null: all), for a product page that shows the next run.
|
|
186269
186425
|
create or replace function better_supabase.list_schedules(name_prefix text default null, for_tenant text default null)
|
|
186270
|
-
returns table (job_name text, schedule text, timezone text, queue text, tenant text, next_run timestamptz, last_run timestamptz, lock_expires_at timestamptz, created_at timestamptz, payload jsonb)
|
|
186426
|
+
returns table (job_name text, schedule text, timezone text, queue text, tenant text, next_run timestamptz, last_run timestamptz, lock_expires_at timestamptz, created_at timestamptz, payload jsonb, probe text)
|
|
186271
186427
|
language sql
|
|
186272
186428
|
stable
|
|
186273
186429
|
security definer
|
|
186274
186430
|
set search_path = ''
|
|
186275
186431
|
as $$
|
|
186276
|
-
select s.${c("jobName")}, s.${c("schedule")}, s.${c("timezone")}, s.${c("queue")}, s.${c("tenant")}, s.${c("nextRun")}, s.${c("lastRun")}, s.${c("lockedUntil")}, s.${c("createdAt")}, s.${c("payload")}
|
|
186432
|
+
select s.${c("jobName")}, s.${c("schedule")}, s.${c("timezone")}, s.${c("queue")}, s.${c("tenant")}, s.${c("nextRun")}, s.${c("lastRun")}, s.${c("lockedUntil")}, s.${c("createdAt")}, s.${c("payload")}, s.${c("probe")}
|
|
186277
186433
|
from ${schedules} s
|
|
186278
186434
|
where (list_schedules.name_prefix is null or starts_with(s.${c("jobName")}, list_schedules.name_prefix))
|
|
186279
186435
|
and (list_schedules.for_tenant is null or s.${c("tenant")} = list_schedules.for_tenant)
|
|
@@ -186317,7 +186473,7 @@ as $$
|
|
|
186317
186473
|
begin
|
|
186318
186474
|
return query
|
|
186319
186475
|
with due as (
|
|
186320
|
-
select s.${c("jobName")} as job_name
|
|
186476
|
+
select s.${c("jobName")} as job_name, s.${c("nextRun")} is null as first, s.${c("probe")} as probe
|
|
186321
186477
|
from ${schedules} s
|
|
186322
186478
|
where (s.${c("nextRun")} is null or s.${c("nextRun")} <= clock_timestamp())
|
|
186323
186479
|
and (s.${c("lockedUntil")} is null or s.${c("lockedUntil")} < clock_timestamp())
|
|
@@ -186329,6 +186485,7 @@ begin
|
|
|
186329
186485
|
set ${c("lockedUntil")} = clock_timestamp() + make_interval(secs => lease)
|
|
186330
186486
|
from due
|
|
186331
186487
|
where s.${c("jobName")} = due.job_name
|
|
186488
|
+
and (due.first or due.probe is null or better_supabase.schedule_has_work(due.probe))
|
|
186332
186489
|
returning s.${c("jobName")}, s.${c("schedule")}, s.${c("timezone")}, s.${c("queue")}, s.${c("payload")}, s.${c("nextRun")}, s.${c("firstAfter")};
|
|
186333
186490
|
end;
|
|
186334
186491
|
$$;
|
|
@@ -186368,7 +186525,8 @@ const GRANTS = (backend) => serviceOnly$1([
|
|
|
186368
186525
|
"complete_job(text, bigint, integer)",
|
|
186369
186526
|
"fail_job(text, bigint, integer, text, integer)",
|
|
186370
186527
|
"extend_job_lease(text, bigint, integer, integer)",
|
|
186371
|
-
"schedule_job(text, text, text, jsonb, text, timestamptz, text)",
|
|
186528
|
+
"schedule_job(text, text, text, jsonb, text, timestamptz, text, text)",
|
|
186529
|
+
"schedule_has_work(text)",
|
|
186372
186530
|
"unschedule_job(text)",
|
|
186373
186531
|
"list_schedules(text, text)",
|
|
186374
186532
|
"unschedule_tenant(text)",
|
|
@@ -186400,7 +186558,8 @@ const NAMES$42 = {
|
|
|
186400
186558
|
lockedUntil: "lock_expires_at",
|
|
186401
186559
|
createdAt: "created_at",
|
|
186402
186560
|
tenant: "tenant",
|
|
186403
|
-
firstAfter: "first_after"
|
|
186561
|
+
firstAfter: "first_after",
|
|
186562
|
+
probe: "probe"
|
|
186404
186563
|
}
|
|
186405
186564
|
}
|
|
186406
186565
|
}
|
|
@@ -186412,6 +186571,7 @@ function jobsSql(ctx) {
|
|
|
186412
186571
|
schemaPreamble(ctx),
|
|
186413
186572
|
LEGACY,
|
|
186414
186573
|
backend === "pgmq" ? pgmq(archiveGuard(ctx)) : table$1(ctx, archiveGuard(ctx)),
|
|
186574
|
+
SCHEDULE_HAS_WORK,
|
|
186415
186575
|
scheduler === "pg_cron" ? PG_CRON(backend) : drain(ctx),
|
|
186416
186576
|
leasesSql(ctx),
|
|
186417
186577
|
GRANTS(backend)
|
|
@@ -186424,10 +186584,15 @@ const JOBS = {
|
|
|
186424
186584
|
requires: ["housekeeping"],
|
|
186425
186585
|
integrates: ["data-lifecycle"],
|
|
186426
186586
|
target: "schema",
|
|
186427
|
-
version:
|
|
186587
|
+
version: 12,
|
|
186428
186588
|
names: NAMES$42,
|
|
186429
186589
|
data: (ctx) => jobsBackend(ctx) === "pgmq" ? "-- Indexes the queues that existed before the module.\nselect better_supabase.index_job_queue(q.queue_name) from pgmq.list_queues() q;" : "",
|
|
186430
186590
|
upgrades: [
|
|
186591
|
+
{
|
|
186592
|
+
from: 11,
|
|
186593
|
+
description: "A schedule can name a probe, a function without arguments that returns whether there is work; a due schedule whose probe returns false stays due and enqueues nothing until it does. list_schedules returns the probe.",
|
|
186594
|
+
sql: () => ["drop function if exists better_supabase.schedule_job(text, text, text, jsonb, text, timestamptz, text);", "drop function if exists better_supabase.list_schedules(text, text);"].join("\n")
|
|
186595
|
+
},
|
|
186431
186596
|
{
|
|
186432
186597
|
from: 10,
|
|
186433
186598
|
description: "ready_job_queues answers which queues have a claimable message, and list_schedules returns each schedule's payload.",
|
|
@@ -220524,7 +220689,35 @@ stable
|
|
|
220524
220689
|
security definer
|
|
220525
220690
|
set search_path = ''
|
|
220526
220691
|
as $$
|
|
220527
|
-
${hasCounter("reported") ? `
|
|
220692
|
+
${hasCounter("reported") ? ` with c as materialized (
|
|
220693
|
+
select * from ${counters} c
|
|
220694
|
+
where c.${cc("value")} > c.${cc("reported")}
|
|
220695
|
+
and c.${cc("meter")} <> all (coalesce(unreported_usage.skip_meters, '{}'))
|
|
220696
|
+
and c.${cc("tenant")} <> all (coalesce(unreported_usage.skip_tenants, '{}'))
|
|
220697
|
+
order by c.${cc("day")}
|
|
220698
|
+
limit max_rows
|
|
220699
|
+
),
|
|
220700
|
+
tenants as materialized (
|
|
220701
|
+
select t.tenant${entitled ? `, ${ctx.entitlements("t.tenant")}::text[] as entitled` : ""}${planKeys === "" ? "" : ", better_supabase.tenant_plans(t.tenant)::text[] as plans"}
|
|
220702
|
+
from (select distinct c.${cc("tenant")} as tenant from c) t
|
|
220703
|
+
),
|
|
220704
|
+
quota as materialized (
|
|
220705
|
+
select distinct on (p.tenant, p.meter) p.tenant, p.meter, q.${qc("limit")} as quota_limit, ${quotaPeriod("q")} as period
|
|
220706
|
+
from (select distinct c.${cc("tenant")} as tenant, c.${cc("meter")} as meter from c) p
|
|
220707
|
+
join tenants t on t.tenant = p.tenant
|
|
220708
|
+
join ${quotas} q on q.${qc("meter")} = p.meter
|
|
220709
|
+
and (q.${qc("tenant")} = p.tenant or (q.${qc("tenant")} is null and (q.${qc("plan")} = '*'${entitled ? ` or q.${qc("plan")} = any (t.entitled)` : ""}${planKeys === "" ? "" : ` or q.${qc("plan")} = any (t.plans)`})))
|
|
220710
|
+
order by p.tenant, p.meter, (q.${qc("tenant")} is not null) desc, q.${qc("limit")} desc nulls first
|
|
220711
|
+
),
|
|
220712
|
+
win as materialized (
|
|
220713
|
+
select d.tenant, d.period, d.day, ${fn("usage_window_start")}(d.tenant, d.period, d.day) as since
|
|
220714
|
+
from (
|
|
220715
|
+
select distinct c.${cc("tenant")} as tenant, q.period, c.${cc("day")} as day
|
|
220716
|
+
from c
|
|
220717
|
+
left join quota q on q.tenant = c.${cc("tenant")} and q.meter = c.${cc("meter")}
|
|
220718
|
+
) d
|
|
220719
|
+
)
|
|
220720
|
+
select coalesce(jsonb_agg(jsonb_build_object(
|
|
220528
220721
|
'organization_id', c.${cc("tenant")},
|
|
220529
220722
|
'meter', c.${cc("meter")},
|
|
220530
220723
|
'day', c.${cc("day")},
|
|
@@ -220540,18 +220733,9 @@ ${hasCounter("reported") ? ` select coalesce(jsonb_agg(jsonb_build_object(
|
|
|
220540
220733
|
and o.${cc("day")} >= w.since
|
|
220541
220734
|
)
|
|
220542
220735
|
) order by c.${cc("day")}, c.${cc("meter")}), '[]'::jsonb)
|
|
220543
|
-
from
|
|
220544
|
-
|
|
220545
|
-
|
|
220546
|
-
and c.${cc("meter")} <> all (coalesce(unreported_usage.skip_meters, '{}'))
|
|
220547
|
-
and c.${cc("tenant")} <> all (coalesce(unreported_usage.skip_tenants, '{}'))
|
|
220548
|
-
order by c.${cc("day")}
|
|
220549
|
-
limit max_rows
|
|
220550
|
-
) c
|
|
220551
|
-
left join lateral ${fn("usage_quota")}(c.${cc("tenant")}, c.${cc("meter")}) q on true
|
|
220552
|
-
cross join lateral (
|
|
220553
|
-
select ${fn("usage_window_start")}(c.${cc("tenant")}, q.period, c.${cc("day")}) as since
|
|
220554
|
-
) w` : " select '[]'::jsonb"}
|
|
220736
|
+
from c
|
|
220737
|
+
left join quota q on q.tenant = c.${cc("tenant")} and q.meter = c.${cc("meter")}
|
|
220738
|
+
join win w on w.tenant = c.${cc("tenant")} and w.period is not distinct from q.period and w.day = c.${cc("day")}` : " select '[]'::jsonb"}
|
|
220555
220739
|
$$;
|
|
220556
220740
|
|
|
220557
220741
|
-- Marks a counter as reported up to value; never moves it backwards.
|
|
@@ -225458,6 +225642,19 @@ ${receive}
|
|
|
225458
225642
|
end;
|
|
225459
225643
|
$$;
|
|
225460
225644
|
|
|
225645
|
+
create or replace function better_supabase.webhook_inbox_has_work()
|
|
225646
|
+
returns boolean
|
|
225647
|
+
language sql
|
|
225648
|
+
stable
|
|
225649
|
+
set search_path = ''
|
|
225650
|
+
as $$
|
|
225651
|
+
select exists (
|
|
225652
|
+
select 1 from ${t} c
|
|
225653
|
+
where (c.${c("status")} = 'pending' and c.${c("availableAt")} <= now())
|
|
225654
|
+
or (c.${c("status")} = 'processing' and c.${c("lockedUntil")} < now())
|
|
225655
|
+
)
|
|
225656
|
+
$$;
|
|
225657
|
+
|
|
225461
225658
|
-- The claimed messages, a jsonb array. A message whose lease ran out on its
|
|
225462
225659
|
-- last attempt lost its worker (fail_webhook marks it dead otherwise), so the
|
|
225463
225660
|
-- claim marks it dead.
|
|
@@ -225648,6 +225845,7 @@ $$;
|
|
|
225648
225845
|
${serviceOnly$1([
|
|
225649
225846
|
`receive_webhook(text, text, text, jsonb, jsonb, text, integer${extra.type})`,
|
|
225650
225847
|
"claim_webhooks(text, text, integer, interval)",
|
|
225848
|
+
"webhook_inbox_has_work()",
|
|
225651
225849
|
"complete_webhook(bigint, text, integer)",
|
|
225652
225850
|
"fail_webhook(bigint, text, text, interval, integer, boolean)",
|
|
225653
225851
|
"extend_webhook(bigint, text, integer, interval)",
|
|
@@ -225686,7 +225884,7 @@ const WEBHOOK_INBOX = {
|
|
|
225686
225884
|
]
|
|
225687
225885
|
} }
|
|
225688
225886
|
},
|
|
225689
|
-
version:
|
|
225887
|
+
version: 10,
|
|
225690
225888
|
upgrades: [
|
|
225691
225889
|
{
|
|
225692
225890
|
from: 1,
|
|
@@ -225731,6 +225929,11 @@ const WEBHOOK_INBOX = {
|
|
|
225731
225929
|
from: 8,
|
|
225732
225930
|
description: "fail_webhook takes permanent, which marks the message dead without further attempts.",
|
|
225733
225931
|
sql: () => "drop function if exists better_supabase.fail_webhook(bigint, text, text, interval, integer);"
|
|
225932
|
+
},
|
|
225933
|
+
{
|
|
225934
|
+
from: 9,
|
|
225935
|
+
description: "webhook_inbox_has_work() says whether a message is ready to claim, as the probe of the inbox schedule.",
|
|
225936
|
+
sql: () => ""
|
|
225734
225937
|
}
|
|
225735
225938
|
],
|
|
225736
225939
|
build: webhookInboxSql
|
|
@@ -226792,7 +226995,22 @@ function claim(ctx, n) {
|
|
|
226792
226995
|
n.has("deliveries", "processedAt") ? `, ${v("processedAt")} = now()` : "",
|
|
226793
226996
|
touched(n, "deliveries")
|
|
226794
226997
|
].join("");
|
|
226998
|
+
const probe = ctx.fn("webhook_deliveries_has_work");
|
|
226795
226999
|
return `
|
|
227000
|
+
create or replace function ${probe}()
|
|
227001
|
+
returns boolean
|
|
227002
|
+
language sql
|
|
227003
|
+
stable
|
|
227004
|
+
set search_path = ''
|
|
227005
|
+
as $$
|
|
227006
|
+
select exists (
|
|
227007
|
+
select 1 from ${n.table("deliveries")} v
|
|
227008
|
+
where v.${v("status")} in (${n.status("pending")}, ${n.status("retrying")}, ${n.status("delivering")})
|
|
227009
|
+
and v.${v("availableAt")} <= now()
|
|
227010
|
+
and (v.${v("leasedUntil")} is null or v.${v("leasedUntil")} <= now())
|
|
227011
|
+
)
|
|
227012
|
+
$$;
|
|
227013
|
+
${grants(probe, "", false)}
|
|
226796
227014
|
drop function if exists ${fn}(integer, interval);
|
|
226797
227015
|
-- Leases due deliveries to one worker and counts the attempt, so a worker
|
|
226798
227016
|
-- that dies mid-send still uses one up. The attempt is the lease token that
|
|
@@ -227851,7 +228069,7 @@ const WEBHOOKS_OUT = {
|
|
|
227851
228069
|
providerFunctions: ["idsWithFor"],
|
|
227852
228070
|
target: "schema",
|
|
227853
228071
|
modes: ["managed", "custom"],
|
|
227854
|
-
version:
|
|
228072
|
+
version: 7,
|
|
227855
228073
|
names: NAMES$2,
|
|
227856
228074
|
contract: contract$1,
|
|
227857
228075
|
upgrades: [
|
|
@@ -227882,6 +228100,11 @@ const WEBHOOKS_OUT = {
|
|
|
227882
228100
|
from: 5,
|
|
227883
228101
|
description: "create_webhook_endpoint, update_webhook_endpoint, list_webhook_endpoints and delete_webhook_endpoint manage a tenant's endpoints behind the module's manage and view permissions.",
|
|
227884
228102
|
sql: () => ""
|
|
228103
|
+
},
|
|
228104
|
+
{
|
|
228105
|
+
from: 6,
|
|
228106
|
+
description: "webhook_deliveries_has_work() says whether a delivery is due, as the probe of the delivery schedule.",
|
|
228107
|
+
sql: () => ""
|
|
227885
228108
|
}
|
|
227886
228109
|
],
|
|
227887
228110
|
build: build$2
|