better-supabase 0.31.0 → 0.33.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.
Files changed (1703) hide show
  1. package/README.md +11 -10
  2. package/codemods/0.32.json +31 -0
  3. package/dist/access-sql-Dao1C0fz.js +383 -0
  4. package/dist/actor-B5b0i1Fs.js +149 -0
  5. package/dist/actor-DseNR02I.d.ts +104 -0
  6. package/dist/adapter-CWzyKepA.js +2260 -0
  7. package/dist/agents-DXiOPB3V.d.ts +115 -0
  8. package/dist/ai-cache-CLiAXCPH.d.ts +80 -0
  9. package/dist/ai-cache-D9D36eh4.js +86 -0
  10. package/dist/ai-chat-DlcBdOhJ.d.ts +532 -0
  11. package/dist/ai-files-DCMVGSds.js +337 -0
  12. package/dist/ai-message-cnroprVB.js +13 -0
  13. package/dist/ai-schedules-Drx2KRTn.d.ts +164 -0
  14. package/dist/ai-sdk/agents/index.d.ts +8 -12
  15. package/dist/ai-sdk/agents/index.js +10 -12
  16. package/dist/ai-sdk/batches/index.d.ts +12 -7
  17. package/dist/ai-sdk/batches/index.js +16 -9
  18. package/dist/ai-sdk/cache/index.d.ts +2 -4
  19. package/dist/ai-sdk/cache/index.js +3 -4
  20. package/dist/ai-sdk/chat/index.d.ts +77 -2
  21. package/dist/ai-sdk/chat/index.js +179 -28
  22. package/dist/ai-sdk/embeddings/index.d.ts +2 -2
  23. package/dist/ai-sdk/embeddings/index.js +1 -1
  24. package/dist/ai-sdk/files/index.d.ts +3 -5
  25. package/dist/ai-sdk/files/index.js +5 -6
  26. package/dist/ai-sdk/index.d.ts +75 -21
  27. package/dist/ai-sdk/index.js +112 -66
  28. package/dist/ai-sdk/mcp/index.d.ts +28 -13
  29. package/dist/ai-sdk/mcp/index.js +56 -17
  30. package/dist/ai-sdk/memory/index.d.ts +3 -5
  31. package/dist/ai-sdk/memory/index.js +3 -4
  32. package/dist/ai-sdk/react/index.d.ts +2 -2
  33. package/dist/ai-sdk/react/index.js +3 -1
  34. package/dist/ai-sdk/react/server.d.ts +7 -4
  35. package/dist/ai-sdk/react/server.js +10 -3
  36. package/dist/ai-sdk/workflow/index.d.ts +12 -13
  37. package/dist/ai-sdk/workflow/index.js +17 -17
  38. package/dist/ai-sdk/workflow/react/index.d.ts +1 -3
  39. package/dist/ai-sdk/workflow/react/index.js +3 -3
  40. package/dist/ai-sdk/workflow/react/server.d.ts +1 -3
  41. package/dist/ai-sdk/workflow/react/server.js +1 -2
  42. package/dist/anchors-sCLvYj-8.d.ts +36 -0
  43. package/dist/api-keys-DbIbkGxx.d.ts +211 -0
  44. package/dist/api-myq2e9t5.d.ts +482 -0
  45. package/dist/api-wwix_K5c.js +691 -0
  46. package/dist/app-tables-IrglDJCs.d.ts +26 -0
  47. package/dist/approvals-DZoGtNFv.d.ts +127 -0
  48. package/dist/approvals-Da4uAANx.js +166 -0
  49. package/dist/assistant-BEbRPjhn.d.ts +209 -0
  50. package/dist/astro/index.d.ts +7 -10
  51. package/dist/astro/index.js +8 -9
  52. package/dist/attachments-BWtUQgsL.js +375 -0
  53. package/dist/attributes-BZNkR2z2.js +51 -0
  54. package/dist/auth-link-BmJsQG4a.js +117 -0
  55. package/dist/auth-link-DRjtI1Ky.d.ts +102 -0
  56. package/dist/auth-module-CqXdm8qD.js +50 -0
  57. package/dist/auth-reply-BMPJQssh.d.ts +9 -0
  58. package/dist/auth-reply-Cnwn3I_q.js +30 -0
  59. package/dist/auth-wFlGgwTZ.js +19 -0
  60. package/dist/authorization-BlmDNI2b.d.ts +3734 -0
  61. package/dist/authorization-hooks-CxwsRnfV.d.ts +219 -0
  62. package/dist/authorizer-BtIPDO-c.js +194 -0
  63. package/dist/automation-acq3iK9y.js +74 -0
  64. package/dist/automations-BfH8GJqv.js +27 -0
  65. package/dist/automations-Bw5cX7oj.js +29 -0
  66. package/dist/automations-CCc5RUw-.js +31 -0
  67. package/dist/automations-Dou1t3lt.js +313 -0
  68. package/dist/availability-CebEOfMN.d.ts +236 -0
  69. package/dist/base64-CVyKHBBw.js +41 -0
  70. package/dist/batch-limit-DqQ3d6op.js +4 -0
  71. package/dist/before-route-Ra3OhI2x.js +29 -0
  72. package/dist/better-result/index.d.ts +4 -6
  73. package/dist/better-result/index.js +2 -3
  74. package/dist/bind-DP-KLgYI.d.ts +102 -0
  75. package/dist/block-authors-C5z3tGVu.d.ts +10 -0
  76. package/dist/block-authors-DCQ4zl8e.js +13 -0
  77. package/dist/block-env-CJ38ZSTP.d.ts +30 -0
  78. package/dist/block-event-listener-DCi7c89M.js +15 -0
  79. package/dist/block-events-Bp6GPIBN.js +82 -0
  80. package/dist/block-fields-Bjcv6_zc.js +139 -0
  81. package/dist/block-fields-Puv5m5D3.d.ts +56 -0
  82. package/dist/block-helpers-I7UzjNEf.js +435 -0
  83. package/dist/block-helpers-disoUWCp.d.ts +56 -0
  84. package/dist/block-hooks-CadxQ9-_.js +129 -0
  85. package/dist/block-hooks-DrA_d1dJ.d.ts +115 -0
  86. package/dist/block-method-DIbWG4Mj.js +20 -0
  87. package/dist/block-method-QSaPsL2P.d.ts +12 -0
  88. package/dist/block-subjects-Br2MQNFn.d.ts +4 -0
  89. package/dist/block-subjects-cRlVtKDO.js +54 -0
  90. package/dist/block-tables-CQTU71zn.d.ts +34 -0
  91. package/dist/block-tenant-Bun03JuO.js +13 -0
  92. package/dist/block-transport-BEtC_Kis.d.ts +67 -0
  93. package/dist/blocks/access-requests/index.d.ts +9 -15
  94. package/dist/blocks/access-requests/index.js +11 -14
  95. package/dist/blocks/activities/index.d.ts +13 -21
  96. package/dist/blocks/activities/index.js +16 -21
  97. package/dist/blocks/agents/index.d.ts +4 -8
  98. package/dist/blocks/agents/index.js +11 -14
  99. package/dist/blocks/ai-cache/index.d.ts +3 -5
  100. package/dist/blocks/ai-cache/index.js +5 -6
  101. package/dist/blocks/ai-chat/index.d.ts +10 -19
  102. package/dist/blocks/ai-chat/index.js +20 -28
  103. package/dist/blocks/ai-files/index.d.ts +5 -9
  104. package/dist/blocks/ai-files/index.js +5 -6
  105. package/dist/blocks/ai-keys/index.d.ts +4 -10
  106. package/dist/blocks/ai-keys/index.js +14 -18
  107. package/dist/blocks/ai-schedules/index.d.ts +3 -5
  108. package/dist/blocks/ai-schedules/index.js +14 -16
  109. package/dist/blocks/announcements/index.d.ts +12 -20
  110. package/dist/blocks/announcements/index.js +12 -16
  111. package/dist/blocks/api-keys/index.d.ts +4 -116
  112. package/dist/blocks/api-keys/index.js +17 -22
  113. package/dist/blocks/approvals/index.d.ts +4 -8
  114. package/dist/blocks/approvals/index.js +7 -173
  115. package/dist/blocks/assets/index.d.ts +9 -17
  116. package/dist/blocks/assets/index.js +13 -17
  117. package/dist/blocks/assignment/index.d.ts +9 -17
  118. package/dist/blocks/assignment/index.js +10 -14
  119. package/dist/blocks/attachments/index.d.ts +6 -18
  120. package/dist/blocks/attachments/index.js +19 -24
  121. package/dist/blocks/audit/index.d.ts +15 -31
  122. package/dist/blocks/audit/index.js +27 -35
  123. package/dist/blocks/automations/index.d.ts +14 -26
  124. package/dist/blocks/automations/index.js +18 -23
  125. package/dist/blocks/billable-time/index.d.ts +9 -19
  126. package/dist/blocks/billable-time/index.js +15 -20
  127. package/dist/blocks/billing/index.d.ts +12 -22
  128. package/dist/blocks/billing/index.js +19 -24
  129. package/dist/blocks/bookings/index.d.ts +8 -18
  130. package/dist/blocks/bookings/index.js +17 -23
  131. package/dist/blocks/bulk/index.d.ts +6 -12
  132. package/dist/blocks/bulk/index.js +10 -13
  133. package/dist/blocks/calendar/index.d.ts +13 -23
  134. package/dist/blocks/calendar/index.js +35 -32
  135. package/dist/blocks/catalog/index.d.ts +12 -20
  136. package/dist/blocks/catalog/index.js +17 -21
  137. package/dist/blocks/channels/index.d.ts +9 -17
  138. package/dist/blocks/channels/index.js +11 -15
  139. package/dist/blocks/collections/index.d.ts +11 -17
  140. package/dist/blocks/collections/index.js +13 -16
  141. package/dist/blocks/comments/index.d.ts +16 -26
  142. package/dist/blocks/comments/index.js +21 -26
  143. package/dist/blocks/compliance/index.d.ts +9 -17
  144. package/dist/blocks/compliance/index.js +13 -17
  145. package/dist/blocks/connectors/index.d.ts +4 -8
  146. package/dist/blocks/connectors/index.js +13 -16
  147. package/dist/blocks/contacts/index.d.ts +10 -18
  148. package/dist/blocks/contacts/index.js +12 -16
  149. package/dist/blocks/content/index.d.ts +8 -16
  150. package/dist/blocks/content/index.js +13 -17
  151. package/dist/blocks/contracts/index.d.ts +11 -21
  152. package/dist/blocks/contracts/index.js +17 -22
  153. package/dist/blocks/courses/index.d.ts +11 -21
  154. package/dist/blocks/courses/index.js +17 -22
  155. package/dist/blocks/created-by/index.d.ts +3 -7
  156. package/dist/blocks/created-by/index.js +4 -5
  157. package/dist/blocks/custom-fields/index.d.ts +10 -16
  158. package/dist/blocks/custom-fields/index.js +13 -16
  159. package/dist/blocks/data-lifecycle/index.d.ts +10 -26
  160. package/dist/blocks/data-lifecycle/index.js +17 -23
  161. package/dist/blocks/deals/index.d.ts +12 -20
  162. package/dist/blocks/deals/index.js +18 -22
  163. package/dist/blocks/dispatch/index.d.ts +11 -23
  164. package/dist/blocks/dispatch/index.js +19 -24
  165. package/dist/blocks/documents/index.d.ts +4 -8
  166. package/dist/blocks/documents/index.js +9 -12
  167. package/dist/blocks/domains/index.d.ts +8 -14
  168. package/dist/blocks/domains/index.js +12 -15
  169. package/dist/blocks/donations/index.d.ts +13 -23
  170. package/dist/blocks/donations/index.js +21 -26
  171. package/dist/blocks/drive/index.d.ts +116 -20
  172. package/dist/blocks/drive/index.js +138 -26
  173. package/dist/blocks/employees/index.d.ts +13 -23
  174. package/dist/blocks/employees/index.js +18 -23
  175. package/dist/blocks/enrichment/index.d.ts +8 -16
  176. package/dist/blocks/enrichment/index.js +11 -15
  177. package/dist/blocks/enrollments/index.d.ts +9 -17
  178. package/dist/blocks/enrollments/index.js +13 -17
  179. package/dist/blocks/entitlements/index.d.ts +8 -14
  180. package/dist/blocks/entitlements/index.js +8 -32
  181. package/dist/blocks/expenses/index.d.ts +22 -19
  182. package/dist/blocks/expenses/index.js +25 -23
  183. package/dist/blocks/field-history/index.d.ts +6 -10
  184. package/dist/blocks/field-history/index.js +5 -7
  185. package/dist/blocks/flags/index.d.ts +49 -20
  186. package/dist/blocks/flags/index.js +65 -19
  187. package/dist/blocks/forecasts/index.d.ts +10 -16
  188. package/dist/blocks/forecasts/index.js +11 -14
  189. package/dist/blocks/forms/index.d.ts +11 -25
  190. package/dist/blocks/forms/index.js +17 -24
  191. package/dist/blocks/goals/index.d.ts +8 -12
  192. package/dist/blocks/goals/index.js +9 -11
  193. package/dist/blocks/guests/index.d.ts +9 -19
  194. package/dist/blocks/guests/index.js +14 -19
  195. package/dist/blocks/hiring/index.d.ts +10 -18
  196. package/dist/blocks/hiring/index.js +12 -15
  197. package/dist/blocks/identities/index.d.ts +7 -11
  198. package/dist/blocks/identities/index.js +7 -9
  199. package/dist/blocks/imports/index.d.ts +8 -18
  200. package/dist/blocks/imports/index.js +11 -16
  201. package/dist/blocks/inbox/index.d.ts +11 -21
  202. package/dist/blocks/inbox/index.js +26 -23
  203. package/dist/blocks/incidents/index.d.ts +9 -17
  204. package/dist/blocks/incidents/index.js +14 -18
  205. package/dist/blocks/index.d.ts +14 -20
  206. package/dist/blocks/index.js +17 -20
  207. package/dist/blocks/inventory/index.d.ts +11 -17
  208. package/dist/blocks/inventory/index.js +12 -15
  209. package/dist/blocks/invoices/index.d.ts +34 -21
  210. package/dist/blocks/invoices/index.js +31 -18
  211. package/dist/blocks/knowledge/index.d.ts +3 -5
  212. package/dist/blocks/knowledge/index.js +5 -6
  213. package/dist/blocks/lead-scoring/index.d.ts +10 -14
  214. package/dist/blocks/lead-scoring/index.js +11 -13
  215. package/dist/blocks/leases/index.d.ts +11 -21
  216. package/dist/blocks/leases/index.js +20 -25
  217. package/dist/blocks/leave/index.d.ts +50 -17
  218. package/dist/blocks/leave/index.js +35 -14
  219. package/dist/blocks/ledger/index.d.ts +9 -17
  220. package/dist/blocks/ledger/index.js +13 -17
  221. package/dist/blocks/mail-sync/index.d.ts +6 -12
  222. package/dist/blocks/mail-sync/index.js +26 -25
  223. package/dist/blocks/memberships/index.d.ts +5 -9
  224. package/dist/blocks/memberships/index.js +4 -5
  225. package/dist/blocks/memory/index.d.ts +4 -8
  226. package/dist/blocks/memory/index.js +12 -15
  227. package/dist/blocks/messaging/index.d.ts +14 -24
  228. package/dist/blocks/messaging/index.js +19 -24
  229. package/dist/blocks/metrics/index.d.ts +9 -17
  230. package/dist/blocks/metrics/index.js +14 -18
  231. package/dist/blocks/mfa/index.d.ts +5 -9
  232. package/dist/blocks/mfa/index.js +7 -9
  233. package/dist/blocks/moderation/index.d.ts +9 -17
  234. package/dist/blocks/moderation/index.js +13 -17
  235. package/dist/blocks/notifications/index.d.ts +18 -34
  236. package/dist/blocks/notifications/index.js +32 -42
  237. package/dist/blocks/numbering/index.d.ts +6 -12
  238. package/dist/blocks/numbering/index.js +8 -11
  239. package/dist/blocks/oauth-server/index.d.ts +7 -13
  240. package/dist/blocks/oauth-server/index.js +12 -15
  241. package/dist/blocks/onboarding/index.d.ts +7 -13
  242. package/dist/blocks/onboarding/index.js +8 -11
  243. package/dist/blocks/orders/index.d.ts +17 -29
  244. package/dist/blocks/orders/index.js +22 -28
  245. package/dist/blocks/organizations/index.d.ts +11 -21
  246. package/dist/blocks/organizations/index.js +16 -19
  247. package/dist/blocks/outbox/index.d.ts +4 -6
  248. package/dist/blocks/outbox/index.js +11 -13
  249. package/dist/blocks/passes/index.d.ts +12 -22
  250. package/dist/blocks/passes/index.js +20 -25
  251. package/dist/blocks/permissions/index.d.ts +50 -15
  252. package/dist/blocks/permissions/index.js +99 -19
  253. package/dist/blocks/pipelines/index.d.ts +12 -18
  254. package/dist/blocks/pipelines/index.js +12 -15
  255. package/dist/blocks/posts/index.d.ts +10 -18
  256. package/dist/blocks/posts/index.js +15 -19
  257. package/dist/blocks/profiles/index.d.ts +8 -12
  258. package/dist/blocks/profiles/index.js +9 -11
  259. package/dist/blocks/promotions/index.d.ts +11 -17
  260. package/dist/blocks/promotions/index.js +13 -16
  261. package/dist/blocks/push/index.d.ts +12 -18
  262. package/dist/blocks/push/index.js +13 -16
  263. package/dist/blocks/queue/index.d.ts +187 -39
  264. package/dist/blocks/queue/index.js +226 -60
  265. package/dist/blocks/quotes/index.d.ts +13 -21
  266. package/dist/blocks/quotes/index.js +14 -17
  267. package/dist/blocks/rank/index.d.ts +7 -13
  268. package/dist/blocks/rank/index.js +8 -10
  269. package/dist/blocks/reactions/index.d.ts +11 -19
  270. package/dist/blocks/reactions/index.js +13 -17
  271. package/dist/blocks/relations/index.d.ts +11 -21
  272. package/dist/blocks/relations/index.js +18 -23
  273. package/dist/blocks/reminders/index.d.ts +12 -22
  274. package/dist/blocks/reminders/index.js +21 -25
  275. package/dist/blocks/reviews/index.d.ts +9 -15
  276. package/dist/blocks/reviews/index.js +11 -14
  277. package/dist/blocks/saved-views/index.d.ts +11 -21
  278. package/dist/blocks/saved-views/index.js +16 -21
  279. package/dist/blocks/scores/index.d.ts +6 -12
  280. package/dist/blocks/scores/index.js +10 -13
  281. package/dist/blocks/search/index.d.ts +9 -19
  282. package/dist/blocks/search/index.js +15 -19
  283. package/dist/blocks/security-events/index.d.ts +10 -24
  284. package/dist/blocks/security-events/index.js +17 -23
  285. package/dist/blocks/segments/index.d.ts +10 -18
  286. package/dist/blocks/segments/index.js +11 -15
  287. package/dist/blocks/sequences/index.d.ts +9 -17
  288. package/dist/blocks/sequences/index.js +15 -19
  289. package/dist/blocks/service-accounts/index.d.ts +9 -15
  290. package/dist/blocks/service-accounts/index.js +11 -14
  291. package/dist/blocks/sessions/index.d.ts +4 -8
  292. package/dist/blocks/sessions/index.js +9 -11
  293. package/dist/blocks/settings/index.d.ts +8 -16
  294. package/dist/blocks/settings/index.js +14 -18
  295. package/dist/blocks/share-links/index.d.ts +9 -17
  296. package/dist/blocks/share-links/index.js +16 -20
  297. package/dist/blocks/shipments/index.d.ts +14 -24
  298. package/dist/blocks/shipments/index.js +25 -31
  299. package/dist/blocks/signatures/index.d.ts +10 -16
  300. package/dist/blocks/signatures/index.js +10 -13
  301. package/dist/blocks/signing-keys/index.d.ts +5 -9
  302. package/dist/blocks/signing-keys/index.js +8 -10
  303. package/dist/blocks/sla/index.d.ts +11 -19
  304. package/dist/blocks/sla/index.js +17 -21
  305. package/dist/blocks/sso/index.d.ts +7 -19
  306. package/dist/blocks/sso/index.js +14 -21
  307. package/dist/blocks/state-machine/index.d.ts +7 -13
  308. package/dist/blocks/state-machine/index.js +9 -12
  309. package/dist/blocks/subjects/index.d.ts +7 -11
  310. package/dist/blocks/subjects/index.js +12 -14
  311. package/dist/blocks/tags/index.d.ts +11 -21
  312. package/dist/blocks/tags/index.js +20 -25
  313. package/dist/blocks/tasks/index.d.ts +13 -27
  314. package/dist/blocks/tasks/index.js +22 -29
  315. package/dist/blocks/teams/index.d.ts +8 -14
  316. package/dist/blocks/teams/index.js +10 -13
  317. package/dist/blocks/templates/index.d.ts +12 -22
  318. package/dist/blocks/templates/index.js +16 -21
  319. package/dist/blocks/time-tracking/index.d.ts +31 -25
  320. package/dist/blocks/time-tracking/index.js +29 -29
  321. package/dist/blocks/timeline/index.d.ts +10 -14
  322. package/dist/blocks/timeline/index.js +11 -13
  323. package/dist/blocks/trash/index.d.ts +10 -18
  324. package/dist/blocks/trash/index.js +11 -14
  325. package/dist/blocks/undo/index.d.ts +4 -8
  326. package/dist/blocks/undo/index.js +6 -8
  327. package/dist/blocks/updated-at/index.d.ts +3 -7
  328. package/dist/blocks/updated-at/index.js +4 -5
  329. package/dist/blocks/usage/index.d.ts +6 -10
  330. package/dist/blocks/usage/index.js +10 -13
  331. package/dist/blocks/vercel-marketplace/index.d.ts +9 -17
  332. package/dist/blocks/vercel-marketplace/index.js +17 -21
  333. package/dist/blocks/versions/index.d.ts +10 -20
  334. package/dist/blocks/versions/index.js +17 -22
  335. package/dist/blocks/waitlist/index.d.ts +10 -16
  336. package/dist/blocks/waitlist/index.js +11 -14
  337. package/dist/blocks/webhooks/index.d.ts +16 -34
  338. package/dist/blocks/webhooks/index.js +33 -44
  339. package/dist/blocks/workflow-editor/index.d.ts +13 -21
  340. package/dist/blocks/workflow-editor/index.js +22 -27
  341. package/dist/blocks/workflows/index.d.ts +8 -14
  342. package/dist/blocks/workflows/index.js +14 -18
  343. package/dist/bookings-Br0VXzaf.d.ts +285 -0
  344. package/dist/bucket-DvG66r5G.d.ts +693 -0
  345. package/dist/build-Ckxct2EX.js +2065 -0
  346. package/dist/build-D1-V9dd8.js +732 -0
  347. package/dist/carrier-D2b_028L.d.ts +165 -0
  348. package/dist/casing-DQzG9ANZ.js +15 -0
  349. package/dist/channel-B_kufDZy.d.ts +101 -0
  350. package/dist/channels-BxeTTtCY.js +113 -0
  351. package/dist/chat-sdk/index.d.ts +174 -41
  352. package/dist/chat-sdk/index.js +425 -83
  353. package/dist/claim-names-BKig1LOk.js +24 -0
  354. package/dist/claims/index.d.ts +8 -0
  355. package/dist/claims/index.js +8 -0
  356. package/dist/claims-CqTr_N1n.js +98 -0
  357. package/dist/claims-DouHL7ZL.js +62 -0
  358. package/dist/cli/_format-Ba0DoWjl.js +99 -0
  359. package/dist/cli/add-BDLLVLI8.js +99 -0
  360. package/dist/cli/add-BaOCKKt6.js +1 -0
  361. package/dist/cli/add-D2pKTbPw.js +1222 -0
  362. package/dist/cli/agent-59XWXsRi.js +184 -0
  363. package/dist/cli/app-table-files-CimWi_eh.js +343 -0
  364. package/dist/cli/arazzo-1.0-D3OaSeZw.js +531 -0
  365. package/dist/cli/arazzo-1.1-DaT2KAkP.js +704 -0
  366. package/dist/cli/args-_ZVgRBkx.js +26 -0
  367. package/dist/cli/asyncapi-3.0.0-Ca-UwtUW.js +5592 -0
  368. package/dist/cli/asyncapi-3.1.0-DUxf5zNu.js +5832 -0
  369. package/dist/cli/authorization-DJkkOjjG.js +230 -0
  370. package/dist/cli/backfill-B1xAsdL4.js +292 -0
  371. package/dist/cli/bin.js +5 -5
  372. package/dist/cli/blocks-DtZtn-R4.js +1 -0
  373. package/dist/cli/blocks-rBeis04I.js +155 -0
  374. package/dist/cli/cache-CvBRwv02.js +643 -0
  375. package/dist/cli/codemod-DYbVbJ-e.js +2884 -0
  376. package/dist/cli/codemod-block-renames-Dt3X1Wvg.js +238 -0
  377. package/dist/cli/command-BpZ4AuhR.js +1021 -0
  378. package/dist/cli/compare-yl4sSwVn.js +8 -0
  379. package/dist/cli/completion-B08Q0xB3.js +29 -0
  380. package/dist/cli/completion-CwL7e93t.js +210 -0
  381. package/dist/cli/completion-DHTT6rjI.js +1 -0
  382. package/dist/cli/config-CrwCec-B.js +1 -0
  383. package/dist/cli/config-D-Upz3jV.js +46 -0
  384. package/dist/cli/config-DrrkMihk.js +2030 -0
  385. package/dist/cli/config-edit-C6sQ1MqT.js +619 -0
  386. package/dist/cli/config-group-D4JWh4kG.js +388 -0
  387. package/dist/cli/content-mapper-DrhtDsAm.js +181 -0
  388. package/dist/cli/db-B8zfxjl2.js +77 -0
  389. package/dist/cli/db-Diy1OebO.js +246 -0
  390. package/dist/cli/detect-BcUDaO8I.js +83 -0
  391. package/dist/cli/dist-CYnD1kyT.js +128 -0
  392. package/dist/cli/dist-MKwjiW2w.js +1114 -0
  393. package/dist/cli/doctor-Dn4TzGmw.js +4687 -0
  394. package/dist/cli/env-BAJn6wCA.js +142 -0
  395. package/dist/cli/env-BCuUsWOh.js +1109 -0
  396. package/dist/cli/env-D70ihdbB.js +1 -0
  397. package/dist/cli/env-UN6PJFX6.js +1 -0
  398. package/dist/cli/errors-DcJ_PayO.js +97 -0
  399. package/dist/cli/exec-CXBufciC.js +461 -0
  400. package/dist/cli/fastest-levenshtein-B_QF6At5.js +119 -0
  401. package/dist/cli/files-DQayErI8.js +999 -0
  402. package/dist/cli/fresh-import-CdO2oQaQ.js +39 -0
  403. package/dist/cli/gen-BbeS0KgF.js +390 -0
  404. package/dist/cli/guards-DxwRG0Uv.js +7 -0
  405. package/dist/cli/in-stack-diff-huI7fGMX.js +185 -0
  406. package/dist/cli/index.d.ts +1 -53
  407. package/dist/cli/index.js +10 -11
  408. package/dist/cli/init-C30xdMSs.js +556 -0
  409. package/dist/cli/io-CQzy8PEZ.js +36 -0
  410. package/dist/cli/json5-DhsZB2va.js +784 -0
  411. package/dist/cli/jsonc-DU9Clnrz.js +1 -0
  412. package/dist/cli/jsonc-u_UiXFxs.js +43 -0
  413. package/dist/cli/keys-CxajkV_7.js +105 -0
  414. package/dist/cli/legacy-prefix-D8Jfku6I.js +153 -0
  415. package/dist/cli/live-Ctc8Qh9Y.js +339 -0
  416. package/dist/cli/mcp-5J0kUOtD.js +240 -0
  417. package/dist/cli/metadata-DxhUNctA.js +149 -0
  418. package/dist/cli/migrate-ockrh3UX.js +45 -0
  419. package/dist/cli/migration-safety-CLrqC0D-.js +925 -0
  420. package/dist/cli/migrations-CZTg2UJM.js +116 -0
  421. package/dist/cli/module-migration-BptQzmj2.js +118 -0
  422. package/dist/cli/moved-BAFPdJz_.js +253 -0
  423. package/dist/cli/ohash-imLR_J5Y.js +276 -0
  424. package/dist/cli/openapi-3.0-BJiTNq_x.js +927 -0
  425. package/dist/cli/openapi-3.1-BcWCoii2.js +869 -0
  426. package/dist/cli/openapi-3.2-MXPkeoTk.js +1030 -0
  427. package/dist/cli/orphans-CPcR85QN.js +27 -0
  428. package/dist/cli/parse-BueItuNJ.js +181 -0
  429. package/dist/cli/powersync-CmsXOuui.js +1 -0
  430. package/dist/cli/powersync-DIvsipKr.js +375 -0
  431. package/dist/cli/preset-BQnjDCSR.js +100 -0
  432. package/dist/cli/print-DdHt8xCc.js +66 -0
  433. package/dist/cli/prompts-D9b6uf21.js +1133 -0
  434. package/dist/cli/providers-k-1cEna6.js +99 -0
  435. package/dist/cli/prune-workflows-Ddv-GfkO.js +153 -0
  436. package/dist/cli/redact--zOGdWzo.js +37 -0
  437. package/dist/cli/remove-DEEQDoc7.js +237 -0
  438. package/dist/cli/render-SjSVz8yK.js +2216 -0
  439. package/dist/cli/rolldown-runtime-DegdyBIC.js +25 -0
  440. package/dist/cli/run-DdhIK7-K.js +1451 -0
  441. package/dist/cli/run-Ixt9mEb6.js +703 -0
  442. package/dist/cli/run-dY9uOC3W.js +62 -0
  443. package/dist/cli/seed-BpaqqyO8.js +187 -0
  444. package/dist/cli/seed-ByLneY1H.js +1 -0
  445. package/dist/cli/shared-p6sxli_5.js +150 -0
  446. package/dist/cli/shell-C1U618XA.js +9 -0
  447. package/dist/cli/skills-jZThjL3B.js +120 -0
  448. package/dist/cli/snapshot-Dd_8B9g-.js +728 -0
  449. package/dist/cli/source-BYvVe_Es.js +317 -0
  450. package/dist/cli/source-args-Bz5QQne2.js +58 -0
  451. package/dist/cli/spec-BxQgllJY.js +7449 -0
  452. package/dist/cli/spec-liRzcZTa.js +1 -0
  453. package/dist/cli/sql-layout-DHwiUOaD.js +260 -0
  454. package/dist/cli/stack-147NqctC.js +134 -0
  455. package/dist/cli/stack-env-BQhbUFa7.js +92 -0
  456. package/dist/cli/stack-status-Mxgqb3I4.js +45 -0
  457. package/dist/cli/stacks-C5YL6Un9.js +230 -0
  458. package/dist/cli/style-B5-nByxb.js +34 -0
  459. package/dist/cli/supabase-toml-B6-eEV5p.js +1155 -0
  460. package/dist/cli/sync-CreQWj53.js +318 -0
  461. package/dist/cli/table-D9FbJS8h.js +88 -0
  462. package/dist/cli/toml-VX0BsvYq.js +422 -0
  463. package/dist/cli/topics-Cdg0V7Tt.js +29 -0
  464. package/dist/cli/trace-D3TNqWBg.js +6 -0
  465. package/dist/cli/upgrade-3NQOUO1_.js +270 -0
  466. package/dist/cli/upgrade-U7IKj45h.js +40 -0
  467. package/dist/cli/validate-C_WTnX1U.js +7426 -0
  468. package/dist/cli/version-mBwP-aMG.js +3 -0
  469. package/dist/cli/yaml-JsusTbcC.js +2250 -0
  470. package/dist/client/index.d.ts +7 -7
  471. package/dist/client/index.js +9 -12
  472. package/dist/client/native/index.d.ts +7 -23
  473. package/dist/client/native/index.js +15 -22
  474. package/dist/client-Bky2z09B.js +290 -0
  475. package/dist/clone-H_gCsL29.js +32 -0
  476. package/dist/cloud-event-CLvsaPqH.js +62 -0
  477. package/dist/cloud-event-DXWmXrus.d.ts +62 -0
  478. package/dist/codecs-B1VO2BGL.d.ts +220 -0
  479. package/dist/codecs-B9v5Y5HH.js +357 -0
  480. package/dist/commerce/index.d.ts +5 -13
  481. package/dist/commerce/index.js +13 -16
  482. package/dist/compiler-qlXlokKn.d.ts +12 -0
  483. package/dist/compose-BRBlPSEY.js +52 -0
  484. package/dist/composite-CIxjVcL1.d.ts +79 -0
  485. package/dist/composite-D2JnIiHt.js +125 -0
  486. package/dist/config/index.d.ts +6 -6
  487. package/dist/config/index.js +7 -7
  488. package/dist/config-Bu6pwqcO.js +1102 -0
  489. package/dist/config-MDRA2sre.js +1672 -0
  490. package/dist/connectors-Cf2LeAuZ.d.ts +145 -0
  491. package/dist/context-D7jICqdN.d.ts +4279 -0
  492. package/dist/context-DSevnLrT.js +40 -0
  493. package/dist/contract/index.d.ts +16 -0
  494. package/dist/contract/index.js +0 -0
  495. package/dist/controller-BJmh7gFm.js +78 -0
  496. package/dist/controller-DxtxeYdf.d.ts +50 -0
  497. package/dist/controller-y1kSMuCU.js +72 -0
  498. package/dist/conversion-Bj9j3KnG.js +76 -0
  499. package/dist/conversion-C9rndpEI.d.ts +84 -0
  500. package/dist/cookie-DDkqvqe4.d.ts +3 -0
  501. package/dist/cookie-DJI6xXJ9.js +4 -0
  502. package/dist/cors-9SDsndtb.d.ts +13 -0
  503. package/dist/cors-DrDFLMNn.js +23 -0
  504. package/dist/create/index.d.ts +4 -28
  505. package/dist/create/index.js +9 -15
  506. package/dist/create/lite/index.d.ts +5 -25
  507. package/dist/create/lite/index.js +14 -24
  508. package/dist/create/oauth/index.d.ts +1 -1
  509. package/dist/create/oauth/index.js +1 -2
  510. package/dist/create/supabase/index.d.ts +2 -4
  511. package/dist/create/supabase/index.js +3 -6
  512. package/dist/create-blocks-D7q1boXV.js +367 -0
  513. package/dist/credentials/index.d.ts +6 -10
  514. package/dist/credentials/index.js +11 -12
  515. package/dist/cron-BD8VrQQl.js +147 -0
  516. package/dist/cron-route-DSITg1yC.js +23 -0
  517. package/dist/csv-Bwn9insJ.js +88 -0
  518. package/dist/csv-Dd1iKsk-.d.ts +26 -0
  519. package/dist/data-engine-BbqQwso_.js +174 -0
  520. package/dist/data-engine-CMENsp3d.d.ts +269 -0
  521. package/dist/data-hooks-BToeAcQ_.js +277 -0
  522. package/dist/db-exception-Dv18UZ-I.js +30 -0
  523. package/dist/deal-forecast-CN_BEy9s.d.ts +21 -0
  524. package/dist/deal-forecast-DsVFoMkJ.js +38 -0
  525. package/dist/define-B6D55cO0.js +2073 -0
  526. package/dist/define-ITQA71fw.d.ts +1242 -0
  527. package/dist/define-block-22Jv4U_-.js +63 -0
  528. package/dist/define-block-COmMkx2x.d.ts +1669 -0
  529. package/dist/delegation-C2rLpkHO.js +147 -0
  530. package/dist/delivery-CWcbh87x.d.ts +69 -0
  531. package/dist/delivery-SmPHu2_H.js +28 -0
  532. package/dist/delivery-events-0mAEuscm.js +52 -0
  533. package/dist/documents-DeZw83ue.d.ts +150 -0
  534. package/dist/edge/index.d.ts +20 -26
  535. package/dist/edge/index.js +20 -24
  536. package/dist/elysia/index.d.ts +2 -6
  537. package/dist/elysia/index.js +4 -6
  538. package/dist/email-BRm6wMWQ.d.ts +40 -0
  539. package/dist/embeddings--v4BJdUL.js +127 -0
  540. package/dist/embeddings-rVR2AKVz.d.ts +76 -0
  541. package/dist/ended-NC_ZesY4.d.ts +22 -0
  542. package/dist/entitlements-Dydkg-TV.js +47 -0
  543. package/dist/entitlements-sLoj3M6Y.js +44 -0
  544. package/dist/entitlements-w04ivvAy.d.ts +70 -0
  545. package/dist/entity-naming-BES3pkQI.js +130 -0
  546. package/dist/entity-schema-DEIz0I8i.js +38 -0
  547. package/dist/env/index.d.ts +1 -1
  548. package/dist/env/index.js +1 -2
  549. package/dist/envelope-CapD-JtH.js +90 -0
  550. package/dist/errors-B7tCfCvX.js +327 -0
  551. package/dist/errors-BdjHv5SV.js +43 -0
  552. package/dist/errors-D3-4c-XF.js +102 -0
  553. package/dist/escape-like-CK6L7gkj.d.ts +26 -0
  554. package/dist/escape-like-gxNXs145.js +6 -0
  555. package/dist/eve/index.d.ts +247 -16
  556. package/dist/eve/index.js +334 -26
  557. package/dist/eve-DIKjuPp5.d.ts +213 -0
  558. package/dist/event-calendar-DUtFyRrv.d.ts +63 -0
  559. package/dist/event-map-DxfsFgQT.js +18 -0
  560. package/dist/events/index.d.ts +3 -3
  561. package/dist/events/index.js +7 -8
  562. package/dist/events-BRKIxVQD.js +25 -0
  563. package/dist/events-DVt3Z9hw.d.ts +850 -0
  564. package/dist/events-Da482tiF.js +81 -0
  565. package/dist/executor-BDMqPbVU.js +482 -0
  566. package/dist/executor-C0_TT717.js +840 -0
  567. package/dist/executor-CFmee_nV.d.ts +35 -0
  568. package/dist/executor-CHnoKOxk.d.ts +168 -0
  569. package/dist/executor-Dc4Pl44u.js +207 -0
  570. package/dist/executor-DqNRrFxx.d.ts +99 -0
  571. package/dist/expo/index.d.ts +5 -9
  572. package/dist/expo/index.js +10 -12
  573. package/dist/extension-DQ9-oOVC.js +58 -0
  574. package/dist/extension-WdHd5uqI.js +102 -0
  575. package/dist/extension-Z8Pe7fXA.js +120 -0
  576. package/dist/extension-rdpYvpyN.js +52 -0
  577. package/dist/extension-shared-DJb_PfD4.js +59 -0
  578. package/dist/extra-Dz9n5y1s.js +9 -0
  579. package/dist/field-errors-DKCaSlZw.d.ts +208 -0
  580. package/dist/field-formats-Cap-V7UP.js +101 -0
  581. package/dist/field-formats-DVukMbRa.d.ts +36 -0
  582. package/dist/fields-BBcdKD-S.js +107 -0
  583. package/dist/fields-CAVk9dxX.d.ts +76 -0
  584. package/dist/filter-evaluate-Bz3Fzhz2.d.ts +35 -0
  585. package/dist/filter-evaluate-D_LLfdtE.js +216 -0
  586. package/dist/filter-query-DV-x8fio.d.ts +131 -0
  587. package/dist/filter-query-Ds7Z6lgZ.js +565 -0
  588. package/dist/flags-0EXDD3Iz.js +361 -0
  589. package/dist/flags-6emyAXly.d.ts +315 -0
  590. package/dist/flags-sdk/index.d.ts +217 -28
  591. package/dist/flags-sdk/index.js +255 -35
  592. package/dist/form-definition-8cCCt5zj.js +362 -0
  593. package/dist/form-definition-BN8shngm.d.ts +117 -0
  594. package/dist/format-BT0Z3V54.d.ts +77 -0
  595. package/dist/framework-BFlaPuvv.d.ts +46 -0
  596. package/dist/framework-ChzJYkJW.js +58 -0
  597. package/dist/function-contract-Bf6llTkE.js +7 -0
  598. package/dist/function-contract-DgDBYbXu.d.ts +25 -0
  599. package/dist/gateway-DaekJ_Me.d.ts +120 -0
  600. package/dist/gateway-options-DQGQzdkD.js +26 -0
  601. package/dist/gateway-options-Mut8jih_.d.ts +27 -0
  602. package/dist/guards-CsRa6v57.js +11 -0
  603. package/dist/guest-actions-CEwttioE.js +8 -0
  604. package/dist/guest-actions-DfHHp98H.d.ts +3 -0
  605. package/dist/h3/index.d.ts +2 -6
  606. package/dist/h3/index.js +4 -6
  607. package/dist/h3/v1/index.d.ts +3 -5
  608. package/dist/h3/v1/index.js +4 -5
  609. package/dist/history-6KiVNWdH.js +269 -0
  610. package/dist/hmac-DNcfpmI9.js +22 -0
  611. package/dist/hono/index.d.ts +18 -22
  612. package/dist/hono/index.js +16 -17
  613. package/dist/http-BDC1IvBX.js +27 -0
  614. package/dist/http-BRUI3qim.js +140 -0
  615. package/dist/http-D4lH1xqY.js +39 -0
  616. package/dist/image-url-bsGeybeg.js +83 -0
  617. package/dist/impersonation-BOCJcsmS.d.ts +26 -0
  618. package/dist/impersonation-D-quM36V.js +61 -0
  619. package/dist/inbox-DavCzW7b.d.ts +326 -0
  620. package/dist/index-8w4OB5En.d.ts +102 -0
  621. package/dist/index-BIAtapnD.d.ts +570 -0
  622. package/dist/index-BWR29Vvw.d.ts +76 -0
  623. package/dist/index-BZCmy767.d.ts +234 -0
  624. package/dist/index-BdC2IqkU.d.ts +152 -0
  625. package/dist/index-BgkHbf9C.d.ts +637 -0
  626. package/dist/index-BvcMQYL-.d.ts +326 -0
  627. package/dist/index-CbUXFzQV.d.ts +107 -0
  628. package/dist/index-CiE37wKX.d.ts +289 -0
  629. package/dist/index-D18su_r5.d.ts +402 -0
  630. package/dist/index-DU0UwWvL.d.ts +667 -0
  631. package/dist/index-Dj4VKpYZ.d.ts +49 -0
  632. package/dist/index-Dvpu22CJ.d.ts +291 -0
  633. package/dist/index-IKfbX_39.d.ts +23 -0
  634. package/dist/index-M1izbwbN.d.ts +145 -0
  635. package/dist/index.d.ts +13 -41
  636. package/dist/index.js +29 -34
  637. package/dist/instance-property-BlH7QSDl.js +6 -0
  638. package/dist/instances-D31jrmKh.js +16636 -0
  639. package/dist/invalidate-DAB9CaPm.d.ts +19 -0
  640. package/dist/iso4217-oKsif_hW.js +175 -0
  641. package/dist/json-O5vFw243.js +21 -0
  642. package/dist/json-schema-D9eVL_xi.js +884 -0
  643. package/dist/jwks-cache-IZaiICAV.js +48 -0
  644. package/dist/jws-B8p0ppgh.js +204 -0
  645. package/dist/jws-CxgTsbgG.d.ts +64 -0
  646. package/dist/kit-9pZP5iLU.js +163 -0
  647. package/dist/kit-OgFOW9rX.d.ts +92 -0
  648. package/dist/knowledge-BBC2sfAY.d.ts +215 -0
  649. package/dist/knowledge-DdZzUTQ-.js +299 -0
  650. package/dist/lint/index.d.ts +1 -5
  651. package/dist/lint/index.js +8 -10
  652. package/dist/list/index.d.ts +3 -3
  653. package/dist/list/index.js +3 -3
  654. package/dist/list-query-C7V8kUaD.d.ts +220 -0
  655. package/dist/list-query-D-tgs1eY.js +558 -0
  656. package/dist/live-BVi3q4bX.js +277 -0
  657. package/dist/logger-0LfhvwE4.d.ts +16 -0
  658. package/dist/logger-BkF8ukXV.js +20 -0
  659. package/dist/lookup-upE-e1zw.js +17 -0
  660. package/dist/management-DtX4ic1F.d.ts +55 -0
  661. package/dist/mapper/bin.js +13 -17
  662. package/dist/mcp/index.d.ts +4 -299
  663. package/dist/mcp/index.js +71 -42
  664. package/dist/mcp/sdk/index.d.ts +7 -11
  665. package/dist/mcp/sdk/index.js +12 -14
  666. package/dist/message-Cc4bkdNw.d.ts +97 -0
  667. package/dist/messages-CRk1g6oe.js +512 -0
  668. package/dist/messaging-D5z2TR37.d.ts +295 -0
  669. package/dist/methods-BjfDv4Gy.js +9 -0
  670. package/dist/metric-definition-2KQYeUZ1.d.ts +67 -0
  671. package/dist/metric-definition-D4H6IQT7.js +116 -0
  672. package/dist/mfa-CM5r904M.d.ts +34 -0
  673. package/dist/model-Lxa_mOzB.d.ts +338 -0
  674. package/dist/model-messages-BcrkjsPE.js +205 -0
  675. package/dist/model-messages-CGSUU450.d.ts +32 -0
  676. package/dist/money-BgpAd7d3.d.ts +89 -0
  677. package/dist/money-DH--bbYr.js +196 -0
  678. package/dist/money-codec-SKPm8FPw.js +40 -0
  679. package/dist/my-work-kinds-DNPq3ccL.js +10 -0
  680. package/dist/nestjs/index.d.ts +3 -5
  681. package/dist/nestjs/index.js +5 -6
  682. package/dist/next/client/index.d.ts +1 -5
  683. package/dist/next/client/index.js +2 -4
  684. package/dist/next/image/index.d.ts +1 -3
  685. package/dist/next/image/index.js +2 -3
  686. package/dist/next/index.d.ts +98 -106
  687. package/dist/next/index.js +88 -87
  688. package/dist/node/index.d.ts +3 -3
  689. package/dist/node/index.js +6 -7
  690. package/dist/node-headers-C3FExlg9.js +54 -0
  691. package/dist/node-headers-TnS4T7V_.d.ts +25 -0
  692. package/dist/nuxt/index.d.ts +0 -2
  693. package/dist/nuxt/index.js +1 -2
  694. package/dist/operations-BNFbWv1t.js +28 -0
  695. package/dist/operations-CsCwruKT.d.ts +4 -0
  696. package/dist/optional-peer-5SOYr3lL.js +31 -0
  697. package/dist/options--rohtkkC.js +4 -0
  698. package/dist/options-1iHDmlZ5.js +8 -0
  699. package/dist/options-2QJXZPPS.js +4 -0
  700. package/dist/options-B-JqrC61.d.ts +8 -0
  701. package/dist/options-B3xH2JvJ.js +8 -0
  702. package/dist/options-B4sTqDrt.js +4 -0
  703. package/dist/options-B56njigZ.js +19 -0
  704. package/dist/options-B5A3UmKY.d.ts +17 -0
  705. package/dist/options-B6m9gYRH.d.ts +11 -0
  706. package/dist/options-B7Pl708M.js +8 -0
  707. package/dist/options-B7YrdiUc.js +11 -0
  708. package/dist/options-B8c2_hIB.js +9 -0
  709. package/dist/options-B9w_Y08G.d.ts +6 -0
  710. package/dist/options-BDF60ouf.js +4 -0
  711. package/dist/options-BDMPjyrI.js +4 -0
  712. package/dist/options-BHdHuY5r.js +14 -0
  713. package/dist/options-BLMeCbtT.js +31 -0
  714. package/dist/options-BLQePOPy.d.ts +8 -0
  715. package/dist/options-BLn1PFyu.js +4 -0
  716. package/dist/options-BMO-FnOT.js +7 -0
  717. package/dist/options-BNRvoEkj.js +4 -0
  718. package/dist/options-BPQOiVx2.js +7 -0
  719. package/dist/options-BSTJmfX4.js +10 -0
  720. package/dist/options-BTRH26MJ.js +9 -0
  721. package/dist/options-BTaQszYn.js +9 -0
  722. package/dist/options-BYo7hMHK.js +10 -0
  723. package/dist/options-B_bxCZYM.js +7 -0
  724. package/dist/options-BaBaVWS-.js +10 -0
  725. package/dist/options-BamaRO-q.d.ts +12 -0
  726. package/dist/options-BcBdiPSZ.js +7 -0
  727. package/dist/options-BfY4pyQE.js +23 -0
  728. package/dist/options-BgCS5ODi.js +9 -0
  729. package/dist/options-Bi96Lzuf.js +9 -0
  730. package/dist/options-BjEsSoFp.js +17 -0
  731. package/dist/options-Bkx8vwip.js +4 -0
  732. package/dist/options-BmFSI07A.js +4 -0
  733. package/dist/options-BmwDdKwE.js +7 -0
  734. package/dist/options-Bn3NjXfn.js +7 -0
  735. package/dist/options-BqK4xV67.js +13 -0
  736. package/dist/options-Bs2dC-at.js +11 -0
  737. package/dist/options-BvttpM1M.js +4 -0
  738. package/dist/options-Bwrwb8do.d.ts +10 -0
  739. package/dist/options-BxdqA2Ex.js +19 -0
  740. package/dist/options-BzxR82Tu.js +9 -0
  741. package/dist/options-C-NFS6e3.js +13 -0
  742. package/dist/options-C13-dVMH.js +7 -0
  743. package/dist/options-C1RIyAe1.js +7 -0
  744. package/dist/options-C1kZ3qLd.js +8 -0
  745. package/dist/options-C2RjdunU.js +27 -0
  746. package/dist/options-C4kpi6HE.js +8 -0
  747. package/dist/options-C5MfwOAO.js +8 -0
  748. package/dist/options-C5fKQ3EJ.d.ts +10 -0
  749. package/dist/options-CJR59q8s.js +17 -0
  750. package/dist/options-CJVYQue3.d.ts +10 -0
  751. package/dist/options-CLy7CcMn.js +8 -0
  752. package/dist/options-COfEYic3.js +8 -0
  753. package/dist/options-CRwTY_q2.d.ts +58 -0
  754. package/dist/options-CcW7h8mv.js +9 -0
  755. package/dist/options-Ceu2j1vv.js +7 -0
  756. package/dist/options-CgBKgmI8.js +7 -0
  757. package/dist/options-CgMiQGOF.js +9 -0
  758. package/dist/options-CptvcSmF.js +11 -0
  759. package/dist/options-CsLUAt04.js +8 -0
  760. package/dist/options-CtyjhSGk.js +15 -0
  761. package/dist/options-CuPWezcV.js +7 -0
  762. package/dist/options-CyDOOWlk.js +7 -0
  763. package/dist/options-CyYZvdSy.js +10 -0
  764. package/dist/options-CzIPn0fF.js +4 -0
  765. package/dist/options-CzWjw2HY.js +10 -0
  766. package/dist/options-CztbWdz9.js +4 -0
  767. package/dist/options-D4LuPM8a.js +4 -0
  768. package/dist/options-D4dxMGHF.js +7 -0
  769. package/dist/options-D5a9CHgP.js +7 -0
  770. package/dist/options-D6tpMRvp.d.ts +13 -0
  771. package/dist/options-D848Os4l.js +10 -0
  772. package/dist/options-DCZPW5gR.d.ts +15 -0
  773. package/dist/options-DFSHZFLN.js +4 -0
  774. package/dist/options-DFemc2im.js +9 -0
  775. package/dist/options-DFgHHwzD.js +12 -0
  776. package/dist/options-DNZ9r_Vo.d.ts +8 -0
  777. package/dist/options-DP7NwQPZ.js +4 -0
  778. package/dist/options-DPQaafyc.js +7 -0
  779. package/dist/options-DQkhhBLy.js +4 -0
  780. package/dist/options-DTTz33na.js +9 -0
  781. package/dist/options-DToWdVqW.js +4 -0
  782. package/dist/options-DUNUGuhM.js +4 -0
  783. package/dist/options-DWgpi5ns.js +7 -0
  784. package/dist/options-DeamnVOY.d.ts +12 -0
  785. package/dist/options-Dg7eK-_J.d.ts +8 -0
  786. package/dist/options-DiIlMZpc.js +8 -0
  787. package/dist/options-DjFbIRgV.js +16 -0
  788. package/dist/options-DjtCYRWb.js +4 -0
  789. package/dist/options-Dk6D88Zx.d.ts +6 -0
  790. package/dist/options-DpwRG4tO.js +8 -0
  791. package/dist/options-DvgKdZ2K.js +9 -0
  792. package/dist/options-DwIoRvic.js +4 -0
  793. package/dist/options-GwwLsKf5.js +8 -0
  794. package/dist/options-I1ZHfDP0.d.ts +58 -0
  795. package/dist/options-Itq7QYoW.js +20 -0
  796. package/dist/options-JnPEVbBJ.js +17 -0
  797. package/dist/options-Jwux4JDX.js +7 -0
  798. package/dist/options-Lg76d-cV.js +7 -0
  799. package/dist/options-Lh6uxepF.d.ts +24 -0
  800. package/dist/options-Oki2W_c3.js +4 -0
  801. package/dist/options-PM7IaIFP.js +10 -0
  802. package/dist/options-PTLBl6QT.js +7 -0
  803. package/dist/options-PheFo4JY.js +10 -0
  804. package/dist/options-SlC_jZ7y.js +4 -0
  805. package/dist/options-Sq4bYbf5.js +13 -0
  806. package/dist/options-XiD_Y3oK.js +14 -0
  807. package/dist/options-Z-bd_H1E.js +88 -0
  808. package/dist/options-ax_ssX_m.js +4 -0
  809. package/dist/options-bNB8_nlW.js +23 -0
  810. package/dist/options-eIEk0vqV.js +4 -0
  811. package/dist/options-eLIedotm.js +7 -0
  812. package/dist/options-jg0FMHA5.js +4 -0
  813. package/dist/options-mypVYaqR.js +9 -0
  814. package/dist/options-ompJjxkV.js +4 -0
  815. package/dist/options-pbc4H8_A.js +7 -0
  816. package/dist/options-uUGi0Phf.d.ts +14 -0
  817. package/dist/options-yRwYr4up.js +4 -0
  818. package/dist/options-z2Zhi97E.js +9 -0
  819. package/dist/options-zYV6M0vr.js +8 -0
  820. package/dist/orpc/index.d.ts +13 -19
  821. package/dist/orpc/index.js +20 -23
  822. package/dist/otel/index.d.ts +4 -6
  823. package/dist/otel/index.js +8 -10
  824. package/dist/outbox-7zgh-7nw.d.ts +197 -0
  825. package/dist/payments-B4JchZuJ.js +15 -0
  826. package/dist/payments-BBGSGRQ7.d.ts +112 -0
  827. package/dist/permissions-BDt27oYF.js +48 -0
  828. package/dist/permissions-BP593xxk.d.ts +44 -0
  829. package/dist/permissions-controller-B4uI5IPH.js +33 -0
  830. package/dist/pg-error-D92B6jlF.js +25 -0
  831. package/dist/plugin-Ca2qBiFZ.js +47 -0
  832. package/dist/pool-D-4HyhuW.d.ts +121 -0
  833. package/dist/pool-errors-JrZie6u3.js +26 -0
  834. package/dist/ports-BVLhLUvR.d.ts +87 -0
  835. package/dist/ports-CmEXVqhg.js +150 -0
  836. package/dist/postgres/index.d.ts +5 -11
  837. package/dist/postgres/index.js +7 -9
  838. package/dist/postgrest-DZtM2nIS.d.ts +51 -0
  839. package/dist/postgrest-executor-lf8Mt4J0.js +1064 -0
  840. package/dist/powersync/index.d.ts +7 -25
  841. package/dist/powersync/index.js +14 -24
  842. package/dist/preset/index.d.ts +3 -3
  843. package/dist/preset/index.js +3 -3
  844. package/dist/preset-om2rbdYw.js +1038 -0
  845. package/dist/problem-C0SVHhd3.js +161 -0
  846. package/dist/problem-NGBjN-TO.d.ts +77 -0
  847. package/dist/project-D4ArwcS5.js +1749 -0
  848. package/dist/provider-B6qpleR9.js +56 -0
  849. package/dist/provider-BI0KC4u5.d.ts +142 -0
  850. package/dist/providers-C9sBIBYE.js +62 -0
  851. package/dist/push-token-B0j171on.d.ts +22 -0
  852. package/dist/push-token-CO28k46S.js +15 -0
  853. package/dist/queries-BLrxg_GL.js +238 -0
  854. package/dist/query/index.d.ts +3 -3
  855. package/dist/query/index.js +11 -15
  856. package/dist/range-BN3kpJAE.d.ts +6 -0
  857. package/dist/range-Nrh_qtb_.js +6 -0
  858. package/dist/rank-keys-CEBzd9Xa.js +59 -0
  859. package/dist/rank-result-B_xLQCBV.d.ts +12 -0
  860. package/dist/rank-result-DzaTKKhH.js +17 -0
  861. package/dist/rate-limit-C89Yzwd9.d.ts +48 -0
  862. package/dist/rate-limit-CRhlLFhP.js +380 -0
  863. package/dist/rate-limit-DXJbLVg0.js +48 -0
  864. package/dist/ratelimit-headers-CpB-cDD6.js +61 -0
  865. package/dist/react/index.d.ts +11 -11
  866. package/dist/react/index.js +6 -6
  867. package/dist/react/native/index.d.ts +3 -5
  868. package/dist/react/native/index.js +5 -5
  869. package/dist/react/server.d.ts +13 -15
  870. package/dist/react/server.js +9 -10
  871. package/dist/react/session.d.ts +4 -6
  872. package/dist/react/session.js +2 -3
  873. package/dist/react-COIov1yC.js +1006 -0
  874. package/dist/react-CqOVutZj.js +80 -0
  875. package/dist/react-router/index.d.ts +7 -12
  876. package/dist/react-router/index.js +10 -12
  877. package/dist/read-set-DEDoIHMM.js +198 -0
  878. package/dist/realtime/index.d.ts +7 -7
  879. package/dist/realtime/index.js +6 -7
  880. package/dist/realtime-status-CocmAOPv.js +10 -0
  881. package/dist/realtime-status-D3oUx3o4.d.ts +6 -0
  882. package/dist/record-bindings-jTZw-GVe.js +25 -0
  883. package/dist/record-form-DU2EoVsv.d.ts +80 -0
  884. package/dist/record-type-oQxekQTX.js +219 -0
  885. package/dist/recordings-D69Va7gP.d.ts +117 -0
  886. package/dist/records/index.d.ts +10 -14
  887. package/dist/records/index.js +13 -16
  888. package/dist/refresh-B8t_KE3s.js +142 -0
  889. package/dist/refresh-BtbC2rZe.d.ts +52 -0
  890. package/dist/refusal-5c6UMpUP.js +63 -0
  891. package/dist/refusal-CGi-0Q18.d.ts +30 -0
  892. package/dist/relay-CllqA-lV.js +248 -0
  893. package/dist/resolve--LfVoOMg.d.ts +287 -0
  894. package/dist/resolve-FW8oeXvh.js +927 -0
  895. package/dist/resolved-names-DYYyh35i.js +130 -0
  896. package/dist/resource-BbWk4hoP.js +561 -0
  897. package/dist/resource-DQ4kIBpa.js +104 -0
  898. package/dist/resource-DWllVW8k.d.ts +124 -0
  899. package/dist/resource-execute-DUBYKTYU.d.ts +13 -0
  900. package/dist/resource-schemas-Bq0g2RCQ.js +81 -0
  901. package/dist/resource-types-RgaljPs0.d.ts +155 -0
  902. package/dist/resources-Bki1J4jy.d.ts +5 -0
  903. package/dist/resources-DYSx9NYM.js +63 -0
  904. package/dist/respond-BYOV7KZp.d.ts +108 -0
  905. package/dist/respond-DLH4tD2d.js +106 -0
  906. package/dist/result-8xza7w5W.js +145 -0
  907. package/dist/result-DTOQRyGY.d.ts +347 -0
  908. package/dist/rows-Ce8dsmfM.js +79 -0
  909. package/dist/rows-D-RqIsRz.js +38 -0
  910. package/dist/rrule-BLpe2449.js +289 -0
  911. package/dist/run-keys-BnzqxtYc.d.ts +59 -0
  912. package/dist/run-state-D0Tbl-nM.d.ts +11 -0
  913. package/dist/run-state-DGiyDQxH.js +12 -0
  914. package/dist/run-watch-DJk4Q603.js +52 -0
  915. package/dist/runtime-qslVrC9l.js +43 -0
  916. package/dist/sales-lines-DuNVoKHA.d.ts +36 -0
  917. package/dist/sales-lines-axwWhnLk.js +44 -0
  918. package/dist/sales-shared-CY3s_wBx.js +21 -0
  919. package/dist/sandboxes-B2hBoBvJ.d.ts +85 -0
  920. package/dist/schemas-CpoEiAeT.js +213 -0
  921. package/dist/scope-dD_OAgRU.js +89 -0
  922. package/dist/scores-Bvk_JgXL.js +176 -0
  923. package/dist/scores-FAORS4qU.d.ts +172 -0
  924. package/dist/search-DtbkD0h0.js +8 -0
  925. package/dist/server/index.d.ts +39 -70
  926. package/dist/server/index.js +55 -59
  927. package/dist/server-types-C2hlvhP4.d.ts +521 -0
  928. package/dist/session-B4VasaAA.d.ts +96 -0
  929. package/dist/session-status-D8CBxCqv.d.ts +80 -0
  930. package/dist/shared-Bmcnxwie.js +16 -0
  931. package/dist/shared-Ci1g9nl4.js +90 -0
  932. package/dist/shared-DsBcvj6q.d.ts +9 -0
  933. package/dist/sign-in-BMm1xhKq.js +730 -0
  934. package/dist/sign-in-C9pZE1kM.d.ts +53 -0
  935. package/dist/sign-in-CX1a5i2P.d.ts +52 -0
  936. package/dist/sign-in-CxdoTEp5.js +399 -0
  937. package/dist/signatures-CBn7w4VR.js +144 -0
  938. package/dist/signatures-jPr9JXyw.d.ts +41 -0
  939. package/dist/signers-6ih6i9aq.d.ts +380 -0
  940. package/dist/signing-keys-BC5_hJN5.js +163 -0
  941. package/dist/signing-keys-De09WNJ3.d.ts +117 -0
  942. package/dist/simplify-BzThKn5b.js +82 -0
  943. package/dist/snapshot-BGsJw9xn.d.ts +83 -0
  944. package/dist/snapshot-CVMSyTHH.js +138 -0
  945. package/dist/solid/index.d.ts +12 -22
  946. package/dist/solid/index.js +10 -16
  947. package/dist/solid-start/index.d.ts +6 -9
  948. package/dist/solid-start/index.js +8 -9
  949. package/dist/spec/index.d.ts +6 -48
  950. package/dist/spec/index.js +23 -39
  951. package/dist/spec-6Vr7sc0Z.js +123 -0
  952. package/dist/spec-pins-CuQ2anBw.d.ts +125 -0
  953. package/dist/spec-pins-FKUzgF6K.js +61 -0
  954. package/dist/sql/index.d.ts +6 -5
  955. package/dist/sql/index.js +5 -5
  956. package/dist/sql-C1K5JALb.js +420 -0
  957. package/dist/sql-DiUP7fKX.js +140711 -0
  958. package/dist/sql-type-XWMeZRAl.js +33 -0
  959. package/dist/sqlite/index.d.ts +3 -9
  960. package/dist/sqlite/index.js +5 -8
  961. package/dist/sso-CRnaFJh0.js +216 -0
  962. package/dist/sso-CuzAjsc8.d.ts +159 -0
  963. package/dist/ssr/index.d.ts +5 -5
  964. package/dist/ssr/index.js +3 -3
  965. package/dist/standard-BD2aOUsf.js +24 -0
  966. package/dist/standard-DRX6Ch1j.d.ts +5 -0
  967. package/dist/stats-BTJgRMEp.js +82 -0
  968. package/dist/statuses-BTrQ5H4S.js +27 -0
  969. package/dist/statuses-Bv-0XoYC.js +27 -0
  970. package/dist/storage/index.d.ts +3 -3
  971. package/dist/storage/index.js +27 -40
  972. package/dist/storage-api-COQr77e8.js +9 -0
  973. package/dist/store-CKKzmsWB.js +68 -0
  974. package/dist/store-c7QxUHX-.d.ts +81 -0
  975. package/dist/streams/index.d.ts +3 -7
  976. package/dist/streams/index.js +5 -6
  977. package/dist/streams/redis/index.d.ts +1 -3
  978. package/dist/streams/redis/index.js +6 -7
  979. package/dist/stripe/index.d.ts +1 -3
  980. package/dist/stripe/index.js +3 -4
  981. package/dist/stripe-Bl-sjnl6.d.ts +154 -0
  982. package/dist/stripe-DKRwRWew.js +31 -0
  983. package/dist/subject-readers-BARV5rNp.js +48 -0
  984. package/dist/subject-readers-BlD8tALG.d.ts +19 -0
  985. package/dist/subject-type-BarjdHZV.js +7 -0
  986. package/dist/subjects-BGwLJ3IB.d.ts +148 -0
  987. package/dist/subjects-Bv2dPflD.d.ts +86 -0
  988. package/dist/subscribers-C57054Pc.js +32 -0
  989. package/dist/summaries-CUemsYwV.d.ts +67 -0
  990. package/dist/supabase-mcp-DY32eoax.d.ts +44 -0
  991. package/dist/supabase-mcp-QvebHckf.js +27 -0
  992. package/dist/support-DxYI6sDM.d.ts +351 -0
  993. package/dist/support-view-CvDEgyGY.js +17 -0
  994. package/dist/support-view-DSmCett7.d.ts +15 -0
  995. package/dist/svelte/index.d.ts +11 -21
  996. package/dist/svelte/index.js +9 -15
  997. package/dist/sveltekit/index.d.ts +9 -14
  998. package/dist/sveltekit/index.js +12 -14
  999. package/dist/table-schema-CwXg7oBz.d.ts +77 -0
  1000. package/dist/table-schema-D-ss9ozY.js +291 -0
  1001. package/dist/tables-BSiVuKKx.js +72 -0
  1002. package/dist/tags--k2fbPfO.d.ts +28 -0
  1003. package/dist/tags-CW-KvjdL.js +38 -0
  1004. package/dist/tanstack-db/index.d.ts +4 -8
  1005. package/dist/tanstack-db/index.js +4 -6
  1006. package/dist/tanstack-start/index.d.ts +7 -12
  1007. package/dist/tanstack-start/index.js +8 -10
  1008. package/dist/tax-BD9dN1rx.d.ts +168 -0
  1009. package/dist/tax-BwckP5dv.js +139 -0
  1010. package/dist/tee-CVOMhEX-.js +100 -0
  1011. package/dist/template-CNq9xcfx.js +125 -0
  1012. package/dist/temporal-DKTdGK9i.js +94 -0
  1013. package/dist/temporal-required-w_2u4EDp.js +19 -0
  1014. package/dist/tenant-B3IIq8Eq.d.ts +14 -0
  1015. package/dist/tenant-Beqd7TTq.js +48 -0
  1016. package/dist/tenant-source-46lMuMEn.js +7 -0
  1017. package/dist/testing/index.d.ts +120 -127
  1018. package/dist/testing/index.js +277 -129
  1019. package/dist/timeline-Bq658xsi.d.ts +147 -0
  1020. package/dist/timeline-Bs-FGMIJ.js +49 -0
  1021. package/dist/timing-B6yHayKA.js +94 -0
  1022. package/dist/topic-D2MyBeaI.d.ts +411 -0
  1023. package/dist/topic-k17VvXRj.js +640 -0
  1024. package/dist/transport-CS4cVH4S.js +30 -0
  1025. package/dist/ttl-cache-C5S0L2wx.js +31 -0
  1026. package/dist/types-BBqP9H6w.d.ts +175 -0
  1027. package/dist/types-BFEKRmEK.d.ts +449 -0
  1028. package/dist/types-BkYEUWdz.d.ts +1095 -0
  1029. package/dist/types-C8UyJOPJ.d.ts +247 -0
  1030. package/dist/types-DCoqai8o.d.ts +215 -0
  1031. package/dist/types-Dh2OGEW5.d.ts +648 -0
  1032. package/dist/types-DnrJ_crV.js +28 -0
  1033. package/dist/types-TH3zlMiM.d.ts +192 -0
  1034. package/dist/types-d0JBRTAg.d.ts +660 -0
  1035. package/dist/undo-22ofP6Zp.d.ts +44 -0
  1036. package/dist/undo-Dki6Ujak.js +43 -0
  1037. package/dist/upload-claim-Bo2mpBz4.js +32 -0
  1038. package/dist/usage-CNCT6_3D.d.ts +230 -0
  1039. package/dist/user-change-Ngy8z1fZ.js +133 -0
  1040. package/dist/variants-BaMleC56.js +51 -0
  1041. package/dist/vault-yGQD5Rdl.d.ts +60 -0
  1042. package/dist/vercel-connect/index.d.ts +194 -20
  1043. package/dist/vercel-connect/index.js +265 -33
  1044. package/dist/vercel-sandbox/index.d.ts +166 -0
  1045. package/dist/vercel-sandbox/index.js +171 -0
  1046. package/dist/verify-BQu3eBNW.d.ts +144 -0
  1047. package/dist/verify-DY_j4GPZ.js +129 -0
  1048. package/dist/view-BfEqjZJ_.js +117 -0
  1049. package/dist/view-Cy2XxYp1.d.ts +107 -0
  1050. package/dist/vue/index.d.ts +12 -22
  1051. package/dist/vue/index.js +10 -16
  1052. package/dist/watch-topic-C2KxpeaB.js +56 -0
  1053. package/dist/watch-topic-q6krNw0T.d.ts +29 -0
  1054. package/dist/wire-DIoLA8VL.js +90 -0
  1055. package/dist/wiring-DJBSLdyF.js +12 -0
  1056. package/dist/workflow-sdk/builder/index.d.ts +12 -14
  1057. package/dist/workflow-sdk/builder/index.js +12 -11
  1058. package/dist/workflow-sdk/index.d.ts +62 -6
  1059. package/dist/workflow-sdk/index.js +75 -10
  1060. package/dist/workflow-sdk/world/index.d.ts +13 -20
  1061. package/dist/workflow-sdk/world/index.js +115 -26
  1062. package/dist/workflow-sdk-BL3wzkdp.js +2749 -0
  1063. package/dist/workflow-sdk-q2jnEaAJ.js +302 -0
  1064. package/dist/workflow-sdk-yIkECybp.d.ts +171 -0
  1065. package/dist/workflows-BljkWRxE.d.ts +256 -0
  1066. package/dist/yjs/index.d.ts +3 -5
  1067. package/dist/yjs/index.js +6 -7
  1068. package/package.json +56 -31
  1069. package/schemas/config-v1.json +60 -3
  1070. package/schemas/doctor-report-v1.json +1 -0
  1071. package/schemas/snapshot-v2.json +7 -0
  1072. package/skills/better-supabase/SKILL.md +4 -4
  1073. package/skills/better-supabase/references/block-extensions.md +2 -2
  1074. package/skills/better-supabase/references/troubleshooting.md +1 -1
  1075. package/skills/better-supabase/references/ui-recipes.md +73 -36
  1076. package/skills/better-supabase-api/SKILL.md +1 -1
  1077. package/skills/better-supabase-api/references/adapters.md +3 -3
  1078. package/skills/better-supabase-api/references/ai.md +8 -0
  1079. package/skills/better-supabase-auth/SKILL.md +19 -19
  1080. package/skills/better-supabase-auth/references/authorization-providers.md +1 -1
  1081. package/dist/access-sql-CTDNuxRv.js +0 -385
  1082. package/dist/actor-CoveJgya.d.ts +0 -106
  1083. package/dist/actor-go7p9-CJ.js +0 -150
  1084. package/dist/adapter-BTbj5N9C.js +0 -2251
  1085. package/dist/agents-CM_cCtcr.d.ts +0 -117
  1086. package/dist/ai-cache-BFRKxgZ4.js +0 -87
  1087. package/dist/ai-cache-BTGqckta.d.ts +0 -82
  1088. package/dist/ai-chat-B7_vQvxU.d.ts +0 -619
  1089. package/dist/ai-files-m_2z3rH1.js +0 -339
  1090. package/dist/ai-message-DfaP8sis.js +0 -14
  1091. package/dist/ai-schedules-CZEfo-_M.d.ts +0 -166
  1092. package/dist/anchors-7F34QyHa.d.ts +0 -40
  1093. package/dist/api-3C0AWFeP.js +0 -696
  1094. package/dist/api-59rv5hL6.d.ts +0 -495
  1095. package/dist/api-keys-JE-aykZE.d.ts +0 -213
  1096. package/dist/app-tables-B2mKMNRQ.d.ts +0 -28
  1097. package/dist/approvals-BfEafAzt.d.ts +0 -129
  1098. package/dist/assistant-B49qATbj.d.ts +0 -157
  1099. package/dist/attachments-BXbLnNxm.js +0 -376
  1100. package/dist/attributes-Bzf51_nc.js +0 -47
  1101. package/dist/auth-DyF_LRxd.js +0 -20
  1102. package/dist/auth-link-B4NL84XU.d.ts +0 -104
  1103. package/dist/auth-link-D3-bU6yz.js +0 -118
  1104. package/dist/auth-module-BbmX-N4L.js +0 -52
  1105. package/dist/auth-reply-Dj124sbX.d.ts +0 -11
  1106. package/dist/auth-reply-tlXB2FQ9.js +0 -31
  1107. package/dist/authorization-DfEkyFt_.d.ts +0 -3867
  1108. package/dist/authorization-hooks-BWhkMZfH.d.ts +0 -221
  1109. package/dist/authorizer-B6X09otb.d.ts +0 -118
  1110. package/dist/authorizer-BGhXaDmo.js +0 -172
  1111. package/dist/automation-D41DXyvT.js +0 -75
  1112. package/dist/automations-8L3NEuoq.js +0 -29
  1113. package/dist/automations-BKjJpktQ.js +0 -33
  1114. package/dist/automations-BMuqwZZn.js +0 -314
  1115. package/dist/automations-EzXteupo.js +0 -31
  1116. package/dist/availability-BdeKCHpl.d.ts +0 -236
  1117. package/dist/base64-B9Wlsdj7.js +0 -42
  1118. package/dist/batch-limit-DKVQDz4o.js +0 -5
  1119. package/dist/before-route-B23K2zYU.js +0 -30
  1120. package/dist/bind-DAx0bMSi.d.ts +0 -104
  1121. package/dist/block-authors-Bw3zdzgl.js +0 -14
  1122. package/dist/block-authors-DzXLUiIq.d.ts +0 -12
  1123. package/dist/block-env-Dz7Caxk0.d.ts +0 -32
  1124. package/dist/block-event-listener-Bu6G0TFH.js +0 -16
  1125. package/dist/block-events-IWAyafO3.js +0 -83
  1126. package/dist/block-fields-BE7pInWZ.d.ts +0 -58
  1127. package/dist/block-fields-BjXgX_5c.js +0 -140
  1128. package/dist/block-helpers-B0f0ZVb5.js +0 -437
  1129. package/dist/block-helpers-D5emQ2O6.d.ts +0 -62
  1130. package/dist/block-hooks-B8itxzEE.d.ts +0 -117
  1131. package/dist/block-hooks-DKtz0HRh.js +0 -130
  1132. package/dist/block-method-C9hWdHom.js +0 -21
  1133. package/dist/block-method-CiVa2G-J.d.ts +0 -14
  1134. package/dist/block-subjects-C1_9DkSA.d.ts +0 -6
  1135. package/dist/block-subjects-DFSuFY1a.js +0 -55
  1136. package/dist/block-tenant-DHp7subc.js +0 -14
  1137. package/dist/block-transport-9EUA3q_I.d.ts +0 -69
  1138. package/dist/bookings-xsmM2TA_.d.ts +0 -289
  1139. package/dist/bucket-SvRQwYS4.d.ts +0 -705
  1140. package/dist/build-CH2N3Yf0.js +0 -2073
  1141. package/dist/build-DbIRFcHQ.js +0 -735
  1142. package/dist/carrier-KzeYXVrW.d.ts +0 -169
  1143. package/dist/casing-DdFWEtqr.js +0 -16
  1144. package/dist/channel-JcMd5lNP.d.ts +0 -105
  1145. package/dist/channels-CfcFPuo_.js +0 -114
  1146. package/dist/claims-Bp9My7XP.js +0 -88
  1147. package/dist/claims-DTy6R6my.js +0 -63
  1148. package/dist/cli/_format-Cax5EsM9.js +0 -101
  1149. package/dist/cli/add-B9wP0YGU.js +0 -99
  1150. package/dist/cli/add-DjZXKd7X.js +0 -1231
  1151. package/dist/cli/add-ZcEOEK23.js +0 -1
  1152. package/dist/cli/agent-CbuPvI2x.js +0 -185
  1153. package/dist/cli/app-table-files-mtvjHa48.js +0 -346
  1154. package/dist/cli/arazzo-1.0-BalU61-_.js +0 -532
  1155. package/dist/cli/arazzo-1.1-Bnfasbun.js +0 -705
  1156. package/dist/cli/args-UEwg0l-N.js +0 -27
  1157. package/dist/cli/asyncapi-3.0.0-C78dBjR6.js +0 -5593
  1158. package/dist/cli/asyncapi-3.1.0-g-7aIfV1.js +0 -5833
  1159. package/dist/cli/backfill-Coshdvh_.js +0 -293
  1160. package/dist/cli/blocks-BWCuA0nq.js +0 -156
  1161. package/dist/cli/blocks-hiSazThw.js +0 -1
  1162. package/dist/cli/cache-x2wWAy0h.js +0 -607
  1163. package/dist/cli/codemod-BnjV7BpC.js +0 -2634
  1164. package/dist/cli/codemod-block-renames-BuSaTE_G.js +0 -239
  1165. package/dist/cli/command-CCAwhiOh.js +0 -1003
  1166. package/dist/cli/compare-BmIWVEui.js +0 -9
  1167. package/dist/cli/completion-BJaB84Pe.js +0 -211
  1168. package/dist/cli/completion-BkUhs1ms.js +0 -1
  1169. package/dist/cli/completion-DmUVsUVQ.js +0 -30
  1170. package/dist/cli/config-Cskysxp-.js +0 -2000
  1171. package/dist/cli/config-Df5cXWNN.js +0 -1
  1172. package/dist/cli/config-edit-CrWfk8s3.js +0 -621
  1173. package/dist/cli/config-group-CP-B9uRt.js +0 -390
  1174. package/dist/cli/config-zId1jkLx.js +0 -47
  1175. package/dist/cli/content-mapper-DvOSOdTE.js +0 -182
  1176. package/dist/cli/db-CQCLx7cx.js +0 -78
  1177. package/dist/cli/db-DXKyVEDF.js +0 -247
  1178. package/dist/cli/detect-D9JaAX20.js +0 -84
  1179. package/dist/cli/dist-D_VbPAMR.js +0 -129
  1180. package/dist/cli/dist-DuiMMRbJ.js +0 -1112
  1181. package/dist/cli/doctor-Ywy8oJEU.js +0 -4684
  1182. package/dist/cli/env-BK0xKMeU.js +0 -1113
  1183. package/dist/cli/env-Bat6ogep.js +0 -1
  1184. package/dist/cli/env-CNjT_uOV.js +0 -1
  1185. package/dist/cli/env-XMiKvhtV.js +0 -143
  1186. package/dist/cli/errors-BTe6A15O.js +0 -98
  1187. package/dist/cli/exec-Ca5s-ygi.js +0 -463
  1188. package/dist/cli/fastest-levenshtein-dhRRvrM2.js +0 -120
  1189. package/dist/cli/files-CX71yBm8.js +0 -1010
  1190. package/dist/cli/fresh-import-DzgsGHkX.js +0 -40
  1191. package/dist/cli/gen-B-FbQmG1.js +0 -394
  1192. package/dist/cli/guards-CUlDNYZs.js +0 -8
  1193. package/dist/cli/in-stack-diff-Cp-tVPj2.js +0 -186
  1194. package/dist/cli/init-fb9e1BKX.js +0 -559
  1195. package/dist/cli/io-DH1kcmmP.js +0 -37
  1196. package/dist/cli/json5-ChRycquj.js +0 -787
  1197. package/dist/cli/jsonc-C8M0EhHB.js +0 -1
  1198. package/dist/cli/jsonc-D5Fu67jw.js +0 -45
  1199. package/dist/cli/keys-ORiPz1sM.js +0 -106
  1200. package/dist/cli/legacy-prefix-R7UChFFl.js +0 -154
  1201. package/dist/cli/live-DIt7TP-N.js +0 -341
  1202. package/dist/cli/mcp-CVWwraga.js +0 -241
  1203. package/dist/cli/metadata-CannIjel.js +0 -150
  1204. package/dist/cli/migrate-Ht2TzIQF.js +0 -46
  1205. package/dist/cli/migration-safety-nNyB05I-.js +0 -928
  1206. package/dist/cli/migrations-bAd7dpk1.js +0 -117
  1207. package/dist/cli/module-migration-CkNux8dr.js +0 -119
  1208. package/dist/cli/moved-C3WyRHkA.js +0 -254
  1209. package/dist/cli/ohash-BjQY1cBb.js +0 -277
  1210. package/dist/cli/openapi-3.0-t7xwkuRH.js +0 -928
  1211. package/dist/cli/openapi-3.1-CVze7tBS.js +0 -870
  1212. package/dist/cli/openapi-3.2-CFoMYM01.js +0 -1031
  1213. package/dist/cli/orphans-BAboqyVM.js +0 -28
  1214. package/dist/cli/parse-DjHbTaFI.js +0 -182
  1215. package/dist/cli/powersync-B2v0tDwp.js +0 -377
  1216. package/dist/cli/powersync-D3mAQ6QE.js +0 -1
  1217. package/dist/cli/preset-BwmIfFnh.js +0 -101
  1218. package/dist/cli/print-CxQ0rBKT.js +0 -68
  1219. package/dist/cli/prompts-jqnr94b9.js +0 -1140
  1220. package/dist/cli/providers-DtI90lSw.js +0 -301
  1221. package/dist/cli/redact-KGAk2Ul9.js +0 -38
  1222. package/dist/cli/remove-DYtE4IZ4.js +0 -239
  1223. package/dist/cli/render-QGWfEoiB.js +0 -2225
  1224. package/dist/cli/rolldown-runtime-kJ_i4yPo.js +0 -26
  1225. package/dist/cli/run-B5aMwErM.js +0 -63
  1226. package/dist/cli/run-BNoJKf5I.js +0 -706
  1227. package/dist/cli/run-DiYX1XEa.js +0 -1459
  1228. package/dist/cli/seed-C-Hu2n_E.js +0 -188
  1229. package/dist/cli/seed-Cm-c0BDd.js +0 -1
  1230. package/dist/cli/shared-D_CFi5di.js +0 -151
  1231. package/dist/cli/shell-Btv_4Yhe.js +0 -10
  1232. package/dist/cli/skills-D98y0bSB.js +0 -121
  1233. package/dist/cli/snapshot-BlQ4DDcJ.js +0 -734
  1234. package/dist/cli/source-CelMBQMj.js +0 -320
  1235. package/dist/cli/source-args-v8ljFDfc.js +0 -59
  1236. package/dist/cli/spec-BxcoGE0h.js +0 -1
  1237. package/dist/cli/spec-iBx1LcYO.js +0 -7530
  1238. package/dist/cli/sql-layout-Dp4Rottt.js +0 -261
  1239. package/dist/cli/stack-B2slzrYH.js +0 -135
  1240. package/dist/cli/stack-env-3ziggrU3.js +0 -93
  1241. package/dist/cli/stack-status-BkkYRlXG.js +0 -46
  1242. package/dist/cli/stacks-CiDBH1dB.js +0 -232
  1243. package/dist/cli/style-Bm2X5JrN.js +0 -35
  1244. package/dist/cli/supabase-toml-CncmQbO0.js +0 -1164
  1245. package/dist/cli/sync-BnORI43S.js +0 -322
  1246. package/dist/cli/table-D6HUECKI.js +0 -89
  1247. package/dist/cli/toml-DB-MNnFs.js +0 -424
  1248. package/dist/cli/topics-BpdnYmWb.js +0 -30
  1249. package/dist/cli/trace-VbdO6bcN.js +0 -7
  1250. package/dist/cli/upgrade-CR6-WmIc.js +0 -272
  1251. package/dist/cli/upgrade-fz92aCnh.js +0 -41
  1252. package/dist/cli/validate-B3lF3-jB.js +0 -7522
  1253. package/dist/cli/version-Dz8ZlOuh.js +0 -4
  1254. package/dist/cli/yaml-CYCbJ6et.js +0 -2252
  1255. package/dist/client-C_mlji5R.js +0 -288
  1256. package/dist/clone-CkG0-hlI.js +0 -33
  1257. package/dist/cloud-event-0pQ9vFNS.d.ts +0 -64
  1258. package/dist/cloud-event-XsM53POL.js +0 -63
  1259. package/dist/codecs-CMWlhHZ0.d.ts +0 -222
  1260. package/dist/codecs-CSUFGrdP.js +0 -358
  1261. package/dist/compiler-BEeVWXPS.d.ts +0 -14
  1262. package/dist/compose-DKW0Tr3e.js +0 -53
  1263. package/dist/composite-B4qB6k31.js +0 -130
  1264. package/dist/composite-BJ9s-IJJ.d.ts +0 -83
  1265. package/dist/config-B7g-HDis.js +0 -1111
  1266. package/dist/config-R0m0fBiD.js +0 -1679
  1267. package/dist/connectors-uC5baoFV.d.ts +0 -147
  1268. package/dist/context-DBicfUNz.js +0 -41
  1269. package/dist/context-DWWoP1wK.d.ts +0 -4344
  1270. package/dist/controller-BEliOBOv.js +0 -79
  1271. package/dist/controller-Br9dGKGe.d.ts +0 -52
  1272. package/dist/controller-W97g2WGG.js +0 -73
  1273. package/dist/conversion-Dq1S7xzE.js +0 -77
  1274. package/dist/conversion-g8HzH9My.d.ts +0 -86
  1275. package/dist/cors-h_v7TPxl.js +0 -24
  1276. package/dist/cors-kLq6VM06.d.ts +0 -15
  1277. package/dist/create-blocks-BfrDUSM6.js +0 -370
  1278. package/dist/cron-DdT4ti8a.js +0 -148
  1279. package/dist/cron-route-FjKgRvTY.js +0 -24
  1280. package/dist/csv-2rXGPNtP.js +0 -89
  1281. package/dist/csv-DhHQS2x_.d.ts +0 -28
  1282. package/dist/data-engine-D1BkmBoR.js +0 -173
  1283. package/dist/data-engine-rvbR2C4F.d.ts +0 -273
  1284. package/dist/data-hooks-CdcZfVS1.js +0 -280
  1285. package/dist/db-exception-Lngc1W49.js +0 -31
  1286. package/dist/deal-forecast-CKBnRodz.js +0 -39
  1287. package/dist/deal-forecast-LwO-Z4_C.d.ts +0 -23
  1288. package/dist/define-D-dLADd5.js +0 -2084
  1289. package/dist/define-D8_9X5fZ.d.ts +0 -1263
  1290. package/dist/define-block-BGqOO8B3.js +0 -64
  1291. package/dist/define-block-DWVZSZv1.d.ts +0 -1687
  1292. package/dist/delegation-C7eWP2r8.d.ts +0 -14
  1293. package/dist/delegation-DGOIiT8k.js +0 -153
  1294. package/dist/delivery-Bm0jxmzI.js +0 -29
  1295. package/dist/delivery-events-DbL8IHIY.js +0 -53
  1296. package/dist/delivery-n6lZGuGx.d.ts +0 -71
  1297. package/dist/documents-BbwYyynk.d.ts +0 -152
  1298. package/dist/email-B3YxEzwC.d.ts +0 -42
  1299. package/dist/embeddings-I3s5sTDt.d.ts +0 -78
  1300. package/dist/embeddings-vVzseUw0.js +0 -128
  1301. package/dist/ended-EZzN9QTM.d.ts +0 -26
  1302. package/dist/entitlements-CBjm2lvD.d.ts +0 -54
  1303. package/dist/entitlements-tGL6-69B.js +0 -45
  1304. package/dist/entity-naming-Dtyq5sKE.js +0 -131
  1305. package/dist/entity-schema-B1YmMtP8.js +0 -39
  1306. package/dist/envelope-DEI2iX-d.js +0 -90
  1307. package/dist/errors-BVFgt8BZ.js +0 -328
  1308. package/dist/errors-CyxMxzlu.js +0 -44
  1309. package/dist/escape-like-DHfx6jRr.js +0 -7
  1310. package/dist/escape-like-PReMbEEU.d.ts +0 -30
  1311. package/dist/eve-BfhVFV33.d.ts +0 -157
  1312. package/dist/event-calendar-DVLs2wUO.d.ts +0 -65
  1313. package/dist/event-map-CtPFhcOp.js +0 -19
  1314. package/dist/events-B2qbZps6.d.ts +0 -854
  1315. package/dist/events-D6IZ5CE8.js +0 -82
  1316. package/dist/events-DuLhzjP6.js +0 -26
  1317. package/dist/executor-BfirBzOr.d.ts +0 -174
  1318. package/dist/executor-BlS0kCrN.d.ts +0 -104
  1319. package/dist/executor-C2Ne-Scm.js +0 -208
  1320. package/dist/executor-DXQIx4sW.d.ts +0 -37
  1321. package/dist/executor-DqIci3Jb.js +0 -486
  1322. package/dist/executor-WolvKszH.js +0 -843
  1323. package/dist/extension-DTaHjwdc.js +0 -59
  1324. package/dist/extension-DeAd_MqI.js +0 -121
  1325. package/dist/extension-DzCc0IOd.js +0 -103
  1326. package/dist/extension-mGylYROs.js +0 -53
  1327. package/dist/extension-shared-Djm8mGHD.js +0 -60
  1328. package/dist/extra-CGQ2_q3S.js +0 -10
  1329. package/dist/field-errors-CEjsMAgd.d.ts +0 -216
  1330. package/dist/field-formats-C6QKA3UR.js +0 -102
  1331. package/dist/field-formats-CAFNkKSN.d.ts +0 -38
  1332. package/dist/fields-BBm49w-E.js +0 -108
  1333. package/dist/fields-snbaZ14h.d.ts +0 -78
  1334. package/dist/filter-evaluate-BRpNiNPG.d.ts +0 -37
  1335. package/dist/filter-evaluate-lCToXzZI.js +0 -217
  1336. package/dist/filter-query-CQ6d5GnQ.js +0 -566
  1337. package/dist/filter-query-DBt7OKuH.d.ts +0 -133
  1338. package/dist/flags-DDKTThrO.d.ts +0 -246
  1339. package/dist/flags-DF_SCqp5.js +0 -279
  1340. package/dist/form-definition-BTpM_tz1.js +0 -363
  1341. package/dist/form-definition-BjEtH8BT.d.ts +0 -119
  1342. package/dist/format-u-65igKI.d.ts +0 -79
  1343. package/dist/framework-CqiZk89W.js +0 -58
  1344. package/dist/framework-DVYTtQXA.d.ts +0 -47
  1345. package/dist/function-contract-DxFNOmsm.d.ts +0 -27
  1346. package/dist/function-contract-pEmsaUIf.js +0 -8
  1347. package/dist/gateway-Ve7cByEr.d.ts +0 -115
  1348. package/dist/gateway-options-BlVCqgb8.d.ts +0 -29
  1349. package/dist/gateway-options-Cl74B7k6.js +0 -27
  1350. package/dist/guards-6F2bCtQR.js +0 -12
  1351. package/dist/guest-actions-1T1DeS5Y.d.ts +0 -5
  1352. package/dist/guest-actions-B7zdhfnh.js +0 -9
  1353. package/dist/history-GH1HJWQV.js +0 -271
  1354. package/dist/hmac-B3CTTlfv.js +0 -23
  1355. package/dist/http-7-UvHjQe.js +0 -28
  1356. package/dist/http-BjjojWg3.js +0 -40
  1357. package/dist/http-DzbloBR-.js +0 -141
  1358. package/dist/image-url-_d7xYsXK.js +0 -84
  1359. package/dist/impersonation-DM3oWNoD.js +0 -62
  1360. package/dist/impersonation-YTa9dZUv.d.ts +0 -28
  1361. package/dist/inbox-c8B86Trp.d.ts +0 -321
  1362. package/dist/index-B4wttiLh.d.ts +0 -407
  1363. package/dist/index-Clyd2Goi.d.ts +0 -338
  1364. package/dist/index-Cxsnd-OL.d.ts +0 -305
  1365. package/dist/index-D98bQs8a.d.ts +0 -665
  1366. package/dist/index-DIdPoQtO.d.ts +0 -240
  1367. package/dist/index-DbyDZZlc.d.ts +0 -53
  1368. package/dist/index-I8YLxKq8.d.ts +0 -729
  1369. package/dist/index-NRMMhhEi.d.ts +0 -104
  1370. package/dist/index-X2fkPUwb.d.ts +0 -51
  1371. package/dist/index-eRBuKtMt.d.ts +0 -158
  1372. package/dist/index-pZn6S_iq.d.ts +0 -149
  1373. package/dist/index-uIU65iEn.d.ts +0 -588
  1374. package/dist/instance-property-hRh88y_s.js +0 -7
  1375. package/dist/instances-DY_ORk5g.js +0 -16605
  1376. package/dist/invalidate-DMp4eqfF.d.ts +0 -21
  1377. package/dist/iso4217-B-durg_y.js +0 -176
  1378. package/dist/json-DaByVJpw.js +0 -22
  1379. package/dist/json-schema-DHJxiizN.js +0 -888
  1380. package/dist/jwks-cache-DEsKI0hJ.js +0 -49
  1381. package/dist/jws-D0toeQlA.d.ts +0 -66
  1382. package/dist/jws-DOgHJKHb.js +0 -205
  1383. package/dist/kit-B8yWCRN7.d.ts +0 -94
  1384. package/dist/kit-Bcd9wYCV.js +0 -133
  1385. package/dist/knowledge-CsLPACGJ.d.ts +0 -217
  1386. package/dist/knowledge-tCrrU99q.js +0 -300
  1387. package/dist/list-query-BcU8NnNL.d.ts +0 -222
  1388. package/dist/list-query-BnpA2BDg.js +0 -559
  1389. package/dist/live-C21DgbsD.js +0 -275
  1390. package/dist/logger-DWVYUmwi.d.ts +0 -18
  1391. package/dist/logger-glM28NVN.js +0 -21
  1392. package/dist/lookup-BaP5bI27.js +0 -18
  1393. package/dist/management-wtecfrNf.d.ts +0 -57
  1394. package/dist/message-Bg4TKA12.d.ts +0 -99
  1395. package/dist/messages-ecPW_nOv.js +0 -492
  1396. package/dist/messaging-DQP09JsY.d.ts +0 -297
  1397. package/dist/methods-Cund9ZBe.js +0 -11
  1398. package/dist/metric-definition-BjxVn4R5.js +0 -117
  1399. package/dist/metric-definition-EAYI1r2n.d.ts +0 -69
  1400. package/dist/mfa-oIOYTpvc.d.ts +0 -36
  1401. package/dist/model-hwpvole9.d.ts +0 -340
  1402. package/dist/model-messages-CkZSDDHP.js +0 -206
  1403. package/dist/model-messages-DrR4lZ_c.d.ts +0 -34
  1404. package/dist/money-BNRdJQzA.d.ts +0 -91
  1405. package/dist/money-BZl985O-.js +0 -197
  1406. package/dist/money-codec-BJuS2zEW.js +0 -41
  1407. package/dist/my-work-kinds-BU3SlA-6.js +0 -11
  1408. package/dist/node-headers-BPtMP4_V.d.ts +0 -27
  1409. package/dist/node-headers-C71zNQHe.js +0 -55
  1410. package/dist/operations-DVHRHvv6.js +0 -29
  1411. package/dist/operations-hm1Isvvs.d.ts +0 -6
  1412. package/dist/optional-peer-C1NbBRJm.js +0 -32
  1413. package/dist/options-3OYOU56e.js +0 -11
  1414. package/dist/options-56zYYXxc.js +0 -10
  1415. package/dist/options-5WvWOkAm.d.ts +0 -26
  1416. package/dist/options-62woPFn3.js +0 -12
  1417. package/dist/options-7ixoOoap.js +0 -10
  1418. package/dist/options-9dSU5RML.js +0 -5
  1419. package/dist/options-B0YZtAkb.d.ts +0 -15
  1420. package/dist/options-B2Kz_tCx.js +0 -10
  1421. package/dist/options-B5E2MGIz.js +0 -15
  1422. package/dist/options-B685YSzQ.js +0 -5
  1423. package/dist/options-B692WoK6.js +0 -9
  1424. package/dist/options-BHU1wc74.js +0 -5
  1425. package/dist/options-BHy0Z5Zd.js +0 -5
  1426. package/dist/options-BJtdsK7b.js +0 -8
  1427. package/dist/options-BKDxrPvE.js +0 -5
  1428. package/dist/options-BLfymS4s.js +0 -5
  1429. package/dist/options-BOCRbzh3.js +0 -5
  1430. package/dist/options-BOqfYsM1.js +0 -13
  1431. package/dist/options-BQWJqwHO.js +0 -9
  1432. package/dist/options-BQunK6_Y.js +0 -8
  1433. package/dist/options-BQyrZjwM.js +0 -28
  1434. package/dist/options-BR9xTHZW.js +0 -5
  1435. package/dist/options-BRUdd5jY.js +0 -8
  1436. package/dist/options-BSsYXjhC.js +0 -9
  1437. package/dist/options-BTmaRzx2.d.ts +0 -60
  1438. package/dist/options-BUCQYAeJ.d.ts +0 -10
  1439. package/dist/options-B_NrjVDt.d.ts +0 -12
  1440. package/dist/options-BawzwlmC.js +0 -11
  1441. package/dist/options-BbLDAp7G.d.ts +0 -10
  1442. package/dist/options-BfPsL7E2.js +0 -9
  1443. package/dist/options-Bfmwwc78.js +0 -8
  1444. package/dist/options-BhsdveDk.js +0 -21
  1445. package/dist/options-BomoTH-8.js +0 -5
  1446. package/dist/options-BtjkzIVh.js +0 -8
  1447. package/dist/options-Bvi9bl4H.js +0 -5
  1448. package/dist/options-BwKNmaJo.js +0 -5
  1449. package/dist/options-BxpLtyk-.js +0 -18
  1450. package/dist/options-BzB2QxL3.js +0 -5
  1451. package/dist/options-C078wBP0.js +0 -5
  1452. package/dist/options-C3AdsFJ6.js +0 -9
  1453. package/dist/options-C7C5OhmL.d.ts +0 -8
  1454. package/dist/options-C87u6eSa.js +0 -10
  1455. package/dist/options-CBAEGxwS.js +0 -8
  1456. package/dist/options-CDSCkYxu.d.ts +0 -14
  1457. package/dist/options-CDUr8zzX.js +0 -8
  1458. package/dist/options-CF6EVF_G.js +0 -17
  1459. package/dist/options-CFjGxfa8.js +0 -5
  1460. package/dist/options-CI6P0xhV.js +0 -10
  1461. package/dist/options-CJFMK9A_.js +0 -8
  1462. package/dist/options-CLpgx7en.js +0 -10
  1463. package/dist/options-CSCXNYJO.d.ts +0 -8
  1464. package/dist/options-CTXHj9zr.js +0 -16
  1465. package/dist/options-CTl8T88w.js +0 -11
  1466. package/dist/options-CUIOOv4z.js +0 -15
  1467. package/dist/options-CZDmtsbV.js +0 -8
  1468. package/dist/options-CZTscdPB.js +0 -5
  1469. package/dist/options-CZdKndeo.js +0 -9
  1470. package/dist/options-C_7g9TTq.d.ts +0 -12
  1471. package/dist/options-Cb2FOFj5.js +0 -5
  1472. package/dist/options-CbOstLa7.js +0 -5
  1473. package/dist/options-CcXgWlvm.js +0 -24
  1474. package/dist/options-CfVPctAw.js +0 -89
  1475. package/dist/options-Cjgaf8ub.js +0 -8
  1476. package/dist/options-CoSPgWKy.js +0 -9
  1477. package/dist/options-CpZ2HlSU.js +0 -32
  1478. package/dist/options-CsSe8Nba.js +0 -8
  1479. package/dist/options-CsvJR-r2.js +0 -9
  1480. package/dist/options-Cucv6sWP.js +0 -12
  1481. package/dist/options-CyjL9lTf.js +0 -5
  1482. package/dist/options-D-OOO9V2.d.ts +0 -10
  1483. package/dist/options-D0Y6ZMe8.js +0 -5
  1484. package/dist/options-D0bzZx9a.d.ts +0 -10
  1485. package/dist/options-D0sj5abR.js +0 -9
  1486. package/dist/options-D1hSuf50.d.ts +0 -12
  1487. package/dist/options-D610Fa6T.js +0 -5
  1488. package/dist/options-D96dScev.js +0 -24
  1489. package/dist/options-DFpyP1bg.js +0 -5
  1490. package/dist/options-DJEcS4DX.js +0 -5
  1491. package/dist/options-DJbN3bi9.js +0 -11
  1492. package/dist/options-DKoQoRCy.js +0 -13
  1493. package/dist/options-DM1qaMMQ.js +0 -9
  1494. package/dist/options-DNgSwhsm.js +0 -11
  1495. package/dist/options-DOIwzRXL.js +0 -16
  1496. package/dist/options-DRIgHh4O.d.ts +0 -16
  1497. package/dist/options-DRrZmJyI.js +0 -8
  1498. package/dist/options-DSCW40_5.js +0 -12
  1499. package/dist/options-DUMUsvml.js +0 -5
  1500. package/dist/options-DWwL5Kaz.js +0 -9
  1501. package/dist/options-DZHZYlpD.js +0 -10
  1502. package/dist/options-DZLkeqWn.js +0 -9
  1503. package/dist/options-DZRpXKQE.js +0 -5
  1504. package/dist/options-DZen3UiC.js +0 -14
  1505. package/dist/options-D_9Vxx7f.js +0 -8
  1506. package/dist/options-DcHl59RC.js +0 -11
  1507. package/dist/options-Dcaql09y.js +0 -11
  1508. package/dist/options-DcnBNYmV.js +0 -8
  1509. package/dist/options-DdpM-fiP.js +0 -9
  1510. package/dist/options-DhoLMknl.js +0 -10
  1511. package/dist/options-DlohRAYd.d.ts +0 -13
  1512. package/dist/options-Dpy-Ruo-.js +0 -14
  1513. package/dist/options-DsVuVRH3.d.ts +0 -17
  1514. package/dist/options-DtAJxfHS.js +0 -8
  1515. package/dist/options-Dz9Yo52Z.js +0 -8
  1516. package/dist/options-HnfETSHr.d.ts +0 -19
  1517. package/dist/options-LqUXTpML.js +0 -8
  1518. package/dist/options-MsloEAIB.js +0 -5
  1519. package/dist/options-P2FxqYpd.js +0 -17
  1520. package/dist/options-_1gAIMq7.d.ts +0 -60
  1521. package/dist/options-aT89JqlB.js +0 -5
  1522. package/dist/options-cVKZu9b0.js +0 -9
  1523. package/dist/options-eTepQ1rZ.js +0 -15
  1524. package/dist/options-fkShrmGQ.js +0 -8
  1525. package/dist/options-gUvfr3no.js +0 -11
  1526. package/dist/options-hynwKWuf.js +0 -20
  1527. package/dist/options-jsOCvLUz.js +0 -10
  1528. package/dist/options-o5wCw8H7.d.ts +0 -14
  1529. package/dist/options-p49DFg3H.js +0 -8
  1530. package/dist/options-pYNpXKcg.js +0 -8
  1531. package/dist/options-qtETCHzW.js +0 -10
  1532. package/dist/options-rnKlqYEr.js +0 -5
  1533. package/dist/options-sU_zGkiV.js +0 -10
  1534. package/dist/options-xq4MXG1M.js +0 -5
  1535. package/dist/options-zzlznRA7.js +0 -10
  1536. package/dist/outbox-BZ712Z3X.d.ts +0 -199
  1537. package/dist/payments-BXvabJOw.js +0 -16
  1538. package/dist/payments-BYcN34Fp.d.ts +0 -114
  1539. package/dist/permissions-controller-BMsqIE5T.js +0 -34
  1540. package/dist/pg-error-B5QLDcbG.js +0 -26
  1541. package/dist/plugin-AKwwe2gF.js +0 -48
  1542. package/dist/pool-DDR1ndk7.d.ts +0 -123
  1543. package/dist/pool-errors-JUBcGrre.js +0 -27
  1544. package/dist/ports-DOrPTJzl.d.ts +0 -89
  1545. package/dist/ports-DvpNseap.js +0 -152
  1546. package/dist/postgrest-AJc8hnJU.d.ts +0 -53
  1547. package/dist/postgrest-executor-B_Uezhrm.js +0 -1068
  1548. package/dist/preset-CXhpPmPV.js +0 -1042
  1549. package/dist/problem-Bf0cJ7tk.js +0 -162
  1550. package/dist/problem-DNwN8iGz.d.ts +0 -79
  1551. package/dist/project-DJ9Uo0sT.js +0 -1760
  1552. package/dist/provider-B6g7rBZX.js +0 -57
  1553. package/dist/provider-CWjzAIX9.d.ts +0 -112
  1554. package/dist/push-token-B4vcIU4s.d.ts +0 -24
  1555. package/dist/push-token-D6REHMMw.js +0 -16
  1556. package/dist/queries-BWYYS9um.js +0 -239
  1557. package/dist/range-DwpWe8e7.js +0 -7
  1558. package/dist/range-p5V4rBhZ.d.ts +0 -8
  1559. package/dist/rank-keys-DcPMt_Jk.js +0 -60
  1560. package/dist/rank-result-BBJIK-k_.js +0 -18
  1561. package/dist/rank-result-Bwe7igy-.d.ts +0 -14
  1562. package/dist/rate-limit-BWKGlhTM.js +0 -49
  1563. package/dist/rate-limit-Bztf32cl.d.ts +0 -50
  1564. package/dist/rate-limit-fZ_d8gSE.js +0 -380
  1565. package/dist/ratelimit-headers-kEcXyO3H.js +0 -62
  1566. package/dist/react-BKCnIuZs.js +0 -79
  1567. package/dist/react-mdVjpewL.js +0 -1016
  1568. package/dist/read-set-B1sDib5O.js +0 -199
  1569. package/dist/realtime-status-BhNkb-Ow.d.ts +0 -8
  1570. package/dist/realtime-status-asHvhiOh.js +0 -11
  1571. package/dist/record-bindings-Z51mGfhB.js +0 -26
  1572. package/dist/record-form-CubgBrtI.d.ts +0 -82
  1573. package/dist/record-type-BEUyEsFx.js +0 -221
  1574. package/dist/recordings-DeZYx-Kv.d.ts +0 -119
  1575. package/dist/refresh-D02Pbf5B.d.ts +0 -54
  1576. package/dist/refresh-DLBgnxjL.js +0 -144
  1577. package/dist/refusal-B0VmlAxF.d.ts +0 -32
  1578. package/dist/refusal-DDlInPff.js +0 -64
  1579. package/dist/relay-CIKcAVjf.js +0 -248
  1580. package/dist/resolve-B0mW2m7f.js +0 -932
  1581. package/dist/resolve-CtX6T0c0.d.ts +0 -288
  1582. package/dist/resolved-names-kMRjmSIy.js +0 -133
  1583. package/dist/resource-BUJcZKiW.js +0 -520
  1584. package/dist/resource-DvgXqZB_.js +0 -105
  1585. package/dist/resource-WxN0IsvB.d.ts +0 -123
  1586. package/dist/resource-execute-BzqR8DdD.d.ts +0 -15
  1587. package/dist/resource-schemas-up6bKOUi.js +0 -82
  1588. package/dist/resource-types-BVbHgTPg.d.ts +0 -157
  1589. package/dist/resources-BSbRa0Ab.d.ts +0 -7
  1590. package/dist/resources-jb3R6rEa.js +0 -64
  1591. package/dist/respond-CZMWbUs3.js +0 -107
  1592. package/dist/respond-Dzu_-EPH.d.ts +0 -112
  1593. package/dist/result-DZeA5KS6.d.ts +0 -351
  1594. package/dist/result-ntFBW2p2.js +0 -146
  1595. package/dist/rows-BdqXmiB-.js +0 -80
  1596. package/dist/rows-jijHLVE_.js +0 -39
  1597. package/dist/rrule-C9Ot6ax8.js +0 -290
  1598. package/dist/run-state-BMCD_1Lt.d.ts +0 -13
  1599. package/dist/run-state-CgBKzYMW.js +0 -13
  1600. package/dist/run-watch-B-LoK5m1.js +0 -53
  1601. package/dist/runtime-LRJM7UqY.js +0 -44
  1602. package/dist/sales-lines-BsmrNHe9.d.ts +0 -38
  1603. package/dist/sales-lines-DO7oRu1o.js +0 -45
  1604. package/dist/sales-shared-BuTA8JK7.js +0 -22
  1605. package/dist/schemas-CLOTvdsC.js +0 -216
  1606. package/dist/scope-DgWjuXUw.js +0 -90
  1607. package/dist/scores-Y8TvyJi1.d.ts +0 -174
  1608. package/dist/scores-bY2Is0kx.js +0 -177
  1609. package/dist/search-Cn_DGluL.js +0 -9
  1610. package/dist/server-types-BkTIxW_H.d.ts +0 -597
  1611. package/dist/session-BOzx2qHC.d.ts +0 -100
  1612. package/dist/session-status-BP8eYVnA.d.ts +0 -82
  1613. package/dist/shared-BeHTi8Fu.js +0 -17
  1614. package/dist/shared-Bf-I13Ht.js +0 -91
  1615. package/dist/shared-CRRfQAKG.d.ts +0 -11
  1616. package/dist/sign-in-BzihC_8k.d.ts +0 -50
  1617. package/dist/sign-in-CmPK1AgM.js +0 -402
  1618. package/dist/sign-in-CuZ1Ag7O.js +0 -718
  1619. package/dist/sign-in-D54FLMQy.d.ts +0 -55
  1620. package/dist/signatures-CX1b4WHa.js +0 -145
  1621. package/dist/signatures-Dkx9OE8j.d.ts +0 -43
  1622. package/dist/signers-ZmxO1I05.d.ts +0 -390
  1623. package/dist/signing-keys-CWtpMask.js +0 -164
  1624. package/dist/signing-keys-udgP7Aod.d.ts +0 -119
  1625. package/dist/simplify-DDO0j0LI.js +0 -83
  1626. package/dist/spec-BMvCCNnd.js +0 -124
  1627. package/dist/spec-pins-BZkKfwY8.d.ts +0 -127
  1628. package/dist/spec-pins-D3zDek-u.js +0 -62
  1629. package/dist/sql-CYt7EhH0.js +0 -421
  1630. package/dist/sql-DHp0L7zK.js +0 -138385
  1631. package/dist/sql-type-iUSZpaUu.js +0 -34
  1632. package/dist/sso-CkU_4mtK.d.ts +0 -161
  1633. package/dist/sso-DdDpJQzw.js +0 -217
  1634. package/dist/standard-BA3mLh6w.js +0 -25
  1635. package/dist/standard-DBV730sF.d.ts +0 -7
  1636. package/dist/stats-BHl1-zj9.js +0 -83
  1637. package/dist/statuses-Alll5Ip6.js +0 -29
  1638. package/dist/statuses-zRcc2TeZ.js +0 -28
  1639. package/dist/storage-api-Dg78Wqsg.js +0 -10
  1640. package/dist/store-CpheI-lN.d.ts +0 -83
  1641. package/dist/store-McN-2esd.js +0 -69
  1642. package/dist/stripe-BJUfp5jM.js +0 -32
  1643. package/dist/stripe-X22LjuH-.d.ts +0 -156
  1644. package/dist/subject-readers-CB5Te02u.d.ts +0 -21
  1645. package/dist/subject-readers-VHcrWhmq.js +0 -49
  1646. package/dist/subject-type-BRnK7Av3.js +0 -8
  1647. package/dist/subjects-BYCL-6hA.d.ts +0 -145
  1648. package/dist/subjects-CiBNKy2y.d.ts +0 -90
  1649. package/dist/subscribers-BvZxcd63.js +0 -33
  1650. package/dist/summaries-8jQTELIX.d.ts +0 -69
  1651. package/dist/supabase-mcp-Dz9DgrKP.js +0 -28
  1652. package/dist/supabase-mcp-Z4vtsuoO.d.ts +0 -46
  1653. package/dist/support-BxyPOFk4.d.ts +0 -357
  1654. package/dist/support-view-g4YLBeqX.js +0 -18
  1655. package/dist/support-view-nqUWKHEs.d.ts +0 -17
  1656. package/dist/table-schema-BlF6k62Q.d.ts +0 -81
  1657. package/dist/table-schema-C80xItaV.js +0 -293
  1658. package/dist/tables-Cb-3_VWc.js +0 -73
  1659. package/dist/tags-CIZTqtlY.js +0 -39
  1660. package/dist/tags-Cm48BsOa.d.ts +0 -30
  1661. package/dist/tax-BkCNWWMc.js +0 -140
  1662. package/dist/tax-DPShHual.d.ts +0 -170
  1663. package/dist/tee-V97_v1ZS.js +0 -101
  1664. package/dist/template-Drgg3v2J.js +0 -126
  1665. package/dist/temporal-Dbo0fLzc.js +0 -95
  1666. package/dist/temporal-required-DcLhnDhQ.js +0 -20
  1667. package/dist/tenant-BgIiMQpo.js +0 -27
  1668. package/dist/tenant-FfgNhd5x.d.ts +0 -17
  1669. package/dist/tenant-source-bqWpSr86.js +0 -8
  1670. package/dist/timeline-DqEoD8bb.d.ts +0 -151
  1671. package/dist/timeline-Dz3hO2I6.js +0 -50
  1672. package/dist/timing-dypS0nxW.js +0 -95
  1673. package/dist/topic-BaUElNw2.d.ts +0 -415
  1674. package/dist/topic-DnsNG4Kj.js +0 -643
  1675. package/dist/ttl-cache-Bhr9swjT.js +0 -32
  1676. package/dist/types-B-D6fYx2.d.ts +0 -194
  1677. package/dist/types-CK2X2wCB.d.ts +0 -618
  1678. package/dist/types-CMN0h_Ix.d.ts +0 -461
  1679. package/dist/types-CPl9uJ0G.d.ts +0 -912
  1680. package/dist/types-CwQgFo8c.d.ts +0 -177
  1681. package/dist/types-DMihLukJ.d.ts +0 -251
  1682. package/dist/types-R6syp1el.js +0 -29
  1683. package/dist/types-iCyZ3lMx.d.ts +0 -217
  1684. package/dist/types-nspa5I-a.d.ts +0 -664
  1685. package/dist/undo-0HkWXASn.d.ts +0 -46
  1686. package/dist/undo-BbftL9-4.js +0 -44
  1687. package/dist/upload-claim-B1ZU8ydB.js +0 -33
  1688. package/dist/usage-BkWAPkg2.d.ts +0 -232
  1689. package/dist/user-change-DgWC6RRC.js +0 -135
  1690. package/dist/variants-Cy--Ub-a.js +0 -53
  1691. package/dist/vault-BkdPmL7f.d.ts +0 -62
  1692. package/dist/verify-41mZmspj.d.ts +0 -146
  1693. package/dist/verify-7EucfCnv.js +0 -130
  1694. package/dist/view-C8Ve14ja.js +0 -247
  1695. package/dist/view-C8_xvD-j.d.ts +0 -97
  1696. package/dist/watch-topic-BabDTZ-L.d.ts +0 -31
  1697. package/dist/watch-topic-CuaWfCuv.js +0 -57
  1698. package/dist/wire-ChYn1g21.js +0 -91
  1699. package/dist/wiring-CDNuQoJJ.js +0 -13
  1700. package/dist/workflow-sdk-Cf0LAOFF.js +0 -242
  1701. package/dist/workflow-sdk-DJJkP0dT.js +0 -2545
  1702. package/dist/workflow-sdk-rg3IbCZC.d.ts +0 -163
  1703. package/dist/workflows-xL6t0TXx.d.ts +0 -258
