@metabase/cli 0.1.18 → 0.2.1-alpha.bcm-ghy-4075-spawn-default-profile.eb120d1
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 +283 -45
- package/dist/add-collection-CCpC-GUz.mjs +9 -0
- package/dist/{add-collection-CRZAFCZy.mjs → add-collection-CLXfrgp4.mjs} +4 -5
- package/dist/append-DMcxP1LM.mjs +42 -0
- package/dist/archive-4WqMsPWB.mjs +38 -0
- package/dist/{archive-De4yVEV8.mjs → archive-5inmbMDL.mjs} +5 -7
- package/dist/{archive-3mEhK9_H.mjs → archive-BggM_AuL.mjs} +5 -7
- package/dist/{archive-Z8ZM-ilB.mjs → archive-BmhehbS0.mjs} +8 -9
- package/dist/{archive-d74nDcp4.mjs → archive-BwIZzWGe.mjs} +5 -7
- package/dist/{archive-CFHYRF65.mjs → archive-DErhQn8A.mjs} +5 -7
- package/dist/archive-DTnz1suV.mjs +38 -0
- package/dist/{archive-C3RWdM-2.mjs → archive-Q1387APe.mjs} +7 -8
- package/dist/{archive-errg-EKw.mjs → archive-h-3H5b4K.mjs} +5 -7
- package/dist/auth-DzCAiArV.mjs +22 -0
- package/dist/{body-BS2s2zDl.mjs → body-5snfmiwR.mjs} +3 -3
- package/dist/{branches-mcyT7wI-.mjs → branches-PL170CYS.mjs} +5 -7
- package/dist/{cancel-B2l-i2NS.mjs → cancel-EFKcF5J_.mjs} +4 -6
- package/dist/{cancel-task-CugcIeIi.mjs → cancel-task-mFFx0d5m.mjs} +5 -7
- package/dist/capabilities-CiaAfUgX.mjs +684 -0
- package/dist/{card-DEmcRlNO.mjs → card-B8G5jQQT.mjs} +24 -18
- package/dist/card-BsfdXK0O.mjs +26 -0
- package/dist/{cards-BGkz5BeZ.mjs → cards-BI7zKb9M.mjs} +7 -8
- package/dist/cli.mjs +178 -29
- package/dist/collection-2h_by9Ue.mjs +23 -0
- package/dist/{collection-DrLpA1SO.mjs → collection-C52Ndi_O.mjs} +5 -3
- package/dist/{collection-namespace-BP_LJrAD.mjs → collection-namespace-uNA5WhLB.mjs} +2 -2
- package/dist/{create-Cztp5kES.mjs → create-BLD0YniB.mjs} +6 -7
- package/dist/create-BP8EIWrP.mjs +161 -0
- package/dist/{create-CkRFKtFG.mjs → create-BpizGzgQ.mjs} +8 -9
- package/dist/create-BxCsAdqc.mjs +45 -0
- package/dist/{create-DzyMvAVy.mjs → create-CBKT7SE_.mjs} +8 -9
- package/dist/{create-D8KA4zJA.mjs → create-CQ32FwVe.mjs} +11 -11
- package/dist/{create-YfGzANNB.mjs → create-CU3bYpsT.mjs} +8 -9
- package/dist/create-DAH24ltu.mjs +45 -0
- package/dist/{create-BOmmMSjF.mjs → create-DutkaD7P.mjs} +11 -12
- package/dist/{create-B4HAEEE0.mjs → create-FuZa4j1N.mjs} +8 -9
- package/dist/{create-wpvDXSSY.mjs → create-KveE3j3p.mjs} +12 -13
- package/dist/{create-DhrftYre.mjs → create-VrSowEbj.mjs} +14 -14
- package/dist/{create-CD9Rp8qs.mjs → create-acWKw4Y1.mjs} +14 -14
- package/dist/{create-branch-DsoMfx_2.mjs → create-branch-CP1Y4_El.mjs} +5 -7
- package/dist/{create-kWzqvTGR.mjs → create-xPfmI1Tu.mjs} +11 -12
- package/dist/csv-CZyYi0vi.mjs +58 -0
- package/dist/{current-task-WuKPZpZ6.mjs → current-task-BR4koo9z.mjs} +5 -7
- package/dist/dashboard-ARgJfamb.mjs +35 -0
- package/dist/{dashboard-DOplbKyQ.mjs → dashboard-BLihjDXg.mjs} +35 -15
- package/dist/{database-D9fftP-i.mjs → database-BOqzcexD.mjs} +2 -2
- package/dist/db-dbnxMPSR.mjs +27 -0
- package/dist/{delete-Buai0_e_.mjs → delete-BpL3vaaT.mjs} +6 -8
- package/dist/{delete-BCitmugk.mjs → delete-C5DqDwev.mjs} +6 -8
- package/dist/delete-DCDFLHFa.mjs +49 -0
- package/dist/delete-P2Qlsr_s.mjs +49 -0
- package/dist/{delete-CmGh0jo1.mjs → delete-ea_ns1uM.mjs} +6 -8
- package/dist/{delete-runtime-B0ha5QR4.mjs → delete-runtime-DdBn6poA.mjs} +2 -3
- package/dist/{delete-table-BOkYxdjA.mjs → delete-table-tM048btr.mjs} +6 -8
- package/dist/{dependencies-XZrEvHUA.mjs → dependencies-DdOTClO2.mjs} +5 -7
- package/dist/destroy-B51EPvOJ.mjs +168 -0
- package/dist/{dirty-B-5NDbG9.mjs → dirty-CEQYmhNF.mjs} +5 -7
- package/dist/{document-1W7NRaO_.mjs → document-D4zB-5a0.mjs} +20 -4
- package/dist/document-DR1FLOn9.mjs +22 -0
- package/dist/{eid-BCuJRv7a.mjs → eid-CtKGjAkz.mjs} +10 -11
- package/dist/embedding-CKdw8q7p.mjs +11 -0
- package/dist/events-C26DZ6yZ.mjs +44 -0
- package/dist/{export-Dod2gdyE.mjs → export-CippuWZJ.mjs} +5 -10
- package/dist/export-Cy2DFtR2.mjs +10 -0
- package/dist/field-CXDndCbB.mjs +21 -0
- package/dist/{field-CMY_LWUe.mjs → field-DsXTeqBy.mjs} +6 -4
- package/dist/{fields-B0yttrzR.mjs → fields-Xm_HVNcX.mjs} +6 -8
- package/dist/get-3O7hv4zv.mjs +67 -0
- package/dist/{get-D-pNrQGA.mjs → get-B0cq1uGy.mjs} +5 -7
- package/dist/{get-k6M5nGMC.mjs → get-B90bXbpw.mjs} +5 -7
- package/dist/{get-D7QMqPOK.mjs → get-BQBu2c94.mjs} +5 -7
- package/dist/{get-CfeYa0v5.mjs → get-BQz45IBF.mjs} +6 -7
- package/dist/get-BSfKWZNJ.mjs +35 -0
- package/dist/get-BdNC8WM8.mjs +38 -0
- package/dist/{get-DBY5esTW.mjs → get-Bj66bcuU.mjs} +5 -7
- package/dist/{get-BpZ81hX8.mjs → get-BrKqMM1d.mjs} +5 -7
- package/dist/{get-9p0Gt1c7.mjs → get-CjZWjRa5.mjs} +5 -7
- package/dist/{get-DISgP66L.mjs → get-CwGqARAf.mjs} +16 -9
- package/dist/{get-BkGh9BPd.mjs → get-D5crrFSf.mjs} +5 -7
- package/dist/{get-Dz7fcqoG.mjs → get-DTkvGu_J.mjs} +8 -9
- package/dist/{get-u5Uq9vms.mjs → get-DX2fp6BB.mjs} +4 -6
- package/dist/get-DYuJVlP-.mjs +35 -0
- package/dist/{get-DJ8huA8y.mjs → get-FIE88hj9.mjs} +7 -8
- package/dist/{get-B0OsW6jk.mjs → get-Ihx_XaaI.mjs} +5 -7
- package/dist/{get-run-DQJVpDw1.mjs → get-run-lVwhQVFx.mjs} +5 -7
- package/dist/{get-CbpHt4Hs.mjs → get-z0BKkiRX.mjs} +4 -6
- package/dist/git-sync-CmB4YBmS.mjs +31 -0
- package/dist/{group-BNE_RiH5.mjs → group-CILtQqCL.mjs} +2 -1
- package/dist/{has-remote-changes-DvQBXudi.mjs → has-remote-changes-DHrYSnTg.mjs} +5 -7
- package/dist/{import-PGS8-DwE.mjs → import-BU40xXSF.mjs} +7 -9
- package/dist/{input-7Sj85_K7.mjs → input-BGyHn0Kr.mjs} +6 -3
- package/dist/{is-dirty-DyEVFQVJ.mjs → is-dirty-BPluqPPP.mjs} +3 -4
- package/dist/is-dirty-DOy1TRcf.mjs +8 -0
- package/dist/{items-CkFEy2Du.mjs → items-BZpYkImP.mjs} +6 -8
- package/dist/{key-bltP32Pm.mjs → key-B8UAsQmB.mjs} +1 -1
- package/dist/{library-1AAVbk-K.mjs → library-BGWDIfEM.mjs} +6 -6
- package/dist/list-B037kJtH.mjs +39 -0
- package/dist/{list-82NkvRpI.mjs → list-B7Ihu6XI.mjs} +7 -8
- package/dist/{list-pQ22nXhQ.mjs → list-BCeZlfpQ.mjs} +4 -6
- package/dist/{list-CKzpoTgP.mjs → list-Bct00qku.mjs} +6 -8
- package/dist/{list-D-rgDFa5.mjs → list-Be8xMtS3.mjs} +8 -9
- package/dist/{list-Bb8YRON_.mjs → list-CjBPVJqd.mjs} +4 -6
- package/dist/{list-BCYTTCFD.mjs → list-CoqHnusK.mjs} +4 -6
- package/dist/{list-B9wXg3qi.mjs → list-CvaoHnl-.mjs} +3 -5
- package/dist/{list-BVzu2RIZ.mjs → list-DamRE5Ds.mjs} +4 -6
- package/dist/{list-BWAYDSbQ.mjs → list-DmopauvJ.mjs} +4 -6
- package/dist/{list-CJx5q-Yn.mjs → list-M_1sdYNH.mjs} +6 -8
- package/dist/{list-CK0p7vvK.mjs → list-Ov6bYzT9.mjs} +7 -8
- package/dist/{list-Sgo3RfDY.mjs → list-SfpASSFx.mjs} +4 -6
- package/dist/{list-BBxRjuMn.mjs → list-fPfgG0PY.mjs} +4 -6
- package/dist/list-lsPeumLP.mjs +34 -0
- package/dist/{list-BY4S32Lg.mjs → list-sn9M7QQX.mjs} +4 -6
- package/dist/{list-CjF12k1G.mjs → list-wxIVl45_.mjs} +5 -7
- package/dist/listing-wFZuS5li.mjs +10 -0
- package/dist/{login-C6ZAnGHz.mjs → login-CRlmR4op.mjs} +61 -23
- package/dist/{logout-CWjyY3Y8.mjs → logout-DSZEUxSQ.mjs} +5 -7
- package/dist/{measure-DoJvtCaA.mjs → measure-C3G1srWb.mjs} +5 -4
- package/dist/measure-Ka0n3426.mjs +25 -0
- package/dist/{parameter-values-DmDOuE-j.mjs → parameter-values-CwW8Xes7.mjs} +5 -7
- package/dist/{parse-enum-BL9i_brN.mjs → parse-enum-ooCsJWn6.mjs} +1 -1
- package/dist/parse-id-xS1tWJAq.mjs +18 -0
- package/dist/{parse-ref-CB_KvF9h.mjs → parse-ref-j4lxaQmd.mjs} +1 -1
- package/dist/{path-D8IJ4YrW.mjs → path-CVmg-bmf.mjs} +4 -6
- package/dist/{poll-hgnrHBoh.mjs → poll-CuTlWBwI.mjs} +2 -2
- package/dist/{poll-task-NQNLT_aA.mjs → poll-task-DhsYs8Hx.mjs} +2 -2
- package/dist/{preflight-DvaPQHHf.mjs → preflight-D3VgjEg7.mjs} +4 -5
- package/dist/{process-j8UHMHc2.mjs → process-7c8BcQEi.mjs} +1 -1
- package/dist/profile-name-CZ1-Vtrh.mjs +7 -0
- package/dist/{prompt-C85xd9HR.mjs → prompt-jQnNKtlx.mjs} +1 -1
- package/dist/{publish-BntmFR6g.mjs → publish-DFTCsjHU.mjs} +13 -10
- package/dist/{query-DSKQZu91.mjs → query-CPq-dhFV.mjs} +15 -15
- package/dist/{query-BQfgKV68.mjs → query-Dfx69iJ4.mjs} +9 -10
- package/dist/{query-result-D6mfoVfQ.mjs → query-result-Cg7odyR_.mjs} +1 -1
- package/dist/{remove-collection-BguaI3-6.mjs → remove-collection-DUAMhx5L.mjs} +7 -9
- package/dist/replace-DZWd6avZ.mjs +42 -0
- package/dist/requests-DYrDe-D0.mjs +96 -0
- package/dist/{rescan-values-DjD6IW3J.mjs → rescan-values-DZSnEFA0.mjs} +7 -9
- package/dist/{resolve-Dj2MTBkn.mjs → resolve-BTZuO3Yq.mjs} +22 -15
- package/dist/{run-Bp1yxkBN.mjs → run-B2b3Bjmv.mjs} +4 -6
- package/dist/{run-RQfQj7Rk.mjs → run-ryZ4sXK5.mjs} +7 -9
- package/dist/{runs-CSsatfWb.mjs → runs-F82HVSie.mjs} +5 -7
- package/dist/{runtime-oxjmrYoP.mjs → runtime-C6ASrgVA.mjs} +944 -909
- package/dist/{schema-tables-5I5pCxHl.mjs → schema-tables-CCOKb715.mjs} +6 -8
- package/dist/{schemas-CfzFCfBt.mjs → schemas-LtVrNECH.mjs} +4 -6
- package/dist/{search-Vo-BqliA.mjs → search-9GSZHgJQ.mjs} +4 -6
- package/dist/segment-C40bORNZ.mjs +25 -0
- package/dist/{segment-TXktTCfU.mjs → segment-CxRYEXeO.mjs} +6 -5
- package/dist/{selectors-DBnJsKlW.mjs → selectors-B2nDmrIV.mjs} +3 -3
- package/dist/{set-1Vh0AF-T.mjs → set-C57KDMGM.mjs} +9 -9
- package/dist/{set-active-C0mUZlNN.mjs → set-active-BDHGHtj2.mjs} +4 -6
- package/dist/setting-zrJwy48C.mjs +20 -0
- package/dist/{setup-CzYFvFK5.mjs → setup-Doq8atTG.mjs} +11 -12
- package/dist/{skills-B6gfH0iR.mjs → skills-y-KsUqT9.mjs} +1 -1
- package/dist/{skills-CR2xyV33.mjs → skills-yuzH_o8s.mjs} +3 -3
- package/dist/{snippet-CtA2Pkoa.mjs → snippet-C8PVaPY9.mjs} +7 -4
- package/dist/snippet-ScFM8re8.mjs +22 -0
- package/dist/{stash-CQHXwBu_.mjs → stash-D_u6z4q6.mjs} +7 -9
- package/dist/{status-C_7aqTvB.mjs → status--Dm2Jv6k.mjs} +5 -7
- package/dist/{status-DXQkM18v.mjs → status-CDPhDX5I.mjs} +27 -13
- package/dist/{summary-1aNpQc8j.mjs → summary-C9a2cBTE.mjs} +5 -7
- package/dist/{sync-schema-BqLp5uTS.mjs → sync-schema-CDIWNCGI.mjs} +9 -11
- package/dist/sync-scope-DW2QpGwv.mjs +55 -0
- package/dist/{table-DE3i82T_.mjs → table-3onHpwcb.mjs} +16 -4
- package/dist/table-BKehBm_E.mjs +21 -0
- package/dist/timeline-DEaiuB5V.mjs +157 -0
- package/dist/timeline-event-CLWMxvE0.mjs +22 -0
- package/dist/timeline-n3Nw9Egt.mjs +24 -0
- package/dist/transform-CrOOqKen.mjs +31 -0
- package/dist/{transform-DEF38FWe.mjs → transform-DP6J2ber.mjs} +31 -5
- package/dist/transform-job-J-E0Mec7.mjs +25 -0
- package/dist/transform-tag-Bkyasy_s.mjs +21 -0
- package/dist/{transforms-BelyllUL.mjs → transforms-w2a5qsjJ.mjs} +5 -7
- package/dist/{tree-YvmwGql7.mjs → tree-JZC6vD9q.mjs} +4 -6
- package/dist/{unpublish-CHjGLMu9.mjs → unpublish-BsfIH46y.mjs} +5 -7
- package/dist/{update-D7vc8GBF.mjs → update-B8hn6VxO.mjs} +12 -13
- package/dist/{update-BKhekuqr.mjs → update-BSNK36fk.mjs} +15 -15
- package/dist/update-BTFj6WHo.mjs +52 -0
- package/dist/{update-BACl_bJS.mjs → update-BfIGjAVA.mjs} +9 -10
- package/dist/{update-CrRz47aj.mjs → update-C1_aIL6X.mjs} +15 -15
- package/dist/{update-K-jjQ0Aw.mjs → update-CXKWHOIN.mjs} +10 -11
- package/dist/{update-BnHYSu96.mjs → update-Cg09lBb5.mjs} +13 -14
- package/dist/update-D01S8hnw.mjs +52 -0
- package/dist/{update-txUfAJxy.mjs → update-DKQjMsuE.mjs} +9 -10
- package/dist/{update-Zz01Woxj.mjs → update-DSlSr7Ky.mjs} +9 -10
- package/dist/{update-C9fndCqb.mjs → update-QaBVvlz9.mjs} +9 -10
- package/dist/{update-BGMJTpA6.mjs → update-WLb9099y.mjs} +12 -13
- package/dist/{update-BWlN3QDo.mjs → update-bFNKpay8.mjs} +9 -10
- package/dist/{update-dashcard-Dvth-yLC.mjs → update-dashcard-CKZC7scy.mjs} +11 -11
- package/dist/{upgrade-DsXlfPef.mjs → upgrade-DkK1ZbEY.mjs} +5 -7
- package/dist/upload-DOMoaR9f.mjs +16 -0
- package/dist/{uuid-ByJmWV7b.mjs → uuid-DDbLKnbe.mjs} +3 -5
- package/dist/{validate-BqNW4Sk1.mjs → validate-DqQ7DQnP.mjs} +1 -2
- package/dist/{validate-query-CcZVKYPV.mjs → validate-query-BYG7lyaY.mjs} +2 -3
- package/dist/{values-CIjJI4sz.mjs → values-Bc99Kkuv.mjs} +5 -7
- package/dist/{verify-Jsuc2dat.mjs → verify-WvMbaT8W.mjs} +2 -2
- package/dist/{wait-5ltTFvSa.mjs → wait-DmgEPnHW.mjs} +6 -8
- package/dist/{wait-flags-D6kd_G7c.mjs → wait-flags-BpzyrpAL.mjs} +2 -2
- package/dist/workspace-BgH_4xFO.mjs +75 -0
- package/dist/workspace-LFtHxcw9.mjs +19 -0
- package/package.json +1 -1
- package/skill-data/core/SKILL.md +31 -23
- package/skill-data/dashboard/SKILL.md +26 -3
- package/skill-data/data-workflow/SKILL.md +17 -15
- package/skill-data/git-sync/SKILL.md +20 -5
- package/skill-data/visualization/SKILL.md +1 -0
- package/dist/add-collection-DbalcC3_.mjs +0 -11
- package/dist/auth--PWX0oj5.mjs +0 -22
- package/dist/capabilities-N0jo5U7S.mjs +0 -239
- package/dist/card-D07WYCQY.mjs +0 -26
- package/dist/collection-Dss2qSEF.mjs +0 -23
- package/dist/dashboard-Crh4v6Fq.mjs +0 -35
- package/dist/db-BCAURQei.mjs +0 -28
- package/dist/document-upxL2nKH.mjs +0 -22
- package/dist/error-BaBm-UrT.mjs +0 -227
- package/dist/field-CloFa1oe.mjs +0 -21
- package/dist/get-B8tugTku.mjs +0 -50
- package/dist/git-sync-C9m-OHac.mjs +0 -31
- package/dist/is-dirty-DpyKeGAJ.mjs +0 -10
- package/dist/manifest-BVf8P4bl.mjs +0 -126
- package/dist/measure-Cbly1r0E.mjs +0 -25
- package/dist/metadata-CW5Lfw5d.mjs +0 -39
- package/dist/metadata-aQAqseCm.mjs +0 -38
- package/dist/notice-DyVl5aYB.mjs +0 -206
- package/dist/parse-id-DlXnOcmP.mjs +0 -12
- package/dist/segment-BuN_IoM8.mjs +0 -25
- package/dist/setting-BbdKR-lO.mjs +0 -20
- package/dist/snippet-Bzo2U9Fv.mjs +0 -22
- package/dist/table-BwGOz97O.mjs +0 -22
- package/dist/transform-B65ZD9-e.mjs +0 -31
- package/dist/transform-job-BWVKXSV6.mjs +0 -25
- package/dist/transform-tag-C4qvmicL.mjs +0 -21
- /package/dist/{body-flags-DWTTxJpP.mjs → body-flags-CgHgJBRC.mjs} +0 -0
- /package/dist/{command-augment-DdZIfx1V.mjs → command-augment-D9pI9Vbh.mjs} +0 -0
- /package/dist/{parameter-CiJ4CwWE.mjs → parameter-BZ6y-Gfs.mjs} +0 -0
- /package/dist/{render-BTKnWL0d.mjs → render-CkuFkWlQ.mjs} +0 -0
- /package/dist/{transform-job-CtixL4An.mjs → transform-job-B5x8aYfV.mjs} +0 -0
- /package/dist/{transform-tag-rsIrckCM.mjs → transform-tag-BRwfWeHf.mjs} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EmbeddingParams } from "./embedding-CKdw8q7p.mjs";
|
|
2
|
+
import { FieldBaseType, FieldSemanticType } from "./field-DsXTeqBy.mjs";
|
|
3
|
+
import { Parameter, ParameterMapping } from "./parameter-BZ6y-Gfs.mjs";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
|
|
5
6
|
//#region src/domain/card.ts
|
|
@@ -9,7 +10,7 @@ const CardType = z.enum([
|
|
|
9
10
|
"metric"
|
|
10
11
|
]);
|
|
11
12
|
const CardQueryType = z.enum(["native", "query"]);
|
|
12
|
-
const CardDatasetQuery = z.object({}).loose().refine((value) => "lib/type" in value || "type" in value, { message: "dataset_query must include \"lib/type\" (MBQL 5) or \"type\" (legacy MBQL/native); empty `{}` is rejected" });
|
|
13
|
+
const CardDatasetQuery = z.object({}).loose().refine((value) => "lib/type" in value || "type" in value, { message: "dataset_query must include \"lib/type\" (MBQL 5) or \"type\" (legacy MBQL/native); empty `{}` is rejected" }).describe("MBQL 5, legacy MBQL, or native query — full MBQL 5 schema: mb query --print-schema");
|
|
13
14
|
const Card = z.object({
|
|
14
15
|
id: z.number().int(),
|
|
15
16
|
name: z.string(),
|
|
@@ -70,38 +71,43 @@ const cardView = {
|
|
|
70
71
|
}
|
|
71
72
|
]
|
|
72
73
|
};
|
|
74
|
+
const CollectionIdOrEntityId = z.union([z.number().int().positive(), z.string().length(21).describe("collection entity_id (21-char NanoID)")]);
|
|
73
75
|
const CardCreateInput = z.object({
|
|
74
76
|
name: z.string().min(1),
|
|
75
|
-
type: CardType.optional(),
|
|
77
|
+
type: CardType.nullable().optional(),
|
|
76
78
|
dataset_query: CardDatasetQuery,
|
|
77
79
|
display: z.string().min(1),
|
|
78
80
|
visualization_settings: z.record(z.string(), z.unknown()),
|
|
79
81
|
description: z.string().min(1).nullable().optional(),
|
|
80
|
-
|
|
82
|
+
entity_id: z.string().min(1).nullable().optional(),
|
|
83
|
+
collection_id: CollectionIdOrEntityId.nullable().optional(),
|
|
81
84
|
collection_position: z.number().int().positive().nullable().optional(),
|
|
85
|
+
cache_ttl: z.number().int().positive().nullable().optional(),
|
|
82
86
|
dashboard_id: z.number().int().positive().nullable().optional(),
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
dashboard_tab_id: z.number().int().positive().nullable().optional(),
|
|
88
|
+
parameters: z.array(Parameter).nullable().optional(),
|
|
89
|
+
parameter_mappings: z.array(ParameterMapping).nullable().optional(),
|
|
90
|
+
result_metadata: z.array(z.unknown()).nullable().optional()
|
|
85
91
|
}).loose();
|
|
86
92
|
const CardUpdateInput = z.object({
|
|
87
|
-
name: z.string().min(1).optional(),
|
|
88
|
-
type: CardType.optional(),
|
|
93
|
+
name: z.string().min(1).nullable().optional(),
|
|
94
|
+
type: CardType.nullable().optional(),
|
|
89
95
|
dataset_query: CardDatasetQuery.optional(),
|
|
90
|
-
display: z.string().min(1).optional(),
|
|
91
|
-
visualization_settings: z.record(z.string(), z.unknown()).optional(),
|
|
96
|
+
display: z.string().min(1).nullable().optional(),
|
|
97
|
+
visualization_settings: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
92
98
|
description: z.string().nullable().optional(),
|
|
93
|
-
archived: z.boolean().optional(),
|
|
94
|
-
enable_embedding: z.boolean().optional(),
|
|
95
|
-
embedding_type: z.string().optional(),
|
|
96
|
-
embedding_params:
|
|
99
|
+
archived: z.boolean().nullable().optional(),
|
|
100
|
+
enable_embedding: z.boolean().nullable().optional(),
|
|
101
|
+
embedding_type: z.string().nullable().optional(),
|
|
102
|
+
embedding_params: EmbeddingParams.nullable().optional(),
|
|
97
103
|
collection_id: z.number().int().positive().nullable().optional(),
|
|
98
104
|
collection_position: z.number().int().positive().nullable().optional(),
|
|
99
|
-
collection_preview: z.boolean().optional(),
|
|
105
|
+
collection_preview: z.boolean().nullable().optional(),
|
|
100
106
|
cache_ttl: z.number().int().positive().nullable().optional(),
|
|
101
107
|
dashboard_id: z.number().int().positive().nullable().optional(),
|
|
102
108
|
dashboard_tab_id: z.number().int().positive().nullable().optional(),
|
|
103
|
-
parameters: z.array(Parameter).optional(),
|
|
104
|
-
parameter_mappings: z.array(ParameterMapping).optional(),
|
|
109
|
+
parameters: z.array(Parameter).nullable().optional(),
|
|
110
|
+
parameter_mappings: z.array(ParameterMapping).nullable().optional(),
|
|
105
111
|
result_metadata: z.array(z.unknown()).nullable().optional()
|
|
106
112
|
}).loose();
|
|
107
113
|
const QueryColumn = z.object({
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
2
|
+
import { defineCommandGroup } from "./group-CILtQqCL.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/commands/card/index.ts
|
|
5
|
+
var card_default = defineCommandGroup({
|
|
6
|
+
name: "card",
|
|
7
|
+
description: "Manage Metabase cards (questions, models, metrics)",
|
|
8
|
+
skills: [{
|
|
9
|
+
skill: "mbql",
|
|
10
|
+
purpose: "author the dataset_query"
|
|
11
|
+
}, {
|
|
12
|
+
skill: "visualization",
|
|
13
|
+
purpose: "choose display and visualization_settings"
|
|
14
|
+
}],
|
|
15
|
+
subCommands: {
|
|
16
|
+
list: () => import("./list-Be8xMtS3.mjs").then((mod) => mod.default),
|
|
17
|
+
get: () => import("./get-DTkvGu_J.mjs").then((mod) => mod.default),
|
|
18
|
+
query: () => import("./query-Dfx69iJ4.mjs").then((mod) => mod.default),
|
|
19
|
+
create: () => import("./create-VrSowEbj.mjs").then((mod) => mod.default),
|
|
20
|
+
update: () => import("./update-C1_aIL6X.mjs").then((mod) => mod.default),
|
|
21
|
+
archive: () => import("./archive-BmhehbS0.mjs").then((mod) => mod.default)
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { card_default as default };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import "./
|
|
7
|
-
import {
|
|
8
|
-
import { DashboardDetail, DashcardCompact, dashcardView } from "./dashboard-DOplbKyQ.mjs";
|
|
1
|
+
import { connectionFlags, listEnvelopeSchema, outputFlags, profileFlag, renderList, wrapList } from "./capabilities-CiaAfUgX.mjs";
|
|
2
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
+
import { defineMetabaseCommand } from "./runtime-C6ASrgVA.mjs";
|
|
4
|
+
import "./embedding-CKdw8q7p.mjs";
|
|
5
|
+
import "./parameter-BZ6y-Gfs.mjs";
|
|
6
|
+
import { parseId } from "./parse-id-xS1tWJAq.mjs";
|
|
7
|
+
import { DashboardDetail, DashcardCompact, dashcardView } from "./dashboard-BLihjDXg.mjs";
|
|
9
8
|
|
|
10
9
|
//#region src/commands/dashboard/cards.ts
|
|
11
10
|
const DashcardListEnvelope = listEnvelopeSchema(DashcardCompact);
|
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { ConfigError, flagConsumesValue, normalizeFlag, resolveCitty, toAliasArray } from "./
|
|
3
|
-
import {
|
|
4
|
-
import { getMetabaseAugment, setMetabaseAugment } from "./command-augment-DdZIfx1V.mjs";
|
|
2
|
+
import { Capabilities, ConfigError, connectionFlags, flagConsumesValue, jsonLine, normalizeFlag, outputFlags, package_default, profileFlag, reportError, resolveCitty, toAliasArray } from "./capabilities-CiaAfUgX.mjs";
|
|
3
|
+
import { getMetabaseAugment, setMetabaseAugment } from "./command-augment-D9pI9Vbh.mjs";
|
|
5
4
|
import { defineCommand, renderUsage, runMain } from "citty";
|
|
5
|
+
import { z } from "zod";
|
|
6
6
|
|
|
7
7
|
//#region src/commands/global-flags.ts
|
|
8
8
|
const ARGUMENT_SEPARATOR = "--";
|
|
@@ -59,31 +59,34 @@ const main = defineCommand({
|
|
|
59
59
|
description: package_default.description
|
|
60
60
|
},
|
|
61
61
|
subCommands: {
|
|
62
|
-
auth: () => import("./auth
|
|
63
|
-
db: () => import("./db-
|
|
64
|
-
table: () => import("./table-
|
|
65
|
-
field: () => import("./field-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"transform-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
62
|
+
auth: () => import("./auth-DzCAiArV.mjs").then((mod) => mod.default),
|
|
63
|
+
db: () => import("./db-dbnxMPSR.mjs").then((mod) => mod.default),
|
|
64
|
+
table: () => import("./table-BKehBm_E.mjs").then((mod) => mod.default),
|
|
65
|
+
field: () => import("./field-CXDndCbB.mjs").then((mod) => mod.default),
|
|
66
|
+
upload: () => import("./upload-DOMoaR9f.mjs").then((mod) => mod.default),
|
|
67
|
+
card: () => import("./card-BsfdXK0O.mjs").then((mod) => mod.default),
|
|
68
|
+
dashboard: () => import("./dashboard-ARgJfamb.mjs").then((mod) => mod.default),
|
|
69
|
+
collection: () => import("./collection-2h_by9Ue.mjs").then((mod) => mod.default),
|
|
70
|
+
library: () => import("./library-BGWDIfEM.mjs").then((mod) => mod.default),
|
|
71
|
+
document: () => import("./document-DR1FLOn9.mjs").then((mod) => mod.default),
|
|
72
|
+
transform: () => import("./transform-CrOOqKen.mjs").then((mod) => mod.default),
|
|
73
|
+
"transform-job": () => import("./transform-job-J-E0Mec7.mjs").then((mod) => mod.default),
|
|
74
|
+
"transform-tag": () => import("./transform-tag-Bkyasy_s.mjs").then((mod) => mod.default),
|
|
75
|
+
setting: () => import("./setting-zrJwy48C.mjs").then((mod) => mod.default),
|
|
76
|
+
search: () => import("./search-9GSZHgJQ.mjs").then((mod) => mod.default),
|
|
77
|
+
"git-sync": () => import("./git-sync-CmB4YBmS.mjs").then((mod) => mod.default),
|
|
78
|
+
workspace: () => import("./workspace-LFtHxcw9.mjs").then((mod) => mod.default),
|
|
79
|
+
setup: () => import("./setup-Doq8atTG.mjs").then((mod) => mod.default),
|
|
80
|
+
snippet: () => import("./snippet-ScFM8re8.mjs").then((mod) => mod.default),
|
|
81
|
+
segment: () => import("./segment-C40bORNZ.mjs").then((mod) => mod.default),
|
|
82
|
+
measure: () => import("./measure-Ka0n3426.mjs").then((mod) => mod.default),
|
|
83
|
+
timeline: () => import("./timeline-n3Nw9Egt.mjs").then((mod) => mod.default),
|
|
84
|
+
"timeline-event": () => import("./timeline-event-CLWMxvE0.mjs").then((mod) => mod.default),
|
|
85
|
+
eid: () => import("./eid-CtKGjAkz.mjs").then((mod) => mod.default),
|
|
86
|
+
query: () => import("./query-CPq-dhFV.mjs").then((mod) => mod.default),
|
|
87
|
+
uuid: () => import("./uuid-DDbLKnbe.mjs").then((mod) => mod.default),
|
|
88
|
+
upgrade: () => import("./upgrade-DkK1ZbEY.mjs").then((mod) => mod.default),
|
|
89
|
+
skills: () => import("./skills-yuzH_o8s.mjs").then((mod) => mod.default)
|
|
87
90
|
}
|
|
88
91
|
});
|
|
89
92
|
setMetabaseAugment(main, {
|
|
@@ -96,11 +99,128 @@ setMetabaseAugment(main, {
|
|
|
96
99
|
skill: "data-workflow",
|
|
97
100
|
purpose: "guided end-to-end: raw data → clean tables → metrics → answers → dashboards"
|
|
98
101
|
}],
|
|
102
|
+
inputSchema: null,
|
|
99
103
|
outputSchema: null,
|
|
100
104
|
capabilities: null
|
|
101
105
|
});
|
|
102
106
|
var main_default = main;
|
|
103
107
|
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/runtime/command-help.ts
|
|
110
|
+
const CommandHelpArg = z.object({
|
|
111
|
+
name: z.string(),
|
|
112
|
+
type: z.enum([
|
|
113
|
+
"string",
|
|
114
|
+
"boolean",
|
|
115
|
+
"positional",
|
|
116
|
+
"enum"
|
|
117
|
+
]),
|
|
118
|
+
required: z.boolean(),
|
|
119
|
+
description: z.string().optional(),
|
|
120
|
+
default: z.union([
|
|
121
|
+
z.string(),
|
|
122
|
+
z.boolean(),
|
|
123
|
+
z.number()
|
|
124
|
+
]).optional(),
|
|
125
|
+
alias: z.array(z.string()).optional(),
|
|
126
|
+
options: z.array(z.string()).optional()
|
|
127
|
+
});
|
|
128
|
+
const CommandHelpSkill = z.object({
|
|
129
|
+
skill: z.string(),
|
|
130
|
+
purpose: z.string()
|
|
131
|
+
});
|
|
132
|
+
const CommandHelpEntry = z.object({
|
|
133
|
+
command: z.string(),
|
|
134
|
+
description: z.string(),
|
|
135
|
+
details: z.string().optional(),
|
|
136
|
+
skills: z.array(CommandHelpSkill),
|
|
137
|
+
examples: z.array(z.string()),
|
|
138
|
+
args: z.array(CommandHelpArg),
|
|
139
|
+
inputSchema: z.unknown().nullable(),
|
|
140
|
+
outputSchema: z.unknown().nullable(),
|
|
141
|
+
capabilities: Capabilities.nullable()
|
|
142
|
+
});
|
|
143
|
+
const CommandIndexEntry = z.object({
|
|
144
|
+
command: z.string(),
|
|
145
|
+
description: z.string()
|
|
146
|
+
});
|
|
147
|
+
const CommandHelpIndex = z.object({ commands: z.array(CommandIndexEntry) });
|
|
148
|
+
const EMPTY_AUGMENT = {
|
|
149
|
+
examples: [],
|
|
150
|
+
details: null,
|
|
151
|
+
skills: [],
|
|
152
|
+
inputSchema: null,
|
|
153
|
+
outputSchema: null,
|
|
154
|
+
capabilities: null
|
|
155
|
+
};
|
|
156
|
+
async function buildHelpEntry(cmd, path) {
|
|
157
|
+
const meta = await resolveCitty(cmd.meta);
|
|
158
|
+
const args = await resolveCitty(cmd.args) ?? {};
|
|
159
|
+
const augment = getMetabaseAugment(cmd) ?? EMPTY_AUGMENT;
|
|
160
|
+
const entry = {
|
|
161
|
+
command: path.join(" "),
|
|
162
|
+
description: readDescription(meta),
|
|
163
|
+
skills: Array.from(augment.skills),
|
|
164
|
+
examples: Array.from(augment.examples),
|
|
165
|
+
args: convertArgs(args),
|
|
166
|
+
inputSchema: augment.inputSchema ? z.toJSONSchema(augment.inputSchema) : null,
|
|
167
|
+
outputSchema: augment.outputSchema ? z.toJSONSchema(augment.outputSchema) : null,
|
|
168
|
+
capabilities: augment.capabilities
|
|
169
|
+
};
|
|
170
|
+
if (augment.details !== null) entry.details = augment.details;
|
|
171
|
+
return entry;
|
|
172
|
+
}
|
|
173
|
+
async function buildHelpIndex(cmd, path) {
|
|
174
|
+
return { commands: await walk(cmd, path) };
|
|
175
|
+
}
|
|
176
|
+
async function walk(cmd, path) {
|
|
177
|
+
const meta = await resolveCitty(cmd.meta);
|
|
178
|
+
if (meta?.hidden === true) return [];
|
|
179
|
+
const subCommands = await resolveCitty(cmd.subCommands);
|
|
180
|
+
if (subCommands && Object.keys(subCommands).length > 0) {
|
|
181
|
+
const groups = await Promise.all(Object.entries(subCommands).map(async ([name, lazy]) => {
|
|
182
|
+
const sub = await resolveCitty(lazy);
|
|
183
|
+
return sub ? walk(sub, [...path, name]) : [];
|
|
184
|
+
}));
|
|
185
|
+
return groups.flat();
|
|
186
|
+
}
|
|
187
|
+
return [{
|
|
188
|
+
command: path.join(" "),
|
|
189
|
+
description: readDescription(meta)
|
|
190
|
+
}];
|
|
191
|
+
}
|
|
192
|
+
function readDescription(meta) {
|
|
193
|
+
if (meta === void 0) return "";
|
|
194
|
+
return typeof meta.description === "string" ? meta.description : "";
|
|
195
|
+
}
|
|
196
|
+
function convertArgs(args) {
|
|
197
|
+
return Object.entries(args).map(([name, def]) => convertArg(name, def));
|
|
198
|
+
}
|
|
199
|
+
function convertArg(name, def) {
|
|
200
|
+
const arg = {
|
|
201
|
+
name,
|
|
202
|
+
type: def.type ?? "string",
|
|
203
|
+
required: def.required === true && def.default === void 0
|
|
204
|
+
};
|
|
205
|
+
if (def.description) arg.description = def.description;
|
|
206
|
+
if (isPrimitiveDefault(def.default)) arg.default = def.default;
|
|
207
|
+
const alias = readAlias(def);
|
|
208
|
+
if (alias.length > 0) arg.alias = alias;
|
|
209
|
+
const options = readOptions(def);
|
|
210
|
+
if (options.length > 0) arg.options = options;
|
|
211
|
+
return arg;
|
|
212
|
+
}
|
|
213
|
+
function readOptions(def) {
|
|
214
|
+
if (!("options" in def) || !Array.isArray(def.options)) return [];
|
|
215
|
+
return [...def.options];
|
|
216
|
+
}
|
|
217
|
+
function readAlias(def) {
|
|
218
|
+
return "alias" in def ? toAliasArray(def.alias) : [];
|
|
219
|
+
}
|
|
220
|
+
function isPrimitiveDefault(value) {
|
|
221
|
+
return typeof value === "string" || typeof value === "boolean" || typeof value === "number";
|
|
222
|
+
}
|
|
223
|
+
|
|
104
224
|
//#endregion
|
|
105
225
|
//#region src/output/help.ts
|
|
106
226
|
const ANSI_ESC = String.fromCharCode(27);
|
|
@@ -142,7 +262,30 @@ async function showUsage(cmd, parent, breadcrumb) {
|
|
|
142
262
|
if (examples.length > 0) sections.push(renderExamples(examples));
|
|
143
263
|
if (skills.length > 0) sections.push(renderSkillsSection(skills, isRoot));
|
|
144
264
|
if (isRoot) sections.push(GETTING_STARTED_HINT);
|
|
145
|
-
|
|
265
|
+
sections.push(machineHelpHint(breadcrumb ?? cittyName, hasSubCommands));
|
|
266
|
+
await writeUsage(sections.join("\n\n") + "\n");
|
|
267
|
+
}
|
|
268
|
+
async function showUsageJson(cmd, breadcrumb) {
|
|
269
|
+
const path = breadcrumbPath(breadcrumb);
|
|
270
|
+
const subCommands = await resolveCitty(cmd.subCommands);
|
|
271
|
+
const hasSubCommands = subCommands !== void 0 && Object.keys(subCommands).length > 0;
|
|
272
|
+
const payload = hasSubCommands ? await buildHelpIndex(cmd, path) : await buildHelpEntry(cmd, path);
|
|
273
|
+
await writeUsage(jsonLine(payload));
|
|
274
|
+
}
|
|
275
|
+
function writeUsage(text) {
|
|
276
|
+
return new Promise((resolve, reject) => {
|
|
277
|
+
process.stdout.write(text, (error) => error ? reject(error) : resolve());
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function breadcrumbPath(breadcrumb) {
|
|
281
|
+
const segments = breadcrumb.split(" ").filter((segment) => segment.length > 0);
|
|
282
|
+
return segments[0] === CLI_NAME ? segments.slice(1) : segments;
|
|
283
|
+
}
|
|
284
|
+
const MACHINE_HELP_LEAF_LABEL = "Machine-readable help (flags, output schema):";
|
|
285
|
+
const MACHINE_HELP_INDEX_LABEL = "Machine-readable command index:";
|
|
286
|
+
function machineHelpHint(breadcrumb, hasSubCommands) {
|
|
287
|
+
const label = hasSubCommands ? MACHINE_HELP_INDEX_LABEL : MACHINE_HELP_LEAF_LABEL;
|
|
288
|
+
return `${label} ${breadcrumb} --help --json`;
|
|
146
289
|
}
|
|
147
290
|
function transformBody(lines, rewrite) {
|
|
148
291
|
const mapped = lines.map((line, index) => {
|
|
@@ -290,10 +433,16 @@ async function findSubCommand(subCommands, token) {
|
|
|
290
433
|
//#endregion
|
|
291
434
|
//#region src/cli.ts
|
|
292
435
|
const HELP_FLAGS = new Set(["--help", "-h"]);
|
|
436
|
+
const JSON_HELP_FLAG = "--json";
|
|
293
437
|
async function run() {
|
|
294
438
|
const rawArgs = hoistGlobalFlags(process.argv.slice(2));
|
|
439
|
+
const wantsJsonHelp = rawArgs.includes(JSON_HELP_FLAG);
|
|
295
440
|
const showUsageWithBreadcrumb = async (cmd, parent) => {
|
|
296
441
|
const breadcrumb = await resolveBreadcrumb(main_default, rawArgs);
|
|
442
|
+
if (wantsJsonHelp) {
|
|
443
|
+
await showUsageJson(cmd, breadcrumb);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
297
446
|
await showUsage(cmd, parent, breadcrumb);
|
|
298
447
|
};
|
|
299
448
|
if (rawArgs.length === 0) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
2
|
+
import { defineCommandGroup } from "./group-CILtQqCL.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/commands/collection/index.ts
|
|
5
|
+
var collection_default = defineCommandGroup({
|
|
6
|
+
name: "collection",
|
|
7
|
+
description: "Manage Metabase collections",
|
|
8
|
+
skills: [{
|
|
9
|
+
skill: "core",
|
|
10
|
+
purpose: "collection ref forms and the transforms namespace"
|
|
11
|
+
}],
|
|
12
|
+
subCommands: {
|
|
13
|
+
list: () => import("./list-Ov6bYzT9.mjs").then((mod) => mod.default),
|
|
14
|
+
get: () => import("./get-BQBu2c94.mjs").then((mod) => mod.default),
|
|
15
|
+
items: () => import("./items-BZpYkImP.mjs").then((mod) => mod.default),
|
|
16
|
+
tree: () => import("./tree-JZC6vD9q.mjs").then((mod) => mod.default),
|
|
17
|
+
create: () => import("./create-CQ32FwVe.mjs").then((mod) => mod.default),
|
|
18
|
+
archive: () => import("./archive-5inmbMDL.mjs").then((mod) => mod.default)
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { collection_default as default };
|
|
@@ -56,7 +56,8 @@ const Collection = z.object({
|
|
|
56
56
|
namespace: CollectionNamespace.nullable().optional(),
|
|
57
57
|
entity_id: z.string().nullable().optional(),
|
|
58
58
|
slug: z.string().optional(),
|
|
59
|
-
can_write: z.boolean().optional()
|
|
59
|
+
can_write: z.boolean().optional(),
|
|
60
|
+
is_remote_synced: z.boolean().nullable().optional()
|
|
60
61
|
}).loose();
|
|
61
62
|
const CollectionCompact = Collection.pick({
|
|
62
63
|
id: true,
|
|
@@ -67,7 +68,8 @@ const CollectionCompact = Collection.pick({
|
|
|
67
68
|
parent_id: true,
|
|
68
69
|
type: true,
|
|
69
70
|
authority_level: true,
|
|
70
|
-
is_personal: true
|
|
71
|
+
is_personal: true,
|
|
72
|
+
is_remote_synced: true
|
|
71
73
|
}).strip();
|
|
72
74
|
const collectionView = {
|
|
73
75
|
compactPick: CollectionCompact,
|
|
@@ -159,7 +161,7 @@ const CollectionTreeNodeBase = z.object({
|
|
|
159
161
|
const CollectionTreeNode = CollectionTreeNodeBase.extend({ children: z.lazy(() => z.array(CollectionTreeNode)) });
|
|
160
162
|
const CollectionCreateInput = z.object({
|
|
161
163
|
name: z.string().min(1),
|
|
162
|
-
description: z.string().nullable().optional(),
|
|
164
|
+
description: z.string().min(1).nullable().optional(),
|
|
163
165
|
parent_id: z.number().int().positive().nullable().optional(),
|
|
164
166
|
namespace: CollectionNamespace.nullable().optional(),
|
|
165
167
|
authority_level: CollectionAuthorityLevel.nullable().optional()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConfigError } from "./
|
|
2
|
-
import { HttpError } from "./runtime-
|
|
1
|
+
import { ConfigError } from "./capabilities-CiaAfUgX.mjs";
|
|
2
|
+
import { HttpError } from "./runtime-C6ASrgVA.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/commands/transform/collection-namespace.ts
|
|
5
5
|
const TRANSFORMS_NAMESPACE_HINT = "transforms can only be filed in a :transforms-namespace collection. Create one with `mb collection create --body '{\"name\":\"…\"}' --namespace transforms` and pass its id as collection_id, or omit collection_id to leave the transform uncollected.";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import "./
|
|
7
|
-
import { Library, createLibrary, libraryView } from "./resolve-Dj2MTBkn.mjs";
|
|
1
|
+
import { connectionFlags, outputFlags, profileFlag, renderSummary } from "./capabilities-CiaAfUgX.mjs";
|
|
2
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
+
import { defineMetabaseCommand } from "./runtime-C6ASrgVA.mjs";
|
|
4
|
+
import "./collection-C52Ndi_O.mjs";
|
|
5
|
+
import "./listing-wFZuS5li.mjs";
|
|
6
|
+
import { Library, createLibrary, libraryView } from "./resolve-BTZuO3Yq.mjs";
|
|
8
7
|
|
|
9
8
|
//#region src/commands/library/create.ts
|
|
10
9
|
var create_default = defineMetabaseCommand({
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ConfigError, ENV_API_KEY, connectionFlags, errorMessage, outputFlags, profileFlag, renderSummary, warn } from "./capabilities-CiaAfUgX.mjs";
|
|
2
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
+
import { WORKSPACE_MANAGER_SCOPE, clearProfile, defineMetabaseCommand, keyringFallbackWarning, listProfileRecords, normalizeUrl, readEnvCredentials, readProfileCredential, resolveRecordCredential, revokeOAuthCredential, setDefaultProfile, writeProfile } from "./runtime-C6ASrgVA.mjs";
|
|
4
|
+
import { promptConfirm } from "./prompt-jQnNKtlx.mjs";
|
|
5
|
+
import { parseIdCsv } from "./parse-id-xS1tWJAq.mjs";
|
|
6
|
+
import { Workspace, workspaceView } from "./workspace-BgH_4xFO.mjs";
|
|
7
|
+
import { workspaceProfileName } from "./profile-name-CZ1-Vtrh.mjs";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
|
|
10
|
+
//#region src/core/auth/stale-credentials.ts
|
|
11
|
+
function findStaleParentCredentials(records, targetUrl, currentProfile) {
|
|
12
|
+
const target = normalizeUrl(targetUrl);
|
|
13
|
+
const stale = [];
|
|
14
|
+
for (const record of records) {
|
|
15
|
+
if (record.name === currentProfile || normalizeUrl(record.url) !== target) continue;
|
|
16
|
+
const resolved = resolveRecordCredential(record);
|
|
17
|
+
if (resolved === null) continue;
|
|
18
|
+
if (resolved.credential.kind === "apiKey") stale.push({
|
|
19
|
+
profile: record.name,
|
|
20
|
+
kind: "apiKey"
|
|
21
|
+
});
|
|
22
|
+
else if (resolved.credential.scope !== WORKSPACE_MANAGER_SCOPE) stale.push({
|
|
23
|
+
profile: record.name,
|
|
24
|
+
kind: "oauth",
|
|
25
|
+
scope: resolved.credential.scope
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return stale;
|
|
29
|
+
}
|
|
30
|
+
function describeStaleCredential(credential) {
|
|
31
|
+
const detail = credential.kind === "apiKey" ? "api key" : credential.scope;
|
|
32
|
+
return `${credential.profile} (${detail})`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/commands/workspace/credential-sweep.ts
|
|
37
|
+
const keepExistingAuthFlag = { keepExistingAuth: {
|
|
38
|
+
type: "boolean",
|
|
39
|
+
description: "Proceed despite broader same-server credentials in the profile store (interactive only)",
|
|
40
|
+
alias: "keep-existing-auth",
|
|
41
|
+
default: false
|
|
42
|
+
} };
|
|
43
|
+
async function enforceCredentialSweep(input) {
|
|
44
|
+
const records = await listProfileRecords();
|
|
45
|
+
const stale = findStaleParentCredentials(records, input.url, input.profile);
|
|
46
|
+
if (stale.length === 0) return;
|
|
47
|
+
const listing = stale.map(describeStaleCredential).join(", ");
|
|
48
|
+
const interactive = process.stdin.isTTY === true;
|
|
49
|
+
if (input.keepExistingAuth) {
|
|
50
|
+
if (!interactive) throw new ConfigError("--keep-existing-auth requires an interactive terminal; refusing to proceed with broader credentials in a non-interactive context");
|
|
51
|
+
warn(`proceeding with broader credentials left in the profile store: ${listing}`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (!interactive) throw new ConfigError(`refusing to ${input.action}: broader credentials for this server exist in the profile store (${listing}) — revoke them with \`mb auth logout --profile <name>\` first; a human can override with --keep-existing-auth`);
|
|
55
|
+
const ok = await promptConfirm({
|
|
56
|
+
message: `Broader credentials for this server exist (${listing}). Revoke them before continuing?`,
|
|
57
|
+
initialValue: true
|
|
58
|
+
});
|
|
59
|
+
if (!ok) throw new ConfigError(`aborted: revoke the broader credentials (${listing}) with \`mb auth logout --profile <name>\` or pass --keep-existing-auth`);
|
|
60
|
+
for (const credential of stale) await revokeStaleCredential(credential);
|
|
61
|
+
}
|
|
62
|
+
async function revokeStaleCredential(stale) {
|
|
63
|
+
const resolved = await readProfileCredential(stale.profile);
|
|
64
|
+
await clearProfile(stale.profile);
|
|
65
|
+
if (resolved === null || resolved.credential.kind !== "oauth") {
|
|
66
|
+
warn(`cleared profile "${stale.profile}"; its API key is still active server-side — delete it in Admin settings → Authentication → API keys`);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const revoked = await revokeOAuthCredential(resolved.url, resolved.credential);
|
|
71
|
+
if (!revoked) warn(`cleared profile "${stale.profile}", but the server advertises no revocation endpoint; its tokens remain valid until they expire`);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
warn(`cleared profile "${stale.profile}", but revoking server-side failed: ${errorMessage(error)}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/commands/workspace/create.ts
|
|
79
|
+
const SpawnedWorkspace = Workspace.extend({
|
|
80
|
+
url: z.string().optional(),
|
|
81
|
+
api_key: z.string().optional()
|
|
82
|
+
});
|
|
83
|
+
var create_default = defineMetabaseCommand({
|
|
84
|
+
meta: {
|
|
85
|
+
name: "create",
|
|
86
|
+
description: "Create and provision a workspace"
|
|
87
|
+
},
|
|
88
|
+
details: "Attaches the given databases and provisions warehouse isolation (a temporary schema + user per database) before returning. Each database must be eligible for workspaces; provisioning is blocking, so the response carries the final per-database status. Before creating, the profile store is swept for broader same-server credentials (any API key, any OAuth grant wider than mb:workspace-manager): interactive runs offer to revoke them, non-interactive runs refuse — --keep-existing-auth is the human-only override. With --spawn the parent also asks its instance manager to spawn a workspace Metabase; the returned credential is saved to the ws-<id> profile (never printed) and made the default, so bare `mb` targets the new workspace.",
|
|
89
|
+
capabilities: {
|
|
90
|
+
minVersion: 62,
|
|
91
|
+
tokenFeature: "workspaces"
|
|
92
|
+
},
|
|
93
|
+
args: {
|
|
94
|
+
...outputFlags,
|
|
95
|
+
...profileFlag,
|
|
96
|
+
...connectionFlags,
|
|
97
|
+
...keepExistingAuthFlag,
|
|
98
|
+
name: {
|
|
99
|
+
type: "string",
|
|
100
|
+
description: "Workspace name",
|
|
101
|
+
required: true
|
|
102
|
+
},
|
|
103
|
+
"database-ids": {
|
|
104
|
+
type: "string",
|
|
105
|
+
description: "Database ids to attach, comma separated",
|
|
106
|
+
required: true
|
|
107
|
+
},
|
|
108
|
+
spawn: {
|
|
109
|
+
type: "boolean",
|
|
110
|
+
description: "Spawn a workspace instance and save its credential as the default profile (key is never printed)",
|
|
111
|
+
default: false
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
outputSchema: Workspace,
|
|
115
|
+
examples: [
|
|
116
|
+
"mb workspace create --name ws-reports --database-ids 1",
|
|
117
|
+
"mb workspace create --name ws-etl --database-ids 1,2 --json",
|
|
118
|
+
"mb workspace create --name transform-work --database-ids 1 --spawn"
|
|
119
|
+
],
|
|
120
|
+
async run({ args, ctx, getClient, getResolvedConfig }) {
|
|
121
|
+
const databaseIds = parseIdCsv(args["database-ids"], "database id");
|
|
122
|
+
if (args.spawn) assertNoApiKeyEnvShadow();
|
|
123
|
+
const resolved = await getResolvedConfig();
|
|
124
|
+
await enforceCredentialSweep({
|
|
125
|
+
url: resolved.url,
|
|
126
|
+
profile: resolved.profile,
|
|
127
|
+
keepExistingAuth: args.keepExistingAuth === true,
|
|
128
|
+
action: "create a workspace"
|
|
129
|
+
});
|
|
130
|
+
const client = await getClient();
|
|
131
|
+
const created = await client.requestParsed(SpawnedWorkspace, "/api/ee/workspace-manager/", {
|
|
132
|
+
method: "POST",
|
|
133
|
+
body: {
|
|
134
|
+
name: args.name,
|
|
135
|
+
database_ids: databaseIds,
|
|
136
|
+
spawn_instance: args.spawn ? true : void 0
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
if (args.spawn) await saveSpawnedCredential(created);
|
|
140
|
+
const workspace = { ...created };
|
|
141
|
+
delete workspace.api_key;
|
|
142
|
+
renderSummary(workspace, workspaceView, `Created workspace ${created.id} "${created.name}".`, ctx);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
function assertNoApiKeyEnvShadow() {
|
|
146
|
+
if (readEnvCredentials().apiKey !== null) throw new ConfigError(`--spawn saves the workspace credential as the default profile, but ${ENV_API_KEY} is set and would shadow it — unset ${ENV_API_KEY} first`);
|
|
147
|
+
}
|
|
148
|
+
async function saveSpawnedCredential(created) {
|
|
149
|
+
if (created.url === void 0 || created.api_key === void 0) throw new Error("the server did not return a spawned instance (no url/api_key in the create response) — this Metabase may not support spawn_instance");
|
|
150
|
+
const profileName = workspaceProfileName(created.id);
|
|
151
|
+
const location = await writeProfile({
|
|
152
|
+
url: normalizeUrl(created.url),
|
|
153
|
+
apiKey: created.api_key
|
|
154
|
+
}, profileName);
|
|
155
|
+
if (location.backend === "file") warn(keyringFallbackWarning(location));
|
|
156
|
+
await setDefaultProfile(profileName);
|
|
157
|
+
warn(`saved workspace credential to profile "${profileName}" and made it the default — bare \`mb\` now targets ${created.url}`);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
//#endregion
|
|
161
|
+
export { create_default as default };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import "./
|
|
7
|
-
import {
|
|
8
|
-
import { bodyInputFlags } from "./body-flags-DWTTxJpP.mjs";
|
|
9
|
-
import { Snippet, SnippetCreateInput, snippetView } from "./snippet-CtA2Pkoa.mjs";
|
|
1
|
+
import { connectionFlags, outputFlags, profileFlag, renderSummary } from "./capabilities-CiaAfUgX.mjs";
|
|
2
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
+
import { defineMetabaseCommand } from "./runtime-C6ASrgVA.mjs";
|
|
4
|
+
import "./input-BGyHn0Kr.mjs";
|
|
5
|
+
import { readBody } from "./body-5snfmiwR.mjs";
|
|
6
|
+
import { bodyInputFlags } from "./body-flags-CgHgJBRC.mjs";
|
|
7
|
+
import { Snippet, SnippetCreateInput, snippetView } from "./snippet-C8PVaPY9.mjs";
|
|
10
8
|
|
|
11
9
|
//#region src/commands/snippet/create.ts
|
|
12
10
|
var create_default = defineMetabaseCommand({
|
|
@@ -21,6 +19,7 @@ var create_default = defineMetabaseCommand({
|
|
|
21
19
|
...connectionFlags,
|
|
22
20
|
...bodyInputFlags
|
|
23
21
|
},
|
|
22
|
+
inputSchema: SnippetCreateInput,
|
|
24
23
|
outputSchema: Snippet,
|
|
25
24
|
examples: [
|
|
26
25
|
"cat snippet.json | mb snippet create",
|