@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,75 @@
1
+ import { t as explainer } from "../refusal-B9aeHMc9.js";
2
+ import { DataApp, DataAppEntry } from "../domain/data-app.js";
3
+ import { z } from "zod";
4
+ //#region src/resources/data-app.ts
5
+ const DATA_APPS_PATH = "/api/ee/apps";
6
+ function appPath(slug) {
7
+ return `${DATA_APPS_PATH}/${encodeURIComponent(slug)}`;
8
+ }
9
+ function dataAppResource(transport) {
10
+ const { explain } = explainer(transport, "dataApp");
11
+ /** List the data apps; `available` keeps only the enabled ones that aren't outdated. `GET /api/ee/apps` answers a bare array. */
12
+ async function list(filter = {}, options = {}) {
13
+ return {
14
+ data: await transport.requestParsed(z.array(DataAppEntry), DATA_APPS_PATH, {
15
+ ...options,
16
+ query: { available: filter.available }
17
+ }),
18
+ total: null
19
+ };
20
+ }
21
+ /** Get one data app by slug; admins read disabled apps too. */
22
+ async function get(slug, options = {}) {
23
+ return transport.requestParsed(DataAppEntry, appPath(slug), { ...options });
24
+ }
25
+ /** Create a data app with its resource collection and an empty bundle; it is disabled unless the body says otherwise. */
26
+ async function create(params, options = {}) {
27
+ return transport.requestParsed(DataApp, DATA_APPS_PATH, {
28
+ ...options,
29
+ method: "POST",
30
+ body: params
31
+ });
32
+ }
33
+ /** Update a data app's fields, or enable or disable it. */
34
+ async function update(slug, params, options = {}) {
35
+ return transport.requestParsed(DataApp, appPath(slug), {
36
+ ...options,
37
+ method: "PUT",
38
+ body: params
39
+ });
40
+ }
41
+ /** Replace a data app's bundle with the text of a built bundle. */
42
+ async function replaceBundle(slug, bundle, options = {}) {
43
+ return transport.requestParsed(DataApp, `${appPath(slug)}/bundle`, {
44
+ ...options,
45
+ method: "PUT",
46
+ body: { bundle }
47
+ });
48
+ }
49
+ /** The TypeScript module of the app's queries and actions: a `defineQuery` or `defineAction` call per question and action in its collection. */
50
+ async function typedSchema(slug, options = {}) {
51
+ return (await transport.requestRaw(`${appPath(slug)}/typed-schema`, {
52
+ ...options,
53
+ expectContentType: "text"
54
+ })).text();
55
+ }
56
+ /** Delete a data app with its bundle, its collection and its group assignments. */
57
+ async function remove(slug, options = {}) {
58
+ await transport.requestRaw(appPath(slug), {
59
+ ...options,
60
+ method: "DELETE",
61
+ expectContentType: "binary"
62
+ });
63
+ }
64
+ return {
65
+ list: explain("list", list),
66
+ get: explain("get", get),
67
+ create: explain("create", create),
68
+ update: explain("update", update),
69
+ replaceBundle: explain("replaceBundle", replaceBundle),
70
+ typedSchema: explain("typedSchema", typedSchema),
71
+ delete: explain("delete", remove)
72
+ };
73
+ }
74
+ //#endregion
75
+ export { dataAppResource };
@@ -0,0 +1,2 @@
1
+ import { i as databaseResource, n as DatabaseListParams, r as DatabaseSyncSchemaParams, t as DatabaseGetParams } from "../database-B0JNZjDN.js";
2
+ export { DatabaseGetParams, DatabaseListParams, DatabaseSyncSchemaParams, databaseResource };
@@ -0,0 +1,103 @@
1
+ import { Table } from "../domain/table.js";
2
+ import { Database, DatabaseWithSettings } from "../domain/database.js";
3
+ import { pollUntil } from "../poll.js";
4
+ import { z } from "zod";
5
+ //#region src/resources/database.ts
6
+ const DatabaseApiList = z.object({
7
+ data: z.array(Database),
8
+ total: z.number().int().nonnegative()
9
+ }).loose();
10
+ const DatabaseTaskAck = z.object({ status: z.literal("ok") });
11
+ const DatabaseApiSchemaList = z.array(z.string());
12
+ const DatabaseApiSchemaTableList = z.array(Table);
13
+ const SYNC_COMPLETE = "complete";
14
+ function databaseResource(transport) {
15
+ /** List databases. `include` hydrates each database's tables; `saved` adds the Saved Questions virtual database. */
16
+ async function list(params = {}, options = {}) {
17
+ const response = await transport.requestParsed(DatabaseApiList, "/api/database", {
18
+ ...options,
19
+ query: {
20
+ include: params.include,
21
+ saved: params.saved
22
+ }
23
+ });
24
+ return {
25
+ data: response.data,
26
+ total: response.total
27
+ };
28
+ }
29
+ /** Get one database by id. `include` hydrates its tables, and `tables.fields` their fields too. */
30
+ async function get(id, params = {}, options = {}) {
31
+ return transport.requestParsed(Database, `/api/database/${id}`, {
32
+ ...options,
33
+ query: { include: params.include }
34
+ });
35
+ }
36
+ /** Update a database's settings by id; the server merges them into the ones it holds. */
37
+ async function update(id, params, options = {}) {
38
+ return transport.requestParsed(DatabaseWithSettings, `/api/database/${id}`, {
39
+ ...options,
40
+ method: "PUT",
41
+ body: params
42
+ });
43
+ }
44
+ /** List the schema names in a database. */
45
+ async function schemas(id, options = {}) {
46
+ return {
47
+ data: await transport.requestParsed(DatabaseApiSchemaList, `/api/database/${id}/schemas`, { ...options }),
48
+ total: null
49
+ };
50
+ }
51
+ /** List the tables one schema of a database holds. */
52
+ async function schemaTables(id, schema, options = {}) {
53
+ return {
54
+ data: await transport.requestParsed(DatabaseApiSchemaTableList, `/api/database/${id}/schema/${encodeURIComponent(schema)}`, { ...options }),
55
+ total: null
56
+ };
57
+ }
58
+ /**
59
+ * Trigger a manual schema sync for a database. The endpoint queues the sync and returns at once;
60
+ * pass `wait` to poll the database until it reports its initial sync complete.
61
+ */
62
+ async function syncSchema(id, params = {}, options = {}) {
63
+ const ack = await transport.requestParsed(DatabaseTaskAck, `/api/database/${id}/sync_schema`, {
64
+ ...options,
65
+ method: "POST"
66
+ });
67
+ const wait = params.wait;
68
+ if (wait === void 0) return {
69
+ id,
70
+ status: ack.status
71
+ };
72
+ const database = await pollUntil(async (signal) => transport.requestParsed(Database, `/api/database/${id}`, {
73
+ ...options,
74
+ signal
75
+ }), (candidate) => candidate.initial_sync_status === SYNC_COMPLETE, wait);
76
+ return {
77
+ id,
78
+ status: ack.status,
79
+ initial_sync_status: database.initial_sync_status ?? null
80
+ };
81
+ }
82
+ /** Trigger a rescan of the cached field values across a database. */
83
+ async function rescanValues(id, options = {}) {
84
+ return {
85
+ id,
86
+ status: (await transport.requestParsed(DatabaseTaskAck, `/api/database/${id}/rescan_values`, {
87
+ ...options,
88
+ method: "POST"
89
+ })).status
90
+ };
91
+ }
92
+ return {
93
+ list,
94
+ get,
95
+ update,
96
+ schemas,
97
+ schemaTables,
98
+ syncSchema,
99
+ rescanValues
100
+ };
101
+ }
102
+ //#endregion
103
+ export { databaseResource };
@@ -0,0 +1,2 @@
1
+ import { n as DatasetNativeParams, r as datasetResource, t as DatasetExportParams } from "../dataset-BUirJ1rO.js";
2
+ export { DatasetExportParams, DatasetNativeParams, datasetResource };
@@ -0,0 +1,81 @@
1
+ import { CardQueryResult } from "../domain/card.js";
2
+ import { CompiledQuery, QueryMetadata } from "../domain/dataset.js";
3
+ import { assertPivotedExport } from "./pivot-export.js";
4
+ //#region src/resources/dataset.ts
5
+ function datasetResource(transport) {
6
+ /**
7
+ * Run an ad-hoc query and return its result envelope. The body is a whole query — MBQL 5, legacy
8
+ * MBQL, or native — rather than a reference to a saved one, so nothing here is a card.
9
+ */
10
+ async function query(body, options = {}) {
11
+ return transport.requestParsed(CardQueryResult, "/api/dataset", {
12
+ ...options,
13
+ method: "POST",
14
+ body
15
+ });
16
+ }
17
+ /**
18
+ * Fetch a native version of an MBQL query. `pretty` rides in the same body as the query and
19
+ * defaults server-side to true.
20
+ */
21
+ async function native(datasetQuery, params = {}, options = {}) {
22
+ return transport.requestParsed(CompiledQuery, "/api/dataset/native", {
23
+ ...options,
24
+ method: "POST",
25
+ body: {
26
+ ...datasetQuery,
27
+ pretty: params.pretty
28
+ }
29
+ });
30
+ }
31
+ /**
32
+ * Get all of the required query metadata for an ad-hoc query: the databases, tables, fields and
33
+ * snippets it references. `{ settings: { "include-sensitive-fields": true } }` inside the query
34
+ * widens the field filter.
35
+ */
36
+ async function queryMetadata(datasetQuery, options = {}) {
37
+ return transport.requestParsed(QueryMetadata, "/api/dataset/query_metadata", {
38
+ ...options,
39
+ method: "POST",
40
+ body: datasetQuery
41
+ });
42
+ }
43
+ /**
44
+ * Execute a query and download the result data as a file in the specified format. Unlike
45
+ * `query`, this endpoint answers bytes, so a caller consumes the stream rather than a value.
46
+ * `visualization_settings` drive `format_rows` column formatting and, through
47
+ * `pivot_table.column_split`, the layout `pivot_results` lays the rows out in. The server only
48
+ * computes that layout for a query it runs as a pivot, which it reads from the query's own
49
+ * `was-pivot`, so `pivot_results` sets it. A pivot the server would answer with plain rows (a
50
+ * JSON export, or pivoted exports turned off) is refused. `csv_include_bom` opens a CSV with a
51
+ * UTF-8 byte order mark; a server without it drops the key silently, so asking for one is refused
52
+ * there before the wire.
53
+ */
54
+ async function exportQuery(format, params, options = {}) {
55
+ if (params.pivot_results) await assertPivotedExport(transport, format, options);
56
+ await transport.requireFeatures(params.csv_include_bom ? ["exportCsvByteOrderMark"] : [], options);
57
+ const exported = params.pivot_results ? {
58
+ ...params.query,
59
+ "was-pivot": true
60
+ } : params.query;
61
+ return transport.requestStream(`/api/dataset/${format}`, {
62
+ ...options,
63
+ method: "POST",
64
+ body: {
65
+ query: exported,
66
+ visualization_settings: params.visualization_settings,
67
+ format_rows: params.format_rows,
68
+ pivot_results: params.pivot_results,
69
+ csv_include_bom: params.csv_include_bom
70
+ }
71
+ });
72
+ }
73
+ return {
74
+ query,
75
+ native,
76
+ queryMetadata,
77
+ exportQuery
78
+ };
79
+ }
80
+ //#endregion
81
+ export { datasetResource };
@@ -0,0 +1,2 @@
1
+ import { a as dependencyResource, i as DependencyItemPageOptions, n as DependencyDependentsParams, r as DependencyItemListParams, t as DependencyBrokenParams } from "../dependency-CzpXmeu7.js";
2
+ export { DependencyBrokenParams, DependencyDependentsParams, DependencyItemListParams, DependencyItemPageOptions, dependencyResource };
@@ -0,0 +1,156 @@
1
+ import { paginatePages } from "../paginate.js";
2
+ import { t as explainer } from "../refusal-B9aeHMc9.js";
3
+ import { BreakingSource, DependencyEntity, DependencyGraph, DependencyNode } from "../domain/dependency.js";
4
+ import { z } from "zod";
5
+ //#region src/resources/dependency.ts
6
+ const DependencyNodeApiList = z.array(DependencyNode);
7
+ const DependencyEntityApiList = z.array(DependencyEntity);
8
+ function entityTypeFeatures(type) {
9
+ if (type === "measure") return [{
10
+ feature: "measureDependencyGraph",
11
+ fields: ["type"]
12
+ }];
13
+ if (type === "action") return [{
14
+ feature: "actionDependencyGraph",
15
+ fields: ["type"]
16
+ }];
17
+ return [];
18
+ }
19
+ function dependencyResource(transport) {
20
+ const { explain, explainWalk } = explainer(transport, "dependency");
21
+ /**
22
+ * The upstream dependency graph of one entity. `nodes` holds the starting entity plus every
23
+ * entity it depends on, directly or transitively; each edge runs from the dependent to what it
24
+ * depends on. A measure starts a graph only on a server with `measureDependencyGraph`, and an
25
+ * action only on one with `actionDependencyGraph`.
26
+ */
27
+ async function graph(type, id, options = {}) {
28
+ return transport.requestParsed(DependencyGraph, "/api/ee/dependencies/graph", {
29
+ ...options,
30
+ query: {
31
+ type,
32
+ id
33
+ }
34
+ });
35
+ }
36
+ /**
37
+ * The entities that depend directly on one entity. `dependent-types` and `dependent-card-types`
38
+ * narrow which kinds are listed, `broken` keeps only those whose query the entity has broken,
39
+ * `query` matches against names and locations, `include-personal-collections` admits content in
40
+ * personal collections, and `sort-column` / `sort-direction` order the result.
41
+ */
42
+ async function dependents(type, id, params = {}, options = {}) {
43
+ return {
44
+ data: await transport.requestParsed(DependencyNodeApiList, "/api/ee/dependencies/graph/dependents", {
45
+ ...options,
46
+ query: {
47
+ type,
48
+ id,
49
+ "dependent-types": params["dependent-types"],
50
+ "dependent-card-types": params["dependent-card-types"],
51
+ broken: params.broken,
52
+ query: params.query,
53
+ "include-personal-collections": params["include-personal-collections"],
54
+ "sort-column": params["sort-column"],
55
+ "sort-direction": params["sort-direction"]
56
+ }
57
+ }),
58
+ total: null
59
+ };
60
+ }
61
+ /**
62
+ * The dependents of one entity whose queries it has broken, as bare entities without a
63
+ * dependents count. `dependent-types` and `dependent-card-types` narrow which kinds are listed,
64
+ * `include-personal-collections` admits content in personal collections, and `sort-column` /
65
+ * `sort-direction` order the result.
66
+ */
67
+ async function broken(type, id, params = {}, options = {}) {
68
+ return {
69
+ data: await transport.requestParsed(DependencyEntityApiList, "/api/ee/dependencies/graph/broken", {
70
+ ...options,
71
+ query: {
72
+ type,
73
+ id,
74
+ "dependent-types": params["dependent-types"],
75
+ "dependent-card-types": params["dependent-card-types"],
76
+ "include-personal-collections": params["include-personal-collections"],
77
+ "sort-column": params["sort-column"],
78
+ "sort-direction": params["sort-direction"]
79
+ }
80
+ }),
81
+ total: null
82
+ };
83
+ }
84
+ /**
85
+ * Walk the entities that no readable, unarchived dependent depends on, one page at a time: an
86
+ * entity used only by archived content, or by content the caller cannot read, is listed. `types`
87
+ * and `card-types` narrow which kinds are listed, `query` matches against names and locations,
88
+ * `include-personal-collections` admits content in personal collections, and `sort-column` /
89
+ * `sort-direction` order the result. A `query` leaves sandboxes out, since they have no name or
90
+ * location to match, so sandboxes alone with a `query` answer one empty page without a request.
91
+ * This endpoint pages on the server, so the caller consumes pages and decides how far to pull.
92
+ */
93
+ async function* unreferencedPages(params = {}, options = {}) {
94
+ if (queryLeavesNoKind(params)) {
95
+ yield {
96
+ items: [],
97
+ total: 0
98
+ };
99
+ return;
100
+ }
101
+ yield* paginatePages(transport, "/api/ee/dependencies/graph/unreferenced", DependencyNode, {
102
+ query: itemListQuery(params),
103
+ ...options.offset !== void 0 && { offset: options.offset },
104
+ ...options.max !== void 0 && { max: options.max },
105
+ ...options.pageSize !== void 0 && { pageSize: options.pageSize },
106
+ ...options.signal !== void 0 && { signal: options.signal }
107
+ });
108
+ }
109
+ /**
110
+ * Walk the entities whose dependents carry analysis errors, one page at a time, each with the
111
+ * `dependents_errors` rows found downstream of it. The server lists cards and tables unless
112
+ * `types` says otherwise; `card-types`, `query`, `include-personal-collections`, `sort-column`
113
+ * and `sort-direction` read as on `unreferencedPages`. This endpoint pages on the server, so the
114
+ * caller consumes pages and decides how far to pull.
115
+ */
116
+ async function* breakingPages(params = {}, options = {}) {
117
+ if (queryLeavesNoKind(params)) {
118
+ yield {
119
+ items: [],
120
+ total: 0
121
+ };
122
+ return;
123
+ }
124
+ yield* paginatePages(transport, "/api/ee/dependencies/graph/breaking", BreakingSource, {
125
+ query: itemListQuery(params),
126
+ ...options.offset !== void 0 && { offset: options.offset },
127
+ ...options.max !== void 0 && { max: options.max },
128
+ ...options.pageSize !== void 0 && { pageSize: options.pageSize },
129
+ ...options.signal !== void 0 && { signal: options.signal }
130
+ });
131
+ }
132
+ return {
133
+ graph: explain("graph", graph, entityTypeFeatures),
134
+ dependents: explain("dependents", dependents, entityTypeFeatures),
135
+ broken: explain("broken", broken, entityTypeFeatures),
136
+ unreferencedPages: explainWalk("unreferencedPages", unreferencedPages),
137
+ breakingPages: explainWalk("breakingPages", breakingPages)
138
+ };
139
+ }
140
+ function queryLeavesNoKind(params) {
141
+ const { query, types } = params;
142
+ if (query === void 0 || types === void 0 || types.length === 0) return false;
143
+ return types.every((type) => type === "sandbox");
144
+ }
145
+ function itemListQuery(params) {
146
+ return {
147
+ types: params.types === void 0 ? void 0 : [...new Set(params.types)],
148
+ "card-types": params["card-types"],
149
+ query: params.query,
150
+ "include-personal-collections": params["include-personal-collections"],
151
+ "sort-column": params["sort-column"],
152
+ "sort-direction": params["sort-direction"]
153
+ };
154
+ }
155
+ //#endregion
156
+ export { dependencyResource };
@@ -0,0 +1,55 @@
1
+ import { f as RequestOptions, h as Transport } from "../transport-BsXqRujn.js";
2
+ import { t as ListResult } from "../list-BT_bBm9Z.js";
3
+ import { a as DocumentUpdateInput, i as DocumentCreateInput, t as Document } from "../document-tLd6pYWe.js";
4
+ //#region src/resources/document.d.ts
5
+ declare function documentResource(transport: Transport): {
6
+ list: (options?: RequestOptions) => Promise<ListResult<Document>>;
7
+ get: (id: number, options?: RequestOptions) => Promise<Document>;
8
+ create: (params: DocumentCreateInput, options?: RequestOptions) => Promise<Document>;
9
+ update: (id: number, params: DocumentUpdateInput, options?: RequestOptions) => Promise<Document>;
10
+ archive: (id: number, options?: RequestOptions) => Promise<Document>;
11
+ copy: (id: number, params?: {
12
+ name?: string | null | undefined;
13
+ collection_id?: number | null | undefined;
14
+ collection_position?: number | null | undefined;
15
+ } | undefined, options?: RequestOptions | undefined) => Promise<{
16
+ [x: string]: unknown;
17
+ id: number;
18
+ name: string;
19
+ document: {
20
+ [x: string]: unknown;
21
+ type: string;
22
+ text?: string | undefined;
23
+ attrs?: Record<string, unknown> | undefined;
24
+ marks?: Record<string, unknown>[] | undefined;
25
+ content?: {
26
+ [x: string]: unknown;
27
+ type: string;
28
+ text?: string | undefined;
29
+ attrs?: Record<string, unknown> | undefined;
30
+ marks?: Record<string, unknown>[] | undefined;
31
+ content?: /*elided*/ any[] | undefined;
32
+ }[] | undefined;
33
+ } | null;
34
+ entity_id: string | null;
35
+ collection_id: number | null;
36
+ creator_id: number;
37
+ archived: boolean;
38
+ created_at: string;
39
+ updated_at: string;
40
+ collection_position?: number | null | undefined;
41
+ creator?: {
42
+ [x: string]: unknown;
43
+ id: number;
44
+ email: string;
45
+ first_name: string | null;
46
+ last_name: string | null;
47
+ } | null | undefined;
48
+ can_write?: boolean | undefined;
49
+ can_delete?: boolean | undefined;
50
+ can_restore?: boolean | undefined;
51
+ is_remote_synced?: boolean | undefined;
52
+ }>;
53
+ };
54
+ //#endregion
55
+ export { documentResource };
@@ -0,0 +1,60 @@
1
+ import { t as explainer } from "../refusal-B9aeHMc9.js";
2
+ import { Document } from "../domain/document.js";
3
+ import { z } from "zod";
4
+ //#region src/resources/document.ts
5
+ const DocumentApiList = z.object({ items: z.array(Document) }).loose();
6
+ function documentResource(transport) {
7
+ const { explain } = explainer(transport, "document");
8
+ /** Get existing documents. */
9
+ async function list(options = {}) {
10
+ return {
11
+ data: (await transport.requestParsed(DocumentApiList, "/api/document", { ...options })).items,
12
+ total: null
13
+ };
14
+ }
15
+ /** Return an existing document by id. */
16
+ async function get(id, options = {}) {
17
+ return transport.requestParsed(Document, `/api/document/${id}`, { ...options });
18
+ }
19
+ /** Create a new document. */
20
+ async function create(params, options = {}) {
21
+ return transport.requestParsed(Document, "/api/document", {
22
+ ...options,
23
+ method: "POST",
24
+ body: params
25
+ });
26
+ }
27
+ /** Update an existing document by id. */
28
+ async function update(id, params, options = {}) {
29
+ return transport.requestParsed(Document, `/api/document/${id}`, {
30
+ ...options,
31
+ method: "PUT",
32
+ body: params
33
+ });
34
+ }
35
+ /** Archive (soft-delete) a document by id. Metabase models this as an update, not its own endpoint. */
36
+ async function archive(id, options = {}) {
37
+ return update(id, { archived: true }, options);
38
+ }
39
+ /**
40
+ * Copy a document into `collection_id` (root when absent), duplicating the cards saved inside
41
+ * it. An archived source is not found.
42
+ */
43
+ async function copy(id, params = {}, options = {}) {
44
+ return transport.requestParsed(Document, `/api/document/${id}/copy`, {
45
+ ...options,
46
+ method: "POST",
47
+ body: params
48
+ });
49
+ }
50
+ return {
51
+ list,
52
+ get,
53
+ create,
54
+ update,
55
+ archive,
56
+ copy: explain("copy", copy)
57
+ };
58
+ }
59
+ //#endregion
60
+ export { documentResource };
@@ -0,0 +1,8 @@
1
+ import { f as RequestOptions, h as Transport } from "../transport-BsXqRujn.js";
2
+ import { a as EidTranslateResult, i as EidTranslateInput } from "../eid-translation-CH6NPWd-.js";
3
+ //#region src/resources/eid-translation.d.ts
4
+ declare function eidTranslationResource(transport: Transport): {
5
+ translate: (params: EidTranslateInput, options?: RequestOptions) => Promise<EidTranslateResult>;
6
+ };
7
+ //#endregion
8
+ export { eidTranslationResource };
@@ -0,0 +1,19 @@
1
+ import { EidTranslateResult } from "../domain/eid-translation.js";
2
+ //#region src/resources/eid-translation.ts
3
+ function eidTranslationResource(transport) {
4
+ /**
5
+ * Translate entity ids to the numeric ids of the rows they name. The request groups the entity
6
+ * ids by model; the response is keyed by entity id, each entry carrying its model and — when the
7
+ * lookup succeeded — the numeric id.
8
+ */
9
+ async function translate(params, options = {}) {
10
+ return transport.requestParsed(EidTranslateResult, "/api/eid-translation/translate", {
11
+ ...options,
12
+ method: "POST",
13
+ body: params
14
+ });
15
+ }
16
+ return { translate };
17
+ }
18
+ //#endregion
19
+ export { eidTranslationResource };
@@ -0,0 +1,2 @@
1
+ import { n as erdResource, t as ErdParams } from "../erd-CbV7xvAc.js";
2
+ export { ErdParams, erdResource };
@@ -0,0 +1,26 @@
1
+ import { t as explainer } from "../refusal-B9aeHMc9.js";
2
+ import { Erd } from "../domain/erd.js";
3
+ //#region src/resources/erd.ts
4
+ const ERD_PATH = "/api/ee/erd";
5
+ function erdResource(transport) {
6
+ const { explain } = explainer(transport, "erd");
7
+ /**
8
+ * Get the entity relationship diagram of a database: the readable tables as nodes, each with its
9
+ * fields, and the foreign keys between them as edges. `table-ids` makes those tables the focal
10
+ * points and draws their neighbours; `schema` keeps one schema, the empty string the tables with
11
+ * none.
12
+ */
13
+ async function get(params, options = {}) {
14
+ return transport.requestParsed(Erd, ERD_PATH, {
15
+ ...options,
16
+ query: {
17
+ "database-id": params["database-id"],
18
+ "table-ids": params["table-ids"],
19
+ schema: params.schema
20
+ }
21
+ });
22
+ }
23
+ return { get: explain("get", get) };
24
+ }
25
+ //#endregion
26
+ export { erdResource };
@@ -0,0 +1,2 @@
1
+ import { a as FieldSetDataSensitivityParams, i as FieldSearchParams, n as FieldSearchBounded, o as fieldResource, r as FieldSearchByValue, t as FieldRemappingParams } from "../field-D1Pfk-0S.js";
2
+ export { FieldRemappingParams, FieldSearchBounded, FieldSearchByValue, FieldSearchParams, FieldSetDataSensitivityParams, fieldResource };