@metabase/cli 0.1.0-alpha.workspaces-commands.645461e → 0.1.0-alpha.workspaces-commands.80b2b17
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 +391 -12
- package/dist/{add-collection-D2VyeBlW.mjs → add-collection-BqucCiGX.mjs} +3 -3
- package/dist/{add-collection-D36mvhlp.mjs → add-collection-DYnUVgZo.mjs} +6 -6
- package/dist/{api-key-D7FJ0diY.mjs → api-key-DqiFwfHf.mjs} +1 -1
- package/dist/archive-1TGgAxcg.mjs +39 -0
- package/dist/archive-DG0VCVCQ.mjs +44 -0
- package/dist/archive-E8nahkCU.mjs +44 -0
- package/dist/{archive-BhrD3g9q.mjs → archive-uhl-s870.mjs} +3 -3
- package/dist/auth-BwgJWXyH.mjs +19 -0
- package/dist/{body-po-d1TER.mjs → body-Brsr9GPd.mjs} +1 -1
- package/dist/{branches-C_QIaXq_.mjs → branches-BV8k-tAp.mjs} +4 -4
- package/dist/cancel-BAuwBvUG.mjs +56 -0
- package/dist/{cancel-task-BUBIAgGA.mjs → cancel-task-CSGWE1Xk.mjs} +4 -4
- package/dist/card-C01m8xhO.mjs +20 -0
- package/dist/{cards-CURArHer.mjs → cards-szqvWxGJ.mjs} +4 -4
- package/dist/cli.mjs +23 -20
- package/dist/collection-P6ADc9R3.mjs +19 -0
- package/dist/{create-CCji2u2l.mjs → create--vi0p8KW.mjs} +3 -3
- package/dist/{create-D3PbG6zp.mjs → create-BCRzAvM-.mjs} +3 -3
- package/dist/{create-CSb4rEYN.mjs → create-BFwMq6f7.mjs} +4 -4
- package/dist/{create-SD_4KNY7.mjs → create-By7kJgQT.mjs} +4 -4
- package/dist/{create-Pz8emM9b.mjs → create-C-UY_5UO.mjs} +4 -4
- package/dist/create-CG_qAdUo.mjs +40 -0
- package/dist/create-CR7I3bWe.mjs +44 -0
- package/dist/{create-DTTeHc01.mjs → create-DhwxqVwf.mjs} +4 -4
- package/dist/{create-branch-DY_Xk7xJ.mjs → create-branch-ZnI44f-h.mjs} +4 -4
- package/dist/create-vo7uPJKP.mjs +40 -0
- package/dist/{create-ZbmxIy-0.mjs → create-xsykgRhW.mjs} +4 -4
- package/dist/{credentials-Cx9Y_e-i.mjs → credentials-DaHDYji4.mjs} +6 -6
- package/dist/{current-task-DVhQW4jT.mjs → current-task-Bu0sANO6.mjs} +4 -4
- package/dist/{dashboard-BJXi1tGr.mjs → dashboard-CztCJxke.mjs} +10 -1
- package/dist/dashboard-j8xycFUI.mjs +20 -0
- package/dist/{database-BAvx1gH2.mjs → database-CTMSbjcD.mjs} +3 -3
- package/dist/database-GbK7OAPX.mjs +51 -0
- package/dist/db-BHPFrKDz.mjs +22 -0
- package/dist/{delete-Vl85AALS.mjs → delete-Bhg_ZVaN.mjs} +4 -4
- package/dist/{delete-BGxR7gVt.mjs → delete-DaHvtXiY.mjs} +4 -4
- package/dist/{delete-table-ClBj6G7Q.mjs → delete-table-D9Nk1EcR.mjs} +4 -4
- package/dist/{deprovision-CwrA3yQY.mjs → deprovision-BUkv6QvW.mjs} +8 -8
- package/dist/{dirty-CNPWGSpA.mjs → dirty-bskqjgxM.mjs} +4 -4
- package/dist/{docker-Cvj7_PZp.mjs → docker-BH3ZgM8X.mjs} +3 -12
- package/dist/{eid-DFaDBRra.mjs → eid-C-j8C4fU.mjs} +1 -1
- package/dist/{export-DuMGd6lo.mjs → export-C148vmMO.mjs} +5 -5
- package/dist/field-BakUM_Le.mjs +142 -0
- package/dist/field-xPcJNejW.mjs +18 -0
- package/dist/fields-B8buJtIm.mjs +38 -0
- package/dist/{get--PcCqyKa.mjs → get-4QVOFifd.mjs} +4 -4
- package/dist/{get-B2r9MJly.mjs → get-4v0BZc-t.mjs} +4 -4
- package/dist/get-BCGqXIPq.mjs +36 -0
- package/dist/{get-swr2-leH.mjs → get-CpBnUZwG.mjs} +4 -4
- package/dist/{get-DfO9yXXn.mjs → get-DF_gcqj0.mjs} +4 -4
- package/dist/{get-BjLQvtIP.mjs → get-DSkpEq1B.mjs} +7 -7
- package/dist/get-DTvJO9pW.mjs +36 -0
- package/dist/{get-vajO-hi6.mjs → get-DU6bgBj5.mjs} +3 -3
- package/dist/{get-CoDOJTMY.mjs → get-DdTCMlFK.mjs} +4 -4
- package/dist/{get-Dyf1VRQF.mjs → get-DvZdIqEo.mjs} +2 -2
- package/dist/get-mkCpPcfT.mjs +49 -0
- package/dist/get-run-B9WJuQXB.mjs +36 -0
- package/dist/get-ystbsKwy.mjs +36 -0
- package/dist/{has-remote-changes-BqwcNcE7.mjs → has-remote-changes-w3xtnKKN.mjs} +4 -4
- package/dist/{import-D--2vqZQ.mjs → import-BPYmRYty.mjs} +5 -5
- package/dist/is-dirty-DF3Xq5qO.mjs +10 -0
- package/dist/{is-dirty-DQ9zG6uN.mjs → is-dirty-DUbSH-Fj.mjs} +2 -2
- package/dist/{items-DwQQ0GAg.mjs → items-B7RHTH7w.mjs} +4 -50
- package/dist/{license-CzMfg5XI.mjs → license-msMkO5-a.mjs} +3 -3
- package/dist/{list-D-L9cq2y.mjs → list-5bWQaEkJ.mjs} +3 -3
- package/dist/{list-BIK_58XI.mjs → list-6zA_S9iX.mjs} +2 -2
- package/dist/list-BD9Jmswp.mjs +32 -0
- package/dist/{list-DQeGs5DL.mjs → list-BFc86CqB.mjs} +3 -3
- package/dist/{list-C79o1l5H.mjs → list-BY6QmcNt.mjs} +28 -7
- package/dist/list-BxFVxGJK.mjs +40 -0
- package/dist/{list-zFg_sbzo.mjs → list-CLR3hoKB.mjs} +3 -3
- package/dist/list-ChLXLMJC.mjs +32 -0
- package/dist/{list-DMwbB4b4.mjs → list-DHnoy9Ev.mjs} +3 -3
- package/dist/{list-BtC8ka3k.mjs → list-DIHwUIWc.mjs} +2 -2
- package/dist/{list-0NpAfgQ4.mjs → list-DaaVEqTW.mjs} +5 -5
- package/dist/{list-FCYnuxeR.mjs → list-DjVp_1u5.mjs} +3 -3
- package/dist/{list-BEjK80yL.mjs → list-Y7rBS4VK.mjs} +2 -2
- package/dist/{login-CzssJlL2.mjs → login-CmF_pjd2.mjs} +10 -3
- package/dist/{logout-Bcwc7QN0.mjs → logout-DALwZk8q.mjs} +3 -3
- package/dist/{logs-DIEyUxpM.mjs → logs-CzpMbpFk.mjs} +5 -5
- package/dist/measure-B1GKcZxO.mjs +67 -0
- package/dist/measure-Cx8PcNRI.mjs +19 -0
- package/dist/{get-CLCdkBcw.mjs → metadata-D0ggtGp6.mjs} +13 -11
- package/dist/metadata-D5ZVNh69.mjs +37 -0
- package/dist/{package-DW4n6lFo.mjs → package-CTWKbRR5.mjs} +1 -1
- package/dist/paginate-CnTxzOh2.mjs +49 -0
- package/dist/{parse-id-DCdBU-nG.mjs → parse-id-Ca6bGAcg.mjs} +1 -1
- package/dist/{parse-schemas-dp6MXbcF.mjs → parse-schemas-uQAt-gDD.mjs} +1 -1
- package/dist/{poll-DaJLfYpK.mjs → poll-Cn1Nr5Pl.mjs} +1 -1
- package/dist/{poll-task-BiYw9iLs.mjs → poll-task-BjJqLBll.mjs} +2 -2
- package/dist/{provision-DqfOs_BL.mjs → provision-DYh9vESV.mjs} +9 -9
- package/dist/{ps-C-oTI3y_.mjs → ps-BUonSMn-.mjs} +2 -2
- package/dist/{ps-zD4MZ7s2.mjs → ps-C2etyNAz.mjs} +5 -5
- package/dist/{query-CiX4UQt3.mjs → query-1DBC2Z68.mjs} +3 -3
- package/dist/{query-eDZSuQaQ.mjs → query-kx5oNHCU.mjs} +3 -3
- package/dist/{remove-Bx1w-uWB.mjs → remove-BG7zWERm.mjs} +5 -5
- package/dist/{remove-BsNj8FcZ.mjs → remove-DHUAqV27.mjs} +2 -2
- package/dist/{remove-collection-CYRloViE.mjs → remove-collection-D9vlLH3f.mjs} +6 -6
- package/dist/rescan-values-Dvqkfe9U.mjs +43 -0
- package/dist/revision-message-flag-BJiGjb5m.mjs +11 -0
- package/dist/{run-o1HdcHcT.mjs → run-w_n6pESZ.mjs} +10 -10
- package/dist/runs-BTZGIWfv.mjs +54 -0
- package/dist/{runtime-BlGbSVbh.mjs → runtime-C3pZKYWJ.mjs} +72 -5
- package/dist/schema-tables-_xH9x_yJ.mjs +45 -0
- package/dist/schemas-qK9k1t5x.mjs +47 -0
- package/dist/{search-CshaaZOi.mjs → search-D_uT_dIh.mjs} +3 -3
- package/dist/segment-CQ5w3M_W.mjs +70 -0
- package/dist/segment-Dx6-fvSJ.mjs +19 -0
- package/dist/{set-Dj-zpi9u.mjs → set-CXfpvjWh.mjs} +2 -2
- package/dist/{set-CS0Bay1g.mjs → set-Du-INOmN.mjs} +5 -5
- package/dist/{setting-CPrSDcuC.mjs → setting-zXeJEuKW.mjs} +3 -3
- package/dist/{setup-BjsZgvZs.mjs → setup-BeGXrMCK.mjs} +3 -3
- package/dist/snippet-BGE_y5l0.mjs +19 -0
- package/dist/snippet-DRTklDg3.mjs +64 -0
- package/dist/{start-DK1KR98G.mjs → start-CemnHYMT.mjs} +44 -25
- package/dist/{stash-CDSI72Pi.mjs → stash-B4iqDei9.mjs} +5 -5
- package/dist/{status-DygsyoJt.mjs → status-BU6KBkX4.mjs} +5 -5
- package/dist/{status-B6X-VTeS.mjs → status-CfwmzKep.mjs} +2 -2
- package/dist/{status-C32y4hQx.mjs → status-rZUhzHtx.mjs} +2 -2
- package/dist/{stop-D8DPsVEP.mjs → stop-CRvnlAXn.mjs} +6 -6
- package/dist/summary-CaatzK3v.mjs +41 -0
- package/dist/sync-Bx9Iy66T.mjs +28 -0
- package/dist/sync-schema-DhLi3v8y.mjs +43 -0
- package/dist/{table-DimNUJtH.mjs → table-DhB2_Dxd.mjs} +21 -4
- package/dist/table-iRHsX6DM.mjs +19 -0
- package/dist/{transform-DRDHuulD.mjs → transform-92odFxg-.mjs} +45 -3
- package/dist/transform-DbE5u-t0.mjs +24 -0
- package/dist/transform-job-SWvb21qd.mjs +19 -0
- package/dist/{translate-bzGSUcP5.mjs → translate-23bZkSH8.mjs} +3 -3
- package/dist/{tree-BXf2Avg_.mjs → tree-B-X7i4bS.mjs} +2 -2
- package/dist/update-BWSckjxb.mjs +51 -0
- package/dist/{update-C_kb0VT2.mjs → update-B_CgvuPe.mjs} +5 -5
- package/dist/{update-C8ZrbNAQ.mjs → update-BqK9kPjo.mjs} +5 -5
- package/dist/update-CrPaxzNT.mjs +52 -0
- package/dist/{update-2rOSt-uC.mjs → update-Cvu0W1Gc.mjs} +9 -9
- package/dist/{update-qBaNdoVm.mjs → update-DUrtN9gl.mjs} +4 -4
- package/dist/update-Dttkbveb.mjs +51 -0
- package/dist/update-Dy-j9Scf.mjs +51 -0
- package/dist/{update-dashcard-Dz8n_Eb3.mjs → update-dashcard-DczxuWJ6.mjs} +5 -5
- package/dist/{update-DFGi07_J.mjs → update-uBgZZAhv.mjs} +5 -5
- package/dist/update-y5rpTFYD.mjs +52 -0
- package/dist/{url-DntR9Vt0.mjs → url-B3Gp2vZx.mjs} +5 -5
- package/dist/values-B1VY8N-9.mjs +36 -0
- package/dist/{wait-CCC_NXX_.mjs → wait-8cMbKe5F.mjs} +5 -5
- package/dist/{wait-w-EDNseb.mjs → wait-Bd5-zU25.mjs} +2 -2
- package/dist/{wait-flags-UxcaSinn.mjs → wait-flags-D-t7OkHC.mjs} +2 -2
- package/dist/workspace-CNkKAM__.mjs +24 -0
- package/package.json +1 -1
- package/dist/auth-BaXOzAzt.mjs +0 -19
- package/dist/card-dTdbUqvv.mjs +0 -20
- package/dist/collection-DZm1oB_J.mjs +0 -19
- package/dist/dashboard-D3ujvyqS.mjs +0 -20
- package/dist/database-C5LkxQ5G.mjs +0 -33
- package/dist/db-TY_YuEzV.mjs +0 -17
- package/dist/field-C1ai7Y05.mjs +0 -76
- package/dist/field-DgYYRJPe.mjs +0 -13
- package/dist/is-dirty-DChKYsYS.mjs +0 -10
- package/dist/sync-BrLw4QgM.mjs +0 -28
- package/dist/table-Dv2QUqKb.mjs +0 -16
- package/dist/transform-C_I-Hc1p.mjs +0 -21
- package/dist/transform-job-4CwmLSTV.mjs +0 -19
- package/dist/workspace-DmQKLMZY.mjs +0 -24
- /package/dist/{delete-runtime-Dx4ONQaO.mjs → delete-runtime-DCc3Hie4.mjs} +0 -0
- /package/dist/{key-CS6durfH.mjs → key-CjpAYsPz.mjs} +0 -0
- /package/dist/{manifest-C7lnUosz.mjs → manifest-CdAV6-YB.mjs} +0 -0
- /package/dist/{setting-DEHSnsEV.mjs → setting-DIXJ2haa.mjs} +0 -0
- /package/dist/{transform-job-BqYZMjf5.mjs → transform-job-DgApCViL.mjs} +0 -0
- /package/dist/{workspace-CTwXenWM.mjs → workspace-D93cDL8-.mjs} +0 -0
- /package/dist/{workspace-credentials-CC_99x9r.mjs → workspace-credentials-D_ivv5vy.mjs} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
+
import { renderList } from "./render-BYWlZPEH.mjs";
|
|
4
|
+
import "./errors-C6w1eZ1F.mjs";
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, listEnvelopeSchema, outputFlags, profileFlag, wrapList } from "./runtime-C3pZKYWJ.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-Ca6bGAcg.mjs";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
//#region src/commands/db/schemas.ts
|
|
10
|
+
const SchemaName = z.object({ name: z.string() });
|
|
11
|
+
const schemaNameView = {
|
|
12
|
+
compactPick: SchemaName,
|
|
13
|
+
tableColumns: [{
|
|
14
|
+
key: "name",
|
|
15
|
+
label: "Schema"
|
|
16
|
+
}]
|
|
17
|
+
};
|
|
18
|
+
const SchemasApiResponse = z.array(z.string());
|
|
19
|
+
const DatabaseSchemaListEnvelope = listEnvelopeSchema(SchemaName);
|
|
20
|
+
var schemas_default = defineMetabaseCommand({
|
|
21
|
+
meta: {
|
|
22
|
+
name: "schemas",
|
|
23
|
+
description: "List schemas in a database"
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
...outputFlags,
|
|
27
|
+
...profileFlag,
|
|
28
|
+
...connectionFlags,
|
|
29
|
+
id: {
|
|
30
|
+
type: "positional",
|
|
31
|
+
description: "Database id",
|
|
32
|
+
required: true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
outputSchema: DatabaseSchemaListEnvelope,
|
|
36
|
+
examples: ["metabase db schemas 1", "metabase db schemas 1 --json"],
|
|
37
|
+
async run({ args, ctx, getClient }) {
|
|
38
|
+
const id = parseId(args.id);
|
|
39
|
+
const client = await getClient();
|
|
40
|
+
const names = await client.requestParsed(SchemasApiResponse, `/api/database/${id}/schemas`);
|
|
41
|
+
const rows = names.map((name) => ({ name }));
|
|
42
|
+
renderList(wrapList(rows), schemaNameView, ctx);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { schemas_default as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
3
|
import { renderList } from "./render-BYWlZPEH.mjs";
|
|
4
4
|
import "./errors-C6w1eZ1F.mjs";
|
|
5
|
-
import { connectionFlags, defineMetabaseCommand, listEnvelopeSchema, outputFlags, parseEnumCsv, profileFlag } from "./runtime-
|
|
6
|
-
import { parseId } from "./parse-id-
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, listEnvelopeSchema, outputFlags, parseEnumCsv, profileFlag } from "./runtime-C3pZKYWJ.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-Ca6bGAcg.mjs";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
|
|
9
9
|
//#region src/domain/search.ts
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/domain/segment.ts
|
|
4
|
+
const Segment = z.object({
|
|
5
|
+
id: z.number().int(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
description: z.string().nullable(),
|
|
8
|
+
archived: z.boolean(),
|
|
9
|
+
table_id: z.number().int(),
|
|
10
|
+
definition: z.unknown(),
|
|
11
|
+
creator_id: z.number().int(),
|
|
12
|
+
entity_id: z.string().nullable(),
|
|
13
|
+
show_in_getting_started: z.boolean().nullable(),
|
|
14
|
+
caveats: z.string().nullable(),
|
|
15
|
+
points_of_interest: z.string().nullable(),
|
|
16
|
+
definition_description: z.string().nullable().optional(),
|
|
17
|
+
created_at: z.string(),
|
|
18
|
+
updated_at: z.string()
|
|
19
|
+
}).loose();
|
|
20
|
+
const SegmentCompact = Segment.pick({
|
|
21
|
+
id: true,
|
|
22
|
+
name: true,
|
|
23
|
+
description: true,
|
|
24
|
+
archived: true,
|
|
25
|
+
table_id: true
|
|
26
|
+
}).strip();
|
|
27
|
+
const segmentView = {
|
|
28
|
+
compactPick: SegmentCompact,
|
|
29
|
+
tableColumns: [
|
|
30
|
+
{
|
|
31
|
+
key: "id",
|
|
32
|
+
label: "ID"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
key: "name",
|
|
36
|
+
label: "Name"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "description",
|
|
40
|
+
label: "Description"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: "table_id",
|
|
44
|
+
label: "Table"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: "archived",
|
|
48
|
+
label: "Archived"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
};
|
|
52
|
+
const SegmentCreateInput = z.object({
|
|
53
|
+
name: z.string().min(1),
|
|
54
|
+
table_id: z.number().int().positive(),
|
|
55
|
+
definition: z.record(z.string(), z.unknown()),
|
|
56
|
+
description: z.string().nullable().optional()
|
|
57
|
+
}).loose();
|
|
58
|
+
const SegmentUpdateInput = z.object({
|
|
59
|
+
name: z.string().min(1).optional(),
|
|
60
|
+
definition: z.record(z.string(), z.unknown()).optional(),
|
|
61
|
+
revision_message: z.string().min(1),
|
|
62
|
+
archived: z.boolean().optional(),
|
|
63
|
+
description: z.string().nullable().optional(),
|
|
64
|
+
caveats: z.string().nullable().optional(),
|
|
65
|
+
points_of_interest: z.string().nullable().optional(),
|
|
66
|
+
show_in_getting_started: z.boolean().optional()
|
|
67
|
+
}).loose();
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { Segment, SegmentCompact, SegmentCreateInput, SegmentUpdateInput, segmentView };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/segment/index.ts
|
|
4
|
+
var segment_default = defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "segment",
|
|
7
|
+
description: "Inspect Metabase segments"
|
|
8
|
+
},
|
|
9
|
+
subCommands: {
|
|
10
|
+
list: () => import("./list-ChLXLMJC.mjs").then((mod) => mod.default),
|
|
11
|
+
get: () => import("./get-DTvJO9pW.mjs").then((mod) => mod.default),
|
|
12
|
+
create: () => import("./create-vo7uPJKP.mjs").then((mod) => mod.default),
|
|
13
|
+
update: () => import("./update-Dy-j9Scf.mjs").then((mod) => mod.default),
|
|
14
|
+
archive: () => import("./archive-E8nahkCU.mjs").then((mod) => mod.default)
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { segment_default as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
3
|
import { renderItem, warn } from "./render-BYWlZPEH.mjs";
|
|
4
4
|
import { ConfigError } from "./errors-C6w1eZ1F.mjs";
|
|
5
5
|
import { readInput } from "./input-DMcm_A5s.mjs";
|
|
6
|
-
import { defineMetabaseCommand, outputFlags, readEnvLicenseToken, writeLicense } from "./runtime-
|
|
6
|
+
import { defineMetabaseCommand, outputFlags, readEnvLicenseToken, writeLicense } from "./runtime-C3pZKYWJ.mjs";
|
|
7
7
|
import { promptPassword } from "./prompt-k9s4Ntk5.mjs";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
3
|
import { renderItem } from "./render-BYWlZPEH.mjs";
|
|
4
4
|
import "./errors-C6w1eZ1F.mjs";
|
|
5
5
|
import "./input-DMcm_A5s.mjs";
|
|
6
|
-
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-
|
|
7
|
-
import { readBody } from "./body-
|
|
8
|
-
import { SettingValue, settingValueView } from "./setting-
|
|
9
|
-
import { parseSettingKey } from "./key-
|
|
6
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-C3pZKYWJ.mjs";
|
|
7
|
+
import { readBody } from "./body-Brsr9GPd.mjs";
|
|
8
|
+
import { SettingValue, settingValueView } from "./setting-DIXJ2haa.mjs";
|
|
9
|
+
import { parseSettingKey } from "./key-CjpAYsPz.mjs";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
|
|
12
12
|
//#region src/commands/setting/set.ts
|
|
@@ -8,9 +8,9 @@ var setting_default = defineCommand({
|
|
|
8
8
|
alias: "settings"
|
|
9
9
|
},
|
|
10
10
|
subCommands: {
|
|
11
|
-
list: () => import("./list-
|
|
12
|
-
get: () => import("./get
|
|
13
|
-
set: () => import("./set-
|
|
11
|
+
list: () => import("./list-BFc86CqB.mjs").then((m) => m.default),
|
|
12
|
+
get: () => import("./get-4QVOFifd.mjs").then((m) => m.default),
|
|
13
|
+
set: () => import("./set-Du-INOmN.mjs").then((m) => m.default)
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
3
|
import { renderItem } from "./render-BYWlZPEH.mjs";
|
|
4
4
|
import "./errors-C6w1eZ1F.mjs";
|
|
5
5
|
import "./input-DMcm_A5s.mjs";
|
|
6
|
-
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-
|
|
7
|
-
import { readBody } from "./body-
|
|
6
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-C3pZKYWJ.mjs";
|
|
7
|
+
import { readBody } from "./body-Brsr9GPd.mjs";
|
|
8
8
|
import { bodyInputFlags } from "./body-flags-BK7J6Daz.mjs";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/snippet/index.ts
|
|
4
|
+
var snippet_default = defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "snippet",
|
|
7
|
+
description: "Inspect Metabase native query snippets"
|
|
8
|
+
},
|
|
9
|
+
subCommands: {
|
|
10
|
+
list: () => import("./list-BxFVxGJK.mjs").then((mod) => mod.default),
|
|
11
|
+
get: () => import("./get-BCGqXIPq.mjs").then((mod) => mod.default),
|
|
12
|
+
create: () => import("./create-CR7I3bWe.mjs").then((mod) => mod.default),
|
|
13
|
+
update: () => import("./update-y5rpTFYD.mjs").then((mod) => mod.default),
|
|
14
|
+
archive: () => import("./archive-1TGgAxcg.mjs").then((mod) => mod.default)
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { snippet_default as default };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/domain/snippet.ts
|
|
4
|
+
const Snippet = z.object({
|
|
5
|
+
id: z.number().int(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
description: z.string().nullable(),
|
|
8
|
+
content: z.string(),
|
|
9
|
+
archived: z.boolean(),
|
|
10
|
+
collection_id: z.number().int().nullable(),
|
|
11
|
+
creator_id: z.number().int(),
|
|
12
|
+
entity_id: z.string().nullable(),
|
|
13
|
+
template_tags: z.record(z.string(), z.unknown()).nullable(),
|
|
14
|
+
created_at: z.string(),
|
|
15
|
+
updated_at: z.string()
|
|
16
|
+
}).loose();
|
|
17
|
+
const SnippetCompact = Snippet.pick({
|
|
18
|
+
id: true,
|
|
19
|
+
name: true,
|
|
20
|
+
description: true,
|
|
21
|
+
archived: true,
|
|
22
|
+
collection_id: true
|
|
23
|
+
}).strip();
|
|
24
|
+
const snippetView = {
|
|
25
|
+
compactPick: SnippetCompact,
|
|
26
|
+
tableColumns: [
|
|
27
|
+
{
|
|
28
|
+
key: "id",
|
|
29
|
+
label: "ID"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: "name",
|
|
33
|
+
label: "Name"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: "description",
|
|
37
|
+
label: "Description"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key: "collection_id",
|
|
41
|
+
label: "Collection"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: "archived",
|
|
45
|
+
label: "Archived"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
const SnippetCreateInput = z.object({
|
|
50
|
+
name: z.string().min(1),
|
|
51
|
+
content: z.string(),
|
|
52
|
+
description: z.string().nullable().optional(),
|
|
53
|
+
collection_id: z.number().int().positive().nullable().optional()
|
|
54
|
+
}).loose();
|
|
55
|
+
const SnippetUpdateInput = z.object({
|
|
56
|
+
name: z.string().min(1).optional(),
|
|
57
|
+
content: z.string().optional(),
|
|
58
|
+
description: z.string().nullable().optional(),
|
|
59
|
+
archived: z.boolean().optional(),
|
|
60
|
+
collection_id: z.number().int().positive().nullable().optional()
|
|
61
|
+
}).loose();
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { Snippet, SnippetCompact, SnippetCreateInput, SnippetUpdateInput, snippetView };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
3
|
import { renderItem, warn } from "./render-BYWlZPEH.mjs";
|
|
4
4
|
import { ConfigError, errorMessage } from "./errors-C6w1eZ1F.mjs";
|
|
5
|
-
import { connectionFlags, defineMetabaseCommand, localUrl, outputFlags, parseInteger, parseOptionalInteger, profileFlag, resolveLicenseToken } from "./runtime-
|
|
6
|
-
import { parseId } from "./parse-id-
|
|
7
|
-
import { pollUntil } from "./poll-
|
|
8
|
-
import { Workspace } from "./workspace-
|
|
9
|
-
import { CONTAINER_REPO_DIR, checkDockerReady, containerLifecycleStatus, containerNameFor, pullImage, removeContainer, runProcess, runWorkspaceContainer, scrubContainerConfig, waitForConfigConsumed } from "./docker-
|
|
10
|
-
import { REPO_SYNC_MODES, RepoSyncMode, buildCredentialsJson, generateWorkspaceCredentials, injectCredentialsIntoConfig, injectRepoSettingsIntoConfig } from "./workspace-credentials-
|
|
5
|
+
import { connectionFlags, createClient, defineMetabaseCommand, localUrl, outputFlags, parseInteger, parseOptionalInteger, profileFlag, resolveLicenseToken } from "./runtime-C3pZKYWJ.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-Ca6bGAcg.mjs";
|
|
7
|
+
import { pollUntil } from "./poll-Cn1Nr5Pl.mjs";
|
|
8
|
+
import { Workspace } from "./workspace-D93cDL8-.mjs";
|
|
9
|
+
import { CONTAINER_REPO_DIR, checkDockerReady, containerLifecycleStatus, containerNameFor, pullImage, removeContainer, runProcess, runWorkspaceContainer, scrubContainerConfig, waitForConfigConsumed } from "./docker-BH3ZgM8X.mjs";
|
|
10
|
+
import { REPO_SYNC_MODES, RepoSyncMode, buildCredentialsJson, generateWorkspaceCredentials, injectCredentialsIntoConfig, injectRepoSettingsIntoConfig } from "./workspace-credentials-D_ivv5vy.mjs";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { stat } from "node:fs/promises";
|
|
13
13
|
import { resolve } from "node:path";
|
|
@@ -53,13 +53,14 @@ async function findFreePort(start) {
|
|
|
53
53
|
//#region src/commands/workspace/start.ts
|
|
54
54
|
const DEFAULT_IMAGE = "metabase/metabase-dev:feature-workspaces-v2";
|
|
55
55
|
const DEFAULT_HOST_PORT = 3e3;
|
|
56
|
-
const
|
|
57
|
-
const DEFAULT_CONFIG_CONSUMED_TIMEOUT_MS = 6e4;
|
|
56
|
+
const DEFAULT_READY_TIMEOUT_MS = 24e4;
|
|
58
57
|
const HEALTH_INTERVAL_MS = 2e3;
|
|
59
58
|
const HEALTH_MAX_INTERVAL_MS = 1e4;
|
|
60
59
|
const HEALTH_PROBE_TIMEOUT_MS = 4e3;
|
|
61
60
|
const DEFAULT_REPO_MODE = "read-write";
|
|
62
61
|
const REPO_FILE_URL = `file://${CONTAINER_REPO_DIR}`;
|
|
62
|
+
const METADATA_IMPORT_TIMEOUT_MS = DEFAULT_READY_TIMEOUT_MS;
|
|
63
|
+
const MetadataImportResult = z.object({ success: z.boolean() });
|
|
63
64
|
const StartResult = z.object({
|
|
64
65
|
workspace_id: z.number().int().positive(),
|
|
65
66
|
workspace_name: z.string(),
|
|
@@ -120,13 +121,13 @@ var start_default = defineMetabaseCommand({
|
|
|
120
121
|
},
|
|
121
122
|
wait: {
|
|
122
123
|
type: "boolean",
|
|
123
|
-
description: "Block until /api/health is ready before returning. Default: return as soon as the container has consumed config.yml.",
|
|
124
|
+
description: "Block until /api/health is ready before returning. Default: return as soon as the container has consumed config.yml. (Implied when --metadata is on, since the import requires a live API.)",
|
|
124
125
|
default: false
|
|
125
126
|
},
|
|
126
127
|
timeout: {
|
|
127
128
|
type: "string",
|
|
128
|
-
description: `
|
|
129
|
-
default: String(
|
|
129
|
+
description: `Per-phase readiness deadline in ms — covers post-create config consumption and (with --wait) the /api/health probe. Default: ${DEFAULT_READY_TIMEOUT_MS}.`,
|
|
130
|
+
default: String(DEFAULT_READY_TIMEOUT_MS)
|
|
130
131
|
},
|
|
131
132
|
pull: {
|
|
132
133
|
type: "boolean",
|
|
@@ -135,12 +136,12 @@ var start_default = defineMetabaseCommand({
|
|
|
135
136
|
},
|
|
136
137
|
metadata: {
|
|
137
138
|
type: "boolean",
|
|
138
|
-
description: "Fetch the workspace's warehouse metadata and
|
|
139
|
+
description: "Fetch the workspace's warehouse metadata from the parent and POST it to the child instance once it is healthy",
|
|
139
140
|
default: true
|
|
140
141
|
},
|
|
141
142
|
force: {
|
|
142
143
|
type: "boolean",
|
|
143
|
-
description: "
|
|
144
|
+
description: "Remove and recreate the container even if it is running. Stopped containers (exited/created/dead) are recreated automatically without this flag.",
|
|
144
145
|
default: false
|
|
145
146
|
},
|
|
146
147
|
repo: {
|
|
@@ -174,7 +175,7 @@ var start_default = defineMetabaseCommand({
|
|
|
174
175
|
name: "--port",
|
|
175
176
|
min: 1
|
|
176
177
|
});
|
|
177
|
-
const
|
|
178
|
+
const readyTimeoutMs = parseInteger(args.timeout ?? String(DEFAULT_READY_TIMEOUT_MS), {
|
|
178
179
|
name: "--timeout",
|
|
179
180
|
min: 1e3
|
|
180
181
|
});
|
|
@@ -182,7 +183,7 @@ var start_default = defineMetabaseCommand({
|
|
|
182
183
|
const resolved = await getResolvedConfig();
|
|
183
184
|
const licenseToken = await resolveLicenseToken({});
|
|
184
185
|
await checkDockerReady();
|
|
185
|
-
await ensureNoExistingContainer(containerName, args.force);
|
|
186
|
+
await ensureNoExistingContainer(workspaceId, containerName, args.force);
|
|
186
187
|
const pullPromise = args.pull ? pullImage(args.image) : Promise.resolve();
|
|
187
188
|
const workspace = await client.requestParsed(Workspace, `/api/ee/workspace-manager/${workspaceId}`);
|
|
188
189
|
assertAllDatabasesProvisioned(workspace);
|
|
@@ -210,22 +211,23 @@ var start_default = defineMetabaseCommand({
|
|
|
210
211
|
hostPort,
|
|
211
212
|
configYaml,
|
|
212
213
|
credentialsJson,
|
|
213
|
-
metadataJson,
|
|
214
214
|
licenseToken,
|
|
215
215
|
bindMounts: repoOptions === null ? [] : [repoOptions.bindMount]
|
|
216
216
|
});
|
|
217
|
-
await waitForConfigConsumed(workspaceId,
|
|
217
|
+
await waitForConfigConsumed(workspaceId, readyTimeoutMs);
|
|
218
218
|
try {
|
|
219
219
|
await scrubContainerConfig(workspaceId);
|
|
220
220
|
} catch (error) {
|
|
221
221
|
warn(`could not scrub in-container config.yml: ${errorMessage(error)}`);
|
|
222
222
|
}
|
|
223
|
-
|
|
223
|
+
const needsHealth = args.wait || metadataJson !== null;
|
|
224
|
+
if (needsHealth) await waitForHealth(hostPort, readyTimeoutMs);
|
|
225
|
+
if (metadataJson !== null) await importMetadataIntoChild(hostPort, credentials, metadataJson);
|
|
224
226
|
const result = {
|
|
225
227
|
workspace_id: workspaceId,
|
|
226
228
|
workspace_name: workspace.name,
|
|
227
229
|
container_name: containerName,
|
|
228
|
-
state:
|
|
230
|
+
state: needsHealth ? "running" : "starting",
|
|
229
231
|
host_port: hostPort,
|
|
230
232
|
url: localUrl(hostPort),
|
|
231
233
|
image: args.image
|
|
@@ -242,13 +244,18 @@ function assertAllDatabasesProvisioned(workspace) {
|
|
|
242
244
|
throw new ConfigError(`workspace ${workspace.id} is not ready: ${summary}. Wait for provisioning to finish.`);
|
|
243
245
|
}
|
|
244
246
|
}
|
|
245
|
-
async function ensureNoExistingContainer(containerName, force) {
|
|
246
|
-
if (
|
|
247
|
-
|
|
248
|
-
if (status !== "missing") throw new ConfigError(`container ${containerName} already exists (state=${status}). Use --force to recreate, or stop/remove it first.`);
|
|
247
|
+
async function ensureNoExistingContainer(workspaceId, containerName, force) {
|
|
248
|
+
if (force) {
|
|
249
|
+
await removeContainer(containerName);
|
|
249
250
|
return;
|
|
250
251
|
}
|
|
251
|
-
await
|
|
252
|
+
const status = await containerLifecycleStatus(containerName);
|
|
253
|
+
if (status === "missing") return;
|
|
254
|
+
if (status === "exited" || status === "created" || status === "dead") {
|
|
255
|
+
await removeContainer(containerName);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
throw new ConfigError(`container ${containerName} is currently ${status}. Run \`metabase workspace stop ${workspaceId}\` first, or use --force to recreate it.`);
|
|
252
259
|
}
|
|
253
260
|
async function resolveHostPort(requested) {
|
|
254
261
|
if (requested !== null) {
|
|
@@ -282,6 +289,18 @@ async function waitForHealth(hostPort, timeoutMs) {
|
|
|
282
289
|
timeoutMs
|
|
283
290
|
});
|
|
284
291
|
}
|
|
292
|
+
async function importMetadataIntoChild(hostPort, credentials, metadataJson) {
|
|
293
|
+
const childClient = createClient({
|
|
294
|
+
url: localUrl(hostPort),
|
|
295
|
+
apiKey: credentials.api_key.key
|
|
296
|
+
});
|
|
297
|
+
const result = await childClient.requestParsed(MetadataImportResult, "/api/ee/serialization/metadata/import", {
|
|
298
|
+
method: "POST",
|
|
299
|
+
body: metadataJson,
|
|
300
|
+
timeoutMs: METADATA_IMPORT_TIMEOUT_MS
|
|
301
|
+
});
|
|
302
|
+
if (!result.success) throw new ConfigError("workspace child rejected the metadata import (returned success=false)");
|
|
303
|
+
}
|
|
285
304
|
async function resolveRepoOptions(input) {
|
|
286
305
|
if (input.hostPath === void 0 || input.hostPath === "") {
|
|
287
306
|
const explicitBranch = input.branch !== void 0;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
3
|
import { renderItem } from "./render-BYWlZPEH.mjs";
|
|
4
4
|
import { ConfigError } from "./errors-C6w1eZ1F.mjs";
|
|
5
|
-
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-
|
|
6
|
-
import { parseId } from "./parse-id-
|
|
7
|
-
import { REMOTE_SYNC_PATHS, SyncTask, pollFlags, pollSyncTask, throwIfFailedTask } from "./poll-task-
|
|
8
|
-
import "./poll-
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-C3pZKYWJ.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-Ca6bGAcg.mjs";
|
|
7
|
+
import { REMOTE_SYNC_PATHS, SyncTask, pollFlags, pollSyncTask, throwIfFailedTask } from "./poll-task-BjJqLBll.mjs";
|
|
8
|
+
import "./poll-Cn1Nr5Pl.mjs";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
|
|
11
11
|
//#region src/commands/sync/stash.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
3
|
import { renderItem } from "./render-BYWlZPEH.mjs";
|
|
4
4
|
import "./errors-C6w1eZ1F.mjs";
|
|
5
|
-
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-
|
|
6
|
-
import { REMOTE_SYNC_PATHS, SyncTask, fetchCurrentTask, fetchOptionalParsed } from "./poll-task-
|
|
7
|
-
import "./poll-
|
|
8
|
-
import { IsDirtyResult } from "./is-dirty-
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-C3pZKYWJ.mjs";
|
|
6
|
+
import { REMOTE_SYNC_PATHS, SyncTask, fetchCurrentTask, fetchOptionalParsed } from "./poll-task-BjJqLBll.mjs";
|
|
7
|
+
import "./poll-Cn1Nr5Pl.mjs";
|
|
8
|
+
import { IsDirtyResult } from "./is-dirty-DUbSH-Fj.mjs";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
|
|
11
11
|
//#region src/commands/sync/status.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
3
|
import { renderItem } from "./render-BYWlZPEH.mjs";
|
|
4
4
|
import "./errors-C6w1eZ1F.mjs";
|
|
5
|
-
import { account, credentials, defineMetabaseCommand, outputFlags } from "./runtime-
|
|
5
|
+
import { account, credentials, defineMetabaseCommand, outputFlags } from "./runtime-C3pZKYWJ.mjs";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
|
|
8
8
|
//#region src/commands/license/status.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
3
|
import { renderItem } from "./render-BYWlZPEH.mjs";
|
|
4
4
|
import "./errors-C6w1eZ1F.mjs";
|
|
5
|
-
import { account, credentials, defineMetabaseCommand, originOnly, outputFlags, profileFlag, resolveProfileName } from "./runtime-
|
|
5
|
+
import { account, credentials, defineMetabaseCommand, originOnly, outputFlags, profileFlag, resolveProfileName } from "./runtime-C3pZKYWJ.mjs";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
|
|
8
8
|
//#region src/commands/auth/status.ts
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "./package-
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
2
|
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
3
|
import { renderItem } from "./render-BYWlZPEH.mjs";
|
|
4
4
|
import "./errors-C6w1eZ1F.mjs";
|
|
5
|
-
import { defineMetabaseCommand, outputFlags } from "./runtime-
|
|
6
|
-
import { parseId } from "./parse-id-
|
|
7
|
-
import "./poll-
|
|
8
|
-
import { checkDockerReady, containerLifecycleStatus, containerNameFor, stopContainer } from "./docker-
|
|
9
|
-
import { LocalWorkspaceState } from "./ps-
|
|
5
|
+
import { defineMetabaseCommand, outputFlags } from "./runtime-C3pZKYWJ.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-Ca6bGAcg.mjs";
|
|
7
|
+
import "./poll-Cn1Nr5Pl.mjs";
|
|
8
|
+
import { checkDockerReady, containerLifecycleStatus, containerNameFor, stopContainer } from "./docker-BH3ZgM8X.mjs";
|
|
9
|
+
import { LocalWorkspaceState } from "./ps-BUonSMn-.mjs";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
|
|
12
12
|
//#region src/commands/workspace/stop.ts
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
+
import { renderItem } from "./render-BYWlZPEH.mjs";
|
|
4
|
+
import "./errors-C6w1eZ1F.mjs";
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-C3pZKYWJ.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-Ca6bGAcg.mjs";
|
|
7
|
+
import { FieldSummary, FieldSummaryRaw, fieldSummaryView } from "./field-BakUM_Le.mjs";
|
|
8
|
+
|
|
9
|
+
//#region src/commands/field/summary.ts
|
|
10
|
+
var summary_default = defineMetabaseCommand({
|
|
11
|
+
meta: {
|
|
12
|
+
name: "summary",
|
|
13
|
+
description: "Get the row count and distinct count for a field"
|
|
14
|
+
},
|
|
15
|
+
args: {
|
|
16
|
+
...outputFlags,
|
|
17
|
+
...profileFlag,
|
|
18
|
+
...connectionFlags,
|
|
19
|
+
id: {
|
|
20
|
+
type: "positional",
|
|
21
|
+
description: "Field id",
|
|
22
|
+
required: true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
outputSchema: FieldSummary,
|
|
26
|
+
examples: ["metabase field summary 100", "metabase field summary 100 --json"],
|
|
27
|
+
async run({ args, ctx, getClient }) {
|
|
28
|
+
const id = parseId(args.id);
|
|
29
|
+
const client = await getClient();
|
|
30
|
+
const [[, count], [, distincts]] = await client.requestParsed(FieldSummaryRaw, `/api/field/${id}/summary`);
|
|
31
|
+
const summary = {
|
|
32
|
+
field_id: id,
|
|
33
|
+
count,
|
|
34
|
+
distincts
|
|
35
|
+
};
|
|
36
|
+
renderItem(summary, fieldSummaryView, ctx);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { summary_default as default };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
|
|
3
|
+
//#region src/commands/sync/index.ts
|
|
4
|
+
var sync_default = defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "sync",
|
|
7
|
+
description: "Remote-sync operations (import, export, status, branches)"
|
|
8
|
+
},
|
|
9
|
+
subCommands: {
|
|
10
|
+
status: () => import("./status-BU6KBkX4.mjs").then((mod) => mod.default),
|
|
11
|
+
"is-dirty": () => import("./is-dirty-DF3Xq5qO.mjs").then((mod) => mod.default),
|
|
12
|
+
"has-remote-changes": () => import("./has-remote-changes-w3xtnKKN.mjs").then((mod) => mod.default),
|
|
13
|
+
dirty: () => import("./dirty-bskqjgxM.mjs").then((mod) => mod.default),
|
|
14
|
+
"current-task": () => import("./current-task-Bu0sANO6.mjs").then((mod) => mod.default),
|
|
15
|
+
"cancel-task": () => import("./cancel-task-CSGWE1Xk.mjs").then((mod) => mod.default),
|
|
16
|
+
wait: () => import("./wait-8cMbKe5F.mjs").then((mod) => mod.default),
|
|
17
|
+
import: () => import("./import-BPYmRYty.mjs").then((mod) => mod.default),
|
|
18
|
+
export: () => import("./export-C148vmMO.mjs").then((mod) => mod.default),
|
|
19
|
+
stash: () => import("./stash-B4iqDei9.mjs").then((mod) => mod.default),
|
|
20
|
+
branches: () => import("./branches-BV8k-tAp.mjs").then((mod) => mod.default),
|
|
21
|
+
"create-branch": () => import("./create-branch-ZnI44f-h.mjs").then((mod) => mod.default),
|
|
22
|
+
"add-collection": () => import("./add-collection-DYnUVgZo.mjs").then((mod) => mod.default),
|
|
23
|
+
"remove-collection": () => import("./remove-collection-D9vlLH3f.mjs").then((mod) => mod.default)
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { sync_default as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import "./package-CTWKbRR5.mjs";
|
|
2
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
+
import { renderItem } from "./render-BYWlZPEH.mjs";
|
|
4
|
+
import "./errors-C6w1eZ1F.mjs";
|
|
5
|
+
import { connectionFlags, defineMetabaseCommand, outputFlags, profileFlag } from "./runtime-C3pZKYWJ.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-Ca6bGAcg.mjs";
|
|
7
|
+
import "./field-BakUM_Le.mjs";
|
|
8
|
+
import "./table-DhB2_Dxd.mjs";
|
|
9
|
+
import { DatabaseSyncResult, databaseSyncResultView } from "./database-GbK7OAPX.mjs";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
|
|
12
|
+
//#region src/commands/db/sync-schema.ts
|
|
13
|
+
const SyncSchemaApiResponse = z.object({ status: z.literal("ok") });
|
|
14
|
+
var sync_schema_default = defineMetabaseCommand({
|
|
15
|
+
meta: {
|
|
16
|
+
name: "sync-schema",
|
|
17
|
+
description: "Trigger a manual schema sync for a database"
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
...outputFlags,
|
|
21
|
+
...profileFlag,
|
|
22
|
+
...connectionFlags,
|
|
23
|
+
id: {
|
|
24
|
+
type: "positional",
|
|
25
|
+
description: "Database id",
|
|
26
|
+
required: true
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
outputSchema: DatabaseSyncResult,
|
|
30
|
+
examples: ["metabase db sync-schema 1", "metabase db sync-schema 1 --json"],
|
|
31
|
+
async run({ args, ctx, getClient }) {
|
|
32
|
+
const id = parseId(args.id);
|
|
33
|
+
const client = await getClient();
|
|
34
|
+
const response = await client.requestParsed(SyncSchemaApiResponse, `/api/database/${id}/sync_schema`, { method: "POST" });
|
|
35
|
+
renderItem({
|
|
36
|
+
id,
|
|
37
|
+
status: response.status
|
|
38
|
+
}, databaseSyncResultView, ctx);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { sync_schema_default as default };
|