@metabase/client 0.0.0-stage → 0.1.1

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 (337) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE +661 -0
  3. package/README.md +490 -2
  4. package/dist/api-key-DJeN1-7G.d.ts +46 -0
  5. package/dist/auth/credential.d.ts +2 -0
  6. package/dist/auth/credential.js +61 -0
  7. package/dist/auth/oauth-login.d.ts +2 -0
  8. package/dist/auth/oauth-login.js +2 -0
  9. package/dist/auth/oauth-session.d.ts +2 -0
  10. package/dist/auth/oauth-session.js +31 -0
  11. package/dist/card-BxBzr5Uj.d.ts +1392 -0
  12. package/dist/card-DN0sLkCG.d.ts +33 -0
  13. package/dist/client-DdXLlH1B.d.ts +3380 -0
  14. package/dist/client.d.ts +2 -0
  15. package/dist/client.js +99 -0
  16. package/dist/collection-DGnTvD6R.d.ts +294 -0
  17. package/dist/collection-fFahL-ub.d.ts +53 -0
  18. package/dist/content-translation-zfUkE_OG.d.ts +8 -0
  19. package/dist/credential-6aOEGqMH.d.ts +30 -0
  20. package/dist/cron-DThzerR6.d.ts +9 -0
  21. package/dist/csv-upload--K35QedP.d.ts +8 -0
  22. package/dist/dashboard-CM7RmNeE.d.ts +38 -0
  23. package/dist/dashboard-DtLXVgtf.d.ts +978 -0
  24. package/dist/data-action-CkXVrOUH.d.ts +97 -0
  25. package/dist/data-app-CqP5_fpB.d.ts +76 -0
  26. package/dist/database-B0JNZjDN.d.ts +27 -0
  27. package/dist/database-BxqDmfcj.d.ts +997 -0
  28. package/dist/dataset-BBNGPVec.d.ts +4144 -0
  29. package/dist/dataset-BUirJ1rO.d.ts +23 -0
  30. package/dist/dependency-CzpXmeu7.d.ts +299 -0
  31. package/dist/dependency-arB8Cr2H.d.ts +879 -0
  32. package/dist/document-tLd6pYWe.d.ts +115 -0
  33. package/dist/domain/api-key.d.ts +2 -0
  34. package/dist/domain/api-key.js +31 -0
  35. package/dist/domain/card.d.ts +2 -0
  36. package/dist/domain/card.js +140 -0
  37. package/dist/domain/collection.d.ts +2 -0
  38. package/dist/domain/collection.js +137 -0
  39. package/dist/domain/content-translation.d.ts +2 -0
  40. package/dist/domain/content-translation.js +5 -0
  41. package/dist/domain/cron.d.ts +2 -0
  42. package/dist/domain/cron.js +5 -0
  43. package/dist/domain/dashboard.d.ts +2 -0
  44. package/dist/domain/dashboard.js +211 -0
  45. package/dist/domain/data-action.d.ts +2 -0
  46. package/dist/domain/data-action.js +91 -0
  47. package/dist/domain/data-app.d.ts +2 -0
  48. package/dist/domain/data-app.js +52 -0
  49. package/dist/domain/database.d.ts +2 -0
  50. package/dist/domain/database.js +56 -0
  51. package/dist/domain/dataset.d.ts +2 -0
  52. package/dist/domain/dataset.js +56 -0
  53. package/dist/domain/dependency.d.ts +2 -0
  54. package/dist/domain/dependency.js +168 -0
  55. package/dist/domain/document.d.ts +2 -0
  56. package/dist/domain/document.js +94 -0
  57. package/dist/domain/eid-translation.d.ts +2 -0
  58. package/dist/domain/eid-translation.js +36 -0
  59. package/dist/domain/embedding.d.ts +2 -0
  60. package/dist/domain/embedding.js +9 -0
  61. package/dist/domain/erd.d.ts +2 -0
  62. package/dist/domain/erd.js +45 -0
  63. package/dist/domain/field.d.ts +2 -0
  64. package/dist/domain/field.js +274 -0
  65. package/dist/domain/git-sync.d.ts +2 -0
  66. package/dist/domain/git-sync.js +147 -0
  67. package/dist/domain/glossary.d.ts +2 -0
  68. package/dist/domain/glossary.js +30 -0
  69. package/dist/domain/library.d.ts +2 -0
  70. package/dist/domain/library.js +89 -0
  71. package/dist/domain/measure.d.ts +2 -0
  72. package/dist/domain/measure.js +43 -0
  73. package/dist/domain/metric.d.ts +2 -0
  74. package/dist/domain/metric.js +139 -0
  75. package/dist/domain/moderation-review.d.ts +2 -0
  76. package/dist/domain/moderation-review.js +31 -0
  77. package/dist/domain/notification.d.ts +2 -0
  78. package/dist/domain/notification.js +143 -0
  79. package/dist/domain/parameter.d.ts +2 -0
  80. package/dist/domain/parameter.js +109 -0
  81. package/dist/domain/permission.d.ts +2 -0
  82. package/dist/domain/permission.js +36 -0
  83. package/dist/domain/pulse.d.ts +2 -0
  84. package/dist/domain/pulse.js +140 -0
  85. package/dist/domain/query.d.ts +2 -0
  86. package/dist/domain/query.js +13 -0
  87. package/dist/domain/replacement.d.ts +2 -0
  88. package/dist/domain/replacement.js +93 -0
  89. package/dist/domain/revision.d.ts +2 -0
  90. package/dist/domain/revision.js +90 -0
  91. package/dist/domain/search.d.ts +2 -0
  92. package/dist/domain/search.js +63 -0
  93. package/dist/domain/segment.d.ts +2 -0
  94. package/dist/domain/segment.js +46 -0
  95. package/dist/domain/session-properties.d.ts +2 -0
  96. package/dist/domain/session-properties.js +14 -0
  97. package/dist/domain/setting.d.ts +2 -0
  98. package/dist/domain/setting.js +22 -0
  99. package/dist/domain/setup.d.ts +2 -0
  100. package/dist/domain/setup.js +21 -0
  101. package/dist/domain/snippet.d.ts +2 -0
  102. package/dist/domain/snippet.js +38 -0
  103. package/dist/domain/table.d.ts +2 -0
  104. package/dist/domain/table.js +187 -0
  105. package/dist/domain/text.d.ts +5 -0
  106. package/dist/domain/text.js +6 -0
  107. package/dist/domain/timeline.d.ts +2 -0
  108. package/dist/domain/timeline.js +97 -0
  109. package/dist/domain/transform-dag-run.d.ts +2 -0
  110. package/dist/domain/transform-dag-run.js +19 -0
  111. package/dist/domain/transform-inspector.d.ts +2 -0
  112. package/dist/domain/transform-inspector.js +142 -0
  113. package/dist/domain/transform-job.d.ts +2 -0
  114. package/dist/domain/transform-job.js +115 -0
  115. package/dist/domain/transform-python.d.ts +2 -0
  116. package/dist/domain/transform-python.js +51 -0
  117. package/dist/domain/transform-tag.d.ts +2 -0
  118. package/dist/domain/transform-tag.js +17 -0
  119. package/dist/domain/transform-test.d.ts +2 -0
  120. package/dist/domain/transform-test.js +176 -0
  121. package/dist/domain/transform.d.ts +2 -0
  122. package/dist/domain/transform.js +304 -0
  123. package/dist/domain/upload.d.ts +2 -0
  124. package/dist/domain/upload.js +13 -0
  125. package/dist/domain/user.d.ts +2 -0
  126. package/dist/domain/user.js +16 -0
  127. package/dist/eid-translation-CH6NPWd-.d.ts +143 -0
  128. package/dist/embedding-oU3gqfgX.d.ts +10 -0
  129. package/dist/erd-BdeFEeSy.d.ts +842 -0
  130. package/dist/erd-CbV7xvAc.d.ts +51 -0
  131. package/dist/errors-DdMlaXqq.js +330 -0
  132. package/dist/errors.d.ts +2 -0
  133. package/dist/errors.js +189 -0
  134. package/dist/features-SMSfJhB6.d.ts +295 -0
  135. package/dist/field-D1Pfk-0S.d.ts +50 -0
  136. package/dist/field-p9Rme2zB.d.ts +2549 -0
  137. package/dist/git-sync-BTf1aYHr.d.ts +205 -0
  138. package/dist/git-sync-C99SVdJ9.d.ts +258 -0
  139. package/dist/glossary-CHK3elPj.d.ts +35 -0
  140. package/dist/glossary-DFvnz-E5.d.ts +15 -0
  141. package/dist/http/errors.d.ts +2 -0
  142. package/dist/http/errors.js +2 -0
  143. package/dist/http/oauth.d.ts +2 -0
  144. package/dist/http/oauth.js +201 -0
  145. package/dist/http/retry.d.ts +19 -0
  146. package/dist/http/retry.js +33 -0
  147. package/dist/http/transport.d.ts +2 -0
  148. package/dist/http/transport.js +2 -0
  149. package/dist/index.d.ts +62 -0
  150. package/dist/index.js +64 -0
  151. package/dist/input-gate-registry-Dai7SfXb.js +14 -0
  152. package/dist/input-gates-DwKoTJVQ.d.ts +28 -0
  153. package/dist/json-BksZpXDC.d.ts +19 -0
  154. package/dist/json-pointer.d.ts +5 -0
  155. package/dist/json-pointer.js +10 -0
  156. package/dist/json.d.ts +2 -0
  157. package/dist/json.js +44 -0
  158. package/dist/known-range-DTOBgTEC.d.ts +7 -0
  159. package/dist/library-B9pEq7qP.d.ts +230 -0
  160. package/dist/list-BT_bBm9Z.d.ts +7 -0
  161. package/dist/list.d.ts +2 -0
  162. package/dist/list.js +1 -0
  163. package/dist/measure-CgH14YQZ.d.ts +44 -0
  164. package/dist/measure-lPz8qnwz.d.ts +108 -0
  165. package/dist/metric-DcYloqOQ.d.ts +2655 -0
  166. package/dist/moderation-review-B4RUTZ6_.d.ts +56 -0
  167. package/dist/network-error-5g4U1iul.js +62 -0
  168. package/dist/notification-Cp5GJErS.d.ts +22 -0
  169. package/dist/notification-D1MThyKE.d.ts +443 -0
  170. package/dist/oauth-C4ordeoJ.d.ts +59 -0
  171. package/dist/oauth-login-CJsT_3EE.d.ts +19 -0
  172. package/dist/oauth-login-D734Jvbq.js +179 -0
  173. package/dist/oauth-session-BlIlcd8Q.d.ts +6 -0
  174. package/dist/paginate-COuL0Gzl.d.ts +24 -0
  175. package/dist/paginate.d.ts +2 -0
  176. package/dist/paginate.js +49 -0
  177. package/dist/parameter-ak-J-IOj.d.ts +190 -0
  178. package/dist/permission-BnCQw5Kp.d.ts +149 -0
  179. package/dist/poll-CIwnee7h.d.ts +15 -0
  180. package/dist/poll.d.ts +2 -0
  181. package/dist/poll.js +47 -0
  182. package/dist/predicates.d.ts +10 -0
  183. package/dist/predicates.js +18 -0
  184. package/dist/pulse-0LG3K6qO.d.ts +598 -0
  185. package/dist/pulse-BzKmz3Yn.d.ts +18 -0
  186. package/dist/query-Xsin530u.d.ts +23 -0
  187. package/dist/refusal-B9aeHMc9.js +130 -0
  188. package/dist/replacement-BGyggp-G.d.ts +2467 -0
  189. package/dist/replacement-CVebCuNp.d.ts +128 -0
  190. package/dist/requirement-check-glU7wqhQ.d.ts +17 -0
  191. package/dist/requirements-Dx_ZVzl7.d.ts +227 -0
  192. package/dist/resources/api-key.d.ts +11 -0
  193. package/dist/resources/api-key.js +35 -0
  194. package/dist/resources/card.d.ts +2 -0
  195. package/dist/resources/card.js +103 -0
  196. package/dist/resources/collection.d.ts +2 -0
  197. package/dist/resources/collection.js +134 -0
  198. package/dist/resources/content-translation.d.ts +11 -0
  199. package/dist/resources/content-translation.js +27 -0
  200. package/dist/resources/csv-upload.d.ts +2 -0
  201. package/dist/resources/csv-upload.js +9 -0
  202. package/dist/resources/dashboard.d.ts +2 -0
  203. package/dist/resources/dashboard.js +221 -0
  204. package/dist/resources/data-action.d.ts +60 -0
  205. package/dist/resources/data-action.js +79 -0
  206. package/dist/resources/data-app.d.ts +112 -0
  207. package/dist/resources/data-app.js +75 -0
  208. package/dist/resources/database.d.ts +2 -0
  209. package/dist/resources/database.js +103 -0
  210. package/dist/resources/dataset.d.ts +2 -0
  211. package/dist/resources/dataset.js +81 -0
  212. package/dist/resources/dependency.d.ts +2 -0
  213. package/dist/resources/dependency.js +156 -0
  214. package/dist/resources/document.d.ts +55 -0
  215. package/dist/resources/document.js +60 -0
  216. package/dist/resources/eid-translation.d.ts +8 -0
  217. package/dist/resources/eid-translation.js +19 -0
  218. package/dist/resources/erd.d.ts +2 -0
  219. package/dist/resources/erd.js +26 -0
  220. package/dist/resources/field.d.ts +2 -0
  221. package/dist/resources/field.js +99 -0
  222. package/dist/resources/git-sync.d.ts +2 -0
  223. package/dist/resources/git-sync.js +362 -0
  224. package/dist/resources/glossary.d.ts +2 -0
  225. package/dist/resources/glossary.js +51 -0
  226. package/dist/resources/library.d.ts +85 -0
  227. package/dist/resources/library.js +90 -0
  228. package/dist/resources/measure.d.ts +2 -0
  229. package/dist/resources/measure.js +57 -0
  230. package/dist/resources/metric.d.ts +2 -0
  231. package/dist/resources/metric.js +50 -0
  232. package/dist/resources/moderation-review.d.ts +23 -0
  233. package/dist/resources/moderation-review.js +24 -0
  234. package/dist/resources/notification.d.ts +2 -0
  235. package/dist/resources/notification.js +93 -0
  236. package/dist/resources/optional-parsed.d.ts +7 -0
  237. package/dist/resources/optional-parsed.js +14 -0
  238. package/dist/resources/permission.d.ts +10 -0
  239. package/dist/resources/permission.js +31 -0
  240. package/dist/resources/pivot-export.d.ts +10 -0
  241. package/dist/resources/pivot-export.js +16 -0
  242. package/dist/resources/pulse.d.ts +2 -0
  243. package/dist/resources/pulse.js +76 -0
  244. package/dist/resources/replacement.d.ts +2 -0
  245. package/dist/resources/replacement.js +82 -0
  246. package/dist/resources/request-body.d.ts +9 -0
  247. package/dist/resources/request-body.js +13 -0
  248. package/dist/resources/revision.d.ts +70 -0
  249. package/dist/resources/revision.js +46 -0
  250. package/dist/resources/search.d.ts +2 -0
  251. package/dist/resources/search.js +78 -0
  252. package/dist/resources/segment.d.ts +2 -0
  253. package/dist/resources/segment.js +55 -0
  254. package/dist/resources/setting.d.ts +11 -0
  255. package/dist/resources/setting.js +43 -0
  256. package/dist/resources/setup.d.ts +8 -0
  257. package/dist/resources/setup.js +18 -0
  258. package/dist/resources/snippet.d.ts +2 -0
  259. package/dist/resources/snippet.js +52 -0
  260. package/dist/resources/table.d.ts +2 -0
  261. package/dist/resources/table.js +274 -0
  262. package/dist/resources/timeline-event.d.ts +12 -0
  263. package/dist/resources/timeline-event.js +51 -0
  264. package/dist/resources/timeline.d.ts +2 -0
  265. package/dist/resources/timeline.js +82 -0
  266. package/dist/resources/transform-dag-run.d.ts +22 -0
  267. package/dist/resources/transform-dag-run.js +32 -0
  268. package/dist/resources/transform-inspector.d.ts +214 -0
  269. package/dist/resources/transform-inspector.js +47 -0
  270. package/dist/resources/transform-job.d.ts +2 -0
  271. package/dist/resources/transform-job.js +90 -0
  272. package/dist/resources/transform-python.d.ts +59 -0
  273. package/dist/resources/transform-python.js +57 -0
  274. package/dist/resources/transform-tag.d.ts +35 -0
  275. package/dist/resources/transform-tag.js +47 -0
  276. package/dist/resources/transform-test.d.ts +2 -0
  277. package/dist/resources/transform-test.js +75 -0
  278. package/dist/resources/transform.d.ts +2 -0
  279. package/dist/resources/transform.js +227 -0
  280. package/dist/resources/upload.d.ts +2 -0
  281. package/dist/resources/upload.js +48 -0
  282. package/dist/resources/user.d.ts +8 -0
  283. package/dist/resources/user.js +11 -0
  284. package/dist/revision-Dyl-8p7d.d.ts +106 -0
  285. package/dist/search-Cm5IxKss.d.ts +92 -0
  286. package/dist/search-Cten2h0I.d.ts +26 -0
  287. package/dist/segment-CbAgVO-5.d.ts +47 -0
  288. package/dist/segment-DQLX6r1E.d.ts +16 -0
  289. package/dist/session-properties-COtlxAcK.d.ts +15 -0
  290. package/dist/setting-DXuQGXGF.d.ts +25 -0
  291. package/dist/setup-JqcJ2unJ.d.ts +26 -0
  292. package/dist/signal.d.ts +8 -0
  293. package/dist/signal.js +25 -0
  294. package/dist/snippet-C_Ilx7tR.d.ts +41 -0
  295. package/dist/snippet-Djn0rL21.d.ts +16 -0
  296. package/dist/table-CDZbLNow.d.ts +176 -0
  297. package/dist/table-Od6uvDVW.d.ts +3234 -0
  298. package/dist/tag-qzjGGci8.d.ts +48 -0
  299. package/dist/timeline-BK45hy-h.d.ts +218 -0
  300. package/dist/timeline-BTs6fuRp.d.ts +21 -0
  301. package/dist/transform-C5thnJwW.d.ts +559 -0
  302. package/dist/transform-WASQAXeA.d.ts +652 -0
  303. package/dist/transform-dag-run-BgZwv1yx.d.ts +49 -0
  304. package/dist/transform-inspector-CMCh8WKV.d.ts +374 -0
  305. package/dist/transform-job-D8jTQtdX.d.ts +98 -0
  306. package/dist/transform-job-DmTwKxhc.d.ts +237 -0
  307. package/dist/transform-python-DtL3xxMj.d.ts +101 -0
  308. package/dist/transform-tag-C6j5EUkX.d.ts +25 -0
  309. package/dist/transform-test-CR_i54IV.d.ts +412 -0
  310. package/dist/transform-test-CeMzDpUC.d.ts +346 -0
  311. package/dist/transport-BsXqRujn.d.ts +476 -0
  312. package/dist/transport-HP7cyo9N.js +397 -0
  313. package/dist/upload-B5YjVkSW.d.ts +12 -0
  314. package/dist/upload-UPfZFdbH.d.ts +22 -0
  315. package/dist/url-CI0pxHOc.d.ts +7 -0
  316. package/dist/url.d.ts +2 -0
  317. package/dist/url.js +34 -0
  318. package/dist/user-Sqqv7rqh.d.ts +18 -0
  319. package/dist/version/capability-error.d.ts +2 -0
  320. package/dist/version/capability-error.js +42 -0
  321. package/dist/version/features.d.ts +2 -0
  322. package/dist/version/features.js +171 -0
  323. package/dist/version/input-gates.d.ts +2 -0
  324. package/dist/version/input-gates.js +13 -0
  325. package/dist/version/known-range.d.ts +2 -0
  326. package/dist/version/known-range.js +7 -0
  327. package/dist/version/probe.d.ts +2 -0
  328. package/dist/version/probe.js +30 -0
  329. package/dist/version/profile.d.ts +2 -0
  330. package/dist/version/profile.js +64 -0
  331. package/dist/version/requirement-check.d.ts +2 -0
  332. package/dist/version/requirement-check.js +62 -0
  333. package/dist/version/requirements.d.ts +2 -0
  334. package/dist/version/requirements.js +229 -0
  335. package/dist/version/tag.d.ts +2 -0
  336. package/dist/version/tag.js +52 -0
  337. package/package.json +66 -4
