@metabase/cli 0.1.0-alpha.workspaces-commands.66774cc → 0.1.0-alpha.workspaces-commands.4f5cd01

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 (125) hide show
  1. package/README.md +72 -0
  2. package/dist/{api-key-Cy87ZD6J.mjs → api-key-BixMkWPO.mjs} +1 -1
  3. package/dist/{archive-CYnqV6se.mjs → archive-wT7OcMGZ.mjs} +3 -3
  4. package/dist/auth-CMAi9kxB.mjs +19 -0
  5. package/dist/{body-CGoWst5q.mjs → body-DXXQwt3g.mjs} +1 -1
  6. package/dist/{branches-CLNtwBB2.mjs → branches-BgTSaFKB.mjs} +4 -4
  7. package/dist/{cancel-task-DqdP2_8k.mjs → cancel-task-B68KyH-t.mjs} +4 -4
  8. package/dist/card-Cmlrb8JB.mjs +20 -0
  9. package/dist/{cards-Bslh-gVE.mjs → cards-DHCBey82.mjs} +4 -4
  10. package/dist/cli.mjs +20 -19
  11. package/dist/collection-Bsb32SoA.mjs +19 -0
  12. package/dist/collection-BsiGRKXh.mjs +170 -0
  13. package/dist/{create-Dfk-Cwra.mjs → create-BDnl0Jwp.mjs} +4 -4
  14. package/dist/{create-cAHtZgGR.mjs → create-CL87egd1.mjs} +4 -4
  15. package/dist/{create-O5_huJxw.mjs → create-CLfXlZDu.mjs} +4 -4
  16. package/dist/{create-CDa7ycuY.mjs → create-CeF5KEIP.mjs} +4 -4
  17. package/dist/{create-DX5ZlJVx.mjs → create-D7dWkt38.mjs} +3 -3
  18. package/dist/{create-MW9yGet7.mjs → create-DKFsiAug.mjs} +4 -4
  19. package/dist/create-Dh4LgJeT.mjs +44 -0
  20. package/dist/{create-branch-Di9ux42t.mjs → create-branch-B5SmQdFu.mjs} +4 -4
  21. package/dist/{credentials-CmfhxT15.mjs → credentials-82nFVe0P.mjs} +6 -6
  22. package/dist/{current-task-BT63IEqN.mjs → current-task-DY_7elif.mjs} +4 -4
  23. package/dist/dashboard-Dme_QP2S.mjs +20 -0
  24. package/dist/{database-Zcv6o9HD.mjs → database-nSBMJhuh.mjs} +3 -3
  25. package/dist/{db-CxjyjJjE.mjs → db-BYP3zD56.mjs} +2 -2
  26. package/dist/{delete-BOqKxL9h.mjs → delete-9gjpYGRE.mjs} +4 -4
  27. package/dist/{delete-C5R9Ovcn.mjs → delete-DBHWiGwd.mjs} +4 -4
  28. package/dist/{delete-table-CHwD8KMd.mjs → delete-table-DRHzc71J.mjs} +4 -4
  29. package/dist/{deprovision-AMoA4GJ-.mjs → deprovision-BJ3cMerU.mjs} +8 -8
  30. package/dist/{dirty-DGu-zGzj.mjs → dirty-BUP0LYch.mjs} +4 -4
  31. package/dist/{docker-JpSqfyrV.mjs → docker-DzY7_Aow.mjs} +2 -2
  32. package/dist/{eid-DOpqY6Xr.mjs → eid-B9onQRkQ.mjs} +1 -1
  33. package/dist/{export-CM4xVQtO.mjs → export-BsatTf9G.mjs} +5 -5
  34. package/dist/{field-CvvYmcqL.mjs → field-Dh2e3SYM.mjs} +1 -1
  35. package/dist/{get-B_TDKynl.mjs → get-3lHNt0M8.mjs} +4 -4
  36. package/dist/{get-BLDZmnI6.mjs → get-B7AsXBBH.mjs} +4 -4
  37. package/dist/{get-BCftPMeY.mjs → get-BbniVMyf.mjs} +4 -4
  38. package/dist/{get-CadG65Mw.mjs → get-Bpog6tab.mjs} +4 -4
  39. package/dist/{get-Bb0zpzfP.mjs → get-CMaLc1zq.mjs} +3 -3
  40. package/dist/{get-B2gUIWWn.mjs → get-CnX5hVjd.mjs} +4 -4
  41. package/dist/{get-C9hLsWZN.mjs → get-UxT_OWI0.mjs} +5 -5
  42. package/dist/get-ZNC24g90.mjs +41 -0
  43. package/dist/{get-BmNatkw0.mjs → get-wKyzyD_R.mjs} +4 -4
  44. package/dist/{has-remote-changes-jcUyn4BL.mjs → has-remote-changes-Aa_dLMOh.mjs} +4 -4
  45. package/dist/{import-DwxLbBqY.mjs → import-BCeN7uud.mjs} +5 -5
  46. package/dist/{is-dirty-Bft_2Beg.mjs → is-dirty-CaE7QtQ6.mjs} +2 -2
  47. package/dist/is-dirty-DKkQ8YC_.mjs +10 -0
  48. package/dist/items-DELa3gJh.mjs +123 -0
  49. package/dist/{license-CEf37q8h.mjs → license-BmQWehUX.mjs} +3 -3
  50. package/dist/{list-YEYFjczS.mjs → list-0lribO31.mjs} +2 -2
  51. package/dist/{list-X1BvRpvu.mjs → list-B411yWtJ.mjs} +2 -2
  52. package/dist/{list-D79qqG6n.mjs → list-C1N7AeUr.mjs} +3 -3
  53. package/dist/{list-WabdLE4S.mjs → list-CO7AK5WE.mjs} +3 -3
  54. package/dist/list-CSsPa_4t.mjs +52 -0
  55. package/dist/{list-B-etmnDB.mjs → list-CxmZEnir.mjs} +3 -3
  56. package/dist/{list-C4mEhTuI.mjs → list-D0_AKOJ4.mjs} +3 -3
  57. package/dist/{list-wflhJJRp.mjs → list-DVMVXdcU.mjs} +5 -5
  58. package/dist/{list-lMXe0ihm.mjs → list-Dt6q4HD1.mjs} +3 -3
  59. package/dist/{list-C9__j3X6.mjs → list-od0znac_.mjs} +3 -3
  60. package/dist/{login-BvZe_SH8.mjs → login-LjjWHJQo.mjs} +2 -2
  61. package/dist/{logout-DS_iumfz.mjs → logout-CUezRKVg.mjs} +2 -2
  62. package/dist/{logs-B-UEyFH2.mjs → logs-zXaUYkh9.mjs} +5 -5
  63. package/dist/{package-DHwFgisf.mjs → package-CnZUZPCL.mjs} +1 -1
  64. package/dist/{parse-id-BVuB-dYb.mjs → parse-id-NycYqVxC.mjs} +1 -1
  65. package/dist/parse-ref-CyeuK_yM.mjs +17 -0
  66. package/dist/{poll-BkPMyRGr.mjs → poll-C1Jt7bqj.mjs} +1 -1
  67. package/dist/{poll-task-8OfFZFlk.mjs → poll-task-Dr-wcPWg.mjs} +2 -2
  68. package/dist/{provision-9JcwXfaO.mjs → provision-CnZa_2C3.mjs} +8 -8
  69. package/dist/{ps-CA2yc6af.mjs → ps-B1mhQo5H.mjs} +5 -5
  70. package/dist/{ps-BtV5q-v0.mjs → ps-Blh341sA.mjs} +2 -2
  71. package/dist/{query-CwGBNXRD.mjs → query-D1l1vhbF.mjs} +3 -3
  72. package/dist/{query-D6MUf1bB.mjs → query-yrakBBQx.mjs} +3 -3
  73. package/dist/{remove-DRzzmp4L.mjs → remove-C3CyQTbr.mjs} +5 -5
  74. package/dist/{remove-D6dNO_JR.mjs → remove-QALmWEOh.mjs} +2 -2
  75. package/dist/{run-CvcTc0Ij.mjs → run-BpzLHEvE.mjs} +19 -13
  76. package/dist/{runtime-Dm9yLeT_.mjs → runtime-BwaCkLrQ.mjs} +28 -2
  77. package/dist/{search-BOESDli6.mjs → search-GNA48eAz.mjs} +5 -19
  78. package/dist/{set-HliJC97V.mjs → set-0N3cAX87.mjs} +2 -2
  79. package/dist/{set-sr3YCFCC.mjs → set-BdsOay8B.mjs} +5 -5
  80. package/dist/{setting-DRiJcVn4.mjs → setting-_TJjBNCq.mjs} +3 -3
  81. package/dist/{setup-Cw7SZEte.mjs → setup-08ROMTE7.mjs} +3 -3
  82. package/dist/{start-BlTG8xm9.mjs → start-Dg90uWo1.mjs} +7 -7
  83. package/dist/{stash-DtwiEyLc.mjs → stash-Dxq8xWen.mjs} +5 -5
  84. package/dist/{status-CQUYPa2m.mjs → status-BBlYwuBE.mjs} +2 -2
  85. package/dist/{status-CqwBiAEw.mjs → status-Cr1_d97l.mjs} +5 -5
  86. package/dist/{status-Snec_vKv.mjs → status-DLlER91p.mjs} +2 -2
  87. package/dist/{stop-ap-ezh_7.mjs → stop-Dgk8Vsac.mjs} +6 -6
  88. package/dist/sync-CPaU5-6S.mjs +26 -0
  89. package/dist/{table-CISZRlK9.mjs → table-BTG_OEIy.mjs} +2 -2
  90. package/dist/{table-Dx6KCUVC.mjs → table-y0J2_gix.mjs} +1 -1
  91. package/dist/{transform-h405NiRC.mjs → transform-BIU7znse.mjs} +12 -0
  92. package/dist/transform-job-DJjANKsX.mjs +19 -0
  93. package/dist/transform-seiBS6y8.mjs +21 -0
  94. package/dist/{translate-DsD_bI78.mjs → translate-BIVIXQ3H.mjs} +3 -3
  95. package/dist/tree-FEoP9l2L.mjs +32 -0
  96. package/dist/{update-CAhzSUHT.mjs → update-B5r42QzR.mjs} +5 -5
  97. package/dist/{update-OAfGXSV1.mjs → update-B_ul-I4N.mjs} +8 -8
  98. package/dist/{update-BS9zqDT2.mjs → update-C9kMQzXy.mjs} +4 -4
  99. package/dist/{update-DeHlwttq.mjs → update-CFy9s_77.mjs} +5 -5
  100. package/dist/{update-kh0X4VGX.mjs → update-Jd2NNiCU.mjs} +5 -5
  101. package/dist/{update-dashcard-H9G6T3zi.mjs → update-dashcard-D8ZtnP9l.mjs} +5 -5
  102. package/dist/{url-vVkeIPup.mjs → url-D6uzYfFt.mjs} +5 -5
  103. package/dist/{wait-GYWtN1mb.mjs → wait-BEwzPbQp.mjs} +5 -5
  104. package/dist/{wait-DR3UCWim.mjs → wait-D5GDYMMT.mjs} +2 -2
  105. package/dist/{wait-flags-DqDOwv0J.mjs → wait-flags--1BizxC6.mjs} +2 -2
  106. package/dist/workspace-BHG9AqFT.mjs +24 -0
  107. package/package.json +1 -1
  108. package/dist/auth-B4W4K7j-.mjs +0 -19
  109. package/dist/card-drxclrvk.mjs +0 -20
  110. package/dist/dashboard-DZvXencG.mjs +0 -20
  111. package/dist/is-dirty-DfpvMy-Z.mjs +0 -10
  112. package/dist/sync-BVrrn4wX.mjs +0 -26
  113. package/dist/transform-job-Bo1rtoXO.mjs +0 -19
  114. package/dist/transform-oFy2JltU.mjs +0 -21
  115. package/dist/workspace-DmuFl7Iw.mjs +0 -24
  116. /package/dist/{dashboard-nYIzB6gy.mjs → dashboard-BJXi1tGr.mjs} +0 -0
  117. /package/dist/{database-CqVM76jo.mjs → database-C5LkxQ5G.mjs} +0 -0
  118. /package/dist/{delete-runtime-BIDRhI6e.mjs → delete-runtime-KieND_CX.mjs} +0 -0
  119. /package/dist/{field-uWPctJqU.mjs → field-C1ai7Y05.mjs} +0 -0
  120. /package/dist/{key-DVHK0_ny.mjs → key-CS6durfH.mjs} +0 -0
  121. /package/dist/{manifest-QVMj24rH.mjs → manifest-C7lnUosz.mjs} +0 -0
  122. /package/dist/{setting-DwFQyJPi.mjs → setting-DEHSnsEV.mjs} +0 -0
  123. /package/dist/{transform-job-oBa_OKqk.mjs → transform-job-DiK7MZXZ.mjs} +0 -0
  124. /package/dist/{workspace-PL1je3wr.mjs → workspace-C8Kgp6BZ.mjs} +0 -0
  125. /package/dist/{workspace-credentials-DT-YilSB.mjs → workspace-credentials-DuTmzpvd.mjs} +0 -0
