better-supabase 0.3.0 → 0.5.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 (211) hide show
  1. package/README.md +9 -6
  2. package/bin/better-supabase.js +4 -0
  3. package/dist/{base64-CQeB1eSf.js → base64-D2gsioCY.js} +2 -2
  4. package/dist/channel-FQW-CnGR.d.ts +70 -0
  5. package/dist/claims-BAf6c7is.js +48 -0
  6. package/dist/cli/_format-Cax5EsM9.js +101 -0
  7. package/dist/cli/bin.d.ts +1 -0
  8. package/dist/cli/bin.js +48 -0
  9. package/dist/cli/codemod-DqV7612m.js +388 -0
  10. package/dist/cli/command-CK14fP91.js +502 -0
  11. package/dist/cli/compare-BmIWVEui.js +9 -0
  12. package/dist/cli/config-CPVpXP5I.js +1965 -0
  13. package/dist/cli/config-dtoekM0v.js +2 -0
  14. package/dist/cli/db-DOBPt660.js +52 -0
  15. package/dist/cli/diff-SjkO5rNr.js +752 -0
  16. package/dist/cli/dist-DBPdlPYK.js +1112 -0
  17. package/dist/cli/dist-DreZ24Sz.js +129 -0
  18. package/dist/cli/dist-xn4wlboc.js +732 -0
  19. package/dist/cli/doctor-L7Z8mYTx.js +2863 -0
  20. package/dist/cli/env-DmKv_G4A.js +108 -0
  21. package/dist/cli/env-jIFUADLY.js +511 -0
  22. package/dist/cli/errors-4v4DTtda.js +56 -0
  23. package/dist/cli/fastest-levenshtein-CFN-lNDv.js +120 -0
  24. package/dist/cli/gen-BJc9vdyu.js +2 -0
  25. package/dist/cli/gen-C2osRcr5.js +2204 -0
  26. package/dist/cli/index.d.ts +493 -0
  27. package/dist/cli/index.js +184 -0
  28. package/dist/cli/init-Saf5-R9T.js +550 -0
  29. package/dist/cli/introspect--H7oGmcd.js +81 -0
  30. package/dist/cli/io-k41_z-jT.js +24 -0
  31. package/dist/cli/json5-ChRycquj.js +787 -0
  32. package/dist/cli/jsonc-BUniUpOk.js +2 -0
  33. package/dist/cli/jsonc-D5Fu67jw.js +45 -0
  34. package/dist/cli/keys-ByKHnvP9.js +83 -0
  35. package/dist/cli/ohash-D7bG_EOb.js +277 -0
  36. package/dist/cli/openapi-Cp5Fyta-.js +66 -0
  37. package/dist/cli/project-B_GeXyHh.js +70 -0
  38. package/dist/cli/prompts-BNcNfAve.js +1142 -0
  39. package/dist/cli/prompts-BTYQGunc.js +2 -0
  40. package/dist/cli/read-sets-BfMQcKy8.js +289 -0
  41. package/dist/cli/rolldown-runtime-BPOCksWG.js +24 -0
  42. package/dist/cli/run-BKR2W_79.js +351 -0
  43. package/dist/cli/seed-CUlqWh-8.js +98 -0
  44. package/dist/cli/skills-LJJIhLFR.js +137 -0
  45. package/dist/cli/sql-DzPbfngx.js +348 -0
  46. package/dist/cli/style-C0NFdJRL.js +29 -0
  47. package/dist/cli/toml-DB-MNnFs.js +424 -0
  48. package/dist/cli/version-BDJuO0UR.js +4 -0
  49. package/dist/cli/yaml-CYCbJ6et.js +2252 -0
  50. package/dist/client/index.d.ts +2 -2
  51. package/dist/client/index.js +15 -22
  52. package/dist/clone-BfgmLU90.js +21 -0
  53. package/dist/{compiler-2zqGzxVZ.d.ts → compiler-BXH_aZ7N.d.ts} +2 -2
  54. package/dist/config/index.d.ts +4 -4
  55. package/dist/config/index.js +5 -5
  56. package/dist/{config-DOsGYSiT.js → config-DreERlKo.js} +1 -1
  57. package/dist/{config-C1CYcm6o.d.ts → config-T_ejwyd3.d.ts} +176 -11
  58. package/dist/{define-DUbydmJa.d.ts → define-Bp_BZa5h.d.ts} +37 -29
  59. package/dist/{define-DF341GDj.js → define-cNKzqwL_.js} +356 -89
  60. package/dist/edge/index.d.ts +20 -13
  61. package/dist/edge/index.js +55 -26
  62. package/dist/{entitlements-DvJXoI02.d.ts → entitlements-DUxU4oHe.d.ts} +2 -2
  63. package/dist/env/index.d.ts +2 -2
  64. package/dist/env/index.js +34 -1
  65. package/dist/{errors-Bl3rkOzo.js → errors-DtwXa6b8.js} +2 -1
  66. package/dist/events/index.d.ts +3 -2
  67. package/dist/events/index.js +69 -16
  68. package/dist/events-aIO7vsIk.d.ts +230 -0
  69. package/dist/executor-BunPOO-k.d.ts +402 -0
  70. package/dist/{executor-B26lgbHD.d.ts → executor-Cghdstwu.d.ts} +1 -2
  71. package/dist/{executor-C57jx2pn.js → executor-XycESQPH.js} +3 -3
  72. package/dist/hono/index.d.ts +27 -23
  73. package/dist/hono/index.js +46 -11
  74. package/dist/impersonation-VfaGc4Q_.js +41 -0
  75. package/dist/{index-BNsABq7P.d.ts → index-BGdgBPdf.d.ts} +66 -25
  76. package/dist/{index-qriRM9cZ.d.ts → index-C7f8cOBM.d.ts} +4 -4
  77. package/dist/{index-Dy6kuF0P.d.ts → index-CLg87OBW.d.ts} +6 -1
  78. package/dist/{index-GV77NpRP.d.ts → index-DOESKG27.d.ts} +34 -9
  79. package/dist/{index-CriFFJ_p.d.ts → index-DgILJRXj.d.ts} +43 -17
  80. package/dist/{index-UJ-LUxtI.d.ts → index-DmXSxbLi.d.ts} +14 -14
  81. package/dist/{index-Cf-D2jk1.d.ts → index-Dxn2a5cw.d.ts} +2 -2
  82. package/dist/{index-CTTMS6_1.d.ts → index-SaTsEfGP.d.ts} +86 -9
  83. package/dist/{index-CADlNHK-.d.ts → index-fag8VJZ2.d.ts} +5 -6
  84. package/dist/index.d.ts +34 -17
  85. package/dist/index.js +15 -14
  86. package/dist/jobs/index.d.ts +147 -95
  87. package/dist/jobs/index.js +773 -250
  88. package/dist/{json-schema--aOXAGfU.js → json-schema-m1fiwKgN.js} +23 -2
  89. package/dist/kit-events-CTFDfSwb.js +60 -0
  90. package/dist/kit-transport-B82k1djG.d.ts +33 -0
  91. package/dist/kit-transport-DJlHQUBU.js +55 -0
  92. package/dist/{config-Be4GwsqI.js → kits-CGLLrNPd.js} +38 -10
  93. package/dist/list/index.d.ts +1 -1
  94. package/dist/list/index.js +3 -3
  95. package/dist/{live-D8rV1Ldw.js → live-CdJBOc4f.js} +13 -9
  96. package/dist/{live-QE3UPbGm.d.ts → live-D9W2M5aO.d.ts} +16 -15
  97. package/dist/lookup-BaP5bI27.js +18 -0
  98. package/dist/mcp/index.d.ts +39 -22
  99. package/dist/mcp/index.js +39 -25
  100. package/dist/{mfa-x3V3vGh-.d.ts → mfa-CusDgPaD.d.ts} +5 -1
  101. package/dist/next/image/index.js +6 -3
  102. package/dist/next/index.d.ts +60 -36
  103. package/dist/next/index.js +167 -50
  104. package/dist/notifications/index.d.ts +162 -0
  105. package/dist/notifications/index.js +264 -0
  106. package/dist/openapi/index.d.ts +1 -1
  107. package/dist/openapi/index.js +6 -6
  108. package/dist/orgs/index.d.ts +132 -0
  109. package/dist/orgs/index.js +245 -0
  110. package/dist/orpc/index.d.ts +37 -20
  111. package/dist/orpc/index.js +24 -11
  112. package/dist/otel/index.d.ts +24 -5
  113. package/dist/otel/index.js +124 -64
  114. package/dist/permdock-sql-C2Inc6Xc.d.ts +29 -0
  115. package/dist/permdock-sql-DgOfeixi.js +51 -0
  116. package/dist/plugin-DwARMuQp.js +59 -0
  117. package/dist/{plugin-DVRB8qNE.d.ts → plugin-o144f322.d.ts} +17 -5
  118. package/dist/plugins/actor/index.d.ts +5 -2
  119. package/dist/plugins/actor/index.js +22 -8
  120. package/dist/plugins/rules/index.d.ts +2 -2
  121. package/dist/plugins/rules/index.js +52 -17
  122. package/dist/plugins/soft-delete/index.d.ts +3 -3
  123. package/dist/plugins/soft-delete/index.js +14 -5
  124. package/dist/plugins/tenant/index.d.ts +3 -3
  125. package/dist/plugins/tenant/index.js +45 -21
  126. package/dist/plugins/timestamps/index.d.ts +1 -1
  127. package/dist/plugins/timestamps/index.js +4 -3
  128. package/dist/plugins/validation/index.d.ts +2 -2
  129. package/dist/plugins/validation/index.js +26 -6
  130. package/dist/{pool-B9qsLyFR.d.ts → pool-C9voM4Kw.d.ts} +24 -6
  131. package/dist/postgres/index.d.ts +5 -5
  132. package/dist/postgres/index.js +20 -10
  133. package/dist/{postgrest-DmBlevh-.d.ts → postgrest-CruYKAvV.d.ts} +1 -1
  134. package/dist/{problem-CGt1ADix.js → problem-BW1KhzSG.js} +2 -1
  135. package/dist/{problem-Z2RTQjZD.d.ts → problem-Blxe8S31.d.ts} +1 -1
  136. package/dist/query/index.d.ts +2 -2
  137. package/dist/query/index.js +3 -3
  138. package/dist/{query-BdKLTPlj.js → query-CCbo44lG.js} +18 -18
  139. package/dist/queue-BYUCjr59.d.ts +252 -0
  140. package/dist/react/index.d.ts +8 -7
  141. package/dist/react/index.js +4 -3
  142. package/dist/react/server.d.ts +16 -5
  143. package/dist/react/server.js +12 -4
  144. package/dist/react/session.d.ts +10 -4
  145. package/dist/react/session.js +11 -3
  146. package/dist/{react-DNBYNazu.js → react-C_s7kiNz.js} +138 -46
  147. package/dist/{read-set-D0qBcboM.js → read-set-DQFt1N_Y.js} +71 -15
  148. package/dist/realtime/index.d.ts +3 -3
  149. package/dist/realtime/index.js +14 -12
  150. package/dist/{index-kpgopLNv.d.ts → refresh-BTrQ_ZTp.d.ts} +6 -3
  151. package/dist/{resolve-BRciX2jK.d.ts → resolve-C15TJq77.d.ts} +22 -11
  152. package/dist/{resource-D30rp0GN.js → resource-CRxxwkQq.js} +24 -9
  153. package/dist/{resource-CwVgiI5q.d.ts → resource-D8iqWMr-.d.ts} +6 -6
  154. package/dist/respond-D2OQl62-.d.ts +371 -0
  155. package/dist/{result-DWXatkd6.js → result-BKiliPY7.js} +2 -2
  156. package/dist/server/index.d.ts +17 -15
  157. package/dist/server/index.js +16 -22
  158. package/dist/server-Csx2sRjg.js +655 -0
  159. package/dist/{shared-_6-uPL7E.js → shared-D1dRUrAg.js} +19 -4
  160. package/dist/signers-Cc6r98SW.d.ts +162 -0
  161. package/dist/{simplify-LakqK1vH.js → simplify-_0oUKqCd.js} +27 -95
  162. package/dist/sql/index.d.ts +247 -10
  163. package/dist/sql/index.js +8591 -780
  164. package/dist/{sql-BIgk12ew.js → sql-Coh6n4cC.js} +11 -3
  165. package/dist/ssr/index.d.ts +4 -4
  166. package/dist/ssr/index.js +1 -2
  167. package/dist/{standard-FUi3Z3-7.js → standard-D7r6dMUu.js} +6 -3
  168. package/dist/{standard-eudBiRk1.d.ts → standard-J4YgMOLm.d.ts} +1 -1
  169. package/dist/{stats-D78UQ8Yu.js → stats-Bqob3WqT.js} +34 -9
  170. package/dist/storage/index.d.ts +4 -4
  171. package/dist/storage/index.js +174 -27
  172. package/dist/support-DT-OhSxD.d.ts +88 -0
  173. package/dist/support-Dk6vdmEw.js +291 -0
  174. package/dist/support-view-Da5peKFg.d.ts +17 -0
  175. package/dist/support-view-g4YLBeqX.js +18 -0
  176. package/dist/{tables-Dhha3BXM.js → tables-Cb-3_VWc.js} +14 -0
  177. package/dist/{permdock-sql-Bta_G0v-.js → template-TxrGI5jR.js} +2 -31
  178. package/dist/{temporal-BwshQk0W.js → temporal-CVlIV2DZ.js} +17 -4
  179. package/dist/{temporal-required-CMxeSVPo.js → temporal-required-CAt4Dc9Z.js} +2 -2
  180. package/dist/testing/index.d.ts +113 -24
  181. package/dist/testing/index.js +375 -47
  182. package/dist/{types-DONv9SHN.d.ts → types-Dnf_wRDz.d.ts} +26 -3
  183. package/dist/user-change-CHFEUro1.js +49 -0
  184. package/dist/{webhooks-CAIFQSTM.js → verify-Ce49ETPz.js} +38 -19
  185. package/dist/{version-BfpG2gks.js → version-DM_Roffb.js} +1 -1
  186. package/dist/{view-3Po_PVlr.d.ts → view-BEf0diC5.d.ts} +10 -5
  187. package/dist/{mfa-BxoR1RkN.js → view-Bq64ki8-.js} +210 -64
  188. package/dist/webhooks/index.d.ts +136 -5
  189. package/dist/webhooks/index.js +588 -2
  190. package/dist/wire-D2dT86vi.js +35 -0
  191. package/package.json +50 -10
  192. package/schemas/config-v1.json +131 -1
  193. package/schemas/doctor-report-v1.json +10 -0
  194. package/skills/better-supabase/SKILL.md +60 -10
  195. package/skills/better-supabase/references/plugins.md +13 -14
  196. package/skills/better-supabase/references/troubleshooting.md +25 -4
  197. package/skills/better-supabase-api/SKILL.md +74 -19
  198. package/skills/better-supabase-api/references/adapters.md +48 -27
  199. package/skills/better-supabase-auth/SKILL.md +149 -0
  200. package/skills/better-supabase-auth/references/permdock.md +100 -0
  201. package/skills/better-supabase-testing/SKILL.md +58 -4
  202. package/dist/claims-CoTobNC-.js +0 -25
  203. package/dist/events-Do8jXh4D.d.ts +0 -84
  204. package/dist/executor-DynmIWhq.d.ts +0 -195
  205. package/dist/invalidate-DbxuL2jL.js +0 -18
  206. package/dist/permdock-sql-DImJULY-.d.ts +0 -17
  207. package/dist/plugin-BqR6wKMB.js +0 -23
  208. package/dist/respond-C44EZAJo.js +0 -399
  209. package/dist/respond-DAkPIdTH.d.ts +0 -175
  210. package/dist/result-c2OYgCV2.d.ts +0 -203
  211. package/dist/view-wZ-9qIUz.js +0 -45