@@ -0,0 +1,57 @@
1
+ import { t as explainer } from "../refusal-B9aeHMc9.js";
2
+ import { PythonLibrary, PythonTestRunError, PythonTestRunOutput, pythonTestRunBody } from "../domain/transform-python.js";
3
+ import { z } from "zod";
4
+ //#region src/resources/transform-python.ts
5
+ const PythonApiTestRun = z.union([z.object({
6
+ logs: z.string(),
7
+ output: PythonTestRunOutput
8
+ }).transform(({ logs, output }) => ({
9
+ outcome: "succeeded",
10
+ logs,
11
+ output
12
+ })), z.object({
13
+ logs: z.string(),
14
+ error: PythonTestRunError
15
+ }).transform(({ logs, error }) => ({
16
+ outcome: "failed",
17
+ logs,
18
+ error
19
+ }))]);
20
+ function libraryPath(path) {
21
+ return `/api/ee/transforms-python/library/${encodeURIComponent(path)}`;
22
+ }
23
+ function transformPythonResource(transport) {
24
+ const { explain } = explainer(transport, "transformPython");
25
+ /** Get the Python library at a path, the user module every Python transform can import. */
26
+ async function getLibrary(path, options = {}) {
27
+ return transport.requestParsed(PythonLibrary, libraryPath(path), { ...options });
28
+ }
29
+ /** Replace the source of the Python library at a path, creating the library when none exists. */
30
+ async function updateLibrary(path, params, options = {}) {
31
+ return transport.requestParsed(PythonLibrary, libraryPath(path), {
32
+ ...options,
33
+ method: "PUT",
34
+ body: params
35
+ });
36
+ }
37
+ /**
38
+ * Evaluate an ad-hoc Python transform on a sample of its source tables, without a target table.
39
+ * Meant for early feedback on short runs: input, output and time limits apply, and the sample
40
+ * sizes are capped at 100 rows.
41
+ */
42
+ async function testRun(params, options = {}) {
43
+ const { features } = await transport.server(options);
44
+ return transport.requestParsed(PythonApiTestRun, "/api/ee/transforms-python/test-run", {
45
+ ...options,
46
+ method: "POST",
47
+ body: pythonTestRunBody(params, features)
48
+ });
49
+ }
50
+ return {
51
+ getLibrary: explain("getLibrary", getLibrary),
52
+ updateLibrary: explain("updateLibrary", updateLibrary),
53
+ testRun: explain("testRun", testRun)
54
+ };
55
+ }
56
+ //#endregion
57
+ export { transformPythonResource };
@@ -0,0 +1,35 @@
1
+ import { f as RequestOptions, h as Transport } from "../transport-BsXqRujn.js";
2
+ import { t as ListResult } from "../list-BT_bBm9Z.js";
3
+ //#region src/resources/transform-tag.d.ts
4
+ declare function transformTagResource(transport: Transport): {
5
+ list: (options?: RequestOptions | undefined) => Promise<ListResult<{
6
+ [x: string]: unknown;
7
+ id: number;
8
+ name: string;
9
+ entity_id: string | null;
10
+ built_in_type: string | null;
11
+ }>>;
12
+ create: (params: {
13
+ [x: string]: unknown;
14
+ name: string;
15
+ }, options?: RequestOptions | undefined) => Promise<{
16
+ [x: string]: unknown;
17
+ id: number;
18
+ name: string;
19
+ entity_id: string | null;
20
+ built_in_type: string | null;
21
+ }>;
22
+ update: (id: number, params: {
23
+ [x: string]: unknown;
24
+ name: string;
25
+ }, options?: RequestOptions | undefined) => Promise<{
26
+ [x: string]: unknown;
27
+ id: number;
28
+ name: string;
29
+ entity_id: string | null;
30
+ built_in_type: string | null;
31
+ }>;
32
+ delete: (id: number, options?: RequestOptions | undefined) => Promise<void>;
33
+ };
34
+ //#endregion
35
+ export { transformTagResource };
@@ -0,0 +1,47 @@
1
+ import { t as explainer } from "../refusal-B9aeHMc9.js";
2
+ import { TransformTag } from "../domain/transform-tag.js";
3
+ import { z } from "zod";
4
+ //#region src/resources/transform-tag.ts
5
+ const TransformTagApiList = z.array(TransformTag);
6
+ function transformTagResource(transport) {
7
+ const { explain } = explainer(transport, "transformTag");
8
+ /** List every transform tag the caller can see, built-in tags included. */
9
+ async function list(options = {}) {
10
+ return {
11
+ data: await transport.requestParsed(TransformTagApiList, "/api/transform-tag", { ...options }),
12
+ total: null
13
+ };
14
+ }
15
+ /** Create a transform tag, the label a transform job matches transforms on. */
16
+ async function create(params, options = {}) {
17
+ return transport.requestParsed(TransformTag, "/api/transform-tag", {
18
+ ...options,
19
+ method: "POST",
20
+ body: params
21
+ });
22
+ }
23
+ /** Rename a transform tag by id. */
24
+ async function update(id, params, options = {}) {
25
+ return transport.requestParsed(TransformTag, `/api/transform-tag/${id}`, {
26
+ ...options,
27
+ method: "PUT",
28
+ body: params
29
+ });
30
+ }
31
+ /** Delete a transform tag by id, detaching it from every transform and job carrying it. */
32
+ async function remove(id, options = {}) {
33
+ await transport.requestRaw(`/api/transform-tag/${id}`, {
34
+ ...options,
35
+ method: "DELETE",
36
+ expectContentType: "binary"
37
+ });
38
+ }
39
+ return {
40
+ list: explain("list", list),
41
+ create: explain("create", create),
42
+ update: explain("update", update),
43
+ delete: explain("delete", remove)
44
+ };
45
+ }
46
+ //#endregion
47
+ export { transformTagResource };
@@ -0,0 +1,2 @@
1
+ import { n as transformTestResource, t as TransformTestListParams } from "../transform-test-CR_i54IV.js";
2
+ export { TransformTestListParams, transformTestResource };
@@ -0,0 +1,75 @@
1
+ import { t as explainer } from "../refusal-B9aeHMc9.js";
2
+ import { TransformTest, TransformTestRunResult } from "../domain/transform-test.js";
3
+ import { z } from "zod";
4
+ //#region src/resources/transform-test.ts
5
+ const TransformTestApiList = z.array(TransformTest);
6
+ function transformTestResource(transport) {
7
+ const { explain } = explainer(transport, "transformTest");
8
+ /** List the transform tests, optionally only those of one transform. */
9
+ async function list(params = {}, options = {}) {
10
+ return {
11
+ data: await transport.requestParsed(TransformTestApiList, "/api/ee/transform-test", {
12
+ ...options,
13
+ query: { "transform-id": params["transform-id"] }
14
+ }),
15
+ total: null
16
+ };
17
+ }
18
+ /** Get a transform test by id. */
19
+ async function get(id, options = {}) {
20
+ return transport.requestParsed(TransformTest, `/api/ee/transform-test/${id}`, { ...options });
21
+ }
22
+ /**
23
+ * Create a transform test. The server validates the inputs and expectations against the
24
+ * transform before saving, and refuses with an `HttpError` whose `errorCode` is a
25
+ * `TransformTestRefusalCode` when they cannot run.
26
+ */
27
+ async function create(params, options = {}) {
28
+ return transport.requestParsed(TransformTest, "/api/ee/transform-test", {
29
+ ...options,
30
+ method: "POST",
31
+ body: params
32
+ });
33
+ }
34
+ /**
35
+ * Update a transform test by id, leaving omitted fields unchanged. A body that touches the
36
+ * transform, inputs or expectations is validated as on create, with the same refusal.
37
+ */
38
+ async function update(id, params, options = {}) {
39
+ return transport.requestParsed(TransformTest, `/api/ee/transform-test/${id}`, {
40
+ ...options,
41
+ method: "PUT",
42
+ body: params
43
+ });
44
+ }
45
+ /** Delete a transform test by id. */
46
+ async function remove(id, options = {}) {
47
+ await transport.requestRaw(`/api/ee/transform-test/${id}`, {
48
+ ...options,
49
+ method: "DELETE",
50
+ expectContentType: "binary"
51
+ });
52
+ }
53
+ /**
54
+ * Run a transform test by id. A result means the run happened: `status` is `passed` or `failed`
55
+ * and every expectation reports what it found, one that could not be evaluated as its own
56
+ * `error`. An `HttpError` whose `errorCode` is a `TransformTestRefusalCode` means the run was
57
+ * refused and nothing meaningful ran.
58
+ */
59
+ async function run(id, options = {}) {
60
+ return transport.requestParsed(TransformTestRunResult, `/api/ee/transform-test/${id}/run`, {
61
+ ...options,
62
+ method: "POST"
63
+ });
64
+ }
65
+ return {
66
+ list: explain("list", list),
67
+ get: explain("get", get),
68
+ create: explain("create", create),
69
+ update: explain("update", update),
70
+ delete: explain("delete", remove),
71
+ run: explain("run", run)
72
+ };
73
+ }
74
+ //#endregion
75
+ export { transformTestResource };
@@ -0,0 +1,2 @@
1
+ import { a as TransformRunSummaryPageParams, i as TransformRunParams, n as TransformRunPageOptions, o as transformResource, r as TransformRunPageParams, t as TransformDagParams } from "../transform-WASQAXeA.js";
2
+ export { TransformDagParams, TransformRunPageOptions, TransformRunPageParams, TransformRunParams, TransformRunSummaryPageParams, transformResource };
@@ -0,0 +1,227 @@
1
+ import { TimeoutError } from "../errors.js";
2
+ import { paginatePages } from "../paginate.js";
3
+ import { t as explainer } from "../refusal-B9aeHMc9.js";
4
+ import { pollUntil } from "../poll.js";
5
+ import { TransformDagRunResult, TransformDagTransform, TransformRun, TransformRunSummary, isTransformRunFailed, isTransformRunTerminal, transformDetailSchema, transformRowSchema, transformSourceBody } from "../domain/transform.js";
6
+ import { z } from "zod";
7
+ //#region src/resources/transform.ts
8
+ function transformListSchema(features) {
9
+ return z.array(transformRowSchema(features));
10
+ }
11
+ const TransformRunKickoff = z.object({
12
+ message: z.string(),
13
+ run_id: z.number().int().positive().nullable()
14
+ });
15
+ const TransformDagTransformList = z.array(TransformDagTransform);
16
+ function transformResource(transport) {
17
+ const { explain, explainWalk } = explainer(transport, "transform");
18
+ async function requestTransformList(path, opts) {
19
+ const { features } = await transport.server(opts);
20
+ return {
21
+ data: await transport.requestParsed(transformListSchema(features), path, opts),
22
+ total: null
23
+ };
24
+ }
25
+ async function requestTransform(path, opts) {
26
+ const { features } = await transport.server(opts);
27
+ return transport.requestParsed(transformRowSchema(features), path, opts);
28
+ }
29
+ /** List every transform the caller can see. */
30
+ async function list(options = {}) {
31
+ return requestTransformList("/api/transform", { ...options });
32
+ }
33
+ /** Get one transform by id. */
34
+ async function get(id, options = {}) {
35
+ const { features } = await transport.server(options);
36
+ return transport.requestParsed(transformDetailSchema(features), `/api/transform/${id}`, { ...options });
37
+ }
38
+ async function writeBody(params, options) {
39
+ if (params.source === void 0) return params;
40
+ const { features } = await transport.server(options);
41
+ return {
42
+ ...params,
43
+ source: transformSourceBody(params.source, features)
44
+ };
45
+ }
46
+ /** Create a transform — a query plus the warehouse table it writes — from a full body. */
47
+ async function create(params, options = {}) {
48
+ const body = await writeBody(params, options);
49
+ return requestTransform("/api/transform", {
50
+ ...options,
51
+ method: "POST",
52
+ body
53
+ });
54
+ }
55
+ /** Update a transform by id, patching only the fields the body carries. */
56
+ async function update(id, params, options = {}) {
57
+ const body = await writeBody(params, options);
58
+ return requestTransform(`/api/transform/${id}`, {
59
+ ...options,
60
+ method: "PUT",
61
+ body
62
+ });
63
+ }
64
+ /** Delete a transform by id, leaving any table it already materialized in place. */
65
+ async function remove(id, options = {}) {
66
+ await transport.requestRaw(`/api/transform/${id}`, {
67
+ ...options,
68
+ method: "DELETE",
69
+ expectContentType: "binary"
70
+ });
71
+ }
72
+ /** Drop a transform's materialized output table, keeping the transform definition. */
73
+ async function deleteTable(id, options = {}) {
74
+ await transport.requestRaw(`/api/transform/${id}/table`, {
75
+ ...options,
76
+ method: "DELETE",
77
+ expectContentType: "binary"
78
+ });
79
+ }
80
+ /** List the upstream transforms a transform depends on. */
81
+ async function dependencies(id, options = {}) {
82
+ return requestTransformList(`/api/transform/${id}/dependencies`, { ...options });
83
+ }
84
+ /** Request cancellation of a transform's current run. */
85
+ async function cancel(id, options = {}) {
86
+ await transport.requestRaw(`/api/transform/${id}/cancel`, {
87
+ ...options,
88
+ method: "POST",
89
+ expectContentType: "binary"
90
+ });
91
+ }
92
+ /** Get one transform run by run id — not by the id of the transform that produced it. */
93
+ async function getRun(runId, options = {}) {
94
+ return transport.requestParsed(TransformRun, `/api/transform/run/${runId}`, { ...options });
95
+ }
96
+ /** Walk the run history, newest first, optionally narrowed to a single transform. */
97
+ async function* runPages(params = {}, options = {}) {
98
+ yield* paginatePages(transport, "/api/transform/run", TransformRun, {
99
+ query: { "transform-ids": params["transform-ids"] },
100
+ ...options.offset !== void 0 && { offset: options.offset },
101
+ ...options.max !== void 0 && { max: options.max },
102
+ ...options.pageSize !== void 0 && { pageSize: options.pageSize },
103
+ ...options.signal !== void 0 && { signal: options.signal }
104
+ });
105
+ }
106
+ /**
107
+ * Walk the unified run history, newest first by default: every row is a root run — a job run, a
108
+ * DAG reprocess run, or a standalone transform run — and never a member run of a job or DAG.
109
+ */
110
+ async function* runSummaryPages(params = {}, options = {}) {
111
+ yield* paginatePages(transport, "/api/transform/runs", TransformRunSummary, {
112
+ query: {
113
+ types: params.types,
114
+ statuses: params.statuses,
115
+ "run-methods": params["run-methods"],
116
+ "start-time": params["start-time"],
117
+ "end-time": params["end-time"],
118
+ "transform-ids": params["transform-ids"],
119
+ "sort-column": params["sort-column"],
120
+ "sort-direction": params["sort-direction"]
121
+ },
122
+ ...options.offset !== void 0 && { offset: options.offset },
123
+ ...options.max !== void 0 && { max: options.max },
124
+ ...options.pageSize !== void 0 && { pageSize: options.pageSize },
125
+ ...options.signal !== void 0 && { signal: options.signal }
126
+ });
127
+ }
128
+ /**
129
+ * Reset the stored checkpoint of an incremental transform, so its next run reprocesses the whole
130
+ * source rather than the rows past the last checkpoint.
131
+ */
132
+ async function resetCheckpoint(id, options = {}) {
133
+ await transport.requestRaw(`/api/transform/${id}/reset-checkpoint`, {
134
+ ...options,
135
+ method: "POST",
136
+ expectContentType: "binary"
137
+ });
138
+ }
139
+ /**
140
+ * Start a DAG reprocess run seeded at a transform: the transform plus, by `direction`, every
141
+ * transform it transitively depends on or every transform that transitively depends on it. The
142
+ * server answers at once with the run's id, or null when it ran nothing because a DAG run for
143
+ * this transform is already in progress or the closure is empty. Progress is read off
144
+ * `runSummaryPages` with `types: ["dag"]`, and the member runs off `transformDagRun.transformRuns`.
145
+ */
146
+ async function runDag(id, params, options = {}) {
147
+ return transport.requestParsed(TransformDagRunResult, `/api/transform/${id}/run-dag`, {
148
+ ...options,
149
+ method: "POST",
150
+ body: { direction: params.direction }
151
+ });
152
+ }
153
+ /** Preview the transforms a DAG reprocess seeded at a transform would run, in execution order. */
154
+ async function dagTransforms(id, params, options = {}) {
155
+ return {
156
+ data: await transport.requestParsed(TransformDagTransformList, `/api/transform/${id}/dag-transforms`, {
157
+ ...options,
158
+ query: { direction: params.direction }
159
+ }),
160
+ total: null
161
+ };
162
+ }
163
+ /**
164
+ * Start a run of a transform by id. The server queues the run and answers at once; `wait` polls
165
+ * it to a terminal status, and `syncTarget` follows that with the output table's registration.
166
+ * A server that answers no run id started nothing, and there is then nothing to poll.
167
+ */
168
+ async function run(id, params = {}, options = {}) {
169
+ const kickoff = await transport.requestParsed(TransformRunKickoff, `/api/transform/${id}/run`, {
170
+ ...options,
171
+ method: "POST"
172
+ });
173
+ const schedule = params.syncTarget === true ? params.wait ?? {} : params.wait;
174
+ if (schedule === void 0 || kickoff.run_id === null) return {
175
+ message: kickoff.message,
176
+ run_id: kickoff.run_id,
177
+ final: null
178
+ };
179
+ const runId = kickoff.run_id;
180
+ const final = await pollUntil(async (signal) => getRun(runId, {
181
+ ...options,
182
+ signal
183
+ }), (candidate) => isTransformRunTerminal(candidate.status), schedule);
184
+ if (params.syncTarget !== true) return {
185
+ message: kickoff.message,
186
+ run_id: runId,
187
+ final
188
+ };
189
+ const targetTableId = isTransformRunFailed(final.status) ? null : await awaitTargetTableId(id, schedule, options);
190
+ return {
191
+ message: kickoff.message,
192
+ run_id: runId,
193
+ final,
194
+ target_table_id: targetTableId
195
+ };
196
+ }
197
+ async function awaitTargetTableId(id, wait, options) {
198
+ try {
199
+ return (await pollUntil(async (signal) => get(id, {
200
+ ...options,
201
+ signal
202
+ }), (transform) => transform.target_table_id !== null, wait)).target_table_id;
203
+ } catch (error) {
204
+ if (error instanceof TimeoutError) return null;
205
+ throw error;
206
+ }
207
+ }
208
+ return {
209
+ list: explain("list", list),
210
+ get: explain("get", get),
211
+ create: explain("create", create),
212
+ update: explain("update", update),
213
+ delete: explain("delete", remove),
214
+ deleteTable: explain("deleteTable", deleteTable),
215
+ dependencies: explain("dependencies", dependencies),
216
+ cancel: explain("cancel", cancel),
217
+ getRun: explain("getRun", getRun),
218
+ runPages: explainWalk("runPages", runPages),
219
+ runSummaryPages: explainWalk("runSummaryPages", runSummaryPages),
220
+ resetCheckpoint: explain("resetCheckpoint", resetCheckpoint),
221
+ runDag: explain("runDag", runDag),
222
+ dagTransforms: explain("dagTransforms", dagTransforms),
223
+ run: explain("run", run)
224
+ };
225
+ }
226
+ //#endregion
227
+ export { transformResource };
@@ -0,0 +1,2 @@
1
+ import { n as uploadResource, t as UploadCsvParams } from "../upload-B5YjVkSW.js";
2
+ export { UploadCsvParams, uploadResource };
@@ -0,0 +1,48 @@
1
+ import { ResponseShapeError } from "../errors.js";
2
+ import { buildCsvFormData } from "./csv-upload.js";
3
+ import { UploadResult } from "../domain/upload.js";
4
+ //#region src/resources/upload.ts
5
+ const UPLOAD_TABLE_ID_HEADER = "metabase-table-id";
6
+ function uploadResource(transport) {
7
+ /**
8
+ * Create a table and model populated with the values from the attached CSV. Returns the model ID
9
+ * if successful.
10
+ *
11
+ * The file may be at most 50 MB; larger uploads are rejected with a 413 response.
12
+ */
13
+ async function createFromCsv(file, params, options = {}) {
14
+ const form = buildCsvFormData(file);
15
+ form.append("collection_id", params.collection_id);
16
+ const response = await transport.requestRaw("/api/upload/csv", {
17
+ ...options,
18
+ method: "POST",
19
+ body: form,
20
+ expectContentType: "binary"
21
+ });
22
+ return parseCreateUploadResult(await response.text(), response.headers);
23
+ }
24
+ return { createFromCsv };
25
+ }
26
+ function parseCreateUploadResult(bodyText, headers) {
27
+ return UploadResult.parse({
28
+ model_id: parseResponseInteger(bodyText, "response body"),
29
+ table_id: parseResponseInteger(headers.get(UPLOAD_TABLE_ID_HEADER), `${UPLOAD_TABLE_ID_HEADER} header`)
30
+ });
31
+ }
32
+ function parseResponseInteger(value, source) {
33
+ const trimmed = value?.trim() ?? "";
34
+ if (trimmed === "") throw new ResponseShapeError(`upload succeeded but the ${source} was empty`, {
35
+ kind: "decoded",
36
+ source,
37
+ value
38
+ });
39
+ const parsed = Number(trimmed);
40
+ if (!Number.isInteger(parsed)) throw new ResponseShapeError(`upload succeeded but the ${source} was not an integer: ${JSON.stringify(trimmed)}`, {
41
+ kind: "decoded",
42
+ source,
43
+ value
44
+ });
45
+ return parsed;
46
+ }
47
+ //#endregion
48
+ export { uploadResource };
@@ -0,0 +1,8 @@
1
+ import { f as RequestOptions, h as Transport } from "../transport-BsXqRujn.js";
2
+ import { t as CurrentUser } from "../user-Sqqv7rqh.js";
3
+ //#region src/resources/user.d.ts
4
+ declare function userResource(transport: Transport): {
5
+ current: (options?: RequestOptions) => Promise<CurrentUser>;
6
+ };
7
+ //#endregion
8
+ export { userResource };
@@ -0,0 +1,11 @@
1
+ import { CurrentUser } from "../domain/user.js";
2
+ //#region src/resources/user.ts
3
+ function userResource(transport) {
4
+ /** Get the user the request's credentials authenticate as. */
5
+ async function current(options = {}) {
6
+ return transport.requestParsed(CurrentUser, "/api/user/current", { ...options });
7
+ }
8
+ return { current };
9
+ }
10
+ //#endregion
11
+ export { userResource };
@@ -0,0 +1,106 @@
1
+ import { r as InputGate } from "./input-gates-DwKoTJVQ.js";
2
+ import { z } from "zod";
3
+ //#region src/domain/revision.d.ts
4
+ declare const RevisionEntity: z.ZodEnum<{
5
+ transform: "transform";
6
+ card: "card";
7
+ dashboard: "dashboard";
8
+ document: "document";
9
+ measure: "measure";
10
+ segment: "segment";
11
+ "transform-test": "transform-test";
12
+ }>;
13
+ type RevisionEntity = z.infer<typeof RevisionEntity>;
14
+ declare const Revision: z.ZodObject<{
15
+ id: z.ZodNumber;
16
+ timestamp: z.ZodString;
17
+ is_creation: z.ZodBoolean;
18
+ is_reversion: z.ZodBoolean;
19
+ most_recent: z.ZodBoolean;
20
+ diff: z.ZodNullable<z.ZodObject<{}, z.core.$loose>>;
21
+ description: z.ZodString;
22
+ has_multiple_changes: z.ZodBoolean;
23
+ user: z.ZodObject<{
24
+ id: z.ZodNumber;
25
+ first_name: z.ZodNullable<z.ZodString>;
26
+ last_name: z.ZodNullable<z.ZodString>;
27
+ common_name: z.ZodString;
28
+ }, z.core.$loose>;
29
+ }, z.core.$loose>;
30
+ type Revision = z.infer<typeof Revision>;
31
+ declare const RevisionCompact: z.ZodObject<{
32
+ id: z.ZodNumber;
33
+ description: z.ZodString;
34
+ timestamp: z.ZodString;
35
+ user: z.ZodObject<{
36
+ id: z.ZodNumber;
37
+ first_name: z.ZodNullable<z.ZodString>;
38
+ last_name: z.ZodNullable<z.ZodString>;
39
+ common_name: z.ZodString;
40
+ }, z.core.$loose>;
41
+ is_creation: z.ZodBoolean;
42
+ is_reversion: z.ZodBoolean;
43
+ }, z.core.$strip>;
44
+ type RevisionCompact = z.infer<typeof RevisionCompact>;
45
+ declare const RevisionRow: z.ZodObject<{
46
+ id: z.ZodNumber;
47
+ model: z.ZodString;
48
+ model_id: z.ZodNumber;
49
+ user_id: z.ZodNumber;
50
+ object: z.ZodObject<{}, z.core.$loose>;
51
+ timestamp: z.ZodString;
52
+ is_creation: z.ZodBoolean;
53
+ is_reversion: z.ZodBoolean;
54
+ most_recent: z.ZodBoolean;
55
+ }, z.core.$loose>;
56
+ type RevisionRow = z.infer<typeof RevisionRow>;
57
+ declare const REVISION_ENTITY_GATES: readonly InputGate[];
58
+ declare const RevisionRevertInput: z.ZodObject<{
59
+ entity: z.ZodEnum<{
60
+ transform: "transform";
61
+ card: "card";
62
+ dashboard: "dashboard";
63
+ document: "document";
64
+ measure: "measure";
65
+ segment: "segment";
66
+ "transform-test": "transform-test";
67
+ }>;
68
+ id: z.ZodNumber;
69
+ revision_id: z.ZodNumber;
70
+ }, z.core.$strict>;
71
+ type RevisionRevertInput = z.infer<typeof RevisionRevertInput>;
72
+ declare const RevisionRevert: z.ZodDiscriminatedUnion<[z.ZodObject<{
73
+ outcome: z.ZodLiteral<"reverted">;
74
+ revision: z.ZodObject<{
75
+ id: z.ZodNumber;
76
+ timestamp: z.ZodString;
77
+ is_creation: z.ZodBoolean;
78
+ is_reversion: z.ZodBoolean;
79
+ most_recent: z.ZodBoolean;
80
+ diff: z.ZodNullable<z.ZodObject<{}, z.core.$loose>>;
81
+ description: z.ZodString;
82
+ has_multiple_changes: z.ZodBoolean;
83
+ user: z.ZodObject<{
84
+ id: z.ZodNumber;
85
+ first_name: z.ZodNullable<z.ZodString>;
86
+ last_name: z.ZodNullable<z.ZodString>;
87
+ common_name: z.ZodString;
88
+ }, z.core.$loose>;
89
+ }, z.core.$loose>;
90
+ }, z.core.$strip>, z.ZodObject<{
91
+ outcome: z.ZodLiteral<"unchanged">;
92
+ revision: z.ZodObject<{
93
+ id: z.ZodNumber;
94
+ model: z.ZodString;
95
+ model_id: z.ZodNumber;
96
+ user_id: z.ZodNumber;
97
+ object: z.ZodObject<{}, z.core.$loose>;
98
+ timestamp: z.ZodString;
99
+ is_creation: z.ZodBoolean;
100
+ is_reversion: z.ZodBoolean;
101
+ most_recent: z.ZodBoolean;
102
+ }, z.core.$loose>;
103
+ }, z.core.$strip>], "outcome">;
104
+ type RevisionRevert = z.infer<typeof RevisionRevert>;
105
+ //#endregion
106
+ export { RevisionRevert as a, RevisionEntity as i, Revision as n, RevisionRevertInput as o, RevisionCompact as r, RevisionRow as s, REVISION_ENTITY_GATES as t };