package/README.md CHANGED
@@ -403,6 +403,78 @@ cat patch.json | metabase dashboard update-dashcard 1 5
403
403
 
404
404
  The patch must contain at least one field; an empty object is rejected before the network round-trip.
405
405
 
406
+ ## Collections
407
+
408
+ Read collections on `/api/collection`. Collections are the folders that contain cards, dashboards, and other collections. The list endpoint surfaces a virtual root collection (id `"root"`) alongside regular numeric ids; the get endpoint accepts only the numeric id.
409
+
410
+ ### `metabase collection list`
411
+
412
+ ```sh
413
+ metabase collection list
414
+ metabase collection list --json
415
+ metabase collection list --filter archived --json
416
+ ```
417
+
418
+ | Flag | Description |
419
+ | ------------------- | --------------------------------------------------------------------------------------------------------------- |
420
+ | `--filter <preset>` | One of `all` (default), `archived` (returns the trash collection only), `personal` (only personal collections). |
421
+
422
+ ### `metabase collection get <id>`
423
+
424
+ `<id>` accepts any of: a positive integer collection id, the literal `root` (the virtual "Our analytics" root), the literal `trash` (the trash collection), or a 21-character entity id (NanoID). Anything else is rejected with a `ConfigError` before any HTTP call.
425
+
426
+ ```sh
427
+ metabase collection get 4
428
+ metabase collection get root --json
429
+ metabase collection get trash --json
430
+ metabase collection get voo1If9y8Sld0lXej6xl0 --json
431
+ metabase collection get 4 --json --full
432
+ ```
433
+
434
+ `--full` returns the full hydrated collection including `slug`, `entity_id`, `can_write`, `namespace`, and `personal_owner_id`. The default compact view returns `id`, `name`, `description`, `archived`, `location`, `parent_id`, `type`, `authority_level`, and `is_personal`. The root collection has a stripped-down shape — `archived`, `description`, `location`, `type`, etc. are absent rather than `null`.
435
+
436
+ ### `metabase collection items <id>`
437
+
438
+ List the cards, dashboards, sub-collections, and other content stored inside a collection. The CLI drains all pages of `/api/collection/:id/items`; pass `--limit` to cap the result. `<id>` accepts the same forms as `collection get` — including `root` for top-level content (items there have `collection_id: null`).
439
+
440
+ ```sh
441
+ metabase collection items 4
442
+ metabase collection items root --json
443
+ metabase collection items 4 --models card,dashboard --json
444
+ metabase collection items 4 --pinned-state is_pinned --json
445
+ ```
446
+
447
+ | Flag | Description |
448
+ | ------------------------ | ------------------------------------------------------------------------------------------------------------------ |
449
+ | `--models <csv>` | Restrict to one or more models (`card`, `dataset`, `metric`, `dashboard`, `snippet`, `collection`, `document`, …). |
450
+ | `--archived` | Return archived items instead of unarchived. |
451
+ | `--pinned-state <state>` | One of `all`, `is_pinned`, `is_not_pinned`. |
452
+ | `--limit <n>` | Cap total items returned. Default: drain all pages. |
453
+
454
+ ### `metabase collection tree`
455
+
456
+ Fetch the full collection hierarchy as a nested tree. Output is always JSON — the recursive structure does not render meaningfully as a key/value table.
457
+
458
+ ```sh
459
+ metabase collection tree
460
+ metabase collection tree --json
461
+ ```
462
+
463
+ ### `metabase collection create`
464
+
465
+ Create a collection from a JSON spec. The body accepts the same fields as `POST /api/collection`: `name` (required), `description`, `parent_id` (omit or `null` for the root), `namespace`, and `authority_level`.
466
+
467
+ ```sh
468
+ cat collection.json | metabase collection create
469
+ metabase collection create --file collection.json
470
+ metabase collection create --body '{"name":"My Collection","parent_id":4}'
471
+ ```
472
+
473
+ | Flag | Description |
474
+ | --------------- | --------------------------------------------------- |
475
+ | `--body <json>` | Inline JSON body. |
476
+ | `--file <path>` | Path to JSON body file. Use `-` to read from stdin. |
477
+
406
478
  ## Settings