package/README.md CHANGED
@@ -12,18 +12,18 @@
12
12
 
13
13
  ```bash
14
14
  pnpm add better-supabase @supabase/supabase-js
15
- pnpm add -D @better-supabase/cli pg
15
+ pnpm add -D pg
16
16
  ```
17
17
 
18
- ESM only. The CLI ships as [`@better-supabase/cli`](https://www.npmjs.com/package/@better-supabase/cli), always at the same version as `better-supabase`, and needs Node 24 or later; the runtime entries run on every WinterTC runtime (Node, Deno, Bun, Workers, Supabase Edge Functions). TypeScript 6 and 7 are tested.
18
+ ESM only. The package includes the `better-supabase` CLI, which needs Node 24 or later; the runtime entries run on every WinterTC runtime (Node, Deno, Bun, Workers, Supabase Edge Functions). TypeScript 6 and 7 are tested.
19
19
 
20
20
  ## Quick start
21
21
 
22
- Or start with `npx @better-supabase/cli init`, which detects your frameworks and prints the install command.
22
+ Or start with `npx better-supabase init`, which detects your frameworks and prints the install command.
23
23
 
24
24
  ```bash
25
25
  supabase start
26
- pnpm better-supabase init # config, src/lib/supabase.ts and framework glue
26
+ pnpm better-supabase init # config, src/lib/supabase/index.ts and framework glue
27
27
  pnpm better-supabase gen # database.types.ts and generated.ts
28
28
  ```
29
29
 
@@ -33,9 +33,9 @@ import { defineSupabase } from "better-supabase";
33
33
 
34
34
  import { schema } from "./lib/supabase/generated.ts";
35
35
 
36
- export const sb = defineSupabase(schema);
36
+ export const betterSupabase = defineSupabase(schema);
37
37
 
38
- const db = sb.connect(createClient(url, publishableKey));
38
+ const db = betterSupabase.connect(createClient(url, publishableKey));
39
39
 
40
40
  const result = await db.customers.findMany({
41
41
  select: ["id", "name"],
@@ -53,6 +53,7 @@ if (!result.ok) return result; // DbError: kind, message, status, code
53
53
  | ---------------------------------------------------------- | ------------------------------------------------------------------------ |
54
54
  | `better-supabase` | `defineSupabase`, repositories, `Result`, `DbError`, `SPEC_PINS` |
55
55
  | `better-supabase/config` | `defineConfig` and generators for `better-supabase.config.ts` |
56
+ | `better-supabase/cli` | `run`, `registerCommand` and codegen for scripts that drive the CLI |
56
57
  | `better-supabase/client` | Browser repositories that follow the session |
57
58
  | `better-supabase/react` | Provider, typed hooks and the server session |
58
59
  | `better-supabase/query` | TanStack Query options with table-based invalidation |
@@ -63,6 +64,8 @@ if (!result.ok) return result; // DbError: kind, message, status, code
63
64
  | `better-supabase/hono`, `/orpc`, `/edge` | Framework adapters |
64
65
  | `better-supabase/mcp` | MCP servers whose tools run as the signed-in user |
65
66
  | `better-supabase/jobs` | Supabase Queues jobs, idempotency keys and a webhook inbox |
67
+ | `better-supabase/orgs` | Organizations, members, invitations and switching from the SQL kit |
68
+ | `better-supabase/notifications` | Sending, listing and delivering notifications from the SQL kit |
66
69
  | `better-supabase/list` | Search, facets, sorting and pagination from one definition |
67
70
  | `better-supabase/storage`, `/realtime` | Typed bucket paths and broadcast topics |
68
71
  | `better-supabase/env` | Validated Supabase settings |
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ // Checked in so pnpm can link the bin on a fresh install, before dist/ is built.
3
+ // oxlint-disable-next-line import/no-unassigned-import -- the CLI module runs on import.
4
+ import "../dist/cli/bin.js";
@@ -1,6 +1,6 @@
1
1
  //#region src/core/base64.ts
2
- const encoder = new TextEncoder();
3
- const decoder = new TextDecoder();
2
+ const encoder = /* @__PURE__ */ new TextEncoder();
3
+ const decoder = /* @__PURE__ */ new TextDecoder();
4
4
  /** Standard base64 (RFC 4648 section 4) of `input`, with padding. */
5
5
  function toBase64(input) {
6
6
  const bytes = typeof input === "string" ? encoder.encode(input) : input;
@@ -0,0 +1,70 @@
1
+ /// <reference lib="esnext.temporal" />
2
+ //#region src/notifications/types.d.ts
3
+ /** A subject a notification is about, e.g. `{ type: 'task', id: '42' }`. */
4
+ interface NotificationSubject {
5
+ readonly type: string;
6
+ readonly id: string;
7
+ /** Shown in the list, e.g. the task title, kept as it was at send time. */
8
+ readonly label?: string;
9
+ }
10
+ /** One notification as its recipient sees it. */
11
+ interface NotificationItem<K extends string = string, D = unknown> {
12
+ /** The recipient row id: pass it to `markRead` and `dismiss`. */
13
+ readonly id: string;
14
+ /** The shared event id, the same for every recipient. */
15
+ readonly eventId: string;
16
+ readonly type: K;
17
+ readonly data: D;
18
+ readonly tenant: string | null;
19
+ readonly actorId: string | null;
20
+ readonly subject: NotificationSubject | null;
21
+ readonly summary: string | null;
22
+ readonly actionPath: string | null;
23
+ readonly priority: string | null;
24
+ readonly createdAt: Temporal.Instant;
25
+ readonly readAt: Temporal.Instant | null;
26
+ readonly resolvedAt: Temporal.Instant | null;
27
+ }
28
+ /** What `render` returns: the text for one notification, in one locale. */
29
+ interface RenderedText {
30
+ readonly title: string;
31
+ readonly body?: string;
32
+ }
33
+ //#endregion
34
+ //#region src/notifications/channel.d.ts
35
+ /** One pending delivery a channel sends: the notification and who gets it. */
36
+ interface NotificationMessage {
37
+ readonly deliveryId: string;
38
+ /** The channel name, e.g. `email`. */
39
+ readonly channel: string;
40
+ /** 1 on the first try. */
41
+ readonly attempts: number;
42
+ readonly userId: string;
43
+ /** The recipient's `auth.users` email, for email channels. */
44
+ readonly email: string | null;
45
+ readonly notification: NotificationItem;
46
+ /** What `render` returned for it, when `createNotifications` has one. */
47
+ readonly text?: RenderedText;
48
+ }
49
+ interface NotificationSendResult {
50
+ /** `skipped` when the channel decided not to send. Defaults to `sent`. */
51
+ readonly status?: "sent" | "skipped";
52
+ /** The provider's name, e.g. `resend` or `fcm`. */
53
+ readonly provider?: string;
54
+ /** The provider's id for the message, kept for support and webhooks. */
55
+ readonly providerMessageId?: string;
56
+ }
57
+ /**
58
+ * Sends notifications on one channel (email, push, Slack). The delivery
59
+ * worker (`notifications.deliver()`) claims pending deliveries for the
60
+ * channel's `name` and calls `send` for each. Throwing retries the delivery
61
+ * after its lease, up to `maxAttempts`, then marks it `failed`.
62
+ */
63
+ interface NotificationChannel {
64
+ readonly apiVersion: 1;
65
+ /** Matches the `channel` the deliveries were created for. */
66
+ readonly name: string;
67
+ send(message: NotificationMessage): NotificationSendResult | void | Promise<NotificationSendResult | void>;
68
+ }
69
+ //#endregion
70
+ export { NotificationSubject as a, NotificationItem as i, NotificationMessage as n, RenderedText as o, NotificationSendResult as r, NotificationChannel as t };
@@ -0,0 +1,48 @@
1
+ //#region src/core/claims.ts
2
+ const DEFAULT_CLAIMS = {
3
+ tenant: "tenant_id",
4
+ scope: "tenant",
5
+ features: "features"
6
+ };
7
+ /** The configured claim names, with defaults for the ones codegen left out. */
8
+ function claimsOf(meta) {
9
+ if (!meta?.claims) return DEFAULT_CLAIMS;
10
+ let claims = claimsByMeta.get(meta);
11
+ if (!claims) {
12
+ claims = {
13
+ ...DEFAULT_CLAIMS,
14
+ ...meta.claims
15
+ };
16
+ claimsByMeta.set(meta, claims);
17
+ }
18
+ return claims;
19
+ }
20
+ const claimsByMeta = /* @__PURE__ */ new WeakMap();
21
+ /** Where the active tenant is read from: the top-level claim, then `app_metadata`. */
22
+ function tenantClaimPaths(tenant = DEFAULT_CLAIMS.tenant) {
23
+ let paths = tenantPaths.get(tenant);
24
+ if (!paths) {
25
+ paths = [tenant, `app_metadata.${tenant}`];
26
+ tenantPaths.set(tenant, paths);
27
+ }
28
+ return paths;
29
+ }
30
+ const tenantPaths = /* @__PURE__ */ new Map();
31
+ /** Claim paths come from configuration, so this stays small. */
32
+ const segmentsByPath = /* @__PURE__ */ new Map();
33
+ function segmentsOf(path) {
34
+ let segments = segmentsByPath.get(path);
35
+ if (!segments) {
36
+ segments = path.split(".");
37
+ if (segmentsByPath.size < 256) segmentsByPath.set(path, segments);
38
+ }
39
+ return segments;
40
+ }
41
+ /** The string at a dotted claim path, if any. */
42
+ function claimAt(claims, path) {
43
+ let value = claims;
44
+ for (const segment of segmentsOf(path)) value = typeof value === "object" && value !== null ? value[segment] : void 0;
45
+ return typeof value === "string" && value.length > 0 ? value : void 0;
46
+ }
47
+ //#endregion
48
+ export { tenantClaimPaths as i, claimAt as n, claimsOf as r, DEFAULT_CLAIMS as t };
@@ -0,0 +1,101 @@
1
+ //#region ../../node_modules/.pnpm/confbox@0.3.1/node_modules/confbox/dist/_chunks/libs/detect-indent.mjs
2
+ const e = /^(?:( )+|\t+)/;
3
+ const t$1 = `space`;
4
+ function n$1(e, n, r) {
5
+ return e && n === t$1 && r === 1;
6
+ }
7
+ function r$1(r, a) {
8
+ let o = /* @__PURE__ */ new Map(), s = 0, c, l;
9
+ for (let u of r.split(/\n/g)) {
10
+ if (!u) continue;
11
+ let r = u.match(e);
12
+ if (r === null) s = 0, c = ``;
13
+ else {
14
+ let e = r[0].length, u = r[1] ? t$1 : `tab`;
15
+ if (n$1(a, u, e)) continue;
16
+ u !== c && (s = 0), c = u;
17
+ let d = 1, f = 0, p = e - s;
18
+ if (s = e, p === 0) d = 0, f = 1;
19
+ else {
20
+ let e = Math.abs(p);
21
+ if (n$1(a, u, e)) continue;
22
+ l = i$1(u, e);
23
+ }
24
+ let m = o.get(l);
25
+ o.set(l, m === void 0 ? [1, 0] : [m[0] + d, m[1] + f]);
26
+ }
27
+ }
28
+ return o;
29
+ }
30
+ function i$1(e, n) {
31
+ return (e === t$1 ? `s` : `t`) + String(n);
32
+ }
33
+ function a$1(e) {
34
+ return {
35
+ type: e[0] === `s` ? t$1 : `tab`,
36
+ amount: Number(e.slice(1))
37
+ };
38
+ }
39
+ function o$1(e) {
40
+ let t, n = 0, r = 0;
41
+ for (let [i, [a, o]] of e) (a > n || a === n && o > r) && (n = a, r = o, t = i);
42
+ return t;
43
+ }
44
+ function s$1(e, n) {
45
+ return (e === t$1 ? ` ` : ` `).repeat(n);
46
+ }
47
+ function c(e) {
48
+ if (typeof e != `string`) throw TypeError(`Expected a string`);
49
+ let t = r$1(e, !0);
50
+ t.size === 0 && (t = r$1(e, !1));
51
+ let n = o$1(t), i, c = 0, l = ``;
52
+ return n !== void 0 && ({type: i, amount: c} = a$1(n), l = s$1(i, c)), {
53
+ amount: c,
54
+ type: i,
55
+ indent: l
56
+ };
57
+ }
58
+ //#endregion
59
+ //#region ../../node_modules/.pnpm/confbox@0.3.1/node_modules/confbox/dist/_chunks/_format.mjs
60
+ const t = Symbol.for(`__confbox_fmt__`);
61
+ const n = /^(\s+)/;
62
+ const r = /(\s+)$/;
63
+ function i(e) {
64
+ return e.charCodeAt(0) === 65279 ? e.slice(1) : e;
65
+ }
66
+ function a(e, t = {}) {
67
+ return {
68
+ sample: t.indent === void 0 && t.preserveIndentation !== !1 && i(e).slice(0, t?.sampleSize || 1024),
69
+ whiteSpace: t.preserveWhitespace === !1 ? void 0 : {
70
+ start: n.exec(e)?.[0] || ``,
71
+ end: r.exec(e)?.[0] || ``
72
+ }
73
+ };
74
+ }
75
+ function o(e, n, r) {
76
+ !n || typeof n != `object` || Object.defineProperty(n, t, {
77
+ enumerable: !1,
78
+ configurable: !0,
79
+ writable: !0,
80
+ value: a(e, r)
81
+ });
82
+ }
83
+ function s(n, r) {
84
+ if (!n || typeof n != `object` || !(t in n)) return {
85
+ indent: r?.indent ?? 2,
86
+ whitespace: {
87
+ start: ``,
88
+ end: ``
89
+ }
90
+ };
91
+ let i = n[t];
92
+ return {
93
+ indent: r?.indent || c(i.sample || ``).indent,
94
+ whitespace: i.whiteSpace || {
95
+ start: ``,
96
+ end: ``
97
+ }
98
+ };
99
+ }
100
+ //#endregion
101
+ export { o as n, s as r, i as t };
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ import { i as run } from "./run-BKR2W_79.js";
3
+ import { t as colorEnabled } from "./style-C0NFdJRL.js";
4
+ import { text } from "node:stream/consumers";
5
+ //#region src/cli/bin.ts
6
+ const clack = () => import("./prompts-BTYQGunc.js").then((module) => module.clackPrompter);
7
+ const prompts = {
8
+ select: async (message, choices, initial) => (await clack()).select(message, choices, initial),
9
+ multiselect: async (message, choices, initial) => (await clack()).multiselect(message, choices, initial),
10
+ confirm: async (message) => (await clack()).confirm(message),
11
+ spinner: (message) => {
12
+ let stop;
13
+ let stopped = false;
14
+ clack().then((prompter) => {
15
+ if (!stopped) stop = prompter.spinner(message);
16
+ });
17
+ return () => {
18
+ stopped = true;
19
+ stop?.();
20
+ };
21
+ }
22
+ };
23
+ const controller = new AbortController();
24
+ process.once("SIGINT", () => {
25
+ controller.abort();
26
+ });
27
+ process.once("SIGTERM", () => {
28
+ controller.abort();
29
+ });
30
+ const result = await run(process.argv.slice(2), {
31
+ cwd: process.cwd(),
32
+ env: process.env,
33
+ signal: controller.signal,
34
+ io: {
35
+ stdout: (chunk) => {
36
+ process.stdout.write(chunk);
37
+ },
38
+ stderr: (chunk) => {
39
+ process.stderr.write(chunk);
40
+ },
41
+ stdin: () => text(process.stdin),
42
+ color: colorEnabled(),
43
+ ...process.stdin.isTTY && process.stdout.isTTY ? { prompts } : {}
44
+ }
45
+ });
46
+ process.exitCode = controller.signal.aborted ? 130 : result.code;
47
+ //#endregion
48
+ export {};