@metabase/cli 0.1.0-alpha.workspaces-commands.818a8f1

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 (107) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +762 -0
  3. package/dist/api-key-D9XxErQn.mjs +13 -0
  4. package/dist/archive-BPG5c88Y.mjs +38 -0
  5. package/dist/auth--Hpjwlaf.mjs +18 -0
  6. package/dist/body-DwU2s6Pg.mjs +19 -0
  7. package/dist/body-flags-7oqLhu5j.mjs +14 -0
  8. package/dist/branches-BbcoJXfp.mjs +41 -0
  9. package/dist/cancel-task-BDas45YO.mjs +29 -0
  10. package/dist/card-C31pGtBZ.mjs +113 -0
  11. package/dist/card-D4zZSPUb.mjs +19 -0
  12. package/dist/cli.d.mts +1 -0
  13. package/dist/cli.mjs +61 -0
  14. package/dist/command-augment-D9pI9Vbh.mjs +11 -0
  15. package/dist/create-Bd_U1zWU.mjs +124 -0
  16. package/dist/create-CCzsCZMm.mjs +47 -0
  17. package/dist/create-CwVcoq0O.mjs +43 -0
  18. package/dist/create-DpnjQvPw.mjs +43 -0
  19. package/dist/create-_UOeEXAj.mjs +39 -0
  20. package/dist/create-branch-sDttBORB.mjs +54 -0
  21. package/dist/credentials-C0xKke5D.mjs +84 -0
  22. package/dist/current-task-BGt1mqaX.mjs +35 -0
  23. package/dist/database-4V1iiPEx.mjs +17 -0
  24. package/dist/database-BTX5qbSv.mjs +33 -0
  25. package/dist/db-Dm2u2ISJ.mjs +17 -0
  26. package/dist/delete-DRBTgyus.mjs +47 -0
  27. package/dist/delete-DUC_stoL.mjs +47 -0
  28. package/dist/delete-runtime-inOVw3IX.mjs +58 -0
  29. package/dist/delete-table-9Is631O_.mjs +47 -0
  30. package/dist/deprovision-BAMzZc6f.mjs +60 -0
  31. package/dist/dirty-CLjHbz6J.mjs +32 -0
  32. package/dist/docker-QWVMG2gl.mjs +605 -0
  33. package/dist/eid-BNhutC1U.mjs +13 -0
  34. package/dist/export-D2Anfu3p.mjs +97 -0
  35. package/dist/field-Dhs2AND3.mjs +13 -0
  36. package/dist/field-QwBMAWsq.mjs +76 -0
  37. package/dist/flag-pair-CWvvzDJ_.mjs +17 -0
  38. package/dist/get-2po1uv9i.mjs +35 -0
  39. package/dist/get-BHJA78zg.mjs +35 -0
  40. package/dist/get-CAPLfawI.mjs +35 -0
  41. package/dist/get-CAVVmdMX.mjs +49 -0
  42. package/dist/get-DDWpubE8.mjs +36 -0
  43. package/dist/get-DhIoNeOp.mjs +35 -0
  44. package/dist/get-qPOsuTPw.mjs +35 -0
  45. package/dist/has-remote-changes-DAL5jetW.mjs +63 -0
  46. package/dist/import-CUMxUfSF.mjs +92 -0
  47. package/dist/input-BNqSFl38.mjs +33 -0
  48. package/dist/is-dirty-B10S6MG0.mjs +35 -0
  49. package/dist/is-dirty-CUuq-aB6.mjs +9 -0
  50. package/dist/key-CyhOpgWt.mjs +12 -0
  51. package/dist/license-DtsGJi3l.mjs +17 -0
  52. package/dist/list-B8s7Qnzk.mjs +31 -0
  53. package/dist/list-C5MGydGU.mjs +31 -0
  54. package/dist/list-DeFGwhhJ.mjs +60 -0
  55. package/dist/list-OBx5B3gd.mjs +39 -0
  56. package/dist/list-Y7iGsOfE.mjs +31 -0
  57. package/dist/list-evtQS7jl.mjs +39 -0
  58. package/dist/list-qetY9OIN.mjs +31 -0
  59. package/dist/login-Dqw9ZtCx.mjs +172 -0
  60. package/dist/logout-DwYJ5OUi.mjs +74 -0
  61. package/dist/logs-B_lrY7Js.mjs +57 -0
  62. package/dist/manifest-wzEFG0JB.mjs +124 -0
  63. package/dist/package-t8dKf4m_.mjs +73 -0
  64. package/dist/parse-id-C1prc9US.mjs +12 -0
  65. package/dist/poll-D2sXM5rc.mjs +49 -0
  66. package/dist/poll-task-Byiunmaj.mjs +194 -0
  67. package/dist/prompt-fXeNtj0M.mjs +40 -0
  68. package/dist/provision-DC4_HWZD.mjs +80 -0
  69. package/dist/ps-1bZKIwWh.mjs +9 -0
  70. package/dist/ps-BiOrecEe.mjs +78 -0
  71. package/dist/query-BnGVGeM3.mjs +100 -0
  72. package/dist/remove-Bx48o-0S.mjs +62 -0
  73. package/dist/remove-DecoZzNd.mjs +97 -0
  74. package/dist/render-DlBijc5i.mjs +179 -0
  75. package/dist/run-D4NgvaRh.mjs +87 -0
  76. package/dist/runtime-DUgFfYkN.mjs +950 -0
  77. package/dist/search-4wKx5ug2.mjs +171 -0
  78. package/dist/set-BZnCRL4c.mjs +66 -0
  79. package/dist/set-DCjrmTFm.mjs +66 -0
  80. package/dist/setting-C4vQSqer.mjs +18 -0
  81. package/dist/setting-DM7pm7yh.mjs +55 -0
  82. package/dist/setup-Dqh9hN6l.mjs +70 -0
  83. package/dist/start-xXQypG5L.mjs +324 -0
  84. package/dist/stash-ZZkmW_V7.mjs +106 -0
  85. package/dist/status-9KAPIpX8.mjs +31 -0
  86. package/dist/status-DezF-PIM.mjs +63 -0
  87. package/dist/status-JH6BZppo.mjs +55 -0
  88. package/dist/stop-br-ZOnve.mjs +80 -0
  89. package/dist/sync-C7VOWD00.mjs +26 -0
  90. package/dist/table-BvAr2ixC.mjs +75 -0
  91. package/dist/table-D-Mb5Nvw.mjs +16 -0
  92. package/dist/transform-CqxZwhGs.mjs +21 -0
  93. package/dist/transform-DfVkUttP.mjs +137 -0
  94. package/dist/transform-job-DuB_OjhO.mjs +91 -0
  95. package/dist/transform-job-HjbqjEoP.mjs +19 -0
  96. package/dist/translate-DJxDVAE4.mjs +110 -0
  97. package/dist/update-CDtm71m2.mjs +50 -0
  98. package/dist/update-DYVeVjk2.mjs +76 -0
  99. package/dist/update-DxKlQ0hP.mjs +50 -0
  100. package/dist/url-DP88YHNo.mjs +53 -0
  101. package/dist/wait-Cj_8wu4y.mjs +52 -0
  102. package/dist/wait-DwZN3ZwR.mjs +19 -0
  103. package/dist/wait-flags-CjW4ogUJ.mjs +35 -0
  104. package/dist/workspace-CbwR0vX_.mjs +24 -0
  105. package/dist/workspace-Dr9lWU3D.mjs +72 -0
  106. package/dist/workspace-credentials-q5RRFMT8.mjs +139 -0
  107. package/package.json +62 -0
