@metabase/client 0.0.0-stage → 0.1.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 (323) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +661 -0
  3. package/README.md +488 -2
  4. package/dist/auth/credential.d.ts +2 -0
  5. package/dist/auth/credential.js +61 -0
  6. package/dist/auth/oauth-login.d.ts +2 -0
  7. package/dist/auth/oauth-login.js +2 -0
  8. package/dist/auth/oauth-session.d.ts +2 -0
  9. package/dist/auth/oauth-session.js +31 -0
  10. package/dist/card-B6merEUN.d.ts +1392 -0
  11. package/dist/card-BZx4NSr-.d.ts +33 -0
  12. package/dist/client-DNRvXFRm.d.ts +3276 -0
  13. package/dist/client.d.ts +2 -0
  14. package/dist/client.js +95 -0
  15. package/dist/collection-Bib61WiV.d.ts +294 -0
  16. package/dist/collection-CqtGPi4W.d.ts +39 -0
  17. package/dist/content-translation-zfUkE_OG.d.ts +8 -0
  18. package/dist/credential-6aOEGqMH.d.ts +30 -0
  19. package/dist/cron-DThzerR6.d.ts +9 -0
  20. package/dist/csv-upload--K35QedP.d.ts +8 -0
  21. package/dist/dashboard-XTe46250.d.ts +38 -0
  22. package/dist/dashboard-z9i1VUZC.d.ts +970 -0
  23. package/dist/data-action-rS27f2Ji.d.ts +95 -0
  24. package/dist/database-BLUMlywE.d.ts +997 -0
  25. package/dist/database-DqTespfa.d.ts +27 -0
  26. package/dist/dataset-C6lX1-cr.d.ts +4144 -0
  27. package/dist/dataset-Cj3XuKLe.d.ts +23 -0
  28. package/dist/dependency-D8Qs5Xdx.d.ts +827 -0
  29. package/dist/dependency-fN5_7a22.d.ts +299 -0
  30. package/dist/document-oZNDbDfx.d.ts +115 -0
  31. package/dist/domain/card.d.ts +2 -0
  32. package/dist/domain/card.js +140 -0
  33. package/dist/domain/collection.d.ts +2 -0
  34. package/dist/domain/collection.js +137 -0
  35. package/dist/domain/content-translation.d.ts +2 -0
  36. package/dist/domain/content-translation.js +5 -0
  37. package/dist/domain/cron.d.ts +2 -0
  38. package/dist/domain/cron.js +5 -0
  39. package/dist/domain/dashboard.d.ts +2 -0
  40. package/dist/domain/dashboard.js +194 -0
  41. package/dist/domain/data-action.d.ts +2 -0
  42. package/dist/domain/data-action.js +85 -0
  43. package/dist/domain/database.d.ts +2 -0
  44. package/dist/domain/database.js +56 -0
  45. package/dist/domain/dataset.d.ts +2 -0
  46. package/dist/domain/dataset.js +56 -0
  47. package/dist/domain/dependency.d.ts +2 -0
  48. package/dist/domain/dependency.js +165 -0
  49. package/dist/domain/document.d.ts +2 -0
  50. package/dist/domain/document.js +94 -0
  51. package/dist/domain/eid-translation.d.ts +2 -0
  52. package/dist/domain/eid-translation.js +36 -0
  53. package/dist/domain/embedding.d.ts +2 -0
  54. package/dist/domain/embedding.js +9 -0
  55. package/dist/domain/erd.d.ts +2 -0
  56. package/dist/domain/erd.js +45 -0
  57. package/dist/domain/field.d.ts +2 -0
  58. package/dist/domain/field.js +268 -0
  59. package/dist/domain/git-sync.d.ts +2 -0
  60. package/dist/domain/git-sync.js +147 -0
  61. package/dist/domain/glossary.d.ts +2 -0
  62. package/dist/domain/glossary.js +30 -0
  63. package/dist/domain/library.d.ts +2 -0
  64. package/dist/domain/library.js +83 -0
  65. package/dist/domain/measure.d.ts +2 -0
  66. package/dist/domain/measure.js +41 -0
  67. package/dist/domain/metric.d.ts +2 -0
  68. package/dist/domain/metric.js +139 -0
  69. package/dist/domain/moderation-review.d.ts +2 -0
  70. package/dist/domain/moderation-review.js +31 -0
  71. package/dist/domain/notification.d.ts +2 -0
  72. package/dist/domain/notification.js +138 -0
  73. package/dist/domain/parameter.d.ts +2 -0
  74. package/dist/domain/parameter.js +109 -0
  75. package/dist/domain/permission.d.ts +2 -0
  76. package/dist/domain/permission.js +36 -0
  77. package/dist/domain/pulse.d.ts +2 -0
  78. package/dist/domain/pulse.js +133 -0
  79. package/dist/domain/query.d.ts +2 -0
  80. package/dist/domain/query.js +13 -0
  81. package/dist/domain/replacement.d.ts +2 -0
  82. package/dist/domain/replacement.js +93 -0
  83. package/dist/domain/revision.d.ts +2 -0
  84. package/dist/domain/revision.js +63 -0
  85. package/dist/domain/search.d.ts +2 -0
  86. package/dist/domain/search.js +63 -0
  87. package/dist/domain/segment.d.ts +2 -0
  88. package/dist/domain/segment.js +44 -0
  89. package/dist/domain/session-properties.d.ts +2 -0
  90. package/dist/domain/session-properties.js +14 -0
  91. package/dist/domain/setting.d.ts +2 -0
  92. package/dist/domain/setting.js +22 -0
  93. package/dist/domain/setup.d.ts +2 -0
  94. package/dist/domain/setup.js +21 -0
  95. package/dist/domain/snippet.d.ts +2 -0
  96. package/dist/domain/snippet.js +38 -0
  97. package/dist/domain/table.d.ts +2 -0
  98. package/dist/domain/table.js +156 -0
  99. package/dist/domain/text.d.ts +5 -0
  100. package/dist/domain/text.js +6 -0
  101. package/dist/domain/timeline.d.ts +2 -0
  102. package/dist/domain/timeline.js +97 -0
  103. package/dist/domain/transform-dag-run.d.ts +2 -0
  104. package/dist/domain/transform-dag-run.js +19 -0
  105. package/dist/domain/transform-inspector.d.ts +2 -0
  106. package/dist/domain/transform-inspector.js +142 -0
  107. package/dist/domain/transform-job.d.ts +2 -0
  108. package/dist/domain/transform-job.js +109 -0
  109. package/dist/domain/transform-python.d.ts +2 -0
  110. package/dist/domain/transform-python.js +39 -0
  111. package/dist/domain/transform-tag.d.ts +2 -0
  112. package/dist/domain/transform-tag.js +17 -0
  113. package/dist/domain/transform-test.d.ts +2 -0
  114. package/dist/domain/transform-test.js +176 -0
  115. package/dist/domain/transform.d.ts +2 -0
  116. package/dist/domain/transform.js +235 -0
  117. package/dist/domain/upload.d.ts +2 -0
  118. package/dist/domain/upload.js +13 -0
  119. package/dist/domain/user.d.ts +2 -0
  120. package/dist/domain/user.js +16 -0
  121. package/dist/eid-translation-nuhr8St2.d.ts +143 -0
  122. package/dist/embedding-Cz3RUJYf.d.ts +10 -0
  123. package/dist/erd-BdeFEeSy.d.ts +842 -0
  124. package/dist/erd-BujD227Y.d.ts +51 -0
  125. package/dist/errors-DdMlaXqq.js +330 -0
  126. package/dist/errors.d.ts +2 -0
  127. package/dist/errors.js +189 -0
  128. package/dist/features-CnFkUCj2.d.ts +261 -0
  129. package/dist/field-BCRO19mk.d.ts +2547 -0
  130. package/dist/field-Bqn10Fq_.d.ts +50 -0
  131. package/dist/git-sync-DNXrNVCW.d.ts +258 -0
  132. package/dist/git-sync-gAMKsZgN.d.ts +205 -0
  133. package/dist/glossary-CHK3elPj.d.ts +35 -0
  134. package/dist/glossary-CqFlzW33.d.ts +15 -0
  135. package/dist/http/errors.d.ts +2 -0
  136. package/dist/http/errors.js +2 -0
  137. package/dist/http/oauth.d.ts +2 -0
  138. package/dist/http/oauth.js +201 -0
  139. package/dist/http/retry.d.ts +19 -0
  140. package/dist/http/retry.js +33 -0
  141. package/dist/http/transport.d.ts +2 -0
  142. package/dist/http/transport.js +2 -0
  143. package/dist/index.d.ts +60 -0
  144. package/dist/index.js +62 -0
  145. package/dist/json-CZvjc3--.d.ts +19 -0
  146. package/dist/json-pointer.d.ts +4 -0
  147. package/dist/json-pointer.js +7 -0
  148. package/dist/json.d.ts +2 -0
  149. package/dist/json.js +44 -0
  150. package/dist/known-range-DTOBgTEC.d.ts +7 -0
  151. package/dist/library-Cx9h_RkU.d.ts +228 -0
  152. package/dist/list-BT_bBm9Z.d.ts +7 -0
  153. package/dist/list.d.ts +2 -0
  154. package/dist/list.js +1 -0
  155. package/dist/measure-CuMqPbQX.d.ts +108 -0
  156. package/dist/measure-KuXdjZYJ.d.ts +44 -0
  157. package/dist/metric-yvehaVCS.d.ts +2655 -0
  158. package/dist/moderation-review-B4RUTZ6_.d.ts +56 -0
  159. package/dist/network-error-5g4U1iul.js +62 -0
  160. package/dist/notification-BT2TDAd_.d.ts +379 -0
  161. package/dist/notification-BiegPoSD.d.ts +22 -0
  162. package/dist/oauth-C4ordeoJ.d.ts +59 -0
  163. package/dist/oauth-login-CJsT_3EE.d.ts +19 -0
  164. package/dist/oauth-login-D734Jvbq.js +179 -0
  165. package/dist/oauth-session-BlIlcd8Q.d.ts +6 -0
  166. package/dist/paginate-DZWvWvbm.d.ts +24 -0
  167. package/dist/paginate.d.ts +2 -0
  168. package/dist/paginate.js +49 -0
  169. package/dist/parameter-ak-J-IOj.d.ts +190 -0
  170. package/dist/permission-BnCQw5Kp.d.ts +149 -0
  171. package/dist/poll-CIwnee7h.d.ts +15 -0
  172. package/dist/poll.d.ts +2 -0
  173. package/dist/poll.js +47 -0
  174. package/dist/predicates.d.ts +10 -0
  175. package/dist/predicates.js +18 -0
  176. package/dist/pulse-CMc1Rwdj.d.ts +596 -0
  177. package/dist/pulse-dylocLd9.d.ts +18 -0
  178. package/dist/query-Xsin530u.d.ts +23 -0
  179. package/dist/refusal-B9aeHMc9.js +130 -0
  180. package/dist/replacement-CyvtbxGg.d.ts +2467 -0
  181. package/dist/replacement-S9U3gApY.d.ts +128 -0
  182. package/dist/requirement-check-CIA5IHC1.d.ts +17 -0
  183. package/dist/requirements-C0txASN8.d.ts +217 -0
  184. package/dist/resources/card.d.ts +2 -0
  185. package/dist/resources/card.js +103 -0
  186. package/dist/resources/collection.d.ts +2 -0
  187. package/dist/resources/collection.js +110 -0
  188. package/dist/resources/content-translation.d.ts +11 -0
  189. package/dist/resources/content-translation.js +27 -0
  190. package/dist/resources/csv-upload.d.ts +2 -0
  191. package/dist/resources/csv-upload.js +9 -0
  192. package/dist/resources/dashboard.d.ts +2 -0
  193. package/dist/resources/dashboard.js +218 -0
  194. package/dist/resources/data-action.d.ts +105 -0
  195. package/dist/resources/data-action.js +79 -0
  196. package/dist/resources/database.d.ts +2 -0
  197. package/dist/resources/database.js +103 -0
  198. package/dist/resources/dataset.d.ts +2 -0
  199. package/dist/resources/dataset.js +81 -0
  200. package/dist/resources/dependency.d.ts +2 -0
  201. package/dist/resources/dependency.js +150 -0
  202. package/dist/resources/document.d.ts +55 -0
  203. package/dist/resources/document.js +60 -0
  204. package/dist/resources/eid-translation.d.ts +8 -0
  205. package/dist/resources/eid-translation.js +19 -0
  206. package/dist/resources/erd.d.ts +2 -0
  207. package/dist/resources/erd.js +26 -0
  208. package/dist/resources/field.d.ts +2 -0
  209. package/dist/resources/field.js +98 -0
  210. package/dist/resources/git-sync.d.ts +2 -0
  211. package/dist/resources/git-sync.js +362 -0
  212. package/dist/resources/glossary.d.ts +2 -0
  213. package/dist/resources/glossary.js +51 -0
  214. package/dist/resources/library.d.ts +85 -0
  215. package/dist/resources/library.js +90 -0
  216. package/dist/resources/measure.d.ts +2 -0
  217. package/dist/resources/measure.js +57 -0
  218. package/dist/resources/metric.d.ts +2 -0
  219. package/dist/resources/metric.js +50 -0
  220. package/dist/resources/moderation-review.d.ts +23 -0
  221. package/dist/resources/moderation-review.js +24 -0
  222. package/dist/resources/notification.d.ts +2 -0
  223. package/dist/resources/notification.js +93 -0
  224. package/dist/resources/optional-parsed.d.ts +7 -0
  225. package/dist/resources/optional-parsed.js +14 -0
  226. package/dist/resources/permission.d.ts +10 -0
  227. package/dist/resources/permission.js +31 -0
  228. package/dist/resources/pivot-export.d.ts +10 -0
  229. package/dist/resources/pivot-export.js +16 -0
  230. package/dist/resources/pulse.d.ts +2 -0
  231. package/dist/resources/pulse.js +75 -0
  232. package/dist/resources/replacement.d.ts +2 -0
  233. package/dist/resources/replacement.js +82 -0
  234. package/dist/resources/request-body.d.ts +9 -0
  235. package/dist/resources/request-body.js +13 -0
  236. package/dist/resources/revision.d.ts +70 -0
  237. package/dist/resources/revision.js +51 -0
  238. package/dist/resources/search.d.ts +2 -0
  239. package/dist/resources/search.js +57 -0
  240. package/dist/resources/segment.d.ts +2 -0
  241. package/dist/resources/segment.js +55 -0
  242. package/dist/resources/setting.d.ts +11 -0
  243. package/dist/resources/setting.js +43 -0
  244. package/dist/resources/setup.d.ts +8 -0
  245. package/dist/resources/setup.js +18 -0
  246. package/dist/resources/snippet.d.ts +2 -0
  247. package/dist/resources/snippet.js +52 -0
  248. package/dist/resources/table.d.ts +2 -0
  249. package/dist/resources/table.js +275 -0
  250. package/dist/resources/timeline-event.d.ts +12 -0
  251. package/dist/resources/timeline-event.js +51 -0
  252. package/dist/resources/timeline.d.ts +2 -0
  253. package/dist/resources/timeline.js +82 -0
  254. package/dist/resources/transform-dag-run.d.ts +22 -0
  255. package/dist/resources/transform-dag-run.js +32 -0
  256. package/dist/resources/transform-inspector.d.ts +214 -0
  257. package/dist/resources/transform-inspector.js +47 -0
  258. package/dist/resources/transform-job.d.ts +2 -0
  259. package/dist/resources/transform-job.js +90 -0
  260. package/dist/resources/transform-python.d.ts +52 -0
  261. package/dist/resources/transform-python.js +56 -0
  262. package/dist/resources/transform-tag.d.ts +35 -0
  263. package/dist/resources/transform-tag.js +47 -0
  264. package/dist/resources/transform-test.d.ts +2 -0
  265. package/dist/resources/transform-test.js +75 -0
  266. package/dist/resources/transform.d.ts +2 -0
  267. package/dist/resources/transform.js +217 -0
  268. package/dist/resources/upload.d.ts +2 -0
  269. package/dist/resources/upload.js +48 -0
  270. package/dist/resources/user.d.ts +8 -0
  271. package/dist/resources/user.js +11 -0
  272. package/dist/revision-CQBPhohA.d.ts +104 -0
  273. package/dist/search-BxJipLN6.d.ts +26 -0
  274. package/dist/search-NZR6iRBs.d.ts +92 -0
  275. package/dist/segment-D2i34X9l.d.ts +16 -0
  276. package/dist/segment-pj3wklGe.d.ts +47 -0
  277. package/dist/session-properties-COtlxAcK.d.ts +15 -0
  278. package/dist/setting-DXuQGXGF.d.ts +25 -0
  279. package/dist/setup-Ez_U7GmM.d.ts +26 -0
  280. package/dist/signal.d.ts +8 -0
  281. package/dist/signal.js +25 -0
  282. package/dist/snippet-RnnWa4TL.d.ts +16 -0
  283. package/dist/snippet-hEV429Pv.d.ts +41 -0
  284. package/dist/table-B3-UaPHa.d.ts +3229 -0
  285. package/dist/table-B_lfuaHc.d.ts +176 -0
  286. package/dist/tag-qzjGGci8.d.ts +48 -0
  287. package/dist/timeline-C2IEcRlP.d.ts +21 -0
  288. package/dist/timeline-folD3mQ_.d.ts +218 -0
  289. package/dist/transform-CDurgE1D.d.ts +443 -0
  290. package/dist/transform-CXOT5kFe.d.ts +638 -0
  291. package/dist/transform-dag-run-BgZwv1yx.d.ts +49 -0
  292. package/dist/transform-inspector-BUYBt6--.d.ts +374 -0
  293. package/dist/transform-job-29P6BULe.d.ts +237 -0
  294. package/dist/transform-job-CTJImaOd.d.ts +96 -0
  295. package/dist/transform-python-DdDnW6yK.d.ts +56 -0
  296. package/dist/transform-tag-DVUIZTEM.d.ts +25 -0
  297. package/dist/transform-test-A-CJYT6B.d.ts +412 -0
  298. package/dist/transform-test-BwuyrHpT.d.ts +346 -0
  299. package/dist/transport-E0ZaPNWJ.d.ts +462 -0
  300. package/dist/transport-HP7cyo9N.js +397 -0
  301. package/dist/upload-B7PG3ePk.d.ts +12 -0
  302. package/dist/upload-UPfZFdbH.d.ts +22 -0
  303. package/dist/url-CI0pxHOc.d.ts +7 -0
  304. package/dist/url.d.ts +2 -0
  305. package/dist/url.js +34 -0
  306. package/dist/user-2r0OBoO6.d.ts +18 -0
  307. package/dist/version/capability-error.d.ts +2 -0
  308. package/dist/version/capability-error.js +42 -0
  309. package/dist/version/features.d.ts +2 -0
  310. package/dist/version/features.js +143 -0
  311. package/dist/version/known-range.d.ts +2 -0
  312. package/dist/version/known-range.js +7 -0
  313. package/dist/version/probe.d.ts +2 -0
  314. package/dist/version/probe.js +30 -0
  315. package/dist/version/profile.d.ts +2 -0
  316. package/dist/version/profile.js +64 -0
  317. package/dist/version/requirement-check.d.ts +2 -0
  318. package/dist/version/requirement-check.js +62 -0
  319. package/dist/version/requirements.d.ts +2 -0
  320. package/dist/version/requirements.js +219 -0
  321. package/dist/version/tag.d.ts +2 -0
  322. package/dist/version/tag.js +52 -0
  323. package/package.json +65 -4