407
479
 
408
480
  Read and write Metabase instance settings via `/api/setting`. Listing all settings requires admin privileges; per-key reads/writes additionally enforce per-setting access. Setting values are always JSON — `"main"` is the string `main`, `42` is a number, `null` deletes the override and resets the value to its default.
@@ -6,7 +6,7 @@ var api_key_default = defineCommand({
6
6
  name: "api-key",
7
7
  description: "Manage Metabase API keys"
8
8
  },
9
- subCommands: { create: () => import("./create-Dfk-Cwra.mjs").then((mod) => mod.default) }
9
+ subCommands: { create: () => import("./create-BDnl0Jwp.mjs").then((mod) => mod.default) }
10
10
  });
11
11
 
12
12
  //#endregion
@@ -1,9 +1,9 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderItem } from "./render-BYWlZPEH.mjs";
4
4
  import "./errors-C6w1eZ1F.mjs";
5
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-Dm9yLeT_.mjs";
6
- import { parseId } from "./parse-id-BVuB-dYb.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BwaCkLrQ.mjs";
6
+ import { parseId } from "./parse-id-NycYqVxC.mjs";
7
7
  import { Card, cardView } from "./card-BOGKT258.mjs";
8
8
 
9
9
  //#region src/commands/card/archive.ts
@@ -0,0 +1,19 @@
1
+ import { defineCommand } from "citty";
2
+
3
+ //#region src/commands/auth/index.ts
4
+ var auth_default = defineCommand({
5
+ meta: {
6
+ name: "auth",
7
+ description: "Authenticate against a Metabase instance"
8
+ },
9
+ default: "login",
10
+ subCommands: {
11
+ login: () => import("./login-LjjWHJQo.mjs").then((m) => m.default),
12
+ status: () => import("./status-DLlER91p.mjs").then((m) => m.default),
13
+ list: () => import("./list-B411yWtJ.mjs").then((m) => m.default),
14
+ logout: () => import("./logout-CUezRKVg.mjs").then((m) => m.default)
15
+ }
16
+ });
17
+
18
+ //#endregion
19
+ export { auth_default as default };
@@ -1,6 +1,6 @@
1
1
  import { ConfigError } from "./errors-C6w1eZ1F.mjs";
