tapimo 0.4.1 → 0.4.4

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 (263) hide show
  1. package/README.md +1 -1
  2. package/dist/ApiKey.d.ts +1 -9
  3. package/dist/ApiKey.d.ts.map +1 -1
  4. package/dist/ApiKey.js +2 -3
  5. package/dist/ApiKey.js.map +1 -1
  6. package/dist/ApiKeys.d.ts +53 -27
  7. package/dist/ApiKeys.d.ts.map +1 -1
  8. package/dist/ApiKeys.js +32 -17
  9. package/dist/ApiKeys.js.map +1 -1
  10. package/dist/App.d.ts +1990 -1442
  11. package/dist/App.d.ts.map +1 -1
  12. package/dist/App.js +23 -9
  13. package/dist/App.js.map +1 -1
  14. package/dist/Assets.d.ts +10 -0
  15. package/dist/Assets.d.ts.map +1 -1
  16. package/dist/Assets.js +4 -0
  17. package/dist/Assets.js.map +1 -1
  18. package/dist/Auth.d.ts +2 -1
  19. package/dist/Auth.d.ts.map +1 -1
  20. package/dist/Auth.js +2 -1
  21. package/dist/Auth.js.map +1 -1
  22. package/dist/Scope.d.ts +40 -15
  23. package/dist/Scope.d.ts.map +1 -1
  24. package/dist/Scope.js +44 -13
  25. package/dist/Scope.js.map +1 -1
  26. package/dist/admin/App.d.ts +560 -9
  27. package/dist/admin/App.d.ts.map +1 -1
  28. package/dist/admin/App.js +38 -6
  29. package/dist/admin/App.js.map +1 -1
  30. package/dist/admin/apps/api-keys.d.ts +10 -24
  31. package/dist/admin/apps/api-keys.d.ts.map +1 -1
  32. package/dist/admin/apps/api-keys.js +10 -3
  33. package/dist/admin/apps/api-keys.js.map +1 -1
  34. package/dist/admin/apps/organizations.d.ts +833 -0
  35. package/dist/admin/apps/organizations.d.ts.map +1 -0
  36. package/dist/admin/apps/organizations.js +733 -0
  37. package/dist/admin/apps/organizations.js.map +1 -0
  38. package/dist/admin/apps/scopes.d.ts +8 -0
  39. package/dist/admin/apps/scopes.d.ts.map +1 -1
  40. package/dist/admin/apps/verified-tokens.d.ts +57 -57
  41. package/dist/admin/ui.generated.d.ts +1 -1
  42. package/dist/admin/ui.generated.d.ts.map +1 -1
  43. package/dist/admin/ui.generated.js +53 -13
  44. package/dist/admin/ui.generated.js.map +1 -1
  45. package/dist/analytics/Analytics.d.ts +10 -0
  46. package/dist/analytics/Analytics.d.ts.map +1 -1
  47. package/dist/analytics/Analytics.js +8 -0
  48. package/dist/analytics/Analytics.js.map +1 -1
  49. package/dist/analytics/tables/requestEvents.d.ts +9 -0
  50. package/dist/analytics/tables/requestEvents.d.ts.map +1 -1
  51. package/dist/analytics/tables/requestEvents.js +14 -0
  52. package/dist/analytics/tables/requestEvents.js.map +1 -1
  53. package/dist/apps/data/App.d.ts +1304 -1304
  54. package/dist/apps/data/FundingRouteProviders.d.ts +4 -22
  55. package/dist/apps/data/FundingRouteProviders.d.ts.map +1 -1
  56. package/dist/apps/data/FundingRouteProviders.js +10 -120
  57. package/dist/apps/data/FundingRouteProviders.js.map +1 -1
  58. package/dist/apps/data/routes/activities.d.ts +38 -38
  59. package/dist/apps/data/routes/addresses.d.ts +24 -24
  60. package/dist/apps/data/routes/blocks.d.ts +39 -39
  61. package/dist/apps/data/routes/fee-amm.d.ts +20 -20
  62. package/dist/apps/data/routes/funding.js +7 -7
  63. package/dist/apps/data/routes/funding.js.map +1 -1
  64. package/dist/apps/data/routes/indexer.d.ts +5 -5
  65. package/dist/apps/data/routes/tokenlist.d.ts +12 -12
  66. package/dist/apps/data/routes/verified-tokens.d.ts +36 -36
  67. package/dist/apps/management/App.d.ts +808 -267
  68. package/dist/apps/management/App.d.ts.map +1 -1
  69. package/dist/apps/management/App.js +2 -2
  70. package/dist/apps/management/Billing.d.ts +3 -0
  71. package/dist/apps/management/Billing.d.ts.map +1 -1
  72. package/dist/apps/management/Billing.js +7 -2
  73. package/dist/apps/management/Billing.js.map +1 -1
  74. package/dist/apps/management/routes/api-keys.d.ts +116 -100
  75. package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
  76. package/dist/apps/management/routes/api-keys.js +41 -30
  77. package/dist/apps/management/routes/api-keys.js.map +1 -1
  78. package/dist/apps/management/routes/billing.d.ts +182 -50
  79. package/dist/apps/management/routes/billing.d.ts.map +1 -1
  80. package/dist/apps/management/routes/billing.js +14 -14
  81. package/dist/apps/management/routes/billing.js.map +1 -1
  82. package/dist/apps/management/routes/invitations.d.ts +93 -20
  83. package/dist/apps/management/routes/invitations.d.ts.map +1 -1
  84. package/dist/apps/management/routes/invitations.js +12 -15
  85. package/dist/apps/management/routes/invitations.js.map +1 -1
  86. package/dist/apps/management/routes/members.d.ts +89 -18
  87. package/dist/apps/management/routes/members.d.ts.map +1 -1
  88. package/dist/apps/management/routes/members.js +10 -10
  89. package/dist/apps/management/routes/members.js.map +1 -1
  90. package/dist/apps/management/routes/orgs.d.ts +100 -40
  91. package/dist/apps/management/routes/orgs.d.ts.map +1 -1
  92. package/dist/apps/management/routes/orgs.js +19 -19
  93. package/dist/apps/management/routes/orgs.js.map +1 -1
  94. package/dist/apps/management/routes/projects.d.ts +122 -33
  95. package/dist/apps/management/routes/projects.d.ts.map +1 -1
  96. package/dist/apps/management/routes/projects.js +12 -13
  97. package/dist/apps/management/routes/projects.js.map +1 -1
  98. package/dist/apps/management/routes/scopes.d.ts +4 -18
  99. package/dist/apps/management/routes/scopes.d.ts.map +1 -1
  100. package/dist/apps/management/routes/scopes.js +6 -7
  101. package/dist/apps/management/routes/scopes.js.map +1 -1
  102. package/dist/apps/management/routes/usage.d.ts +63 -19
  103. package/dist/apps/management/routes/usage.d.ts.map +1 -1
  104. package/dist/apps/management/routes/usage.js +9 -10
  105. package/dist/apps/management/routes/usage.js.map +1 -1
  106. package/dist/apps/mcp.d.ts.map +1 -1
  107. package/dist/apps/mcp.js +38 -4
  108. package/dist/apps/mcp.js.map +1 -1
  109. package/dist/apps/relay/App.d.ts +26 -4
  110. package/dist/apps/relay/App.d.ts.map +1 -1
  111. package/dist/apps/relay/App.js +17 -14
  112. package/dist/apps/relay/App.js.map +1 -1
  113. package/dist/cloudflare.d.ts +2 -0
  114. package/dist/cloudflare.d.ts.map +1 -1
  115. package/dist/cloudflare.js +4 -0
  116. package/dist/cloudflare.js.map +1 -1
  117. package/dist/db/Db.d.ts +5 -3
  118. package/dist/db/Db.d.ts.map +1 -1
  119. package/dist/db/Db.js +52 -0
  120. package/dist/db/Db.js.map +1 -1
  121. package/dist/db/Schema.d.ts +13 -0
  122. package/dist/db/Schema.d.ts.map +1 -1
  123. package/dist/db/Schema.js +16 -1
  124. package/dist/db/Schema.js.map +1 -1
  125. package/dist/db/tables/adminAuditLogs.d.ts +27 -0
  126. package/dist/db/tables/adminAuditLogs.d.ts.map +1 -0
  127. package/dist/db/tables/adminAuditLogs.js +19 -0
  128. package/dist/db/tables/adminAuditLogs.js.map +1 -0
  129. package/dist/db/tables/invitations.d.ts +1 -1
  130. package/dist/db/tables/invitations.d.ts.map +1 -1
  131. package/dist/db/tables/memberships.d.ts +32 -4
  132. package/dist/db/tables/memberships.d.ts.map +1 -1
  133. package/dist/db/tables/memberships.js +31 -0
  134. package/dist/db/tables/memberships.js.map +1 -1
  135. package/dist/db/tables/organizations.d.ts +43 -1
  136. package/dist/db/tables/organizations.d.ts.map +1 -1
  137. package/dist/db/tables/organizations.js +103 -0
  138. package/dist/db/tables/organizations.js.map +1 -1
  139. package/dist/db/tables/projects.d.ts +25 -0
  140. package/dist/db/tables/projects.d.ts.map +1 -1
  141. package/dist/db/tables/projects.js +22 -0
  142. package/dist/db/tables/projects.js.map +1 -1
  143. package/dist/db/tables/webhookDeliveries.d.ts +26 -0
  144. package/dist/db/tables/webhookDeliveries.d.ts.map +1 -1
  145. package/dist/db/tables/webhookDeliveries.js +37 -0
  146. package/dist/db/tables/webhookDeliveries.js.map +1 -1
  147. package/dist/internal/Auth.d.ts +46 -40
  148. package/dist/internal/Auth.d.ts.map +1 -1
  149. package/dist/internal/Auth.js +118 -69
  150. package/dist/internal/Auth.js.map +1 -1
  151. package/dist/internal/Cursor.d.ts +1 -1
  152. package/dist/internal/Cursor.d.ts.map +1 -1
  153. package/dist/internal/Cursor.js +4 -0
  154. package/dist/internal/Cursor.js.map +1 -1
  155. package/dist/internal/EdgeCache.d.ts.map +1 -1
  156. package/dist/internal/EdgeCache.js +2 -0
  157. package/dist/internal/EdgeCache.js.map +1 -1
  158. package/dist/internal/Errors.d.ts +6 -0
  159. package/dist/internal/Errors.d.ts.map +1 -0
  160. package/dist/internal/Errors.js +16 -0
  161. package/dist/internal/Errors.js.map +1 -0
  162. package/dist/internal/FundingRoutes.d.ts +15 -43
  163. package/dist/internal/FundingRoutes.d.ts.map +1 -1
  164. package/dist/internal/FundingRoutes.js +8 -17
  165. package/dist/internal/FundingRoutes.js.map +1 -1
  166. package/dist/internal/Log.d.ts +16 -1
  167. package/dist/internal/Log.d.ts.map +1 -1
  168. package/dist/internal/Log.js +5 -3
  169. package/dist/internal/Log.js.map +1 -1
  170. package/dist/internal/Store.d.ts +61 -16
  171. package/dist/internal/Store.d.ts.map +1 -1
  172. package/dist/internal/Store.js +72 -17
  173. package/dist/internal/Store.js.map +1 -1
  174. package/dist/internal/Viem.d.ts +1 -1
  175. package/dist/internal/index.d.ts +27 -0
  176. package/dist/internal/index.d.ts.map +1 -0
  177. package/dist/internal/index.js +27 -0
  178. package/dist/internal/index.js.map +1 -0
  179. package/package.json +8 -3
  180. package/src/ApiKey.ts +2 -3
  181. package/src/ApiKeys.ts +95 -17
  182. package/src/App.test.ts +104 -6
  183. package/src/App.ts +29 -9
  184. package/src/Assets.ts +8 -0
  185. package/src/Auth.test-d.ts +36 -0
  186. package/src/Auth.ts +20 -1
  187. package/src/Client.test-d.ts +17 -17
  188. package/src/Scope.test.ts +34 -0
  189. package/src/Scope.ts +53 -17
  190. package/src/admin/App.test.ts +33 -3
  191. package/src/admin/App.ts +49 -14
  192. package/src/admin/apps/api-keys.ts +10 -3
  193. package/src/admin/apps/organizations.test.ts +455 -0
  194. package/src/admin/apps/organizations.ts +953 -0
  195. package/src/admin/apps/scopes.test.ts +10 -0
  196. package/src/admin/ui/plugin.ts +1 -1
  197. package/src/admin/ui/src/components/MobileProfile.tsx +2 -0
  198. package/src/admin/ui/src/components/ThemeToggle.tsx +20 -0
  199. package/src/admin/ui/src/lib/api-keys.ts +36 -19
  200. package/src/admin/ui/src/lib/config.ts +2 -3
  201. package/src/admin/ui/src/lib/organizations.test.ts +89 -0
  202. package/src/admin/ui/src/lib/organizations.ts +262 -0
  203. package/src/admin/ui/src/lib/query-client.ts +3 -1
  204. package/src/admin/ui/src/lib/theme.ts +57 -0
  205. package/src/admin/ui/src/routeTree.gen.ts +47 -4
  206. package/src/admin/ui/src/routes/__root.tsx +18 -3
  207. package/src/admin/ui/src/routes/api-keys.tsx +52 -7
  208. package/src/admin/ui/src/routes/index.tsx +1 -1
  209. package/src/admin/ui/src/routes/organizations.tsx +158 -0
  210. package/src/admin/ui/src/routes/organizations_.$orgId.tsx +710 -0
  211. package/src/admin/ui/src/start.ts +6 -0
  212. package/src/admin/ui.generated.ts +63 -13
  213. package/src/analytics/Analytics.ts +25 -0
  214. package/src/analytics/tables/requestEvents.ts +33 -0
  215. package/src/apps/composition.test.ts +82 -2
  216. package/src/apps/data/FundingRouteProviders.test.ts +37 -93
  217. package/src/apps/data/FundingRouteProviders.ts +14 -161
  218. package/src/apps/data/routes/funding.test.ts +7 -42
  219. package/src/apps/data/routes/funding.ts +8 -8
  220. package/src/apps/data/routes/indexer.test.ts +2 -2
  221. package/src/apps/data/routes/webhooks.test.ts +2 -2
  222. package/src/apps/management/App.ts +2 -2
  223. package/src/apps/management/Billing.ts +10 -2
  224. package/src/apps/management/routes/api-keys.test.ts +137 -1
  225. package/src/apps/management/routes/api-keys.ts +63 -38
  226. package/src/apps/management/routes/billing.ts +14 -14
  227. package/src/apps/management/routes/invitations.test.ts +102 -1
  228. package/src/apps/management/routes/invitations.ts +13 -15
  229. package/src/apps/management/routes/members.ts +10 -10
  230. package/src/apps/management/routes/orgs.test.ts +78 -16
  231. package/src/apps/management/routes/orgs.ts +21 -20
  232. package/src/apps/management/routes/projects.ts +12 -13
  233. package/src/apps/management/routes/scopes.test.ts +16 -0
  234. package/src/apps/management/routes/scopes.ts +6 -7
  235. package/src/apps/management/routes/usage.ts +9 -14
  236. package/src/apps/mcp.test.ts +72 -7
  237. package/src/apps/mcp.ts +46 -4
  238. package/src/apps/relay/App.test.ts +23 -18
  239. package/src/apps/relay/App.ts +35 -14
  240. package/src/cloudflare.ts +5 -0
  241. package/src/db/Db.ts +59 -3
  242. package/src/db/Schema.ts +20 -1
  243. package/src/db/tables/adminAuditLogs.ts +47 -0
  244. package/src/db/tables/invitations.ts +1 -1
  245. package/src/db/tables/memberships.ts +59 -3
  246. package/src/db/tables/organizations.ts +148 -1
  247. package/src/db/tables/projects.ts +47 -0
  248. package/src/db/tables/webhookDeliveries.ts +83 -0
  249. package/src/internal/Auth.test.ts +571 -23
  250. package/src/internal/Auth.ts +166 -94
  251. package/src/internal/Cursor.test.ts +10 -0
  252. package/src/internal/Cursor.ts +5 -1
  253. package/src/internal/EdgeCache.test.ts +11 -0
  254. package/src/internal/EdgeCache.ts +2 -0
  255. package/src/internal/FundingRoutes.test.ts +8 -8
  256. package/src/internal/FundingRoutes.ts +25 -29
  257. package/src/internal/Log.test.ts +41 -3
  258. package/src/internal/Log.ts +23 -4
  259. package/src/internal/Store.test-d.ts +15 -0
  260. package/src/internal/Store.test.ts +153 -2
  261. package/src/internal/Store.ts +157 -41
  262. package/src/internal/index.test.ts +34 -0
  263. package/src/internal/index.ts +26 -0
