@metabase/cli 0.1.0 → 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 (187) hide show
  1. package/README.md +972 -57
  2. package/dist/add-collection--zwkmE1S.mjs +11 -0
  3. package/dist/add-collection-B1qe0D1U.mjs +54 -0
  4. package/dist/api-key-gzCbKDjL.mjs +13 -0
  5. package/dist/archive-CitmlD1e.mjs +39 -0
  6. package/dist/{archive-CsWeHXle.mjs → archive-CnhWegtR.mjs} +7 -4
  7. package/dist/archive-DQjBOXnx.mjs +44 -0
  8. package/dist/archive-Ni8-lQ1Y.mjs +44 -0
  9. package/dist/auth-BPjsrFxM.mjs +19 -0
  10. package/dist/{body-Dv9hQ0Qk.mjs → body-DRBgxS6-.mjs} +3 -2
  11. package/dist/{branches-BujtceGr.mjs → branches-C5Jcw8wu.mjs} +8 -6
  12. package/dist/cancel-Ca3r7Y6v.mjs +56 -0
  13. package/dist/{cancel-task-CT2xUMRg.mjs → cancel-task-C1-8vDKS.mjs} +9 -7
  14. package/dist/card-BGAy3eIb.mjs +20 -0
  15. package/dist/{card-CsXk8T6A.mjs → card-CAEZWixN.mjs} +34 -15
  16. package/dist/cards-CILfMPUP.mjs +37 -0
  17. package/dist/cli.mjs +33 -14
  18. package/dist/collection-B3sPXRLs.mjs +163 -0
  19. package/dist/collection-D8cnCB98.mjs +19 -0
  20. package/dist/create-3Z6rm-4O.mjs +44 -0
  21. package/dist/create-BsY5RrVY.mjs +44 -0
  22. package/dist/create-C4OCclBD.mjs +48 -0
  23. package/dist/create-COsD7Vzm.mjs +48 -0
  24. package/dist/create-CP8ou91U.mjs +125 -0
  25. package/dist/create-CeIi_QLj.mjs +66 -0
  26. package/dist/create-CqNw6PmR.mjs +50 -0
  27. package/dist/create-DE_5NrFy.mjs +48 -0
  28. package/dist/{create-B8ektf-R.mjs → create-MEhhhgMC.mjs} +8 -6
  29. package/dist/create-QxDmleKJ.mjs +48 -0
  30. package/dist/{create-branch-goZBTNnr.mjs → create-branch-CKMYaAHk.mjs} +9 -7
  31. package/dist/credentials-CwRKvdP2.mjs +85 -0
  32. package/dist/{current-task-DBjRNCFq.mjs → current-task-Dutjys16.mjs} +9 -7
  33. package/dist/dashboard-B4fVp392.mjs +20 -0
  34. package/dist/dashboard-CnMD04PQ.mjs +163 -0
  35. package/dist/database-BMTb0CzV.mjs +17 -0
  36. package/dist/database-Dvkfy3JM.mjs +51 -0
  37. package/dist/db-ACuuaEok.mjs +22 -0
  38. package/dist/{delete-8vGU35r3.mjs → delete-BMQZuVXZ.mjs} +7 -5
  39. package/dist/{delete-B27KLF5X.mjs → delete-BvcA4jPj.mjs} +7 -5
  40. package/dist/{delete-runtime-Byr60cR3.mjs → delete-runtime-BMzvfj_B.mjs} +4 -4
  41. package/dist/{delete-table-BNaJ_gA4.mjs → delete-table-DUPjHKk4.mjs} +7 -5
  42. package/dist/deprovision-Bsc1S15j.mjs +61 -0
  43. package/dist/{dirty-aNUuph4I.mjs → dirty-CXcdoUhY.mjs} +8 -6
  44. package/dist/docker-D-ieBsP7.mjs +612 -0
  45. package/dist/eid-pvOsEMPZ.mjs +13 -0
  46. package/dist/{export-QDkuuzSE.mjs → export-BjGhLEOi.mjs} +30 -23
  47. package/dist/field-BI2bt8e9.mjs +18 -0
  48. package/dist/field-DciLbuv-.mjs +276 -0
  49. package/dist/fields-Do8HHm_T.mjs +38 -0
  50. package/dist/flag-pair-DtR1AiBQ.mjs +17 -0
  51. package/dist/{get-BGBIzMKY.mjs → get-BGFGWkH0.mjs} +6 -4
  52. package/dist/get-BmE_VHdl.mjs +36 -0
  53. package/dist/{get-DI_IJvgk.mjs → get-C7sshmqF.mjs} +6 -4
  54. package/dist/get-CObKBj2J.mjs +36 -0
  55. package/dist/get-Cq5U_Eep.mjs +40 -0
  56. package/dist/get-D4GUJBiX.mjs +41 -0
  57. package/dist/{get-COXHplHP.mjs → get-DFrsi77F.mjs} +7 -5
  58. package/dist/get-DczxeETg.mjs +53 -0
  59. package/dist/{get-Cl8-IauC.mjs → get-DeQa3ThJ.mjs} +7 -4
  60. package/dist/get-DhZ_dGUb.mjs +36 -0
  61. package/dist/{get-i6LWOByV.mjs → get-DzCVafyO.mjs} +6 -4
  62. package/dist/get-YCnVqq-z.mjs +49 -0
  63. package/dist/get-run-CTyW29s3.mjs +36 -0
  64. package/dist/git-sync-BOmT8HEU.mjs +28 -0
  65. package/dist/{has-remote-changes-hjKoQuRy.mjs → has-remote-changes-xX8vMVsX.mjs} +8 -6
  66. package/dist/{import-HJsSKRYx.mjs → import-CaAUNtXz.mjs} +11 -9
  67. package/dist/{input-Dojr-RTw.mjs → input-ikCiip6x.mjs} +2 -1
  68. package/dist/is-dirty-CPu-xqkW.mjs +10 -0
  69. package/dist/{is-dirty-1Qy7hiHB.mjs → is-dirty-mgxEwEk4.mjs} +5 -4
  70. package/dist/items-Cg67tdto.mjs +77 -0
  71. package/dist/{key-DBxPSFwi.mjs → key-NDEARu2L.mjs} +1 -1
  72. package/dist/{license-MoWse3ZI.mjs → license-CwKzVMD0.mjs} +3 -3
  73. package/dist/list-BqdNQ1nU.mjs +47 -0
  74. package/dist/list-BwGdD45N.mjs +32 -0
  75. package/dist/list-CfOVsAZz.mjs +55 -0
  76. package/dist/list-CpyNn1Zn.mjs +32 -0
  77. package/dist/list-CwwOoGLK.mjs +40 -0
  78. package/dist/{list-C_PRdL5e.mjs → list-DD8CQx8l.mjs} +7 -5
  79. package/dist/{list-Bk6RsbJl.mjs → list-DL-RWpIE.mjs} +5 -3
  80. package/dist/list-DLlq3FyS.mjs +61 -0
  81. package/dist/list-DdQ4jmUQ.mjs +52 -0
  82. package/dist/{list-C4Ajrw8f.mjs → list-DshbLoqR.mjs} +6 -3
  83. package/dist/{list-C8tdLOH5.mjs → list-DzTMpoBs.mjs} +5 -3
  84. package/dist/list-JgRtCzz3.mjs +32 -0
  85. package/dist/{list-CWt3fqrZ.mjs → list-WzgJcwB5.mjs} +5 -3
  86. package/dist/{login-C9WTwNn6.mjs → login-DJnmR2wX.mjs} +14 -5
  87. package/dist/{logout-oLszGCOg.mjs → logout-BMe_1Zp8.mjs} +7 -6
  88. package/dist/logs-CQxKJ3HG.mjs +58 -0
  89. package/dist/{manifest-CAdjQYH8.mjs → manifest-Dv5B9Blc.mjs} +3 -7
  90. package/dist/measure-BEQfnLdN.mjs +67 -0
  91. package/dist/measure-BGyYbtqO.mjs +19 -0
  92. package/dist/metadata-CLIALntn.mjs +37 -0
  93. package/dist/metadata-T-fNUWg_.mjs +38 -0
  94. package/dist/{package-BGfw4ZWJ.mjs → package-DBsS7a5x.mjs} +7 -1
  95. package/dist/paginate-CTSfuYiF.mjs +49 -0
  96. package/dist/parse-id-BUOZQqjp.mjs +12 -0
  97. package/dist/parse-ref-DGvh4aDn.mjs +17 -0
  98. package/dist/parse-schemas-BnW4T1_I.mjs +12 -0
  99. package/dist/{poll-ILanYysl.mjs → poll-DMmmZWvi.mjs} +2 -1
  100. package/dist/{poll-task-DbpsiQhl.mjs → poll-task-2Ckiwp8U.mjs} +8 -7
  101. package/dist/predicates-DiIiS3k7.mjs +153 -0
  102. package/dist/preflight-CC_g6EWU.mjs +91 -0
  103. package/dist/{prompt-DpT8yAVy.mjs → prompt-Bf3DQ-qE.mjs} +1 -1
  104. package/dist/provision-BUgWJWAV.mjs +77 -0
  105. package/dist/ps-BUNHygf-.mjs +10 -0
  106. package/dist/ps-Yv0JjLVN.mjs +78 -0
  107. package/dist/{query-PihYi-UZ.mjs → query-CzfbuG8a.mjs} +38 -13
  108. package/dist/query-UIebHmbT.mjs +90 -0
  109. package/dist/remove-BAUbcwuF.mjs +98 -0
  110. package/dist/{remove-B2hVYn1v.mjs → remove-CN2PNGTR.mjs} +6 -5
  111. package/dist/remove-collection-C6NxEh53.mjs +38 -0
  112. package/dist/render-DXv-D6fU.mjs +182 -0
  113. package/dist/rescan-values-CcB4F9qa.mjs +43 -0
  114. package/dist/revision-message-flag-CWQbKhdl.mjs +11 -0
  115. package/dist/{run-C2so6Qp6.mjs → run-BjXZtu_6.mjs} +27 -36
  116. package/dist/runs-CXx7l1NY.mjs +54 -0
  117. package/dist/{runtime-C9CEZhcn.mjs → runtime-D7jihh81.mjs} +425 -442
  118. package/dist/schema-tables-BCJT2DM_.mjs +45 -0
  119. package/dist/schemas-DlNpbn4H.mjs +47 -0
  120. package/dist/{search-CopOytXY.mjs → search-Dt-6mdHZ.mjs} +6 -19
  121. package/dist/segment-BMrUBz94.mjs +70 -0
  122. package/dist/segment-C52QNnSs.mjs +19 -0
  123. package/dist/{set-BcF7M1GQ.mjs → set-DCESWpi3.mjs} +6 -4
  124. package/dist/{set-CbibegpA.mjs → set-L7cuHjVZ.mjs} +8 -6
  125. package/dist/{setting-U3NtBMFo.mjs → setting-DysGAuYS.mjs} +3 -3
  126. package/dist/setup-_ypJDPAY.mjs +71 -0
  127. package/dist/snippet-Dw0Sjzkr.mjs +64 -0
  128. package/dist/snippet-vb3G9R8a.mjs +19 -0
  129. package/dist/start-BokXnb0V.mjs +350 -0
  130. package/dist/{stash-DOBbYozC.mjs → stash-CaGX6PfX.mjs} +9 -7
  131. package/dist/{status-Buf1ZbNR.mjs → status-BaX9vedb.mjs} +10 -8
  132. package/dist/{status-CUcs8XBH.mjs → status-CyecXzN4.mjs} +4 -2
  133. package/dist/{status-D1F5XHae.mjs → status-RpVyPEty.mjs} +4 -2
  134. package/dist/stop-BRuF_Cg1.mjs +81 -0
  135. package/dist/summary-CpEOiOlZ.mjs +41 -0
  136. package/dist/sync-schema-4Cl4h8Jn.mjs +43 -0
  137. package/dist/table-BeMWuvzO.mjs +19 -0
  138. package/dist/{table-Cfk7oSvw.mjs → table-jljEqZ0R.mjs} +22 -9
  139. package/dist/transform-DwRc-w6y.mjs +24 -0
  140. package/dist/{transform-B5uRpg1G.mjs → transform-IEX4Mx3X.mjs} +56 -2
  141. package/dist/transform-job-BigWrctt.mjs +19 -0
  142. package/dist/{transform-job-C7QXWTVE.mjs → transform-job-Csr86muI.mjs} +7 -0
  143. package/dist/translate-DqLlXXUx.mjs +111 -0
  144. package/dist/tree-BT24nkLM.mjs +32 -0
  145. package/dist/update-BCXKQi2n.mjs +52 -0
  146. package/dist/{update-CL8tRbxr.mjs → update-BXbLmC2b.mjs} +9 -7
  147. package/dist/update-C1Frz9GR.mjs +52 -0
  148. package/dist/update-C5goGhNr.mjs +56 -0
  149. package/dist/update-CCOyB0iT.mjs +73 -0
  150. package/dist/update-D04NMueX.mjs +59 -0
  151. package/dist/update-D6WVtNV1.mjs +57 -0
  152. package/dist/update-DFR46LsB.mjs +56 -0
  153. package/dist/update-DyLItrpV.mjs +56 -0
  154. package/dist/update-dashcard-av0_PYeg.mjs +71 -0
  155. package/dist/update-mrgvQF4i.mjs +51 -0
  156. package/dist/url-x4wn_l3k.mjs +54 -0
  157. package/dist/uuid-BZHbti8B.mjs +47 -0
  158. package/dist/validate-DCYx6jdL.mjs +1496 -0
  159. package/dist/validate-query-B07oGG4K.mjs +37 -0
  160. package/dist/values-Be6i0Fs9.mjs +36 -0
  161. package/dist/{wait-Bugr9eXD.mjs → wait-BMqQD8k_.mjs} +10 -8
  162. package/dist/wait-CWizX_sR.mjs +19 -0
  163. package/dist/wait-flags-DO3ar2tf.mjs +35 -0
  164. package/dist/workspace-CG1xyJ86.mjs +24 -0
  165. package/dist/workspace-DVuqKJGG.mjs +72 -0
  166. package/dist/workspace-credentials-B6BL-X0d.mjs +139 -0
  167. package/package.json +7 -1
  168. package/dist/auth-BF7IjZIH.mjs +0 -18
  169. package/dist/card-_Ta7zdYe.mjs +0 -19
  170. package/dist/create-CI2Cunq5.mjs +0 -38
  171. package/dist/create-DdbU3TLX.mjs +0 -42
  172. package/dist/database-PA9Goi25.mjs +0 -33
  173. package/dist/db-DMghzgb6.mjs +0 -17
  174. package/dist/field-C8IVs6rp.mjs +0 -76
  175. package/dist/field-DaYo_90x.mjs +0 -13
  176. package/dist/get-Cwpj7lDe.mjs +0 -35
  177. package/dist/get-Dh_acl8q.mjs +0 -34
  178. package/dist/is-dirty-DpKn9HJp.mjs +0 -8
  179. package/dist/list-CBSBHtK-.mjs +0 -38
  180. package/dist/parse-id-BhmmfyCP.mjs +0 -14
  181. package/dist/sync-BPyGXfUk.mjs +0 -26
  182. package/dist/table-D7nJt7JO.mjs +0 -16
  183. package/dist/transform-UbyewMxY.mjs +0 -21
  184. package/dist/transform-job-CrYkr-Ma.mjs +0 -19
  185. package/dist/update-DU2oU2j-.mjs +0 -49
  186. /package/dist/{body-flags-BUA9XV1u.mjs → body-flags-BK7J6Daz.mjs} +0 -0
  187. /package/dist/{setting-26ckqHAP.mjs → setting-CTaAeMci.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { Field } from "./field-C8IVs6rp.mjs";
1
+ import { Field, FieldCompact } from "./field-DciLbuv-.mjs";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/domain/table.ts
@@ -12,14 +12,16 @@ const TableEntityType = z.enum([
12
12
  "entity/EventTable"
13
13
  ]);
14
14
  const TableVisibilityType = z.enum([
15
- "details-only",
16
15
  "hidden",
17
- "normal",
18
- "retired",
19
- "sensitive",
20
16
  "technical",
21
17
  "cruft"
22
18
  ]);
19
+ const TableFieldOrder = z.enum([
20
+ "alphabetical",
21
+ "custom",
22
+ "database",
23
+ "smart"
24
+ ]);
23
25
  const Table = z.object({
24
26
  id: z.number().int(),
25
27
  name: z.string(),
@@ -28,10 +30,11 @@ const Table = z.object({
28
30
  db_id: z.number().int(),
29
31
  schema: z.string().nullable(),
30
32
  entity_type: TableEntityType.nullable(),
31
- visibility_type: TableVisibilityType.nullable(),
32
- active: z.boolean(),
33
+ visibility_type: TableVisibilityType.nullable().optional(),
34
+ active: z.boolean().optional(),
33
35
  fields: z.array(Field).optional()
34
36
  }).loose();
37
+ const TableQueryMetadata = Table.extend({ fields: z.array(Field) });
35
38
  const TableCompact = Table.pick({
36
39
  id: true,
37
40
  name: true,
@@ -40,7 +43,7 @@ const TableCompact = Table.pick({
40
43
  db_id: true,
41
44
  schema: true,
42
45
  entity_type: true
43
- }).strip();
46
+ }).strip().extend({ fields: z.array(FieldCompact).optional() });
44
47
  const tableView = {
45
48
  compactPick: TableCompact,
46
49
  tableColumns: [
@@ -70,6 +73,16 @@ const tableView = {
70
73
  }
71
74
  ]
72
75
  };
76
+ const TableUpdateInput = z.object({
77
+ display_name: z.string().min(1).optional(),
78
+ entity_type: TableEntityType.nullable().optional(),
79
+ visibility_type: TableVisibilityType.nullable().optional(),
80
+ description: z.string().nullable().optional(),
81
+ caveats: z.string().nullable().optional(),
82
+ points_of_interest: z.string().nullable().optional(),
83
+ show_in_getting_started: z.boolean().optional(),
84
+ field_order: TableFieldOrder.optional()
85
+ }).loose();
73
86
 
74
87
  //#endregion
75
- export { Table, TableCompact, tableView };
88
+ export { Table, TableCompact, TableQueryMetadata, TableUpdateInput, tableView };
@@ -0,0 +1,24 @@
1
+ import { defineCommand } from "citty";
2
+
3
+ //#region src/commands/transform/index.ts
4
+ var transform_default = defineCommand({
5
+ meta: {
6
+ name: "transform",
7
+ description: "Manage Metabase transforms"
8
+ },
9
+ subCommands: {
10
+ list: () => import("./list-WzgJcwB5.mjs").then((mod) => mod.default),
11
+ get: () => import("./get-DzCVafyO.mjs").then((mod) => mod.default),
12
+ create: () => import("./create-QxDmleKJ.mjs").then((mod) => mod.default),
13
+ update: () => import("./update-C5goGhNr.mjs").then((mod) => mod.default),
14
+ delete: () => import("./delete-BMQZuVXZ.mjs").then((mod) => mod.default),
15
+ "delete-table": () => import("./delete-table-DUPjHKk4.mjs").then((mod) => mod.default),
16
+ run: () => import("./run-BjXZtu_6.mjs").then((mod) => mod.default),
17
+ cancel: () => import("./cancel-Ca3r7Y6v.mjs").then((mod) => mod.default),
18
+ "get-run": () => import("./get-run-CTyW29s3.mjs").then((mod) => mod.default),
19
+ runs: () => import("./runs-CXx7l1NY.mjs").then((mod) => mod.default)
20
+ }
21
+ });
22
+
23
+ //#endregion
24
+ export { transform_default as default };
@@ -38,6 +38,7 @@ const TransformTableIncrementalTarget = z.object({
38
38
  name: z.string()
39
39
  }).loose();
40
40
  const TransformTarget = z.discriminatedUnion("type", [TransformTableTarget, TransformTableIncrementalTarget]);
41
+ const TransformTargetCompact = z.discriminatedUnion("type", [TransformTableTarget.strip(), TransformTableIncrementalTarget.strip()]);
41
42
  const TransformLastRun = z.object({
42
43
  id: z.number().int(),
43
44
  transform_id: z.number().int(),
@@ -59,6 +60,48 @@ const TransformRun = z.object({
59
60
  message: z.string().nullable(),
60
61
  user_id: z.number().int().nullable()
61
62
  }).loose();
63
+ const TransformRunCompact = TransformRun.pick({
64
+ id: true,
65
+ transform_id: true,
66
+ status: true,
67
+ run_method: true,
68
+ start_time: true,
69
+ end_time: true,
70
+ message: true
71
+ }).strip();
72
+ const transformRunView = {
73
+ compactPick: TransformRunCompact,
74
+ tableColumns: [
75
+ {
76
+ key: "id",
77
+ label: "Run ID"
78
+ },
79
+ {
80
+ key: "transform_id",
81
+ label: "Transform"
82
+ },
83
+ {
84
+ key: "status",
85
+ label: "Status"
86
+ },
87
+ {
88
+ key: "run_method",
89
+ label: "Method"
90
+ },
91
+ {
92
+ key: "start_time",
93
+ label: "Started"
94
+ },
95
+ {
96
+ key: "end_time",
97
+ label: "Ended"
98
+ },
99
+ {
100
+ key: "message",
101
+ label: "Message"
102
+ }
103
+ ]
104
+ };
62
105
  const Transform = z.object({
63
106
  id: z.number().int(),
64
107
  name: z.string(),
@@ -84,7 +127,7 @@ const TransformCompact = Transform.pick({
84
127
  description: true,
85
128
  source_type: true,
86
129
  target_db_id: true
87
- }).strip();
130
+ }).strip().extend({ target: TransformTargetCompact });
88
131
  const transformView = {
89
132
  compactPick: TransformCompact,
90
133
  tableColumns: [
@@ -100,6 +143,11 @@ const transformView = {
100
143
  key: "source_type",
101
144
  label: "Source"
102
145
  },
146
+ {
147
+ key: "target",
148
+ label: "Target",
149
+ format: (value) => formatTarget(value)
150
+ },
103
151
  {
104
152
  key: "target_db_id",
105
153
  label: "Target DB"
@@ -110,6 +158,12 @@ const transformView = {
110
158
  }
111
159
  ]
112
160
  };
161
+ function formatTarget(value) {
162
+ const parsed = TransformTarget.safeParse(value);
163
+ if (!parsed.success) return "";
164
+ const { schema, name } = parsed.data;
165
+ return schema ? `${schema}.${name}` : name;
166
+ }
113
167
  const TransformCreateInput = z.object({
114
168
  name: z.string().min(1),
115
169
  description: z.string().nullable().optional(),
@@ -134,4 +188,4 @@ const TransformUpdateInput = z.object({
134
188
  }).loose();
135
189
 
136
190
  //#endregion
137
- export { Transform, TransformCompact, TransformCreateInput, TransformRun, TransformUpdateInput, transformView };
191
+ export { Transform, TransformCompact, TransformCreateInput, TransformRun, TransformRunCompact, TransformUpdateInput, transformRunView, transformView };
@@ -0,0 +1,19 @@
1
+ import { defineCommand } from "citty";
2
+
3
+ //#region src/commands/transform-job/index.ts
4
+ var transform_job_default = defineCommand({
5
+ meta: {
6
+ name: "transform-job",
7
+ description: "Manage Metabase transform jobs"
8
+ },
9
+ subCommands: {
10
+ list: () => import("./list-DzTMpoBs.mjs").then((mod) => mod.default),
11
+ get: () => import("./get-BGFGWkH0.mjs").then((mod) => mod.default),
12
+ create: () => import("./create-MEhhhgMC.mjs").then((mod) => mod.default),
13
+ update: () => import("./update-BXbLmC2b.mjs").then((mod) => mod.default),
14
+ delete: () => import("./delete-BvcA4jPj.mjs").then((mod) => mod.default)
15
+ }
16
+ });
17
+
18
+ //#endregion
19
+ export { transform_job_default as default };
@@ -27,6 +27,7 @@ const TransformJob = z.object({
27
27
  description: z.string().nullable(),
28
28
  schedule: z.string(),
29
29
  ui_display_type: JobUiDisplayType,
30
+ active: z.boolean(),
30
31
  entity_id: z.string().nullable(),
31
32
  created_at: z.string(),
32
33
  updated_at: z.string(),
@@ -41,6 +42,7 @@ const TransformJobCompact = TransformJob.pick({
41
42
  description: true,
42
43
  schedule: true,
43
44
  ui_display_type: true,
45
+ active: true,
44
46
  built_in_type: true
45
47
  }).strip();
46
48
  const transformJobView = {
@@ -62,6 +64,10 @@ const transformJobView = {
62
64
  key: "ui_display_type",
63
65
  label: "Display"
64
66
  },
67
+ {
68
+ key: "active",
69
+ label: "Active"
70
+ },
65
71
  {
66
72
  key: "built_in_type",
67
73
  label: "Built-in"
@@ -84,6 +90,7 @@ const TransformJobUpdateInput = z.object({
84
90
  description: z.string().min(1).nullable().optional(),
85
91
  schedule: z.string().min(1).optional(),
86
92
  ui_display_type: JobUiDisplayType.optional(),
93
+ active: z.boolean().optional(),
87
94
  tag_ids: z.array(z.number().int().positive()).optional()
88
95
  }).loose();
89
96
 
@@ -0,0 +1,111 @@
1
+ import "./package-DBsS7a5x.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-DXv-D6fU.mjs";
4
+ import { ConfigError } from "./predicates-DiIiS3k7.mjs";
5
+ import "./input-ikCiip6x.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, parseCsv, profileFlag } from "./runtime-D7jihh81.mjs";
7
+ import { readBody } from "./body-DRBgxS6-.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { requireBothOrNeither } from "./flag-pair-DtR1AiBQ.mjs";
10
+ import { z } from "zod";
11
+
12
+ //#region src/domain/eid-translation.ts
13
+ const EID_MODELS = [
14
+ "action",
15
+ "card",
16
+ "collection",
17
+ "dashboard",
18
+ "dashboard-card",
19
+ "dashboard-tab",
20
+ "dataset",
21
+ "dimension",
22
+ "document",
23
+ "measure",
24
+ "metric",
25
+ "permissions-group",
26
+ "pulse",
27
+ "pulse-card",
28
+ "pulse-channel",
29
+ "segment",
30
+ "snippet",
31
+ "timeline",
32
+ "transform",
33
+ "user"
34
+ ];
35
+ const EidModel = z.enum(EID_MODELS);
36
+ const EidTranslateInput = z.object({ entity_ids: z.partialRecord(EidModel, z.array(z.string().min(1)).min(1)) }).loose();
37
+ const EidTranslateEntry = z.object({
38
+ status: z.string(),
39
+ type: EidModel,
40
+ id: z.number().int().optional()
41
+ }).loose();
42
+ const EidTranslateResult = z.object({ entity_ids: z.record(z.string(), EidTranslateEntry) }).loose();
43
+ const EidTranslateResultCompact = EidTranslateResult.pick({ entity_ids: true }).strip();
44
+ const eidTranslateView = {
45
+ compactPick: EidTranslateResultCompact,
46
+ tableColumns: [{
47
+ key: "entity_ids",
48
+ label: "Translated"
49
+ }]
50
+ };
51
+
52
+ //#endregion
53
+ //#region src/commands/eid/translate.ts
54
+ var translate_default = defineMetabaseCommand({
55
+ meta: {
56
+ name: "translate",
57
+ description: "Translate entity ids (EIDs) to numeric ids"
58
+ },
59
+ args: {
60
+ ...outputFlags,
61
+ ...profileFlag,
62
+ ...connectionFlags,
63
+ ...bodyInputFlags,
64
+ model: {
65
+ type: "string",
66
+ description: `Entity model for shortcut form: ${EID_MODELS.join(" | ")}`
67
+ },
68
+ eids: {
69
+ type: "string",
70
+ description: "Comma-separated EIDs (used with --model as a shortcut)"
71
+ }
72
+ },
73
+ outputSchema: EidTranslateResult,
74
+ examples: [
75
+ "metabase eid translate --model card --eids abc123XYZ,def456ABC",
76
+ "metabase eid translate --file translate.json",
77
+ "metabase eid translate --body '{\"entity_ids\":{\"card\":[\"abc123XYZ\"]}}'"
78
+ ],
79
+ async run({ args, ctx, getClient }) {
80
+ const pair = requireBothOrNeither({
81
+ name: "--model",
82
+ value: args.model
83
+ }, {
84
+ name: "--eids",
85
+ value: args.eids
86
+ });
87
+ const body = pair ? EidTranslateInput.parse({ entity_ids: { [parseModel(pair.first)]: parseEids(pair.second) } }) : await readBody({
88
+ flag: args.body,
89
+ file: args.file
90
+ }, EidTranslateInput);
91
+ const client = await getClient();
92
+ const result = await client.requestParsed(EidTranslateResult, "/api/eid-translation/translate", {
93
+ method: "POST",
94
+ body
95
+ });
96
+ renderItem(result, eidTranslateView, ctx);
97
+ }
98
+ });
99
+ function parseModel(raw) {
100
+ const result = EidModel.safeParse(raw);
101
+ if (!result.success) throw new ConfigError(`invalid --model: "${raw}" (expected one of: ${EID_MODELS.join(", ")})`);
102
+ return result.data;
103
+ }
104
+ function parseEids(raw) {
105
+ const parts = parseCsv(raw);
106
+ if (parts.length === 0) throw new ConfigError("--eids must contain at least one EID");
107
+ return parts;
108
+ }
109
+
110
+ //#endregion
111
+ export { translate_default as default };
@@ -0,0 +1,32 @@
1
+ import "./package-DBsS7a5x.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { writeJson } from "./render-DXv-D6fU.mjs";
4
+ import { ConfigError } from "./predicates-DiIiS3k7.mjs";
5
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-D7jihh81.mjs";
6
+ import { CollectionTreeNode } from "./collection-B3sPXRLs.mjs";
7
+ import { z } from "zod";
8
+
9
+ //#region src/commands/collection/tree.ts
10
+ const CollectionTreeResponse = z.array(CollectionTreeNode);
11
+ var tree_default = defineMetabaseCommand({
12
+ meta: {
13
+ name: "tree",
14
+ description: "Fetch the collection hierarchy as a nested tree (JSON only)"
15
+ },
16
+ args: {
17
+ ...outputFlags,
18
+ ...profileFlag,
19
+ ...connectionFlags
20
+ },
21
+ outputSchema: CollectionTreeResponse,
22
+ examples: ["metabase collection tree", "metabase collection tree --json"],
23
+ async run({ ctx, getClient }) {
24
+ if (ctx.format === "text") throw new ConfigError("collection tree output is JSON-only; --format text is not supported");
25
+ const client = await getClient();
26
+ const tree = await client.requestParsed(CollectionTreeResponse, "/api/collection/tree");
27
+ writeJson(tree);
28
+ }
29
+ });
30
+
31
+ //#endregion
32
+ export { tree_default as default };
@@ -0,0 +1,52 @@
1
+ import "./package-DBsS7a5x.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-DXv-D6fU.mjs";
4
+ import "./predicates-DiIiS3k7.mjs";
5
+ import "./input-ikCiip6x.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-D7jihh81.mjs";
7
+ import { readBody } from "./body-DRBgxS6-.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { parseId } from "./parse-id-BUOZQqjp.mjs";
10
+ import "./field-DciLbuv-.mjs";
11
+ import { Table, TableUpdateInput, tableView } from "./table-jljEqZ0R.mjs";
12
+
13
+ //#region src/commands/table/update.ts
14
+ var update_default = defineMetabaseCommand({
15
+ meta: {
16
+ name: "update",
17
+ description: "Update a table (display name, description, visibility, etc.)"
18
+ },
19
+ args: {
20
+ ...outputFlags,
21
+ ...profileFlag,
22
+ ...connectionFlags,
23
+ ...bodyInputFlags,
24
+ id: {
25
+ type: "positional",
26
+ description: "Table id",
27
+ required: true
28
+ }
29
+ },
30
+ outputSchema: Table,
31
+ examples: [
32
+ "metabase table update 42 --body '{\"display_name\":\"Customers\"}'",
33
+ "metabase table update 42 --file patch.json",
34
+ "cat patch.json | metabase table update 42"
35
+ ],
36
+ async run({ args, ctx, getClient }) {
37
+ const id = parseId(args.id);
38
+ const body = await readBody({
39
+ flag: args.body,
40
+ file: args.file
41
+ }, TableUpdateInput);
42
+ const client = await getClient();
43
+ const updated = await client.requestParsed(Table, `/api/table/${id}`, {
44
+ method: "PUT",
45
+ body
46
+ });
47
+ renderItem(updated, tableView, ctx);
48
+ }
49
+ });
50
+
51
+ //#endregion
52
+ export { update_default as default };
@@ -1,11 +1,13 @@
1
- import "./package-BGfw4ZWJ.mjs";
1
+ import "./package-DBsS7a5x.mjs";
2
2
  import "./command-augment-D9pI9Vbh.mjs";
3
- import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag, renderItem } from "./runtime-C9CEZhcn.mjs";
4
- import "./input-Dojr-RTw.mjs";
5
- import { parseId } from "./parse-id-BhmmfyCP.mjs";
6
- import { readBody } from "./body-Dv9hQ0Qk.mjs";
7
- import { bodyInputFlags } from "./body-flags-BUA9XV1u.mjs";
8
- import { TransformJob, TransformJobUpdateInput, transformJobView } from "./transform-job-C7QXWTVE.mjs";
3
+ import { renderItem } from "./render-DXv-D6fU.mjs";
4
+ import "./predicates-DiIiS3k7.mjs";
5
+ import "./input-ikCiip6x.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-D7jihh81.mjs";
7
+ import { readBody } from "./body-DRBgxS6-.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { parseId } from "./parse-id-BUOZQqjp.mjs";
10
+ import { TransformJob, TransformJobUpdateInput, transformJobView } from "./transform-job-Csr86muI.mjs";
9
11
 
10
12
  //#region src/commands/transform-job/update.ts
11
13
  var update_default = defineMetabaseCommand({
@@ -0,0 +1,52 @@
1
+ import "./package-DBsS7a5x.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-DXv-D6fU.mjs";
4
+ import "./predicates-DiIiS3k7.mjs";
5
+ import "./input-ikCiip6x.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-D7jihh81.mjs";
7
+ import { readBody } from "./body-DRBgxS6-.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { parseId } from "./parse-id-BUOZQqjp.mjs";
10
+ import { Snippet, SnippetUpdateInput, snippetView } from "./snippet-Dw0Sjzkr.mjs";
11
+
12
+ //#region src/commands/snippet/update.ts
13
+ var update_default = defineMetabaseCommand({
14
+ meta: {
15
+ name: "update",
16
+ description: "Update a native query snippet by id"
17
+ },
18
+ args: {
19
+ ...outputFlags,
20
+ ...profileFlag,
21
+ ...connectionFlags,
22
+ ...bodyInputFlags,
23
+ id: {
24
+ type: "positional",
25
+ description: "Snippet id",
26
+ required: true
27
+ }
28
+ },
29
+ outputSchema: Snippet,
30
+ examples: [
31
+ "cat patch.json | metabase snippet update 1",
32
+ "metabase snippet update 1 --file patch.json",
33
+ "metabase snippet update 1 --body '{\"name\":\"renamed\"}'",
34
+ "metabase snippet update 1 --body '{\"archived\":true}'"
35
+ ],
36
+ async run({ args, ctx, getClient }) {
37
+ const id = parseId(args.id);
38
+ const body = await readBody({
39
+ flag: args.body,
40
+ file: args.file
41
+ }, SnippetUpdateInput);
42
+ const client = await getClient();
43
+ const updated = await client.requestParsed(Snippet, `/api/native-query-snippet/${id}`, {
44
+ method: "PUT",
45
+ body
46
+ });
47
+ renderItem(updated, snippetView, ctx);
48
+ }
49
+ });
50
+
51
+ //#endregion
52
+ export { update_default as default };
@@ -0,0 +1,56 @@
1
+ import "./package-DBsS7a5x.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-DXv-D6fU.mjs";
4
+ import "./predicates-DiIiS3k7.mjs";
5
+ import "./input-ikCiip6x.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-D7jihh81.mjs";
7
+ import { readBody } from "./body-DRBgxS6-.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { parseId } from "./parse-id-BUOZQqjp.mjs";
10
+ import "./validate-DCYx6jdL.mjs";
11
+ import { TRANSFORM_SOURCE_QUERY_LABELS, preflightMbql5Query, skipValidateFlag } from "./validate-query-B07oGG4K.mjs";
12
+ import { Transform, TransformUpdateInput, transformView } from "./transform-IEX4Mx3X.mjs";
13
+
14
+ //#region src/commands/transform/update.ts
15
+ var update_default = defineMetabaseCommand({
16
+ meta: {
17
+ name: "update",
18
+ description: "Update a transform by id; if source is provided with type `query` and source.query is MBQL 5 (lib/type: mbql/query) it is pre-flight-validated against the same schema as `metabase query` (see `metabase query --print-schema`)"
19
+ },
20
+ args: {
21
+ ...outputFlags,
22
+ ...profileFlag,
23
+ ...connectionFlags,
24
+ ...bodyInputFlags,
25
+ id: {
26
+ type: "positional",
27
+ description: "Transform id",
28
+ required: true
29
+ },
30
+ ...skipValidateFlag
31
+ },
32
+ outputSchema: Transform,
33
+ examples: [
34
+ "cat patch.json | metabase transform update 1",
35
+ "metabase transform update 1 --file patch.json",
36
+ "metabase transform update 1 --body '{\"name\":\"renamed\"}'",
37
+ "metabase transform update 1 --file patch.json --skip-validate"
38
+ ],
39
+ async run({ args, ctx, getClient }) {
40
+ const id = parseId(args.id);
41
+ const body = await readBody({
42
+ flag: args.body,
43
+ file: args.file
44
+ }, TransformUpdateInput);
45
+ if (body.source !== void 0 && body.source.type === "query") preflightMbql5Query(body.source.query, TRANSFORM_SOURCE_QUERY_LABELS, { skip: args["skip-validate"] === true });
46
+ const client = await getClient();
47
+ const updated = await client.requestParsed(Transform, `/api/transform/${id}`, {
48
+ method: "PUT",
49
+ body
50
+ });
51
+ renderItem(updated, transformView, ctx);
52
+ }
53
+ });
54
+
55
+ //#endregion
56
+ export { update_default as default };
@@ -0,0 +1,73 @@
1
+ import "./package-DBsS7a5x.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-DXv-D6fU.mjs";
4
+ import "./predicates-DiIiS3k7.mjs";
5
+ import "./input-ikCiip6x.mjs";
6
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-D7jihh81.mjs";
7
+ import { readBody } from "./body-DRBgxS6-.mjs";
8
+ import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
9
+ import { parseId } from "./parse-id-BUOZQqjp.mjs";
10
+ import "./poll-DMmmZWvi.mjs";
11
+ import { parseWaitFlags, waitFlags } from "./wait-flags-DO3ar2tf.mjs";
12
+ import { Workspace, WorkspaceUpdateDatabaseInput, workspaceView } from "./workspace-DVuqKJGG.mjs";
13
+ import { waitForDatabaseProvisioned } from "./wait-CWizX_sR.mjs";
14
+ import { parseSchemasCsv } from "./parse-schemas-BnW4T1_I.mjs";
15
+
16
+ //#region src/commands/workspace/database/update.ts
17
+ var update_default = defineMetabaseCommand({
18
+ meta: {
19
+ name: "update",
20
+ description: "Update a workspace's database (deprovisions then re-provisions with new input schemas)"
21
+ },
22
+ args: {
23
+ ...outputFlags,
24
+ ...profileFlag,
25
+ ...connectionFlags,
26
+ ...bodyInputFlags,
27
+ ...waitFlags,
28
+ schemas: {
29
+ type: "string",
30
+ description: "Comma-separated input schemas (alternative to --body / --file)"
31
+ },
32
+ id: {
33
+ type: "positional",
34
+ description: "Workspace id",
35
+ required: true
36
+ },
37
+ "db-id": {
38
+ type: "positional",
39
+ description: "Database id",
40
+ required: true
41
+ }
42
+ },
43
+ outputSchema: Workspace,
44
+ examples: [
45
+ "metabase workspace database update 1 5 --schemas analytics,github",
46
+ "metabase workspace database update 1 5 --schemas analytics --wait",
47
+ "metabase workspace database update 1 5 --file update.json"
48
+ ],
49
+ async run({ args, ctx, getClient }) {
50
+ const workspaceId = parseId(args.id);
51
+ const databaseId = parseId(args["db-id"], "db-id");
52
+ const schemasFlag = args.schemas;
53
+ const wait = parseWaitFlags(args);
54
+ let body;
55
+ if (schemasFlag !== void 0 && schemasFlag !== "") {
56
+ const input_schemas = parseSchemasCsv(schemasFlag);
57
+ body = WorkspaceUpdateDatabaseInput.parse({ input_schemas });
58
+ } else body = await readBody({
59
+ flag: args.body,
60
+ file: args.file
61
+ }, WorkspaceUpdateDatabaseInput);
62
+ const client = await getClient();
63
+ const initial = await client.requestParsed(Workspace, `/api/ee/workspace-manager/${workspaceId}/database/${databaseId}`, {
64
+ method: "PUT",
65
+ body
66
+ });
67
+ const final = wait.enabled ? await waitForDatabaseProvisioned(client, workspaceId, databaseId, wait.schedule) : initial;
68
+ renderItem(final, workspaceView, ctx);
69
+ }
70
+ });
71
+
72
+ //#endregion
73
+ export { update_default as default };