2
2
  import { readInput } from "./input-DMcm_A5s.mjs";
3
- import { parseJson } from "./runtime-Dm9yLeT_.mjs";
3
+ import { parseJson } from "./runtime-BwaCkLrQ.mjs";
4
4
 
5
5
  //#region src/runtime/body.ts
6
6
  async function readBody(sources, schema) {
@@ -1,10 +1,10 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderList } from "./render-BYWlZPEH.mjs";
4
4
  import "./errors-C6w1eZ1F.mjs";
5
- import { connectionFlags, defineMetabaseCommand, listEnvelopeSchema, outputFlags, profileFlag, wrapList } from "./runtime-Dm9yLeT_.mjs";
6
- import { REMOTE_SYNC_PATHS } from "./poll-task-8OfFZFlk.mjs";
7
- import "./poll-BkPMyRGr.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, listEnvelopeSchema, outputFlags, profileFlag, wrapList } from "./runtime-BwaCkLrQ.mjs";
6
+ import { REMOTE_SYNC_PATHS } from "./poll-task-Dr-wcPWg.mjs";
7
+ import "./poll-C1Jt7bqj.mjs";
8
8
  import { z } from "zod";
9
9
 
10
10
  //#region src/commands/sync/branches.ts
@@ -1,10 +1,10 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderItem } from "./render-BYWlZPEH.mjs";
4
4
  import "./errors-C6w1eZ1F.mjs";
5
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-Dm9yLeT_.mjs";
6
- import { REMOTE_SYNC_PATHS, SyncTask, syncTaskView } from "./poll-task-8OfFZFlk.mjs";
7
- import "./poll-BkPMyRGr.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BwaCkLrQ.mjs";
6
+ import { REMOTE_SYNC_PATHS, SyncTask, syncTaskView } from "./poll-task-Dr-wcPWg.mjs";
7
+ import "./poll-C1Jt7bqj.mjs";
8
8
 
9
9
  //#region src/commands/sync/cancel-task.ts