@@ -124,22 +124,21 @@ export declare namespace schema {
124
124
  }, z.core.$strip>;
125
125
  }
126
126
  /**
127
- * Mounts the billing surface: an organization's billing status. Orgs without
128
- * a Stripe billing source read as `none`. Session lane; reads for members.
127
+ * Mounts billing routes. Reads require membership or scoped API key access; organizations without Stripe state return `none`.
129
128
  */
130
129
  export declare function billing(): import("hono/hono-base").HonoBase<Environment, {
131
130
  "/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing": {
132
131
  $get: {
133
132
  output: {
134
133
  error: {
135
- code: "upstream_error";
134
+ code: "api_key_malformed";
136
135
  details?: readonly Response.error.Detail[] | undefined;
137
136
  message: string;
138
137
  };
139
138
  requestId: string;
140
139
  };
141
140
  outputFormat: "json";
142
- status: 502;
141
+ status: 400;
143
142
  input: {
144
143
  param: {
145
144
  orgId: string;
@@ -152,14 +151,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
152
151
  } | {
153
152
  output: {
154
153
  error: {
155
- code: "api_key_malformed";
154
+ code: "api_key_invalid" | "api_key_missing";
156
155
  details?: readonly Response.error.Detail[] | undefined;
157
156
  message: string;
158
157
  };
159
158
  requestId: string;
160
159
  };
161
160
  outputFormat: "json";
162
- status: 400;
161
+ status: 401;
163
162
  input: {
164
163
  param: {
165
164
  orgId: string;
@@ -172,14 +171,34 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
172
171
  } | {
173
172
  output: {
174
173
  error: {
175
- code: "api_key_invalid" | "api_key_missing";
174
+ code: "api_key_forbidden";
176
175
  details?: readonly Response.error.Detail[] | undefined;
177
176
  message: string;
178
177
  };
179
178
  requestId: string;
180
179
  };
181
180
  outputFormat: "json";
182
- status: 401;
181
+ status: 403;
182
+ input: {
183
+ param: {
184
+ orgId: string;
185
+ };
186
+ } & {
187
+ query?: {
188
+ environment?: string | string[];
189
+ } | undefined;
190
+ };
191
+ } | {
192
+ output: {
193
+ error: {
194
+ code: "payment_required" | "rate_limit_exceeded";
195
+ details?: readonly Response.error.Detail[] | undefined;
196
+ message: string;
197
+ };
198
+ requestId: string;
199
+ };
200
+ outputFormat: "json";
201
+ status: 429;
183
202
  input: {
184
203
  param: {
185
204
  orgId: string;
@@ -212,14 +231,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
212
231
  } | {
213
232
  output: {
214
233
  error: {
215
- code: "forbidden";
234
+ code: "upstream_error";
216
235
  details?: readonly Response.error.Detail[] | undefined;
217
236
  message: string;
218
237
  };
219
238
  requestId: string;
220
239
  };
221
240
  outputFormat: "json";
222
- status: 403;
241
+ status: 502;
223
242
  input: {
224
243
  param: {
225
244
  orgId: string;
@@ -326,14 +345,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
326
345
  $patch: {
327
346
  output: {
328
347
  error: {
329
- code: "upstream_error";
348
+ code: "api_key_malformed";
330
349
  details?: readonly Response.error.Detail[] | undefined;
331
350
  message: string;
332
351
  };
333
352
  requestId: string;
334
353
  };
335
354
  outputFormat: "json";
336
- status: 502;
355
+ status: 400;
337
356
  input: {
338
357
  param: {
339
358
  orgId: string;
@@ -358,14 +377,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
358
377
  } | {
359
378
  output: {
360
379
  error: {
361
- code: "api_key_malformed";
380
+ code: "api_key_invalid" | "api_key_missing";
362
381
  details?: readonly Response.error.Detail[] | undefined;
363
382
  message: string;
364
383
  };
365
384
  requestId: string;
366
385
  };
367
386
  outputFormat: "json";
368
- status: 400;
387
+ status: 401;
369
388
  input: {
370
389
  param: {
371
390
  orgId: string;
@@ -390,14 +409,46 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
390
409
  } | {
391
410
  output: {
392
411
  error: {
393
- code: "api_key_invalid" | "api_key_missing";
412
+ code: "api_key_forbidden";
394
413
  details?: readonly Response.error.Detail[] | undefined;
395
414
  message: string;
396
415
  };
397
416
  requestId: string;
398
417
  };
399
418
  outputFormat: "json";
400
- status: 401;
419
+ status: 403;
420
+ input: {
421
+ param: {
422
+ orgId: string;
423
+ };
424
+ } & {
425
+ query?: {
426
+ environment?: string | string[];
427
+ } | undefined;
428
+ } & {
429
+ json: {
430
+ spendLimit?: {
431
+ amount: string;
432
+ currency?: "usd" | undefined;
433
+ period?: "month" | undefined;
434
+ } | null | undefined;
435
+ txFeeLimit?: {
436
+ amount: string;
437
+ currency?: "usd" | undefined;
438
+ } | null | undefined;
439
+ };
440
+ };
441
+ } | {
442
+ output: {
443
+ error: {
444
+ code: "payment_required" | "rate_limit_exceeded";
445
+ details?: readonly Response.error.Detail[] | undefined;
446
+ message: string;
447
+ };
448
+ requestId: string;
449
+ };
450
+ outputFormat: "json";
451
+ status: 429;
401
452
  input: {
402
453
  param: {
403
454
  orgId: string;
@@ -454,14 +505,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
454
505
  } | {
455
506
  output: {
456
507
  error: {
457
- code: "forbidden";
508
+ code: "upstream_error";
458
509
  details?: readonly Response.error.Detail[] | undefined;
459
510
  message: string;
460
511
  };
461
512
  requestId: string;
462
513
  };
463
514
  outputFormat: "json";
464
- status: 403;
515
+ status: 502;
465
516
  input: {
466
517
  param: {
467
518
  orgId: string;
@@ -660,14 +711,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
660
711
  $post: {
661
712
  output: {
662
713
  error: {
663
- code: "upstream_error";
714
+ code: "api_key_malformed";
664
715
  details?: readonly Response.error.Detail[] | undefined;
665
716
  message: string;
666
717
  };
667
718
  requestId: string;
668
719
  };
669
720
  outputFormat: "json";
670
- status: 502;
721
+ status: 400;
671
722
  input: {
672
723
  param: {
673
724
  orgId: string;
@@ -680,14 +731,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
680
731
  } | {
681
732
  output: {
682
733
  error: {
683
- code: "api_key_malformed";
734
+ code: "api_key_invalid" | "api_key_missing";
684
735
  details?: readonly Response.error.Detail[] | undefined;
685
736
  message: string;
686
737
  };
687
738
  requestId: string;
688
739
  };
689
740
  outputFormat: "json";
690
- status: 400;
741
+ status: 401;
691
742
  input: {
692
743
  param: {
693
744
  orgId: string;
@@ -700,14 +751,34 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
700
751
  } | {
701
752
  output: {
702
753
  error: {
703
- code: "api_key_invalid" | "api_key_missing";
754
+ code: "api_key_forbidden";
704
755
  details?: readonly Response.error.Detail[] | undefined;
705
756
  message: string;
706
757
  };
707
758
  requestId: string;
708
759
  };
709
760
  outputFormat: "json";
710
- status: 401;
761
+ status: 403;
762
+ input: {
763
+ param: {
764
+ orgId: string;
765
+ };
766
+ } & {
767
+ query?: {
768
+ environment?: string | string[];
769
+ } | undefined;
770
+ };
771
+ } | {
772
+ output: {
773
+ error: {
774
+ code: "payment_required" | "rate_limit_exceeded";
775
+ details?: readonly Response.error.Detail[] | undefined;
776
+ message: string;
777
+ };
778
+ requestId: string;
779
+ };
780
+ outputFormat: "json";
781
+ status: 429;
711
782
  input: {
712
783
  param: {
713
784
  orgId: string;
@@ -740,14 +811,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
740
811
  } | {
741
812
  output: {
742
813
  error: {
743
- code: "forbidden";
814
+ code: "upstream_error";
744
815
  details?: readonly Response.error.Detail[] | undefined;
745
816
  message: string;
746
817
  };
747
818
  requestId: string;
748
819
  };
749
820
  outputFormat: "json";
750
- status: 403;
821
+ status: 502;
751
822
  input: {
752
823
  param: {
753
824
  orgId: string;
@@ -839,14 +910,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
839
910
  $post: {
840
911
  output: {
841
912
  error: {
842
- code: "upstream_error";
913
+ code: "api_key_malformed";
843
914
  details?: readonly Response.error.Detail[] | undefined;
844
915
  message: string;
845
916
  };
846
917
  requestId: string;
847
918
  };
848
919
  outputFormat: "json";
849
- status: 502;
920
+ status: 400;
850
921
  input: {
851
922
  param: {
852
923
  orgId: string;
@@ -859,14 +930,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
859
930
  } | {
860
931
  output: {
861
932
  error: {
862
- code: "api_key_malformed";
933
+ code: "api_key_invalid" | "api_key_missing";
863
934
  details?: readonly Response.error.Detail[] | undefined;
864
935
  message: string;
865
936
  };
866
937
  requestId: string;
867
938
  };
868
939
  outputFormat: "json";
869
- status: 400;
940
+ status: 401;
870
941
  input: {
871
942
  param: {
872
943
  orgId: string;
@@ -879,14 +950,34 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
879
950
  } | {
880
951
  output: {
881
952
  error: {
882
- code: "api_key_invalid" | "api_key_missing";
953
+ code: "api_key_forbidden";
883
954
  details?: readonly Response.error.Detail[] | undefined;
884
955
  message: string;
885
956
  };
886
957
  requestId: string;
887
958
  };
888
959
  outputFormat: "json";
889
- status: 401;
960
+ status: 403;
961
+ input: {
962
+ param: {
963
+ orgId: string;
964
+ };
965
+ } & {
966
+ query?: {
967
+ environment?: string | string[];
968
+ } | undefined;
969
+ };
970
+ } | {
971
+ output: {
972
+ error: {
973
+ code: "payment_required" | "rate_limit_exceeded";
974
+ details?: readonly Response.error.Detail[] | undefined;
975
+ message: string;
976
+ };
977
+ requestId: string;
978
+ };
979
+ outputFormat: "json";
980
+ status: 429;
890
981
  input: {
891
982
  param: {
892
983
  orgId: string;
@@ -919,14 +1010,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
919
1010
  } | {
920
1011
  output: {
921
1012
  error: {
922
- code: "forbidden";
1013
+ code: "upstream_error";
923
1014
  details?: readonly Response.error.Detail[] | undefined;
924
1015
  message: string;
925
1016
  };
926
1017
  requestId: string;
927
1018
  };
928
1019
  outputFormat: "json";
929
- status: 403;
1020
+ status: 502;
930
1021
  input: {
931
1022
  param: {
932
1023
  orgId: string;
@@ -1038,14 +1129,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
1038
1129
  $get: {
1039
1130
  output: {
1040
1131
  error: {
1041
- code: "upstream_error";
1132
+ code: "api_key_malformed";
1042
1133
  details?: readonly Response.error.Detail[] | undefined;
1043
1134
  message: string;
1044
1135
  };
1045
1136
  requestId: string;
1046
1137
  };
1047
1138
  outputFormat: "json";
1048
- status: 502;
1139
+ status: 400;
1049
1140
  input: {
1050
1141
  param: {
1051
1142
  orgId: string;
@@ -1058,14 +1149,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
1058
1149
  } | {
1059
1150
  output: {
1060
1151
  error: {
1061
- code: "api_key_malformed";
1152
+ code: "api_key_invalid" | "api_key_missing";
1062
1153
  details?: readonly Response.error.Detail[] | undefined;
1063
1154
  message: string;
1064
1155
  };
1065
1156
  requestId: string;
1066
1157
  };
1067
1158
  outputFormat: "json";
1068
- status: 400;
1159
+ status: 401;
1069
1160
  input: {
1070
1161
  param: {
1071
1162
  orgId: string;
@@ -1078,14 +1169,34 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
1078
1169
  } | {
1079
1170
  output: {
1080
1171
  error: {
1081
- code: "api_key_invalid" | "api_key_missing";
1172
+ code: "api_key_forbidden";
1082
1173
  details?: readonly Response.error.Detail[] | undefined;
1083
1174
  message: string;
1084
1175
  };
1085
1176
  requestId: string;
1086
1177
  };
1087
1178
  outputFormat: "json";
1088
- status: 401;
1179
+ status: 403;
1180
+ input: {
1181
+ param: {
1182
+ orgId: string;
1183
+ };
1184
+ } & {
1185
+ query?: {
1186
+ environment?: string | string[];
1187
+ } | undefined;
1188
+ };
1189
+ } | {
1190
+ output: {
1191
+ error: {
1192
+ code: "payment_required" | "rate_limit_exceeded";
1193
+ details?: readonly Response.error.Detail[] | undefined;
1194
+ message: string;
1195
+ };
1196
+ requestId: string;
1197
+ };
1198
+ outputFormat: "json";
1199
+ status: 429;
1089
1200
  input: {
1090
1201
  param: {
1091
1202
  orgId: string;
@@ -1118,14 +1229,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
1118
1229
  } | {
1119
1230
  output: {
1120
1231
  error: {
1121
- code: "forbidden";
1232
+ code: "upstream_error";
1122
1233
  details?: readonly Response.error.Detail[] | undefined;
1123
1234
  message: string;
1124
1235
  };
1125
1236
  requestId: string;
1126
1237
  };
1127
1238
  outputFormat: "json";
1128
- status: 403;
1239
+ status: 502;
1129
1240
  input: {
1130
1241
  param: {
1131
1242
  orgId: string;
@@ -1229,14 +1340,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
1229
1340
  $delete: {
1230
1341
  output: {
1231
1342
  error: {
1232
- code: "upstream_error";
1343
+ code: "api_key_malformed";
1233
1344
  details?: readonly Response.error.Detail[] | undefined;
1234
1345
  message: string;
1235
1346
  };
1236
1347
  requestId: string;
1237
1348
  };
1238
1349
  outputFormat: "json";
1239
- status: 502;
1350
+ status: 400;
1240
1351
  input: {
1241
1352
  param: {
1242
1353
  methodId: string;
@@ -1250,14 +1361,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
1250
1361
  } | {
1251
1362
  output: {
1252
1363
  error: {
1253
- code: "api_key_malformed";
1364
+ code: "api_key_invalid" | "api_key_missing";
1254
1365
  details?: readonly Response.error.Detail[] | undefined;
1255
1366
  message: string;
1256
1367
  };
1257
1368
  requestId: string;
1258
1369
  };
1259
1370
  outputFormat: "json";
1260
- status: 400;
1371
+ status: 401;
1261
1372
  input: {
1262
1373
  param: {
1263
1374
  methodId: string;
@@ -1271,14 +1382,35 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
1271
1382
  } | {
1272
1383
  output: {
1273
1384
  error: {
1274
- code: "api_key_invalid" | "api_key_missing";
1385
+ code: "api_key_forbidden";
1275
1386
  details?: readonly Response.error.Detail[] | undefined;
1276
1387
  message: string;
1277
1388
  };
1278
1389
  requestId: string;
1279
1390
  };
1280
1391
  outputFormat: "json";
1281
- status: 401;
1392
+ status: 403;
1393
+ input: {
1394
+ param: {
1395
+ methodId: string;
1396
+ orgId: string;
1397
+ };
1398
+ } & {
1399
+ query?: {
1400
+ environment?: string | string[];
1401
+ } | undefined;
1402
+ };
1403
+ } | {
1404
+ output: {
1405
+ error: {
1406
+ code: "payment_required" | "rate_limit_exceeded";
1407
+ details?: readonly Response.error.Detail[] | undefined;
1408
+ message: string;
1409
+ };
1410
+ requestId: string;
1411
+ };
1412
+ outputFormat: "json";
1413
+ status: 429;
1282
1414
  input: {
1283
1415
  param: {
1284
1416
  methodId: string;
@@ -1313,14 +1445,14 @@ export declare function billing(): import("hono/hono-base").HonoBase<Environment
1313
1445
  } | {
1314
1446
  output: {
1315
1447
  error: {
1316
- code: "forbidden";
1448
+ code: "upstream_error";
1317
1449
  details?: readonly Response.error.Detail[] | undefined;
1318
1450
  message: string;
1319
1451
  };
1320
1452
  requestId: string;
1321
1453
  };
1322
1454
  outputFormat: "json";
1323
- status: 403;
1455
+ status: 502;
1324
1456
  input: {
1325
1457
  param: {
1326
1458
  methodId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../../src/apps/management/routes/billing.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAO7B,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAA;AAMzD,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,WAAW,CAAA;AAErD,iDAAiD;AACjD,yBAAiB,MAAM,CAAC;IAQtB,6DAA6D;IACtD,MAAM,MAAM;;qBAEoD,CAAA;IAEvE,0DAA0D;IACnD,MAAM,KAAK;;;;;sBAEsD,CAAA;IAExE,qDAAqD;IAC9C,MAAM,YAAY;;;qBAU6C,CAAA;IAEtE,gCAAgC;IACzB,MAAM,UAAU;;;;;;;;qBAuBtB,CAAA;IAED,iCAAiC;IAC1B,MAAM,UAAU;;;;;qBAiBtB,CAAA;IAED,qEAAqE;IAC9D,MAAM,KAAK;;;;;;;;;;;;;;;;qBAcjB,CAAA;IAED,uCAAuC;IAChC,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA6CnB,CAAA;IAED,oCAAoC;IAC7B,MAAM,OAAO;;qBAUnB,CAAA;IAED,gCAAgC;IACzB,MAAM,aAAa;;;;;;;;;;;;qBAkDzB,CAAA;IAED,yCAAyC;IAClC,MAAM,cAAc;;;;;;;;;;;;;;qBAK1B,CAAA;CACF;AAED;;;GAGG;AACH,wBAAgB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA2gBtB"}
@@ -135,12 +135,11 @@ export var schema;
135
135
  }), "An organization's payment methods.");
136
136
  })(schema || (schema = {}));
137
137
  /**
138
- * Mounts the billing surface: an organization's billing status. Orgs without
139
- * a Stripe billing source read as `none`. Session lane; reads for members.
138
+ * Mounts billing routes. Reads require membership or scoped API key access; organizations without Stripe state return `none`.
140
139
  */
141
140
  export function billing() {
142
141
  return new Hono()
143
- .get('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing', Auth.policy({ session: true }), Auth.ensureOrg(), OpenApi.validate('param', schema.Params, {
142
+ .get('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing', Auth.policy({ apiKey: { scopes: ['management:read'] }, session: true }), Auth.ensureOrg(), OpenApi.validate('param', schema.Params, {
144
143
  code: 'param_invalid',
145
144
  message: 'Check the path parameters and try again.',
146
145
  }), OpenApi.validate('query', schema.Query, {
@@ -159,7 +158,7 @@ export function billing() {
159
158
  tags: ['Billing'],
160
159
  }), async (c) => {
161
160
  if (Auth.narrowAccess)
162
- return Auth.superAdminAccessError(c);
161
+ return Auth.accessError(c);
163
162
  if (Auth.narrowScope)
164
163
  return Auth.ensureOrgError(c);
165
164
  if (OpenApi.narrowValidation)
@@ -185,7 +184,7 @@ export function billing() {
185
184
  return Response.upstream(c, cause);
186
185
  }
187
186
  })
188
- .patch('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing', Auth.policy({ session: true }), Auth.ensureOrg({ role: 'owner' }), OpenApi.validate('param', schema.Params, {
187
+ .patch('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing', Auth.policy({ apiKey: { scopes: ['management:write'] }, session: true }), Auth.ensureOrg({ role: 'owner' }), OpenApi.validate('param', schema.Params, {
189
188
  code: 'param_invalid',
190
189
  message: 'Check the path parameters and try again.',
191
190
  }), OpenApi.validate('query', schema.Query, {
@@ -211,7 +210,7 @@ export function billing() {
211
210
  tags: ['Billing'],
212
211
  }), async (c) => {
213
212
  if (Auth.narrowAccess)
214
- return Auth.superAdminAccessError(c);
213
+ return Auth.accessError(c);
215
214
  if (Auth.narrowScope)
216
215
  return Auth.ensureOrgError(c);
217
216
  if (OpenApi.narrowValidation)
@@ -263,7 +262,7 @@ export function billing() {
263
262
  return Response.upstream(c, cause);
264
263
  }
265
264
  })
266
- .post('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing/stripe/checkout', Auth.policy({ session: true }), Auth.ensureOrg({ role: 'owner' }), OpenApi.validate('param', schema.Params, {
265
+ .post('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing/stripe/checkout', Auth.policy({ apiKey: { scopes: ['management:write'] }, session: true }), Auth.ensureOrg({ role: 'owner' }), OpenApi.validate('param', schema.Params, {
267
266
  code: 'param_invalid',
268
267
  message: 'Check the path parameters and try again.',
269
268
  }), OpenApi.validate('query', schema.Query, {
@@ -286,7 +285,7 @@ export function billing() {
286
285
  tags: ['Billing'],
287
286
  }), async (c) => {
288
287
  if (Auth.narrowAccess)
289
- return Auth.superAdminAccessError(c);
288
+ return Auth.accessError(c);
290
289
  if (Auth.narrowScope)
291
290
  return Auth.ensureOrgError(c);
292
291
  if (OpenApi.narrowValidation)
@@ -344,7 +343,7 @@ export function billing() {
344
343
  return Response.upstream(c, cause);
345
344
  }
346
345
  })
347
- .post('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing/stripe/manage', Auth.policy({ session: true }), Auth.ensureOrg({ role: 'owner' }), OpenApi.validate('param', schema.Params, {
346
+ .post('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing/stripe/manage', Auth.policy({ apiKey: { scopes: ['management:write'] }, session: true }), Auth.ensureOrg({ role: 'owner' }), OpenApi.validate('param', schema.Params, {
348
347
  code: 'param_invalid',
349
348
  message: 'Check the path parameters and try again.',
350
349
  }), OpenApi.validate('query', schema.Query, {
@@ -367,7 +366,7 @@ export function billing() {
367
366
  tags: ['Billing'],
368
367
  }), async (c) => {
369
368
  if (Auth.narrowAccess)
370
- return Auth.superAdminAccessError(c);
369
+ return Auth.accessError(c);
371
370
  if (Auth.narrowScope)
372
371
  return Auth.ensureOrgError(c);
373
372
  if (OpenApi.narrowValidation)
@@ -403,7 +402,7 @@ export function billing() {
403
402
  return Response.upstream(c, cause);
404
403
  }
405
404
  })
406
- .get('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing/payment-methods', Auth.policy({ session: true }), Auth.ensureOrg(), OpenApi.validate('param', schema.Params, {
405
+ .get('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing/payment-methods', Auth.policy({ apiKey: { scopes: ['management:read'] }, session: true }), Auth.ensureOrg(), OpenApi.validate('param', schema.Params, {
407
406
  code: 'param_invalid',
408
407
  message: 'Check the path parameters and try again.',
409
408
  }), OpenApi.validate('query', schema.Query, {
@@ -425,7 +424,7 @@ export function billing() {
425
424
  tags: ['Billing'],
426
425
  }), async (c) => {
427
426
  if (Auth.narrowAccess)
428
- return Auth.superAdminAccessError(c);
427
+ return Auth.accessError(c);
429
428
  if (Auth.narrowScope)
430
429
  return Auth.ensureOrgError(c);
431
430
  if (OpenApi.narrowValidation)
@@ -482,7 +481,7 @@ export function billing() {
482
481
  return Response.upstream(c, cause);
483
482
  }
484
483
  })
485
- .delete('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing/payment-methods/:methodId{pm_[A-Za-z0-9_-]+}', Auth.policy({ session: true }), Auth.ensureOrg({ role: 'owner' }), OpenApi.validate('param', schema.MethodParams, {
484
+ .delete('/v1/orgs/:orgId{org_[A-Za-z0-9_-]+}/billing/payment-methods/:methodId{pm_[A-Za-z0-9_-]+}', Auth.policy({ apiKey: { scopes: ['management:write'] }, session: true }), Auth.ensureOrg({ role: 'owner' }), OpenApi.validate('param', schema.MethodParams, {
486
485
  code: 'param_invalid',
487
486
  message: 'Check the path parameters and try again.',
488
487
  }), OpenApi.validate('query', schema.Query, {
@@ -505,7 +504,7 @@ export function billing() {
505
504
  tags: ['Billing'],
506
505
  }), async (c) => {
507
506
  if (Auth.narrowAccess)
508
- return Auth.superAdminAccessError(c);
507
+ return Auth.accessError(c);
509
508
  if (Auth.narrowScope)
510
509
  return Auth.ensureOrgError(c);
511
510
  if (OpenApi.narrowValidation)
@@ -648,6 +647,7 @@ async function syncKeyBilling(c, options) {
648
647
  active: options.status === 'active',
649
648
  environment: 'sandbox',
650
649
  orgId: options.orgId,
650
+ scopeCatalog: c.get('scopeCatalog'),
651
651
  });
652
652
  }
653
653
  /**