@metabase/cli 0.1.0 → 0.1.2
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.
- package/README.md +972 -57
- package/dist/add-collection-DwxQDXzL.mjs +54 -0
- package/dist/add-collection-SL08iMub.mjs +11 -0
- package/dist/api-key-BktzvPb7.mjs +13 -0
- package/dist/{archive-CsWeHXle.mjs → archive-C1mF-9Kj.mjs} +7 -4
- package/dist/archive-CLWtbvvH.mjs +44 -0
- package/dist/archive-Cq4WKmJt.mjs +44 -0
- package/dist/archive-kYoy5LK5.mjs +39 -0
- package/dist/auth-DfYkakP3.mjs +19 -0
- package/dist/{body-Dv9hQ0Qk.mjs → body-rDrR-C1c.mjs} +3 -2
- package/dist/{branches-BujtceGr.mjs → branches-CH2UcCpX.mjs} +8 -6
- package/dist/cancel-CgLZcItQ.mjs +56 -0
- package/dist/{cancel-task-CT2xUMRg.mjs → cancel-task-DcYrFsM6.mjs} +9 -7
- package/dist/{card-CsXk8T6A.mjs → card-CQxvHeyP.mjs} +34 -15
- package/dist/card-ZCGU2JEh.mjs +20 -0
- package/dist/cards-C4NIaERo.mjs +37 -0
- package/dist/cli.mjs +33 -14
- package/dist/collection-B3sPXRLs.mjs +163 -0
- package/dist/collection-D_uFLIAS.mjs +19 -0
- package/dist/create-BUCLNqiN.mjs +48 -0
- package/dist/create-CB0Yp__0.mjs +66 -0
- package/dist/create-CNvd5T8h.mjs +48 -0
- package/dist/create-Cbh1cGj9.mjs +48 -0
- package/dist/create-CzfNOhOF.mjs +48 -0
- package/dist/create-DU0ZhnZu.mjs +44 -0
- package/dist/create-Dh0p-c2Y.mjs +44 -0
- package/dist/create-DvrVZ2hS.mjs +125 -0
- package/dist/create-QgN369N5.mjs +50 -0
- package/dist/{create-B8ektf-R.mjs → create-bqc_rmix.mjs} +8 -6
- package/dist/{create-branch-goZBTNnr.mjs → create-branch-BJFH9Hda.mjs} +9 -7
- package/dist/credentials-DTP1xuKz.mjs +85 -0
- package/dist/{current-task-DBjRNCFq.mjs → current-task-z_TiJ0kt.mjs} +9 -7
- package/dist/dashboard-CnMD04PQ.mjs +163 -0
- package/dist/dashboard-G1-dGLUR.mjs +20 -0
- package/dist/database-DQkUxTLd.mjs +17 -0
- package/dist/database-vvig8k4x.mjs +51 -0
- package/dist/db-CBaEfumR.mjs +22 -0
- package/dist/{delete-8vGU35r3.mjs → delete-CVYII8mq.mjs} +7 -5
- package/dist/{delete-B27KLF5X.mjs → delete-DeZQ1r9w.mjs} +7 -5
- package/dist/{delete-runtime-Byr60cR3.mjs → delete-runtime-BMzvfj_B.mjs} +4 -4
- package/dist/{delete-table-BNaJ_gA4.mjs → delete-table-ZiR9-ndv.mjs} +7 -5
- package/dist/deprovision-BhD3J-Am.mjs +61 -0
- package/dist/{dirty-aNUuph4I.mjs → dirty-D9agt7Os.mjs} +8 -6
- package/dist/docker-CHpV8PRz.mjs +612 -0
- package/dist/eid-B5wawMmO.mjs +13 -0
- package/dist/{export-QDkuuzSE.mjs → export-Bfk7JAlR.mjs} +30 -23
- package/dist/field-B3gvaqpK.mjs +278 -0
- package/dist/field-BDJ1pEgr.mjs +18 -0
- package/dist/fields-7ByLsxLg.mjs +38 -0
- package/dist/flag-pair-DtR1AiBQ.mjs +17 -0
- package/dist/get-BE6Izpus.mjs +36 -0
- package/dist/get-C3CcAJGg.mjs +49 -0
- package/dist/{get-DI_IJvgk.mjs → get-CQGeF-eP.mjs} +6 -4
- package/dist/get-D2m4jhwT.mjs +53 -0
- package/dist/{get-BGBIzMKY.mjs → get-DKy3DAJX.mjs} +6 -4
- package/dist/{get-COXHplHP.mjs → get-DUSR5i99.mjs} +7 -5
- package/dist/get-DikegGzi.mjs +36 -0
- package/dist/get-StkjKuh0.mjs +40 -0
- package/dist/get-bYc7eGYe.mjs +36 -0
- package/dist/{get-Cl8-IauC.mjs → get-cuHp9-6U.mjs} +7 -4
- package/dist/{get-i6LWOByV.mjs → get-gOT_RarI.mjs} +6 -4
- package/dist/get-run-D59Yqaoh.mjs +36 -0
- package/dist/get-tISo-cmg.mjs +41 -0
- package/dist/git-sync-BiTWfLgY.mjs +28 -0
- package/dist/{has-remote-changes-hjKoQuRy.mjs → has-remote-changes-B1TciDVD.mjs} +8 -6
- package/dist/{import-HJsSKRYx.mjs → import-DnnmmJbp.mjs} +11 -9
- package/dist/{input-Dojr-RTw.mjs → input-ikCiip6x.mjs} +2 -1
- package/dist/is-dirty-DClGFOGV.mjs +10 -0
- package/dist/{is-dirty-1Qy7hiHB.mjs → is-dirty-DlfX7e39.mjs} +5 -4
- package/dist/items-DQFQSpjF.mjs +77 -0
- package/dist/{key-DBxPSFwi.mjs → key-NDEARu2L.mjs} +1 -1
- package/dist/{license-MoWse3ZI.mjs → license-DBh13sc8.mjs} +3 -3
- package/dist/list-4kYCGv01.mjs +32 -0
- package/dist/list-9AOWhxqp.mjs +61 -0
- package/dist/{list-Bk6RsbJl.mjs → list-BwjqQ6pp.mjs} +5 -3
- package/dist/{list-C_PRdL5e.mjs → list-CP5RNjO6.mjs} +7 -5
- package/dist/{list-C8tdLOH5.mjs → list-Cy0VhXQs.mjs} +5 -3
- package/dist/list-D067ZSE5.mjs +47 -0
- package/dist/list-DAZP-IM5.mjs +32 -0
- package/dist/list-DJN-OvTZ.mjs +52 -0
- package/dist/list-DQj-QJAs.mjs +40 -0
- package/dist/list-Di529OJD.mjs +55 -0
- package/dist/{list-C4Ajrw8f.mjs → list-DlKzgnqo.mjs} +6 -3
- package/dist/list-GFfR9SuT.mjs +32 -0
- package/dist/{list-CWt3fqrZ.mjs → list-iFVEdi2J.mjs} +5 -3
- package/dist/{login-C9WTwNn6.mjs → login-DxgkosGx.mjs} +30 -9
- package/dist/{logout-oLszGCOg.mjs → logout-BlVwqBog.mjs} +7 -6
- package/dist/logs-CudNEkT4.mjs +58 -0
- package/dist/{manifest-CAdjQYH8.mjs → manifest-Dv5B9Blc.mjs} +3 -7
- package/dist/measure-BEQfnLdN.mjs +67 -0
- package/dist/measure-C7SbdYQk.mjs +19 -0
- package/dist/metadata-B2Td415K.mjs +38 -0
- package/dist/metadata-BTJAFVvZ.mjs +37 -0
- package/dist/{package-BGfw4ZWJ.mjs → package-DV6Asqim.mjs} +7 -1
- package/dist/paginate-CTSfuYiF.mjs +49 -0
- package/dist/parse-id-B38zTlYs.mjs +12 -0
- package/dist/parse-ref-DGvh4aDn.mjs +17 -0
- package/dist/parse-schemas-Ds-cVE-O.mjs +12 -0
- package/dist/{poll-ILanYysl.mjs → poll-Bh6oAifO.mjs} +2 -1
- package/dist/{poll-task-DbpsiQhl.mjs → poll-task-vPwV31Fs.mjs} +8 -7
- package/dist/predicates-DiIiS3k7.mjs +153 -0
- package/dist/preflight-DxJb-hUV.mjs +91 -0
- package/dist/{prompt-DpT8yAVy.mjs → prompt-Bf3DQ-qE.mjs} +1 -1
- package/dist/provision-B-I0zuDe.mjs +77 -0
- package/dist/ps-BmYQYC7t.mjs +10 -0
- package/dist/ps-CaiOFCv2.mjs +78 -0
- package/dist/query-BtF1yWZZ.mjs +90 -0
- package/dist/{query-PihYi-UZ.mjs → query-jmfqaXRP.mjs} +38 -13
- package/dist/remove-C2iv0g03.mjs +98 -0
- package/dist/remove-collection-DhZghaZy.mjs +38 -0
- package/dist/{remove-B2hVYn1v.mjs → remove-xskleeru.mjs} +6 -5
- package/dist/render-DXv-D6fU.mjs +182 -0
- package/dist/rescan-values-DW6u90ep.mjs +43 -0
- package/dist/revision-message-flag-CWQbKhdl.mjs +11 -0
- package/dist/{run-C2so6Qp6.mjs → run-DxVzhcF3.mjs} +27 -36
- package/dist/runs-BOHk1XnM.mjs +54 -0
- package/dist/{runtime-C9CEZhcn.mjs → runtime-cwBS8wwK.mjs} +428 -442
- package/dist/schema-tables-CcFbY_jN.mjs +45 -0
- package/dist/schemas-DZmv_V62.mjs +47 -0
- package/dist/{search-CopOytXY.mjs → search-CYMuc7Fg.mjs} +6 -19
- package/dist/segment-BMrUBz94.mjs +70 -0
- package/dist/segment-Df4pfjco.mjs +19 -0
- package/dist/{set-BcF7M1GQ.mjs → set-B_rrVwU4.mjs} +6 -4
- package/dist/{set-CbibegpA.mjs → set-CbGfQ7Ye.mjs} +8 -6
- package/dist/{setting-U3NtBMFo.mjs → setting-DqZY9NXP.mjs} +3 -3
- package/dist/setup-DxmcAorA.mjs +71 -0
- package/dist/snippet-CwSHjQyn.mjs +19 -0
- package/dist/snippet-Dw0Sjzkr.mjs +64 -0
- package/dist/start-Cn0epTks.mjs +380 -0
- package/dist/{stash-DOBbYozC.mjs → stash-BFZIl9F4.mjs} +9 -7
- package/dist/{status-Buf1ZbNR.mjs → status-BjCeJNLp.mjs} +10 -8
- package/dist/{status-CUcs8XBH.mjs → status-FDIDmqvM.mjs} +4 -2
- package/dist/{status-D1F5XHae.mjs → status-UALK3OJl.mjs} +4 -2
- package/dist/stop-DUwrDWw8.mjs +81 -0
- package/dist/summary-CS4UGiFJ.mjs +41 -0
- package/dist/sync-schema-IrHdJxmX.mjs +43 -0
- package/dist/{table-Cfk7oSvw.mjs → table-B-PYcgGb.mjs} +22 -9
- package/dist/table-Cdr5bKp1.mjs +19 -0
- package/dist/transform-CeZusR_w.mjs +24 -0
- package/dist/{transform-B5uRpg1G.mjs → transform-IEX4Mx3X.mjs} +56 -2
- package/dist/transform-job-BOn9-CGa.mjs +19 -0
- package/dist/{transform-job-C7QXWTVE.mjs → transform-job-Csr86muI.mjs} +7 -0
- package/dist/translate-B__zbDKm.mjs +111 -0
- package/dist/tree-Mh0uQ_Wy.mjs +32 -0
- package/dist/update-1Di9hbPo.mjs +56 -0
- package/dist/update-B5_pp6Jj.mjs +56 -0
- package/dist/update-B9DBMo30.mjs +52 -0
- package/dist/update-BfBsM_y1.mjs +56 -0
- package/dist/update-Bw0WZix_.mjs +73 -0
- package/dist/update-Cp1789qq.mjs +52 -0
- package/dist/update-D2VI_5cy.mjs +57 -0
- package/dist/update-D8GwQTcL.mjs +59 -0
- package/dist/{update-CL8tRbxr.mjs → update-Masp5WeT.mjs} +9 -7
- package/dist/update-dashcard-CNiQw1MD.mjs +71 -0
- package/dist/update-j9vgemKR.mjs +51 -0
- package/dist/url-GFM76VIK.mjs +54 -0
- package/dist/uuid-Uif0lNk8.mjs +47 -0
- package/dist/validate-DCYx6jdL.mjs +1496 -0
- package/dist/validate-query-B07oGG4K.mjs +37 -0
- package/dist/values-DrwNHUAI.mjs +36 -0
- package/dist/{wait-Bugr9eXD.mjs → wait-BoKk8CJy.mjs} +10 -8
- package/dist/wait-DO7tS7NI.mjs +19 -0
- package/dist/wait-flags-CjX2sEGm.mjs +35 -0
- package/dist/workspace-CyEX40D-.mjs +24 -0
- package/dist/workspace-DVuqKJGG.mjs +72 -0
- package/dist/workspace-credentials-B6BL-X0d.mjs +139 -0
- package/package.json +7 -1
- package/dist/auth-BF7IjZIH.mjs +0 -18
- package/dist/card-_Ta7zdYe.mjs +0 -19
- package/dist/create-CI2Cunq5.mjs +0 -38
- package/dist/create-DdbU3TLX.mjs +0 -42
- package/dist/database-PA9Goi25.mjs +0 -33
- package/dist/db-DMghzgb6.mjs +0 -17
- package/dist/field-C8IVs6rp.mjs +0 -76
- package/dist/field-DaYo_90x.mjs +0 -13
- package/dist/get-Cwpj7lDe.mjs +0 -35
- package/dist/get-Dh_acl8q.mjs +0 -34
- package/dist/is-dirty-DpKn9HJp.mjs +0 -8
- package/dist/list-CBSBHtK-.mjs +0 -38
- package/dist/parse-id-BhmmfyCP.mjs +0 -14
- package/dist/sync-BPyGXfUk.mjs +0 -26
- package/dist/table-D7nJt7JO.mjs +0 -16
- package/dist/transform-UbyewMxY.mjs +0 -21
- package/dist/transform-job-CrYkr-Ma.mjs +0 -19
- package/dist/update-DU2oU2j-.mjs +0 -49
- /package/dist/{body-flags-BUA9XV1u.mjs → body-flags-BK7J6Daz.mjs} +0 -0
- /package/dist/{setting-26ckqHAP.mjs → setting-CTaAeMci.mjs} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import "./package-DV6Asqim.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-cwBS8wwK.mjs";
|
|
7
|
+
import { readBody } from "./body-rDrR-C1c.mjs";
|
|
8
|
+
import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
|
|
9
|
+
import "./field-B3gvaqpK.mjs";
|
|
10
|
+
import { Card, CardCreateInput, cardView } from "./card-CQxvHeyP.mjs";
|
|
11
|
+
import "./validate-DCYx6jdL.mjs";
|
|
12
|
+
import { CARD_DATASET_QUERY_LABELS, preflightMbql5Query, skipValidateFlag } from "./validate-query-B07oGG4K.mjs";
|
|
13
|
+
|
|
14
|
+
//#region src/commands/card/create.ts
|
|
15
|
+
var create_default = defineMetabaseCommand({
|
|
16
|
+
meta: {
|
|
17
|
+
name: "create",
|
|
18
|
+
description: "Create a card from a JSON spec; if dataset_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
|
+
...skipValidateFlag
|
|
26
|
+
},
|
|
27
|
+
outputSchema: Card,
|
|
28
|
+
examples: [
|
|
29
|
+
"cat card.json | metabase card create",
|
|
30
|
+
"metabase card create --file card.json",
|
|
31
|
+
"metabase card create --body '{\"name\":\"x\",\"display\":\"table\",\"dataset_query\":{...},\"visualization_settings\":{}}'",
|
|
32
|
+
"metabase card create --file card.json --skip-validate"
|
|
33
|
+
],
|
|
34
|
+
async run({ args, ctx, getClient }) {
|
|
35
|
+
const body = await readBody({
|
|
36
|
+
flag: args.body,
|
|
37
|
+
file: args.file
|
|
38
|
+
}, CardCreateInput);
|
|
39
|
+
preflightMbql5Query(body.dataset_query, CARD_DATASET_QUERY_LABELS, { skip: args["skip-validate"] === true });
|
|
40
|
+
const client = await getClient();
|
|
41
|
+
const created = await client.requestParsed(Card, "/api/card", {
|
|
42
|
+
method: "POST",
|
|
43
|
+
body
|
|
44
|
+
});
|
|
45
|
+
renderItem(created, cardView, ctx);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { create_default as default };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-DV6Asqim.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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-cwBS8wwK.mjs";
|
|
7
|
+
import { readBody } from "./body-rDrR-C1c.mjs";
|
|
8
|
+
import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
|
|
9
|
+
import { TransformJob, TransformJobCreateInput, transformJobView } from "./transform-job-Csr86muI.mjs";
|
|
8
10
|
|
|
9
11
|
//#region src/commands/transform-job/create.ts
|
|
10
12
|
var create_default = defineMetabaseCommand({
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-DV6Asqim.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import "./
|
|
3
|
+
import { renderItem } from "./render-DXv-D6fU.mjs";
|
|
4
|
+
import { ConfigError } from "./predicates-DiIiS3k7.mjs";
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-cwBS8wwK.mjs";
|
|
6
|
+
import { REMOTE_SYNC_PATHS } from "./poll-task-vPwV31Fs.mjs";
|
|
7
|
+
import "./poll-Bh6oAifO.mjs";
|
|
6
8
|
import { z } from "zod";
|
|
7
9
|
|
|
8
|
-
//#region src/commands/sync/create-branch.ts
|
|
10
|
+
//#region src/commands/git-sync/create-branch.ts
|
|
9
11
|
const CreateBranchResult = z.object({
|
|
10
12
|
status: z.literal("success"),
|
|
11
13
|
message: z.string()
|
|
@@ -23,7 +25,7 @@ const createBranchView = {
|
|
|
23
25
|
var create_branch_default = defineMetabaseCommand({
|
|
24
26
|
meta: {
|
|
25
27
|
name: "create-branch",
|
|
26
|
-
description: "Create a new branch on the git remote and switch sync to it"
|
|
28
|
+
description: "Create a new branch on the git remote and switch git-sync to it"
|
|
27
29
|
},
|
|
28
30
|
args: {
|
|
29
31
|
...outputFlags,
|
|
@@ -36,7 +38,7 @@ var create_branch_default = defineMetabaseCommand({
|
|
|
36
38
|
}
|
|
37
39
|
},
|
|
38
40
|
outputSchema: CreateBranchResult,
|
|
39
|
-
examples: ["metabase sync create-branch feat/dashboards", "metabase sync create-branch feat/x --json"],
|
|
41
|
+
examples: ["metabase git-sync create-branch feat/dashboards", "metabase git-sync create-branch feat/x --json"],
|
|
40
42
|
async run({ args, ctx, getClient }) {
|
|
41
43
|
const name = args.name.trim();
|
|
42
44
|
if (name === "") throw new ConfigError("invalid name: branch name must not be blank");
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import "./package-DV6Asqim.mjs";
|
|
2
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
+
import { renderItem } from "./render-DXv-D6fU.mjs";
|
|
4
|
+
import "./predicates-DiIiS3k7.mjs";
|
|
5
|
+
import { defineMetabaseCommand, localUrl, outputFlags, parseJson } from "./runtime-cwBS8wwK.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-B38zTlYs.mjs";
|
|
7
|
+
import "./poll-Bh6oAifO.mjs";
|
|
8
|
+
import { checkDockerReady, readContainerCredentialsFile, requireWorkspaceContainerLocation } from "./docker-CHpV8PRz.mjs";
|
|
9
|
+
import { WorkspaceCredentials } from "./workspace-credentials-B6BL-X0d.mjs";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
|
|
12
|
+
//#region src/commands/workspace/credentials.ts
|
|
13
|
+
const WorkspaceCredentialsResult = z.object({
|
|
14
|
+
workspace_id: z.number().int().positive(),
|
|
15
|
+
url: z.string(),
|
|
16
|
+
email: z.string(),
|
|
17
|
+
password: z.string(),
|
|
18
|
+
api_key_name: z.string(),
|
|
19
|
+
api_key: z.string()
|
|
20
|
+
});
|
|
21
|
+
const credentialsView = {
|
|
22
|
+
compactPick: WorkspaceCredentialsResult,
|
|
23
|
+
tableColumns: [
|
|
24
|
+
{
|
|
25
|
+
key: "workspace_id",
|
|
26
|
+
label: "ID"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
key: "url",
|
|
30
|
+
label: "URL"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: "email",
|
|
34
|
+
label: "Email"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
key: "password",
|
|
38
|
+
label: "Password"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: "api_key_name",
|
|
42
|
+
label: "API Key Name"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
key: "api_key",
|
|
46
|
+
label: "API Key"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
const textDecoder = new TextDecoder("utf-8");
|
|
51
|
+
var credentials_default = defineMetabaseCommand({
|
|
52
|
+
meta: {
|
|
53
|
+
name: "credentials",
|
|
54
|
+
description: "Read the workspace child instance's admin credentials (email + password + API key) from the running container"
|
|
55
|
+
},
|
|
56
|
+
args: {
|
|
57
|
+
...outputFlags,
|
|
58
|
+
id: {
|
|
59
|
+
type: "positional",
|
|
60
|
+
description: "Workspace id",
|
|
61
|
+
required: true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
outputSchema: WorkspaceCredentialsResult,
|
|
65
|
+
examples: ["metabase workspace credentials 1", "metabase workspace credentials 1 --json"],
|
|
66
|
+
async run({ args, ctx }) {
|
|
67
|
+
const workspaceId = parseId(args.id);
|
|
68
|
+
await checkDockerReady();
|
|
69
|
+
const { containerName, hostPort } = await requireWorkspaceContainerLocation(workspaceId);
|
|
70
|
+
const bytes = await readContainerCredentialsFile(workspaceId);
|
|
71
|
+
const credentials = parseJson(textDecoder.decode(bytes), WorkspaceCredentials, { source: `${containerName}:credentials.json` });
|
|
72
|
+
const result = {
|
|
73
|
+
workspace_id: workspaceId,
|
|
74
|
+
url: localUrl(hostPort),
|
|
75
|
+
email: credentials.user.email,
|
|
76
|
+
password: credentials.user.password,
|
|
77
|
+
api_key_name: credentials.api_key.name,
|
|
78
|
+
api_key: credentials.api_key.key
|
|
79
|
+
};
|
|
80
|
+
renderItem(result, credentialsView, ctx);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
export { credentials_default as default };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-DV6Asqim.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import "./
|
|
3
|
+
import { renderItem } from "./render-DXv-D6fU.mjs";
|
|
4
|
+
import "./predicates-DiIiS3k7.mjs";
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-cwBS8wwK.mjs";
|
|
6
|
+
import { SyncTaskOrIdle, fetchCurrentTask, syncTaskIdleView, syncTaskView } from "./poll-task-vPwV31Fs.mjs";
|
|
7
|
+
import "./poll-Bh6oAifO.mjs";
|
|
6
8
|
|
|
7
|
-
//#region src/commands/sync/current-task.ts
|
|
9
|
+
//#region src/commands/git-sync/current-task.ts
|
|
8
10
|
const CurrentTaskResult = SyncTaskOrIdle;
|
|
9
11
|
var current_task_default = defineMetabaseCommand({
|
|
10
12
|
meta: {
|
|
11
13
|
name: "current-task",
|
|
12
|
-
description: "Get the most recent sync task (or idle if none)"
|
|
14
|
+
description: "Get the most recent git-sync task (or idle if none)"
|
|
13
15
|
},
|
|
14
16
|
args: {
|
|
15
17
|
...outputFlags,
|
|
@@ -17,7 +19,7 @@ var current_task_default = defineMetabaseCommand({
|
|
|
17
19
|
...connectionFlags
|
|
18
20
|
},
|
|
19
21
|
outputSchema: CurrentTaskResult,
|
|
20
|
-
examples: ["metabase sync current-task", "metabase sync current-task --json"],
|
|
22
|
+
examples: ["metabase git-sync current-task", "metabase git-sync current-task --json"],
|
|
21
23
|
async run({ ctx, getClient }) {
|
|
22
24
|
const client = await getClient();
|
|
23
25
|
const task = await fetchCurrentTask(client);
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/domain/dashboard.ts
|
|
4
|
+
const DashboardWidth = z.enum(["fixed", "full"]);
|
|
5
|
+
const Dashcard = z.object({
|
|
6
|
+
id: z.number().int(),
|
|
7
|
+
dashboard_id: z.number().int(),
|
|
8
|
+
card_id: z.number().int().nullable(),
|
|
9
|
+
dashboard_tab_id: z.number().int().nullable(),
|
|
10
|
+
row: z.number().int(),
|
|
11
|
+
col: z.number().int(),
|
|
12
|
+
size_x: z.number().int(),
|
|
13
|
+
size_y: z.number().int(),
|
|
14
|
+
entity_id: z.string().nullable(),
|
|
15
|
+
visualization_settings: z.unknown(),
|
|
16
|
+
parameter_mappings: z.array(z.unknown()).nullable(),
|
|
17
|
+
inline_parameters: z.array(z.string()).nullable()
|
|
18
|
+
}).loose();
|
|
19
|
+
const DashcardCompact = Dashcard.pick({
|
|
20
|
+
id: true,
|
|
21
|
+
dashboard_id: true,
|
|
22
|
+
card_id: true,
|
|
23
|
+
dashboard_tab_id: true,
|
|
24
|
+
row: true,
|
|
25
|
+
col: true,
|
|
26
|
+
size_x: true,
|
|
27
|
+
size_y: true
|
|
28
|
+
}).strip();
|
|
29
|
+
const dashcardView = {
|
|
30
|
+
compactPick: DashcardCompact,
|
|
31
|
+
tableColumns: [
|
|
32
|
+
{
|
|
33
|
+
key: "id",
|
|
34
|
+
label: "ID"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
key: "card_id",
|
|
38
|
+
label: "Card"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: "dashboard_tab_id",
|
|
42
|
+
label: "Tab"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
key: "row",
|
|
46
|
+
label: "Row"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: "col",
|
|
50
|
+
label: "Col"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: "size_x",
|
|
54
|
+
label: "W"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
key: "size_y",
|
|
58
|
+
label: "H"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
};
|
|
62
|
+
const DashboardTab = z.object({
|
|
63
|
+
id: z.number().int(),
|
|
64
|
+
dashboard_id: z.number().int(),
|
|
65
|
+
name: z.string(),
|
|
66
|
+
position: z.number().int().optional(),
|
|
67
|
+
entity_id: z.string().nullable().optional()
|
|
68
|
+
}).loose();
|
|
69
|
+
const DashboardTabCompact = DashboardTab.pick({
|
|
70
|
+
id: true,
|
|
71
|
+
dashboard_id: true,
|
|
72
|
+
name: true,
|
|
73
|
+
position: true
|
|
74
|
+
}).strip();
|
|
75
|
+
const Dashboard = z.object({
|
|
76
|
+
id: z.number().int(),
|
|
77
|
+
name: z.string(),
|
|
78
|
+
description: z.string().nullable(),
|
|
79
|
+
archived: z.boolean(),
|
|
80
|
+
collection_id: z.number().int().nullable(),
|
|
81
|
+
creator_id: z.number().int(),
|
|
82
|
+
entity_id: z.string().nullable(),
|
|
83
|
+
width: DashboardWidth,
|
|
84
|
+
auto_apply_filters: z.boolean(),
|
|
85
|
+
enable_embedding: z.boolean(),
|
|
86
|
+
public_uuid: z.string().nullable(),
|
|
87
|
+
cache_ttl: z.number().int().nullable(),
|
|
88
|
+
parameters: z.array(z.unknown()).nullable(),
|
|
89
|
+
dashcards: z.array(Dashcard).optional(),
|
|
90
|
+
tabs: z.array(DashboardTab).optional()
|
|
91
|
+
}).loose();
|
|
92
|
+
const DashboardDetail = Dashboard.extend({
|
|
93
|
+
dashcards: z.array(Dashcard),
|
|
94
|
+
tabs: z.array(DashboardTab)
|
|
95
|
+
});
|
|
96
|
+
const DashboardCompact = Dashboard.pick({
|
|
97
|
+
id: true,
|
|
98
|
+
name: true,
|
|
99
|
+
description: true,
|
|
100
|
+
archived: true,
|
|
101
|
+
collection_id: true
|
|
102
|
+
}).strip().extend({
|
|
103
|
+
dashcards: z.array(DashcardCompact).optional(),
|
|
104
|
+
tabs: z.array(DashboardTabCompact).optional()
|
|
105
|
+
});
|
|
106
|
+
const dashboardView = {
|
|
107
|
+
compactPick: DashboardCompact,
|
|
108
|
+
tableColumns: [
|
|
109
|
+
{
|
|
110
|
+
key: "id",
|
|
111
|
+
label: "ID"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
key: "name",
|
|
115
|
+
label: "Name"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: "collection_id",
|
|
119
|
+
label: "Collection"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
key: "archived",
|
|
123
|
+
label: "Archived"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
};
|
|
127
|
+
const DashboardCreateInput = z.object({
|
|
128
|
+
name: z.string().min(1),
|
|
129
|
+
description: z.string().nullable().optional(),
|
|
130
|
+
parameters: z.array(z.unknown()).optional(),
|
|
131
|
+
cache_ttl: z.number().int().positive().optional(),
|
|
132
|
+
collection_id: z.number().int().positive().nullable().optional(),
|
|
133
|
+
collection_position: z.number().int().positive().nullable().optional(),
|
|
134
|
+
dashcards: z.array(z.unknown()).optional(),
|
|
135
|
+
tabs: z.array(DashboardTab.partial()).optional()
|
|
136
|
+
}).loose();
|
|
137
|
+
const DashboardUpdateInput = z.object({
|
|
138
|
+
name: z.string().min(1).optional(),
|
|
139
|
+
description: z.string().nullable().optional(),
|
|
140
|
+
archived: z.boolean().optional(),
|
|
141
|
+
width: DashboardWidth.optional(),
|
|
142
|
+
enable_embedding: z.boolean().optional(),
|
|
143
|
+
embedding_params: z.unknown().optional(),
|
|
144
|
+
parameters: z.array(z.unknown()).optional(),
|
|
145
|
+
cache_ttl: z.number().int().positive().nullable().optional(),
|
|
146
|
+
collection_id: z.number().int().positive().nullable().optional(),
|
|
147
|
+
collection_position: z.number().int().positive().nullable().optional(),
|
|
148
|
+
dashcards: z.array(z.unknown()).optional(),
|
|
149
|
+
tabs: z.array(DashboardTab.partial()).optional()
|
|
150
|
+
}).loose();
|
|
151
|
+
const DashcardPatchInput = z.object({
|
|
152
|
+
row: z.number().int().nonnegative().optional(),
|
|
153
|
+
col: z.number().int().nonnegative().optional(),
|
|
154
|
+
size_x: z.number().int().positive().optional(),
|
|
155
|
+
size_y: z.number().int().positive().optional(),
|
|
156
|
+
dashboard_tab_id: z.number().int().nullable().optional(),
|
|
157
|
+
parameter_mappings: z.array(z.unknown()).optional(),
|
|
158
|
+
inline_parameters: z.array(z.string()).optional(),
|
|
159
|
+
visualization_settings: z.unknown().optional()
|
|
160
|
+
}).strict().refine((value) => Object.keys(value).length > 0, { message: "patch must contain at least one field" });
|
|
161
|
+
|
|
162
|
+
//#endregion
|
|
163
|
+
export { Dashboard, DashboardCompact, DashboardCreateInput, DashboardDetail, DashboardUpdateInput, Dashcard, DashcardCompact, DashcardPatchInput, dashboardView, dashcardView };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/dashboard/index.ts
|
|
4
|
+
var dashboard_default = defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "dashboard",
|
|
7
|
+
description: "Manage Metabase dashboards"
|
|
8
|
+
},
|
|
9
|
+
subCommands: {
|
|
10
|
+
list: () => import("./list-D067ZSE5.mjs").then((mod) => mod.default),
|
|
11
|
+
get: () => import("./get-StkjKuh0.mjs").then((mod) => mod.default),
|
|
12
|
+
cards: () => import("./cards-C4NIaERo.mjs").then((mod) => mod.default),
|
|
13
|
+
create: () => import("./create-CB0Yp__0.mjs").then((mod) => mod.default),
|
|
14
|
+
update: () => import("./update-D2VI_5cy.mjs").then((mod) => mod.default),
|
|
15
|
+
"update-dashcard": () => import("./update-dashcard-CNiQw1MD.mjs").then((mod) => mod.default)
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { dashboard_default as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/workspace/database/index.ts
|
|
4
|
+
var database_default = defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "database",
|
|
7
|
+
description: "Manage databases provisioned to a workspace"
|
|
8
|
+
},
|
|
9
|
+
subCommands: {
|
|
10
|
+
provision: () => import("./provision-B-I0zuDe.mjs").then((mod) => mod.default),
|
|
11
|
+
update: () => import("./update-Bw0WZix_.mjs").then((mod) => mod.default),
|
|
12
|
+
deprovision: () => import("./deprovision-BhD3J-Am.mjs").then((mod) => mod.default)
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { database_default as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Table } from "./table-B-PYcgGb.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/domain/database.ts
|
|
5
|
+
const Database = z.object({
|
|
6
|
+
id: z.number().int(),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
engine: z.string().optional(),
|
|
9
|
+
is_saved_questions: z.boolean().optional(),
|
|
10
|
+
tables: z.array(Table).optional()
|
|
11
|
+
}).loose();
|
|
12
|
+
const DatabaseCompact = Database.pick({
|
|
13
|
+
id: true,
|
|
14
|
+
name: true,
|
|
15
|
+
engine: true,
|
|
16
|
+
is_saved_questions: true
|
|
17
|
+
}).strip();
|
|
18
|
+
const databaseView = {
|
|
19
|
+
compactPick: DatabaseCompact,
|
|
20
|
+
tableColumns: [
|
|
21
|
+
{
|
|
22
|
+
key: "id",
|
|
23
|
+
label: "ID"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: "name",
|
|
27
|
+
label: "Name"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
key: "engine",
|
|
31
|
+
label: "Engine"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
const DatabaseSyncResult = z.object({
|
|
36
|
+
id: z.number().int(),
|
|
37
|
+
status: z.literal("ok")
|
|
38
|
+
});
|
|
39
|
+
const databaseSyncResultView = {
|
|
40
|
+
compactPick: DatabaseSyncResult,
|
|
41
|
+
tableColumns: [{
|
|
42
|
+
key: "id",
|
|
43
|
+
label: "Database"
|
|
44
|
+
}, {
|
|
45
|
+
key: "status",
|
|
46
|
+
label: "Status"
|
|
47
|
+
}]
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Database, DatabaseCompact, DatabaseSyncResult, databaseSyncResultView, databaseView };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/db/index.ts
|
|
4
|
+
var db_default = defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "db",
|
|
7
|
+
description: "Inspect Metabase databases",
|
|
8
|
+
alias: "database"
|
|
9
|
+
},
|
|
10
|
+
subCommands: {
|
|
11
|
+
list: () => import("./list-9AOWhxqp.mjs").then((m) => m.default),
|
|
12
|
+
get: () => import("./get-C3CcAJGg.mjs").then((m) => m.default),
|
|
13
|
+
metadata: () => import("./metadata-B2Td415K.mjs").then((m) => m.default),
|
|
14
|
+
schemas: () => import("./schemas-DZmv_V62.mjs").then((m) => m.default),
|
|
15
|
+
"schema-tables": () => import("./schema-tables-CcFbY_jN.mjs").then((m) => m.default),
|
|
16
|
+
"sync-schema": () => import("./sync-schema-IrHdJxmX.mjs").then((m) => m.default),
|
|
17
|
+
"rescan-values": () => import("./rescan-values-DW6u90ep.mjs").then((m) => m.default)
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { db_default as default };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-DV6Asqim.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import "./render-DXv-D6fU.mjs";
|
|
4
|
+
import "./predicates-DiIiS3k7.mjs";
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-cwBS8wwK.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-B38zTlYs.mjs";
|
|
7
|
+
import "./prompt-Bf3DQ-qE.mjs";
|
|
8
|
+
import { DeleteResult, confirmAndDelete } from "./delete-runtime-BMzvfj_B.mjs";
|
|
7
9
|
|
|
8
10
|
//#region src/commands/transform/delete.ts
|
|
9
11
|
var delete_default = defineMetabaseCommand({
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-DV6Asqim.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import "./render-DXv-D6fU.mjs";
|
|
4
|
+
import "./predicates-DiIiS3k7.mjs";
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-cwBS8wwK.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-B38zTlYs.mjs";
|
|
7
|
+
import "./prompt-Bf3DQ-qE.mjs";
|
|
8
|
+
import { DeleteResult, confirmAndDelete } from "./delete-runtime-BMzvfj_B.mjs";
|
|
7
9
|
|
|
8
10
|
//#region src/commands/transform-job/delete.ts
|
|
9
11
|
var delete_default = defineMetabaseCommand({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { promptConfirm } from "./prompt-
|
|
1
|
+
import { renderItem } from "./render-DXv-D6fU.mjs";
|
|
2
|
+
import { promptConfirm } from "./prompt-Bf3DQ-qE.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/commands/delete-runtime.ts
|
|
@@ -26,8 +26,7 @@ const deleteResultView = {
|
|
|
26
26
|
]
|
|
27
27
|
};
|
|
28
28
|
async function confirmAndDelete(args) {
|
|
29
|
-
if (!args.yes) {
|
|
30
|
-
if (!process.stdin.isTTY) throw new ConfigError("--yes required to delete non-interactively");
|
|
29
|
+
if (!args.yes && process.stdin.isTTY === true) {
|
|
31
30
|
const ok = await promptConfirm({
|
|
32
31
|
message: args.promptMessage,
|
|
33
32
|
initialValue: false
|
|
@@ -45,6 +44,7 @@ async function confirmAndDelete(args) {
|
|
|
45
44
|
method: "DELETE",
|
|
46
45
|
expectContentType: "binary"
|
|
47
46
|
});
|
|
47
|
+
if (args.afterDelete) await args.afterDelete();
|
|
48
48
|
renderItem({
|
|
49
49
|
deleted: true,
|
|
50
50
|
aborted: false,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-DV6Asqim.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import "./render-DXv-D6fU.mjs";
|
|
4
|
+
import "./predicates-DiIiS3k7.mjs";
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-cwBS8wwK.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-B38zTlYs.mjs";
|
|
7
|
+
import "./prompt-Bf3DQ-qE.mjs";
|
|
8
|
+
import { DeleteResult, confirmAndDelete } from "./delete-runtime-BMzvfj_B.mjs";
|
|
7
9
|
|
|
8
10
|
//#region src/commands/transform/delete-table.ts
|
|
9
11
|
var delete_table_default = defineMetabaseCommand({
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import "./package-DV6Asqim.mjs";
|
|
2
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
+
import "./render-DXv-D6fU.mjs";
|
|
4
|
+
import "./predicates-DiIiS3k7.mjs";
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-cwBS8wwK.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-B38zTlYs.mjs";
|
|
7
|
+
import "./prompt-Bf3DQ-qE.mjs";
|
|
8
|
+
import "./poll-Bh6oAifO.mjs";
|
|
9
|
+
import { DeleteResult, confirmAndDelete } from "./delete-runtime-BMzvfj_B.mjs";
|
|
10
|
+
import { parseWaitFlags, waitFlags } from "./wait-flags-CjX2sEGm.mjs";
|
|
11
|
+
import "./workspace-DVuqKJGG.mjs";
|
|
12
|
+
import { waitForDatabaseGone } from "./wait-DO7tS7NI.mjs";
|
|
13
|
+
|
|
14
|
+
//#region src/commands/workspace/database/deprovision.ts
|
|
15
|
+
var deprovision_default = defineMetabaseCommand({
|
|
16
|
+
meta: {
|
|
17
|
+
name: "deprovision",
|
|
18
|
+
description: "Deprovision a database from a workspace"
|
|
19
|
+
},
|
|
20
|
+
args: {
|
|
21
|
+
...outputFlags,
|
|
22
|
+
...profileFlag,
|
|
23
|
+
...connectionFlags,
|
|
24
|
+
...waitFlags,
|
|
25
|
+
yes: {
|
|
26
|
+
type: "boolean",
|
|
27
|
+
description: "Skip confirmation",
|
|
28
|
+
default: false
|
|
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: DeleteResult,
|
|
42
|
+
examples: ["metabase workspace database deprovision 1 5 --yes", "metabase workspace database deprovision 1 5 --yes --wait"],
|
|
43
|
+
async run({ args, ctx, getClient }) {
|
|
44
|
+
const workspaceId = parseId(args.id);
|
|
45
|
+
const databaseId = parseId(args["db-id"], "db-id");
|
|
46
|
+
const wait = parseWaitFlags(args);
|
|
47
|
+
const client = await getClient();
|
|
48
|
+
await confirmAndDelete({
|
|
49
|
+
id: databaseId,
|
|
50
|
+
path: `/api/ee/workspace-manager/${workspaceId}/database/${databaseId}`,
|
|
51
|
+
yes: args.yes,
|
|
52
|
+
promptMessage: `Deprovision database ${databaseId} from workspace ${workspaceId}?`,
|
|
53
|
+
client,
|
|
54
|
+
ctx,
|
|
55
|
+
...wait.enabled ? { afterDelete: () => waitForDatabaseGone(client, workspaceId, databaseId, wait.schedule) } : {}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { deprovision_default as default };
|