10
10
  var cancel_task_default = defineMetabaseCommand({
@@ -0,0 +1,20 @@
1
+ import { defineCommand } from "citty";
2
+
3
+ //#region src/commands/card/index.ts
4
+ var card_default = defineCommand({
5
+ meta: {
6
+ name: "card",
7
+ description: "Manage Metabase cards (questions, models, metrics)"
8
+ },
9
+ subCommands: {
10
+ list: () => import("./list-0lribO31.mjs").then((mod) => mod.default),
11
+ get: () => import("./get-CMaLc1zq.mjs").then((mod) => mod.default),
12
+ query: () => import("./query-D1l1vhbF.mjs").then((mod) => mod.default),
13
+ create: () => import("./create-D7dWkt38.mjs").then((mod) => mod.default),
14
+ update: () => import("./update-C9kMQzXy.mjs").then((mod) => mod.default),
15
+ archive: () => import("./archive-wT7OcMGZ.mjs").then((mod) => mod.default)
16
+ }
17
+ });
18
+
19
+ //#endregion
20
+ export { card_default as default };
@@ -1,10 +1,10 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderList } from "./render-BYWlZPEH.mjs";
4
4
  import "./errors-C6w1eZ1F.mjs";
5
- import { connectionFlags, defineMetabaseCommand, listEnvelopeSchema, outputFlags, profileFlag, wrapList } from "./runtime-Dm9yLeT_.mjs";
6
- import { parseId } from "./parse-id-BVuB-dYb.mjs";
7
- import { DashboardDetail, DashcardCompact, dashcardView } from "./dashboard-nYIzB6gy.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, listEnvelopeSchema, outputFlags, profileFlag, wrapList } from "./runtime-BwaCkLrQ.mjs";
6
+ import { parseId } from "./parse-id-NycYqVxC.mjs";
7
+ import { DashboardDetail, DashcardCompact, dashcardView } from "./dashboard-BJXi1tGr.mjs";
8
8
 
9
9
  //#region src/commands/dashboard/cards.ts
10
10
  const DashcardListEnvelope = listEnvelopeSchema(DashcardCompact);
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { package_default } from "./package-DHwFgisf.mjs";
2
+ import { package_default } from "./package-CnZUZPCL.mjs";
3
3
  import { getMetabaseAugment } from "./command-augment-D9pI9Vbh.mjs";
4
4
  import { defineCommand, renderUsage, runMain } from "citty";
5
5
 
@@ -11,24 +11,25 @@ const main = defineCommand({
11
11
  description: package_default.description
12
12
  },
13
13
  subCommands: {
14
- auth: () => import("./auth-B4W4K7j-.mjs").then((mod) => mod.default),
15
- license: () => import("./license-CEf37q8h.mjs").then((mod) => mod.default),
16
- db: () => import("./db-CxjyjJjE.mjs").then((mod) => mod.default),
17
- table: () => import("./table-CISZRlK9.mjs").then((mod) => mod.default),
18
- field: () => import("./field-CvvYmcqL.mjs").then((mod) => mod.default),
19
- card: () => import("./card-drxclrvk.mjs").then((mod) => mod.default),
20
- dashboard: () => import("./dashboard-DZvXencG.mjs").then((mod) => mod.default),
21
- transform: () => import("./transform-oFy2JltU.mjs").then((mod) => mod.default),
22
- "transform-job": () => import("./transform-job-Bo1rtoXO.mjs").then((mod) => mod.default),
23
- setting: () => import("./setting-DRiJcVn4.mjs").then((mod) => mod.default),
24
- search: () => import("./search-BOESDli6.mjs").then((mod) => mod.default),
25
- sync: () => import("./sync-BVrrn4wX.mjs").then((mod) => mod.default),
26
- workspace: () => import("./workspace-DmuFl7Iw.mjs").then((mod) => mod.default),
27
- setup: () => import("./setup-Cw7SZEte.mjs").then((mod) => mod.default),
28
- "api-key": () => import("./api-key-Cy87ZD6J.mjs").then((mod) => mod.default),
29
- eid: () => import("./eid-DOpqY6Xr.mjs").then((mod) => mod.default),
30
- query: () => import("./query-D6MUf1bB.mjs").then((mod) => mod.default),
31
- __manifest: () => import("./manifest-QVMj24rH.mjs").then((mod) => mod.createManifestCommand(main))
14
+ auth: () => import("./auth-CMAi9kxB.mjs").then((mod) => mod.default),
15
+ license: () => import("./license-BmQWehUX.mjs").then((mod) => mod.default),
16
+ db: () => import("./db-BYP3zD56.mjs").then((mod) => mod.default),
17
+ table: () => import("./table-BTG_OEIy.mjs").then((mod) => mod.default),
18
+ field: () => import("./field-Dh2e3SYM.mjs").then((mod) => mod.default),
19
+ card: () => import("./card-Cmlrb8JB.mjs").then((mod) => mod.default),
20
+ dashboard: () => import("./dashboard-Dme_QP2S.mjs").then((mod) => mod.default),
21
+ collection: () => import("./collection-Bsb32SoA.mjs").then((mod) => mod.default),
22
+ transform: () => import("./transform-seiBS6y8.mjs").then((mod) => mod.default),
23
+ "transform-job": () => import("./transform-job-DJjANKsX.mjs").then((mod) => mod.default),
24
+ setting: () => import("./setting-_TJjBNCq.mjs").then((mod) => mod.default),
25
+ search: () => import("./search-GNA48eAz.mjs").then((mod) => mod.default),
26
+ sync: () => import("./sync-CPaU5-6S.mjs").then((mod) => mod.default),
27
+ workspace: () => import("./workspace-BHG9AqFT.mjs").then((mod) => mod.default),
28
+ setup: () => import("./setup-08ROMTE7.mjs").then((mod) => mod.default),
29
+ "api-key": () => import("./api-key-BixMkWPO.mjs").then((mod) => mod.default),
30
+ eid: () => import("./eid-B9onQRkQ.mjs").then((mod) => mod.default),
31
+ query: () => import("./query-yrakBBQx.mjs").then((mod) => mod.default),
32
+ __manifest: () => import("./manifest-C7lnUosz.mjs").then((mod) => mod.createManifestCommand(main))
32
33
  }
33
34
  });