@@ -0,0 +1,75 @@
1
+ import { Field } from "./field-QwBMAWsq.mjs";
2
+ import { z } from "zod";
3
+
4
+ //#region src/domain/table.ts
5
+ const TableEntityType = z.enum([
6
+ "entity/GenericTable",
7
+ "entity/UserTable",
8
+ "entity/CompanyTable",
9
+ "entity/TransactionTable",
10
+ "entity/ProductTable",
11
+ "entity/SubscriptionTable",
12
+ "entity/EventTable"
13
+ ]);
14
+ const TableVisibilityType = z.enum([
15
+ "details-only",
16
+ "hidden",
17
+ "normal",
18
+ "retired",
19
+ "sensitive",
20
+ "technical",
21
+ "cruft"
22
+ ]);
23
+ const Table = z.object({
24
+ id: z.number().int(),
25
+ name: z.string(),
26
+ display_name: z.string(),
27
+ description: z.string().nullable(),
28
+ db_id: z.number().int(),
29
+ schema: z.string().nullable(),
30
+ entity_type: TableEntityType.nullable(),
31
+ visibility_type: TableVisibilityType.nullable(),
32
+ active: z.boolean(),
33
+ fields: z.array(Field).optional()
34
+ }).loose();
35
+ const TableCompact = Table.pick({
36
+ id: true,
37
+ name: true,
38
+ display_name: true,
39
+ description: true,
40
+ db_id: true,
41
+ schema: true,
42
+ entity_type: true
43
+ }).strip();
44
+ const tableView = {
45
+ compactPick: TableCompact,
46
+ tableColumns: [
47
+ {
48
+ key: "id",
49
+ label: "ID"
50
+ },
51
+ {
52
+ key: "db_id",
53
+ label: "DB"
54
+ },
55
+ {
56
+ key: "schema",
57
+ label: "Schema"
58
+ },
59
+ {
60
+ key: "name",
61
+ label: "Name"
62
+ },
63
+ {
64
+ key: "display_name",
65
+ label: "Display Name"
66
+ },
67
+ {
68
+ key: "description",
69
+ label: "Description"
70
+ }
71
+ ]
72
+ };
73
+
74
+ //#endregion
75
+ export { Table, TableCompact, tableView };
@@ -0,0 +1,16 @@
1
+ import { defineCommand } from "citty";
2
+
3
+ //#region src/commands/table/index.ts
4
+ var table_default = defineCommand({
5
+ meta: {
6
+ name: "table",
7
+ description: "Inspect Metabase tables"
8
+ },
9
+ subCommands: {
10
+ list: () => import("./list-OBx5B3gd.mjs").then((m) => m.default),
11
+ get: () => import("./get-DDWpubE8.mjs").then((m) => m.default)
12
+ }
13
+ });
14
+
15
+ //#endregion
16
+ export { table_default as default };
@@ -0,0 +1,21 @@
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-qetY9OIN.mjs").then((mod) => mod.default),
11
+ get: () => import("./get-qPOsuTPw.mjs").then((mod) => mod.default),
12
+ create: () => import("./create-_UOeEXAj.mjs").then((mod) => mod.default),
13
+ update: () => import("./update-CDtm71m2.mjs").then((mod) => mod.default),
14
+ delete: () => import("./delete-DRBTgyus.mjs").then((mod) => mod.default),
15
+ "delete-table": () => import("./delete-table-9Is631O_.mjs").then((mod) => mod.default),
16
+ run: () => import("./run-D4NgvaRh.mjs").then((mod) => mod.default)
17
+ }
18
+ });
19
+
20
+ //#endregion
21
+ export { transform_default as default };
@@ -0,0 +1,137 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/domain/transform.ts
4
+ const TransformSourceType = z.enum([
5
+ "native",
6
+ "mbql",
7
+ "python"
8
+ ]);
9
+ const TransformRunStatus = z.enum([
10
+ "started",
11
+ "succeeded",
12
+ "failed",
13
+ "timeout",
14
+ "canceled",
15
+ "canceling"
16
+ ]);
17
+ const TransformRunMethod = z.enum(["manual", "cron"]);
18
+ const TransformRunTrigger = z.enum(["none", "global-schedule"]);
19
+ const TransformQuerySource = z.object({
20
+ type: z.literal("query"),
21
+ query: z.unknown()
22
+ }).loose();
23
+ const TransformPythonSource = z.object({
24
+ type: z.literal("python"),
25
+ body: z.string()
26
+ }).loose();
27
+ const TransformSource = z.discriminatedUnion("type", [TransformQuerySource, TransformPythonSource]);
28
+ const TransformTableTarget = z.object({
29
+ type: z.literal("table"),
30
+ database: z.number().int().optional(),
31
+ schema: z.string().nullable().optional(),
32
+ name: z.string()
33
+ }).loose();
34
+ const TransformTableIncrementalTarget = z.object({
35
+ type: z.literal("table-incremental"),
36
+ database: z.number().int().optional(),
37
+ schema: z.string().nullable().optional(),
38
+ name: z.string()
39
+ }).loose();
40
+ const TransformTarget = z.discriminatedUnion("type", [TransformTableTarget, TransformTableIncrementalTarget]);
41
+ const TransformLastRun = z.object({
42
+ id: z.number().int(),
43
+ transform_id: z.number().int(),
44
+ run_method: TransformRunMethod,
45
+ status: TransformRunStatus,
46
+ start_time: z.string(),
47
+ end_time: z.string().nullable().optional(),
48
+ message: z.string().nullable(),
49
+ user_id: z.number().int().nullable()
50
+ }).loose();
51
+ const TransformRun = z.object({
52
+ id: z.number().int(),
53
+ transform_id: z.number().int().nullable(),
54
+ run_method: TransformRunMethod,
55
+ status: TransformRunStatus,
56
+ is_active: z.boolean().nullable(),
57
+ start_time: z.string(),
58
+ end_time: z.string().nullable().optional(),
59
+ message: z.string().nullable(),
60
+ user_id: z.number().int().nullable()
61
+ }).loose();
62
+ const Transform = z.object({
63
+ id: z.number().int(),
64
+ name: z.string(),
65
+ description: z.string().nullable(),
66
+ source: TransformSource,
67
+ target: TransformTarget,
68
+ source_type: TransformSourceType,
69
+ source_database_id: z.number().int().nullable().optional(),
70
+ target_db_id: z.number().int().nullable().optional(),
71
+ target_table_id: z.number().int().nullable().optional(),
72
+ entity_id: z.string().nullable(),
73
+ created_at: z.string(),
74
+ updated_at: z.string(),
75
+ creator_id: z.number().int(),
76
+ collection_id: z.number().int().nullable(),
77
+ run_trigger: TransformRunTrigger.nullable().optional(),
78
+ last_run: TransformLastRun.nullable().optional(),
79
+ tag_ids: z.array(z.number().int()).optional()
80
+ }).loose();
81
+ const TransformCompact = Transform.pick({
82
+ id: true,
83
+ name: true,
84
+ description: true,
85
+ source_type: true,
86
+ target_db_id: true
87
+ }).strip();
88
+ const transformView = {
89
+ compactPick: TransformCompact,
90
+ tableColumns: [
91
+ {
92
+ key: "id",
93
+ label: "ID"
94
+ },
95
+ {
96
+ key: "name",
97
+ label: "Name"
98
+ },
99
+ {
100
+ key: "source_type",
101
+ label: "Source"
102
+ },
103
+ {
104
+ key: "target_db_id",
105
+ label: "Target DB"
106
+ },
107
+ {
108
+ key: "description",
109
+ label: "Description"
110
+ }
111
+ ]
112
+ };
113
+ const TransformCreateInput = z.object({
114
+ name: z.string().min(1),
115
+ description: z.string().nullable().optional(),
116
+ source: TransformSource,
117
+ target: TransformTarget,
118
+ run_trigger: TransformRunTrigger.optional(),
119
+ tag_ids: z.array(z.number().int().positive()).optional(),
120
+ collection_id: z.number().int().positive().nullable().optional(),
121
+ owner_user_id: z.number().int().positive().nullable().optional(),
122
+ owner_email: z.string().nullable().optional()
123
+ }).loose();
124
+ const TransformUpdateInput = z.object({
125
+ name: z.string().min(1).optional(),
126
+ description: z.string().nullable().optional(),
127
+ source: TransformSource.optional(),
128
+ target: TransformTarget.optional(),
129
+ run_trigger: TransformRunTrigger.optional(),
130
+ tag_ids: z.array(z.number().int().positive()).optional(),
131
+ collection_id: z.number().int().positive().nullable().optional(),
132
+ owner_user_id: z.number().int().positive().nullable().optional(),
133
+ owner_email: z.string().nullable().optional()
134
+ }).loose();
135
+
136
+ //#endregion
137
+ export { Transform, TransformCompact, TransformCreateInput, TransformRun, TransformUpdateInput, transformView };
@@ -0,0 +1,91 @@
1
+ import { z } from "zod";
2
+
3
+ //#region src/domain/transform-job.ts
4
+ const JobUiDisplayType = z.enum(["cron/raw", "cron/builder"]);
5
+ const JobRunStatus = z.enum([
6
+ "started",
7
+ "succeeded",
8
+ "failed",
9
+ "timeout"
10
+ ]);
11
+ const JobRunMethod = z.enum(["manual", "cron"]);
12
+ const JobLastRun = z.object({
13
+ id: z.number().int(),
14
+ job_id: z.number().int(),
15
+ run_method: JobRunMethod,
16
+ status: JobRunStatus,
17
+ start_time: z.string(),
18
+ end_time: z.string().nullable().optional(),
19
+ message: z.string().nullable(),
20
+ created_at: z.string(),
21
+ updated_at: z.string()
22
+ }).loose();
23
+ const JobNextRun = z.object({ start_time: z.string() }).loose();
24
+ const TransformJob = z.object({
25
+ id: z.number().int(),
26
+ name: z.string(),
27
+ description: z.string().nullable(),
28
+ schedule: z.string(),
29
+ ui_display_type: JobUiDisplayType,
30
+ entity_id: z.string().nullable(),
31
+ created_at: z.string(),
32
+ updated_at: z.string(),
33
+ built_in_type: z.string().nullable().optional(),
34
+ tag_ids: z.array(z.number().int()).optional(),
35
+ last_run: JobLastRun.nullable().optional(),
36
+ next_run: JobNextRun.nullable().optional()
37
+ }).loose();
38
+ const TransformJobCompact = TransformJob.pick({
39
+ id: true,
40
+ name: true,
41
+ description: true,
42
+ schedule: true,
43
+ ui_display_type: true,
44
+ built_in_type: true
45
+ }).strip();
46
+ const transformJobView = {
47
+ compactPick: TransformJobCompact,
48
+ tableColumns: [
49
+ {
50
+ key: "id",
51
+ label: "ID"
52
+ },
53
+ {
54
+ key: "name",
55
+ label: "Name"
56
+ },
57
+ {
58
+ key: "schedule",
59
+ label: "Schedule"
60
+ },
61
+ {
62
+ key: "ui_display_type",
63
+ label: "Display"
64
+ },
65
+ {
66
+ key: "built_in_type",
67
+ label: "Built-in"
68
+ },
69
+ {
70
+ key: "description",
71
+ label: "Description"
72
+ }
73
+ ]
74
+ };
75
+ const TransformJobCreateInput = z.object({
76
+ name: z.string().min(1),
77
+ description: z.string().min(1).nullable().optional(),
78
+ schedule: z.string().min(1),
79
+ ui_display_type: JobUiDisplayType.optional(),
80
+ tag_ids: z.array(z.number().int().positive()).optional()
81
+ }).loose();
82
+ const TransformJobUpdateInput = z.object({
83
+ name: z.string().min(1).optional(),
84
+ description: z.string().min(1).nullable().optional(),
85
+ schedule: z.string().min(1).optional(),
86
+ ui_display_type: JobUiDisplayType.optional(),
87
+ tag_ids: z.array(z.number().int().positive()).optional()
88
+ }).loose();
89
+
90
+ //#endregion
91
+ export { TransformJob, TransformJobCompact, TransformJobCreateInput, TransformJobUpdateInput, transformJobView };
@@ -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-C5MGydGU.mjs").then((mod) => mod.default),
11
+ get: () => import("./get-DhIoNeOp.mjs").then((mod) => mod.default),
12
+ create: () => import("./create-DpnjQvPw.mjs").then((mod) => mod.default),
13
+ update: () => import("./update-DxKlQ0hP.mjs").then((mod) => mod.default),
14
+ delete: () => import("./delete-DUC_stoL.mjs").then((mod) => mod.default)
15
+ }
16
+ });
17
+
18
+ //#endregion
19
+ export { transform_job_default as default };
@@ -0,0 +1,110 @@
1
+ import "./package-t8dKf4m_.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-DlBijc5i.mjs";
4
+ import { ConfigError, connectionFlags, defineMetabaseCommand, outputFlags, parseCsv, profileFlag } from "./runtime-DUgFfYkN.mjs";
5
+ import "./input-BNqSFl38.mjs";
6
+ import { readBody } from "./body-DwU2s6Pg.mjs";
7
+ import { bodyInputFlags } from "./body-flags-7oqLhu5j.mjs";
8
+ import { requireBothOrNeither } from "./flag-pair-CWvvzDJ_.mjs";
9
+ import { z } from "zod";
10
+
11
+ //#region src/domain/eid-translation.ts
12
+ const EID_MODELS = [
13
+ "action",
14
+ "card",
15
+ "collection",
16
+ "dashboard",
17
+ "dashboard-card",
18
+ "dashboard-tab",
19
+ "dataset",
20
+ "dimension",
21
+ "document",
22
+ "measure",
23
+ "metric",
24
+ "permissions-group",
25
+ "pulse",
26
+ "pulse-card",
27
+ "pulse-channel",
28
+ "segment",
29
+ "snippet",
30
+ "timeline",
31
+ "transform",
32
+ "user"
33
+ ];
34
+ const EidModel = z.enum(EID_MODELS);
35
+ const EidTranslateInput = z.object({ entity_ids: z.partialRecord(EidModel, z.array(z.string().min(1)).min(1)) }).loose();
36
+ const EidTranslateEntry = z.object({
37
+ status: z.string(),
38
+ type: EidModel,
39
+ id: z.number().int().optional()
40
+ }).loose();
41
+ const EidTranslateResult = z.object({ entity_ids: z.record(z.string(), EidTranslateEntry) }).loose();
42
+ const EidTranslateResultCompact = EidTranslateResult.pick({ entity_ids: true }).strip();
43
+ const eidTranslateView = {
44
+ compactPick: EidTranslateResultCompact,
45
+ tableColumns: [{
46
+ key: "entity_ids",
47
+ label: "Translated"
48
+ }]
49
+ };
50
+
51
+ //#endregion
52
+ //#region src/commands/eid/translate.ts
53
+ var translate_default = defineMetabaseCommand({
54
+ meta: {
55
+ name: "translate",
56
+ description: "Translate entity ids (EIDs) to numeric ids"
57
+ },
58
+ args: {
59
+ ...outputFlags,
60
+ ...profileFlag,
61
+ ...connectionFlags,
62
+ ...bodyInputFlags,
63
+ model: {
64
+ type: "string",
65
+ description: `Entity model for shortcut form: ${EID_MODELS.join(" | ")}`
66
+ },
67
+ eids: {
68
+ type: "string",
69
+ description: "Comma-separated EIDs (used with --model as a shortcut)"
70
+ }
71
+ },
72
+ outputSchema: EidTranslateResult,
73
+ examples: [
74
+ "metabase eid translate --model card --eids abc123XYZ,def456ABC",
75
+ "metabase eid translate --file translate.json",
76
+ "metabase eid translate --body '{\"entity_ids\":{\"card\":[\"abc123XYZ\"]}}'"
77
+ ],
78
+ async run({ args, ctx, getClient }) {
79
+ const pair = requireBothOrNeither({
80
+ name: "--model",
81
+ value: args.model
82
+ }, {
83
+ name: "--eids",
84
+ value: args.eids
85
+ });
86
+ const body = pair ? EidTranslateInput.parse({ entity_ids: { [parseModel(pair.first)]: parseEids(pair.second) } }) : await readBody({
87
+ flag: args.body,
88
+ file: args.file
89
+ }, EidTranslateInput);
90
+ const client = await getClient();
91
+ const result = await client.requestParsed(EidTranslateResult, "/api/eid-translation/translate", {
92
+ method: "POST",
93
+ body
94
+ });
95
+ renderItem(result, eidTranslateView, ctx);
96
+ }
97
+ });
98
+ function parseModel(raw) {
99
+ const result = EidModel.safeParse(raw);
100
+ if (!result.success) throw new ConfigError(`invalid --model: "${raw}" (expected one of: ${EID_MODELS.join(", ")})`);
101
+ return result.data;
102
+ }
103
+ function parseEids(raw) {
104
+ const parts = parseCsv(raw);
105
+ if (parts.length === 0) throw new ConfigError("--eids must contain at least one EID");
106
+ return parts;
107
+ }
108
+
109
+ //#endregion
110
+ export { translate_default as default };
@@ -0,0 +1,50 @@
1
+ import "./package-t8dKf4m_.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-DlBijc5i.mjs";
4
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DUgFfYkN.mjs";
5
+ import "./input-BNqSFl38.mjs";
6
+ import { readBody } from "./body-DwU2s6Pg.mjs";
7
+ import { bodyInputFlags } from "./body-flags-7oqLhu5j.mjs";
8
+ import { parseId } from "./parse-id-C1prc9US.mjs";
9
+ import { Transform, TransformUpdateInput, transformView } from "./transform-DfVkUttP.mjs";
10
+
11
+ //#region src/commands/transform/update.ts
12
+ var update_default = defineMetabaseCommand({
13
+ meta: {
14
+ name: "update",
15
+ description: "Update a transform by id"
16
+ },
17
+ args: {
18
+ ...outputFlags,
19
+ ...profileFlag,
20
+ ...connectionFlags,
21
+ ...bodyInputFlags,
22
+ id: {
23
+ type: "positional",
24
+ description: "Transform id",
25
+ required: true
26
+ }
27
+ },
28
+ outputSchema: Transform,
29
+ examples: [
30
+ "cat patch.json | metabase transform update 1",
31
+ "metabase transform update 1 --file patch.json",
32
+ "metabase transform update 1 --body '{\"name\":\"renamed\"}'"
33
+ ],
34
+ async run({ args, ctx, getClient }) {
35
+ const id = parseId(args.id);
36
+ const body = await readBody({
37
+ flag: args.body,
38
+ file: args.file
39
+ }, TransformUpdateInput);
40
+ const client = await getClient();
41
+ const updated = await client.requestParsed(Transform, `/api/transform/${id}`, {
42
+ method: "PUT",
43
+ body
44
+ });
45
+ renderItem(updated, transformView, ctx);
46
+ }
47
+ });
48
+
49
+ //#endregion
50
+ export { update_default as default };
@@ -0,0 +1,76 @@
1
+ import "./package-t8dKf4m_.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-DlBijc5i.mjs";
4
+ import { ConfigError, connectionFlags, defineMetabaseCommand, outputFlags, parseCsv, profileFlag } from "./runtime-DUgFfYkN.mjs";
5
+ import "./input-BNqSFl38.mjs";
6
+ import { readBody } from "./body-DwU2s6Pg.mjs";
7
+ import { bodyInputFlags } from "./body-flags-7oqLhu5j.mjs";
8
+ import { parseId } from "./parse-id-C1prc9US.mjs";
9
+ import "./poll-D2sXM5rc.mjs";
10
+ import { parseWaitFlags, waitFlags } from "./wait-flags-CjW4ogUJ.mjs";
11
+ import { Workspace, WorkspaceUpdateDatabaseInput, workspaceView } from "./workspace-Dr9lWU3D.mjs";
12
+ import { waitForDatabaseProvisioned } from "./wait-DwZN3ZwR.mjs";
13
+
14
+ //#region src/commands/workspace/database/update.ts
15
+ var update_default = defineMetabaseCommand({
16
+ meta: {
17
+ name: "update",
18
+ description: "Update a workspace's database (deprovisions then re-provisions with new input schemas)"
19
+ },
20
+ args: {
21
+ ...outputFlags,
22
+ ...profileFlag,
23
+ ...connectionFlags,
24
+ ...bodyInputFlags,
25
+ ...waitFlags,
26
+ schemas: {
27
+ type: "string",
28
+ description: "Comma-separated input schemas (alternative to --body / --file)"
29
+ },
30
+ id: {
31
+ type: "positional",
32
+ description: "Workspace id",
33
+ required: true
34
+ },
35
+ "db-id": {
36
+ type: "positional",
37
+ description: "Database id",
38
+ required: true
39
+ }
40
+ },
41
+ outputSchema: Workspace,
42
+ examples: [
43
+ "metabase workspace database update 1 5 --schemas analytics,github",
44
+ "metabase workspace database update 1 5 --schemas analytics --wait",
45
+ "metabase workspace database update 1 5 --file update.json"
46
+ ],
47
+ async run({ args, ctx, getClient }) {
48
+ const workspaceId = parseId(args.id);
49
+ const databaseId = parseId(args["db-id"], "db-id");
50
+ const schemasFlag = args.schemas;
51
+ const wait = parseWaitFlags(args);
52
+ let body;
53
+ if (schemasFlag !== void 0 && schemasFlag !== "") {
54
+ const schemas = parseSchemas(schemasFlag);
55
+ body = WorkspaceUpdateDatabaseInput.parse({ input_schemas: schemas });
56
+ } else body = await readBody({
57
+ flag: args.body,
58
+ file: args.file
59
+ }, WorkspaceUpdateDatabaseInput);
60
+ const client = await getClient();
61
+ const initial = await client.requestParsed(Workspace, `/api/ee/workspace-manager/${workspaceId}/database/${databaseId}`, {
62
+ method: "PUT",
63
+ body
64
+ });
65
+ const final = wait.enabled ? await waitForDatabaseProvisioned(client, workspaceId, databaseId, wait.schedule) : initial;
66
+ renderItem(final, workspaceView, ctx);
67
+ }
68
+ });
69
+ function parseSchemas(raw) {
70
+ const parts = parseCsv(raw);
71
+ if (parts.length === 0) throw new ConfigError("--schemas must contain at least one schema name");
72
+ return parts;
73
+ }
74
+
75
+ //#endregion
76
+ export { update_default as default };
@@ -0,0 +1,50 @@
1
+ import "./package-t8dKf4m_.mjs";
2
+ import "./command-augment-D9pI9Vbh.mjs";
3
+ import { renderItem } from "./render-DlBijc5i.mjs";
4
+ import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-DUgFfYkN.mjs";
5
+ import "./input-BNqSFl38.mjs";
6
+ import { readBody } from "./body-DwU2s6Pg.mjs";
7
+ import { bodyInputFlags } from "./body-flags-7oqLhu5j.mjs";
8
+ import { parseId } from "./parse-id-C1prc9US.mjs";
9
+ import { TransformJob, TransformJobUpdateInput, transformJobView } from "./transform-job-DuB_OjhO.mjs";
10
+
11
+ //#region src/commands/transform-job/update.ts
12
+ var update_default = defineMetabaseCommand({
13
+ meta: {
14
+ name: "update",
15
+ description: "Update a transform job by id"
16
+ },
17
+ args: {
18
+ ...outputFlags,
19
+ ...profileFlag,
20
+ ...connectionFlags,
21
+ ...bodyInputFlags,
22
+ id: {
23
+ type: "positional",
24
+ description: "Transform job id",
25
+ required: true
26
+ }
27
+ },
28
+ outputSchema: TransformJob,
29
+ examples: [
30
+ "cat patch.json | metabase transform-job update 1",
31
+ "metabase transform-job update 1 --file patch.json",
32
+ "metabase transform-job update 1 --body '{\"schedule\":\"0 0 6 * * ?\"}'"
33
+ ],
34
+ async run({ args, ctx, getClient }) {
35
+ const id = parseId(args.id);
36
+ const body = await readBody({
37
+ flag: args.body,
38
+ file: args.file
39
+ }, TransformJobUpdateInput);
40
+ const client = await getClient();
41
+ const updated = await client.requestParsed(TransformJob, `/api/transform-job/${id}`, {
42
+ method: "PUT",
43
+ body
44
+ });
45
+ renderItem(updated, transformJobView, ctx);
46
+ }
47
+ });
48
+
49
+ //#endregion
50
+ export { update_default as default };