@@ -1,2634 +0,0 @@
1
- import { m as commandMeta, r as defineCliCommand } from "./command-CCAwhiOh.js";
2
- import { i as plain } from "./style-Bm2X5JrN.js";
3
- import { n as CliError } from "./errors-BTe6A15O.js";
4
- import { t as migrateCliCall } from "./moved-C3WyRHkA.js";
5
- import { t as isRecord$1 } from "./guards-CUlDNYZs.js";
6
- import { a as changedFiles, i as changeLines, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
7
- import { i as schemasDirOf, n as migrationsDir, o as writtenByBlocks } from "./sql-layout-Dp4Rottt.js";
8
- import { a as configObject, c as mask, f as setPathInConfig, g as skipSpace, h as setPresetInJson, i as closingIndex, l as properties, m as setPresetInConfig, o as indentAt, p as setPathInJson, t as addBlocksToConfig, v as codeRanges } from "./config-edit-CrWfk8s3.js";
9
- import { i as legacyPrefixNames, n as LEGACY_PREFIXES, t as LEGACY_CLAIMS } from "./legacy-prefix-R7UChFFl.js";
10
- import { a as REVIEW_0_15, c as renameSubpaths, r as PLUGIN_IMPORT_RENAMES, s as SUBPATH_RENAMES_0_15, t as BLOCK_EXPORT_RENAMES } from "./codemod-block-renames-BuSaTE_G.js";
11
- import { a as RECORD_BINDING_RENAMES, n as groupConfigJson, r as groupConfigSource, t as cutRange } from "./config-group-CP-B9uRt.js";
12
- import { existsSync } from "node:fs";
13
- import { extname, join, relative, resolve } from "node:path";
14
- import { readFile, readdir, stat } from "node:fs/promises";
15
- import { DEFAULT_CONVENTIONS, presetSpec } from "better-supabase/preset";
16
- import { currentBlockName, formatBsbComment, parseBsbComment, renamedBlock } from "better-supabase/sql";
17
- import { BLOCK_EVENT_RENAMES } from "better-supabase/events";
18
- //#region src/cli/codemod-calls.ts
19
- /** Files whose CLI calls a codemod rewrites. */
20
- const CLI_CALL_FILE = /(?:^|[\\/])(?:package\.json|\.github[\\/]workflows[\\/][^\\/]+\.ya?ml)$/;
21
- /** Other files that run shell commands; their CLI calls are listed for review. */
22
- const SHELL_FILE = /(?:^|[\\/])(?:[^\\/]+\.(?:sh|bash|zsh|ya?ml)|Makefile|justfile|Dockerfile)$/;
23
- /** The bin, with an optional `@version`, followed by its arguments. */
24
- const BIN = /(?<![\w.@-])(?:better-supabase|bsb)(?:@[\w.^~-]+)?(?=[ \t])/g;
25
- /**
26
- * Where a call's arguments end: a line break, a shell operator, a closing quote
27
- * or a comment.
28
- */
29
- const CALL_END = /\r?\n|&&|\|\||[;|)`]|\\?"|\s#/;
30
- /** `pnpm --filter better-supabase <script>` names the package, not the bin. */
31
- const PACKAGE_FILTER = /(?:--filter|-F)[= ]$/;
32
- function cliCalls(text, migrate) {
33
- const calls = [];
34
- for (const match of text.matchAll(BIN)) {
35
- if (PACKAGE_FILTER.test(text.slice(0, match.index))) continue;
36
- const start = match.index + match[0].length;
37
- const tail = text.slice(start);
38
- const end = start + (CALL_END.exec(tail)?.index ?? tail.length);
39
- const words = text.slice(start, end).trim().split(/\s+/u);
40
- const to = words[0] === "" ? void 0 : migrate(words);
41
- if (to) calls.push({
42
- start,
43
- end,
44
- bin: match[0],
45
- to
46
- });
47
- }
48
- return calls;
49
- }
50
- /**
51
- * A CLI call followed by `&&` and the same call again. The call starts after a
52
- * shell operator, a quote, a line break or a YAML `run:`, and the repeat ends
53
- * at one, so only whole commands match.
54
- */
55
- const REPEATED_CALL = /((?:^|&&|\|\||[;:\n"'`(])[ \t]*)([^&|;\n"'`()]*?(?<![\w.@-])(?:better-supabase|bsb)(?:@[\w.^~-]+)?[ \t][^&|;\n"'`()]*?)[ \t]*&&[ \t]*\2(?=[ \t]*(?:&&|\|\||[;\n"'`)]|$))/g;
56
- /**
57
- * `text` with each run of identical CLI calls joined by `&&` kept once. Two old
58
- * commands can move to the same new one (`sql sync` and `sql upgrade` both
59
- * become `upgrade`), and running it twice in a row does the work twice.
60
- */
61
- function collapseRepeatedCalls(text) {
62
- let out = text;
63
- let previous;
64
- while (out !== previous) {
65
- previous = out;
66
- out = out.replaceAll(REPEATED_CALL, "$1$2");
67
- }
68
- return out;
69
- }
70
- /** `text` with every moved CLI call spelled the new way. */
71
- function rewriteCliCalls(text, migrate) {
72
- const calls = cliCalls(text, migrate);
73
- if (calls.length === 0) return text;
74
- let out = "";
75
- let cursor = 0;
76
- for (const call of calls) {
77
- const original = text.slice(call.start, call.end);
78
- const trailing = /\s*$/u.exec(original)?.[0] ?? "";
79
- out += `${text.slice(cursor, call.start)} ${call.to.join(" ")}${trailing}`;
80
- cursor = call.end;
81
- }
82
- return collapseRepeatedCalls(out + text.slice(cursor));
83
- }
84
- /** One review line per moved CLI call, with the new spelling. */
85
- function cliCallHints(text, migrate) {
86
- return cliCalls(text, migrate).map((call) => ({
87
- line: text.slice(0, call.start).split("\n").length,
88
- message: `This call uses a renamed command or flag: run \`${call.bin} ${call.to.join(" ")}\``
89
- }));
90
- }
91
- //#endregion
92
- //#region src/cli/codemod-preset-code.ts
93
- /**
94
- * The 0.14 preset code layout, frozen: the fields in code order with their
95
- * values and widths, then one bit per block. Codes are no longer written; the
96
- * 0.15 codemod reads them into a preset object.
97
- */
98
- const FIELDS = [
99
- {
100
- key: "framework",
101
- values: [
102
- "next",
103
- "vite",
104
- "tanstack-start",
105
- "expo",
106
- "sveltekit",
107
- "nuxt",
108
- "hono",
109
- "astro",
110
- "react-router"
111
- ],
112
- bits: 5
113
- },
114
- {
115
- key: "platforms",
116
- values: [
117
- "web",
118
- "native",
119
- "both"
120
- ],
121
- bits: 2
122
- },
123
- {
124
- key: "casing",
125
- values: ["snake", "camel"],
126
- bits: 2
127
- },
128
- {
129
- key: "idType",
130
- values: [
131
- "uuid",
132
- "text",
133
- "bigint",
134
- "integer"
135
- ],
136
- bits: 3
137
- },
138
- {
139
- key: "scope",
140
- values: [
141
- "tenant",
142
- "user",
143
- "none"
144
- ],
145
- bits: 2
146
- },
147
- {
148
- key: "tenantName",
149
- values: [
150
- "organization",
151
- "workspace",
152
- "team"
153
- ],
154
- bits: 3
155
- },
156
- {
157
- key: "access",
158
- values: [
159
- "roles",
160
- "catalog",
161
- "provider",
162
- "custom"
163
- ],
164
- bits: 3
165
- },
166
- {
167
- key: "api",
168
- values: ["none", "api"],
169
- bits: 2
170
- },
171
- {
172
- key: "integrations",
173
- values: [
174
- "next",
175
- "hono",
176
- "orpc",
177
- "edge",
178
- "expo",
179
- "mcp",
180
- "client",
181
- "react"
182
- ],
183
- bits: 16,
184
- multi: true
185
- }
186
- ];
187
- /** The 0.14 block bits, in order; `null` marks a removed block. */
188
- const BLOCKS = [
189
- "updated-at",
190
- "actor",
191
- "audit",
192
- "tenant",
193
- "invitations",
194
- "reserved-slugs",
195
- "jobs",
196
- "idempotency",
197
- "webhook-inbox",
198
- "realtime-tables",
199
- "jsonb-schemas",
200
- "pgtap",
201
- "grants",
202
- "read-sets",
203
- "mfa",
204
- "entitlements",
205
- "rate-limit",
206
- "vector-search",
207
- "access",
208
- "support-sessions",
209
- "organizations",
210
- "profiles",
211
- "outbox",
212
- "notifications",
213
- "webhooks-out",
214
- "sessions",
215
- "webhooks-in",
216
- "api-keys",
217
- "settings",
218
- "usage",
219
- "billing",
220
- "flags",
221
- "comments",
222
- "attachments",
223
- "data-lifecycle",
224
- "sso",
225
- "onboarding",
226
- "waitlist",
227
- "announcements",
228
- "streams",
229
- "credentials",
230
- "workflows",
231
- "workflow-sdk-world",
232
- "workflow-builder",
233
- "chat-sdk-state",
234
- "inbox",
235
- "ai-chat",
236
- "ai-files",
237
- "knowledge",
238
- "memory",
239
- "agents",
240
- "connectors",
241
- "ai-tasks",
242
- "push",
243
- "ai-cache",
244
- "ai-providers",
245
- "number-sequences",
246
- "teams",
247
- "tags",
248
- "state-machine",
249
- "custom-fields",
250
- "share-links",
251
- "reminders",
252
- "imports",
253
- "subjects",
254
- "rank",
255
- "saved-views",
256
- "relations",
257
- "bulk",
258
- "search",
259
- "metrics",
260
- "calendar",
261
- "bookings",
262
- "versions",
263
- "trash",
264
- "reactions",
265
- "approvals",
266
- "access-requests",
267
- "documents",
268
- "catalog",
269
- "inventory",
270
- "drive",
271
- "drive-files",
272
- "orders",
273
- "promotions",
274
- "forms",
275
- "signatures",
276
- "time-tracking",
277
- "identities",
278
- "service-principals",
279
- "templates",
280
- "pipelines",
281
- "parties",
282
- "engagements",
283
- "deals",
284
- "work-items",
285
- "quotes",
286
- "invoices",
287
- "sla",
288
- "targets",
289
- "hiring",
290
- "employees",
291
- "collections",
292
- "ensure-rls",
293
- "signing-keys",
294
- "shared-signals",
295
- "oauth-server",
296
- "domains",
297
- "reviews",
298
- "leave",
299
- "rules",
300
- "vercel-marketplace",
301
- "ledger",
302
- "assets",
303
- "scores",
304
- "moderation",
305
- "enrollments",
306
- "guests",
307
- "passes",
308
- "billable-time",
309
- "leases",
310
- "expenses",
311
- "donations",
312
- "dispatch",
313
- "shipments",
314
- "contracts",
315
- "controls",
316
- "incidents",
317
- "courses",
318
- "messaging",
319
- "channels",
320
- "activity",
321
- "mail-sync",
322
- "segments",
323
- "assignment",
324
- "enrichment",
325
- "forecasts",
326
- "field-history",
327
- "sequences",
328
- "lead-scoring",
329
- "posts",
330
- "field-encryption"
331
- ];
332
- const BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
333
- /** Whether `value` reads as a 0.14 preset code: `1` and base62 digits. */
334
- function isLegacyPresetCode(value) {
335
- return /^1[0-9A-Za-z]+$/.test(value);
336
- }
337
- /**
338
- * The conventions and blocks a 0.14 preset code holds, the blocks under their
339
- * 0.15 names. Throws a TypeError when `code` isn't one.
340
- */
341
- function decodeLegacyPresetCode(code) {
342
- if (!isLegacyPresetCode(code)) throw new TypeError(`"${code}" is not a 0.14 preset code.`);
343
- let value = 0n;
344
- for (const char of code.slice(1)) value = value * 62n + BigInt(BASE62.indexOf(char));
345
- const preset = {};
346
- for (const field of FIELDS) {
347
- const bits = value & (1n << BigInt(field.bits)) - 1n;
348
- value >>= BigInt(field.bits);
349
- if (field.multi === true) {
350
- preset[field.key] = field.values.filter((_, index) => (bits >> BigInt(index) & 1n) === 1n);
351
- continue;
352
- }
353
- const each = field.values[Number(bits)];
354
- if (each === void 0) throw new TypeError(`Preset code "${code}" has an unknown ${field.key}.`);
355
- preset[field.key] = each;
356
- }
357
- const blocks = [];
358
- for (let index = 0; value > 0n; index += 1, value >>= 1n) {
359
- const name = BLOCKS[index];
360
- if ((value & 1n) === 1n && name !== null && name !== void 0) blocks.push(currentBlockName(name));
361
- }
362
- return {
363
- ...preset,
364
- blocks
365
- };
366
- }
367
- /** The preset a 0.14 code holds, as the name or object the config takes. */
368
- function specOfCode(code) {
369
- const { blocks, ...decoded } = decodeLegacyPresetCode(code);
370
- return presetSpec({
371
- ...DEFAULT_CONVENTIONS,
372
- ...decoded,
373
- blocks: typeof blocks === "string" ? [blocks] : blocks ?? []
374
- });
375
- }
376
- const PRESET_CODE = /(\bpreset\s*:\s*|"preset"\s*:\s*)(["'])((?:https?:\/\/[^"'?]*\?(?:[^"']*&)?preset=)?)(1[0-9A-Za-z]+)([^"']*)\2/;
377
- /**
378
- * `better-supabase.config.*` with a 0.14 preset code (or a Create URL holding
379
- * one) in `preset` rewritten to the preset object or name it holds.
380
- */
381
- function convertConfigPresetCode(source, json) {
382
- const match = PRESET_CODE.exec(source);
383
- if (match === null || match[5] !== "") return {
384
- ok: true,
385
- text: source
386
- };
387
- const spec = specOfCode(match[4] ?? "");
388
- return json ? setPresetInJson(source, spec) : setPresetInConfig(source, spec);
389
- }
390
- /**
391
- * A 0.14 design file (`{ preset: "<code>", design }`) as a 0.15 one: the design
392
- * with the preset object inside. Other JSON is returned as it is.
393
- */
394
- function convertDesignFile(source) {
395
- let value;
396
- try {
397
- value = JSON.parse(source);
398
- } catch {
399
- return {
400
- ok: false,
401
- reason: "it isn't valid JSON"
402
- };
403
- }
404
- if (typeof value !== "object" || value === null || !("preset" in value) || !("design" in value) || typeof value.preset !== "string" || typeof value.design !== "object" || value.design === null) return {
405
- ok: true,
406
- text: source
407
- };
408
- const preset = isLegacyPresetCode(value.preset) ? specOfCode(value.preset) : value.preset;
409
- return {
410
- ok: true,
411
- text: `${JSON.stringify({
412
- ...value.design,
413
- preset
414
- }, null, 2)}\n`
415
- };
416
- }
417
- /** A design file Create downloaded (`better-supabase.design.json`). */
418
- const DESIGN_FILE_NAME = /(?:^|[\\/])[^\\/]*\.design\.json$/;
419
- const reviewOf = (edit) => edit.ok && "review" in edit ? edit.review : [];
420
- /** `edit`, then `convertConfigPresetCode` on its text, with both reviews. */
421
- function thenConvertPresetCode(edit, json) {
422
- if (!edit.ok) return edit;
423
- const converted = convertConfigPresetCode(edit.text, json);
424
- return converted.ok ? {
425
- ok: true,
426
- text: converted.text,
427
- review: [...reviewOf(edit), ...reviewOf(converted)]
428
- } : converted;
429
- }
430
- /** A codemod's `designFile` rewrite as a result; a refusal is listed for review. */
431
- function designFileResult(source, rewrite) {
432
- if (rewrite === void 0) return {
433
- text: source,
434
- review: []
435
- };
436
- const edit = rewrite(source);
437
- return edit.ok ? {
438
- text: edit.text,
439
- review: reviewOf(edit)
440
- } : {
441
- text: source,
442
- review: [{
443
- line: 1,
444
- message: `The design file wasn't rewritten: ${edit.reason}`
445
- }]
446
- };
447
- }
448
- //#endregion
449
- //#region src/cli/codemod-sql-names.ts
450
- /**
451
- * The 0.15 `bs_` to `bsb_` rename in the app's own SQL. The upgrade migration
452
- * renames the objects in the database, but SQL the app wrote (pgTAP tests, its
453
- * schema files, its newest migration) still names them the old way, so the
454
- * codemod lists those lines. It never rewrites SQL: a pushed migration must not
455
- * change, and a test may name an object on purpose.
456
- */
457
- const LEGACY_NAME = /\bbs_[a-z0-9_]+/g;
458
- const CURRENT_NAME = /\bbsb_[a-z0-9_]+/g;
459
- /**
460
- * The `bs_` names the 0.15 rename covers, from the files better-supabase wrote:
461
- * their old `bs_` names before `upgrade` rewrites them, or the `bs_` form of
462
- * their `bsb_` names after.
463
- */
464
- function renamedSqlNames(blockFiles) {
465
- const text = blockFiles.join("\n");
466
- return /* @__PURE__ */ new Set([...legacyPrefixNames(text), ...[...new Set(text.match(CURRENT_NAME))].map((name) => `bs_${name.slice(4)}`).filter((name) => !LEGACY_CLAIMS.has(name))]);
467
- }
468
- const renamed = (name, names) => names.has(name) || LEGACY_PREFIXES.some((prefix) => name.startsWith(prefix));
469
- /** One hint per line and renamed name in `sources`. */
470
- function sqlNameHints(sources, names) {
471
- const hints = [];
472
- for (const source of sources) for (const [index, line] of source.text.split("\n").entries()) for (const name of new Set(line.match(LEGACY_NAME))) if (renamed(name, names)) hints.push({
473
- file: source.path,
474
- line: index + 1,
475
- message: `${name} is bsb_${name.slice(3)} since 0.15, and the upgrade migration renames it in the database. Rename it here, in SQL that runs after that migration.`
476
- });
477
- return hints;
478
- }
479
- async function sqlFiles(dir) {
480
- if (!existsSync(dir)) return [];
481
- const files = [];
482
- for (const entry of await readdir(dir, { withFileTypes: true })) {
483
- const full = join(dir, entry.name);
484
- if (entry.isDirectory()) files.push(...await sqlFiles(full));
485
- else if (entry.name.endsWith(".sql")) files.push(full);
486
- }
487
- return files.toSorted();
488
- }
489
- /**
490
- * Lines of the app's SQL that name a `bs_` object the 0.15 upgrade renames: the
491
- * pgTAP tests (`sql.testsDir`), the schema files no block wrote, and the newest
492
- * migration the app wrote. Older migrations already ran, so they stay as they
493
- * are.
494
- */
495
- async function legacySqlNameHints(config) {
496
- const read = async (path) => ({
497
- path: relative(config.root, path).replaceAll("\\", "/"),
498
- text: await readFile(path, "utf-8")
499
- });
500
- const [tests, schemas, migrations] = await Promise.all([
501
- Promise.all((await sqlFiles(join(config.root, config.sql.testsDir))).map(read)),
502
- Promise.all((await sqlFiles(join(config.root, await schemasDirOf(config)))).map(read)),
503
- Promise.all((await sqlFiles(join(config.root, migrationsDir(config)))).map(read))
504
- ]);
505
- const names = renamedSqlNames([...schemas, ...migrations].filter(writtenByBlocks).map((file) => file.text));
506
- const latest = migrations.findLast((file) => !writtenByBlocks(file));
507
- return sqlNameHints([
508
- ...tests.filter((file) => !writtenByBlocks(file)),
509
- ...schemas.filter((file) => !writtenByBlocks(file)),
510
- ...latest === void 0 ? [] : [latest]
511
- ], names);
512
- }
513
- //#endregion
514
- //#region src/cli/codemod-data-contract.ts
515
- /** The query guards named after the retired verbs. */
516
- const DATA_CONTRACT_OPTIONS = [{
517
- call: "guards",
518
- from: "noUnboundedFindMany",
519
- to: "noUnboundedList"
520
- }, {
521
- call: "guards",
522
- from: "noDeleteManyWithoutWhere",
523
- to: "noDeleteWithoutWhere"
524
- }];
525
- /** The lint rules named after the retired verbs. */
526
- const DATA_CONTRACT_STRINGS = {
527
- "better-supabase/no-unbounded-find-many": "better-supabase/no-unbounded-list",
528
- "better-supabase/no-delete-many-without-where": "better-supabase/no-empty-where"
529
- };
530
- const RENAMED = {
531
- findMany: "list",
532
- paginate: "page",
533
- findById: "get",
534
- createMany: "create",
535
- upsertMany: "upsert"
536
- };
537
- const CALL = /\.(findMany|paginate|findById|createMany|upsertMany|updateMany|deleteMany|findUnique|findOnly|findFirst|exists)(\s*)\(/g;
538
- const REVIEW = "Rewrite this call by hand: its arguments aren't an object literal (see the 0.14 to 0.15 guide's data contract table)";
539
- /**
540
- * Rewrites the 0.14 repository methods to the 0.15 data contract. A call nested
541
- * in another rewritten call's arguments is rewritten on the next pass.
542
- */
543
- function rewriteDataContract(source, options = {}) {
544
- let text = source;
545
- for (let pass = 0; pass < 4; pass += 1) {
546
- const next = rewritePass(text, options);
547
- if (next.text === text) return next;
548
- text = next.text;
549
- }
550
- return rewritePass(text, options);
551
- }
552
- function rewritePass(source, options) {
553
- const code = options.raw === true ? source : mask(source);
554
- const edits = [];
555
- const review = [];
556
- for (const match of code.matchAll(CALL)) {
557
- const method = match[1];
558
- const name = match.index + 1;
559
- const open = match.index + match[0].length - 1;
560
- const close = closingIndex(code, open);
561
- if (close === -1) continue;
562
- const edit = rewrite(source, code, {
563
- method,
564
- name,
565
- open,
566
- close
567
- });
568
- if (edit === void 0) review.push({
569
- line: source.slice(0, name).split("\n").length,
570
- message: REVIEW
571
- });
572
- else if (edit !== "skip") edits.push(...edit);
573
- }
574
- return {
575
- text: apply(source, edits),
576
- review
577
- };
578
- }
579
- function rewrite(source, code, call) {
580
- const { method, name, open, close } = call;
581
- const renamed = RENAMED[method];
582
- if (renamed !== void 0) return [{
583
- start: name,
584
- end: name + method.length,
585
- text: renamed
586
- }];
587
- const sole = soleArgument(code, open, close);
588
- if (sole === "several") return method === "exists" ? "skip" : void 0;
589
- const argument = sole === "none" ? void 0 : sole;
590
- if (method === "exists") {
591
- if (argument !== void 0 && (code[argument] !== "{" || !properties(source, code, argument)?.some((prop) => prop.key === "where"))) return "skip";
592
- return [{
593
- start: name,
594
- end: name + method.length,
595
- text: "count"
596
- }, {
597
- start: close + 1,
598
- end: close + 1,
599
- text: ".map((n) => n > 0)"
600
- }];
601
- }
602
- if (method === "findFirst") return findFirst(source, code, call, argument);
603
- if (argument === void 0 || code[argument] !== "{") return;
604
- const props = properties(source, code, argument);
605
- if (!props) return;
606
- const text = (key) => {
607
- const prop = props.find((entry) => entry.key === key);
608
- return prop === void 0 ? void 0 : source.slice(prop.valueStart, prop.valueEnd);
609
- };
610
- const rest = (...without) => props.filter((prop) => prop.key === void 0 || !without.includes(prop.key)).map((prop) => source.slice(prop.start, prop.valueEnd));
611
- const value = text("where");
612
- if (value === void 0) return;
613
- const where = value === "where" ? "where" : `where: ${value}`;
614
- const options = (extra) => {
615
- const items = [...extra];
616
- return items.length === 0 ? "" : `, { ${items.join(", ")} }`;
617
- };
618
- const replace = (verb, args) => [{
619
- start: name,
620
- end: close + 1,
621
- text: `${verb}(${args})`
622
- }];
623
- switch (method) {
624
- case "updateMany": {
625
- const data = text("data");
626
- return data === void 0 ? void 0 : replace("update", `{ ${where} }, ${data}${options(rest("where", "data"))}`);
627
- }
628
- case "deleteMany": return replace("delete", `{ ${where} }${options(rest("where"))}`);
629
- case "findUnique": return replace("get", `${value}${options([...rest("where"), "optional: true"])}`);
630
- case "findOnly": return replace("get", `{ ${where} }${options([...rest("where"), "optional: true"])}`);
631
- default: return;
632
- }
633
- }
634
- function findFirst(source, code, call, argument) {
635
- const { name, open, close } = call;
636
- const first = {
637
- start: close + 1,
638
- end: close + 1,
639
- text: ".map((rows) => rows[0] ?? null)"
640
- };
641
- const verb = {
642
- start: name,
643
- end: name + 9,
644
- text: "list"
645
- };
646
- if (argument === void 0) return [
647
- verb,
648
- {
649
- start: open + 1,
650
- end: close,
651
- text: "{ limit: 1 }"
652
- },
653
- first
654
- ];
655
- if (code[argument] === "{") {
656
- const end = closingIndex(code, argument);
657
- const inner = source.slice(argument + 1, end).trim();
658
- return [
659
- verb,
660
- {
661
- start: argument,
662
- end: end + 1,
663
- text: inner.length === 0 ? "{ limit: 1 }" : `{ ${inner.replace(/,\s*$/, "")}, limit: 1 }`
664
- },
665
- first
666
- ];
667
- }
668
- const value = source.slice(argument, close).trim();
669
- return [
670
- verb,
671
- {
672
- start: open + 1,
673
- end: close,
674
- text: `{ ...${value}, limit: 1 }`
675
- },
676
- first
677
- ];
678
- }
679
- /** The index where the only argument starts. */
680
- function soleArgument(code, open, close) {
681
- const start = open + 1 + (/^\s*/.exec(code.slice(open + 1))?.[0].length ?? 0);
682
- if (start >= close) return "none";
683
- let depth = 0;
684
- for (let index = start; index < close; index += 1) {
685
- const char = code[index];
686
- if (char === "\"" || char === "'" || char === "`") index = Math.max(index, code.indexOf(char, index + 1));
687
- else if ("({[".includes(char)) depth += 1;
688
- else if (")}]".includes(char)) depth -= 1;
689
- else if (char === "," && depth === 0 && code.slice(index + 1, close).trim() !== "") return "several";
690
- }
691
- return start;
692
- }
693
- function apply(text, edits) {
694
- let out = "";
695
- let cursor = 0;
696
- for (const edit of edits.toSorted((a, b) => a.start - b.start)) {
697
- if (edit.start < cursor) continue;
698
- out += text.slice(cursor, edit.start) + edit.text;
699
- cursor = edit.end;
700
- }
701
- return out + text.slice(cursor);
702
- }
703
- const REQUIRE_TENANT = /\brequireTenant\b/g;
704
- /**
705
- * The data contract moves, then `requireTenant` renamed to
706
- * `requireOrganization`.
707
- */
708
- function rewrite015(text) {
709
- const result = rewriteDataContract(text);
710
- return {
711
- text: result.text.replaceAll(REQUIRE_TENANT, "requireOrganization"),
712
- review: result.review
713
- };
714
- }
715
- //#endregion
716
- //#region src/cli/codemod-subjects.ts
717
- const ENVIRONMENT_KEY$1 = /^\$(?:development|production|test|ci)$/;
718
- const lineAt = (source, index) => source.slice(0, index).split("\n").length;
719
- function applyEdits$3(source, edits) {
720
- let text = source;
721
- for (const edit of edits.toSorted((a, b) => b.start - a.start)) text = text.slice(0, edit.start) + edit.text + text.slice(edit.end);
722
- return text;
723
- }
724
- /** The range that removes `prop` with its comma and the space after it. */
725
- function removal$1(code, prop, close) {
726
- const after = skipSpace(code, prop.valueEnd);
727
- if (code[after] === ",") return {
728
- start: prop.start,
729
- end: skipSpace(code, after + 1),
730
- text: ""
731
- };
732
- return {
733
- start: prop.start,
734
- end: after === close ? prop.valueEnd : after,
735
- text: ""
736
- };
737
- }
738
- /** Text that adds `entries` before the `}` at `close`. */
739
- function insertion(source, code, open, close, existing, entries) {
740
- const outer = indentAt(source, open);
741
- const first = existing[0];
742
- const inner = first === void 0 ? `${outer} ` : indentAt(source, first.start);
743
- let last = close - 1;
744
- while (last > open && /\s/.test(code[last])) last -= 1;
745
- const body = entries.map((entry) => `\n${inner}${entry},`).join("");
746
- if (last === open) return {
747
- start: open + 1,
748
- end: close,
749
- text: `${body}\n${outer}`
750
- };
751
- return {
752
- start: last + 1,
753
- end: last + 1,
754
- text: `${code[last] === "," ? "" : ","}${body}`
755
- };
756
- }
757
- /** Moves `records` into `subjects` in the object at `open`. */
758
- function renameIn(source, code, open, review) {
759
- const props = properties(source, code, open);
760
- const close = closingIndex(code, open);
761
- if (props === void 0 || close === -1) return [];
762
- const edits = [];
763
- const records = props.find((prop) => prop.key === "records");
764
- const subjects = props.find((prop) => prop.key === "subjects");
765
- if (records !== void 0 && subjects === void 0) {
766
- const keyEnd = source.indexOf("records", records.start) + 7;
767
- edits.push({
768
- start: records.start,
769
- end: keyEnd,
770
- text: "subjects"
771
- });
772
- } else if (records !== void 0 && subjects !== void 0) {
773
- const from = code[records.valueStart] === "{" ? properties(source, code, records.valueStart) : void 0;
774
- const into = code[subjects.valueStart] === "{" ? properties(source, code, subjects.valueStart) : void 0;
775
- if (from === void 0 || into === void 0) review.push({
776
- line: lineAt(source, records.start),
777
- message: "`records` and `subjects` are both set and one isn't an object literal: move the `records` entries into `subjects` by hand"
778
- });
779
- else {
780
- const taken = new Set(into.flatMap((prop) => prop.key ?? []));
781
- const moved = [];
782
- for (const entry of from) if (entry.key !== void 0 && taken.has(entry.key)) review.push({
783
- line: lineAt(source, entry.start),
784
- message: `\`records.${entry.key}\` is dropped: \`subjects.${entry.key}\` already exists and wins`
785
- });
786
- else moved.push(source.slice(entry.start, entry.valueEnd));
787
- if (moved.length > 0) edits.push(insertion(source, code, subjects.valueStart, closingIndex(code, subjects.valueStart), into, moved));
788
- edits.push(removal$1(code, records, close));
789
- }
790
- }
791
- for (const prop of props) {
792
- if (prop.key === void 0 || code[prop.valueStart] !== "{") continue;
793
- if (ENVIRONMENT_KEY$1.test(prop.key)) edits.push(...renameIn(source, code, prop.valueStart, review));
794
- else if (prop.key === "$env") {
795
- for (const environment of properties(source, code, prop.valueStart) ?? []) if (code[environment.valueStart] === "{") edits.push(...renameIn(source, code, environment.valueStart, review));
796
- }
797
- }
798
- return edits;
799
- }
800
- function renameJson(value, review) {
801
- if (!isRecord$1(value)) return value;
802
- const { records, ...rest } = value;
803
- const out = { ...rest };
804
- if (records !== void 0) {
805
- const subjects = rest["subjects"];
806
- if (subjects === void 0) out["subjects"] = records;
807
- else if (isRecord$1(records) && isRecord$1(subjects)) {
808
- for (const key of Object.keys(records)) if (key in subjects) review.push({
809
- line: 1,
810
- message: `\`records.${key}\` is dropped: \`subjects.${key}\` already exists and wins`
811
- });
812
- out["subjects"] = {
813
- ...records,
814
- ...subjects
815
- };
816
- } else {
817
- out["records"] = records;
818
- review.push({
819
- line: 1,
820
- message: "`records` and `subjects` are both set and one isn't an object: move the `records` entries into `subjects` by hand"
821
- });
822
- }
823
- }
824
- for (const [key, entry] of Object.entries(out)) if (ENVIRONMENT_KEY$1.test(key)) out[key] = renameJson(entry, review);
825
- else if (key === "$env" && isRecord$1(entry)) out[key] = Object.fromEntries(Object.entries(entry).map(([name, block]) => [name, renameJson(block, review)]));
826
- return out;
827
- }
828
- /**
829
- * `better-supabase.config.*` with `records` renamed to `subjects`, at the top
830
- * level and in the `$env` and `$<environment>` blocks. Where both keys are set,
831
- * the `records` entries move into `subjects` and an existing `subjects` entry
832
- * wins, as the 0.29 config loader merges them.
833
- */
834
- function recordsToSubjects(source, json) {
835
- const review = [];
836
- if (json) {
837
- let parsed;
838
- try {
839
- parsed = JSON.parse(source);
840
- } catch {
841
- return {
842
- ok: false,
843
- reason: "the file is not valid JSON"
844
- };
845
- }
846
- const renamed = renameJson(parsed, review);
847
- return JSON.stringify(renamed) === JSON.stringify(parsed) ? {
848
- ok: true,
849
- text: source,
850
- review
851
- } : {
852
- ok: true,
853
- text: `${JSON.stringify(renamed, null, 2)}\n`,
854
- review
855
- };
856
- }
857
- const code = mask(source);
858
- const open = configObject(code);
859
- if (open === void 0) return /\brecords\s*:/.test(code) ? {
860
- ok: false,
861
- reason: "no defineConfig({...}) or exported object literal; rename `records` to `subjects` by hand"
862
- } : {
863
- ok: true,
864
- text: source,
865
- review
866
- };
867
- return {
868
- ok: true,
869
- text: applyEdits$3(source, renameIn(source, code, open, review)),
870
- review
871
- };
872
- }
873
- const COMMENT = /(comment\s+on\s+table\s+(?:"?[\w$]+"?\.)?"?[\w$]+"?\s+is\s+)'((?:[^']|'')*)'(\s*;)/giu;
874
- /**
875
- * `sql` with the `@bsb record` tags of its `comment on table` statements
876
- * renamed to `subject`. A comment that has both keeps `subject` and drops
877
- * `record`, with a review line.
878
- */
879
- function recordTagsToSubject(sql) {
880
- const review = [];
881
- return {
882
- text: sql.replaceAll(COMMENT, (statement, head, body, tail, offset) => {
883
- const parsed = parseBsbComment(body.replaceAll("''", "'"));
884
- if (!parsed.tags.some((tag) => tag.name === "record")) return statement;
885
- const hasSubject = parsed.tags.some((tag) => tag.name === "subject");
886
- if (hasSubject) review.push({
887
- line: lineAt(sql, offset),
888
- message: "The `record` tag is dropped: the comment already has a `subject` tag, which wins"
889
- });
890
- return `${head}'${formatBsbComment({
891
- text: parsed.text,
892
- tags: parsed.tags.flatMap((tag) => tag.name === "record" ? hasSubject ? [] : [{
893
- ...tag,
894
- name: "subject"
895
- }] : [tag])
896
- }).replaceAll("'", "''")}'${tail}`;
897
- }),
898
- review
899
- };
900
- }
901
- const CODEMOD_0_29 = {
902
- name: "0.29",
903
- description: "Renames records back to subjects in better-supabase.config.*, reversing the 0.15 rename (at the top level and in the $env and $<environment> blocks; where both are set, the records entries move into subjects and an existing subjects entry wins), and renames @bsb record tags to subject in the comment on table statements of supabase/schemas",
904
- configFile: recordsToSubjects,
905
- sqlFile: recordTagsToSubject
906
- };
907
- //#endregion
908
- //#region src/cli/sql/config-adopt.ts
909
- const ADOPT = /(?:\bownership|"ownership"|'ownership')\s*:\s*(["'])adopt\1[ \t]*,?/g;
910
- const lineOf$1 = (text, index) => text.slice(0, index).split("\n").length;
911
- /** `[start, end)` to delete for the property matched at `start..end`. */
912
- function span(text, start, end) {
913
- const lineStart = text.lastIndexOf("\n", start - 1) + 1;
914
- const newline = text.indexOf("\n", end);
915
- const lineEnd = newline === -1 ? text.length : newline;
916
- if (text.slice(lineStart, start).trim() === "" && text.slice(end, lineEnd).trim() === "") {
917
- const after = newline === -1 ? lineEnd : lineEnd + 1;
918
- const before = text.slice(0, lineStart).trimEnd();
919
- return text[end - 1] !== "," && before.endsWith(",") ? [before.length - 1, lineEnd] : [lineStart, after];
920
- }
921
- if (text[end - 1] === ",") return [start, end + (/^[ \t]*/.exec(text.slice(end))?.[0].length ?? 0)];
922
- const before = text.slice(0, start).trimEnd();
923
- return before.endsWith(",") ? [before.length - 1, end] : [start, end];
924
- }
925
- /** `source` without its `ownership: "adopt"` keys, and a review line each. */
926
- function removeAdoptOwnership(source, json) {
927
- const code = json ? source : mask(source);
928
- const spans = [];
929
- const review = [];
930
- for (const match of source.matchAll(ADOPT)) {
931
- const start = match.index;
932
- const value = source.indexOf(match[1], start + 9 + 1);
933
- if (!json && (code[start] === " " || code[value] !== match[1])) continue;
934
- const removed = span(source, start, start + match[0].length);
935
- const linesBefore = spans.map(([from, to]) => source.slice(from, to).split("\n").length - 1).reduce((sum, count) => sum + count, 0);
936
- review.push({
937
- line: Math.max(lineOf$1(source, removed[0]) - linesBefore, 1),
938
- message: "removed ownership: \"adopt\": the block now leaves alone every table your schema already has and keeps its tables and columns mappings. Run `better-supabase upgrade` to write its SQL over them"
939
- });
940
- spans.push(removed);
941
- }
942
- let text = source;
943
- for (const [start, end] of spans.toReversed()) text = text.slice(0, start) + text.slice(end);
944
- return {
945
- text,
946
- review
947
- };
948
- }
949
- /** `edit` with `ownership: "adopt"` removed from every block. */
950
- function withoutAdoptOwnership(edit, json) {
951
- if (!edit.ok) return edit;
952
- const earlier = "review" in edit ? edit.review : [];
953
- const { text, review } = removeAdoptOwnership(edit.text, json);
954
- return {
955
- ok: true,
956
- text,
957
- review: [...earlier, ...review]
958
- };
959
- }
960
- //#endregion
961
- //#region src/cli/sql/config-block-names.ts
962
- const ENVIRONMENT_KEY = /^\$(?:development|production|test|ci)$/;
963
- const STRING = /(["'`])([a-z0-9-]+)\1/g;
964
- const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
965
- /** An operation name (`<block>.<action>`) under its block's 0.15 name. */
966
- function currentOperationName(name) {
967
- const dot = name.indexOf(".");
968
- const to = dot === -1 ? void 0 : renamedBlock(name.slice(0, dot));
969
- return to === void 0 ? name : `${to}${name.slice(dot)}`;
970
- }
971
- function applyEdits$2(source, edits) {
972
- let text = source;
973
- for (const edit of edits.toSorted((a, b) => b.start - a.start)) text = text.slice(0, edit.start) + edit.text + text.slice(edit.end);
974
- return text;
975
- }
976
- /** The key token at `start` renamed to `to`, keeping its quotes. */
977
- function keyEdit(source, start, key, to) {
978
- const quote = source[start];
979
- const quoted = quote === "\"" || quote === "'";
980
- const bare = /^[A-Za-z_$][\w$]*$/.test(to);
981
- return {
982
- start,
983
- end: start + key.length + (quoted ? 2 : 0),
984
- text: quoted ? `${quote}${to}${quote}` : bare ? to : `"${to}"`
985
- };
986
- }
987
- /** Edits renaming the keys of the object literal at `open` with `rename`. */
988
- function keyEdits(source, code, open, rename) {
989
- return (properties(source, code, open) ?? []).flatMap((prop) => {
990
- if (prop.key === void 0 || prop.valueStart === prop.start) return [];
991
- const to = rename(prop.key);
992
- return to === prop.key ? [] : [keyEdit(source, prop.start, prop.key, to)];
993
- });
994
- }
995
- /**
996
- * Edits renaming the block names among the string literals of the array at
997
- * `open`.
998
- */
999
- function listEdits(source, code, open) {
1000
- const close = closingIndex(code, open);
1001
- if (close === -1) return [];
1002
- return [...source.slice(open, close).matchAll(STRING)].flatMap((match) => {
1003
- const to = renamedBlock(match[2]);
1004
- const start = open + match.index + 1;
1005
- return to === void 0 ? [] : [{
1006
- start,
1007
- end: start + match[2].length,
1008
- text: to
1009
- }];
1010
- });
1011
- }
1012
- /** The value at `index` when it opens an object or an array. */
1013
- const opens = (code, index) => code[index] === "{" || code[index] === "[" ? code[index] : void 0;
1014
- /** The value of `key` in the object literal at `open`, when it is a literal. */
1015
- function valueOf(source, code, open, key) {
1016
- const prop = properties(source, code, open)?.find((entry) => entry.key === key);
1017
- return prop === void 0 || opens(code, prop.valueStart) === void 0 ? void 0 : prop.valueStart;
1018
- }
1019
- function objectEdits(source, code, open) {
1020
- const edits = [];
1021
- for (const prop of properties(source, code, open) ?? []) {
1022
- const kind = opens(code, prop.valueStart);
1023
- if (prop.key === void 0 || kind === void 0) continue;
1024
- if (prop.key === "blocks") edits.push(...kind === "[" ? listEdits(source, code, prop.valueStart) : keyEdits(source, code, prop.valueStart, (key) => renamedBlock(key) ?? key));
1025
- else if (prop.key === "preset" && kind === "{") {
1026
- const blocks = valueOf(source, code, prop.valueStart, "blocks");
1027
- if (blocks !== void 0 && code[blocks] === "[") edits.push(...listEdits(source, code, blocks));
1028
- } else if (prop.key === "auth" && kind === "{") {
1029
- const authorization = valueOf(source, code, prop.valueStart, "authorization");
1030
- const operations = authorization !== void 0 && code[authorization] === "{" ? valueOf(source, code, authorization, "operations") : void 0;
1031
- if (operations !== void 0 && code[operations] === "{") edits.push(...keyEdits(source, code, operations, currentOperationName));
1032
- } else if (prop.key === "$env" && kind === "{") {
1033
- for (const env of properties(source, code, prop.valueStart) ?? []) if (code[env.valueStart] === "{") edits.push(...objectEdits(source, code, env.valueStart));
1034
- } else if (ENVIRONMENT_KEY.test(prop.key) && kind === "{") edits.push(...objectEdits(source, code, prop.valueStart));
1035
- }
1036
- return edits;
1037
- }
1038
- /** `better-supabase.config.ts`, grouped, with the 0.15 block names. */
1039
- function renameBlocksInSource(source) {
1040
- const code = mask(source);
1041
- const open = configObject(code);
1042
- if (open === void 0) return {
1043
- ok: false,
1044
- reason: "no defineConfig({...}) or default export object found"
1045
- };
1046
- return {
1047
- ok: true,
1048
- text: applyEdits$2(source, objectEdits(source, code, open))
1049
- };
1050
- }
1051
- function renameKeys(value, rename) {
1052
- return isObject(value) ? Object.fromEntries(Object.entries(value).map(([key, entry]) => [rename(key), entry])) : value;
1053
- }
1054
- const renameList = (value) => Array.isArray(value) ? value.map((entry) => typeof entry === "string" ? renamedBlock(entry) ?? entry : entry) : value;
1055
- /** A parsed config object with the 0.15 block names. */
1056
- function renameBlocksInConfig(config) {
1057
- const out = {};
1058
- for (const [key, value] of Object.entries(config)) if (key === "blocks") out[key] = Array.isArray(value) ? renameList(value) : renameKeys(value, (name) => renamedBlock(name) ?? name);
1059
- else if (key === "preset" && isObject(value)) out[key] = value["blocks"] === void 0 ? value : {
1060
- ...value,
1061
- blocks: renameList(value["blocks"])
1062
- };
1063
- else if (key === "auth" && isObject(value)) {
1064
- const authorization = value["authorization"];
1065
- out[key] = isObject(authorization) ? {
1066
- ...value,
1067
- authorization: authorization["operations"] === void 0 ? authorization : {
1068
- ...authorization,
1069
- operations: renameKeys(authorization["operations"], currentOperationName)
1070
- }
1071
- } : value;
1072
- } else if (key === "$env" && isObject(value) || ENVIRONMENT_KEY.test(key) && isObject(value)) out[key] = key === "$env" ? Object.fromEntries(Object.entries(value).map(([name, entry]) => [name, isObject(entry) ? renameBlocksInConfig(entry) : entry])) : renameBlocksInConfig(value);
1073
- else out[key] = value;
1074
- return out;
1075
- }
1076
- /** `edit`, then the 0.15 block names on its text. */
1077
- function withBlockNames(edit, json) {
1078
- if (!edit.ok) return edit;
1079
- if (!json) return renameBlocksInSource(edit.text);
1080
- const config = JSON.parse(edit.text);
1081
- if (!isObject(config)) return edit;
1082
- const renamed = renameBlocksInConfig(config);
1083
- return JSON.stringify(renamed) === JSON.stringify(config) ? edit : {
1084
- ok: true,
1085
- text: `${JSON.stringify(renamed, null, 2)}\n`
1086
- };
1087
- }
1088
- //#endregion
1089
- //#region src/cli/sql/config-block-on.ts
1090
- const OPTIONS = /\boptions\s*:\s*\{/g;
1091
- const KEY_BEFORE = /(?:["']([\w-]+)["']|([A-Za-z_$][\w$-]*))\s*:\s*$/;
1092
- function applyEdits$1(source, edits) {
1093
- let text = source;
1094
- for (const edit of edits.toSorted((a, b) => b.start - a.start)) text = text.slice(0, edit.start) + edit.text + text.slice(edit.end);
1095
- return text;
1096
- }
1097
- /** The `{` of the object literal that holds the code at `index`. */
1098
- function enclosingObject(code, index) {
1099
- let depth = 0;
1100
- for (let at = index - 1; at >= 0; at -= 1) {
1101
- const char = code[at];
1102
- if (char === "}" || char === "]" || char === ")") depth += 1;
1103
- else if (char === "{" || char === "[" || char === "(") {
1104
- if (depth === 0) return char === "{" ? at : void 0;
1105
- depth -= 1;
1106
- }
1107
- }
1108
- }
1109
- /** The block an entry installs: its `block` string, or the key it sits under. */
1110
- function blockOf(source, open, props) {
1111
- const block = props.find((prop) => prop.key === "block");
1112
- if (block !== void 0) return /^["']([\w-]+)["']$/.exec(source.slice(block.valueStart, block.valueEnd))?.[1];
1113
- const key = KEY_BEFORE.exec(source.slice(0, open));
1114
- return key?.[1] ?? key?.[2];
1115
- }
1116
- /** `{ deal: ["amount"] }` as `{ deal: { fields: ["amount"] } }`. */
1117
- function wrapFields(source, code, open) {
1118
- return (properties(source, code, open) ?? []).flatMap((prop) => prop.key !== void 0 && code[prop.valueStart] === "[" ? [{
1119
- start: prop.valueStart,
1120
- end: prop.valueEnd,
1121
- text: `{ fields: ${source.slice(prop.valueStart, prop.valueEnd)} }`
1122
- }] : []);
1123
- }
1124
- /** `text` moved one object level out: two spaces fewer after each newline. */
1125
- const outdented = (text) => text.replaceAll(/\n {2}/g, "\n");
1126
- /** The edit that removes `props[index]` from its object literal. */
1127
- function removal(props, index) {
1128
- const next = props[index + 1];
1129
- const previous = props[index - 1];
1130
- const prop = props[index];
1131
- if (next !== void 0) return {
1132
- start: prop.start,
1133
- end: next.start,
1134
- text: ""
1135
- };
1136
- return {
1137
- start: previous?.valueEnd ?? prop.start,
1138
- end: prop.valueEnd,
1139
- text: ""
1140
- };
1141
- }
1142
- const lineOf = (source, index) => source.slice(0, index).split("\n").length;
1143
- /**
1144
- * `source` with every `options.subjects` of a block entry moved to the entry's
1145
- * `on`. An entry that already sets `on` is left and listed for review.
1146
- */
1147
- function moveSubjectsToOnInSource(source) {
1148
- const code = mask(source);
1149
- const edits = [];
1150
- const review = [];
1151
- for (const match of code.matchAll(OPTIONS)) {
1152
- const valueOpen = match.index + match[0].length - 1;
1153
- const entryOpen = enclosingObject(code, match.index);
1154
- if (entryOpen === void 0) continue;
1155
- const entry = properties(source, code, entryOpen) ?? [];
1156
- const options = entry.find((prop) => prop.key === "options" && prop.valueStart === valueOpen);
1157
- const inner = properties(source, code, valueOpen) ?? [];
1158
- const index = inner.findIndex((prop) => prop.key === "subjects");
1159
- if (options === void 0 || index === -1) continue;
1160
- if (entry.some((prop) => prop.key === "on")) {
1161
- review.push({
1162
- line: lineOf(source, match.index),
1163
- message: "options.subjects moved to on, and this block already sets on: merge them into on"
1164
- });
1165
- continue;
1166
- }
1167
- const subjects = inner[index];
1168
- const shorthand = subjects.valueStart === subjects.start;
1169
- const wrap = !shorthand && code[subjects.valueStart] === "{" && blockOf(source, entryOpen, entry) === "field-history";
1170
- const slice = source.slice(subjects.valueStart, subjects.valueEnd);
1171
- const raw = shorthand ? "subjects" : wrap ? applyEdits$1(slice, wrapFields(source, code, subjects.valueStart).map((edit) => ({
1172
- ...edit,
1173
- start: edit.start - subjects.valueStart,
1174
- end: edit.end - subjects.valueStart
1175
- }))) : slice;
1176
- const on = `on: ${outdented(raw)}`;
1177
- if (inner.length === 1) {
1178
- edits.push({
1179
- start: options.start,
1180
- end: options.valueEnd,
1181
- text: on
1182
- });
1183
- continue;
1184
- }
1185
- const multiline = code.slice(entryOpen, closingIndex(code, entryOpen)).includes("\n");
1186
- edits.push({
1187
- start: options.start,
1188
- end: options.start,
1189
- text: `${on},${multiline ? `\n${indentAt(source, options.start)}` : " "}`
1190
- }, removal(inner, index));
1191
- }
1192
- return {
1193
- text: applyEdits$1(source, edits),
1194
- review
1195
- };
1196
- }
1197
- function moveInObject(value) {
1198
- if (Array.isArray(value)) return value.map(moveInObject);
1199
- if (!isRecord$1(value)) return value;
1200
- const entries = Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, moveInObject(entry)]));
1201
- const options = entries["options"];
1202
- if (!isRecord$1(options) || options["subjects"] === void 0 || entries["on"] !== void 0) return entries;
1203
- const { subjects, ...rest } = options;
1204
- const { options: _, ...withoutOptions } = entries;
1205
- return {
1206
- ...withoutOptions,
1207
- on: subjects,
1208
- ...Object.keys(rest).length > 0 && { options: rest }
1209
- };
1210
- }
1211
- /** Field history's `on`, with each column list as `{ fields }`. */
1212
- function fieldHistoryOn(config) {
1213
- if (!isRecord$1(config) || !isRecord$1(config["blocks"])) return config;
1214
- const history = config["blocks"]["field-history"];
1215
- if (!isRecord$1(history) || !isRecord$1(history["on"])) return config;
1216
- const on = Object.fromEntries(Object.entries(history["on"]).map(([type, fields]) => [type, Array.isArray(fields) ? { fields } : fields]));
1217
- return {
1218
- ...config,
1219
- blocks: {
1220
- ...config["blocks"],
1221
- "field-history": {
1222
- ...history,
1223
- on
1224
- }
1225
- }
1226
- };
1227
- }
1228
- /** `edit`, then every `options.subjects` moved to `on`. */
1229
- function withSubjectsOn(edit, json) {
1230
- if (!edit.ok) return edit;
1231
- const before = "review" in edit ? edit.review : [];
1232
- if (!json) {
1233
- const moved = moveSubjectsToOnInSource(edit.text);
1234
- return {
1235
- ok: true,
1236
- text: moved.text,
1237
- review: [...before, ...moved.review]
1238
- };
1239
- }
1240
- const config = JSON.parse(edit.text);
1241
- const moved = fieldHistoryOn(moveInObject(config));
1242
- return {
1243
- ok: true,
1244
- text: JSON.stringify(moved) === JSON.stringify(config) ? edit.text : `${JSON.stringify(moved, null, 2)}\n`,
1245
- review: before
1246
- };
1247
- }
1248
- //#endregion
1249
- //#region src/cli/sql/config-move.ts
1250
- const lineStart = (source, index) => source.lastIndexOf("\n", index - 1) + 1;
1251
- function propertySpan(source, code, open, props, index) {
1252
- const prop = props[index];
1253
- const previous = props[index - 1];
1254
- if (prop === void 0) throw new Error(`no property at ${index}`);
1255
- const close = closingIndex(code, open);
1256
- const multiline = code.slice(open, close).includes("\n");
1257
- const after = skipSpace(code, prop.valueEnd);
1258
- const hasComma = code[after] === ",";
1259
- const tailFrom = hasComma ? after + 1 : prop.valueEnd;
1260
- if (!multiline) {
1261
- const value = source.slice(prop.start, prop.valueEnd);
1262
- if (previous) return {
1263
- start: previous.valueEnd,
1264
- end: prop.valueEnd,
1265
- value,
1266
- keyAt: 0,
1267
- trailing: "",
1268
- hasComma,
1269
- multiline
1270
- };
1271
- return {
1272
- start: prop.start,
1273
- end: hasComma ? skipSpace(code, tailFrom) : prop.valueEnd,
1274
- value,
1275
- keyAt: 0,
1276
- trailing: "",
1277
- hasComma,
1278
- multiline
1279
- };
1280
- }
1281
- let before = open + 1;
1282
- if (previous) {
1283
- const comma = skipSpace(code, previous.valueEnd);
1284
- before = code[comma] === "," ? comma + 1 : previous.valueEnd;
1285
- }
1286
- const newline = source.slice(before, prop.start).indexOf("\n");
1287
- const start = newline === -1 ? prop.start : before + newline + 1;
1288
- const lineEnd = source.indexOf("\n", tailFrom);
1289
- const restIsBlank = lineEnd !== -1 && code.slice(tailFrom, lineEnd).trim() === "";
1290
- return {
1291
- start,
1292
- end: restIsBlank ? lineEnd + 1 : tailFrom,
1293
- value: source.slice(start, prop.valueEnd),
1294
- keyAt: prop.start - start,
1295
- trailing: restIsBlank ? source.slice(tailFrom, lineEnd).trimEnd() : "",
1296
- hasComma,
1297
- multiline
1298
- };
1299
- }
1300
- /** `modules: ...` as `blocks: ...`, keeping the key's quotes. */
1301
- function renameKey(text, keyAt, prop) {
1302
- const head = text.slice(keyAt);
1303
- const quoted = /^(["'])modules\1/.exec(head);
1304
- if (quoted) {
1305
- const quote = quoted[1] ?? "\"";
1306
- return `${text.slice(0, keyAt)}${quote}blocks${quote}${head.slice(quoted[0].length)}`;
1307
- }
1308
- if (prop.valueStart === prop.start) return `${text.slice(0, keyAt)}blocks: modules${head.slice(7)}`;
1309
- return `${text.slice(0, keyAt)}blocks${head.slice(7)}`;
1310
- }
1311
- function reindent(text, from, to) {
1312
- return text.split("\n").map((line) => line.startsWith(from) ? to + line.slice(from.length) : line).join("\n");
1313
- }
1314
- const sortKey = (key) => (key ?? "").toLowerCase();
1315
- function keysSorted(keys) {
1316
- return keys.every((key, index) => index === 0 || key !== void 0 && sortKey(keys[index - 1]) <= sortKey(key));
1317
- }
1318
- function rootKeys(source) {
1319
- const code = mask(source);
1320
- const root = configObject(code);
1321
- return (root === void 0 ? void 0 : properties(source, code, root))?.map((prop) => prop.key) ?? [];
1322
- }
1323
- function sortBlocksKey(source) {
1324
- const code = mask(source);
1325
- const root = configObject(code);
1326
- if (root === void 0) return source;
1327
- const props = properties(source, code, root);
1328
- const blocksIndex = props?.findIndex((prop) => prop.key === "blocks") ?? -1;
1329
- if (!props || blocksIndex === -1) return source;
1330
- const targetIndex = props.findIndex((prop, index) => index !== blocksIndex && sortKey(prop.key) > sortKey("blocks"));
1331
- if (targetIndex === -1 || targetIndex === blocksIndex + 1) return source;
1332
- const blocks = propertySpan(source, code, root, props, blocksIndex);
1333
- const target = props[targetIndex];
1334
- if (target.start > blocks.start) return source;
1335
- const at = blocks.multiline ? propertySpan(source, code, root, props, targetIndex).start : target.start;
1336
- const moved = blocks.multiline ? `${blocks.value},${blocks.trailing}\n` : `${blocks.value}, `;
1337
- return source.slice(0, at) + moved + source.slice(at, blocks.start) + source.slice(blocks.end);
1338
- }
1339
- /**
1340
- * `source` with `sql.modules` moved to a top-level `blocks` key, placed right
1341
- * after `sql`, or in sorted position when the config's top-level keys are
1342
- * sorted. `sql` is dropped when nothing else is left in it. A config without
1343
- * `sql.modules` comes back unchanged; one that also sets `blocks` is refused,
1344
- * because the two need a merge by hand.
1345
- */
1346
- function moveSqlModulesToBlocks(source) {
1347
- const edit = moveSqlModules(source);
1348
- return edit.ok && edit.text !== source && keysSorted(rootKeys(source)) ? {
1349
- ok: true,
1350
- text: sortBlocksKey(edit.text)
1351
- } : edit;
1352
- }
1353
- function moveSqlModules(source) {
1354
- const code = mask(source);
1355
- const root = configObject(code);
1356
- if (root === void 0) return /\bmodules\b/.test(code) ? {
1357
- ok: false,
1358
- reason: "it doesn't pass an object literal to defineConfig()"
1359
- } : {
1360
- ok: true,
1361
- text: source
1362
- };
1363
- const rootProps = properties(source, code, root);
1364
- if (!rootProps) return {
1365
- ok: false,
1366
- reason: "its config object can't be read"
1367
- };
1368
- const sqlIndex = rootProps.findIndex((prop) => prop.key === "sql");
1369
- const sql = rootProps[sqlIndex];
1370
- if (sql === void 0) return {
1371
- ok: true,
1372
- text: source
1373
- };
1374
- if (code[sql.valueStart] !== "{" || sql.valueStart === sql.start) return /\bmodules\b/.test(code) ? {
1375
- ok: false,
1376
- reason: "its `sql` value isn't an object literal; move `sql.modules` to `blocks` by hand"
1377
- } : {
1378
- ok: true,
1379
- text: source
1380
- };
1381
- const sqlProps = properties(source, code, sql.valueStart);
1382
- if (!sqlProps) return {
1383
- ok: false,
1384
- reason: "its `sql` object can't be read"
1385
- };
1386
- const modulesIndex = sqlProps.findIndex((prop) => prop.key === "modules");
1387
- const modules = sqlProps[modulesIndex];
1388
- if (modules === void 0) return {
1389
- ok: true,
1390
- text: source
1391
- };
1392
- if (rootProps.some((prop) => prop.key === "blocks")) return {
1393
- ok: false,
1394
- reason: "it sets both `sql.modules` and `blocks`; merge `sql.modules` into `blocks` by hand"
1395
- };
1396
- const cut = propertySpan(source, code, sql.valueStart, sqlProps, modulesIndex);
1397
- const outer = propertySpan(source, code, root, rootProps, sqlIndex);
1398
- const renamed = renameKey(cut.value, cut.keyAt, modules);
1399
- const sqlClose = closingIndex(code, sql.valueStart);
1400
- const leftover = source.slice(sql.valueStart + 1, cut.start) + source.slice(cut.end, sqlClose);
1401
- const dropSql = sqlProps.length === 1 && leftover.trim() === "";
1402
- if (!cut.multiline || !outer.multiline) {
1403
- const property = renamed.trim();
1404
- if (dropSql) return {
1405
- ok: true,
1406
- text: source.slice(0, sql.start) + property + source.slice(sql.valueEnd)
1407
- };
1408
- return {
1409
- ok: true,
1410
- text: `${source.slice(0, cut.start)}${source.slice(cut.end, sql.valueEnd)}, ${property}${source.slice(sql.valueEnd)}`
1411
- };
1412
- }
1413
- const sqlIndent = indentAt(source, sql.start);
1414
- const body = reindent(renamed, indentAt(source, modules.start), sqlIndent);
1415
- const moved = `${cut.start === modules.start ? sqlIndent + body : body},${cut.trailing}\n`;
1416
- if (dropSql) return {
1417
- ok: true,
1418
- text: source.slice(0, lineStart(source, sql.start)) + moved + source.slice(outer.end)
1419
- };
1420
- const atLineStart = source[outer.end - 1] === "\n";
1421
- return {
1422
- ok: true,
1423
- text: source.slice(0, cut.start) + source.slice(cut.end, sql.valueEnd) + (outer.hasComma ? "" : ",") + source.slice(sql.valueEnd, outer.end) + (atLineStart ? "" : "\n") + moved + source.slice(outer.end)
1424
- };
1425
- }
1426
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1427
- function withBlocksSorted(config) {
1428
- const entries = Object.entries(config).filter(([key]) => key !== "blocks");
1429
- const after = entries.findIndex(([key]) => sortKey(key) > "blocks");
1430
- entries.splice(after === -1 ? entries.length : after, 0, ["blocks", config["blocks"]]);
1431
- return Object.fromEntries(entries);
1432
- }
1433
- /** `moveSqlModulesToBlocks` for `better-supabase.config.json`. */
1434
- function moveSqlModulesToBlocksJson(source) {
1435
- let config;
1436
- try {
1437
- config = JSON.parse(source);
1438
- } catch {
1439
- return {
1440
- ok: false,
1441
- reason: "it isn't valid JSON"
1442
- };
1443
- }
1444
- if (!isRecord(config)) return {
1445
- ok: false,
1446
- reason: "it isn't a JSON object"
1447
- };
1448
- const sql = config["sql"];
1449
- if (!isRecord(sql) || !("modules" in sql)) return {
1450
- ok: true,
1451
- text: source
1452
- };
1453
- if ("blocks" in config) return {
1454
- ok: false,
1455
- reason: "it sets both `sql.modules` and `blocks`; merge `sql.modules` into `blocks` by hand"
1456
- };
1457
- const { modules, ...restSql } = sql;
1458
- const next = {};
1459
- for (const [key, value] of Object.entries(config)) {
1460
- if (key !== "sql") {
1461
- next[key] = value;
1462
- continue;
1463
- }
1464
- if (Object.keys(restSql).length > 0) next["sql"] = restSql;
1465
- next["blocks"] = modules;
1466
- }
1467
- const sorted = keysSorted(Object.keys(config)) ? withBlocksSorted(next) : next;
1468
- const indent = /^[ \t]+/m.exec(source)?.[0] ?? " ";
1469
- return {
1470
- ok: true,
1471
- text: `${JSON.stringify(sorted, null, indent)}\n`
1472
- };
1473
- }
1474
- /** Review lines for `sql.modules` left in environment blocks after the move. */
1475
- function environmentModules(text) {
1476
- return mask(text).split("\n").flatMap((line, index) => /\bmodules\s*:/.test(line) ? [{
1477
- line: index + 1,
1478
- message: "`sql.modules` in an environment block moves to `blocks` too"
1479
- }] : []);
1480
- }
1481
- //#endregion
1482
- //#region src/cli/sql/config-plugins.ts
1483
- /** The block each plugin flag became, and its column keys as block options. */
1484
- const PLUGIN_BLOCKS = {
1485
- timestamps: {
1486
- block: "updated-at",
1487
- options: {
1488
- createdAt: "createdAt",
1489
- updatedAt: "updatedAt"
1490
- }
1491
- },
1492
- actor: {
1493
- block: "created-by",
1494
- options: {
1495
- createdBy: "createdBy",
1496
- updatedBy: "updatedBy",
1497
- impersonatedBy: "impersonatedBy"
1498
- }
1499
- },
1500
- softDelete: {
1501
- block: "trash",
1502
- options: { column: "deletedAt" }
1503
- }
1504
- };
1505
- const DEFAULT_ORGANIZATION_COLUMN = "organization_id";
1506
- function movesOf(flags) {
1507
- const blocks = [];
1508
- let tenant = false;
1509
- for (const [name, flag] of Object.entries(flags)) {
1510
- if (name === "tenant") {
1511
- tenant = flag !== false;
1512
- continue;
1513
- }
1514
- const move = PLUGIN_BLOCKS[name];
1515
- if (move === void 0) return { reason: `plugins.${name} is not a plugin flag 0.14 had` };
1516
- if (flag === false) continue;
1517
- const options = {};
1518
- for (const [key, value] of Object.entries(flag)) {
1519
- const option = move.options[key];
1520
- if (option === void 0) return { reason: `plugins.${name}.${key} is not a column it took` };
1521
- options[option] = value;
1522
- }
1523
- blocks.push([move.block, options]);
1524
- }
1525
- return {
1526
- blocks,
1527
- tenant
1528
- };
1529
- }
1530
- /** A string literal's value, or undefined for any other expression. */
1531
- function stringValue(text) {
1532
- return /^(["'])((?:(?!\1)[^\\])*)\1$/.exec(text.trim())?.[2];
1533
- }
1534
- function flagsInSource(source, code, open) {
1535
- const flags = {};
1536
- for (const prop of properties(source, code, open) ?? []) {
1537
- const value = source.slice(prop.valueStart, prop.valueEnd).trim();
1538
- if (prop.key === void 0) return { reason: "plugins has a spread or a computed key" };
1539
- if (value === "true" || value === "false") {
1540
- flags[prop.key] = value === "true" ? {} : false;
1541
- continue;
1542
- }
1543
- if (code[prop.valueStart] !== "{") return { reason: `plugins.${prop.key} isn't true, false or an object` };
1544
- const columns = {};
1545
- for (const inner of properties(source, code, prop.valueStart) ?? []) {
1546
- const column = stringValue(source.slice(inner.valueStart, inner.valueEnd));
1547
- if (inner.key === void 0 || column === void 0) return { reason: `plugins.${prop.key} has a key that isn't a string` };
1548
- columns[inner.key] = column;
1549
- }
1550
- flags[prop.key] = columns;
1551
- }
1552
- return flags;
1553
- }
1554
- /** Whether the `blocks` value names `memberships`, as a key or a list item. */
1555
- const MEMBERSHIPS = /["']memberships["']|\bmemberships\s*:/;
1556
- /** `better-supabase.config.ts` with `plugins` moved into blocks. */
1557
- function movePluginsInSource(source) {
1558
- const code = mask(source);
1559
- const root = configObject(code);
1560
- if (root === void 0) return {
1561
- ok: true,
1562
- text: source
1563
- };
1564
- const props = properties(source, code, root) ?? [];
1565
- const index = props.findIndex((prop) => prop.key === "plugins");
1566
- const plugins = props[index];
1567
- if (plugins === void 0) return {
1568
- ok: true,
1569
- text: source
1570
- };
1571
- if (code[plugins.valueStart] !== "{") return {
1572
- ok: false,
1573
- reason: "its plugins key isn't a literal object"
1574
- };
1575
- const flags = flagsInSource(source, code, plugins.valueStart);
1576
- if ("reason" in flags) return {
1577
- ok: false,
1578
- reason: String(flags.reason)
1579
- };
1580
- const moves = movesOf(flags);
1581
- if ("reason" in moves) return {
1582
- ok: false,
1583
- reason: moves.reason
1584
- };
1585
- const multiline = code.slice(root, closingIndex(code, root)).includes("\n");
1586
- const cut = cutRange(source, code, root, props, index, multiline);
1587
- let edit = {
1588
- ok: true,
1589
- text: source.slice(0, cut.start) + source.slice(cut.end)
1590
- };
1591
- const blocks = props.find((prop) => prop.key === "blocks");
1592
- const memberships = blocks !== void 0 && MEMBERSHIPS.test(source.slice(blocks.valueStart, blocks.valueEnd));
1593
- const organization = organizationText(source, code, props);
1594
- const organizationColumn = /\bcolumn\s*:/.test(organization);
1595
- const onMissing = /\bonMissing\s*:/.test(organization);
1596
- const steps = [
1597
- ...moves.blocks.flatMap(([block, options]) => [(text) => addBlocksToConfig(text, [block]), ...Object.entries(options).map(([key, value]) => (text) => setPathInConfig(text, [
1598
- "blocks",
1599
- block,
1600
- "options",
1601
- key
1602
- ], value))]),
1603
- ...moves.tenant && !memberships && !organizationColumn ? [(text) => setPathInConfig(text, [
1604
- "auth",
1605
- "organization",
1606
- "column"
1607
- ], DEFAULT_ORGANIZATION_COLUMN)] : [],
1608
- ...moves.tenant && !onMissing ? [(text) => setPathInConfig(text, [
1609
- "auth",
1610
- "organization",
1611
- "onMissing"
1612
- ], "error")] : []
1613
- ];
1614
- for (const step of steps) {
1615
- if (!edit.ok) return edit;
1616
- edit = step(edit.text);
1617
- }
1618
- return edit;
1619
- }
1620
- /** The source of `auth.organization`, or `""` without one. */
1621
- function organizationText(source, code, props) {
1622
- const auth = props.find((prop) => prop.key === "auth");
1623
- if (auth === void 0 || code[auth.valueStart] !== "{") return "";
1624
- const organization = (properties(source, code, auth.valueStart) ?? []).find((prop) => prop.key === "organization");
1625
- return organization === void 0 ? "" : source.slice(organization.valueStart, organization.valueEnd);
1626
- }
1627
- const isColumns = (value) => isRecord$1(value) && Object.values(value).every((column) => typeof column === "string");
1628
- function flagsInJson(plugins) {
1629
- if (!isRecord$1(plugins)) return { reason: "its plugins key isn't an object" };
1630
- const flags = {};
1631
- for (const [name, value] of Object.entries(plugins)) if (typeof value === "boolean") flags[name] = value ? {} : false;
1632
- else if (isColumns(value)) flags[name] = value;
1633
- else return { reason: `plugins.${name} isn't true, false or columns` };
1634
- return flags;
1635
- }
1636
- const objectAt$1 = (value) => isRecord$1(value) ? value : {};
1637
- /** `movePluginsInSource` for `better-supabase.config.json`. */
1638
- function movePluginsInJson(source) {
1639
- let config;
1640
- try {
1641
- config = JSON.parse(source);
1642
- } catch {
1643
- return {
1644
- ok: true,
1645
- text: source
1646
- };
1647
- }
1648
- if (!isRecord$1(config) || !("plugins" in config)) return {
1649
- ok: true,
1650
- text: source
1651
- };
1652
- const { plugins, ...rest } = config;
1653
- const flags = flagsInJson(plugins);
1654
- if ("reason" in flags) return {
1655
- ok: false,
1656
- reason: String(flags.reason)
1657
- };
1658
- const moves = movesOf(flags);
1659
- if ("reason" in moves) return {
1660
- ok: false,
1661
- reason: moves.reason
1662
- };
1663
- const listed = rest["blocks"] ?? {};
1664
- const blocks = Array.isArray(listed) ? Object.fromEntries(listed.map((name) => [String(name), {}])) : { ...objectAt$1(listed) };
1665
- const memberships = "memberships" in blocks;
1666
- for (const [block, options] of moves.blocks) {
1667
- const entry = objectAt$1(blocks[block]);
1668
- blocks[block] = {
1669
- ...entry,
1670
- ...Object.keys(options).length === 0 ? {} : { options: {
1671
- ...objectAt$1(entry["options"]),
1672
- ...options
1673
- } }
1674
- };
1675
- }
1676
- const next = {
1677
- ...rest,
1678
- ...moves.blocks.length === 0 && rest["blocks"] === void 0 ? {} : { blocks: moves.blocks.length === 0 ? rest["blocks"] : blocks }
1679
- };
1680
- if (moves.tenant) {
1681
- const auth = objectAt$1(next["auth"]);
1682
- const organization = objectAt$1(auth["organization"]);
1683
- next["auth"] = {
1684
- ...auth,
1685
- organization: {
1686
- ...memberships ? {} : { column: DEFAULT_ORGANIZATION_COLUMN },
1687
- onMissing: "error",
1688
- ...organization
1689
- }
1690
- };
1691
- }
1692
- const indent = /^[ \t]+/m.exec(source)?.[0] ?? " ";
1693
- return {
1694
- ok: true,
1695
- text: `${JSON.stringify(next, null, indent)}\n`
1696
- };
1697
- }
1698
- /** `edit` with `plugins` moved into blocks, after the regrouping. */
1699
- function withoutPlugins(edit, json) {
1700
- if (!edit.ok) return edit;
1701
- return json ? movePluginsInJson(edit.text) : movePluginsInSource(edit.text);
1702
- }
1703
- //#endregion
1704
- //#region src/cli/sql/config-webhook-format.ts
1705
- const PATH = [
1706
- "blocks",
1707
- "webhooks-out",
1708
- "options",
1709
- "defaultFormat"
1710
- ];
1711
- function needsPin(block) {
1712
- if (!isRecord$1(block) || block["mode"] !== "adopt") return false;
1713
- const options = block["options"];
1714
- const columns = block["columns"];
1715
- const endpoints = isRecord$1(columns) ? columns["endpoints"] : void 0;
1716
- return !(isRecord$1(options) && options["defaultFormat"] !== void 0) && !(isRecord$1(endpoints) && endpoints["format"] !== void 0);
1717
- }
1718
- function pinJson(source, format) {
1719
- let config;
1720
- try {
1721
- config = JSON.parse(source);
1722
- } catch {
1723
- return {
1724
- ok: false,
1725
- reason: "it isn't valid JSON"
1726
- };
1727
- }
1728
- const blocks = isRecord$1(config) ? config["blocks"] : void 0;
1729
- return isRecord$1(blocks) && needsPin(blocks["webhooks-out"]) ? setPathInJson(source, PATH, format) : void 0;
1730
- }
1731
- /** The object literal at `prop`'s value, or `undefined` when it isn't one. */
1732
- function objectAt(source, code, prop) {
1733
- return prop && code[prop.valueStart] === "{" ? properties(source, code, prop.valueStart) : void 0;
1734
- }
1735
- function pinTs(source, format) {
1736
- const code = mask(source);
1737
- const root = configObject(code);
1738
- if (root === void 0) return;
1739
- const find = (props, key) => props?.find((prop) => prop.key === key);
1740
- const blockProp = find(objectAt(source, code, find(properties(source, code, root), "blocks")), "webhooks-out");
1741
- if (!blockProp) return;
1742
- const block = objectAt(source, code, blockProp);
1743
- if (!block) return {
1744
- ok: false,
1745
- reason: "its blocks[\"webhooks-out\"] isn't a literal object"
1746
- };
1747
- const mode = find(block, "mode");
1748
- const modeText = mode ? source.slice(mode.valueStart, mode.valueEnd).trim() : void 0;
1749
- if (modeText !== "\"adopt\"" && modeText !== "'adopt'") return;
1750
- const options = find(block, "options");
1751
- const columns = find(block, "columns");
1752
- if (options && !objectAt(source, code, options) || columns && !objectAt(source, code, columns)) return {
1753
- ok: false,
1754
- reason: "its blocks[\"webhooks-out\"] options or columns aren't literal objects"
1755
- };
1756
- const endpoints = find(objectAt(source, code, columns), "endpoints");
1757
- if (endpoints && !objectAt(source, code, endpoints)) return {
1758
- ok: false,
1759
- reason: "its blocks[\"webhooks-out\"].columns.endpoints isn't a literal object"
1760
- };
1761
- if (find(objectAt(source, code, options), "defaultFormat") || find(objectAt(source, code, endpoints), "format")) return;
1762
- return setPathInConfig(source, PATH, format);
1763
- }
1764
- /**
1765
- * Pins `defaultFormat` to `format` where an adopted block leaves it to the
1766
- * default.
1767
- */
1768
- function pinWebhookFormat(source, json, format) {
1769
- return json ? pinJson(source, format) : pinTs(source, format);
1770
- }
1771
- /**
1772
- * `edit` with `defaultFormat` pinned to `format` where an adopted webhooks-out
1773
- * block needs it.
1774
- */
1775
- function withWebhookFormat(edit, json, format) {
1776
- if (!edit.ok) return edit;
1777
- const earlier = "review" in edit ? edit.review : [];
1778
- const pin = pinWebhookFormat(edit.text, json, format);
1779
- if (pin === void 0) return {
1780
- ok: true,
1781
- text: edit.text,
1782
- review: earlier
1783
- };
1784
- if (!pin.ok) return {
1785
- ok: true,
1786
- text: edit.text,
1787
- review: [...earlier, {
1788
- line: 1,
1789
- message: `blocks["webhooks-out"] is adopted and maps no columns.endpoints.format, but defaultFormat wasn't pinned: ${pin.reason}. Set options.defaultFormat to "${format}" to keep the body endpoints get now`
1790
- }]
1791
- };
1792
- const line = pin.text.split("\n").findIndex((text) => text.includes("defaultFormat")) + 1;
1793
- return {
1794
- ok: true,
1795
- text: pin.text,
1796
- review: [...earlier, {
1797
- line: Math.max(line, 1),
1798
- message: `blocks["webhooks-out"] is adopted and maps no columns.endpoints.format, so the codemod set options.defaultFormat to "${format}", the body its endpoints get now. Change it if your receivers expect the other format`
1799
- }]
1800
- };
1801
- }
1802
- //#endregion
1803
- //#region src/cli/codemod.ts
1804
- /**
1805
- * `better-supabase.config.*`, the files a codemod's `configFile` edit applies
1806
- * to.
1807
- */
1808
- const CONFIG_FILE = /(?:^|[\\/])better-supabase\.config\.(?:ts|mts|cts|js|mjs|cjs|json)$/;
1809
- const OFFSET_PIN = {
1810
- key: "pagination",
1811
- value: "\"offset\"",
1812
- when: /\.page\b(?!\s*\()|\bpageCount\b|\btotalPages\b|\bpage\s*:|[?&]page=|["']page["']/,
1813
- message: "Lists and resources page by cursor (`after`, `nextCursor`, no total) unless `pagination: \"offset\"` is set. This file shows no page numbers, so the codemod left it: add `pagination: \"offset\"` if a UI elsewhere reads `page` or the total, or the list sorts by a relation"
1814
- };
1815
- const SQL_ADD_HINT = {
1816
- pattern: /(?<![\w.@-])(?:better-supabase|bsb)(?:@[\w.^~-]+)?\s+sql\s+add\b/,
1817
- message: "`sql add` still only writes the block's SQL; `add` also wires its clients and config. Use `add` unless the script needs the SQL alone"
1818
- };
1819
- const BLOCK_SQL_TYPES = "Context ContractFunction Names Layout File IdType AccessProvider EntitlementsProvider TableSpec Upgrade PermissionKey Audit Deprecation Extension Emit UpgradePlan Topic TestFile Action";
1820
- const ENTITY_FORM_TYPES = " CustomField Field Input Options Result State Values";
1821
- /** `from` and `to` prefixed to each space-separated suffix in `suffixes`. */
1822
- function prefixed(from, to, suffixes) {
1823
- return Object.fromEntries(suffixes.split(" ").map((suffix) => [from + suffix, to + suffix]));
1824
- }
1825
- const CODEMODS = {
1826
- "0.4": {
1827
- name: "0.4",
1828
- description: "Renames from 0.3 to 0.4 (the naming page lists them)",
1829
- imports: {
1830
- createBrowser: "createClient",
1831
- BetterBrowser: "BetterClient",
1832
- BrowserOptions: "ClientOptions",
1833
- BrowserAuth: "ClientAuth",
1834
- BetterEnv: "HonoEnv",
1835
- HandlerOptions: "MiddlewareOptions",
1836
- Queries: "BetterQueries",
1837
- CreateQueriesOptions: "QueriesOptions",
1838
- Postgres: "BetterPostgres",
1839
- DefineSupabaseOptions: "SupabaseOptions"
1840
- },
1841
- members: [
1842
- {
1843
- from: "serverFor",
1844
- to: "contextForSession"
1845
- },
1846
- {
1847
- from: "toORPCError",
1848
- to: "toOrpcError"
1849
- },
1850
- {
1851
- from: "$table",
1852
- to: "$tableName",
1853
- notCalled: true
1854
- }
1855
- ],
1856
- props: [{
1857
- component: "BetterSupabaseProvider",
1858
- from: "browser",
1859
- to: "client"
1860
- }],
1861
- review: [
1862
- {
1863
- pattern: /\.server\(\)/,
1864
- message: "`next.server()` is `bsb.context()` on the createNext() instance"
1865
- },
1866
- {
1867
- pattern: /\.handle\(\)/,
1868
- message: "Hono's `bsb.handle()` is `bsb.handler()`"
1869
- },
1870
- {
1871
- pattern: /\bmcp\.handler\b/,
1872
- message: "`mcp.handler` is `bsb.endpoint`"
1873
- },
1874
- {
1875
- pattern: /\.sb\b/,
1876
- message: "`client.sb` is `client.betterSupabase`"
1877
- },
1878
- {
1879
- pattern: /\btestExecutor\(\s*\{[^}]*\bsb\b/,
1880
- message: "`{ sb }` in testExecutor is `{ betterSupabase }`"
1881
- }
1882
- ]
1883
- },
1884
- "0.5": {
1885
- name: "0.5",
1886
- description: "Renames from 0.4 to 0.5: createMcp's scopes is advertisedScopes",
1887
- options: [{
1888
- call: "createMcp",
1889
- from: "scopes",
1890
- to: "advertisedScopes"
1891
- }]
1892
- },
1893
- "0.6": {
1894
- name: "0.6",
1895
- description: "Changes from 0.5 to 0.6: kits become blocks and modules, org becomes organization (in event types too), $rpc returns table rows and records in the configured casing, and bucket publicUrl() and path() return a Result",
1896
- strings: {
1897
- ...BLOCK_EVENT_RENAMES,
1898
- "org.*": "organization.*"
1899
- },
1900
- imports: {
1901
- KitEvent: "BlockEvent",
1902
- KitEventMap: "BlockEventMap",
1903
- KitEventType: "BlockEventType",
1904
- KitEventMeta: "BlockEventMeta",
1905
- KitEventPattern: "BlockEventPattern",
1906
- KitEventsMatching: "BlockEventsMatching",
1907
- onKitEvent: "onBlockEvent",
1908
- forwardKitEvents: "forwardBlockEvents",
1909
- ForwardKitOptions: "ForwardBlockOptions",
1910
- KIT_ATTRIBUTES: "BLOCK_ATTRIBUTES",
1911
- kitCloudEvent: "blockCloudEvent",
1912
- kitEventAttributes: "blockEventAttributes",
1913
- traceKitEvents: "traceBlockEvents",
1914
- KitTransport: "BlockTransport",
1915
- OrgEventData: "OrganizationEventData",
1916
- createOrgs: "createOrganizations",
1917
- Orgs: "Organizations",
1918
- OrgsOptions: "OrganizationsOptions",
1919
- CreateOrgOptions: "CreateOrganizationOptions",
1920
- OrgAttributes: "OrganizationAttributes",
1921
- orgLogoBucket: "organizationLogoBucket",
1922
- OrgLogoBucketOptions: "OrganizationLogoBucketOptions",
1923
- KitsConfig: "BlocksConfig",
1924
- KitModuleConfig: "BlockConfig",
1925
- KitMode: "BlockMode",
1926
- AccessKitConfig: "AccessBlockConfig",
1927
- renderKit: "renderModules",
1928
- kitLayout: "moduleLayout",
1929
- kitPermissionKeys: "modulePermissionKeys",
1930
- kitDeprecations: "moduleDeprecations",
1931
- kitFilePaths: "moduleFilePaths",
1932
- kitFileVersion: "moduleFileVersion",
1933
- sameKitFile: "sameModuleFile",
1934
- kitIdType: "moduleIdType",
1935
- isKitIdType: "isModuleIdType",
1936
- KIT_ID_TYPES: "MODULE_ID_TYPES",
1937
- KitIdType: "ModuleIdType",
1938
- KitContext: "ModuleContext",
1939
- KitLayout: "ModuleLayout",
1940
- KitFile: "ModuleFile",
1941
- KitNames: "ModuleNames",
1942
- KitTableSpec: "ModuleTableSpec",
1943
- KitContractFunction: "ModuleContractFunction",
1944
- KitDeprecation: "ModuleDeprecation",
1945
- KitPermissionKey: "ModulePermissionKey",
1946
- KitUpgrade: "ModuleUpgrade",
1947
- KitUpgradePlan: "ModuleUpgradePlan",
1948
- InstalledKitModule: "InstalledModule"
1949
- },
1950
- options: [{
1951
- call: "defineSupabase",
1952
- from: "maxUrlLength",
1953
- to: "urlLengthLimit"
1954
- }],
1955
- review: [
1956
- {
1957
- pattern: /from\s*["']better-supabase\/(orgs|jobs|notifications|webhooks)["']/,
1958
- message: "This subpath moved under `better-supabase/blocks/` (`orgs` is `blocks/organizations`; the outbox, entitlements and audit retention left `jobs` for their own blocks); the 0.5 to 0.6 guide maps each export"
1959
- },
1960
- {
1961
- pattern: /\bcreateInbox\b[^\n]*from\s*["']better-supabase\/(blocks\/)?jobs["']/,
1962
- message: "The webhook inbox is `createWebhookInbox` from `better-supabase/blocks/jobs`; `createInbox` is now the conversation inbox in `blocks/inbox`"
1963
- },
1964
- {
1965
- pattern: /\$rpc\s*(<|\()/,
1966
- message: "`$rpc` now returns table rows and `returns table (...)` records in the configured casing, with codecs applied: drop a snake-to-camel mapping of the result, or pass `{ raw: true }` to keep database names. Scalar results and `returns table` columns are now `| null` unless `functions.<name>.notNull` says otherwise"
1967
- },
1968
- {
1969
- pattern: /\.publicUrl\s*\(/,
1970
- message: "A connected bucket's `publicUrl()` returns a `Result` instead of throwing: read `.data` (`null` on an error) or check `.ok`"
1971
- },
1972
- {
1973
- pattern: /\.path\s*\(\s*\{/,
1974
- message: "A bucket definition's `path(values)` returns a `Result` instead of throwing, like the connected client's `path()`: read `.data` (`null` on an error) or check `.ok`"
1975
- }
1976
- ]
1977
- },
1978
- "0.9": {
1979
- name: "0.9",
1980
- description: "Moves sql.modules to the top-level blocks key in better-supabase.config.*, rewrites CLI calls in package.json scripts and GitHub workflows to the new subcommands and flags (other shell files are listed), renames the config types (ModulesConfig to BlocksConfig, ModuleConfig to BlockConfig, AccessModuleConfig to AccessBlockConfig, ModuleMode to BlockMode), pins pagination: 'offset' on lists and resources in files that read page numbers, and lists behaviour changes for review: support sessions (denied without authorize, approved by a second admin), canApprove (now isApprover), outgoing webhook transforms and receivers (CloudEvents), gatewayOptions callers, generic problem types (about:blank), the delegation cap, role helpers, event and schedule starts (runAs), workflow builders, delivery and realtime fan-out, agent actors, share links, before_promotion_activate and comment subjects",
1981
- imports: {
1982
- ModulesConfig: "BlocksConfig",
1983
- ModuleConfig: "BlockConfig",
1984
- AccessModuleConfig: "AccessBlockConfig",
1985
- ModuleMode: "BlockMode"
1986
- },
1987
- configFile: (source, json) => {
1988
- const moved = json ? moveSqlModulesToBlocksJson(source) : moveSqlModulesToBlocks(source);
1989
- return withWebhookFormat(moved.ok && !json ? {
1990
- ...moved,
1991
- review: environmentModules(moved.text)
1992
- } : moved, json, "standard");
1993
- },
1994
- cliCalls: migrateCliCall,
1995
- cliReview: [SQL_ADD_HINT],
1996
- pins: [{
1997
- call: "defineListQuery",
1998
- argument: 2,
1999
- ...OFFSET_PIN
2000
- }, {
2001
- call: "defineResource",
2002
- argument: 2,
2003
- unless: ["list"],
2004
- ...OFFSET_PIN
2005
- }],
2006
- review: [
2007
- {
2008
- pattern: /\bresources\s*:\s*\{/,
2009
- message: "The default list of each `defineApi` resource pages by cursor (`after`, `nextCursor`) unless the table has no primary key; set `pagination: \"offset\"` on a resource whose clients send `page` or read the total"
2010
- },
2011
- {
2012
- pattern: /\bsupportSessions\s*\(/,
2013
- message: "Support sessions refuse every start without `authorize` (or the server's `authorization.support.authorize`), and a start needs a request approved by a different admin unless `policy.approval` is `\"none\"`. `authorize: \"store\"` keeps the store-only check"
2014
- },
2015
- {
2016
- pattern: /\bcanApprove\b/,
2017
- message: "`authorization.functions.canApprove` is deprecated: set `isApprover` with `{kind}` (`'ai-tool'`), `{subject}` (the tool name, was `{tool}`) and `{tenant}`"
2018
- },
2019
- {
2020
- pattern: /\bcreateWebhooks\s*\(/,
2021
- message: "Outgoing webhooks send CloudEvents 1.0 (`application/cloudevents+json`) instead of `{ type, timestamp, data }`; a `transform` now returns only the event's `data`, and receivers read `data` from the CloudEvent. `sql upgrade` keeps existing endpoints on `format = 'standard'` (the 0.8 body) until you set each one to `cloudevents`"
2022
- },
2023
- {
2024
- pattern: /\bgatewayOptions\s*\(/,
2025
- message: "`gatewayOptions` ignores a `user` in its second argument; pass the caller's id as `context.userId`"
2026
- },
2027
- {
2028
- pattern: /bettersupabase\.com\/problems\/(invalid-request|unauthorized|forbidden|not-found|conflict|rate-limited|unexpected)\b|["'](Invalid request|Not found|Too many requests|Unexpected error)["']/,
2029
- message: "Generic problems use `type: \"about:blank\"` and the HTTP status phrase as `title` (`Bad Request`, `Not Found`, `Too Many Requests`, `Internal Server Error`); match on `kind` or `code` instead"
2030
- },
2031
- {
2032
- pattern: /\bpublish_webhook_event\s*\(/,
2033
- message: "`publish_webhook_event` takes `subject` and `read_permission` and delivers only to endpoints whose owner may read the event"
2034
- },
2035
- {
2036
- pattern: /\btoken_scope_allows\s*\(|["']oauth-client["']/,
2037
- message: "Delegated tokens are narrowed inside `member_can`, `platform_can` and `tenant_ids_with`: a permission passes only when one of the token's scopes maps to it. Map scopes in `blocks.access.scopes` or `authorization.delegation.scopes`; a `token_scope_allows` check in a write policy is now covered by the cap"
2038
- },
2039
- {
2040
- pattern: /\b(has_organization_role|member_organization_ids|organization_member_roles?)\s*\(/,
2041
- message: "Under the provider model the role helpers take membership from the provider's `memberIds`, and a role name check skips the delegation cap (doctor BS334): check a permission with `tenant_ids_with('<permission>')` or `member_can()`"
2042
- },
2043
- {
2044
- pattern: /\b(workflowStarter|startOnEvent)\s*\(/,
2045
- message: "Event and schedule starts need `runAs: { publisher, permissions }` (or a function returning it): a schedule start without it throws, and the run's context is the publisher's, capped to `permissions`"
2046
- },
2047
- {
2048
- pattern: /\bcreateBuilder\s*\(/,
2049
- message: "Published versions run as their publisher (`versions.runAs`), and versions published before 0.9 fail with `WORKFLOW_PUBLISHER_REVOKED` until republished. A version the organization owns runs as its default service principal: create one with `default: true` or set `automation.runAs`"
2050
- },
2051
- {
2052
- pattern: /\b(createNotifications|createReminders)\s*\(|\.fanOut\s*\(/,
2053
- message: "Under an authorization provider without `delivery.subscribers` or `delivery.audience`, an event about a registered subject reaches only users who may read it (`subjectReaders`), and realtime `fanOut` refuses it (`REALTIME_SUBSCRIBER_POLICY_REQUIRED`) until you pass a `policy`"
2054
- },
2055
- {
2056
- pattern: /\bkind\s*:\s*["']agent["']/,
2057
- message: "An `act` level `{ kind: \"agent\", sub, tools }` is now valid (build it with `agentClaims`) and writes with the user's rights unless it sets `read_only: true`; `tools` must be a list of names"
2058
- },
2059
- {
2060
- pattern: /\bcreate_share_link\b/,
2061
- message: "`create_share_link` takes `version_id` and `expires_at` after `role`; grants and revokes on the four-argument signature must name `(uuid, text, text, text, uuid, timestamptz)`"
2062
- },
2063
- {
2064
- pattern: /\bbefore_promotion_activate\b/,
2065
- message: "`promotions` now calls `before_promotion_activate(promotion uuid)` after every write that leaves a promotion active; a function of that name runs on each such save"
2066
- },
2067
- {
2068
- pattern: /\bcomments\s*:\s*\{/,
2069
- message: "With `config.subjects` set and no `subjects` option, comments accept only the registered subject types and require read on the subject row"
2070
- }
2071
- ]
2072
- },
2073
- "0.11": {
2074
- name: "0.11",
2075
- description: "Pins blocks[\"webhooks-out\"].options.defaultFormat to \"cloudevents\" in better-supabase.config.* when the block is adopted and maps no columns.endpoints.format, since adopt mode requires it from 0.11; the 0.9 codemod pins \"standard\" instead for configs coming from 0.8",
2076
- configFile: (source, json) => withWebhookFormat({
2077
- ok: true,
2078
- text: source
2079
- }, json, "cloudevents")
2080
- },
2081
- "0.15": {
2082
- name: "0.15",
2083
- description: "Regroups better-supabase.config.* into database, auth, gen, api and tooling (subjects to records, appTables to tables, integrations to adapters, a block's mode, scope, entities and hooks to ownership, owner, names and callbacks, and removes ownership: \"adopt\", since a block now leaves alone the tables the schema already has; claims.tenant and the tenant plugin's column to auth.organization); renames the requireTenant option and helper to requireOrganization; renames the runtime instance bs to bsb (the CLI's short name) where a file creates, imports or destructures it, and the bs key on request contexts (ctx.bs, c.var.bs, locals.bs, context.bs) to bsb; renames imports: SqlModule to BlockSql, ModuleDefinition to BlockSqlDefinition and the other Module* SQL types to BlockSql*, SubjectRef to RecordRef, entityForm to recordForm, ShipmentCarrier to ShippingProvider, QueueBackend to QueueProvider; rewrites CLI calls in package.json scripts and GitHub workflows to the 0.15 commands (apply and adopt to add, sql sync and sql upgrade to upgrade, introspect to gen --save-snapshot, seed to db seed, env, run, keys and stack to dev); renames the blocks 0.15 renamed (work-items to tasks, parties to contacts, engagements to activities, access to permissions, rules to automations, jobs to queue, activity to timeline and the rest of the 0.14 to 0.15 guide's table) in the config's blocks and preset.blocks, in operation names under auth.authorization.operations, in better-supabase/blocks/<name> imports and in the exports named after them; turns a 0.14 preset code in the config's preset into the preset name or object it holds, and a 0.14 design file into a design with its preset inside; moves the plugins key into blocks (timestamps to updated-at, actor to created-by, softDelete to trash, with their columns as the block's options; tenant to auth.organization.column when memberships is not installed) and the better-supabase/plugins/* imports to the block extensions, better-supabase/lint guards and validation from better-supabase; moves repository calls to the data contract (findMany to list, paginate to page, findById, findUnique and findOnly to get, findFirst to list with limit: 1, exists to count, createMany and upsertMany to create and upsert with an array, updateMany and deleteMany to update and delete with a { where } filter); renames generateFeatures to gen.recordTypes, the record section exports to record bindings (defineSection to defineRecordBinding, commentsSection to commentsBinding, loadSections to loadBindings and the rest) and lists record feature imports, recordServer and sectionAction calls for the move to bsb.record; cache tags, query keys and the debug header and route that start with bs are listed for review, and so are the lines of the app's SQL tests, schema files and newest migration that name a bs_ object the upgrade renames to bsb_",
2084
- sqlNames: true,
2085
- bindings: {
2086
- bs: "bsb",
2087
- SqlModule: "BlockSql",
2088
- ModuleDefinition: "BlockSqlDefinition",
2089
- ...prefixed("Module", "BlockSql", BLOCK_SQL_TYPES),
2090
- ...prefixed("EntityForm", "RecordForm", ENTITY_FORM_TYPES),
2091
- renderModules: "renderBlocks",
2092
- resolveModules: "resolveBlocks",
2093
- resolveModule: "resolveBlock",
2094
- isModuleIdType: "isBlockSqlIdType",
2095
- sameModuleFile: "sameBlockFile",
2096
- InstalledModule: "InstalledBlock",
2097
- SkippedModule: "SkippedBlock",
2098
- SubjectRef: "RecordRef",
2099
- entityForm: "recordForm",
2100
- useEntityForm: "useRecordForm",
2101
- UseEntityFormOptions: "UseRecordFormOptions",
2102
- ShipmentCarrier: "ShippingProvider",
2103
- testShipmentCarrier: "testShippingProvider",
2104
- TestShipmentCarrierOptions: "TestShippingProviderOptions",
2105
- QueueBackend: "QueueProvider",
2106
- sqlQueueBackend: "sqlQueueProvider",
2107
- testQueueBackend: "testQueueProvider",
2108
- transportQueueBackend: "transportQueueProvider",
2109
- vercelQueueBackend: "vercelQueueProvider",
2110
- TestQueueBackendOptions: "TestQueueProviderOptions",
2111
- TransportQueueBackendOptions: "TransportQueueProviderOptions",
2112
- VercelQueueBackendOptions: "VercelQueueProviderOptions",
2113
- ...RECORD_BINDING_RENAMES
2114
- },
2115
- imports: BLOCK_EXPORT_RENAMES,
2116
- subpathImports: PLUGIN_IMPORT_RENAMES,
2117
- subpaths: SUBPATH_RENAMES_0_15,
2118
- members: [{
2119
- from: "bs",
2120
- to: "bsb"
2121
- }],
2122
- options: DATA_CONTRACT_OPTIONS,
2123
- strings: {
2124
- ...DATA_CONTRACT_STRINGS,
2125
- "bs-block": "bsb"
2126
- },
2127
- configFile: (source, json) => [
2128
- withoutPlugins,
2129
- withBlockNames,
2130
- withSubjectsOn,
2131
- thenConvertPresetCode,
2132
- withoutAdoptOwnership
2133
- ].reduce((edit, step) => step(edit, json), json ? groupConfigJson(source) : groupConfigSource(source)),
2134
- designFile: convertDesignFile,
2135
- cliCalls: migrateCliCall,
2136
- source: rewrite015,
2137
- review: REVIEW_0_15
2138
- },
2139
- "0.29": CODEMOD_0_29
2140
- };
2141
- const SUPABASE_IMPORT = /\bfrom\s*["'](?:better-supabase(?:\/[\w./-]*)?|[^"']*supabase[^"']*)["']/;
2142
- /**
2143
- * Renames bindings a file declares, destructures or imports, in files that
2144
- * import from `better-supabase` or a `supabase` module.
2145
- */
2146
- function renameBindings(text, bindings) {
2147
- const ranges = codeRanges(text);
2148
- if (codeMatches(text, new RegExp(SUPABASE_IMPORT, "g"), ranges).length === 0) return text;
2149
- return renameIdentifiers(text, new Map(Object.entries(bindings).filter(([from]) => {
2150
- const name = escapeRegExp(from);
2151
- return codeMatches(text, new RegExp(`\\b(?:const|let|var|function)\\s+${name}(?![\\w$])|[{,]\\s*(?:type\\s+)?${name}\\s*(?:[,}]|as\\b)|\\(\\s*${name}\\s*[:,)]`, "g"), ranges).length > 0;
2152
- })));
2153
- }
2154
- function applyEdits(text, edits) {
2155
- let out = "";
2156
- let cursor = 0;
2157
- for (const edit of edits.toSorted((a, b) => a.start - b.start)) {
2158
- if (edit.start < cursor) continue;
2159
- out += text.slice(cursor, edit.start) + edit.text;
2160
- cursor = edit.end;
2161
- }
2162
- return out + text.slice(cursor);
2163
- }
2164
- const escapeRegExp = (value) => value.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&");
2165
- function inCode(ranges, index) {
2166
- let low = 0;
2167
- let high = ranges.length - 1;
2168
- while (low <= high) {
2169
- const middle = Math.floor((low + high) / 2);
2170
- const [start, end] = ranges[middle];
2171
- if (index < start) high = middle - 1;
2172
- else if (index >= end) low = middle + 1;
2173
- else return true;
2174
- }
2175
- return false;
2176
- }
2177
- const OPENING = "({[";
2178
- const CLOSING = ")}]";
2179
- /** Matches of `pattern` that start in code. */
2180
- function codeMatches(text, pattern, ranges) {
2181
- return [...text.matchAll(pattern)].filter((match) => inCode(ranges, match.index));
2182
- }
2183
- const IMPORT = /\b(import|export)\s+(type\s+)?\{([^}]*)\}\s*from\s*(["'])better-supabase(?:\/([\w./-]*))?\4/g;
2184
- /** Renames imported names, from every subpath or only from `subpath`. */
2185
- function renameImports(text, renames, subpath) {
2186
- const ranges = codeRanges(text);
2187
- const locals = /* @__PURE__ */ new Set();
2188
- const edits = [];
2189
- for (const match of codeMatches(text, IMPORT, ranges)) {
2190
- if (subpath !== void 0 && match[5] !== subpath) continue;
2191
- const list = match[3];
2192
- const listStart = match.index + match[0].indexOf("{") + 1;
2193
- const renamed = list.replaceAll(/(\btype\s+)?([\w$]+)(\s+as\s+[\w$]+)?/g, (spec, type, name, alias) => {
2194
- const to = renames[name];
2195
- if (to === void 0) return spec;
2196
- if (alias === void 0 && match[1] === "import") locals.add(name);
2197
- return `${type ?? ""}${to}${alias ?? ""}`;
2198
- });
2199
- if (renamed !== list) edits.push({
2200
- start: listStart,
2201
- end: listStart + list.length,
2202
- text: renamed
2203
- });
2204
- }
2205
- return {
2206
- text: applyEdits(text, edits),
2207
- locals
2208
- };
2209
- }
2210
- function renameIdentifiers(text, renames) {
2211
- if (renames.size === 0) return text;
2212
- const ranges = codeRanges(text);
2213
- const names = [...renames.keys()].map(escapeRegExp).join("|");
2214
- return applyEdits(text, codeMatches(text, new RegExp(`(?<![\\w$.])(?:${names})(?![\\w$])`, "g"), ranges).map((match) => ({
2215
- start: match.index,
2216
- end: match.index + match[0].length,
2217
- text: renames.get(match[0])
2218
- })));
2219
- }
2220
- function renameStrings(text, strings) {
2221
- const names = Object.keys(strings).map(escapeRegExp).join("|");
2222
- if (names === "") return text;
2223
- const ranges = codeRanges(text);
2224
- const pattern = new RegExp(`(["'\`])(${names})\\1`, "g");
2225
- return applyEdits(text, [...text.matchAll(pattern)].filter((match) => !inCode(ranges, match.index + 1)).map((match) => ({
2226
- start: match.index + 1,
2227
- end: match.index + 1 + match[2].length,
2228
- text: strings[match[2]]
2229
- })));
2230
- }
2231
- function renameMembers(text, members) {
2232
- const ranges = codeRanges(text);
2233
- return applyEdits(text, members.flatMap((member) => codeMatches(text, new RegExp(`\\.${escapeRegExp(member.from)}(?![\\w$])${member.notCalled === true ? "(?!\\s*\\()" : ""}`, "g"), ranges).map((match) => ({
2234
- start: match.index,
2235
- end: match.index + match[0].length,
2236
- text: `.${member.to}`
2237
- }))));
2238
- }
2239
- function renameProps(text, props) {
2240
- const ranges = codeRanges(text);
2241
- const edits = [];
2242
- for (const prop of props) {
2243
- const tag = new RegExp(`<${escapeRegExp(prop.component)}(?![\\w$.])`, "g");
2244
- for (const match of codeMatches(text, tag, ranges)) {
2245
- let depth = 0;
2246
- for (let index = match.index + match[0].length; index < text.length; index += 1) {
2247
- if (!inCode(ranges, index)) continue;
2248
- const char = text[index];
2249
- if (char === "{") depth += 1;
2250
- else if (char === "}") depth -= 1;
2251
- else if (char === ">" && depth === 0) break;
2252
- if (depth === 0 && /\s/.test(text[index - 1] ?? "") && text.startsWith(`${prop.from}=`, index)) edits.push({
2253
- start: index,
2254
- end: index + prop.from.length,
2255
- text: prop.to
2256
- });
2257
- }
2258
- }
2259
- }
2260
- return applyEdits(text, edits);
2261
- }
2262
- /** The index after the bracket that closes the one at `open`, in code only. */
2263
- function closing(text, open, ranges) {
2264
- let depth = 0;
2265
- for (let index = open; index < text.length; index += 1) {
2266
- if (!inCode(ranges, index)) continue;
2267
- const char = text[index];
2268
- if (OPENING.includes(char)) depth += 1;
2269
- else if (CLOSING.includes(char)) {
2270
- depth -= 1;
2271
- if (depth === 0) return index + 1;
2272
- }
2273
- }
2274
- return text.length;
2275
- }
2276
- /**
2277
- * Calls `visit(index, depth)` for each code character from `open` to its
2278
- * closing bracket.
2279
- */
2280
- function walkBrackets(text, open, ranges, visit) {
2281
- const end = closing(text, open, ranges);
2282
- let depth = 0;
2283
- for (let index = open; index < end; index += 1) {
2284
- if (!inCode(ranges, index)) continue;
2285
- const char = text[index];
2286
- if (OPENING.includes(char)) depth += 1;
2287
- else if (CLOSING.includes(char)) depth -= 1;
2288
- visit(index, depth, char);
2289
- }
2290
- }
2291
- /** Where `key` is a top-level key of the object literal at `open`. */
2292
- function topLevelKeys(text, open, key, ranges) {
2293
- const keys = [];
2294
- let previous = "";
2295
- walkBrackets(text, open, ranges, (index, depth, char) => {
2296
- if (depth === 1 && (previous === "{" || previous === ",") && text.startsWith(key, index) && !/[\w$]/.test(text[index + key.length] ?? "")) {
2297
- const after = /^\s*(\S)/.exec(text.slice(index + key.length))?.[1];
2298
- if (after === ":") keys.push({
2299
- index,
2300
- shorthand: false
2301
- });
2302
- else if (after === "," || after === "}") keys.push({
2303
- index,
2304
- shorthand: true
2305
- });
2306
- }
2307
- if (depth === 1 && !/\s/.test(char)) previous = char;
2308
- });
2309
- return keys;
2310
- }
2311
- function renameOptions(text, options) {
2312
- const ranges = codeRanges(text);
2313
- const edits = [];
2314
- for (const option of options) {
2315
- const call = new RegExp(`(?<![\\w$.])${escapeRegExp(option.call)}\\s*(?:<[^>]*>)?\\s*\\(`, "g");
2316
- for (const match of codeMatches(text, call, ranges)) {
2317
- const objects = [];
2318
- walkBrackets(text, match.index + match[0].length - 1, ranges, (index, depth, char) => {
2319
- if (depth === 2 && char === "{") objects.push(index);
2320
- });
2321
- for (const object of objects) for (const { index, shorthand } of topLevelKeys(text, object, option.from, ranges)) edits.push({
2322
- start: index,
2323
- end: index + option.from.length,
2324
- text: shorthand ? `${option.to}: ${option.from}` : option.to
2325
- });
2326
- }
2327
- }
2328
- return applyEdits(text, edits);
2329
- }
2330
- /** The arguments of the call whose `(` is at `open`: start and end of each. */
2331
- function callArguments(text, open, ranges) {
2332
- const args = [];
2333
- let start = open + 1;
2334
- const end = closing(text, open, ranges) - 1;
2335
- walkBrackets(text, open, ranges, (index, depth, char) => {
2336
- if (depth === 1 && char === ",") {
2337
- args.push({
2338
- start,
2339
- end: index
2340
- });
2341
- start = index + 1;
2342
- }
2343
- });
2344
- if (text.slice(start, end).trim() !== "") args.push({
2345
- start,
2346
- end
2347
- });
2348
- return args;
2349
- }
2350
- /**
2351
- * Calls of `pin.call` whose options object lacks `pin.key`, with the insertion
2352
- * when one is safe.
2353
- */
2354
- function pinTargets(text, pin) {
2355
- const ranges = codeRanges(text);
2356
- const call = new RegExp(`(?<![\\w$.])${escapeRegExp(pin.call)}\\s*(?:<[^>]*>)?\\s*\\(`, "g");
2357
- const targets = [];
2358
- const entry = `${pin.key}: ${pin.value}`;
2359
- for (const match of codeMatches(text, call, ranges)) {
2360
- const open = match.index + match[0].length - 1;
2361
- const args = callArguments(text, open, ranges);
2362
- const arg = args[pin.argument];
2363
- if (arg === void 0) {
2364
- if (args.length !== pin.argument) {
2365
- targets.push({
2366
- call: match.index,
2367
- edit: void 0
2368
- });
2369
- continue;
2370
- }
2371
- const last = args.at(-1);
2372
- const at = last === void 0 ? open + 1 : last.end;
2373
- const trailing = text[at] === ",";
2374
- targets.push({
2375
- call: match.index,
2376
- edit: trailing ? {
2377
- start: at + 1,
2378
- end: at + 1,
2379
- text: ` { ${entry} }`
2380
- } : {
2381
- start: at,
2382
- end: at,
2383
- text: `, { ${entry} }`
2384
- }
2385
- });
2386
- continue;
2387
- }
2388
- const offset = text.slice(arg.start, arg.end).search(/\S/);
2389
- const object = arg.start + offset;
2390
- if (text[object] !== "{") {
2391
- targets.push({
2392
- call: match.index,
2393
- edit: void 0
2394
- });
2395
- continue;
2396
- }
2397
- if ([pin.key, ...pin.unless ?? []].some((key) => topLevelKeys(text, object, key, ranges).length > 0)) continue;
2398
- const spreads = [];
2399
- walkBrackets(text, object, ranges, (index, depth) => {
2400
- if (depth === 1 && text.startsWith("...", index)) spreads.push(index);
2401
- });
2402
- if (spreads.length > 0) {
2403
- targets.push({
2404
- call: match.index,
2405
- edit: void 0
2406
- });
2407
- continue;
2408
- }
2409
- const body = text.slice(object + 1, closing(text, object, ranges) - 1);
2410
- const first = /^[ \t]*\n([ \t]*)\S/.exec(body);
2411
- targets.push({
2412
- call: match.index,
2413
- edit: body.trim() === "" ? {
2414
- start: object,
2415
- end: object + body.length + 2,
2416
- text: `{ ${entry} }`
2417
- } : first ? {
2418
- start: object + 1,
2419
- end: object + 1,
2420
- text: `\n${first[1]}${entry},`
2421
- } : {
2422
- start: object + 1,
2423
- end: object + 1,
2424
- text: ` ${entry},`
2425
- }
2426
- });
2427
- }
2428
- return targets;
2429
- }
2430
- function pinOptions(text, pins) {
2431
- let out = text;
2432
- for (const pin of pins) if (pin.when.test(out)) out = applyEdits(out, pinTargets(out, pin).flatMap((target) => target.edit === void 0 ? [] : [target.edit]));
2433
- const review = pins.flatMap((pin) => pinTargets(out, pin).map((target) => ({
2434
- line: out.slice(0, target.call).split("\n").length,
2435
- message: pin.message
2436
- })));
2437
- return {
2438
- text: out,
2439
- review
2440
- };
2441
- }
2442
- /** Applies one codemod to a source file. */
2443
- function applyCodemod(codemod, source, file) {
2444
- if (file !== void 0 && (CLI_CALL_FILE.test(file) || SHELL_FILE.test(file))) {
2445
- const hints = linesMatching(source, codemod.cliReview ?? []);
2446
- if (!codemod.cliCalls) return {
2447
- text: source,
2448
- review: hints
2449
- };
2450
- return CLI_CALL_FILE.test(file) ? {
2451
- text: rewriteCliCalls(source, codemod.cliCalls),
2452
- review: hints
2453
- } : {
2454
- text: source,
2455
- review: [...cliCallHints(source, codemod.cliCalls), ...hints]
2456
- };
2457
- }
2458
- if (file?.endsWith(".sql") === true) return codemod.sqlFile?.(source) ?? {
2459
- text: source,
2460
- review: []
2461
- };
2462
- if (file !== void 0 && DESIGN_FILE_NAME.test(file)) return designFileResult(source, codemod.designFile);
2463
- let text = source;
2464
- const refused = [];
2465
- if (codemod.configFile && file !== void 0 && CONFIG_FILE.test(file)) {
2466
- const json = file.endsWith(".json");
2467
- const edit = codemod.configFile(source, json);
2468
- if (edit.ok) {
2469
- text = edit.text;
2470
- refused.push(..."review" in edit ? edit.review : []);
2471
- } else refused.push({
2472
- line: 1,
2473
- message: `The config wasn't rewritten: ${edit.reason}`
2474
- });
2475
- if (json) return {
2476
- text,
2477
- review: refused
2478
- };
2479
- }
2480
- for (const [subpath, renames] of Object.entries(codemod.subpathImports ?? {})) {
2481
- const imported = renameImports(text, renames, subpath);
2482
- text = renameIdentifiers(imported.text, new Map([...imported.locals].map((name) => [name, renames[name]])));
2483
- }
2484
- if (codemod.subpaths) text = renameSubpaths(text, codemod.subpaths);
2485
- if (codemod.imports) {
2486
- const imported = renameImports(text, codemod.imports);
2487
- text = renameIdentifiers(imported.text, new Map([...imported.locals].map((name) => [name, codemod.imports[name]])));
2488
- }
2489
- if (codemod.bindings) text = renameBindings(text, codemod.bindings);
2490
- if (codemod.members) text = renameMembers(text, codemod.members);
2491
- if (codemod.props) text = renameProps(text, codemod.props);
2492
- if (codemod.options) text = renameOptions(text, codemod.options);
2493
- if (codemod.strings) text = renameStrings(text, codemod.strings);
2494
- if (codemod.source) {
2495
- const rewritten = codemod.source(text);
2496
- text = rewritten.text;
2497
- refused.push(...rewritten.review);
2498
- }
2499
- if (codemod.pins) {
2500
- const pinned = pinOptions(text, codemod.pins);
2501
- text = pinned.text;
2502
- refused.push(...pinned.review);
2503
- }
2504
- return {
2505
- text,
2506
- review: [...refused, ...linesMatching(text, codemod.review ?? [])]
2507
- };
2508
- }
2509
- /** One review line per line of `text` that a hint's pattern matches. */
2510
- function linesMatching(text, hints) {
2511
- return hints.flatMap((hint) => text.split("\n").flatMap((line, index) => hint.pattern.test(line) ? [{
2512
- line: index + 1,
2513
- message: hint.message
2514
- }] : []));
2515
- }
2516
- //#endregion
2517
- //#region src/cli/commands/codemod.ts
2518
- const CODEMOD_ARGS = {
2519
- path: {
2520
- type: "positional",
2521
- required: false,
2522
- variadic: true,
2523
- description: "Files or directories to rewrite (default: the project)"
2524
- },
2525
- "dry-run": {
2526
- type: "boolean",
2527
- description: "Show the changes without writing them"
2528
- },
2529
- check: {
2530
- type: "boolean",
2531
- description: "Write nothing; exit 1 with a diff when a file would change"
2532
- }
2533
- };
2534
- const SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
2535
- ".ts",
2536
- ".tsx",
2537
- ".mts",
2538
- ".cts",
2539
- ".js",
2540
- ".jsx",
2541
- ".mjs",
2542
- ".cjs"
2543
- ]);
2544
- const SKIPPED_DIRS = /* @__PURE__ */ new Set([
2545
- "node_modules",
2546
- ".git",
2547
- ".next",
2548
- ".turbo",
2549
- ".vercel",
2550
- "dist",
2551
- "build",
2552
- "coverage"
2553
- ]);
2554
- const SCHEMA_SQL = /(?:^|[\\/])supabase[\\/]schemas[\\/].*\.sql$/;
2555
- /**
2556
- * Source, config and script files under `path`, skipping dependencies, build
2557
- * output and `.d.ts` files. With `sql`, the `.sql` files under
2558
- * `supabase/schemas` too; migrations stay as they are.
2559
- */
2560
- async function sourceFiles(path, sql) {
2561
- const info = await stat(path).catch(() => void 0);
2562
- if (!info) return [];
2563
- if (info.isFile()) return path.endsWith(".sql") && !sql ? [] : [path];
2564
- const files = [];
2565
- for (const entry of await readdir(path, { withFileTypes: true })) {
2566
- const full = join(path, entry.name);
2567
- if (entry.isDirectory()) {
2568
- if (!SKIPPED_DIRS.has(entry.name)) files.push(...await sourceFiles(full, sql));
2569
- } else if (SOURCE_EXTENSIONS.has(extname(entry.name)) && !entry.name.endsWith(".d.ts") || CONFIG_FILE.test(entry.name) || DESIGN_FILE_NAME.test(entry.name) || CLI_CALL_FILE.test(full) || SHELL_FILE.test(entry.name) || sql && SCHEMA_SQL.test(full)) files.push(full);
2570
- }
2571
- return files.toSorted();
2572
- }
2573
- async function runCodemod(config, args, paint = plain) {
2574
- const [name, ...paths] = args._ ?? [];
2575
- const names = Object.entries(CODEMODS).map(([key, codemod]) => ` ${key.padEnd(5)} ${codemod.description}`).join("\n");
2576
- if (name === void 0) throw new CliError("usage", `Name a codemod:\n${names}`);
2577
- const codemod = CODEMODS[name];
2578
- if (!codemod) throw new CliError("usage", `Unknown codemod "${name}". Codemods:\n${names}`);
2579
- const roots = (paths.length > 0 ? paths : ["."]).map((path) => resolve(config.root, path));
2580
- const files = [...new Set((await Promise.all(roots.map((root) => sourceFiles(root, codemod.sqlFile !== void 0)))).flat())];
2581
- const dryRun = args["dry-run"] === true;
2582
- const edits = [];
2583
- const review = [];
2584
- for (const file of files) {
2585
- const source = await readFile(file, "utf-8");
2586
- const result = applyCodemod(codemod, source, file);
2587
- const path = relative(config.root, file);
2588
- review.push(...result.review.map((hint) => ({
2589
- file: path,
2590
- ...hint
2591
- })));
2592
- if (result.text !== source) edits.push({
2593
- path: file,
2594
- contents: result.text,
2595
- policy: "edit"
2596
- });
2597
- }
2598
- if (codemod.sqlNames === true) review.push(...await legacySqlNameHints(config));
2599
- const plan = {
2600
- root: config.root,
2601
- regenerate: `better-supabase codemod ${codemod.name}`,
2602
- files: edits
2603
- };
2604
- const applied = await applyPlan(plan, args, paint);
2605
- const changed = changedFiles(applied);
2606
- if (applied.mode === "check" && applied.drift) return planResult(plan, applied, { data: { codemod: codemod.name } });
2607
- const lines = [...applied.mode === "write" ? [] : applied.diffs, changed.length === 0 ? `Nothing to change in ${String(files.length)} files.` : [...changeLines(applied), `${applied.mode === "write" ? "Updated" : "Would update"} ${String(changed.length)} of ${String(files.length)} files.`].join("\n")];
2608
- if (review.length > 0) lines.push("", "Check these by hand:", ...review.map((hint) => ` ${hint.file}:${String(hint.line)}: ${hint.message}`));
2609
- return {
2610
- code: 0,
2611
- output: lines.join("\n"),
2612
- data: {
2613
- codemod: codemod.name,
2614
- dryRun,
2615
- changed,
2616
- files: applied.changes,
2617
- review
2618
- }
2619
- };
2620
- }
2621
- /** The `codemod <name>` subcommand for one codemod in `CODEMODS`. */
2622
- function codemodCommand(name) {
2623
- return defineCliCommand({
2624
- meta: commandMeta(`codemod ${name}`),
2625
- args: CODEMOD_ARGS,
2626
- runsWithInvalidConfig: true,
2627
- run: (args, { config, paint }) => runCodemod(config, {
2628
- ...args,
2629
- _: [name, ...args._]
2630
- }, paint)
2631
- });
2632
- }
2633
- //#endregion
2634
- export { codemodCommand };