@@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ //#region src/domain/moderation-review.d.ts
3
+ declare const ModeratedItemType: z.ZodEnum<{
4
+ card: "card";
5
+ dashboard: "dashboard";
6
+ }>;
7
+ type ModeratedItemType = z.infer<typeof ModeratedItemType>;
8
+ declare const ModerationStatus: z.ZodEnum<{
9
+ verified: "verified";
10
+ }>;
11
+ type ModerationStatus = z.infer<typeof ModerationStatus>;
12
+ declare const ModerationReview: z.ZodObject<{
13
+ id: z.ZodNumber;
14
+ moderated_item_id: z.ZodNumber;
15
+ moderated_item_type: z.ZodEnum<{
16
+ card: "card";
17
+ dashboard: "dashboard";
18
+ }>;
19
+ moderator_id: z.ZodNumber;
20
+ status: z.ZodNullable<z.ZodEnum<{
21
+ verified: "verified";
22
+ }>>;
23
+ text: z.ZodNullable<z.ZodString>;
24
+ most_recent: z.ZodBoolean;
25
+ created_at: z.ZodString;
26
+ updated_at: z.ZodString;
27
+ }, z.core.$loose>;
28
+ type ModerationReview = z.infer<typeof ModerationReview>;
29
+ declare const ModerationReviewCompact: z.ZodObject<{
30
+ id: z.ZodNumber;
31
+ text: z.ZodNullable<z.ZodString>;
32
+ status: z.ZodNullable<z.ZodEnum<{
33
+ verified: "verified";
34
+ }>>;
35
+ moderated_item_type: z.ZodEnum<{
36
+ card: "card";
37
+ dashboard: "dashboard";
38
+ }>;
39
+ moderated_item_id: z.ZodNumber;
40
+ most_recent: z.ZodBoolean;
41
+ }, z.core.$strip>;
42
+ type ModerationReviewCompact = z.infer<typeof ModerationReviewCompact>;
43
+ declare const ModerationReviewCreateInput: z.ZodObject<{
44
+ moderated_item_id: z.ZodNumber;
45
+ moderated_item_type: z.ZodEnum<{
46
+ card: "card";
47
+ dashboard: "dashboard";
48
+ }>;
49
+ status: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
50
+ verified: "verified";
51
+ }>>>;
52
+ text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ }, z.core.$strict>;
54
+ type ModerationReviewCreateInput = z.infer<typeof ModerationReviewCreateInput>;
55
+ //#endregion
56
+ export { ModerationStatus as a, ModerationReviewCreateInput as i, ModerationReview as n, ModerationReviewCompact as r, ModeratedItemType as t };
@@ -0,0 +1,62 @@
1
+ import { NetworkError, errorMessage } from "./errors.js";
2
+ //#region src/http/network-error.ts
3
+ const NETWORK_HINTS = {
4
+ ECONNREFUSED: (t) => `Connection refused by ${t.host} — is Metabase running and is the port correct?`,
5
+ ENOTFOUND: (t) => `Host not found: ${t.hostname} — check the URL.`,
6
+ EAI_AGAIN: (t) => `Could not resolve ${t.hostname} — check your network connection and the URL.`,
7
+ ECONNRESET: (t) => `Connection to ${t.host} was reset — the server may have closed it, or http/https may be mismatched.`,
8
+ UND_ERR_SOCKET: (t) => `Connection to ${t.host} was closed by the other side — a pooled connection or a proxy may have dropped it.`,
9
+ EPIPE: (t) => `Connection to ${t.host} closed while the request was still being written — the server or a proxy dropped it.`,
10
+ ETIMEDOUT: (t) => `Connection to ${t.host} timed out — check the host, port, and your network.`
11
+ };
12
+ const CONNECTION_CLOSED_CODES = /* @__PURE__ */ new Set([
13
+ "ECONNRESET",
14
+ "UND_ERR_SOCKET",
15
+ "EPIPE"
16
+ ]);
17
+ const TLS_ERROR_CODES = /* @__PURE__ */ new Set([
18
+ "EPROTO",
19
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
20
+ "SELF_SIGNED_CERT_IN_CHAIN",
21
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
22
+ "CERT_HAS_EXPIRED",
23
+ "ERR_TLS_CERT_ALTNAME_INVALID"
24
+ ]);
25
+ function buildNetworkError(error, method, url) {
26
+ const fallback = errorMessage(error);
27
+ const code = failureCode(error);
28
+ return new NetworkError(networkMessage(code, networkTarget(url), fallback), {
29
+ method,
30
+ url,
31
+ cause: code ?? fallback
32
+ });
33
+ }
34
+ function isConnectionClosed(error) {
35
+ const code = failureCode(error);
36
+ return code !== null && CONNECTION_CLOSED_CODES.has(code);
37
+ }
38
+ function networkMessage(code, target, fallback) {
39
+ if (code === null) return `Could not reach Metabase: ${fallback}`;
40
+ if (TLS_ERROR_CODES.has(code)) return `Could not reach Metabase: TLS error contacting ${target.host} (${code}) — the certificate could not be verified, or https:// was used against a plain-HTTP server. For a certificate the OS does not trust either, set NODE_EXTRA_CA_CERTS to its CA bundle.`;
41
+ const hint = NETWORK_HINTS[code];
42
+ if (hint === void 0) return `Could not reach Metabase: ${fallback} (${code})`;
43
+ return `Could not reach Metabase: ${hint(target)}`;
44
+ }
45
+ function failureCode(error) {
46
+ const own = errorCode(error);
47
+ if (own !== null) return own;
48
+ return errorCode(error instanceof Error ? error.cause : void 0);
49
+ }
50
+ function errorCode(value) {
51
+ if (value instanceof Error && "code" in value && typeof value.code === "string") return value.code;
52
+ return null;
53
+ }
54
+ function networkTarget(url) {
55
+ const parsed = new URL(url);
56
+ return {
57
+ host: parsed.host,
58
+ hostname: parsed.hostname
59
+ };
60
+ }
61
+ //#endregion
62
+ export { isConnectionClosed as n, buildNetworkError as t };
@@ -0,0 +1,379 @@
1
+ import { z } from "zod";
2
+ //#region src/domain/notification.d.ts
3
+ declare const NotificationPayloadType: z.ZodEnum<{
4
+ "notification/card": "notification/card";
5
+ "notification/dashboard": "notification/dashboard";
6
+ "notification/system-event": "notification/system-event";
7
+ "notification/testing": "notification/testing";
8
+ }>;
9
+ type NotificationPayloadType = z.infer<typeof NotificationPayloadType>;
10
+ declare const CARD_PAYLOAD_TYPE: NotificationPayloadType;
11
+ declare const NotificationSendCondition: z.ZodEnum<{
12
+ has_result: "has_result";
13
+ goal_above: "goal_above";
14
+ goal_below: "goal_below";
15
+ }>;
16
+ type NotificationSendCondition = z.infer<typeof NotificationSendCondition>;
17
+ declare const NotificationChannelType: z.ZodEnum<{
18
+ "channel/email": "channel/email";
19
+ "channel/slack": "channel/slack";
20
+ "channel/http": "channel/http";
21
+ }>;
22
+ type NotificationChannelType = z.infer<typeof NotificationChannelType>;
23
+ declare const NotificationRecipientType: z.ZodEnum<{
24
+ "notification-recipient/user": "notification-recipient/user";
25
+ "notification-recipient/group": "notification-recipient/group";
26
+ "notification-recipient/raw-value": "notification-recipient/raw-value";
27
+ "notification-recipient/template": "notification-recipient/template";
28
+ }>;
29
+ type NotificationRecipientType = z.infer<typeof NotificationRecipientType>;
30
+ declare const NotificationSubscriptionType: z.ZodEnum<{
31
+ "notification-subscription/cron": "notification-subscription/cron";
32
+ "notification-subscription/system-event": "notification-subscription/system-event";
33
+ }>;
34
+ type NotificationSubscriptionType = z.infer<typeof NotificationSubscriptionType>;
35
+ declare const NotificationRecipientDetails: z.ZodObject<{
36
+ value: z.ZodOptional<z.ZodString>;
37
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
+ }, z.core.$loose>;
39
+ type NotificationRecipientDetails = z.infer<typeof NotificationRecipientDetails>;
40
+ declare const NotificationRecipient: z.ZodObject<{
41
+ id: z.ZodOptional<z.ZodNumber>;
42
+ type: z.ZodEnum<{
43
+ "notification-recipient/user": "notification-recipient/user";
44
+ "notification-recipient/group": "notification-recipient/group";
45
+ "notification-recipient/raw-value": "notification-recipient/raw-value";
46
+ "notification-recipient/template": "notification-recipient/template";
47
+ }>;
48
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
49
+ permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
50
+ details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
51
+ value: z.ZodOptional<z.ZodString>;
52
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ }, z.core.$loose>>>;
54
+ }, z.core.$loose>;
55
+ type NotificationRecipient = z.infer<typeof NotificationRecipient>;
56
+ declare const NotificationRecipientCompact: z.ZodObject<{
57
+ type: z.ZodEnum<{
58
+ "notification-recipient/user": "notification-recipient/user";
59
+ "notification-recipient/group": "notification-recipient/group";
60
+ "notification-recipient/raw-value": "notification-recipient/raw-value";
61
+ "notification-recipient/template": "notification-recipient/template";
62
+ }>;
63
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
64
+ permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
65
+ details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
66
+ value: z.ZodOptional<z.ZodString>;
67
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
+ }, z.core.$strip>>>;
69
+ }, z.core.$strip>;
70
+ type NotificationRecipientCompact = z.infer<typeof NotificationRecipientCompact>;
71
+ declare const NotificationHandler: z.ZodObject<{
72
+ id: z.ZodOptional<z.ZodNumber>;
73
+ channel_type: z.ZodEnum<{
74
+ "channel/email": "channel/email";
75
+ "channel/slack": "channel/slack";
76
+ "channel/http": "channel/http";
77
+ }>;
78
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
79
+ template_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
80
+ active: z.ZodOptional<z.ZodBoolean>;
81
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
82
+ id: z.ZodOptional<z.ZodNumber>;
83
+ type: z.ZodEnum<{
84
+ "notification-recipient/user": "notification-recipient/user";
85
+ "notification-recipient/group": "notification-recipient/group";
86
+ "notification-recipient/raw-value": "notification-recipient/raw-value";
87
+ "notification-recipient/template": "notification-recipient/template";
88
+ }>;
89
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
90
+ permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
91
+ details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
92
+ value: z.ZodOptional<z.ZodString>;
93
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
+ }, z.core.$loose>>>;
95
+ }, z.core.$loose>>>;
96
+ }, z.core.$loose>;
97
+ type NotificationHandler = z.infer<typeof NotificationHandler>;
98
+ declare const NotificationHandlerCompact: z.ZodObject<{
99
+ channel_type: z.ZodEnum<{
100
+ "channel/email": "channel/email";
101
+ "channel/slack": "channel/slack";
102
+ "channel/http": "channel/http";
103
+ }>;
104
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
105
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
106
+ type: z.ZodEnum<{
107
+ "notification-recipient/user": "notification-recipient/user";
108
+ "notification-recipient/group": "notification-recipient/group";
109
+ "notification-recipient/raw-value": "notification-recipient/raw-value";
110
+ "notification-recipient/template": "notification-recipient/template";
111
+ }>;
112
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
113
+ permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
114
+ details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
115
+ value: z.ZodOptional<z.ZodString>;
116
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
117
+ }, z.core.$strip>>>;
118
+ }, z.core.$strip>>>;
119
+ }, z.core.$strip>;
120
+ type NotificationHandlerCompact = z.infer<typeof NotificationHandlerCompact>;
121
+ declare const NotificationSubscription: z.ZodObject<{
122
+ id: z.ZodOptional<z.ZodNumber>;
123
+ type: z.ZodEnum<{
124
+ "notification-subscription/cron": "notification-subscription/cron";
125
+ "notification-subscription/system-event": "notification-subscription/system-event";
126
+ }>;
127
+ cron_schedule: z.ZodOptional<z.ZodNullable<z.ZodString>>;
128
+ event_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
129
+ ui_display_type: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
130
+ "cron/raw": "cron/raw";
131
+ "cron/builder": "cron/builder";
132
+ }>>>;
133
+ }, z.core.$loose>;
134
+ type NotificationSubscription = z.infer<typeof NotificationSubscription>;
135
+ declare const NotificationSubscriptionCompact: z.ZodObject<{
136
+ type: z.ZodEnum<{
137
+ "notification-subscription/cron": "notification-subscription/cron";
138
+ "notification-subscription/system-event": "notification-subscription/system-event";
139
+ }>;
140
+ cron_schedule: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
+ }, z.core.$strip>;
142
+ type NotificationSubscriptionCompact = z.infer<typeof NotificationSubscriptionCompact>;
143
+ declare const NotificationCardPayload: z.ZodObject<{
144
+ id: z.ZodOptional<z.ZodNumber>;
145
+ card_id: z.ZodNumber;
146
+ send_condition: z.ZodEnum<{
147
+ has_result: "has_result";
148
+ goal_above: "goal_above";
149
+ goal_below: "goal_below";
150
+ }>;
151
+ send_once: z.ZodBoolean;
152
+ }, z.core.$loose>;
153
+ type NotificationCardPayload = z.infer<typeof NotificationCardPayload>;
154
+ declare const NotificationCardPayloadCompact: z.ZodObject<{
155
+ card_id: z.ZodNumber;
156
+ send_condition: z.ZodEnum<{
157
+ has_result: "has_result";
158
+ goal_above: "goal_above";
159
+ goal_below: "goal_below";
160
+ }>;
161
+ send_once: z.ZodBoolean;
162
+ }, z.core.$strip>;
163
+ type NotificationCardPayloadCompact = z.infer<typeof NotificationCardPayloadCompact>;
164
+ declare const Notification: z.ZodObject<{
165
+ id: z.ZodNumber;
166
+ payload_type: z.ZodEnum<{
167
+ "notification/card": "notification/card";
168
+ "notification/dashboard": "notification/dashboard";
169
+ "notification/system-event": "notification/system-event";
170
+ "notification/testing": "notification/testing";
171
+ }>;
172
+ payload_id: z.ZodNullable<z.ZodNumber>;
173
+ payload: z.ZodNullable<z.ZodObject<{
174
+ id: z.ZodOptional<z.ZodNumber>;
175
+ card_id: z.ZodNumber;
176
+ send_condition: z.ZodEnum<{
177
+ has_result: "has_result";
178
+ goal_above: "goal_above";
179
+ goal_below: "goal_below";
180
+ }>;
181
+ send_once: z.ZodBoolean;
182
+ }, z.core.$loose>>;
183
+ active: z.ZodBoolean;
184
+ creator_id: z.ZodNullable<z.ZodNumber>;
185
+ subscriptions: z.ZodArray<z.ZodObject<{
186
+ id: z.ZodOptional<z.ZodNumber>;
187
+ type: z.ZodEnum<{
188
+ "notification-subscription/cron": "notification-subscription/cron";
189
+ "notification-subscription/system-event": "notification-subscription/system-event";
190
+ }>;
191
+ cron_schedule: z.ZodOptional<z.ZodNullable<z.ZodString>>;
192
+ event_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
193
+ ui_display_type: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
194
+ "cron/raw": "cron/raw";
195
+ "cron/builder": "cron/builder";
196
+ }>>>;
197
+ }, z.core.$loose>>;
198
+ handlers: z.ZodArray<z.ZodObject<{
199
+ id: z.ZodOptional<z.ZodNumber>;
200
+ channel_type: z.ZodEnum<{
201
+ "channel/email": "channel/email";
202
+ "channel/slack": "channel/slack";
203
+ "channel/http": "channel/http";
204
+ }>;
205
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
206
+ template_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
207
+ active: z.ZodOptional<z.ZodBoolean>;
208
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
209
+ id: z.ZodOptional<z.ZodNumber>;
210
+ type: z.ZodEnum<{
211
+ "notification-recipient/user": "notification-recipient/user";
212
+ "notification-recipient/group": "notification-recipient/group";
213
+ "notification-recipient/raw-value": "notification-recipient/raw-value";
214
+ "notification-recipient/template": "notification-recipient/template";
215
+ }>;
216
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
217
+ permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
218
+ details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
219
+ value: z.ZodOptional<z.ZodString>;
220
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
221
+ }, z.core.$loose>>>;
222
+ }, z.core.$loose>>>;
223
+ }, z.core.$loose>>;
224
+ }, z.core.$loose>;
225
+ type Notification = z.infer<typeof Notification>;
226
+ declare const NotificationCompact: z.ZodObject<{
227
+ id: z.ZodNumber;
228
+ creator_id: z.ZodNullable<z.ZodNumber>;
229
+ active: z.ZodBoolean;
230
+ payload_type: z.ZodEnum<{
231
+ "notification/card": "notification/card";
232
+ "notification/dashboard": "notification/dashboard";
233
+ "notification/system-event": "notification/system-event";
234
+ "notification/testing": "notification/testing";
235
+ }>;
236
+ payload: z.ZodNullable<z.ZodObject<{
237
+ card_id: z.ZodNumber;
238
+ send_condition: z.ZodEnum<{
239
+ has_result: "has_result";
240
+ goal_above: "goal_above";
241
+ goal_below: "goal_below";
242
+ }>;
243
+ send_once: z.ZodBoolean;
244
+ }, z.core.$strip>>;
245
+ subscriptions: z.ZodArray<z.ZodObject<{
246
+ type: z.ZodEnum<{
247
+ "notification-subscription/cron": "notification-subscription/cron";
248
+ "notification-subscription/system-event": "notification-subscription/system-event";
249
+ }>;
250
+ cron_schedule: z.ZodOptional<z.ZodNullable<z.ZodString>>;
251
+ }, z.core.$strip>>;
252
+ handlers: z.ZodArray<z.ZodObject<{
253
+ channel_type: z.ZodEnum<{
254
+ "channel/email": "channel/email";
255
+ "channel/slack": "channel/slack";
256
+ "channel/http": "channel/http";
257
+ }>;
258
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
259
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
260
+ type: z.ZodEnum<{
261
+ "notification-recipient/user": "notification-recipient/user";
262
+ "notification-recipient/group": "notification-recipient/group";
263
+ "notification-recipient/raw-value": "notification-recipient/raw-value";
264
+ "notification-recipient/template": "notification-recipient/template";
265
+ }>;
266
+ user_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
267
+ permissions_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
268
+ details: z.ZodOptional<z.ZodNullable<z.ZodObject<{
269
+ value: z.ZodOptional<z.ZodString>;
270
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
271
+ }, z.core.$strip>>>;
272
+ }, z.core.$strip>>>;
273
+ }, z.core.$strip>>;
274
+ }, z.core.$strip>;
275
+ type NotificationCompact = z.infer<typeof NotificationCompact>;
276
+ declare const NotificationCreateInput: z.ZodObject<{
277
+ payload_type: z.ZodDefault<z.ZodEnum<{
278
+ "notification/card": "notification/card";
279
+ "notification/dashboard": "notification/dashboard";
280
+ "notification/system-event": "notification/system-event";
281
+ "notification/testing": "notification/testing";
282
+ }>>;
283
+ payload: z.ZodObject<{
284
+ card_id: z.ZodNumber;
285
+ send_condition: z.ZodOptional<z.ZodEnum<{
286
+ has_result: "has_result";
287
+ goal_above: "goal_above";
288
+ goal_below: "goal_below";
289
+ }>>;
290
+ send_once: z.ZodOptional<z.ZodBoolean>;
291
+ }, z.core.$loose>;
292
+ subscriptions: z.ZodArray<z.ZodObject<{
293
+ type: z.ZodDefault<z.ZodEnum<{
294
+ "notification-subscription/cron": "notification-subscription/cron";
295
+ "notification-subscription/system-event": "notification-subscription/system-event";
296
+ }>>;
297
+ cron_schedule: z.ZodString;
298
+ }, z.core.$loose>>;
299
+ handlers: z.ZodArray<z.ZodObject<{
300
+ channel_type: z.ZodEnum<{
301
+ "channel/email": "channel/email";
302
+ "channel/slack": "channel/slack";
303
+ "channel/http": "channel/http";
304
+ }>;
305
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
306
+ active: z.ZodOptional<z.ZodBoolean>;
307
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
308
+ type: z.ZodEnum<{
309
+ "notification-recipient/user": "notification-recipient/user";
310
+ "notification-recipient/group": "notification-recipient/group";
311
+ "notification-recipient/raw-value": "notification-recipient/raw-value";
312
+ "notification-recipient/template": "notification-recipient/template";
313
+ }>;
314
+ user_id: z.ZodOptional<z.ZodNumber>;
315
+ permissions_group_id: z.ZodOptional<z.ZodNumber>;
316
+ details: z.ZodOptional<z.ZodObject<{
317
+ value: z.ZodOptional<z.ZodString>;
318
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
319
+ }, z.core.$loose>>;
320
+ }, z.core.$loose>>>;
321
+ }, z.core.$loose>>;
322
+ active: z.ZodOptional<z.ZodBoolean>;
323
+ }, z.core.$loose>;
324
+ type NotificationCreateInput = z.infer<typeof NotificationCreateInput>;
325
+ declare const NotificationCardPayloadPatch: z.ZodObject<{
326
+ card_id: z.ZodOptional<z.ZodNumber>;
327
+ send_condition: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
328
+ has_result: "has_result";
329
+ goal_above: "goal_above";
330
+ goal_below: "goal_below";
331
+ }>>>;
332
+ send_once: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
333
+ }, z.core.$loose>;
334
+ type NotificationCardPayloadPatch = z.infer<typeof NotificationCardPayloadPatch>;
335
+ declare const NotificationUpdateInput: z.ZodObject<{
336
+ payload: z.ZodOptional<z.ZodObject<{
337
+ card_id: z.ZodOptional<z.ZodNumber>;
338
+ send_condition: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
339
+ has_result: "has_result";
340
+ goal_above: "goal_above";
341
+ goal_below: "goal_below";
342
+ }>>>;
343
+ send_once: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
344
+ }, z.core.$loose>>;
345
+ subscriptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
346
+ type: z.ZodDefault<z.ZodEnum<{
347
+ "notification-subscription/cron": "notification-subscription/cron";
348
+ "notification-subscription/system-event": "notification-subscription/system-event";
349
+ }>>;
350
+ cron_schedule: z.ZodString;
351
+ }, z.core.$loose>>>;
352
+ handlers: z.ZodOptional<z.ZodArray<z.ZodObject<{
353
+ channel_type: z.ZodEnum<{
354
+ "channel/email": "channel/email";
355
+ "channel/slack": "channel/slack";
356
+ "channel/http": "channel/http";
357
+ }>;
358
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
359
+ active: z.ZodOptional<z.ZodBoolean>;
360
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
361
+ type: z.ZodEnum<{
362
+ "notification-recipient/user": "notification-recipient/user";
363
+ "notification-recipient/group": "notification-recipient/group";
364
+ "notification-recipient/raw-value": "notification-recipient/raw-value";
365
+ "notification-recipient/template": "notification-recipient/template";
366
+ }>;
367
+ user_id: z.ZodOptional<z.ZodNumber>;
368
+ permissions_group_id: z.ZodOptional<z.ZodNumber>;
369
+ details: z.ZodOptional<z.ZodObject<{
370
+ value: z.ZodOptional<z.ZodString>;
371
+ channel_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
372
+ }, z.core.$loose>>;
373
+ }, z.core.$loose>>>;
374
+ }, z.core.$loose>>>;
375
+ active: z.ZodOptional<z.ZodBoolean>;
376
+ }, z.core.$loose>;
377
+ type NotificationUpdateInput = z.infer<typeof NotificationUpdateInput>;
378
+ //#endregion
379
+ export { NotificationSubscription as _, NotificationCardPayloadPatch as a, NotificationUpdateInput as b, NotificationCreateInput as c, NotificationPayloadType as d, NotificationRecipient as f, NotificationSendCondition as g, NotificationRecipientType as h, NotificationCardPayloadCompact as i, NotificationHandler as l, NotificationRecipientDetails as m, Notification as n, NotificationChannelType as o, NotificationRecipientCompact as p, NotificationCardPayload as r, NotificationCompact as s, CARD_PAYLOAD_TYPE as t, NotificationHandlerCompact as u, NotificationSubscriptionCompact as v, NotificationSubscriptionType as y };
@@ -0,0 +1,22 @@
1
+ import { f as RequestOptions, h as Transport } from "./transport-E0ZaPNWJ.js";
2
+ import { t as ListResult } from "./list-BT_bBm9Z.js";
3
+ import { b as NotificationUpdateInput, c as NotificationCreateInput, n as Notification } from "./notification-BT2TDAd_.js";
4
+ //#region src/resources/notification.d.ts
5
+ interface NotificationListParams {
6
+ card_id?: number | undefined;
7
+ creator_id?: number | undefined;
8
+ recipient_id?: number | undefined;
9
+ include_inactive?: boolean | undefined;
10
+ }
11
+ declare function assertCardAlert(notification: Notification): Notification;
12
+ declare function mergeAlertUpdate(current: Notification, patch: NotificationUpdateInput): Notification;
13
+ declare function notificationResource(transport: Transport): {
14
+ list: (params?: NotificationListParams, options?: RequestOptions) => Promise<ListResult<Notification>>;
15
+ get: (id: number, options?: RequestOptions) => Promise<Notification>;
16
+ create: (params: NotificationCreateInput, options?: RequestOptions) => Promise<Notification>;
17
+ update: (id: number, params: NotificationUpdateInput, options?: RequestOptions) => Promise<Notification>;
18
+ archive: (id: number, options?: RequestOptions) => Promise<Notification>;
19
+ send: (id: number, options?: RequestOptions) => Promise<void>;
20
+ };
21
+ //#endregion
22
+ export { notificationResource as i, assertCardAlert as n, mergeAlertUpdate as r, NotificationListParams as t };
@@ -0,0 +1,59 @@
1
+ import { z } from "zod";
2
+ //#region src/http/oauth.d.ts
3
+ declare const OAUTH_SCOPE = "mb:full";
4
+ declare const OAuthServerMetadata: z.ZodObject<{
5
+ issuer: z.ZodString;
6
+ authorization_endpoint: z.ZodString;
7
+ token_endpoint: z.ZodString;
8
+ registration_endpoint: z.ZodOptional<z.ZodString>;
9
+ revocation_endpoint: z.ZodOptional<z.ZodString>;
10
+ scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
+ }, z.core.$loose>;
12
+ type OAuthServerMetadata = z.infer<typeof OAuthServerMetadata>;
13
+ declare const RegisteredClient: z.ZodObject<{
14
+ client_id: z.ZodString;
15
+ }, z.core.$loose>;
16
+ type RegisteredClient = z.infer<typeof RegisteredClient>;
17
+ declare const OAuthTokens: z.ZodObject<{
18
+ access_token: z.ZodString;
19
+ token_type: z.ZodString;
20
+ expires_in: z.ZodOptional<z.ZodNumber>;
21
+ refresh_token: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$loose>;
23
+ type OAuthTokens = z.infer<typeof OAuthTokens>;
24
+ interface ClientRegistration {
25
+ registrationEndpoint: string;
26
+ redirectUri: string;
27
+ clientName: string;
28
+ userAgent: string;
29
+ }
30
+ interface CodeExchange {
31
+ tokenEndpoint: string;
32
+ code: string;
33
+ redirectUri: string;
34
+ clientId: string;
35
+ codeVerifier: string;
36
+ userAgent: string;
37
+ }
38
+ interface TokenRefresh {
39
+ tokenEndpoint: string;
40
+ refreshToken: string;
41
+ clientId: string;
42
+ userAgent: string;
43
+ }
44
+ interface TokenRevocation {
45
+ revocationEndpoint: string;
46
+ token: string;
47
+ clientId: string;
48
+ userAgent: string;
49
+ }
50
+ declare const OAUTH_UNSUPPORTED_MESSAGE = "this Metabase does not support OAuth login (requires Metabase v63 or newer)";
51
+ declare function tryDiscoverMetadata(baseUrl: string, userAgent: string): Promise<OAuthServerMetadata | null>;
52
+ declare function discoverLoginMetadata(baseUrl: string, userAgent: string): Promise<OAuthServerMetadata>;
53
+ declare function discoverMetadata(baseUrl: string, userAgent: string): Promise<OAuthServerMetadata>;
54
+ declare function registerClient(input: ClientRegistration): Promise<RegisteredClient>;
55
+ declare function exchangeCode(input: CodeExchange): Promise<OAuthTokens>;
56
+ declare function refreshTokens(input: TokenRefresh): Promise<OAuthTokens>;
57
+ declare function revokeToken(input: TokenRevocation): Promise<void>;
58
+ //#endregion
59
+ export { OAuthServerMetadata as a, TokenRefresh as c, discoverMetadata as d, exchangeCode as f, tryDiscoverMetadata as g, revokeToken as h, OAUTH_UNSUPPORTED_MESSAGE as i, TokenRevocation as l, registerClient as m, CodeExchange as n, OAuthTokens as o, refreshTokens as p, OAUTH_SCOPE as r, RegisteredClient as s, ClientRegistration as t, discoverLoginMetadata as u };
@@ -0,0 +1,19 @@
1
+ import { a as OAuthServerMetadata } from "./oauth-C4ordeoJ.js";
2
+ import { c as OAuthCredential } from "./credential-6aOEGqMH.js";
3
+ //#region src/auth/oauth-login.d.ts
4
+ interface OAuthLoginInput {
5
+ baseUrl: string;
6
+ userAgent: string;
7
+ clientName: string;
8
+ metadata?: OAuthServerMetadata;
9
+ clientId?: string;
10
+ timeoutMs?: number;
11
+ }
12
+ interface OAuthLoginDeps {
13
+ openBrowser: (url: string) => Promise<boolean>;
14
+ onAuthorizeUrl: (url: string, opened: boolean) => void;
15
+ now: () => number;
16
+ }
17
+ declare function oauthLogin(input: OAuthLoginInput, deps: OAuthLoginDeps): Promise<OAuthCredential>;
18
+ //#endregion
19
+ export { OAuthLoginInput as n, oauthLogin as r, OAuthLoginDeps as t };