34
35
  var main_default = main;
@@ -0,0 +1,19 @@
1
+ import { defineCommand } from "citty";
2
+
3
+ //#region src/commands/collection/index.ts
4
+ var collection_default = defineCommand({
5
+ meta: {
6
+ name: "collection",
7
+ description: "Browse Metabase collections"
8
+ },
9
+ subCommands: {
10
+ list: () => import("./list-CSsPa_4t.mjs").then((mod) => mod.default),
11
+ get: () => import("./get-ZNC24g90.mjs").then((mod) => mod.default),
12
+ items: () => import("./items-DELa3gJh.mjs").then((mod) => mod.default),
13
+ tree: () => import("./tree-FEoP9l2L.mjs").then((mod) => mod.default),
14
+ create: () => import("./create-Dh4LgJeT.mjs").then((mod) => mod.default)
15
+ }
16
+ });
17
+
18
+ //#endregion
19
+ export { collection_default as default };
@@ -0,0 +1,170 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/domain/collection.ts
4
+ const CollectionId = z.union([z.number().int(), z.string()]);
5
+ const CollectionAuthorityLevel = z.enum(["official"]);
6
+ const CollectionType = z.enum([
7
+ "instance-analytics",
8
+ "trash",
9
+ "remote-synced",
10
+ "library",
11
+ "library-data",
12
+ "library-metrics",
13
+ "shared-tenant-collection",
14
+ "tenant-specific-root-collection"
15
+ ]);
16
+ const CollectionNamespace = z.enum([
17
+ "snippets",
18
+ "transforms",
19
+ "analytics",
20
+ "tenant-specific",
21
+ "shared-tenant-collection"
22
+ ]);
23
+ const COLLECTION_ITEM_MODELS = [
24
+ "card",
25
+ "dataset",
26
+ "metric",
27
+ "dashboard",
28
+ "snippet",
29
+ "collection",
30
+ "indexed-entity",
31
+ "document",
32
+ "table",
33
+ "transform",
34
+ "measure",
35
+ "pulse",
36
+ "timeline",
37
+ "no_models"
38
+ ];
39
+ const CollectionItemModel = z.enum(COLLECTION_ITEM_MODELS);
40
+ const COLLECTION_PINNED_STATES = [
41
+ "all",
42
+ "is_pinned",
43
+ "is_not_pinned"
44
+ ];
45
+ const CollectionPinnedState = z.enum(COLLECTION_PINNED_STATES);
46
+ const Collection = z.object({
47
+ id: CollectionId,
48
+ name: z.string(),
49
+ description: z.string().nullable().optional(),
50
+ archived: z.boolean().optional(),
51
+ location: z.string().nullable().optional(),
52
+ parent_id: CollectionId.nullable().optional(),
53
+ personal_owner_id: z.number().int().nullable().optional(),
54
+ is_personal: z.boolean().optional(),
55
+ authority_level: CollectionAuthorityLevel.nullable().optional(),
56
+ type: CollectionType.nullable().optional(),
57
+ namespace: CollectionNamespace.nullable().optional(),
58
+ entity_id: z.string().nullable().optional(),
59
+ slug: z.string().optional(),
60
+ can_write: z.boolean().optional()
61
+ }).loose();
62
+ const CollectionCompact = Collection.pick({
63
+ id: true,
64
+ name: true,
65
+ description: true,
66
+ archived: true,
67
+ location: true,
68
+ parent_id: true,
69
+ type: true,
70
+ authority_level: true,
71
+ is_personal: true
72
+ }).strip();
73
+ const collectionView = {
74
+ compactPick: CollectionCompact,
75
+ tableColumns: [
76
+ {
77
+ key: "id",
78
+ label: "ID"
79
+ },
80
+ {
81
+ key: "name",
82
+ label: "Name"
83
+ },
84
+ {
85
+ key: "location",
86
+ label: "Location"
87
+ },
88
+ {
89
+ key: "type",
90
+ label: "Type"
91
+ },
92
+ {
93
+ key: "authority_level",
94
+ label: "Authority"
95
+ },
96
+ {
97
+ key: "archived",
98
+ label: "Archived"
99
+ }
100
+ ]
101
+ };
102
+ const CollectionItem = z.object({
103
+ id: z.number().int(),
104
+ model: CollectionItemModel,
105
+ name: z.string(),
106
+ description: z.string().nullable().optional(),
107
+ archived: z.boolean(),
108
+ collection_id: CollectionId.nullable().optional(),
109
+ collection_position: z.number().int().nullable().optional(),
110
+ display: z.string().optional(),
111
+ location: z.string().nullable().optional(),
112
+ entity_id: z.string().nullable().optional(),
113
+ database_id: z.number().int().nullable().optional(),
114
+ dashboard_id: z.number().int().nullable().optional()
115
+ }).loose();
116
+ const CollectionItemCompact = CollectionItem.pick({
117
+ id: true,
118
+ model: true,
119
+ name: true,
120
+ description: true,
121
+ archived: true,
122
+ collection_id: true
123
+ }).strip();
124
+ const collectionItemView = {
125
+ compactPick: CollectionItemCompact,
126
+ tableColumns: [
127
+ {
128
+ key: "id",
129
+ label: "ID"
130
+ },
131
+ {
132
+ key: "model",
133
+ label: "Model"
134
+ },
135
+ {
136
+ key: "name",
137
+ label: "Name"
138
+ },
139
+ {
140
+ key: "collection_id",
141
+ label: "Collection"
142
+ },
143
+ {
144
+ key: "archived",
145
+ label: "Archived"
146
+ }
147
+ ]
148
+ };
149
+ const CollectionTreeNodeBase = z.object({
150
+ id: CollectionId,
151
+ name: z.string(),
152
+ description: z.string().nullable().optional(),
153
+ archived: z.boolean().optional(),
154
+ location: z.string().nullable().optional(),
155
+ type: CollectionType.nullable().optional(),
156
+ authority_level: CollectionAuthorityLevel.nullable().optional(),
157
+ here: z.array(CollectionItemModel).optional(),
158
+ below: z.array(CollectionItemModel).optional()
159
+ }).loose();
160
+ const CollectionTreeNode = CollectionTreeNodeBase.extend({ children: z.lazy(() => z.array(CollectionTreeNode)) });
161
+ const CollectionCreateInput = z.object({
162
+ name: z.string().min(1),
163
+ description: z.string().nullable().optional(),
164
+ parent_id: z.number().int().positive().nullable().optional(),
165
+ namespace: CollectionNamespace.nullable().optional(),
166
+ authority_level: CollectionAuthorityLevel.nullable().optional()
167
+ }).loose();
168
+
169
+ //#endregion
170
+ export { COLLECTION_ITEM_MODELS, COLLECTION_PINNED_STATES, Collection, CollectionCompact, CollectionCreateInput, CollectionItem, CollectionItemCompact, CollectionItemModel, CollectionPinnedState, CollectionTreeNode, collectionItemView, collectionView };
@@ -1,13 +1,13 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderItem } from "./render-BYWlZPEH.mjs";
4
4
  import "./errors-C6w1eZ1F.mjs";
