better-supabase 0.5.1 → 0.6.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/README.md +187 -46
- package/dist/access-sql-B0dF-SoF.js +181 -0
- package/dist/{actor-DaJjqD5R.d.ts → actor-CQTlc1Hh.d.ts} +1 -1
- package/dist/adapter-Bc1o3zyy.js +1106 -0
- package/dist/agents-CVHGd7It.d.ts +94 -0
- package/dist/ai-cache-CBWs1W0k.js +80 -0
- package/dist/ai-cache-DaDu_G5L.d.ts +64 -0
- package/dist/ai-chat-7amvXjmQ.d.ts +590 -0
- package/dist/ai-chat-B24UI962.js +743 -0
- package/dist/ai-files-CSPNswUY.js +319 -0
- package/dist/ai-sdk/agents/index.d.ts +74 -0
- package/dist/ai-sdk/agents/index.js +159 -0
- package/dist/ai-sdk/batches/index.d.ts +74 -0
- package/dist/ai-sdk/batches/index.js +180 -0
- package/dist/ai-sdk/cache/index.d.ts +38 -0
- package/dist/ai-sdk/cache/index.js +127 -0
- package/dist/ai-sdk/chat/index.d.ts +2 -0
- package/dist/ai-sdk/chat/index.js +246 -0
- package/dist/ai-sdk/embeddings/index.d.ts +3 -0
- package/dist/ai-sdk/embeddings/index.js +2 -0
- package/dist/ai-sdk/files/index.d.ts +61 -0
- package/dist/ai-sdk/files/index.js +111 -0
- package/dist/ai-sdk/index.d.ts +145 -0
- package/dist/ai-sdk/index.js +174 -0
- package/dist/ai-sdk/mcp/index.d.ts +102 -0
- package/dist/ai-sdk/mcp/index.js +362 -0
- package/dist/ai-sdk/memory/index.d.ts +67 -0
- package/dist/ai-sdk/memory/index.js +175 -0
- package/dist/ai-sdk/react/index.d.ts +2 -0
- package/dist/ai-sdk/react/index.js +3 -0
- package/dist/ai-sdk/react/server.d.ts +6 -0
- package/dist/ai-sdk/react/server.js +7 -0
- package/dist/ai-sdk/workflow/index.d.ts +249 -0
- package/dist/ai-sdk/workflow/index.js +575 -0
- package/dist/ai-sdk/workflow/react/index.d.ts +20 -0
- package/dist/ai-sdk/workflow/react/index.js +66 -0
- package/dist/ai-sdk/workflow/react/server.d.ts +10 -0
- package/dist/ai-sdk/workflow/react/server.js +12 -0
- package/dist/ai-tasks-Cd1HMFvB.d.ts +131 -0
- package/dist/announcements-CiyOs-xP.js +107 -0
- package/dist/announcements-ZRGnScWI.d.ts +72 -0
- package/dist/api-keys-rCGtKaZA.d.ts +156 -0
- package/dist/assistant-DwdpDH1q.d.ts +147 -0
- package/dist/astro/index.d.ts +86 -0
- package/dist/astro/index.js +93 -0
- package/dist/attributes-5dYul0u0.js +13 -0
- package/dist/auth-link-BjFPqwLz.d.ts +97 -0
- package/dist/auth-link-DrDX9KOT.js +114 -0
- package/dist/authorization-BFCqamMs.d.ts +172 -0
- package/dist/before-route-CnR0C0Jr.js +30 -0
- package/dist/bind-Bu_ZNa3W.d.ts +62 -0
- package/dist/bind-l4kAvYSv.js +97 -0
- package/dist/block-events-CrT8r7Fe.js +76 -0
- package/dist/block-fields-GFkxl4dP.js +49 -0
- package/dist/block-fields-SJ6fEf3o.d.ts +31 -0
- package/dist/block-helpers-CKtbFcRv.d.ts +37 -0
- package/dist/block-helpers-DWHxHsEQ.js +190 -0
- package/dist/block-hooks-BmjMyXTa.js +114 -0
- package/dist/block-hooks-plbZ0AbJ.d.ts +107 -0
- package/dist/{kit-transport-DJlHQUBU.js → block-transport-BLr-ZgLc.js} +11 -7
- package/dist/block-transport-DvaoPuZ9.d.ts +48 -0
- package/dist/blocks/agents/index.d.ts +3 -0
- package/dist/blocks/agents/index.js +123 -0
- package/dist/blocks/ai-cache/index.d.ts +3 -0
- package/dist/blocks/ai-cache/index.js +3 -0
- package/dist/blocks/ai-chat/index.d.ts +31 -0
- package/dist/blocks/ai-chat/index.js +5 -0
- package/dist/blocks/ai-chat/react/index.d.ts +77 -0
- package/dist/blocks/ai-chat/react/index.js +387 -0
- package/dist/blocks/ai-chat/react/server.d.ts +16 -0
- package/dist/blocks/ai-chat/react/server.js +14 -0
- package/dist/blocks/ai-files/index.d.ts +14 -0
- package/dist/blocks/ai-files/index.js +3 -0
- package/dist/blocks/ai-providers/index.d.ts +7 -0
- package/dist/blocks/ai-providers/index.js +211 -0
- package/dist/blocks/ai-tasks/index.d.ts +3 -0
- package/dist/blocks/ai-tasks/index.js +203 -0
- package/dist/blocks/announcements/index.d.ts +3 -0
- package/dist/blocks/announcements/index.js +3 -0
- package/dist/blocks/announcements/react/index.d.ts +31 -0
- package/dist/blocks/announcements/react/index.js +86 -0
- package/dist/blocks/announcements/react/server.d.ts +6 -0
- package/dist/blocks/announcements/react/server.js +7 -0
- package/dist/blocks/api-keys/index.d.ts +35 -0
- package/dist/blocks/api-keys/index.js +334 -0
- package/dist/blocks/attachments/index.d.ts +210 -0
- package/dist/blocks/attachments/index.js +222 -0
- package/dist/blocks/audit/index.d.ts +366 -0
- package/dist/blocks/audit/index.js +714 -0
- package/dist/blocks/billing/index.d.ts +265 -0
- package/dist/blocks/billing/index.js +400 -0
- package/dist/blocks/comments/index.d.ts +200 -0
- package/dist/blocks/comments/index.js +207 -0
- package/dist/blocks/connectors/index.d.ts +3 -0
- package/dist/blocks/connectors/index.js +164 -0
- package/dist/blocks/data-lifecycle/index.d.ts +251 -0
- package/dist/blocks/data-lifecycle/index.js +353 -0
- package/dist/blocks/entitlements/index.d.ts +14 -0
- package/dist/blocks/entitlements/index.js +25 -0
- package/dist/blocks/flags/index.d.ts +226 -0
- package/dist/blocks/flags/index.js +282 -0
- package/dist/blocks/inbox/index.d.ts +6 -0
- package/dist/blocks/inbox/index.js +499 -0
- package/dist/blocks/inbox/react/index.d.ts +2 -0
- package/dist/blocks/inbox/react/index.js +225 -0
- package/dist/blocks/inbox/react/server.d.ts +10 -0
- package/dist/blocks/inbox/react/server.js +12 -0
- package/dist/blocks/index.d.ts +65 -0
- package/dist/blocks/index.js +77 -0
- package/dist/blocks/jobs/index.d.ts +297 -0
- package/dist/blocks/jobs/index.js +1051 -0
- package/dist/blocks/knowledge/index.d.ts +3 -0
- package/dist/blocks/knowledge/index.js +3 -0
- package/dist/blocks/memory/index.d.ts +8 -0
- package/dist/blocks/memory/index.js +289 -0
- package/dist/blocks/notifications/index.d.ts +297 -0
- package/dist/blocks/notifications/index.js +425 -0
- package/dist/blocks/notifications/react/index.d.ts +44 -0
- package/dist/blocks/notifications/react/index.js +67 -0
- package/dist/blocks/notifications/react/server.d.ts +6 -0
- package/dist/blocks/notifications/react/server.js +7 -0
- package/dist/blocks/onboarding/index.d.ts +3 -0
- package/dist/blocks/onboarding/index.js +64 -0
- package/dist/blocks/onboarding/react/index.d.ts +28 -0
- package/dist/blocks/onboarding/react/index.js +78 -0
- package/dist/blocks/onboarding/react/server.d.ts +7 -0
- package/dist/blocks/onboarding/react/server.js +7 -0
- package/dist/blocks/organizations/index.d.ts +241 -0
- package/dist/blocks/organizations/index.js +400 -0
- package/dist/blocks/outbox/index.d.ts +3 -0
- package/dist/blocks/outbox/index.js +266 -0
- package/dist/blocks/profiles/index.d.ts +40 -0
- package/dist/blocks/profiles/index.js +28 -0
- package/dist/blocks/push/index.d.ts +185 -0
- package/dist/blocks/push/index.js +258 -0
- package/dist/blocks/settings/index.d.ts +89 -0
- package/dist/blocks/settings/index.js +104 -0
- package/dist/blocks/sso/index.d.ts +198 -0
- package/dist/blocks/sso/index.js +1297 -0
- package/dist/blocks/usage/index.d.ts +4 -0
- package/dist/blocks/usage/index.js +233 -0
- package/dist/blocks/waitlist/index.d.ts +117 -0
- package/dist/blocks/waitlist/index.js +132 -0
- package/dist/blocks/webhooks/index.d.ts +304 -0
- package/dist/{webhooks → blocks/webhooks}/index.js +468 -148
- package/dist/blocks/workflow-builder/index.d.ts +21 -0
- package/dist/blocks/workflow-builder/index.js +5 -0
- package/dist/blocks/workflow-builder/react/index.d.ts +47 -0
- package/dist/blocks/workflow-builder/react/index.js +119 -0
- package/dist/blocks/workflow-builder/react/server.d.ts +8 -0
- package/dist/blocks/workflow-builder/react/server.js +11 -0
- package/dist/blocks/workflows/index.d.ts +3 -0
- package/dist/blocks/workflows/index.js +3 -0
- package/dist/blocks/workflows/react/index.d.ts +47 -0
- package/dist/blocks/workflows/react/index.js +137 -0
- package/dist/blocks/workflows/react/server.d.ts +8 -0
- package/dist/blocks/workflows/react/server.js +11 -0
- package/dist/{index-SaTsEfGP.d.ts → bucket-Cl46E3jS.d.ts} +134 -91
- package/dist/{simplify-_0oUKqCd.js → build-BXIzE6Xv.js} +222 -124
- package/dist/{channel-FQW-CnGR.d.ts → channel-_2Mx1Oyu.d.ts} +2 -2
- package/dist/channels-CkgQ_X60.js +114 -0
- package/dist/chat-sdk/index.d.ts +303 -0
- package/dist/chat-sdk/index.js +733 -0
- package/dist/chat-sdk/react/index.d.ts +2 -0
- package/dist/chat-sdk/react/index.js +3 -0
- package/dist/chat-sdk/react/server.d.ts +3 -0
- package/dist/chat-sdk/react/server.js +2 -0
- package/dist/claims-DDBQT6BK.js +61 -0
- package/dist/{claims-BAf6c7is.js → claims-PqzCxaTD.js} +39 -2
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{codemod-DqV7612m.js → codemod-Bl_tQpHn.js} +105 -2
- package/dist/cli/config-B9HkL8nF.js +2 -0
- package/dist/cli/config-DU7EJImt.js +49 -0
- package/dist/cli/config-NiPxAmUF.js +1077 -0
- package/dist/cli/{dist-xn4wlboc.js → dist-DRAVaE6w.js} +111 -1
- package/dist/cli/{doctor-C_A-KEAz.js → doctor-B4JOm_ox.js} +991 -317
- package/dist/cli/{env-DmKv_G4A.js → env-CJLbUVPB.js} +1 -1
- package/dist/cli/{env-jIFUADLY.js → env-qXgyMV6r.js} +2 -2
- package/dist/cli/fresh-import-BeYf9I3x.js +40 -0
- package/dist/cli/gen-BGLb_zou.js +3100 -0
- package/dist/cli/gen-DAH8FM2W.js +2 -0
- package/dist/cli/index.d.ts +44 -5
- package/dist/cli/index.js +7 -7
- package/dist/cli/{init-DMa6M7hV.js → init-BIIwclPg.js} +242 -27
- package/dist/cli/{introspect-BKlaIu_M.js → introspect-DNUTuNvb.js} +5 -5
- package/dist/cli/{io-k41_z-jT.js → io-DI1mTdSA.js} +12 -3
- package/dist/cli/{keys-ByKHnvP9.js → keys-BGCnnb-s.js} +8 -6
- package/dist/cli/{ohash-D7bG_EOb.js → ohash-BjQY1cBb.js} +1 -1
- package/dist/cli/{openapi-Cp5Fyta-.js → openapi-BlRJ18s3.js} +2 -2
- package/dist/cli/{project-B_GeXyHh.js → project-DZRaBaY7.js} +11 -6
- package/dist/cli/read-sets-CETOSFx4.js +223 -0
- package/dist/cli/{run-Bo_NLT5n.js → run-DNWxHynX.js} +33 -23
- package/dist/cli/{seed-CUlqWh-8.js → seed-DQzqT7LP.js} +8 -6
- package/dist/cli/{skills-LJJIhLFR.js → skills-QQs4q68J.js} +3 -2
- package/dist/cli/sql-D0GUtUPp.js +536 -0
- package/dist/cli/{config-CPVpXP5I.js → supabase-toml-B-bIukQF.js} +72 -942
- package/dist/cli/typegen-version-DeFbtzYI.js +8 -0
- package/dist/cli/{version-BCtlgDQx.js → version-hr88OZG0.js} +1 -1
- package/dist/client/index.d.ts +3 -2
- package/dist/client/index.js +11 -71
- package/dist/client/native/index.d.ts +228 -0
- package/dist/client/native/index.js +361 -0
- package/dist/client-CI0Z2zWX.js +277 -0
- package/dist/cloud-event-BnmD5fb9.js +46 -0
- package/dist/cloud-event-C1JCc1bH.d.ts +50 -0
- package/dist/{compiler-BXH_aZ7N.d.ts → compiler-DY_wkj4R.d.ts} +2 -2
- package/dist/compose-BIBNgAnq.js +53 -0
- package/dist/composite-Bt1YK3Ke.d.ts +146 -0
- package/dist/composite-DhE66P5u.js +130 -0
- package/dist/config/index.d.ts +6 -4
- package/dist/config/index.js +5 -5
- package/dist/{config-Bv7gvfzC.d.ts → config-D44Y7PAv.d.ts} +406 -214
- package/dist/{config-DreERlKo.js → config-Dn7F5k9A.js} +62 -14
- package/dist/connector-Dv8kK0MO.d.ts +107 -0
- package/dist/connectors-hkLCwyEz.d.ts +120 -0
- package/dist/context-BCrWe7ow.d.ts +237 -0
- package/dist/credentials/index.d.ts +31 -0
- package/dist/credentials/index.js +168 -0
- package/dist/cron-DVPUg5k3.js +145 -0
- package/dist/csv-CPAzEmB6.js +25 -0
- package/dist/db-exception-CnWcYPxL.js +15 -0
- package/dist/{define-cNKzqwL_.js → define-B-TVjC25.js} +784 -227
- package/dist/{define-Bp_BZa5h.d.ts → define-CJJkkr1-.d.ts} +353 -61
- package/dist/edge/index.d.ts +69 -11
- package/dist/edge/index.js +191 -75
- package/dist/elysia/index.d.ts +59 -0
- package/dist/elysia/index.js +62 -0
- package/dist/embeddings-4ZvFzjsU.js +127 -0
- package/dist/embeddings-C9KGQnXt.d.ts +68 -0
- package/dist/{refresh-CFPX0Qft.d.ts → ended-jLfvw8h-.d.ts} +20 -2
- package/dist/{entitlements-BiJZ4t49.d.ts → entitlements-DHrY2UDZ.d.ts} +16 -7
- package/dist/entitlements-DRl6ZJUm.js +24 -0
- package/dist/envelope-DqnYGRw7.js +47 -0
- package/dist/{errors-DtwXa6b8.js → errors-B11Duf73.js} +82 -13
- package/dist/errors-DLjJHPLK.js +44 -0
- package/dist/escape-like-DHfx6jRr.js +7 -0
- package/dist/escape-like-ImTK0ps_.d.ts +15 -0
- package/dist/eve/index.d.ts +220 -0
- package/dist/eve/index.js +504 -0
- package/dist/eve-gT2Fpjut.d.ts +151 -0
- package/dist/events/index.d.ts +4 -3
- package/dist/events/index.js +9 -50
- package/dist/events-DWDhx77e.d.ts +549 -0
- package/dist/executor-Bq28caBo.js +718 -0
- package/dist/executor-C-R4pucm.js +83 -0
- package/dist/executor-CaWigTyR.d.ts +148 -0
- package/dist/executor-D14tGopJ.d.ts +36 -0
- package/dist/{executor-Cghdstwu.d.ts → executor-DbvExCFC.d.ts} +7 -1
- package/dist/{sql-Coh6n4cC.js → executor-De1Of3m3.js} +210 -11
- package/dist/executor-DvsBbNBS.d.ts +261 -0
- package/dist/expo/index.d.ts +79 -0
- package/dist/expo/index.js +129 -0
- package/dist/expo-sqlite/index.d.ts +58 -0
- package/dist/expo-sqlite/index.js +104 -0
- package/dist/field-errors-BFOa7WhB.d.ts +99 -0
- package/dist/field-errors-VF1yb8yI.js +13 -0
- package/dist/framework-CONDyPYx.js +51 -0
- package/dist/framework-DuVb4Xa8.d.ts +25 -0
- package/dist/gateway-C1ssRHnf.d.ts +130 -0
- package/dist/graph-BGyLLFLX.js +265 -0
- package/dist/h3/index.d.ts +59 -0
- package/dist/h3/index.js +55 -0
- package/dist/h3/v1/index.d.ts +63 -0
- package/dist/h3/v1/index.js +49 -0
- package/dist/history-BZih6SFP.js +64 -0
- package/dist/hono/index.d.ts +56 -7
- package/dist/hono/index.js +97 -45
- package/dist/{react-C_s7kiNz.js → hooks-1BTCJsiw.js} +104 -133
- package/dist/http-Cv4T29xh.js +40 -0
- package/dist/http-DdYadv-o.js +126 -0
- package/dist/image-url-pIVlO6R1.js +41 -0
- package/dist/{impersonation-BgSHAYLf.js → impersonation-DcqaTBHx.js} +21 -6
- package/dist/inbox-i7E1ppo6.d.ts +384 -0
- package/dist/index-ACiNPN4Z.d.ts +74 -0
- package/dist/{index-DgILJRXj.d.ts → index-Bepi-Hgg.d.ts} +91 -28
- package/dist/index-BkWT_uBO.d.ts +51 -0
- package/dist/index-BpFYMsi0.d.ts +53 -0
- package/dist/{index-C7f8cOBM.d.ts → index-Bxih3l0u.d.ts} +2 -2
- package/dist/index-CaxrMD1A.d.ts +1 -0
- package/dist/index-ClmjK_o-.d.ts +55 -0
- package/dist/index-CtuakVRc.d.ts +267 -0
- package/dist/index-D48jVS-N.d.ts +246 -0
- package/dist/index-DDrYaUcq.d.ts +138 -0
- package/dist/index-DQh4VCc9.d.ts +98 -0
- package/dist/{live-D9W2M5aO.d.ts → index-DunNRdnT.d.ts} +136 -38
- package/dist/index.d.ts +65 -18
- package/dist/index.js +42 -14
- package/dist/invalidate-BBqhpxyB.d.ts +19 -0
- package/dist/json-CEnpTHlZ.js +16 -0
- package/dist/json-schema-CvER4kgT.js +502 -0
- package/dist/keys-4MnkWTTh.js +35 -0
- package/dist/kit-B5tid-q5.d.ts +60 -0
- package/dist/kit-Fm-Fv7q5.js +78 -0
- package/dist/knowledge-BXBbT0Tr.d.ts +176 -0
- package/dist/knowledge-CDmiMLew.js +255 -0
- package/dist/lint/index.d.ts +1 -1
- package/dist/lint/index.js +37 -0
- package/dist/list/index.d.ts +3 -2
- package/dist/list/index.js +1 -444
- package/dist/{index-fag8VJZ2.d.ts → list-query-BRt-zDF7.d.ts} +20 -12
- package/dist/list-query-gl808ac1.js +459 -0
- package/dist/{live-CdJBOc4f.js → live-CTAZQkwl.js} +99 -14
- package/dist/logger-DWVYUmwi.d.ts +18 -0
- package/dist/mcp/index.d.ts +38 -11
- package/dist/mcp/index.js +82 -46
- package/dist/mcp/sdk/index.d.ts +105 -0
- package/dist/mcp/sdk/index.js +126 -0
- package/dist/message-CaKlqdsX.js +219 -0
- package/dist/message-CfDoR0Y6.d.ts +94 -0
- package/dist/messages-B9-5887d.js +715 -0
- package/dist/messages-DYP0sUTe.d.ts +59 -0
- package/dist/mfa-Daak8ukG.d.ts +54 -0
- package/dist/modules-DpPwzC7E.d.ts +192 -0
- package/dist/modules-dxrVK3ID.js +228 -0
- package/dist/nestjs/index.d.ts +68 -0
- package/dist/nestjs/index.js +164 -0
- package/dist/next/client/index.d.ts +35 -0
- package/dist/next/client/index.js +36 -0
- package/dist/next/image/index.js +3 -24
- package/dist/next/index.d.ts +150 -51
- package/dist/next/index.js +261 -107
- package/dist/node/index.d.ts +4 -0
- package/dist/node/index.js +210 -0
- package/dist/node-headers-AO06VhqH.d.ts +24 -0
- package/dist/node-headers-C71zNQHe.js +55 -0
- package/dist/nuxt/index.d.ts +60 -0
- package/dist/nuxt/index.js +64 -0
- package/dist/onboarding-BZGHYJks.d.ts +62 -0
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.js +3 -3
- package/dist/orpc/index.d.ts +70 -11
- package/dist/orpc/index.js +73 -24
- package/dist/otel/index.d.ts +7 -7
- package/dist/otel/index.js +87 -57
- package/dist/outbox-Cq7pPYvl.d.ts +161 -0
- package/dist/{plugin-o144f322.d.ts → plugin-FGY8UhYm.d.ts} +30 -10
- package/dist/plugin-tfXW1-qO.js +45 -0
- package/dist/plugins/actor/index.d.ts +2 -2
- package/dist/plugins/actor/index.js +3 -3
- package/dist/plugins/rules/index.d.ts +11 -4
- package/dist/plugins/rules/index.js +40 -13
- package/dist/plugins/soft-delete/index.d.ts +5 -4
- package/dist/plugins/soft-delete/index.js +10 -5
- package/dist/plugins/tenant/index.d.ts +2 -2
- package/dist/plugins/tenant/index.js +18 -11
- package/dist/plugins/timestamps/index.d.ts +5 -3
- package/dist/plugins/timestamps/index.js +6 -4
- package/dist/plugins/validation/index.d.ts +2 -2
- package/dist/plugins/validation/index.js +10 -6
- package/dist/{pool-C9voM4Kw.d.ts → pool-CAu2nLrL.d.ts} +2 -2
- package/dist/postgres/index.d.ts +4 -4
- package/dist/postgres/index.js +1 -2
- package/dist/{postgrest-CruYKAvV.d.ts → postgrest-BLVdEnfe.d.ts} +13 -3
- package/dist/powersync/index.d.ts +43 -0
- package/dist/powersync/index.js +199 -0
- package/dist/powersync/react/index.d.ts +87 -0
- package/dist/powersync/react/index.js +108 -0
- package/dist/{problem-BW1KhzSG.js → problem-BreOl8b8.js} +14 -3
- package/dist/{problem-Blxe8S31.d.ts → problem-DD8LZFjc.d.ts} +21 -3
- package/dist/provider-BH5UWZJ6.d.ts +113 -0
- package/dist/provider-Di3sRutW.js +57 -0
- package/dist/query/index.d.ts +4 -2
- package/dist/query/index.js +4 -3
- package/dist/{query-CCbo44lG.js → query-BQ-NaZon.js} +141 -24
- package/dist/{queue-BYUCjr59.d.ts → queue-CLJurhdy.d.ts} +258 -83
- package/dist/react/index.d.ts +11 -7
- package/dist/react/index.js +7 -3
- package/dist/react/native/index.d.ts +116 -0
- package/dist/react/native/index.js +130 -0
- package/dist/react/server.d.ts +28 -10
- package/dist/react/server.js +22 -5
- package/dist/react/session.d.ts +2 -2
- package/dist/react-4ZqkP8da.js +79 -0
- package/dist/react-F80mF4-t.js +409 -0
- package/dist/react-router/index.d.ts +83 -0
- package/dist/react-router/index.js +89 -0
- package/dist/react-topic-seAWjL3_.js +38 -0
- package/dist/{read-set-DQFt1N_Y.js → read-set-DuKWC9Mj.js} +67 -25
- package/dist/realtime/index.d.ts +4 -5
- package/dist/realtime/index.js +144 -82
- package/dist/refusal-CeJWxmkH.js +61 -0
- package/dist/refusal-D1rgbzNq.d.ts +15 -0
- package/dist/replicas-CwrYp5Zj.js +94 -0
- package/dist/{view-Bn6HNKUe.js → resolve-D_IcnvFd.js} +248 -240
- package/dist/{impersonation-BmePsuxz.d.ts → resolve-KW8nCeL6.d.ts} +29 -69
- package/dist/{resource-mqfJW4YF.js → resource-BsvzCMlX.js} +4 -4
- package/dist/{resource-DNRFP7KR.d.ts → resource-D6Uc7Sk7.d.ts} +5 -5
- package/dist/respond-BUgsXNgk.js +91 -0
- package/dist/respond-DoBijysA.d.ts +93 -0
- package/dist/result-D7y2fT87.d.ts +282 -0
- package/dist/{result-BKiliPY7.js → result-DzUbqgdW.js} +27 -2
- package/dist/run-state-CPo-1X2B.d.ts +12 -0
- package/dist/run-state-CgBKzYMW.js +13 -0
- package/dist/search-CUWCRYKL.js +9 -0
- package/dist/server/index.d.ts +143 -22
- package/dist/server/index.js +46 -14
- package/dist/{respond-BR1fJWOB.d.ts → server-CeVeeXwz.d.ts} +224 -85
- package/dist/session-ChiXDZdZ.d.ts +72 -0
- package/dist/shared-CBxosKK3.js +75 -0
- package/dist/{shared-D1dRUrAg.js → shared-CxWmcyqB.js} +2 -1
- package/dist/shared-DDSjEGDR.d.ts +11 -0
- package/dist/sign-in-BCV5S2WZ.d.ts +49 -0
- package/dist/sign-in-Cb1mwv6X.js +86 -0
- package/dist/{signers-Cc6r98SW.d.ts → signers-4y62_VIi.d.ts} +13 -9
- package/dist/simplify-DDO0j0LI.js +83 -0
- package/dist/solid/index.d.ts +131 -0
- package/dist/solid/index.js +344 -0
- package/dist/solid-start/index.d.ts +75 -0
- package/dist/solid-start/index.js +58 -0
- package/dist/{spec-pins-C3oc-Tdp.js → spec-pins--j6mTok4.js} +8 -1
- package/dist/{spec-pins-CqorWDnO.d.ts → spec-pins-C89s6DyW.d.ts} +7 -0
- package/dist/sql/index.d.ts +313 -212
- package/dist/sql/index.js +34872 -6579
- package/dist/ssr/index.d.ts +6 -5
- package/dist/ssr/index.js +3 -3
- package/dist/{standard-D7r6dMUu.js → standard-BK0cqJ7y.js} +4 -3
- package/dist/{standard-J4YgMOLm.d.ts → standard-CYsm7xpT.d.ts} +1 -1
- package/dist/stats-D_AD9GGu.js +1123 -0
- package/dist/storage/index.d.ts +5 -5
- package/dist/storage/index.js +1027 -368
- package/dist/store-BdH5ruDx.js +66 -0
- package/dist/store-CGjgWu5n.d.ts +68 -0
- package/dist/streams/index.d.ts +76 -0
- package/dist/streams/index.js +77 -0
- package/dist/streams/redis/index.d.ts +52 -0
- package/dist/streams/redis/index.js +185 -0
- package/dist/stripe-BMj5LtsT.js +38 -0
- package/dist/stripe-D04h-QBT.d.ts +136 -0
- package/dist/{support-wHnK6zp-.js → support-BivNqSpK.js} +32 -11
- package/dist/{support-view-B8SlToQX.d.ts → support-view-33Oi07TT.d.ts} +1 -1
- package/dist/svelte/index.d.ts +114 -0
- package/dist/svelte/index.js +344 -0
- package/dist/sveltekit/index.d.ts +116 -0
- package/dist/sveltekit/index.js +106 -0
- package/dist/tags-B99_U9Pp.js +39 -0
- package/dist/tags-Cx-LnIQP.d.ts +30 -0
- package/dist/tanstack-db/index.d.ts +71 -0
- package/dist/tanstack-db/index.js +72 -0
- package/dist/tanstack-start/index.d.ts +75 -0
- package/dist/tanstack-start/index.js +95 -0
- package/dist/tee-CoEppCER.js +101 -0
- package/dist/{template-TxrGI5jR.js → template--jDkl3UP.js} +34 -13
- package/dist/template-CwO38Do8.d.ts +6 -0
- package/dist/temporal-BJGitm-h.js +79 -0
- package/dist/{temporal-required-CAt4Dc9Z.js → temporal-required-BVvW7SYJ.js} +3 -2
- package/dist/tenant-I1TEZ_BX.js +27 -0
- package/dist/tenant-icPeuUBN.d.ts +17 -0
- package/dist/testing/index.d.ts +315 -41
- package/dist/testing/index.js +1046 -79
- package/dist/timing-CyTQPubY.js +92 -0
- package/dist/ttl-Hr34gRu8.js +12 -0
- package/dist/{types-Dnf_wRDz.d.ts → types-6BdhkmZe.d.ts} +111 -45
- package/dist/types-BI-0Sl2v.d.ts +359 -0
- package/dist/types-C05bxW-W.d.ts +220 -0
- package/dist/types-DGs5L0VN.d.ts +192 -0
- package/dist/types-TaiEeBGA.d.ts +156 -0
- package/dist/usage-CrvrL2vw.d.ts +177 -0
- package/dist/user-change-XzvgafU4.js +130 -0
- package/dist/vault-CSO7ss5C.d.ts +50 -0
- package/dist/vercel-connect/index.d.ts +47 -0
- package/dist/vercel-connect/index.js +119 -0
- package/dist/{verify-Ce49ETPz.js → verify-DL41hbvY.js} +85 -13
- package/dist/verify-DPuWngD4.d.ts +172 -0
- package/dist/{version-DOYTYwHP.js → version-Bvv6aLjZ.js} +1 -1
- package/dist/view-BeFcRV6G.js +99 -0
- package/dist/{view-CbgObAeb.d.ts → view-DbxLNu8L.d.ts} +22 -5
- package/dist/vue/index.d.ts +141 -0
- package/dist/vue/index.js +362 -0
- package/dist/watch-DI34G86j.d.ts +60 -0
- package/dist/watch-Xuxrvxq-.js +122 -0
- package/dist/{wire-D2dT86vi.js → wire-DtZQ4sdE.js} +15 -5
- package/dist/workflow-builder-DJ1oHn8g.js +398 -0
- package/dist/workflow-sdk/builder/index.d.ts +85 -0
- package/dist/workflow-sdk/builder/index.js +250 -0
- package/dist/workflow-sdk/index.d.ts +14 -0
- package/dist/workflow-sdk/index.js +3 -0
- package/dist/workflow-sdk/world/index.d.ts +107 -0
- package/dist/workflow-sdk/world/index.js +702 -0
- package/dist/workflow-sdk-B3yLD6Br.d.ts +98 -0
- package/dist/workflow-sdk-C2WJ_G2O.js +173 -0
- package/dist/workflow-sdk-world-D-prir6O.js +1397 -0
- package/dist/workflows-B0j9WKPu.d.ts +185 -0
- package/dist/workflows-wu1WWBn7.js +216 -0
- package/package.json +461 -20
- package/schemas/ai-message-v1.json +258 -0
- package/schemas/config-v1.json +1074 -140
- package/schemas/doctor-report-v1.json +20 -1
- package/schemas/snapshot-v2.json +8 -0
- package/skills/better-supabase/SKILL.md +41 -12
- package/skills/better-supabase/references/frontend.md +96 -0
- package/skills/better-supabase/references/plugins.md +10 -6
- package/skills/better-supabase/references/troubleshooting.md +2 -1
- package/skills/better-supabase-api/SKILL.md +76 -22
- package/skills/better-supabase-api/references/adapters.md +207 -0
- package/skills/better-supabase-api/references/ai.md +125 -0
- package/skills/better-supabase-api/references/expo.md +65 -0
- package/skills/better-supabase-api/references/powersync.md +35 -0
- package/skills/better-supabase-api/references/streams-credentials.md +105 -0
- package/skills/better-supabase-auth/SKILL.md +47 -11
- package/skills/better-supabase-auth/references/authorization-providers.md +51 -0
- package/skills/better-supabase-testing/SKILL.md +3 -1
- package/dist/cli/config-dtoekM0v.js +0 -2
- package/dist/cli/gen-CIdSQZad.js +0 -2
- package/dist/cli/gen-CjElD1Vw.js +0 -2241
- package/dist/cli/read-sets-VQcPgxU9.js +0 -436
- package/dist/cli/sql-CVx-1O8G.js +0 -373
- package/dist/entitlements-CTEBm7IB.js +0 -20
- package/dist/events-aIO7vsIk.d.ts +0 -230
- package/dist/executor-BunPOO-k.d.ts +0 -402
- package/dist/executor-XycESQPH.js +0 -94
- package/dist/index-CWMDdEr4.d.ts +0 -50
- package/dist/index-DOESKG27.d.ts +0 -100
- package/dist/index-DmXSxbLi.d.ts +0 -62
- package/dist/index-Dp2VDwog.d.ts +0 -161
- package/dist/jobs/index.d.ts +0 -226
- package/dist/jobs/index.js +0 -1007
- package/dist/json-schema-m1fiwKgN.js +0 -208
- package/dist/kit-events-CTFDfSwb.js +0 -60
- package/dist/kit-transport-B82k1djG.d.ts +0 -33
- package/dist/kits-CGLLrNPd.js +0 -157
- package/dist/mfa-Cu96oJdw.d.ts +0 -30
- package/dist/notifications/index.d.ts +0 -162
- package/dist/notifications/index.js +0 -264
- package/dist/orgs/index.d.ts +0 -132
- package/dist/orgs/index.js +0 -245
- package/dist/permdock-sql-C2Inc6Xc.d.ts +0 -29
- package/dist/permdock-sql-DgOfeixi.js +0 -51
- package/dist/plugin-DwARMuQp.js +0 -59
- package/dist/server-B1mZ7CgQ.js +0 -660
- package/dist/stats-Bqob3WqT.js +0 -592
- package/dist/support-CEPwlw2G.d.ts +0 -89
- package/dist/template-mbvlysOo.d.ts +0 -6
- package/dist/temporal-CVlIV2DZ.js +0 -40
- package/dist/user-change-CHFEUro1.js +0 -49
- package/dist/webhooks/index.d.ts +0 -285
- package/skills/better-supabase-auth/references/permdock.md +0 -122
|
@@ -1,853 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { _ as unknown, a as literal, c as objectWithRest, f as record, g as union, h as string, i as getDotPath, l as optional, m as strictObject, n as boolean, o as nullable, p as safeParse, r as custom, s as number, t as array, u as picklist } from "./dist-xn4wlboc.js";
|
|
5
|
-
import * as nodeUtil from "node:util";
|
|
6
|
-
import { join, posix, resolve } from "node:path";
|
|
7
|
-
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
8
|
-
import { glob, readFile, rm } from "node:fs/promises";
|
|
9
|
-
import { pathToFileURL } from "node:url";
|
|
10
|
-
import { homedir } from "node:os";
|
|
11
|
-
import { resolveConfig } from "better-supabase/config";
|
|
12
|
-
//#region ../../node_modules/.pnpm/rc9@3.1.0/node_modules/rc9/dist/_chunks/libs/flat.mjs
|
|
13
|
-
function isBuffer(obj) {
|
|
14
|
-
return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
15
|
-
}
|
|
16
|
-
function keyIdentity(key) {
|
|
17
|
-
return key;
|
|
18
|
-
}
|
|
19
|
-
function flatten(target, opts) {
|
|
20
|
-
opts = opts || {};
|
|
21
|
-
const delimiter = opts.delimiter || ".";
|
|
22
|
-
const maxDepth = opts.maxDepth;
|
|
23
|
-
const transformKey = opts.transformKey || keyIdentity;
|
|
24
|
-
const output = {};
|
|
25
|
-
function step(object, prev, currentDepth) {
|
|
26
|
-
currentDepth = currentDepth || 1;
|
|
27
|
-
Object.keys(object).forEach(function(key) {
|
|
28
|
-
const value = object[key];
|
|
29
|
-
const isarray = opts.safe && Array.isArray(value);
|
|
30
|
-
const type = Object.prototype.toString.call(value);
|
|
31
|
-
const isbuffer = isBuffer(value);
|
|
32
|
-
const isobject = type === "[object Object]" || type === "[object Array]";
|
|
33
|
-
const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
|
|
34
|
-
if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) return step(value, newKey, currentDepth + 1);
|
|
35
|
-
output[newKey] = value;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
step(target);
|
|
39
|
-
return output;
|
|
40
|
-
}
|
|
41
|
-
function unflatten(target, opts) {
|
|
42
|
-
opts = opts || {};
|
|
43
|
-
const delimiter = opts.delimiter || ".";
|
|
44
|
-
const overwrite = opts.overwrite || false;
|
|
45
|
-
const transformKey = opts.transformKey || keyIdentity;
|
|
46
|
-
const result = {};
|
|
47
|
-
if (isBuffer(target) || Object.prototype.toString.call(target) !== "[object Object]") return target;
|
|
48
|
-
function getkey(key) {
|
|
49
|
-
const parsedKey = Number(key);
|
|
50
|
-
return isNaN(parsedKey) || key.indexOf(".") !== -1 || opts.object ? key : parsedKey;
|
|
51
|
-
}
|
|
52
|
-
function addKeys(keyPrefix, recipient, target) {
|
|
53
|
-
return Object.keys(target).reduce(function(result, key) {
|
|
54
|
-
result[keyPrefix + delimiter + key] = target[key];
|
|
55
|
-
return result;
|
|
56
|
-
}, recipient);
|
|
57
|
-
}
|
|
58
|
-
function isEmpty(val) {
|
|
59
|
-
const type = Object.prototype.toString.call(val);
|
|
60
|
-
const isArray = type === "[object Array]";
|
|
61
|
-
const isObject = type === "[object Object]";
|
|
62
|
-
if (!val) return true;
|
|
63
|
-
else if (isArray) return !val.length;
|
|
64
|
-
else if (isObject) return !Object.keys(val).length;
|
|
65
|
-
}
|
|
66
|
-
target = Object.keys(target).reduce(function(result, key) {
|
|
67
|
-
const type = Object.prototype.toString.call(target[key]);
|
|
68
|
-
if (!(type === "[object Object]" || type === "[object Array]") || isEmpty(target[key])) {
|
|
69
|
-
result[key] = target[key];
|
|
70
|
-
return result;
|
|
71
|
-
} else return addKeys(key, result, flatten(target[key], opts));
|
|
72
|
-
}, {});
|
|
73
|
-
Object.keys(target).forEach(function(key) {
|
|
74
|
-
const split = key.split(delimiter).map(transformKey);
|
|
75
|
-
let key1 = getkey(split.shift());
|
|
76
|
-
let key2 = getkey(split[0]);
|
|
77
|
-
let recipient = result;
|
|
78
|
-
while (key2 !== void 0) {
|
|
79
|
-
if (key1 === "__proto__") return;
|
|
80
|
-
const type = Object.prototype.toString.call(recipient[key1]);
|
|
81
|
-
const isobject = type === "[object Object]" || type === "[object Array]";
|
|
82
|
-
if (!overwrite && !isobject && typeof recipient[key1] !== "undefined") return;
|
|
83
|
-
if (overwrite && !isobject || !overwrite && recipient[key1] == null) recipient[key1] = typeof key2 === "number" && !opts.object ? [] : {};
|
|
84
|
-
recipient = recipient[key1];
|
|
85
|
-
if (split.length > 0) {
|
|
86
|
-
key1 = getkey(split.shift());
|
|
87
|
-
key2 = getkey(split[0]);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
recipient[key1] = unflatten(target[key], opts);
|
|
91
|
-
});
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region ../../node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs
|
|
96
|
-
const suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/;
|
|
97
|
-
const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
98
|
-
const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
99
|
-
function jsonParseTransform(key, value) {
|
|
100
|
-
if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) {
|
|
101
|
-
warnKeyDropped(key);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
return value;
|
|
105
|
-
}
|
|
106
|
-
function warnKeyDropped(key) {
|
|
107
|
-
console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`);
|
|
108
|
-
}
|
|
109
|
-
function destr(value, options = {}) {
|
|
110
|
-
if (typeof value !== "string") return value;
|
|
111
|
-
if (value[0] === "\"" && value[value.length - 1] === "\"" && value.indexOf("\\") === -1) return value.slice(1, -1);
|
|
112
|
-
const _value = value.trim();
|
|
113
|
-
if (_value.length <= 9) switch (_value.toLowerCase()) {
|
|
114
|
-
case "true": return true;
|
|
115
|
-
case "false": return false;
|
|
116
|
-
case "undefined": return;
|
|
117
|
-
case "null": return null;
|
|
118
|
-
case "nan": return NaN;
|
|
119
|
-
case "infinity": return Number.POSITIVE_INFINITY;
|
|
120
|
-
case "-infinity": return Number.NEGATIVE_INFINITY;
|
|
121
|
-
}
|
|
122
|
-
if (!JsonSigRx.test(value)) {
|
|
123
|
-
if (options.strict) throw new SyntaxError("[destr] Invalid JSON");
|
|
124
|
-
return value;
|
|
125
|
-
}
|
|
126
|
-
try {
|
|
127
|
-
if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) {
|
|
128
|
-
if (options.strict) throw new Error("[destr] Possible prototype pollution");
|
|
129
|
-
return JSON.parse(value, jsonParseTransform);
|
|
130
|
-
}
|
|
131
|
-
return JSON.parse(value);
|
|
132
|
-
} catch (error) {
|
|
133
|
-
if (options.strict) throw error;
|
|
134
|
-
return value;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
//#endregion
|
|
138
|
-
//#region ../../node_modules/.pnpm/defu@6.1.7/node_modules/defu/dist/defu.mjs
|
|
139
|
-
function isPlainObject(value) {
|
|
140
|
-
if (value === null || typeof value !== "object") return false;
|
|
141
|
-
const prototype = Object.getPrototypeOf(value);
|
|
142
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
143
|
-
if (Symbol.iterator in value) return false;
|
|
144
|
-
if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
148
|
-
if (!isPlainObject(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
149
|
-
const object = { ...defaults };
|
|
150
|
-
for (const key of Object.keys(baseObject)) {
|
|
151
|
-
if (key === "__proto__" || key === "constructor") continue;
|
|
152
|
-
const value = baseObject[key];
|
|
153
|
-
if (value === null || value === void 0) continue;
|
|
154
|
-
if (merger && merger(object, key, value, namespace)) continue;
|
|
155
|
-
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
156
|
-
else if (isPlainObject(value) && isPlainObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
157
|
-
else object[key] = value;
|
|
158
|
-
}
|
|
159
|
-
return object;
|
|
160
|
-
}
|
|
161
|
-
function createDefu(merger) {
|
|
162
|
-
return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
|
|
163
|
-
}
|
|
164
|
-
const defu = createDefu();
|
|
165
|
-
//#endregion
|
|
166
|
-
//#region ../../node_modules/.pnpm/rc9@3.1.0/node_modules/rc9/dist/index.mjs
|
|
167
|
-
const RE_KEY_VAL = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/;
|
|
168
|
-
const RE_LINES = /\n|\r|\r\n/;
|
|
169
|
-
const defaults = {
|
|
170
|
-
name: ".conf",
|
|
171
|
-
dir: process.cwd(),
|
|
172
|
-
flat: false
|
|
173
|
-
};
|
|
174
|
-
function withDefaults(options) {
|
|
175
|
-
if (typeof options === "string") options = { name: options };
|
|
176
|
-
return {
|
|
177
|
-
...defaults,
|
|
178
|
-
...options
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
function parse$1(contents, options = {}) {
|
|
182
|
-
const config = {};
|
|
183
|
-
const lines = contents.split(RE_LINES);
|
|
184
|
-
for (const line of lines) {
|
|
185
|
-
const match = line.match(RE_KEY_VAL);
|
|
186
|
-
if (!match) continue;
|
|
187
|
-
const key = match[1];
|
|
188
|
-
if (!key || key === "__proto__" || key === "constructor") continue;
|
|
189
|
-
const value = destr((match[2] || "").trim());
|
|
190
|
-
if (key.endsWith("[]")) {
|
|
191
|
-
const nkey = key.slice(0, Math.max(0, key.length - 2));
|
|
192
|
-
config[nkey] = (config[nkey] || []).concat(value);
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
config[key] = value;
|
|
196
|
-
}
|
|
197
|
-
return options.flat ? config : unflatten(config, { overwrite: true });
|
|
198
|
-
}
|
|
199
|
-
function parseFile(path, options) {
|
|
200
|
-
if (!existsSync(path)) return {};
|
|
201
|
-
return parse$1(readFileSync(path, "utf8"), options);
|
|
202
|
-
}
|
|
203
|
-
function read(options) {
|
|
204
|
-
options = withDefaults(options);
|
|
205
|
-
return parseFile(resolve(options.dir, options.name), options);
|
|
206
|
-
}
|
|
207
|
-
function userConfigDir() {
|
|
208
|
-
return process.env.XDG_CONFIG_HOME || resolve(homedir(), ".config");
|
|
209
|
-
}
|
|
210
|
-
function readUserConfig(options) {
|
|
211
|
-
options = withDefaults(options);
|
|
212
|
-
options.dir = userConfigDir();
|
|
213
|
-
return read(options);
|
|
214
|
-
}
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region ../../node_modules/.pnpm/c12@4.0.0-rc.2_dotenv@17.4.2_jiti@2.7.0_magicast@0.5.5/node_modules/c12/dist/index.mjs
|
|
217
|
-
async function setupDotenv(options) {
|
|
218
|
-
const targetEnvironment = options.env ?? process.env;
|
|
219
|
-
const environment = await loadDotenv({
|
|
220
|
-
cwd: options.cwd,
|
|
221
|
-
fileName: options.fileName ?? ".env",
|
|
222
|
-
env: targetEnvironment,
|
|
223
|
-
interpolate: options.interpolate ?? true,
|
|
224
|
-
expandFileReferences: options.expandFileReferences ?? false,
|
|
225
|
-
parse: options.parse
|
|
226
|
-
});
|
|
227
|
-
const dotenvVars = getDotEnvVars(targetEnvironment);
|
|
228
|
-
for (const key in environment) {
|
|
229
|
-
if (key.startsWith("_")) continue;
|
|
230
|
-
if (targetEnvironment[key] === void 0 || dotenvVars.has(key)) targetEnvironment[key] = environment[key];
|
|
231
|
-
}
|
|
232
|
-
return environment;
|
|
233
|
-
}
|
|
234
|
-
async function loadDotenv(options) {
|
|
235
|
-
const environment = Object.create(null);
|
|
236
|
-
const cwd = resolve$1(options.cwd || ".");
|
|
237
|
-
const _fileName = options.fileName || ".env";
|
|
238
|
-
const dotenvFiles = typeof _fileName === "string" ? [_fileName] : _fileName;
|
|
239
|
-
const dotenvVars = getDotEnvVars(options.env || {});
|
|
240
|
-
Object.assign(environment, options.env);
|
|
241
|
-
for (const file of dotenvFiles) {
|
|
242
|
-
const dotenvFile = resolve$1(cwd, file);
|
|
243
|
-
if (!statSync(dotenvFile, { throwIfNoEntry: false })?.isFile()) continue;
|
|
244
|
-
const parsed = await readEnvFile(dotenvFile, options.parse);
|
|
245
|
-
for (const key in parsed) {
|
|
246
|
-
if (key in environment && !dotenvVars.has(key)) continue;
|
|
247
|
-
environment[key] = parsed[key];
|
|
248
|
-
dotenvVars.add(key);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
if (options.expandFileReferences) {
|
|
252
|
-
for (const key in environment) if (key.endsWith("_FILE")) {
|
|
253
|
-
const targetKey = key.slice(0, -5);
|
|
254
|
-
if (environment[targetKey] === void 0) {
|
|
255
|
-
const filePath = environment[key];
|
|
256
|
-
if (filePath && statSync(filePath, { throwIfNoEntry: false })?.isFile()) {
|
|
257
|
-
environment[targetKey] = readFileSync(filePath, "utf8").trim();
|
|
258
|
-
dotenvVars.add(targetKey);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
if (options.interpolate) interpolate(environment);
|
|
264
|
-
return environment;
|
|
265
|
-
}
|
|
266
|
-
let _parseEnv = nodeUtil.parseEnv;
|
|
267
|
-
async function readEnvFile(path, parse) {
|
|
268
|
-
const src = readFileSync(path, "utf8");
|
|
269
|
-
if (parse) return parse(src);
|
|
270
|
-
if (!_parseEnv) try {
|
|
271
|
-
const dotenv = await import("dotenv");
|
|
272
|
-
_parseEnv = (src) => dotenv.parse(src);
|
|
273
|
-
} catch {
|
|
274
|
-
throw new Error("Failed to parse .env file: `node:util.parseEnv` is not available and `dotenv` package is not installed. Please upgrade your runtime, install `dotenv` as a dependency or provide a custom `parse` option.");
|
|
275
|
-
}
|
|
276
|
-
return _parseEnv(src);
|
|
277
|
-
}
|
|
278
|
-
function interpolate(target, source = {}, parse = (v) => v) {
|
|
279
|
-
function getValue(key) {
|
|
280
|
-
return source[key] === void 0 ? target[key] : source[key];
|
|
281
|
-
}
|
|
282
|
-
function interpolate(value, parents = []) {
|
|
283
|
-
if (typeof value !== "string") return value;
|
|
284
|
-
let result = "";
|
|
285
|
-
let index = 0;
|
|
286
|
-
while (index < value.length) {
|
|
287
|
-
const char = value[index];
|
|
288
|
-
if (char === "\\" && value[index + 1] === "$") {
|
|
289
|
-
result += "$";
|
|
290
|
-
index += 2;
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
293
|
-
const ref = char === "$" ? parseRef(value, index) : void 0;
|
|
294
|
-
if (!ref) {
|
|
295
|
-
result += char;
|
|
296
|
-
index++;
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
299
|
-
if (parents.includes(ref.key)) {
|
|
300
|
-
if (ref.defaultValue !== void 0) {
|
|
301
|
-
result += interpolate(ref.defaultValue, parents);
|
|
302
|
-
index = ref.end;
|
|
303
|
-
continue;
|
|
304
|
-
}
|
|
305
|
-
console.warn(`Please avoid recursive environment variables ( loop: ${parents.join(" > ")} > ${ref.key} )`);
|
|
306
|
-
return "";
|
|
307
|
-
}
|
|
308
|
-
let resolved = interpolate(getValue(ref.key), [...parents, ref.key]);
|
|
309
|
-
if (ref.defaultValue !== void 0 && (resolved === void 0 || ref.operator === ":-" && resolved === "")) resolved = interpolate(ref.defaultValue, parents);
|
|
310
|
-
result += resolved === void 0 ? value.slice(index, ref.end) : resolved;
|
|
311
|
-
index = ref.end;
|
|
312
|
-
}
|
|
313
|
-
return parse(result);
|
|
314
|
-
}
|
|
315
|
-
for (const key in target) target[key] = interpolate(getValue(key));
|
|
316
|
-
}
|
|
317
|
-
const REF_NAME_RE = /\w+/y;
|
|
318
|
-
const BRACED_REF_NAME_RE = /[\w:]+/y;
|
|
319
|
-
function parseRef(input, start) {
|
|
320
|
-
let index = start + 1;
|
|
321
|
-
const braced = input[index] === "{";
|
|
322
|
-
if (braced) index++;
|
|
323
|
-
const nameRe = braced ? BRACED_REF_NAME_RE : REF_NAME_RE;
|
|
324
|
-
nameRe.lastIndex = index;
|
|
325
|
-
const name = nameRe.exec(input);
|
|
326
|
-
if (!name) return;
|
|
327
|
-
let key = name[0];
|
|
328
|
-
index = nameRe.lastIndex;
|
|
329
|
-
if (!braced) return {
|
|
330
|
-
key,
|
|
331
|
-
end: index
|
|
332
|
-
};
|
|
333
|
-
if (input[index] === "}") return {
|
|
334
|
-
key,
|
|
335
|
-
end: index + 1
|
|
336
|
-
};
|
|
337
|
-
if (input[index] === "-") {
|
|
338
|
-
let operator = "-";
|
|
339
|
-
if (key.endsWith(":")) {
|
|
340
|
-
key = key.slice(0, -1);
|
|
341
|
-
operator = ":-";
|
|
342
|
-
}
|
|
343
|
-
const defaultValue = key ? readDefault(input, index + 1) : void 0;
|
|
344
|
-
if (!defaultValue) return;
|
|
345
|
-
return {
|
|
346
|
-
key,
|
|
347
|
-
operator,
|
|
348
|
-
defaultValue: defaultValue.value,
|
|
349
|
-
end: defaultValue.end
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
return {
|
|
353
|
-
key,
|
|
354
|
-
end: index
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
function readDefault(input, start) {
|
|
358
|
-
let value = "";
|
|
359
|
-
let depth = 1;
|
|
360
|
-
for (let index = start; index < input.length; index++) {
|
|
361
|
-
const char = input[index];
|
|
362
|
-
if (char === "\\" && index + 1 < input.length) {
|
|
363
|
-
const next = input[index + 1];
|
|
364
|
-
value += next === "{" || next === "}" ? next : char + next;
|
|
365
|
-
index++;
|
|
366
|
-
continue;
|
|
367
|
-
}
|
|
368
|
-
if (char === "$" && input[index + 1] === "{") {
|
|
369
|
-
depth++;
|
|
370
|
-
value += "${";
|
|
371
|
-
index++;
|
|
372
|
-
continue;
|
|
373
|
-
}
|
|
374
|
-
if (char === "{") depth++;
|
|
375
|
-
if (char === "}") {
|
|
376
|
-
depth--;
|
|
377
|
-
if (depth === 0) return {
|
|
378
|
-
value,
|
|
379
|
-
end: index + 1
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
value += char;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
function getDotEnvVars(targetEnvironment) {
|
|
386
|
-
const globalRegistry = globalThis.__c12_dotenv_vars__ ||= /* @__PURE__ */ new Map();
|
|
387
|
-
if (!globalRegistry.has(targetEnvironment)) globalRegistry.set(targetEnvironment, /* @__PURE__ */ new Set());
|
|
388
|
-
return globalRegistry.get(targetEnvironment);
|
|
389
|
-
}
|
|
390
|
-
const _normalize = (p) => p?.replace(/\\/g, "/");
|
|
391
|
-
let importCounter = 0;
|
|
392
|
-
const ASYNC_LOADERS = {
|
|
393
|
-
".json": () => JSON.parse,
|
|
394
|
-
".yaml": () => import("./yaml-CYCbJ6et.js").then((r) => r.parseYAML),
|
|
395
|
-
".yml": () => import("./yaml-CYCbJ6et.js").then((r) => r.parseYAML),
|
|
396
|
-
".jsonc": () => import("./jsonc-BUniUpOk.js").then((r) => (source) => r.parseJSONC(source, { allowTrailingComma: true })),
|
|
397
|
-
".json5": () => import("./json5-ChRycquj.js").then((r) => r.parseJSON5),
|
|
398
|
-
".toml": () => import("./toml-DB-MNnFs.js").then((r) => r.parseTOML)
|
|
399
|
-
};
|
|
400
|
-
const SUPPORTED_EXTENSIONS = Object.freeze([
|
|
401
|
-
".js",
|
|
402
|
-
".ts",
|
|
403
|
-
".mjs",
|
|
404
|
-
".cjs",
|
|
405
|
-
".mts",
|
|
406
|
-
".cts",
|
|
407
|
-
".json",
|
|
408
|
-
".jsonc",
|
|
409
|
-
".json5",
|
|
410
|
-
".yaml",
|
|
411
|
-
".yml",
|
|
412
|
-
".toml"
|
|
413
|
-
]);
|
|
414
|
-
async function loadConfig$1(options) {
|
|
415
|
-
options.cwd = resolve$1(process.cwd(), options.cwd || ".");
|
|
416
|
-
options.name = options.name || "config";
|
|
417
|
-
options.envName = options.envName ?? process.env.NODE_ENV;
|
|
418
|
-
options.configFile = options.configFile ?? (options.name === "config" ? "config" : `${options.name}.config`);
|
|
419
|
-
options.rcFile = options.rcFile ?? `.${options.name}rc`;
|
|
420
|
-
if (options.extend !== false) options.extend = {
|
|
421
|
-
extendKey: "extends",
|
|
422
|
-
...options.extend
|
|
423
|
-
};
|
|
424
|
-
const _merger = options.merger || defu;
|
|
425
|
-
const r = {
|
|
426
|
-
config: {},
|
|
427
|
-
cwd: options.cwd,
|
|
428
|
-
configFile: resolve$1(options.cwd, options.configFile),
|
|
429
|
-
layers: [],
|
|
430
|
-
_configFile: void 0
|
|
431
|
-
};
|
|
432
|
-
const rawConfigs = {
|
|
433
|
-
overrides: options.overrides,
|
|
434
|
-
main: void 0,
|
|
435
|
-
rc: void 0,
|
|
436
|
-
packageJson: void 0,
|
|
437
|
-
defaultConfig: options.defaultConfig
|
|
438
|
-
};
|
|
439
|
-
if (options.dotenv) await setupDotenv({
|
|
440
|
-
cwd: options.cwd,
|
|
441
|
-
...options.dotenv === true ? {} : options.dotenv
|
|
442
|
-
});
|
|
443
|
-
const _mainConfig = await resolveConfig$1(".", options);
|
|
444
|
-
if (_mainConfig.configFile) {
|
|
445
|
-
rawConfigs.main = _mainConfig.config;
|
|
446
|
-
r.configFile = _mainConfig.configFile;
|
|
447
|
-
r._configFile = _mainConfig._configFile;
|
|
448
|
-
}
|
|
449
|
-
if (_mainConfig.meta) r.meta = _mainConfig.meta;
|
|
450
|
-
if (options.rcFile) {
|
|
451
|
-
const rcSources = [];
|
|
452
|
-
rcSources.push(read({
|
|
453
|
-
name: options.rcFile,
|
|
454
|
-
dir: options.cwd
|
|
455
|
-
}));
|
|
456
|
-
if (options.globalRc) {
|
|
457
|
-
const { findWorkspaceDir } = await import("./dist-DreZ24Sz.js");
|
|
458
|
-
const workspaceDir = await findWorkspaceDir(options.cwd).catch(() => {});
|
|
459
|
-
if (workspaceDir) rcSources.push(read({
|
|
460
|
-
name: options.rcFile,
|
|
461
|
-
dir: workspaceDir
|
|
462
|
-
}));
|
|
463
|
-
rcSources.push(readUserConfig({ name: options.rcFile }));
|
|
464
|
-
rcSources.push(read({
|
|
465
|
-
name: options.rcFile,
|
|
466
|
-
dir: homedir()
|
|
467
|
-
}));
|
|
468
|
-
}
|
|
469
|
-
rawConfigs.rc = _merger({}, ...rcSources);
|
|
470
|
-
}
|
|
471
|
-
if (options.packageJson) {
|
|
472
|
-
const keys = (Array.isArray(options.packageJson) ? options.packageJson : [typeof options.packageJson === "string" ? options.packageJson : options.name]).filter((t) => t && typeof t === "string");
|
|
473
|
-
const { readPackageJSON } = await import("./dist-DreZ24Sz.js");
|
|
474
|
-
const pkgJsonFile = await readPackageJSON(options.cwd).catch(() => {});
|
|
475
|
-
rawConfigs.packageJson = _merger({}, ...keys.map((key) => pkgJsonFile?.[key]));
|
|
476
|
-
}
|
|
477
|
-
const configs = {};
|
|
478
|
-
for (const key in rawConfigs) {
|
|
479
|
-
const value = rawConfigs[key];
|
|
480
|
-
configs[key] = await (typeof value === "function" ? value({
|
|
481
|
-
configs,
|
|
482
|
-
rawConfigs
|
|
483
|
-
}) : value);
|
|
484
|
-
}
|
|
485
|
-
if (Array.isArray(configs.main)) r.config = configs.main;
|
|
486
|
-
else {
|
|
487
|
-
r.config = _merger(configs.overrides, configs.main, configs.rc, configs.packageJson, configs.defaultConfig);
|
|
488
|
-
if (options.extend) {
|
|
489
|
-
await extendConfig(r.config, options);
|
|
490
|
-
r.layers = r.config._layers;
|
|
491
|
-
delete r.config._layers;
|
|
492
|
-
r.config = _merger(r.config, ...r.layers.map((e) => e.config));
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
r.layers = [...[
|
|
496
|
-
configs.overrides && {
|
|
497
|
-
config: configs.overrides,
|
|
498
|
-
configFile: void 0,
|
|
499
|
-
cwd: void 0
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
config: configs.main,
|
|
503
|
-
configFile: options.configFile,
|
|
504
|
-
cwd: options.cwd
|
|
505
|
-
},
|
|
506
|
-
configs.rc && {
|
|
507
|
-
config: configs.rc,
|
|
508
|
-
configFile: options.rcFile
|
|
509
|
-
},
|
|
510
|
-
configs.packageJson && {
|
|
511
|
-
config: configs.packageJson,
|
|
512
|
-
configFile: "package.json"
|
|
513
|
-
}
|
|
514
|
-
].filter((l) => l && l.config), ...r.layers];
|
|
515
|
-
if (options.defaults) r.config = _merger(r.config, options.defaults);
|
|
516
|
-
if (options.omit$Keys) {
|
|
517
|
-
for (const key in r.config) if (key.startsWith("$")) delete r.config[key];
|
|
518
|
-
}
|
|
519
|
-
if (options.configFileRequired && !r._configFile) throw new Error(`Required config (${r.configFile}) cannot be resolved.`);
|
|
520
|
-
if (options.schema != null) r.config = await validateConfig(r.config, options.schema);
|
|
521
|
-
return r;
|
|
522
|
-
}
|
|
523
|
-
async function extendConfig(config, options) {
|
|
524
|
-
config._layers = config._layers || [];
|
|
525
|
-
if (!options.extend) return;
|
|
526
|
-
let keys = options.extend.extendKey;
|
|
527
|
-
if (typeof keys === "string") keys = [keys];
|
|
528
|
-
const extendSources = [];
|
|
529
|
-
for (const key of keys) {
|
|
530
|
-
extendSources.push(...(Array.isArray(config[key]) ? config[key] : [config[key]]).filter(Boolean));
|
|
531
|
-
delete config[key];
|
|
532
|
-
}
|
|
533
|
-
for (let extendSource of extendSources) {
|
|
534
|
-
const originalExtendSource = extendSource;
|
|
535
|
-
let sourceOptions = {};
|
|
536
|
-
if (extendSource.source) {
|
|
537
|
-
sourceOptions = extendSource.options || {};
|
|
538
|
-
extendSource = extendSource.source;
|
|
539
|
-
}
|
|
540
|
-
if (Array.isArray(extendSource)) {
|
|
541
|
-
sourceOptions = extendSource[1] || {};
|
|
542
|
-
extendSource = extendSource[0];
|
|
543
|
-
}
|
|
544
|
-
if (typeof extendSource !== "string") {
|
|
545
|
-
console.warn(`Cannot extend config from \`${JSON.stringify(originalExtendSource)}\` in ${options.cwd}`);
|
|
546
|
-
continue;
|
|
547
|
-
}
|
|
548
|
-
const _config = await resolveConfig$1(extendSource, options, sourceOptions);
|
|
549
|
-
if (!_config.config) {
|
|
550
|
-
console.warn(`Cannot extend config from \`${extendSource}\` in ${options.cwd}`);
|
|
551
|
-
continue;
|
|
552
|
-
}
|
|
553
|
-
await extendConfig(_config.config, {
|
|
554
|
-
...options,
|
|
555
|
-
cwd: _config.cwd
|
|
556
|
-
});
|
|
557
|
-
config._layers.push(_config);
|
|
558
|
-
if (_config.config._layers) {
|
|
559
|
-
config._layers.push(..._config.config._layers);
|
|
560
|
-
delete _config.config._layers;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
const GIGET_PREFIXES = [
|
|
565
|
-
"gh:",
|
|
566
|
-
"github:",
|
|
567
|
-
"gitlab:",
|
|
568
|
-
"bitbucket:",
|
|
569
|
-
"https://",
|
|
570
|
-
"http://"
|
|
571
|
-
];
|
|
572
|
-
const NPM_PACKAGE_RE = /^(@[\da-z~-][\d._a-z~-]*\/)?[\da-z~-][\d._a-z~-]*($|\/.*)/;
|
|
573
|
-
async function resolveConfig$1(source, options, sourceOptions = {}) {
|
|
574
|
-
if (options.resolve) {
|
|
575
|
-
const res = await options.resolve(source, options);
|
|
576
|
-
if (res) return res;
|
|
577
|
-
}
|
|
578
|
-
const _merger = options.merger || defu;
|
|
579
|
-
const customProviderKeys = Object.keys(sourceOptions.giget?.providers || {}).map((key) => `${key}:`);
|
|
580
|
-
const gigetPrefixes = customProviderKeys.length > 0 ? [.../* @__PURE__ */ new Set([...customProviderKeys, ...GIGET_PREFIXES])] : GIGET_PREFIXES;
|
|
581
|
-
if (options.giget !== false && gigetPrefixes.some((prefix) => source.startsWith(prefix))) {
|
|
582
|
-
const { downloadTemplate } = await import("giget").catch((error) => {
|
|
583
|
-
throw new Error(`Extending config from \`${source}\` requires \`giget\` peer dependency to be installed.\n\nInstall it with: \`npx nypm i giget\``, { cause: error });
|
|
584
|
-
});
|
|
585
|
-
const { digest } = await import("./ohash-D7bG_EOb.js").then((n) => n.dist_exports);
|
|
586
|
-
const cloneName = source.replace(/\W+/g, "_").split("_").splice(0, 3).join("_") + "_" + digest(source).slice(0, 10).replace(/[-_]/g, "");
|
|
587
|
-
let cloneDir;
|
|
588
|
-
const localNodeModules = resolve$1(options.cwd, "node_modules");
|
|
589
|
-
const parentDir = dirname$1(options.cwd);
|
|
590
|
-
if (basename$1(parentDir) === ".c12") cloneDir = join$1(parentDir, cloneName);
|
|
591
|
-
else if (existsSync(localNodeModules)) cloneDir = join$1(localNodeModules, ".c12", cloneName);
|
|
592
|
-
else cloneDir = process.env.XDG_CACHE_HOME ? resolve$1(process.env.XDG_CACHE_HOME, "c12", cloneName) : resolve$1(homedir(), ".cache/c12", cloneName);
|
|
593
|
-
const install = sourceOptions.install ? defu(sourceOptions.install === true ? {} : sourceOptions.install, { ignoreWorkspace: true }) : false;
|
|
594
|
-
if (existsSync(cloneDir) && !install) await rm(cloneDir, { recursive: true });
|
|
595
|
-
source = (await downloadTemplate(source, {
|
|
596
|
-
dir: cloneDir,
|
|
597
|
-
install,
|
|
598
|
-
force: Boolean(install),
|
|
599
|
-
auth: sourceOptions.auth,
|
|
600
|
-
...options.giget,
|
|
601
|
-
...sourceOptions.giget
|
|
602
|
-
})).dir;
|
|
603
|
-
}
|
|
604
|
-
if (NPM_PACKAGE_RE.test(source)) source = tryResolve(source, options) || source;
|
|
605
|
-
const ext = extname$1(source);
|
|
606
|
-
const isDir = _isDirectory(resolve$1(options.cwd, source)) ?? (!ext || ext === basename$1(source));
|
|
607
|
-
const cwd = resolve$1(options.cwd, isDir ? source : dirname$1(source));
|
|
608
|
-
if (isDir) source = options.configFile;
|
|
609
|
-
const res = {
|
|
610
|
-
config: void 0,
|
|
611
|
-
configFile: void 0,
|
|
612
|
-
cwd,
|
|
613
|
-
source,
|
|
614
|
-
sourceOptions
|
|
615
|
-
};
|
|
616
|
-
res.configFile = tryResolve(resolve$1(cwd, source), options) || tryResolve(resolve$1(cwd, ".config", source.replace(/\.config$/, "")), options) || tryResolve(resolve$1(cwd, ".config", source), options) || source;
|
|
617
|
-
if (!existsSync(res.configFile)) return res;
|
|
618
|
-
res._configFile = res.configFile;
|
|
619
|
-
const configFileExt = extname$1(res.configFile) || "";
|
|
620
|
-
if (configFileExt in ASYNC_LOADERS) res.config = (await ASYNC_LOADERS[configFileExt]())(await readFile(res.configFile, "utf8"));
|
|
621
|
-
else {
|
|
622
|
-
const _resolveModule = options.resolveModule || ((mod) => mod.default || mod);
|
|
623
|
-
if (options.import) res.config = _resolveModule(await options.import(res.configFile));
|
|
624
|
-
else {
|
|
625
|
-
const _configURL = pathToFileURL(res.configFile);
|
|
626
|
-
_configURL.search = `_${++importCounter}`;
|
|
627
|
-
res.config = await import(_configURL.href).then(_resolveModule, async (error) => {
|
|
628
|
-
const { createJiti } = await import("jiti").catch(() => {
|
|
629
|
-
throw new Error(`Failed to load config file \`${res.configFile}\`: ${error?.message}. Hint install \`jiti\` for compatibility.`, { cause: error });
|
|
630
|
-
});
|
|
631
|
-
const jiti = createJiti(join$1(options.cwd || ".", options.configFile || "/"), {
|
|
632
|
-
interopDefault: true,
|
|
633
|
-
moduleCache: false,
|
|
634
|
-
extensions: [...SUPPORTED_EXTENSIONS],
|
|
635
|
-
...options.jitiOptions
|
|
636
|
-
});
|
|
637
|
-
options.import = (id) => jiti.import(id);
|
|
638
|
-
return _resolveModule(await options.import(res.configFile));
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
if (typeof res.config === "function") res.config = await res.config(options.context);
|
|
643
|
-
if (res.config && typeof res.config === "object" && !Array.isArray(res.config) && !Object.isExtensible(res.config)) res.config = { ...res.config };
|
|
644
|
-
const envConfigs = (Array.isArray(options.envName) ? options.envName : [options.envName]).filter(Boolean).reverse().flatMap((envName) => [res.config.$env?.[envName], res.config["$" + envName]]).filter((c) => c && Object.keys(c).length > 0);
|
|
645
|
-
if (envConfigs.length > 0) res.config = (options.envMerger || _merger)({}, ...envConfigs, res.config);
|
|
646
|
-
res.meta = defu(res.sourceOptions.meta, res.config.$meta);
|
|
647
|
-
delete res.config.$meta;
|
|
648
|
-
if (res.sourceOptions.overrides) res.config = _merger(res.sourceOptions.overrides, res.config);
|
|
649
|
-
res.configFile = _normalize(res.configFile);
|
|
650
|
-
res.source = _normalize(res.source);
|
|
651
|
-
return res;
|
|
652
|
-
}
|
|
653
|
-
async function validateConfig(config, schema) {
|
|
654
|
-
if (typeof schema?.["~standard"]?.validate !== "function") throw new TypeError("Invalid `schema` option: expected a Standard Schema (https://standardschema.dev).");
|
|
655
|
-
const result = await schema["~standard"].validate(config);
|
|
656
|
-
if (result.issues) {
|
|
657
|
-
const messages = result.issues.map((issue) => {
|
|
658
|
-
const path = issue.path?.map((p) => String(typeof p === "object" ? p.key : p)).join(".");
|
|
659
|
-
return ` - ${path ? `${path}: ` : ""}${issue.message}`;
|
|
660
|
-
});
|
|
661
|
-
throw new Error(`Config validation failed (${schema["~standard"].vendor}):\n${messages.join("\n")}`, { cause: result.issues });
|
|
662
|
-
}
|
|
663
|
-
return result.value;
|
|
664
|
-
}
|
|
665
|
-
function tryResolve(id, options) {
|
|
666
|
-
const res = resolveModulePath(id, {
|
|
667
|
-
try: true,
|
|
668
|
-
from: pathToFileURL(join$1(options.cwd || ".", options.configFile || "/")),
|
|
669
|
-
suffixes: ["", "/index"],
|
|
670
|
-
extensions: SUPPORTED_EXTENSIONS,
|
|
671
|
-
cache: false
|
|
672
|
-
});
|
|
673
|
-
return res ? normalize$1(res) : void 0;
|
|
674
|
-
}
|
|
675
|
-
function _isDirectory(path) {
|
|
676
|
-
try {
|
|
677
|
-
return statSync(path).isDirectory();
|
|
678
|
-
} catch {
|
|
679
|
-
return null;
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
//#endregion
|
|
683
|
-
//#region src/cli/config-schema.ts
|
|
684
|
-
const strings = array(string());
|
|
685
|
-
const stringRecord = record(string(), string());
|
|
686
|
-
const privileges = array(picklist([
|
|
687
|
-
"select",
|
|
688
|
-
"insert",
|
|
689
|
-
"update",
|
|
690
|
-
"delete"
|
|
691
|
-
]));
|
|
692
|
-
const pluginFlag = union([boolean(), record(string(), unknown())]);
|
|
693
|
-
const isGenerator = (value) => typeof value === "object" && value !== null && "name" in value && typeof value.name === "string" && "generate" in value && typeof value.generate === "function";
|
|
694
|
-
/**
|
|
695
|
-
* The top level of `better-supabase.config.*`. It rejects unknown keys and
|
|
696
|
-
* checks the leaves a typo or an old value breaks; nested objects the
|
|
697
|
-
* library reads loosely stay loose.
|
|
698
|
-
*/
|
|
699
|
-
const kitModuleEntries = {
|
|
700
|
-
mode: optional(picklist([
|
|
701
|
-
"managed",
|
|
702
|
-
"adopt",
|
|
703
|
-
"custom"
|
|
704
|
-
])),
|
|
705
|
-
schema: optional(string()),
|
|
706
|
-
tables: optional(record(string(), nullable(string()))),
|
|
707
|
-
columns: optional(record(string(), record(string(), nullable(string())))),
|
|
708
|
-
idType: optional(string()),
|
|
709
|
-
permissions: optional(stringRecord),
|
|
710
|
-
options: optional(record(string(), unknown())),
|
|
711
|
-
hooks: optional(strictObject({
|
|
712
|
-
schema: optional(string()),
|
|
713
|
-
functions: optional(stringRecord)
|
|
714
|
-
})),
|
|
715
|
-
events: optional(boolean())
|
|
716
|
-
};
|
|
717
|
-
const accessKit = strictObject({
|
|
718
|
-
...kitModuleEntries,
|
|
719
|
-
model: optional(picklist([
|
|
720
|
-
"roles",
|
|
721
|
-
"catalog",
|
|
722
|
-
"permdock",
|
|
723
|
-
"custom"
|
|
724
|
-
])),
|
|
725
|
-
roles: optional(record(string(), strings)),
|
|
726
|
-
functions: optional(strictObject({
|
|
727
|
-
can: optional(string()),
|
|
728
|
-
tenantIdsWith: optional(string()),
|
|
729
|
-
isPlatform: optional(string()),
|
|
730
|
-
canUser: optional(string()),
|
|
731
|
-
canAssign: optional(string()),
|
|
732
|
-
permissionClaims: optional(string())
|
|
733
|
-
})),
|
|
734
|
-
platformClaim: optional(string()),
|
|
735
|
-
disabled: optional(strictObject({
|
|
736
|
-
tenant: optional(string()),
|
|
737
|
-
user: optional(string()),
|
|
738
|
-
userKey: optional(string())
|
|
739
|
-
})),
|
|
740
|
-
activeTenant: optional(union([picklist(["claim", "resolver"]), strictObject({
|
|
741
|
-
profileColumn: string(),
|
|
742
|
-
key: optional(string())
|
|
743
|
-
})])),
|
|
744
|
-
permdock: optional(strictObject({
|
|
745
|
-
schema: optional(string()),
|
|
746
|
-
scope: optional(string())
|
|
747
|
-
}))
|
|
748
|
-
});
|
|
749
|
-
const ConfigSchema = strictObject({
|
|
750
|
-
$schema: optional(string()),
|
|
751
|
-
source: optional(strictObject({
|
|
752
|
-
dbUrl: optional(string()),
|
|
753
|
-
projectRef: optional(string()),
|
|
754
|
-
accessToken: optional(string()),
|
|
755
|
-
snapshot: optional(string())
|
|
756
|
-
})),
|
|
757
|
-
schemas: optional(strings),
|
|
758
|
-
casing: optional(picklist(["snake", "camel"])),
|
|
759
|
-
tables: optional(record(string(), strictObject({
|
|
760
|
-
casing: optional(picklist(["snake", "camel"])),
|
|
761
|
-
exclude: optional(boolean()),
|
|
762
|
-
relations: optional(stringRecord)
|
|
763
|
-
}))),
|
|
764
|
-
output: optional(string()),
|
|
765
|
-
postgrestVersion: optional(string()),
|
|
766
|
-
json: optional(record(string(), unknown())),
|
|
767
|
-
codecs: optional(strictObject({
|
|
768
|
-
timestamptz: optional(picklist(["string", "instant"])),
|
|
769
|
-
int8: optional(picklist([
|
|
770
|
-
"number",
|
|
771
|
-
"string",
|
|
772
|
-
"bigint"
|
|
773
|
-
])),
|
|
774
|
-
numeric: optional(picklist(["number", "string"]))
|
|
775
|
-
})),
|
|
776
|
-
sensitive: optional(strings),
|
|
777
|
-
storagePaths: optional(stringRecord),
|
|
778
|
-
expose: optional(record(string(), union([privileges, strictObject({
|
|
779
|
-
anon: optional(privileges),
|
|
780
|
-
authenticated: optional(privileges)
|
|
781
|
-
})]))),
|
|
782
|
-
readSets: optional(strings),
|
|
783
|
-
generators: optional(array(custom(isGenerator, "must be a generator: { name, generate(input) }"))),
|
|
784
|
-
plugins: optional(strictObject({
|
|
785
|
-
timestamps: optional(pluginFlag),
|
|
786
|
-
softDelete: optional(pluginFlag),
|
|
787
|
-
tenant: optional(pluginFlag),
|
|
788
|
-
actor: optional(pluginFlag)
|
|
789
|
-
})),
|
|
790
|
-
claims: optional(strictObject({
|
|
791
|
-
tenant: optional(string()),
|
|
792
|
-
scope: optional(string()),
|
|
793
|
-
features: optional(string())
|
|
794
|
-
})),
|
|
795
|
-
buckets: optional(record(string(), record(string(), unknown()))),
|
|
796
|
-
topics: optional(stringRecord),
|
|
797
|
-
realtime: optional(strictObject({
|
|
798
|
-
tables: optional(strings),
|
|
799
|
-
global: optional(strings)
|
|
800
|
-
})),
|
|
801
|
-
entitlements: optional(strictObject({
|
|
802
|
-
customer: optional(string()),
|
|
803
|
-
key: optional(string()),
|
|
804
|
-
permdock: optional(union([literal(false), strictObject({ scope: optional(string()) })]))
|
|
805
|
-
})),
|
|
806
|
-
permdock: optional(strictObject({
|
|
807
|
-
manifest: optional(string()),
|
|
808
|
-
catalog: optional(string())
|
|
809
|
-
})),
|
|
810
|
-
vectorSearch: optional(record(string(), union([string(), strictObject({
|
|
811
|
-
column: string(),
|
|
812
|
-
distance: optional(picklist([
|
|
813
|
-
"cosine",
|
|
814
|
-
"l2",
|
|
815
|
-
"inner_product"
|
|
816
|
-
]))
|
|
817
|
-
})]))),
|
|
818
|
-
sql: optional(strictObject({
|
|
819
|
-
dir: optional(string()),
|
|
820
|
-
prefix: optional(string()),
|
|
821
|
-
testsDir: optional(string()),
|
|
822
|
-
kit: optional(strings)
|
|
823
|
-
})),
|
|
824
|
-
kits: optional(objectWithRest({ access: optional(accessKit) }, strictObject(kitModuleEntries))),
|
|
825
|
-
seed: optional(strictObject({
|
|
826
|
-
entry: optional(string()),
|
|
827
|
-
output: optional(string())
|
|
828
|
-
})),
|
|
829
|
-
openapi: optional(strictObject({
|
|
830
|
-
entry: optional(string()),
|
|
831
|
-
output: optional(string())
|
|
832
|
-
})),
|
|
833
|
-
doctor: optional(strictObject({
|
|
834
|
-
ignore: optional(strings),
|
|
835
|
-
strict: optional(boolean()),
|
|
836
|
-
sources: optional(strings),
|
|
837
|
-
policyHelperLimit: optional(number()),
|
|
838
|
-
claimsLimit: optional(number())
|
|
839
|
-
}))
|
|
840
|
-
});
|
|
841
|
-
/** Each issue as `path: message`, the path in config keys. */
|
|
842
|
-
function configIssues(value) {
|
|
843
|
-
const result = safeParse(ConfigSchema, value);
|
|
844
|
-
if (result.success) return [];
|
|
845
|
-
return result.issues.map((issue) => {
|
|
846
|
-
const path = getDotPath(issue);
|
|
847
|
-
return path ? `${path}: ${issue.message}` : issue.message;
|
|
848
|
-
});
|
|
849
|
-
}
|
|
850
|
-
//#endregion
|
|
1
|
+
import { dirname, join, posix, relative } from "node:path";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { glob, readFile } from "node:fs/promises";
|
|
851
4
|
//#region ../../node_modules/.pnpm/smol-toml@1.9.0/node_modules/smol-toml/dist/error.js
|
|
852
5
|
/*!
|
|
853
6
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
@@ -1693,6 +846,46 @@ function parse(toml, options = {}) {
|
|
|
1693
846
|
//#region src/cli/supabase-toml.ts
|
|
1694
847
|
const CONFIG_TOML = "supabase/config.toml";
|
|
1695
848
|
/**
|
|
849
|
+
* The nearest directory at or above `start` where `found` is true. The search
|
|
850
|
+
* stops after the first directory with `.git`, so a checkout never picks up a
|
|
851
|
+
* project outside it.
|
|
852
|
+
*/
|
|
853
|
+
function findUp(start, found) {
|
|
854
|
+
let dir = start;
|
|
855
|
+
for (;;) {
|
|
856
|
+
if (found(dir)) return dir;
|
|
857
|
+
const parent = dirname(dir);
|
|
858
|
+
if (parent === dir || existsSync(join(dir, ".git"))) return void 0;
|
|
859
|
+
dir = parent;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* The nearest directory at or above `start` that has `supabase/config.toml`,
|
|
864
|
+
* like the Supabase CLI's search, within the same `.git` boundary.
|
|
865
|
+
*/
|
|
866
|
+
function findSupabaseRoot(start) {
|
|
867
|
+
return findUp(start, (dir) => existsSync(join(dir, CONFIG_TOML)));
|
|
868
|
+
}
|
|
869
|
+
/** The repository root for `start`: the directory with `.git`, else the Supabase project root, else `start`. */
|
|
870
|
+
function findRepoRoot(start) {
|
|
871
|
+
let dir = start;
|
|
872
|
+
for (;;) {
|
|
873
|
+
if (existsSync(join(dir, ".git"))) return dir;
|
|
874
|
+
const parent = dirname(dir);
|
|
875
|
+
if (parent === dir) return findSupabaseRoot(start) ?? start;
|
|
876
|
+
dir = parent;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
/** The `supabase` directory relative to `root`: the one `findSupabaseRoot` finds, or `supabase`. */
|
|
880
|
+
function supabaseDir(root) {
|
|
881
|
+
const found = findSupabaseRoot(root);
|
|
882
|
+
return found === void 0 ? "supabase" : relativePath(root, join(found, "supabase"));
|
|
883
|
+
}
|
|
884
|
+
/** `path` under `from`, with forward slashes. */
|
|
885
|
+
function relativePath(from, path) {
|
|
886
|
+
return relative(from, path).replaceAll("\\", "/") || ".";
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
1696
889
|
* `@supabase/config` is an optional peer (it needs `effect` and
|
|
1697
890
|
* `@effect/platform-node`), so it is imported lazily through a variable:
|
|
1698
891
|
* projects without it get smol-toml instead of a load error.
|
|
@@ -1723,41 +916,47 @@ function parseToml(text) {
|
|
|
1723
916
|
}
|
|
1724
917
|
const parsed = /* @__PURE__ */ new Map();
|
|
1725
918
|
/**
|
|
1726
|
-
* Reads `supabase/config.toml
|
|
919
|
+
* Reads `supabase/config.toml` from `root` or the nearest parent that has
|
|
920
|
+
* one (`findSupabaseRoot`). A file with `env()` values goes through
|
|
1727
921
|
* `@supabase/config` when it is installed, which resolves them; any other
|
|
1728
922
|
* file, or a project without it, is parsed with smol-toml, since loading
|
|
1729
923
|
* `@supabase/config` costs hundreds of milliseconds. Parses are reused while
|
|
1730
924
|
* the file's text is unchanged.
|
|
1731
925
|
*/
|
|
1732
926
|
async function readSupabaseToml(root) {
|
|
1733
|
-
const
|
|
1734
|
-
if (
|
|
927
|
+
const found = findSupabaseRoot(root);
|
|
928
|
+
if (found === void 0) return void 0;
|
|
929
|
+
const absolute = join(found, CONFIG_TOML);
|
|
1735
930
|
const text = await readFile(absolute, "utf8");
|
|
1736
|
-
const
|
|
931
|
+
const key = `${root}\0${absolute}`;
|
|
932
|
+
const cached = parsed.get(key);
|
|
1737
933
|
if (cached?.text === text) return cached.toml;
|
|
1738
|
-
const toml = parseSupabaseToml(
|
|
1739
|
-
|
|
934
|
+
const toml = parseSupabaseToml(found, text, {
|
|
935
|
+
path: relativePath(root, absolute),
|
|
936
|
+
dir: relativePath(root, join(found, "supabase"))
|
|
937
|
+
});
|
|
938
|
+
parsed.set(key, {
|
|
1740
939
|
text,
|
|
1741
940
|
toml
|
|
1742
941
|
});
|
|
1743
942
|
return toml;
|
|
1744
943
|
}
|
|
1745
|
-
async function parseSupabaseToml(
|
|
944
|
+
async function parseSupabaseToml(found, text, location) {
|
|
1746
945
|
const io = text.includes("env(") ? await loadSupabaseConfig() : void 0;
|
|
1747
946
|
if (io) try {
|
|
1748
|
-
const loaded = await io.loadCliConfig(
|
|
947
|
+
const loaded = await io.loadCliConfig(found, {
|
|
1749
948
|
tomlOnly: true,
|
|
1750
949
|
search: false
|
|
1751
950
|
});
|
|
1752
951
|
if (loaded?.document) return {
|
|
1753
|
-
|
|
952
|
+
...location,
|
|
1754
953
|
text,
|
|
1755
954
|
document: loaded.document,
|
|
1756
955
|
parser: "@supabase/config"
|
|
1757
956
|
};
|
|
1758
957
|
} catch {}
|
|
1759
958
|
return {
|
|
1760
|
-
|
|
959
|
+
...location,
|
|
1761
960
|
text,
|
|
1762
961
|
document: parseToml(text),
|
|
1763
962
|
parser: "smol-toml"
|
|
@@ -1826,12 +1025,13 @@ function diffEngine(toml) {
|
|
|
1826
1025
|
]);
|
|
1827
1026
|
return enabled === true || enabled === "true" ? "pg-delta" : "migra";
|
|
1828
1027
|
}
|
|
1028
|
+
/** The `config.toml` table that turns pg-delta on. */
|
|
1029
|
+
const PGDELTA_TABLE = "[experimental.pgdelta]\nenabled = true\n";
|
|
1829
1030
|
/** The command that writes a migration (named `name`, when given) from `supabase/schemas`. */
|
|
1830
1031
|
function migrationCommand(toml, name) {
|
|
1831
1032
|
const command = diffEngine(toml) === "pg-delta" ? "supabase db schema declarative sync" : "supabase db diff";
|
|
1832
1033
|
return name === void 0 ? command : `${command} -f ${name}`;
|
|
1833
1034
|
}
|
|
1834
|
-
const SCHEMAS_DIR = "supabase/schemas";
|
|
1835
1035
|
/** `experimental.pgdelta.declarative_schema_path` (relative to `supabase/`), or `./schemas`. */
|
|
1836
1036
|
function pgDeltaSchemasDir(toml) {
|
|
1837
1037
|
const dir = tomlGet(toml?.document ?? {}, [
|
|
@@ -1839,8 +1039,12 @@ function pgDeltaSchemasDir(toml) {
|
|
|
1839
1039
|
"pgdelta",
|
|
1840
1040
|
"declarative_schema_path"
|
|
1841
1041
|
]);
|
|
1842
|
-
const
|
|
1843
|
-
return posix.join("supabase",
|
|
1042
|
+
const schemas = typeof dir === "string" && dir.trim() !== "" ? dir : "schemas";
|
|
1043
|
+
return posix.join(toml?.dir ?? "supabase", schemas.replace(/^\.\//, "").replace(/\/$/, ""));
|
|
1044
|
+
}
|
|
1045
|
+
/** The folder the diff engine loads declarative schema files from, relative to the root. */
|
|
1046
|
+
function declarativeSchemasDir(toml) {
|
|
1047
|
+
return diffEngine(toml) === "pg-delta" ? pgDeltaSchemasDir(toml) : posix.join(toml?.dir ?? "supabase", "schemas");
|
|
1844
1048
|
}
|
|
1845
1049
|
async function expand(cwd, pattern) {
|
|
1846
1050
|
const matched = [];
|
|
@@ -1864,8 +1068,9 @@ async function schemaPaths(root, toml) {
|
|
|
1864
1068
|
configured: false
|
|
1865
1069
|
};
|
|
1866
1070
|
}
|
|
1867
|
-
const
|
|
1868
|
-
const
|
|
1071
|
+
const dir = toml?.dir ?? "supabase";
|
|
1072
|
+
const supabase = join(root, dir);
|
|
1073
|
+
const all = existsSync(join(supabase, "schemas")) ? (await expand(supabase, "schemas/**/*.sql")).map((path) => posix.join(dir, path)) : [];
|
|
1869
1074
|
const entries = tomlGet(toml?.document ?? {}, [
|
|
1870
1075
|
"db",
|
|
1871
1076
|
"migrations",
|
|
@@ -1878,7 +1083,7 @@ async function schemaPaths(root, toml) {
|
|
|
1878
1083
|
configured: false
|
|
1879
1084
|
};
|
|
1880
1085
|
const listed = /* @__PURE__ */ new Set();
|
|
1881
|
-
for (const pattern of patterns) for (const path of await expand(supabase, pattern)) listed.add(posix.join(
|
|
1086
|
+
for (const pattern of patterns) for (const path of await expand(supabase, pattern)) listed.add(posix.join(dir, path));
|
|
1882
1087
|
const unlisted = all.filter((path) => !listed.has(path));
|
|
1883
1088
|
return {
|
|
1884
1089
|
files: [...listed, ...unlisted],
|
|
@@ -1887,79 +1092,4 @@ async function schemaPaths(root, toml) {
|
|
|
1887
1092
|
};
|
|
1888
1093
|
}
|
|
1889
1094
|
//#endregion
|
|
1890
|
-
|
|
1891
|
-
const CONFIG_FILES = [
|
|
1892
|
-
"better-supabase.config.ts",
|
|
1893
|
-
"better-supabase.config.mts",
|
|
1894
|
-
"better-supabase.config.js",
|
|
1895
|
-
"better-supabase.config.mjs",
|
|
1896
|
-
"better-supabase.config.json"
|
|
1897
|
-
];
|
|
1898
|
-
function findConfig(cwd, explicit) {
|
|
1899
|
-
if (explicit) return resolve(cwd, explicit);
|
|
1900
|
-
for (const name of CONFIG_FILES) {
|
|
1901
|
-
const path = join(cwd, name);
|
|
1902
|
-
if (existsSync(path)) return path;
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
/** Imports a project module fresh, so watch loops and tests see edits. */
|
|
1906
|
-
async function importModule(path) {
|
|
1907
|
-
return await import(`${pathToFileURL(path).href}?t=${Date.now()}`);
|
|
1908
|
-
}
|
|
1909
|
-
/** The named export, then `default`, of a project module. */
|
|
1910
|
-
async function importExport(path, name) {
|
|
1911
|
-
if (!existsSync(path)) throw new Error(`Module not found: ${path}`);
|
|
1912
|
-
const loaded = await importModule(path);
|
|
1913
|
-
return loaded[name] ?? loaded["default"];
|
|
1914
|
-
}
|
|
1915
|
-
function isConfig(value) {
|
|
1916
|
-
return configIssues(value).length === 0;
|
|
1917
|
-
}
|
|
1918
|
-
/**
|
|
1919
|
-
* Loads `better-supabase.config.*` with c12 and checks it against the config
|
|
1920
|
-
* schema. c12 imports `.ts` natively (Node 24 strips the types), so no
|
|
1921
|
-
* loader is needed; rc files, `package.json`, env overrides and `extends`
|
|
1922
|
-
* are off so the one file is the whole config.
|
|
1923
|
-
*/
|
|
1924
|
-
async function loadConfig(cwd, explicit) {
|
|
1925
|
-
const path = findConfig(cwd, explicit);
|
|
1926
|
-
if (!path) return resolveConfig({}, cwd);
|
|
1927
|
-
if (!existsSync(path)) throw new CliError("config_not_found", `Config file not found: ${path}`);
|
|
1928
|
-
const { config } = await loadConfig$1({
|
|
1929
|
-
cwd,
|
|
1930
|
-
configFile: path,
|
|
1931
|
-
rcFile: false,
|
|
1932
|
-
globalRc: false,
|
|
1933
|
-
packageJson: false,
|
|
1934
|
-
dotenv: false,
|
|
1935
|
-
envName: false,
|
|
1936
|
-
extend: false,
|
|
1937
|
-
giget: false
|
|
1938
|
-
});
|
|
1939
|
-
if (!isConfig(config)) {
|
|
1940
|
-
const issues = configIssues(config);
|
|
1941
|
-
throw new CliError("config_invalid", `${display(cwd, path)} is not a valid config:\n${issues.map((issue) => ` ${issue}`).join("\n")}`, { issues });
|
|
1942
|
-
}
|
|
1943
|
-
return resolveConfig(config, cwd);
|
|
1944
|
-
}
|
|
1945
|
-
/** `[db] port` or `[api] port` from `supabase/config.toml`. */
|
|
1946
|
-
async function readSupabasePort(root, section) {
|
|
1947
|
-
const toml = await readSupabaseToml(root);
|
|
1948
|
-
return toml ? tomlNumber(toml.document, [section, "port"]) : void 0;
|
|
1949
|
-
}
|
|
1950
|
-
/** The connection string piped in for `--db-url-stdin`, when it was passed. */
|
|
1951
|
-
async function stdinDatabaseUrl(enabled, io) {
|
|
1952
|
-
if (enabled !== true) return void 0;
|
|
1953
|
-
const url = (await io.stdin?.())?.trim();
|
|
1954
|
-
if (!url) throw new CliError("missing_value", "--db-url-stdin read nothing from stdin. Pipe the connection string: printf %s \"$URL\" | better-supabase <command> --db-url-stdin", { flag: "--db-url-stdin" });
|
|
1955
|
-
return url;
|
|
1956
|
-
}
|
|
1957
|
-
/** Connection string: stdin, config, `$DATABASE_URL`, then the local stack. */
|
|
1958
|
-
async function databaseUrl(config, env, fromStdin) {
|
|
1959
|
-
if (fromStdin) return fromStdin;
|
|
1960
|
-
if (config.source.dbUrl) return config.source.dbUrl;
|
|
1961
|
-
if (env.DATABASE_URL) return env.DATABASE_URL;
|
|
1962
|
-
return `postgresql://postgres:postgres@127.0.0.1:${await readSupabasePort(config.root, "db") ?? 54322}/postgres`;
|
|
1963
|
-
}
|
|
1964
|
-
//#endregion
|
|
1965
|
-
export { loadConfig as a, diffEngine as c, pgFunctionHooks as d, readSupabaseToml as f, importModule as i, httpHooks as l, tomlGet as m, findConfig as n, readSupabasePort as o, schemaPaths as p, importExport as r, stdinDatabaseUrl as s, databaseUrl as t, migrationCommand as u };
|
|
1095
|
+
export { findSupabaseRoot as a, migrationCommand as c, schemaPaths as d, supabaseDir as f, findRepoRoot as i, pgFunctionHooks as l, tomlNumber as m, declarativeSchemasDir as n, findUp as o, tomlGet as p, diffEngine as r, httpHooks as s, PGDELTA_TABLE as t, readSupabaseToml as u };
|