@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
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ConfigError, isNotFoundError } from "./capabilities-CiaAfUgX.mjs";
|
|
2
|
+
import { fileNotFoundError } from "./input-BGyHn0Kr.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { basename } from "node:path";
|
|
5
|
+
import { readFile } from "node:fs/promises";
|
|
6
|
+
|
|
7
|
+
//#region src/runtime/upload.ts
|
|
8
|
+
const CSV_CONTENT_TYPE = "text/csv";
|
|
9
|
+
function requireUploadFilePath(file) {
|
|
10
|
+
if (typeof file !== "string" || file.trim() === "") throw new ConfigError("provide the CSV file to upload with --file <path>");
|
|
11
|
+
return file;
|
|
12
|
+
}
|
|
13
|
+
async function readCsvFile(path) {
|
|
14
|
+
try {
|
|
15
|
+
const bytes = await readFile(path);
|
|
16
|
+
return {
|
|
17
|
+
filename: basename(path),
|
|
18
|
+
bytes
|
|
19
|
+
};
|
|
20
|
+
} catch (error) {
|
|
21
|
+
if (isNotFoundError(error)) throw fileNotFoundError(path);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function buildCsvFormData(file) {
|
|
26
|
+
const form = new FormData();
|
|
27
|
+
form.append("file", new Blob([file.bytes], { type: CSV_CONTENT_TYPE }), file.filename);
|
|
28
|
+
return form;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/commands/upload/results.ts
|
|
33
|
+
const UploadResult = z.object({
|
|
34
|
+
model_id: z.number().int(),
|
|
35
|
+
table_id: z.number().int()
|
|
36
|
+
});
|
|
37
|
+
const uploadResultView = {
|
|
38
|
+
compactPick: UploadResult,
|
|
39
|
+
tableColumns: [{
|
|
40
|
+
key: "model_id",
|
|
41
|
+
label: "Model ID"
|
|
42
|
+
}, {
|
|
43
|
+
key: "table_id",
|
|
44
|
+
label: "Table ID"
|
|
45
|
+
}]
|
|
46
|
+
};
|
|
47
|
+
const UploadUpdateAction = z.enum(["append", "replace"]);
|
|
48
|
+
const UploadUpdateResult = z.object({
|
|
49
|
+
table_id: z.number().int(),
|
|
50
|
+
action: UploadUpdateAction
|
|
51
|
+
});
|
|
52
|
+
const uploadUpdateResultView = {
|
|
53
|
+
compactPick: UploadUpdateResult,
|
|
54
|
+
tableColumns: [{
|
|
55
|
+
key: "table_id",
|
|
56
|
+
label: "Table ID"
|
|
57
|
+
}, {
|
|
58
|
+
key: "action",
|
|
59
|
+
label: "Action"
|
|
60
|
+
}]
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/commands/upload/requests.ts
|
|
65
|
+
const UPLOAD_TABLE_ID_HEADER = "metabase-table-id";
|
|
66
|
+
const UPLOAD_UPDATE_PATHS = {
|
|
67
|
+
append: "append-csv",
|
|
68
|
+
replace: "replace-csv"
|
|
69
|
+
};
|
|
70
|
+
async function updateTableFromCsv(client, tableId, action, file) {
|
|
71
|
+
await client.requestRaw(`/api/table/${tableId}/${UPLOAD_UPDATE_PATHS[action]}`, {
|
|
72
|
+
method: "POST",
|
|
73
|
+
body: buildCsvFormData(file),
|
|
74
|
+
expectContentType: "binary"
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
table_id: tableId,
|
|
78
|
+
action
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function parseCreateUploadResult(bodyText, headers) {
|
|
82
|
+
return UploadResult.parse({
|
|
83
|
+
model_id: parseResponseInteger(bodyText, "response body"),
|
|
84
|
+
table_id: parseResponseInteger(headers.get(UPLOAD_TABLE_ID_HEADER), `${UPLOAD_TABLE_ID_HEADER} header`)
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function parseResponseInteger(value, source) {
|
|
88
|
+
const trimmed = value?.trim() ?? "";
|
|
89
|
+
if (trimmed === "") throw new Error(`upload succeeded but the ${source} was empty`);
|
|
90
|
+
const parsed = Number(trimmed);
|
|
91
|
+
if (!Number.isInteger(parsed)) throw new Error(`upload succeeded but the ${source} was not an integer: ${JSON.stringify(trimmed)}`);
|
|
92
|
+
return parsed;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { UploadResult, UploadUpdateResult, buildCsvFormData, parseCreateUploadResult, readCsvFile, requireUploadFilePath, updateTableFromCsv, uploadResultView, uploadUpdateResultView };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import "./
|
|
7
|
-
import {
|
|
8
|
-
import "./table-DE3i82T_.mjs";
|
|
9
|
-
import { DatabaseSyncResult, DatabaseTaskAck, databaseSyncResultView } from "./database-D9fftP-i.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 "./field-DsXTeqBy.mjs";
|
|
5
|
+
import { parseId } from "./parse-id-xS1tWJAq.mjs";
|
|
6
|
+
import "./table-3onHpwcb.mjs";
|
|
7
|
+
import { DatabaseSyncResult, DatabaseTaskAck, databaseSyncResultView } from "./database-BOqzcexD.mjs";
|
|
10
8
|
|
|
11
9
|
//#region src/commands/db/rescan-values.ts
|
|
12
10
|
var rescan_values_default = defineMetabaseCommand({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Collection } from "./collection-
|
|
1
|
+
import { Collection } from "./collection-C52Ndi_O.mjs";
|
|
2
|
+
import { fetchCollectionsWithLibrary } from "./listing-wFZuS5li.mjs";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
|
|
4
5
|
//#region src/domain/library.ts
|
|
@@ -6,7 +7,8 @@ const LibraryChild = Collection.pick({
|
|
|
6
7
|
id: true,
|
|
7
8
|
name: true,
|
|
8
9
|
type: true,
|
|
9
|
-
description: true
|
|
10
|
+
description: true,
|
|
11
|
+
is_remote_synced: true
|
|
10
12
|
}).strip();
|
|
11
13
|
const Library = Collection.extend({ effective_children: z.array(LibraryChild) }).loose();
|
|
12
14
|
const LibraryCompact = Library.pick({
|
|
@@ -36,33 +38,38 @@ const libraryView = {
|
|
|
36
38
|
//#endregion
|
|
37
39
|
//#region src/commands/library/resolve.ts
|
|
38
40
|
const LIBRARY_ROOT_PATH = "/api/ee/library/";
|
|
39
|
-
const COLLECTION_LIST_PATH = "/api/collection";
|
|
40
41
|
const LIBRARY_DATA_TYPE = "library-data";
|
|
41
42
|
const AbsentLibrary = z.object({ data: z.null() });
|
|
42
43
|
const LibraryOrAbsent = z.union([Library, AbsentLibrary]);
|
|
43
44
|
const LibraryCollectionEntry = Collection.pick({
|
|
44
45
|
id: true,
|
|
45
|
-
type: true
|
|
46
|
+
type: true,
|
|
47
|
+
is_remote_synced: true
|
|
46
48
|
}).strip();
|
|
47
|
-
const LibraryCollections = z.array(LibraryCollectionEntry);
|
|
48
49
|
async function fetchLibrary(client) {
|
|
49
50
|
const result = await client.requestParsed(LibraryOrAbsent, LIBRARY_ROOT_PATH);
|
|
50
51
|
if (!("effective_children" in result)) return null;
|
|
51
|
-
const
|
|
52
|
-
const effective_children = result.effective_children.map((child) =>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const infoById = await fetchLibraryCollectionInfo(client);
|
|
53
|
+
const effective_children = result.effective_children.map((child) => {
|
|
54
|
+
if (typeof child.id !== "number") return child;
|
|
55
|
+
const info = infoById.get(child.id);
|
|
56
|
+
if (info === void 0) return child;
|
|
57
|
+
return {
|
|
58
|
+
...child,
|
|
59
|
+
type: info.type ?? child.type,
|
|
60
|
+
is_remote_synced: info.is_remote_synced ?? child.is_remote_synced
|
|
61
|
+
};
|
|
62
|
+
});
|
|
56
63
|
return {
|
|
57
64
|
...result,
|
|
58
65
|
effective_children
|
|
59
66
|
};
|
|
60
67
|
}
|
|
61
|
-
async function
|
|
62
|
-
const collections = await client
|
|
63
|
-
const
|
|
64
|
-
for (const collection of collections) if (typeof collection.id === "number"
|
|
65
|
-
return
|
|
68
|
+
async function fetchLibraryCollectionInfo(client) {
|
|
69
|
+
const collections = await fetchCollectionsWithLibrary(client, LibraryCollectionEntry);
|
|
70
|
+
const infoById = new Map();
|
|
71
|
+
for (const collection of collections) if (typeof collection.id === "number") infoById.set(collection.id, collection);
|
|
72
|
+
return infoById;
|
|
66
73
|
}
|
|
67
74
|
async function createLibrary(client) {
|
|
68
75
|
const existing = await fetchLibrary(client);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import {
|
|
5
|
-
import { renderSummary } from "./capabilities-N0jo5U7S.mjs";
|
|
6
|
-
import { parseId } from "./parse-id-DlXnOcmP.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 { parseId } from "./parse-id-xS1tWJAq.mjs";
|
|
7
5
|
import { z } from "zod";
|
|
8
6
|
|
|
9
7
|
//#region src/commands/transform-job/run.ts
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { TimeoutError } from "./
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { parseWaitFlags, waitFlags } from "./wait-flags-D6kd_G7c.mjs";
|
|
9
|
-
import { Transform, TransformRun } from "./transform-DEF38FWe.mjs";
|
|
1
|
+
import { TimeoutError, connectionFlags, outputFlags, profileFlag, renderSummary } from "./capabilities-CiaAfUgX.mjs";
|
|
2
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
+
import { defineMetabaseCommand } from "./runtime-C6ASrgVA.mjs";
|
|
4
|
+
import { parseId } from "./parse-id-xS1tWJAq.mjs";
|
|
5
|
+
import { pollUntil } from "./poll-CuTlWBwI.mjs";
|
|
6
|
+
import { parseWaitFlags, waitFlags } from "./wait-flags-BpzyrpAL.mjs";
|
|
7
|
+
import { Transform, TransformRun } from "./transform-DP6J2ber.mjs";
|
|
10
8
|
import { z } from "zod";
|
|
11
9
|
|
|
12
10
|
//#region src/commands/transform/run.ts
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import {
|
|
5
|
-
import { renderList } from "./capabilities-N0jo5U7S.mjs";
|
|
6
|
-
import { parseId } from "./parse-id-DlXnOcmP.mjs";
|
|
1
|
+
import { connectionFlags, listEnvelopeSchema, outputFlags, profileFlag, renderList } from "./capabilities-CiaAfUgX.mjs";
|
|
2
|
+
import "./command-augment-D9pI9Vbh.mjs";
|
|
3
|
+
import { defineMetabaseCommand } from "./runtime-C6ASrgVA.mjs";
|
|
4
|
+
import { parseId } from "./parse-id-xS1tWJAq.mjs";
|
|
7
5
|
import { collectPaginated } from "./paginate-FVZUxL4J.mjs";
|
|
8
|
-
import { TransformRun, TransformRunCompact, transformRunView } from "./transform-
|
|
6
|
+
import { TransformRun, TransformRunCompact, transformRunView } from "./transform-DP6J2ber.mjs";
|
|
9
7
|
|
|
10
8
|
//#region src/commands/transform/runs.ts
|
|
11
9
|
const TransformRunListEnvelope = listEnvelopeSchema(TransformRunCompact);
|