5
5
  import "./input-DMcm_A5s.mjs";
6
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-Dm9yLeT_.mjs";
7
- import { readBody } from "./body-CGoWst5q.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BwaCkLrQ.mjs";
7
+ import { readBody } from "./body-DXXQwt3g.mjs";
8
8
  import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
9
  import { requireBothOrNeither } from "./flag-pair-Dz-mbq0z.mjs";
10
- import { parseId } from "./parse-id-BVuB-dYb.mjs";
10
+ import { parseId } from "./parse-id-NycYqVxC.mjs";
11
11
  import { z } from "zod";
12
12
 
13
13
  //#region src/domain/api-key.ts
@@ -1,12 +1,12 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderItem } from "./render-BYWlZPEH.mjs";
4
4
  import "./errors-C6w1eZ1F.mjs";
5
5
  import "./input-DMcm_A5s.mjs";
6
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-Dm9yLeT_.mjs";
7
- import { readBody } from "./body-CGoWst5q.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BwaCkLrQ.mjs";
7
+ import { readBody } from "./body-DXXQwt3g.mjs";
8
8
  import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
- import { TransformJob, TransformJobCreateInput, transformJobView } from "./transform-job-oBa_OKqk.mjs";
9
+ import { TransformJob, TransformJobCreateInput, transformJobView } from "./transform-job-DiK7MZXZ.mjs";
10
10
 
11
11
  //#region src/commands/transform-job/create.ts
12
12
  var create_default = defineMetabaseCommand({
@@ -1,13 +1,13 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderItem } from "./render-BYWlZPEH.mjs";
4
4
  import "./errors-C6w1eZ1F.mjs";
5
5
  import "./input-DMcm_A5s.mjs";
6
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-Dm9yLeT_.mjs";
7
- import { readBody } from "./body-CGoWst5q.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BwaCkLrQ.mjs";
7
+ import { readBody } from "./body-DXXQwt3g.mjs";
8
8
  import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
9
  import { preflightInternalMbql5Query, skipValidateFlag } from "./validate-query-D0aAFTUs.mjs";
10
- import { Transform, TransformCreateInput, transformView } from "./transform-h405NiRC.mjs";
10
+ import { Transform, TransformCreateInput, transformView } from "./transform-BIU7znse.mjs";
11
11
 
12
12
  //#region src/commands/transform/create.ts
13
13
  var create_default = defineMetabaseCommand({
@@ -1,12 +1,12 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderItem } from "./render-BYWlZPEH.mjs";
4
4
  import "./errors-C6w1eZ1F.mjs";
5
5
  import "./input-DMcm_A5s.mjs";
6
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-Dm9yLeT_.mjs";
7
- import { readBody } from "./body-CGoWst5q.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BwaCkLrQ.mjs";
7
+ import { readBody } from "./body-DXXQwt3g.mjs";
8
8
  import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
- import { Dashboard, DashboardCreateInput, DashboardDetail, dashboardView } from "./dashboard-nYIzB6gy.mjs";
9
+ import { Dashboard, DashboardCreateInput, DashboardDetail, dashboardView } from "./dashboard-BJXi1tGr.mjs";
10
10
 
11
11
  //#region src/commands/dashboard/create.ts
12
12
  var create_default = defineMetabaseCommand({
@@ -1,10 +1,10 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderItem } from "./render-BYWlZPEH.mjs";
4
4
  import "./errors-C6w1eZ1F.mjs";
5
5
  import "./input-DMcm_A5s.mjs";
6
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-Dm9yLeT_.mjs";
7
- import { readBody } from "./body-CGoWst5q.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BwaCkLrQ.mjs";
7
+ import { readBody } from "./body-DXXQwt3g.mjs";
8
8
  import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
9
  import { Card, CardCreateInput, cardView } from "./card-BOGKT258.mjs";
10
10
  import { preflightInternalMbql5Query, skipValidateFlag } from "./validate-query-D0aAFTUs.mjs";
@@ -1,12 +1,12 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderItem } from "./render-BYWlZPEH.mjs";
4
4
  import "./errors-C6w1eZ1F.mjs";
5
5
  import "./input-DMcm_A5s.mjs";
6
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-Dm9yLeT_.mjs";
7
- import { readBody } from "./body-CGoWst5q.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BwaCkLrQ.mjs";
7
+ import { readBody } from "./body-DXXQwt3g.mjs";
8
8
  import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
- import { Workspace, WorkspaceCreateInput, workspaceView } from "./workspace-PL1je3wr.mjs";
9
+ import { Workspace, WorkspaceCreateInput, workspaceView } from "./workspace-C8Kgp6BZ.mjs";
10
10
 
11
11
  //#region src/commands/workspace/create.ts
12
12
  var create_default = defineMetabaseCommand({
@@ -0,0 +1,44 @@
1
+ import "./package-CnZUZPCL.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-BYWlZPEH.mjs";
4
+ import "./errors-C6w1eZ1F.mjs";
5
+ import "./input-DMcm_A5s.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BwaCkLrQ.mjs";
7
+ import { readBody } from "./body-DXXQwt3g.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { Collection, CollectionCreateInput, collectionView } from "./collection-BsiGRKXh.mjs";
10
+
11
+ //#region src/commands/collection/create.ts
12
+ var create_default = defineMetabaseCommand({
13
+ meta: {
14
+ name: "create",
15
+ description: "Create a collection from a JSON spec"
16
+ },
17
+ args: {
18
+ ...outputFlags,
19
+ ...profileFlag,
20
+ ...connectionFlags,
21
+ ...bodyInputFlags
22
+ },
23
+ outputSchema: Collection,
24
+ examples: [
25
+ "cat collection.json | metabase collection create",
26
+ "metabase collection create --file collection.json",
27
+ "metabase collection create --body '{\"name\":\"My Collection\",\"parent_id\":4}'"
28
+ ],
29
+ async run({ args, ctx, getClient }) {
30
+ const body = await readBody({
31
+ flag: args.body,
32
+ file: args.file
33
+ }, CollectionCreateInput);
34
+ const client = await getClient();
35
+ const created = await client.requestParsed(Collection, "/api/collection", {
36
+ method: "POST",
37
+ body
38
+ });
39
+ renderItem(created, collectionView, ctx);
40
+ }
41
+ });
42
+
43
+ //#endregion
44
+ export { create_default as default };
@@ -1,10 +1,10 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderItem } from "./render-BYWlZPEH.mjs";
4
4
  import { ConfigError } from "./errors-C6w1eZ1F.mjs";
5
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-Dm9yLeT_.mjs";
6
- import { REMOTE_SYNC_PATHS } from "./poll-task-8OfFZFlk.mjs";
7
- import "./poll-BkPMyRGr.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-BwaCkLrQ.mjs";
6
+ import { REMOTE_SYNC_PATHS } from "./poll-task-Dr-wcPWg.mjs";
7
+ import "./poll-C1Jt7bqj.mjs";
8
8
  import { z } from "zod";
9
9
 
10
10
  //#region src/commands/sync/create-branch.ts
@@ -1,12 +1,12 @@
1
- import "./package-DHwFgisf.mjs";
1
+ import "./package-CnZUZPCL.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
3
  import { renderItem } from "./render-BYWlZPEH.mjs";
4
4
  import "./errors-C6w1eZ1F.mjs";
5
- import { defineMetabaseCommand, localUrl, outputFlags, parseJson } from "./runtime-Dm9yLeT_.mjs";
6
- import { parseId } from "./parse-id-BVuB-dYb.mjs";
7
- import "./poll-BkPMyRGr.mjs";
8
- import { checkDockerReady, readContainerCredentialsFile, requireWorkspaceContainerLocation } from "./docker-JpSqfyrV.mjs";
9
- import { WorkspaceCredentials } from "./workspace-credentials-DT-YilSB.mjs";
5
+ import { defineMetabaseCommand, localUrl, outputFlags, parseJson } from "./runtime-BwaCkLrQ.mjs";
6
+ import { parseId } from "./parse-id-NycYqVxC.mjs";
7
+ import "./poll-C1Jt7bqj.mjs";
8
+ import { checkDockerReady, readContainerCredentialsFile, requireWorkspaceContainerLocation } from "./docker-DzY7_Aow.mjs";
9
+ import { WorkspaceCredentials } from "./workspace-credentials-DuTmzpvd.mjs";
10
10
  import { z } from "zod";
11
11
 
12
12
  //#region src/commands/workspace/credentials.ts