@metabase/cli 0.3.0 → 0.3.1-alpha.versioning.9ac5f50
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/dist/{add-collection-B3Ty8SzB.mjs → add-collection-Dmd-uNeU.mjs} +4 -7
- package/dist/{alert-DT-ee7yf.mjs → alert-D1u2MVZj.mjs} +7 -7
- package/dist/{alerts-Bf2RH_p_.mjs → alerts-DcBjcfEE.mjs} +5 -5
- package/dist/{append-DFzQRPMd.mjs → append-B9Htvmab.mjs} +6 -5
- package/dist/{archive-lQqs13Uz.mjs → archive-B660RguB.mjs} +4 -4
- package/dist/{archive-ByvA49Kz.mjs → archive-BNivAYGr.mjs} +4 -4
- package/dist/{archive-4tmm946K.mjs → archive-BUoYMkxO.mjs} +4 -4
- package/dist/{archive-C7w49Grr.mjs → archive-BVmFGFwG.mjs} +4 -4
- package/dist/{archive-ChORH5JH.mjs → archive-Bf014rFm.mjs} +4 -4
- package/dist/{archive-gid9Y09v.mjs → archive-BmsZFOZY.mjs} +4 -4
- package/dist/{archive-BxNPHxOY.mjs → archive-CNif6BKy.mjs} +6 -6
- package/dist/{archive-Cd29QC0c.mjs → archive-CgmidYZV.mjs} +4 -4
- package/dist/{archive-CwAdlv63.mjs → archive-CvU2z5192.mjs} +4 -4
- package/dist/{archive-Dr9Xnx_Z.mjs → archive-DhDQIKR_.mjs} +6 -6
- package/dist/{archive-B6eXiyER.mjs → archive-bPdDITuY.mjs} +4 -4
- package/dist/{auth-Dltxua89.mjs → auth-CefYEPP5.mjs} +5 -5
- package/dist/{body-Cur4NJt9.mjs → body-C7m9q4cm.mjs} +3 -3
- package/dist/{branches-DchlyU0i.mjs → branches-pz04OjF2.mjs} +3 -6
- package/dist/{cancel-BMQa5R1Z.mjs → cancel-CNLnv19e.mjs} +4 -4
- package/dist/{cancel-task-C5CU1pxU.mjs → cancel-task-DbnxSh7U.mjs} +3 -6
- package/dist/card-BRarvKYX.mjs +24 -0
- package/dist/{cards-SccWvRQD.mjs → cards-DtYlVoGP.mjs} +6 -6
- package/dist/cli.mjs +554 -62
- package/dist/{client-BqhzKdLM.mjs → client-Bv7Iwdvh.mjs} +258 -76
- package/dist/collection-CKeO8X7U.mjs +20 -0
- package/dist/{collection-CGoVLvcD.mjs → collection-DALwHnbz.mjs} +1 -1
- package/dist/{collection-CfulNRBG.mjs → collection-WFdBeyqa.mjs} +1 -1
- package/dist/{collection-namespace-GwydWBF3.mjs → collection-namespace-CvT0TIZA.mjs} +2 -2
- package/dist/content-translation-BrHOrmj9.mjs +5 -0
- package/dist/content-translation-D7POzJJ6.mjs +12 -0
- package/dist/{create-CD008jdE.mjs → create-BEE8uvz2.mjs} +12 -8
- package/dist/{create-CAQV2g6V.mjs → create-Bh2j733n.mjs} +7 -7
- package/dist/{create-BNQ_DytP.mjs → create-Bwg-5p08.mjs} +4 -4
- package/dist/{create-C79vErX0.mjs → create-CGPle4nE.mjs} +5 -5
- package/dist/{create-i14Wv3Tj.mjs → create-CGgPnb7L.mjs} +4 -4
- package/dist/{create-DJmXXQoq.mjs → create-CLgalJUe.mjs} +8 -8
- package/dist/{create-Beh-2uoN.mjs → create-CN24yp_W.mjs} +6 -6
- package/dist/{create-DF4QtgDL.mjs → create-CuYGZ4gu2.mjs} +4 -4
- package/dist/{create-CAWytBE5.mjs → create-DGHILnnk.mjs} +5 -5
- package/dist/{create-zeveFdnd.mjs → create-DYd_o9BD.mjs} +5 -8
- package/dist/{create-DV-Ln5Mo.mjs → create-DhDREiiy.mjs} +4 -4
- package/dist/{create-CHQx7jq4.mjs → create-Di4YvIbK.mjs} +4 -4
- package/dist/{create-tQbnuz-I.mjs → create-DnqnjGGf.mjs} +4 -4
- package/dist/{create-CCh_LyW9.mjs → create-Ds-DnSBe.mjs} +4 -4
- package/dist/{create-BOLwWt8Q.mjs → create-JOXq0ULN.mjs} +5 -5
- package/dist/{create-branch-CYo6jZth.mjs → create-branch-DWcxC30N.mjs} +3 -7
- package/dist/{csv-B2Jgb1GM.mjs → csv-CUQvcCEk.mjs} +6 -5
- package/dist/{current-task-MpBFGttd.mjs → current-task-D6P0eL21.mjs} +3 -6
- package/dist/{dashboard-CsIFFpzK.mjs → dashboard-BlbNszi8.mjs} +1 -1
- package/dist/{dashboard-BHJBoaG7.mjs → dashboard-BudI952R.mjs} +10 -10
- package/dist/{dashboard-BCpSq_G-.mjs → dashboard-CKUR8ZpQ.mjs} +1 -0
- package/dist/{db-DsfojyeH.mjs → db-C7UTd-6P.mjs} +7 -7
- package/dist/{delete-DFmX7jTp.mjs → delete-DSxqbcFE.mjs} +5 -5
- package/dist/{delete-Ck0q4Dzp.mjs → delete-DbZZKcYj.mjs} +5 -5
- package/dist/{delete-Ob06PPie.mjs → delete-Ds-zGh9C.mjs} +5 -5
- package/dist/{delete-B8e01xAG.mjs → delete-Ud6iliGM.mjs} +5 -5
- package/dist/{delete-BApOjQvl.mjs → delete-_IHffP-A.mjs} +5 -5
- package/dist/{delete-runtime-D74s6vhu.mjs → delete-runtime-BjHL1ryM.mjs} +1 -2
- package/dist/{delete-table-DuyhGrvA.mjs → delete-table-DtXH6IN5.mjs} +5 -5
- package/dist/{dependencies-Bj3QrGIm.mjs → dependencies-CR1dlq-A.mjs} +6 -6
- package/dist/{dirty-DNYoM6Bp.mjs → dirty-CYxnOnh0.mjs} +3 -6
- package/dist/document-BoILnE_1.mjs +19 -0
- package/dist/download-DPpmmYQe.mjs +25 -0
- package/dist/{eid-WTZmDdsr.mjs → eid-D-BbtWjt.mjs} +4 -5
- package/dist/{events-Bn7jh5lP.mjs → events-CJEnn8WE.mjs} +4 -4
- package/dist/{export-BjfoZRDJ.mjs → export-BOgyuIOQ.mjs} +4 -7
- package/dist/{field-Zau6Hc6X.mjs → field-CzHBOPER.mjs} +5 -5
- package/dist/{fields-CBBa-Prp.mjs → fields-Bwgkrvus.mjs} +4 -4
- package/dist/{get-C2-Q3iQ5.mjs → get-B89DUSvw.mjs} +4 -4
- package/dist/{get-DkWO0EI0.mjs → get-BL90QC64.mjs} +6 -6
- package/dist/{get-ByBOq30r.mjs → get-BLJSCw53.mjs} +6 -6
- package/dist/{get-DRvsATp-.mjs → get-BOLwso0V.mjs} +6 -6
- package/dist/{get-B7sMgsFs.mjs → get-BaPadzdM.mjs} +4 -4
- package/dist/{get-00lyLv6R.mjs → get-BfVCLBqc.mjs} +4 -4
- package/dist/{get-DdsoHaKH.mjs → get-C1ZdOvMm.mjs} +4 -4
- package/dist/{get-DmpB6J9g.mjs → get-CLu4yzMp2.mjs} +4 -4
- package/dist/{get-DY03Azx9.mjs → get-COwdtskS.mjs} +5 -8
- package/dist/{get-D_h-G9bn.mjs → get-CWfIiXwL.mjs} +4 -4
- package/dist/get-CqQ-pf0q.mjs +89 -0
- package/dist/{get-DYO1kywc.mjs → get-CvIgxPXV.mjs} +4 -4
- package/dist/{get-Bz99dAxK.mjs → get-D4OTJblo.mjs} +6 -6
- package/dist/{get-Dn9ZiSZr.mjs → get-D8lHwu4-.mjs} +4 -4
- package/dist/{get-B_xdF1kq.mjs → get-DVi3a2nm.mjs} +4 -4
- package/dist/{get-CDJFVvhj.mjs → get-DgnYF7LR.mjs} +4 -4
- package/dist/{get-CDMGbgrh.mjs → get-DsKmZfM2.mjs} +4 -4
- package/dist/{get-Dmj9Ygz1.mjs → get-DyyPiiaB.mjs} +4 -4
- package/dist/{get-CnbUCzDM.mjs → get-Eqq13YY-.mjs} +4 -4
- package/dist/{get-run-Cnux9ln0.mjs → get-run-Iya0Yw9s.mjs} +6 -6
- package/dist/git-sync-CdN0Maun.mjs +28 -0
- package/dist/{group-DBM87IgC.mjs → group-CmVCLBDz.mjs} +2 -1
- package/dist/{has-remote-changes-C684Redh.mjs → has-remote-changes-DfJUMP8F.mjs} +3 -6
- package/dist/{import-Rmmttboo.mjs → import-FEAx-Y5A.mjs} +4 -7
- package/dist/{input-DH9i67x_.mjs → input-DFZ_qGW_.mjs} +1 -1
- package/dist/{is-dirty-DYeJYhBz.mjs → is-dirty-BsYjBSXG.mjs} +3 -6
- package/dist/{items-CQlPXBXE.mjs → items-D4rstE12.mjs} +6 -6
- package/dist/{key-BEhqIzIQ.mjs → key-BmWundO3.mjs} +1 -1
- package/dist/{library-DfYAT2Ep.mjs → library-CmctxHjv.mjs} +1 -1
- package/dist/library-DXB8sm4r.mjs +81 -0
- package/dist/{library-Bsm5KsFF.mjs → library-uzyHWBap.mjs} +5 -5
- package/dist/{list-DF2rvoO1.mjs → list-1DkkU82x.mjs} +13 -12
- package/dist/{list-BpFp9Wre.mjs → list-B7tqNV8B.mjs} +3 -3
- package/dist/{list-DE9FM957.mjs → list-BRpPbvyS.mjs} +3 -3
- package/dist/{list-CQwOgIlj.mjs → list-BXL8HFr_.mjs} +3 -3
- package/dist/{list-BzVTHOoH.mjs → list-Bjj0z5BS.mjs} +5 -5
- package/dist/{list-CQDprvW0.mjs → list-BmMi_wPD.mjs} +6 -6
- package/dist/{list-C5Zs8nrb.mjs → list-CC1M_n6Z.mjs} +5 -5
- package/dist/{list-CKK-s3Ty.mjs → list-CQy0z7f9.mjs} +3 -3
- package/dist/{list-BtmsNOEn.mjs → list-D_zvX0ms.mjs} +3 -3
- package/dist/{list-CMpoc2TN.mjs → list-DeNGm9G4.mjs} +3 -3
- package/dist/{list-DMKDsBRd.mjs → list-Dgm6TkqR.mjs} +6 -6
- package/dist/{list-BOET6zhP.mjs → list-DoTiQc3D.mjs} +3 -3
- package/dist/{list-BP3MPq-M.mjs → list-DrS3ePsv.mjs} +3 -3
- package/dist/list-bN0RC14-.mjs +59 -0
- package/dist/{list-B4hJuMhA.mjs → list-ndIl9XqV.mjs} +4 -4
- package/dist/{list-B8nAGwP4.mjs → list-sQcA4g05.mjs} +3 -3
- package/dist/{list-CNUiF8Z7.mjs → list-squb_ioH.mjs} +3 -3
- package/dist/{list-BtkWNtvY.mjs → list-xMfCeuZc.mjs} +4 -4
- package/dist/{login-CGHeSjlP.mjs → login-D_1-zE4A.mjs} +15 -12
- package/dist/{logout-DAxOlbv4.mjs → logout-DPi2q1Wu.mjs} +3 -4
- package/dist/{measure-BsYv0p26.mjs → measure-CdA8Nl3Z.mjs} +6 -6
- package/dist/{parameter-values-CJTdqd8c.mjs → parameter-values-C6dj6I4g.mjs} +4 -5
- package/dist/{parse-enum-D0Jfm_Bz.mjs → parse-enum-B1t8S194.mjs} +1 -1
- package/dist/{parse-id-C_jmKFaa.mjs → parse-id-DR8aUSdL.mjs} +1 -1
- package/dist/{parse-ref-ibKVB0J4.mjs → parse-ref-BJ_Q0tNW.mjs} +1 -1
- package/dist/{path-B5gHvrYL.mjs → path-B96DI8u2.mjs} +4 -4
- package/dist/{poll-75SvT7Zv.mjs → poll-By46YQ5J.mjs} +2 -2
- package/dist/{preflight-YpPQo-sa.mjs → preflight-Bl1oitm8.mjs} +3 -4
- package/dist/{process-DBOOrmET.mjs → process-CcQM4qPv.mjs} +1 -1
- package/dist/{publish-DijrxaCW.mjs → publish-BKJYvxif.mjs} +9 -9
- package/dist/{query-Dc__-KJH.mjs → query-BKSM-pbi.mjs} +6 -7
- package/dist/{query-BbqECzmF.mjs → query-qBHjZQc_.mjs} +5 -12
- package/dist/{remove-collection-BOnxYvhj.mjs → remove-collection-BWFW7Rn6.mjs} +4 -7
- package/dist/{render-CI93iP0I.mjs → render-DmykmrFB.mjs} +11 -2
- package/dist/{replace-Cq4CxVa-.mjs → replace-BmAqD3zY.mjs} +6 -5
- package/dist/{rescan-values-Dr_j416g.mjs → rescan-values-BrCLrihF.mjs} +4 -4
- package/dist/{run-C3DkS6NP.mjs → run-CtbzjDKY.mjs} +6 -6
- package/dist/{run-DdGJ544X.mjs → run-q5Y44Fxj.mjs} +26 -14
- package/dist/{runs-CUNWiidL.mjs → runs-JFlbezkQ.mjs} +6 -6
- package/dist/{runtime-DiKyBxOw.mjs → runtime-BQiGgbgZ.mjs} +850 -265
- package/dist/{schema-tables-CV386fnC.mjs → schema-tables-Bzx2ShyE.mjs} +4 -4
- package/dist/{schemas-DM-UqZBQ.mjs → schemas-ww5mU2AS.mjs} +4 -4
- package/dist/{search-DmGScXs8.mjs → search-J4RwCof-.mjs} +4 -4
- package/dist/{segment-BzUGM2Fr.mjs → segment-XXTjU0eG.mjs} +6 -6
- package/dist/{selectors-DGDn0Hto.mjs → selectors-BAAZMi43.mjs} +3 -3
- package/dist/{send-CVxxEpDB.mjs → send-BmpDlw9O.mjs} +4 -4
- package/dist/{set-DFolTjbd.mjs → set-DUWrSza9.mjs} +5 -5
- package/dist/{set-active-BD8L1lPX.mjs → set-active-BiUlbNI5.mjs} +5 -5
- package/dist/{setting-DyhaeICs.mjs → setting-B1KBQN3M.mjs} +4 -4
- package/dist/{setup-BbDQN8fe.mjs → setup-CVaNVwOd.mjs} +4 -4
- package/dist/{signal-CMd0EFUa.mjs → signal-GhGmuHfx.mjs} +11 -2
- package/dist/{list-UhpKG6_m.mjs → skill-list-DTnDhnL5.mjs} +17 -46
- package/dist/{skills--vK6J-e4.mjs → skills-BWrAlj9l.mjs} +3 -3
- package/dist/{skills-DTCrMcix.mjs → skills-DkDsSH5F.mjs} +102 -14
- package/dist/snippet-CG75L2DS.mjs +19 -0
- package/dist/{stash-D0S4JmAz.mjs → stash-DMm8YF8V.mjs} +4 -8
- package/dist/{status-hL1am-HV.mjs → status-BzEQjQ_t.mjs} +12 -11
- package/dist/{status-BhswxJL1.mjs → status-ClWsQD6v.mjs} +9 -7
- package/dist/stream-McixcoUl.mjs +7 -0
- package/dist/{subscription-_d5fB45F.mjs → subscription-CdFn2hre.mjs} +6 -6
- package/dist/{subscriptions-s4TF6Ax3.mjs → subscriptions-DBda1pE5.mjs} +5 -5
- package/dist/{summary-CsPvcUwW.mjs → summary-B4GPiuqD.mjs} +4 -4
- package/dist/{sync-schema-DaZ_MV-u.mjs → sync-schema-DsIM5g2U.mjs} +5 -5
- package/dist/{table-DYoC1kPn.mjs → table-D4Alrrwh.mjs} +5 -5
- package/dist/timeline-DmM0BuX8.mjs +21 -0
- package/dist/{timeline-event-CNQdCTDg.mjs → timeline-event-DWIh3Tdt.mjs} +6 -6
- package/dist/transform-BcV_XlSX.mjs +28 -0
- package/dist/{transform-DoTyyXAu.mjs → transform-Bk0D0nIs.mjs} +1 -1
- package/dist/{transform-D3QX0jxA.mjs → transform-DpuG-ON3.mjs} +26 -5
- package/dist/{transform-job-50GZHhKH.mjs → transform-job-AaMZRxAq.mjs} +1 -1
- package/dist/{transform-job-DRrK28IH.mjs → transform-job-CCguL6LP.mjs} +41 -4
- package/dist/transform-job-CjtwBGoM.mjs +22 -0
- package/dist/{transform-tag-_tgwlsdB.mjs → transform-tag-DJ3_bksm.mjs} +5 -5
- package/dist/{transforms-oU4zizbO.mjs → transforms-Dg2MfB2a.mjs} +6 -6
- package/dist/{tree-CH-f3bjP.mjs → tree-BQL0f7YX.mjs} +4 -5
- package/dist/{unpublish-BUl9RU5C.mjs → unpublish-DfSvb_Rs.mjs} +4 -7
- package/dist/{update-D-NE60AV.mjs → update-B-hRR8gW.mjs} +5 -5
- package/dist/{update-CO4m4wH3.mjs → update-BCgAyfj_.mjs} +6 -6
- package/dist/{update-BzMDeZiU.mjs → update-Bhmli02m.mjs} +5 -5
- package/dist/{update-CvOO8TED.mjs → update-BxIyFtrX.mjs} +5 -5
- package/dist/{update-BiFDBcEH.mjs → update-CDo0Orvu.mjs} +5 -5
- package/dist/{update-BCS5FxKr.mjs → update-CKoBDTL7.mjs} +9 -9
- package/dist/{update-CmDTljK-.mjs → update-CiYxcf8M.mjs} +7 -7
- package/dist/{update-CHNSUHK4.mjs → update-Cr5zHb0D.mjs} +5 -5
- package/dist/{update-Nfi44RrE.mjs → update-CtDHMxW8.mjs} +6 -6
- package/dist/{update-bD_Jh5-s.mjs → update-D1QdfpKR.mjs} +5 -5
- package/dist/{update-BZPllQoR.mjs → update-D4qdTlLF.mjs} +5 -5
- package/dist/{update-C4YJQFDS.mjs → update-DBGaJDsj.mjs} +5 -5
- package/dist/{update-tX9mKBN_.mjs → update-Izqip6jY.mjs} +9 -9
- package/dist/{update-cYkvbqK8.mjs → update-NZhIjTCf.mjs} +5 -5
- package/dist/{update-dashcard-C3TuYO_k.mjs → update-dashcard-D5b971AO.mjs} +7 -7
- package/dist/{update-CVPAwJaH.mjs → update-sYLQIUgh.mjs} +6 -6
- package/dist/{upgrade-DXMV4AyP.mjs → upgrade-CD1xtsIv.mjs} +6 -8
- package/dist/upload-BUd3MG90.mjs +23 -0
- package/dist/upload-C3z5ZaXA.mjs +24 -0
- package/dist/upload-DzGTlldn.mjs +13 -0
- package/dist/upload-akKFxpVA.mjs +39 -0
- package/dist/{uuid-BJkDWj9p.mjs → uuid-oVdJ62eA.mjs} +3 -4
- package/dist/{validate-BWchyW0V.mjs → validate-CWd6l6KZ.mjs} +1 -1
- package/dist/{validate-query-DaGYSmpQ.mjs → validate-query-Boi8-cAP.mjs} +2 -3
- package/dist/{values-Dxf1JEoA.mjs → values-DLwZl-P8.mjs} +4 -4
- package/dist/{verify-K96rItG5.mjs → verify-CH9Tw8yv.mjs} +3 -18
- package/dist/{wait-flags-DWEF9tX4.mjs → wait-flags-DiQ_kRjZ.mjs} +2 -2
- package/dist/{wait-DoMDH226.mjs → wait-rfTdQWdi.mjs} +5 -8
- package/package.json +1 -1
- package/skill-data/core/SKILL.md +16 -5
- package/skill-data/dashboard/SKILL.md +2 -2
- package/skill-data/data-workflow/references/building-clean-tables.md +6 -2
- package/skill-data/data-workflow/references/reusable-definitions.md +11 -3
- package/skill-data/document/SKILL.md +4 -1
- package/skill-data/git-sync/SKILL.md +5 -0
- package/skill-data/mbql/SKILL.md +1 -1
- package/skill-data/mbql/references/operators.md +20 -15
- package/skill-data/metadata/SKILL.md +1 -1
- package/skill-data/metadata/references/semantic-types.md +7 -1
- package/skill-data/native-sql/references/template-tags.md +6 -2
- package/skill-data/notification/SKILL.md +7 -1
- package/skill-data/transform/SKILL.md +12 -2
- package/skill-data/visualization/SKILL.md +11 -3
- package/skill-data/visualization/references/settings.md +6 -4
- package/skills/metabase-cli/SKILL.md +1 -1
- package/dist/card-CHI2bmds.mjs +0 -24
- package/dist/collection-CY0AB99E.mjs +0 -20
- package/dist/document-BbskZPTT.mjs +0 -19
- package/dist/get-CvI--9S_.mjs +0 -80
- package/dist/git-sync-MQQYRYLg.mjs +0 -28
- package/dist/library-ClLgrAXy.mjs +0 -19
- package/dist/network-error-CEb9ymDW.mjs +0 -423
- package/dist/predicates-Bkm2IoeX.mjs +0 -170
- package/dist/snippet-DRwKb2x7.mjs +0 -19
- package/dist/timeline-xlDbEKWg.mjs +0 -21
- package/dist/transform-Bs0EWijQ.mjs +0 -28
- package/dist/transform-job-BcLChRup.mjs +0 -22
- package/dist/upload-CH632qW6.mjs +0 -46
- package/dist/upload-Dey_8rLf.mjs +0 -13
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as ValidationError, K as ConfigError, X as ResponseShapeError, Y as NetworkError, Z as TimeoutError, et as errorMessage, it as createServerProfile, n as methodRequirements, q as InternalError } from "./cli.mjs";
|
|
2
2
|
import { n as Notification, r as NotificationCardPayload, t as CARD_PAYLOAD_TYPE } from "./notification-DaA4bBHW.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { n as throwIfAborted, t as combineAborts } from "./signal-
|
|
3
|
+
import { $ as probeServer, B as JSON_CONTENT_TYPE, F as buildNetworkError, G as credentialSecrets, H as parseJsonOrPlain, I as isConnectionClosed, J as normalizeUrl, L as HttpError, Q as checkRequirements, U as assertCredentialHeaderSafe, V as parseJson, W as credentialAuthHeader, et as CapabilityError, z as isRetryableStatus } from "./runtime-BQiGgbgZ.mjs";
|
|
4
|
+
import { n as throwIfAborted, r as untilAborted, t as combineAborts } from "./signal-GhGmuHfx.mjs";
|
|
5
5
|
import { s as FieldValues, t as Field } from "./field-Cr2DPUG9.mjs";
|
|
6
6
|
import { r as ParameterValues } from "./parameter-DUKR8NXo.mjs";
|
|
7
7
|
import { o as CardQueryResult, t as Card } from "./card-DZxRmver.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { p as CollectionTreeNode, r as Collection, s as CollectionItem } from "./collection-WFdBeyqa.mjs";
|
|
9
|
+
import { t as ContentTranslationUploadResult } from "./content-translation-BrHOrmj9.mjs";
|
|
10
|
+
import { i as DashboardDetail, s as Dashcard, t as Dashboard } from "./dashboard-CKUR8ZpQ.mjs";
|
|
10
11
|
import { i as TableQueryMetadata, t as Table } from "./table-CeeTJgQb.mjs";
|
|
11
12
|
import { t as Database } from "./database-C8G6ZKG0.mjs";
|
|
12
|
-
import { r as pollUntil } from "./poll-
|
|
13
|
+
import { r as pollUntil } from "./poll-By46YQ5J.mjs";
|
|
13
14
|
import { t as Document } from "./document-Cd2mmqCp.mjs";
|
|
14
15
|
import { i as EidTranslateResult } from "./eid-translation-zEHtr5Oc.mjs";
|
|
15
16
|
import { f as isSyncTaskTerminal, l as SyncTask, n as SyncDirtyItem, o as SyncRemoteChanges, s as SyncSettingsUpdateResult, t as SyncBranchCreated } from "./git-sync-BDnxPrqU.mjs";
|
|
16
|
-
import {
|
|
17
|
+
import { a as toLibrary, i as libraryWireSchema, n as LibraryCollectionInfo } from "./library-DXB8sm4r.mjs";
|
|
17
18
|
import { t as Measure } from "./measure-CtfjqJFP.mjs";
|
|
18
19
|
import { t as Pulse } from "./pulse-BmsDenXm.mjs";
|
|
19
20
|
import { r as SearchResult } from "./search-DFBwUc6d.mjs";
|
|
@@ -22,8 +23,8 @@ import { t as Setting } from "./setting-DTiLCW8g.mjs";
|
|
|
22
23
|
import { n as SetupResult } from "./setup-CO7QV-ao.mjs";
|
|
23
24
|
import { t as Snippet } from "./snippet-CyKAgIZl.mjs";
|
|
24
25
|
import { i as TimelineEvent, t as Timeline } from "./timeline-CCSU2qOS.mjs";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
26
|
+
import { d as transformDetailSchema, f as transformRowSchema, i as TransformRun, l as isTransformRunFailed, u as isTransformRunTerminal } from "./transform-DpuG-ON3.mjs";
|
|
27
|
+
import { c as transformJobSchema, n as TransformJobActiveResult, s as transformJobRunResultSchema } from "./transform-job-CCguL6LP.mjs";
|
|
27
28
|
import { t as TransformTag } from "./transform-tag-CcElGp3C.mjs";
|
|
28
29
|
import { t as UploadResult } from "./upload-DAtxBBms.mjs";
|
|
29
30
|
import { z } from "zod";
|
|
@@ -41,7 +42,6 @@ var __exportAll = (all, no_symbols) => {
|
|
|
41
42
|
};
|
|
42
43
|
//#endregion
|
|
43
44
|
//#region ../client/src/http/response-shape.ts
|
|
44
|
-
const NO_SERVER_TAG = async () => null;
|
|
45
45
|
async function parseJsonResponse(text, schema, context) {
|
|
46
46
|
try {
|
|
47
47
|
return parseJson(text, schema, { source: context.url });
|
|
@@ -52,7 +52,8 @@ async function parseJsonResponse(text, schema, context) {
|
|
|
52
52
|
url: context.url,
|
|
53
53
|
status: context.status,
|
|
54
54
|
zodIssues: error.developerDetail.zodIssues,
|
|
55
|
-
serverTag: await context.getServerTag()
|
|
55
|
+
serverTag: await context.getServerTag(),
|
|
56
|
+
serverSkew: context.serverSkew
|
|
56
57
|
});
|
|
57
58
|
throw error;
|
|
58
59
|
}
|
|
@@ -103,7 +104,9 @@ function createTransport(config, options) {
|
|
|
103
104
|
const baseUrl = normalizeUrl(config.url);
|
|
104
105
|
assertCredentialHeaderSafe(config.credential);
|
|
105
106
|
const fetchImpl = options.fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
106
|
-
|
|
107
|
+
let settledProfile = options.server ?? null;
|
|
108
|
+
const getServerTag = options.getServerTag ?? (async () => tagOf(settledProfile));
|
|
109
|
+
const serverSkew = () => settledProfile === null ? null : settledProfile.skew;
|
|
107
110
|
const refreshCredential = options.refreshCredential;
|
|
108
111
|
let credential = config.credential;
|
|
109
112
|
const knownSecrets = new Set(credentialSecrets(credential));
|
|
@@ -242,7 +245,30 @@ function createTransport(config, options) {
|
|
|
242
245
|
cancelSignal: combineAborts(opts.signal, options.signal)
|
|
243
246
|
};
|
|
244
247
|
}
|
|
245
|
-
|
|
248
|
+
let serverProfile = options.server === void 0 ? null : Promise.resolve(options.server);
|
|
249
|
+
async function server(wait = {}) {
|
|
250
|
+
throwIfAborted(wait.signal);
|
|
251
|
+
if (serverProfile === null) {
|
|
252
|
+
const probe = probeServer(transport).then((info) => {
|
|
253
|
+
settledProfile = createServerProfile(info);
|
|
254
|
+
return settledProfile;
|
|
255
|
+
});
|
|
256
|
+
probe.catch(() => {
|
|
257
|
+
serverProfile = null;
|
|
258
|
+
});
|
|
259
|
+
serverProfile = probe;
|
|
260
|
+
}
|
|
261
|
+
return untilAborted(serverProfile, wait.signal);
|
|
262
|
+
}
|
|
263
|
+
const enforceRequirements = options.enforceRequirements ?? true;
|
|
264
|
+
async function requireFeatures(key, wait = {}) {
|
|
265
|
+
if (!enforceRequirements || methodRequirements(key).length === 0) return;
|
|
266
|
+
const failure = checkRequirements(key, await server(wait));
|
|
267
|
+
if (failure !== null) throw new CapabilityError(failure);
|
|
268
|
+
}
|
|
269
|
+
const transport = {
|
|
270
|
+
server,
|
|
271
|
+
require: requireFeatures,
|
|
246
272
|
async requestRaw(path, opts) {
|
|
247
273
|
return (await executeWithAuthRefresh(path, opts ?? {})).response;
|
|
248
274
|
},
|
|
@@ -255,7 +281,8 @@ function createTransport(config, options) {
|
|
|
255
281
|
method: prepared.method,
|
|
256
282
|
url: prepared.url,
|
|
257
283
|
status: response.status,
|
|
258
|
-
getServerTag
|
|
284
|
+
getServerTag,
|
|
285
|
+
serverSkew: serverSkew()
|
|
259
286
|
});
|
|
260
287
|
},
|
|
261
288
|
async requestStream(path, opts) {
|
|
@@ -271,6 +298,11 @@ function createTransport(config, options) {
|
|
|
271
298
|
return response.body;
|
|
272
299
|
}
|
|
273
300
|
};
|
|
301
|
+
return transport;
|
|
302
|
+
}
|
|
303
|
+
function tagOf(profile) {
|
|
304
|
+
if (profile === null || profile.version === null) return null;
|
|
305
|
+
return profile.version.tag;
|
|
274
306
|
}
|
|
275
307
|
function buildUrl(baseUrl, path, query) {
|
|
276
308
|
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
@@ -319,6 +351,7 @@ const CardApiList = z.array(Card);
|
|
|
319
351
|
function cardResource(transport) {
|
|
320
352
|
/** List cards. `f` picks a server-side preset; `model_id` scopes the presets that need an id. */
|
|
321
353
|
async function list(params = {}, options = {}) {
|
|
354
|
+
await transport.require("card.list", options);
|
|
322
355
|
return {
|
|
323
356
|
data: await transport.requestParsed(CardApiList, "/api/card", {
|
|
324
357
|
...options,
|
|
@@ -332,10 +365,12 @@ function cardResource(transport) {
|
|
|
332
365
|
}
|
|
333
366
|
/** Get one card by id. */
|
|
334
367
|
async function get(id, options = {}) {
|
|
368
|
+
await transport.require("card.get", options);
|
|
335
369
|
return transport.requestParsed(Card, `/api/card/${id}`, { ...options });
|
|
336
370
|
}
|
|
337
371
|
/** Create a card — a question, a model, or a metric — from a full card body. */
|
|
338
372
|
async function create(params, options = {}) {
|
|
373
|
+
await transport.require("card.create", options);
|
|
339
374
|
return transport.requestParsed(Card, "/api/card", {
|
|
340
375
|
...options,
|
|
341
376
|
method: "POST",
|
|
@@ -344,6 +379,7 @@ function cardResource(transport) {
|
|
|
344
379
|
}
|
|
345
380
|
/** Update a card by id, patching only the fields the body carries. */
|
|
346
381
|
async function update(id, params, options = {}) {
|
|
382
|
+
await transport.require("card.update", options);
|
|
347
383
|
return transport.requestParsed(Card, `/api/card/${id}`, {
|
|
348
384
|
...options,
|
|
349
385
|
method: "PUT",
|
|
@@ -352,10 +388,12 @@ function cardResource(transport) {
|
|
|
352
388
|
}
|
|
353
389
|
/** Archive (soft-delete) a card by id. Metabase models this as an update, not its own endpoint. */
|
|
354
390
|
async function archive(id, options = {}) {
|
|
391
|
+
await transport.require("card.archive", options);
|
|
355
392
|
return update(id, { archived: true }, options);
|
|
356
393
|
}
|
|
357
394
|
/** Run a saved card and return the query result envelope. */
|
|
358
395
|
async function query(id, params, options = {}) {
|
|
396
|
+
await transport.require("card.query", options);
|
|
359
397
|
return transport.requestParsed(CardQueryResult, `/api/card/${id}/query`, {
|
|
360
398
|
...options,
|
|
361
399
|
method: "POST",
|
|
@@ -367,6 +405,7 @@ function cardResource(transport) {
|
|
|
367
405
|
* form-encoded body and answers bytes, so a caller consumes the stream rather than a value.
|
|
368
406
|
*/
|
|
369
407
|
async function exportQuery(id, format, params, options = {}) {
|
|
408
|
+
await transport.require("card.exportQuery", options);
|
|
370
409
|
const body = new URLSearchParams({
|
|
371
410
|
parameters: JSON.stringify(params.parameters),
|
|
372
411
|
format_rows: String(params.format_rows),
|
|
@@ -460,6 +499,7 @@ async function listCollectionsWithLibrary(transport, schema, options = {}) {
|
|
|
460
499
|
function collectionResource(transport) {
|
|
461
500
|
/** List collections. `filter` picks a server-side preset: everything, archived, or personal. */
|
|
462
501
|
async function list(params = {}, options = {}) {
|
|
502
|
+
await transport.require("collection.list", options);
|
|
463
503
|
return {
|
|
464
504
|
data: await transport.requestParsed(CollectionApiList, "/api/collection", {
|
|
465
505
|
...options,
|
|
@@ -474,6 +514,7 @@ function collectionResource(transport) {
|
|
|
474
514
|
* caller resolves both.
|
|
475
515
|
*/
|
|
476
516
|
async function listWithLibrary(options = {}) {
|
|
517
|
+
await transport.require("collection.listWithLibrary", options);
|
|
477
518
|
return {
|
|
478
519
|
data: await listCollectionsWithLibrary(transport, Collection, options),
|
|
479
520
|
total: null
|
|
@@ -481,10 +522,12 @@ function collectionResource(transport) {
|
|
|
481
522
|
}
|
|
482
523
|
/** Get one collection by id, entity id, or the `root`/`trash` alias. */
|
|
483
524
|
async function get(ref, options = {}) {
|
|
525
|
+
await transport.require("collection.get", options);
|
|
484
526
|
return transport.requestParsed(Collection, `/api/collection/${refPath(ref)}`, { ...options });
|
|
485
527
|
}
|
|
486
528
|
/** Create a new collection. */
|
|
487
529
|
async function create(params, options = {}) {
|
|
530
|
+
await transport.require("collection.create", options);
|
|
488
531
|
return transport.requestParsed(Collection, "/api/collection", {
|
|
489
532
|
...options,
|
|
490
533
|
method: "POST",
|
|
@@ -493,6 +536,7 @@ function collectionResource(transport) {
|
|
|
493
536
|
}
|
|
494
537
|
/** Update a collection, patching only the fields the body carries. */
|
|
495
538
|
async function update(ref, params, options = {}) {
|
|
539
|
+
await transport.require("collection.update", options);
|
|
496
540
|
return transport.requestParsed(Collection, `/api/collection/${refPath(ref)}`, {
|
|
497
541
|
...options,
|
|
498
542
|
method: "PUT",
|
|
@@ -501,14 +545,16 @@ function collectionResource(transport) {
|
|
|
501
545
|
}
|
|
502
546
|
/** Archive (soft-delete) a collection. Metabase models this as an update, not its own endpoint. */
|
|
503
547
|
async function archive(ref, options = {}) {
|
|
548
|
+
await transport.require("collection.archive", options);
|
|
504
549
|
return update(ref, { archived: true }, options);
|
|
505
550
|
}
|
|
506
551
|
/**
|
|
507
552
|
* Walk the items inside a collection one page at a time. This endpoint pages on the server, so
|
|
508
553
|
* the caller consumes pages rather than a single list and decides how far to pull.
|
|
509
554
|
*/
|
|
510
|
-
function itemPages(ref, params = {}, options = {}) {
|
|
511
|
-
|
|
555
|
+
async function* itemPages(ref, params = {}, options = {}) {
|
|
556
|
+
await transport.require("collection.itemPages", options);
|
|
557
|
+
yield* paginatePages(transport, `/api/collection/${refPath(ref)}/items`, CollectionItem, {
|
|
512
558
|
query: {
|
|
513
559
|
models: params.models,
|
|
514
560
|
archived: params.archived,
|
|
@@ -522,6 +568,7 @@ function collectionResource(transport) {
|
|
|
522
568
|
}
|
|
523
569
|
/** Fetch the collection hierarchy as a forest of nested nodes. */
|
|
524
570
|
async function tree(options = {}) {
|
|
571
|
+
await transport.require("collection.tree", options);
|
|
525
572
|
return {
|
|
526
573
|
data: await transport.requestParsed(CollectionTreeApiList, "/api/collection/tree", { ...options }),
|
|
527
574
|
total: null
|
|
@@ -539,6 +586,38 @@ function collectionResource(transport) {
|
|
|
539
586
|
};
|
|
540
587
|
}
|
|
541
588
|
//#endregion
|
|
589
|
+
//#region ../client/src/resources/csv-upload.ts
|
|
590
|
+
const CSV_CONTENT_TYPE = "text/csv";
|
|
591
|
+
function buildCsvFormData(file) {
|
|
592
|
+
const form = new FormData();
|
|
593
|
+
form.append("file", new Blob([file.bytes], { type: CSV_CONTENT_TYPE }), file.filename);
|
|
594
|
+
return form;
|
|
595
|
+
}
|
|
596
|
+
//#endregion
|
|
597
|
+
//#region ../client/src/resources/content-translation.ts
|
|
598
|
+
const CONTENT_TRANSLATION_PATH = "/api/ee/content-translation";
|
|
599
|
+
function contentTranslationResource(transport) {
|
|
600
|
+
/** Download the complete content translation dictionary as CSV. */
|
|
601
|
+
async function download(options = {}) {
|
|
602
|
+
await transport.require("contentTranslation.download", options);
|
|
603
|
+
return transport.requestStream(`${CONTENT_TRANSLATION_PATH}/csv`, options);
|
|
604
|
+
}
|
|
605
|
+
/** Replace the complete content translation dictionary with the attached CSV. */
|
|
606
|
+
async function upload(file, options = {}) {
|
|
607
|
+
await transport.require("contentTranslation.upload", options);
|
|
608
|
+
const form = buildCsvFormData(file);
|
|
609
|
+
return transport.requestParsed(ContentTranslationUploadResult, `${CONTENT_TRANSLATION_PATH}/upload-dictionary`, {
|
|
610
|
+
...options,
|
|
611
|
+
method: "POST",
|
|
612
|
+
body: form
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
return {
|
|
616
|
+
download,
|
|
617
|
+
upload
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
//#endregion
|
|
542
621
|
//#region ../client/src/resources/dashboard.ts
|
|
543
622
|
const DashboardApiList = z.array(Dashboard);
|
|
544
623
|
const PreflightDashcard = z.looseObject({ card_id: z.number().int().nullable().optional() });
|
|
@@ -546,6 +625,7 @@ function dashboardResource(transport) {
|
|
|
546
625
|
const card = cardResource(transport);
|
|
547
626
|
/** List dashboards. `f` picks a server-side preset. */
|
|
548
627
|
async function list(params = {}, options = {}) {
|
|
628
|
+
await transport.require("dashboard.list", options);
|
|
549
629
|
return {
|
|
550
630
|
data: await transport.requestParsed(DashboardApiList, "/api/dashboard", {
|
|
551
631
|
...options,
|
|
@@ -556,6 +636,7 @@ function dashboardResource(transport) {
|
|
|
556
636
|
}
|
|
557
637
|
/** Get one dashboard by id, with its dashcards, tabs and parameters. */
|
|
558
638
|
async function get(id, options = {}) {
|
|
639
|
+
await transport.require("dashboard.get", options);
|
|
559
640
|
return transport.requestParsed(DashboardDetail, `/api/dashboard/${id}`, { ...options });
|
|
560
641
|
}
|
|
561
642
|
/**
|
|
@@ -563,6 +644,7 @@ function dashboardResource(transport) {
|
|
|
563
644
|
* puts content on a fresh dashboard.
|
|
564
645
|
*/
|
|
565
646
|
async function create(params, options = {}) {
|
|
647
|
+
await transport.require("dashboard.create", options);
|
|
566
648
|
return transport.requestParsed(Dashboard, "/api/dashboard", {
|
|
567
649
|
...options,
|
|
568
650
|
method: "POST",
|
|
@@ -574,6 +656,7 @@ function dashboardResource(transport) {
|
|
|
574
656
|
* full replacements: whatever the body omits is deleted from the dashboard.
|
|
575
657
|
*/
|
|
576
658
|
async function update(id, params, options = {}) {
|
|
659
|
+
await transport.require("dashboard.update", options);
|
|
577
660
|
return transport.requestParsed(DashboardDetail, `/api/dashboard/${id}`, {
|
|
578
661
|
...options,
|
|
579
662
|
method: "PUT",
|
|
@@ -586,6 +669,7 @@ function dashboardResource(transport) {
|
|
|
586
669
|
* an archive is a state change on the dashboard itself, and its dashcards are not part of it.
|
|
587
670
|
*/
|
|
588
671
|
async function archive(id, options = {}) {
|
|
672
|
+
await transport.require("dashboard.archive", options);
|
|
589
673
|
return transport.requestParsed(Dashboard, `/api/dashboard/${id}`, {
|
|
590
674
|
...options,
|
|
591
675
|
method: "PUT",
|
|
@@ -598,6 +682,7 @@ function dashboardResource(transport) {
|
|
|
598
682
|
* currently stands.
|
|
599
683
|
*/
|
|
600
684
|
async function updateDashcard(dashboardId, dashcardId, params, options = {}) {
|
|
685
|
+
await transport.require("dashboard.updateDashcard", options);
|
|
601
686
|
const dashboard = await get(dashboardId, options);
|
|
602
687
|
const target = dashboard.dashcards.find((dashcard) => dashcard.id === dashcardId);
|
|
603
688
|
if (target === void 0) throw new ConfigError(`dashcard ${dashcardId} not found on dashboard ${dashboardId}`);
|
|
@@ -616,6 +701,7 @@ function dashboardResource(transport) {
|
|
|
616
701
|
* any other way propagates as the failure it was.
|
|
617
702
|
*/
|
|
618
703
|
async function checkCardReferences(dashcards, options = {}) {
|
|
704
|
+
await transport.require("dashboard.checkCardReferences", options);
|
|
619
705
|
const grouped = groupByCardId(collectCardReferences(dashcards));
|
|
620
706
|
return (await Promise.all(Array.from(grouped.entries()).map(async ([cardId, references]) => ({
|
|
621
707
|
references,
|
|
@@ -646,6 +732,7 @@ function dashboardResource(transport) {
|
|
|
646
732
|
* Fetch the selectable values for a dashboard parameter, through the chain-filter value endpoint.
|
|
647
733
|
*/
|
|
648
734
|
async function parameterValues(dashboardId, parameterId, options = {}) {
|
|
735
|
+
await transport.require("dashboard.parameterValues", options);
|
|
649
736
|
return transport.requestParsed(ParameterValues, `/api/dashboard/${dashboardId}/params/${encodeURIComponent(parameterId)}/values`, { ...options });
|
|
650
737
|
}
|
|
651
738
|
/**
|
|
@@ -653,6 +740,7 @@ function dashboardResource(transport) {
|
|
|
653
740
|
* substring, capped at the first 1000 matches.
|
|
654
741
|
*/
|
|
655
742
|
async function searchParameterValues(dashboardId, parameterId, query, options = {}) {
|
|
743
|
+
await transport.require("dashboard.searchParameterValues", options);
|
|
656
744
|
const parameter = encodeURIComponent(parameterId);
|
|
657
745
|
return transport.requestParsed(ParameterValues, `/api/dashboard/${dashboardId}/params/${parameter}/search/${encodeURIComponent(query)}`, { ...options });
|
|
658
746
|
}
|
|
@@ -715,6 +803,7 @@ const SYNC_COMPLETE = "complete";
|
|
|
715
803
|
function databaseResource(transport) {
|
|
716
804
|
/** List databases. `include` hydrates each database's tables; `saved` adds the Saved Questions virtual database. */
|
|
717
805
|
async function list(params = {}, options = {}) {
|
|
806
|
+
await transport.require("database.list", options);
|
|
718
807
|
const response = await transport.requestParsed(DatabaseApiList, "/api/database", {
|
|
719
808
|
...options,
|
|
720
809
|
query: {
|
|
@@ -729,6 +818,7 @@ function databaseResource(transport) {
|
|
|
729
818
|
}
|
|
730
819
|
/** Get one database by id. `include` hydrates its tables, and `tables.fields` their fields too. */
|
|
731
820
|
async function get(id, params = {}, options = {}) {
|
|
821
|
+
await transport.require("database.get", options);
|
|
732
822
|
return transport.requestParsed(Database, `/api/database/${id}`, {
|
|
733
823
|
...options,
|
|
734
824
|
query: { include: params.include }
|
|
@@ -736,6 +826,7 @@ function databaseResource(transport) {
|
|
|
736
826
|
}
|
|
737
827
|
/** List the schema names in a database. */
|
|
738
828
|
async function schemas(id, options = {}) {
|
|
829
|
+
await transport.require("database.schemas", options);
|
|
739
830
|
return {
|
|
740
831
|
data: await transport.requestParsed(DatabaseApiSchemaList, `/api/database/${id}/schemas`, { ...options }),
|
|
741
832
|
total: null
|
|
@@ -743,6 +834,7 @@ function databaseResource(transport) {
|
|
|
743
834
|
}
|
|
744
835
|
/** List the tables one schema of a database holds. */
|
|
745
836
|
async function schemaTables(id, schema, options = {}) {
|
|
837
|
+
await transport.require("database.schemaTables", options);
|
|
746
838
|
return {
|
|
747
839
|
data: await transport.requestParsed(DatabaseApiSchemaTableList, `/api/database/${id}/schema/${encodeURIComponent(schema)}`, { ...options }),
|
|
748
840
|
total: null
|
|
@@ -753,6 +845,7 @@ function databaseResource(transport) {
|
|
|
753
845
|
* pass `wait` to poll the database until it reports its initial sync complete.
|
|
754
846
|
*/
|
|
755
847
|
async function syncSchema(id, params = {}, options = {}) {
|
|
848
|
+
await transport.require("database.syncSchema", options);
|
|
756
849
|
const ack = await transport.requestParsed(DatabaseTaskAck, `/api/database/${id}/sync_schema`, {
|
|
757
850
|
...options,
|
|
758
851
|
method: "POST"
|
|
@@ -774,6 +867,7 @@ function databaseResource(transport) {
|
|
|
774
867
|
}
|
|
775
868
|
/** Trigger a rescan of the cached field values across a database. */
|
|
776
869
|
async function rescanValues(id, options = {}) {
|
|
870
|
+
await transport.require("database.rescanValues", options);
|
|
777
871
|
return {
|
|
778
872
|
id,
|
|
779
873
|
status: (await transport.requestParsed(DatabaseTaskAck, `/api/database/${id}/rescan_values`, {
|
|
@@ -799,6 +893,7 @@ function datasetResource(transport) {
|
|
|
799
893
|
* MBQL, or native — rather than a reference to a saved one, so nothing here is a card.
|
|
800
894
|
*/
|
|
801
895
|
async function query(body, options = {}) {
|
|
896
|
+
await transport.require("dataset.query", options);
|
|
802
897
|
return transport.requestParsed(CardQueryResult, "/api/dataset", {
|
|
803
898
|
...options,
|
|
804
899
|
method: "POST",
|
|
@@ -813,6 +908,7 @@ const DocumentApiList = z.object({ items: z.array(Document) }).loose();
|
|
|
813
908
|
function documentResource(transport) {
|
|
814
909
|
/** Get existing documents. */
|
|
815
910
|
async function list(options = {}) {
|
|
911
|
+
await transport.require("document.list", options);
|
|
816
912
|
return {
|
|
817
913
|
data: (await transport.requestParsed(DocumentApiList, "/api/document", { ...options })).items,
|
|
818
914
|
total: null
|
|
@@ -820,10 +916,12 @@ function documentResource(transport) {
|
|
|
820
916
|
}
|
|
821
917
|
/** Return an existing document by id. */
|
|
822
918
|
async function get(id, options = {}) {
|
|
919
|
+
await transport.require("document.get", options);
|
|
823
920
|
return transport.requestParsed(Document, `/api/document/${id}`, { ...options });
|
|
824
921
|
}
|
|
825
922
|
/** Create a new document. */
|
|
826
923
|
async function create(params, options = {}) {
|
|
924
|
+
await transport.require("document.create", options);
|
|
827
925
|
return transport.requestParsed(Document, "/api/document", {
|
|
828
926
|
...options,
|
|
829
927
|
method: "POST",
|
|
@@ -832,6 +930,7 @@ function documentResource(transport) {
|
|
|
832
930
|
}
|
|
833
931
|
/** Update an existing document by id. */
|
|
834
932
|
async function update(id, params, options = {}) {
|
|
933
|
+
await transport.require("document.update", options);
|
|
835
934
|
return transport.requestParsed(Document, `/api/document/${id}`, {
|
|
836
935
|
...options,
|
|
837
936
|
method: "PUT",
|
|
@@ -840,6 +939,7 @@ function documentResource(transport) {
|
|
|
840
939
|
}
|
|
841
940
|
/** Archive (soft-delete) a document by id. Metabase models this as an update, not its own endpoint. */
|
|
842
941
|
async function archive(id, options = {}) {
|
|
942
|
+
await transport.require("document.archive", options);
|
|
843
943
|
return update(id, { archived: true }, options);
|
|
844
944
|
}
|
|
845
945
|
return {
|
|
@@ -859,6 +959,7 @@ function eidTranslationResource(transport) {
|
|
|
859
959
|
* lookup succeeded — the numeric id.
|
|
860
960
|
*/
|
|
861
961
|
async function translate(params, options = {}) {
|
|
962
|
+
await transport.require("eidTranslation.translate", options);
|
|
862
963
|
return transport.requestParsed(EidTranslateResult, "/api/eid-translation/translate", {
|
|
863
964
|
...options,
|
|
864
965
|
method: "POST",
|
|
@@ -873,10 +974,12 @@ const FieldApiSummary = z.tuple([z.tuple([z.literal("count"), z.number().int()])
|
|
|
873
974
|
function fieldResource(transport) {
|
|
874
975
|
/** Get one field by id. */
|
|
875
976
|
async function get(id, options = {}) {
|
|
977
|
+
await transport.require("field.get", options);
|
|
876
978
|
return transport.requestParsed(Field, `/api/field/${id}`, { ...options });
|
|
877
979
|
}
|
|
878
980
|
/** Update a field by id, patching only the fields the body carries. */
|
|
879
981
|
async function update(id, params, options = {}) {
|
|
982
|
+
await transport.require("field.update", options);
|
|
880
983
|
return transport.requestParsed(Field, `/api/field/${id}`, {
|
|
881
984
|
...options,
|
|
882
985
|
method: "PUT",
|
|
@@ -885,6 +988,7 @@ function fieldResource(transport) {
|
|
|
885
988
|
}
|
|
886
989
|
/** Get the row count and the distinct-value count for a field. */
|
|
887
990
|
async function summary(id, options = {}) {
|
|
991
|
+
await transport.require("field.summary", options);
|
|
888
992
|
const [[, count], [, distincts]] = await transport.requestParsed(FieldApiSummary, `/api/field/${id}/summary`, { ...options });
|
|
889
993
|
return {
|
|
890
994
|
field_id: id,
|
|
@@ -894,6 +998,7 @@ function fieldResource(transport) {
|
|
|
894
998
|
}
|
|
895
999
|
/** Get the cached distinct values Metabase holds for a field. */
|
|
896
1000
|
async function values(id, options = {}) {
|
|
1001
|
+
await transport.require("field.values", options);
|
|
897
1002
|
return transport.requestParsed(FieldValues, `/api/field/${id}/values`, { ...options });
|
|
898
1003
|
}
|
|
899
1004
|
return {
|
|
@@ -949,10 +1054,12 @@ function isRemoteUnreadable(error) {
|
|
|
949
1054
|
function gitSyncResource(transport) {
|
|
950
1055
|
/** Get the running or most recently finished sync task, or null when the server has none. */
|
|
951
1056
|
async function currentTask(options = {}) {
|
|
1057
|
+
await transport.require("gitSync.currentTask", options);
|
|
952
1058
|
return fetchOptionalParsed(transport, "/api/ee/remote-sync/current-task", SyncTask, options);
|
|
953
1059
|
}
|
|
954
1060
|
/** Request cancellation of the running sync task, and answer it in the state that left it. */
|
|
955
1061
|
async function cancelTask(options = {}) {
|
|
1062
|
+
await transport.require("gitSync.cancelTask", options);
|
|
956
1063
|
return transport.requestParsed(SyncTask, "/api/ee/remote-sync/current-task/cancel", {
|
|
957
1064
|
...options,
|
|
958
1065
|
method: "POST"
|
|
@@ -960,10 +1067,12 @@ function gitSyncResource(transport) {
|
|
|
960
1067
|
}
|
|
961
1068
|
/** Whether Metabase holds content changes the remote has not been told about. */
|
|
962
1069
|
async function isDirty(options = {}) {
|
|
1070
|
+
await transport.require("gitSync.isDirty", options);
|
|
963
1071
|
return (await transport.requestParsed(SyncDirtyFlag, "/api/ee/remote-sync/is-dirty", { ...options })).is_dirty;
|
|
964
1072
|
}
|
|
965
1073
|
/** List the objects whose local state differs from the remote. */
|
|
966
1074
|
async function dirty(options = {}) {
|
|
1075
|
+
await transport.require("gitSync.dirty", options);
|
|
967
1076
|
return {
|
|
968
1077
|
data: (await transport.requestParsed(SyncDirtyList, "/api/ee/remote-sync/dirty", { ...options })).dirty,
|
|
969
1078
|
total: null
|
|
@@ -974,6 +1083,7 @@ function gitSyncResource(transport) {
|
|
|
974
1083
|
* comparison; `force-refresh` re-reads the remote instead.
|
|
975
1084
|
*/
|
|
976
1085
|
async function hasRemoteChanges(params = {}, options = {}) {
|
|
1086
|
+
await transport.require("gitSync.hasRemoteChanges", options);
|
|
977
1087
|
return transport.requestParsed(SyncRemoteChanges, "/api/ee/remote-sync/has-remote-changes", {
|
|
978
1088
|
...options,
|
|
979
1089
|
query: { "force-refresh": params["force-refresh"] }
|
|
@@ -985,6 +1095,7 @@ function gitSyncResource(transport) {
|
|
|
985
1095
|
* answers no task id, and there is then nothing to poll.
|
|
986
1096
|
*/
|
|
987
1097
|
async function importFromRemote(params = {}, options = {}) {
|
|
1098
|
+
await transport.require("gitSync.import", options);
|
|
988
1099
|
const started = await transport.requestParsed(SyncImportStarted, "/api/ee/remote-sync/import", {
|
|
989
1100
|
...options,
|
|
990
1101
|
method: "POST",
|
|
@@ -1009,6 +1120,7 @@ function gitSyncResource(transport) {
|
|
|
1009
1120
|
* `wait` to poll that task until it reaches a terminal status.
|
|
1010
1121
|
*/
|
|
1011
1122
|
async function exportToRemote(params = {}, options = {}) {
|
|
1123
|
+
await transport.require("gitSync.export", options);
|
|
1012
1124
|
const started = await transport.requestParsed(SyncExportStarted, "/api/ee/remote-sync/export", {
|
|
1013
1125
|
...options,
|
|
1014
1126
|
method: "POST",
|
|
@@ -1033,6 +1145,7 @@ function gitSyncResource(transport) {
|
|
|
1033
1145
|
* queues a task and returns at once; pass `wait` to poll that task to a terminal status.
|
|
1034
1146
|
*/
|
|
1035
1147
|
async function stash(params, options = {}) {
|
|
1148
|
+
await transport.require("gitSync.stash", options);
|
|
1036
1149
|
const started = await transport.requestParsed(SyncStashStarted, "/api/ee/remote-sync/stash", {
|
|
1037
1150
|
...options,
|
|
1038
1151
|
method: "POST",
|
|
@@ -1055,6 +1168,7 @@ function gitSyncResource(transport) {
|
|
|
1055
1168
|
}
|
|
1056
1169
|
/** List the branches the configured remote carries. */
|
|
1057
1170
|
async function branches(options = {}) {
|
|
1171
|
+
await transport.require("gitSync.branches", options);
|
|
1058
1172
|
return {
|
|
1059
1173
|
data: (await transport.requestParsed(SyncBranchList, "/api/ee/remote-sync/branches", { ...options })).items,
|
|
1060
1174
|
total: null
|
|
@@ -1062,6 +1176,7 @@ function gitSyncResource(transport) {
|
|
|
1062
1176
|
}
|
|
1063
1177
|
/** Create a branch on the remote and point git-sync at it. */
|
|
1064
1178
|
async function createBranch(params, options = {}) {
|
|
1179
|
+
await transport.require("gitSync.createBranch", options);
|
|
1065
1180
|
return transport.requestParsed(SyncBranchCreated, "/api/ee/remote-sync/create-branch", {
|
|
1066
1181
|
...options,
|
|
1067
1182
|
method: "POST",
|
|
@@ -1073,6 +1188,7 @@ function gitSyncResource(transport) {
|
|
|
1073
1188
|
* by location prefix, and may queue an export task to carry the change to the remote.
|
|
1074
1189
|
*/
|
|
1075
1190
|
async function setCollectionSynced(collectionId, synced, options = {}) {
|
|
1191
|
+
await transport.require("gitSync.setCollectionSynced", options);
|
|
1076
1192
|
return transport.requestParsed(SyncSettingsUpdateResult, "/api/ee/remote-sync/settings", {
|
|
1077
1193
|
...options,
|
|
1078
1194
|
method: "PUT",
|
|
@@ -1081,6 +1197,7 @@ function gitSyncResource(transport) {
|
|
|
1081
1197
|
}
|
|
1082
1198
|
/** The collections currently in git-sync's scope. */
|
|
1083
1199
|
async function syncedCollections(options = {}) {
|
|
1200
|
+
await transport.require("gitSync.syncedCollections", options);
|
|
1084
1201
|
return {
|
|
1085
1202
|
data: (await listCollectionsWithLibrary(transport, SyncScopeCollection, options)).filter((entry) => entry.is_remote_synced === true),
|
|
1086
1203
|
total: null
|
|
@@ -1088,6 +1205,7 @@ function gitSyncResource(transport) {
|
|
|
1088
1205
|
}
|
|
1089
1206
|
/** The remote's URL, or null when none is configured or the caller may not read it. */
|
|
1090
1207
|
async function remoteUrl(options = {}) {
|
|
1208
|
+
await transport.require("gitSync.remoteUrl", options);
|
|
1091
1209
|
try {
|
|
1092
1210
|
const url = await fetchOptionalParsed(transport, "/api/setting/remote-sync-url", RemoteSyncSetting, options);
|
|
1093
1211
|
return url === "" ? null : url;
|
|
@@ -1098,6 +1216,7 @@ function gitSyncResource(transport) {
|
|
|
1098
1216
|
}
|
|
1099
1217
|
/** The branch git-sync tracks, or null when none is configured or the caller may not read it. */
|
|
1100
1218
|
async function branch(options = {}) {
|
|
1219
|
+
await transport.require("gitSync.branch", options);
|
|
1101
1220
|
return fetchOptionalParsed(transport, "/api/setting/remote-sync-branch", RemoteSyncSetting, options);
|
|
1102
1221
|
}
|
|
1103
1222
|
/**
|
|
@@ -1105,6 +1224,7 @@ function gitSyncResource(transport) {
|
|
|
1105
1224
|
* answers null, which is terminal in the same sense: nothing further will happen.
|
|
1106
1225
|
*/
|
|
1107
1226
|
async function waitForTask(wait, options = {}) {
|
|
1227
|
+
await transport.require("gitSync.waitForTask", options);
|
|
1108
1228
|
return settle(wait, options);
|
|
1109
1229
|
}
|
|
1110
1230
|
async function settle(wait, options) {
|
|
@@ -1137,36 +1257,17 @@ const LIBRARY_ROOT_PATH = "/api/ee/library/";
|
|
|
1137
1257
|
const PUBLISH_TABLES_PATH = "/api/ee/data-studio/table/publish-tables";
|
|
1138
1258
|
const UNPUBLISH_TABLES_PATH = "/api/ee/data-studio/table/unpublish-tables";
|
|
1139
1259
|
const LIBRARY_DATA_TYPE = "library-data";
|
|
1140
|
-
const AbsentLibrary = z.object({ data: z.null() });
|
|
1141
|
-
const LibraryOrAbsent = z.union([Library, AbsentLibrary]);
|
|
1142
1260
|
const PublishTablesResponse = z.object({ target_collection: Collection.nullable() });
|
|
1143
|
-
const LibraryCollectionInfo = Collection.pick({
|
|
1144
|
-
id: true,
|
|
1145
|
-
type: true,
|
|
1146
|
-
is_remote_synced: true
|
|
1147
|
-
}).strip();
|
|
1148
1261
|
function libraryResource(transport) {
|
|
1149
1262
|
/** Get the Library root and its child collections, or `null` on an instance that has none. */
|
|
1150
1263
|
async function get(options = {}) {
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
const
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
const info = infoById.get(child.id);
|
|
1157
|
-
if (info === void 0) return child;
|
|
1158
|
-
return {
|
|
1159
|
-
...child,
|
|
1160
|
-
type: info.type ?? child.type,
|
|
1161
|
-
is_remote_synced: info.is_remote_synced ?? child.is_remote_synced
|
|
1162
|
-
};
|
|
1163
|
-
});
|
|
1164
|
-
return {
|
|
1165
|
-
...result,
|
|
1166
|
-
effective_children
|
|
1167
|
-
};
|
|
1264
|
+
await transport.require("library.get", options);
|
|
1265
|
+
const { features } = await transport.server(options);
|
|
1266
|
+
const wire = await transport.requestParsed(libraryWireSchema(features), LIBRARY_ROOT_PATH, { ...options });
|
|
1267
|
+
if (wire === null) return null;
|
|
1268
|
+
return toLibrary(wire, await libraryListing(options));
|
|
1168
1269
|
}
|
|
1169
|
-
async function
|
|
1270
|
+
async function libraryListing(options) {
|
|
1170
1271
|
const data = await listCollectionsWithLibrary(transport, LibraryCollectionInfo, options);
|
|
1171
1272
|
const byId = /* @__PURE__ */ new Map();
|
|
1172
1273
|
for (const collection of data) if (typeof collection.id === "number") byId.set(collection.id, collection);
|
|
@@ -1179,6 +1280,7 @@ function libraryResource(transport) {
|
|
|
1179
1280
|
* back from a refetch, which together make this idempotent.
|
|
1180
1281
|
*/
|
|
1181
1282
|
async function create(options = {}) {
|
|
1283
|
+
await transport.require("library.create", options);
|
|
1182
1284
|
const existing = await get(options);
|
|
1183
1285
|
if (existing !== null) return existing;
|
|
1184
1286
|
await transport.requestRaw(LIBRARY_ROOT_PATH, {
|
|
@@ -1191,6 +1293,7 @@ function libraryResource(transport) {
|
|
|
1191
1293
|
}
|
|
1192
1294
|
/** The id of the Library's Data collection, creating the Library first when it does not exist. */
|
|
1193
1295
|
async function ensureDataCollectionId(options = {}) {
|
|
1296
|
+
await transport.require("library.ensureDataCollectionId", options);
|
|
1194
1297
|
const data = (await create(options)).effective_children.find((child) => child.type === LIBRARY_DATA_TYPE);
|
|
1195
1298
|
if (data === void 0) throw new Error("Library has no Data collection to publish into");
|
|
1196
1299
|
if (typeof data.id !== "number") throw new Error(`Library Data collection has a non-numeric id ${String(data.id)}`);
|
|
@@ -1201,6 +1304,7 @@ function libraryResource(transport) {
|
|
|
1201
1304
|
* data pickers and rank up in search. Answers the collection they landed in.
|
|
1202
1305
|
*/
|
|
1203
1306
|
async function publishTables(params, options = {}) {
|
|
1307
|
+
await transport.require("library.publishTables", options);
|
|
1204
1308
|
return (await transport.requestParsed(PublishTablesResponse, PUBLISH_TABLES_PATH, {
|
|
1205
1309
|
...options,
|
|
1206
1310
|
method: "POST",
|
|
@@ -1212,6 +1316,7 @@ function libraryResource(transport) {
|
|
|
1212
1316
|
* depends on them. The endpoint answers no JSON body.
|
|
1213
1317
|
*/
|
|
1214
1318
|
async function unpublishTables(params, options = {}) {
|
|
1319
|
+
await transport.require("library.unpublishTables", options);
|
|
1215
1320
|
await transport.requestRaw(UNPUBLISH_TABLES_PATH, {
|
|
1216
1321
|
...options,
|
|
1217
1322
|
method: "POST",
|
|
@@ -1233,6 +1338,7 @@ const MeasureApiList = z.array(Measure);
|
|
|
1233
1338
|
function measureResource(transport) {
|
|
1234
1339
|
/** List measures. */
|
|
1235
1340
|
async function list(options = {}) {
|
|
1341
|
+
await transport.require("measure.list", options);
|
|
1236
1342
|
return {
|
|
1237
1343
|
data: await transport.requestParsed(MeasureApiList, "/api/measure", { ...options }),
|
|
1238
1344
|
total: null
|
|
@@ -1240,10 +1346,12 @@ function measureResource(transport) {
|
|
|
1240
1346
|
}
|
|
1241
1347
|
/** Get one measure by id. */
|
|
1242
1348
|
async function get(id, options = {}) {
|
|
1349
|
+
await transport.require("measure.get", options);
|
|
1243
1350
|
return transport.requestParsed(Measure, `/api/measure/${id}`, { ...options });
|
|
1244
1351
|
}
|
|
1245
1352
|
/** Create a measure — a saved aggregation tied to a table — from a full measure body. */
|
|
1246
1353
|
async function create(params, options = {}) {
|
|
1354
|
+
await transport.require("measure.create", options);
|
|
1247
1355
|
return transport.requestParsed(Measure, "/api/measure", {
|
|
1248
1356
|
...options,
|
|
1249
1357
|
method: "POST",
|
|
@@ -1255,6 +1363,7 @@ function measureResource(transport) {
|
|
|
1255
1363
|
* required and lands in the audit log.
|
|
1256
1364
|
*/
|
|
1257
1365
|
async function update(id, params, options = {}) {
|
|
1366
|
+
await transport.require("measure.update", options);
|
|
1258
1367
|
return transport.requestParsed(Measure, `/api/measure/${id}`, {
|
|
1259
1368
|
...options,
|
|
1260
1369
|
method: "PUT",
|
|
@@ -1266,6 +1375,7 @@ function measureResource(transport) {
|
|
|
1266
1375
|
* so it carries the same required `revision_message`.
|
|
1267
1376
|
*/
|
|
1268
1377
|
async function archive(id, params, options = {}) {
|
|
1378
|
+
await transport.require("measure.archive", options);
|
|
1269
1379
|
return update(id, {
|
|
1270
1380
|
archived: true,
|
|
1271
1381
|
revision_message: params.revision_message
|
|
@@ -1308,6 +1418,7 @@ function notificationResource(transport) {
|
|
|
1308
1418
|
* the request pins the card payload type.
|
|
1309
1419
|
*/
|
|
1310
1420
|
async function list(params = {}, options = {}) {
|
|
1421
|
+
await transport.require("notification.list", options);
|
|
1311
1422
|
return {
|
|
1312
1423
|
data: await transport.requestParsed(NotificationApiList, "/api/notification", {
|
|
1313
1424
|
...options,
|
|
@@ -1324,10 +1435,12 @@ function notificationResource(transport) {
|
|
|
1324
1435
|
}
|
|
1325
1436
|
/** Get one question alert by id, refusing an id that names a system-event notification. */
|
|
1326
1437
|
async function get(id, options = {}) {
|
|
1438
|
+
await transport.require("notification.get", options);
|
|
1327
1439
|
return assertCardAlert(await transport.requestParsed(Notification, `/api/notification/${id}`, { ...options }));
|
|
1328
1440
|
}
|
|
1329
1441
|
/** Create a question alert — its card payload, schedules and handlers — from a full body. */
|
|
1330
1442
|
async function create(params, options = {}) {
|
|
1443
|
+
await transport.require("notification.create", options);
|
|
1331
1444
|
return transport.requestParsed(Notification, "/api/notification", {
|
|
1332
1445
|
...options,
|
|
1333
1446
|
method: "POST",
|
|
@@ -1336,6 +1449,7 @@ function notificationResource(transport) {
|
|
|
1336
1449
|
}
|
|
1337
1450
|
/** Update a question alert by id, merging the patch over the stored notification. */
|
|
1338
1451
|
async function update(id, params, options = {}) {
|
|
1452
|
+
await transport.require("notification.update", options);
|
|
1339
1453
|
const current = await get(id, options);
|
|
1340
1454
|
return transport.requestParsed(Notification, `/api/notification/${id}`, {
|
|
1341
1455
|
...options,
|
|
@@ -1345,6 +1459,7 @@ function notificationResource(transport) {
|
|
|
1345
1459
|
}
|
|
1346
1460
|
/** Archive a question alert by id, stopping every delivery. Metabase models this as an update. */
|
|
1347
1461
|
async function archive(id, options = {}) {
|
|
1462
|
+
await transport.require("notification.archive", options);
|
|
1348
1463
|
return update(id, { active: false }, options);
|
|
1349
1464
|
}
|
|
1350
1465
|
/**
|
|
@@ -1352,6 +1467,7 @@ function notificationResource(transport) {
|
|
|
1352
1467
|
* body.
|
|
1353
1468
|
*/
|
|
1354
1469
|
async function send(id, options = {}) {
|
|
1470
|
+
await transport.require("notification.send", options);
|
|
1355
1471
|
await get(id, options);
|
|
1356
1472
|
await transport.requestRaw(`/api/notification/${id}/send`, {
|
|
1357
1473
|
...options,
|
|
@@ -1381,6 +1497,7 @@ function mergePulseUpdate(current, patch) {
|
|
|
1381
1497
|
function pulseResource(transport) {
|
|
1382
1498
|
/** List dashboard subscriptions, optionally narrowed to one dashboard or to the archived ones. */
|
|
1383
1499
|
async function list(params = {}, options = {}) {
|
|
1500
|
+
await transport.require("pulse.list", options);
|
|
1384
1501
|
return {
|
|
1385
1502
|
data: await transport.requestParsed(PulseApiList, "/api/pulse", {
|
|
1386
1503
|
...options,
|
|
@@ -1394,10 +1511,12 @@ function pulseResource(transport) {
|
|
|
1394
1511
|
}
|
|
1395
1512
|
/** Get one dashboard subscription by id. */
|
|
1396
1513
|
async function get(id, options = {}) {
|
|
1514
|
+
await transport.require("pulse.get", options);
|
|
1397
1515
|
return transport.requestParsed(Pulse, `/api/pulse/${id}`, { ...options });
|
|
1398
1516
|
}
|
|
1399
1517
|
/** Create a dashboard subscription — its cards and its delivery channels — from a full body. */
|
|
1400
1518
|
async function create(params, options = {}) {
|
|
1519
|
+
await transport.require("pulse.create", options);
|
|
1401
1520
|
return transport.requestParsed(Pulse, "/api/pulse", {
|
|
1402
1521
|
...options,
|
|
1403
1522
|
method: "POST",
|
|
@@ -1406,6 +1525,7 @@ function pulseResource(transport) {
|
|
|
1406
1525
|
}
|
|
1407
1526
|
/** Update a dashboard subscription by id, carrying the server-defaulted flags forward. */
|
|
1408
1527
|
async function update(id, params, options = {}) {
|
|
1528
|
+
await transport.require("pulse.update", options);
|
|
1409
1529
|
const current = await get(id, options);
|
|
1410
1530
|
return transport.requestParsed(Pulse, `/api/pulse/${id}`, {
|
|
1411
1531
|
...options,
|
|
@@ -1418,6 +1538,7 @@ function pulseResource(transport) {
|
|
|
1418
1538
|
* update, and disables each of the subscription's channels as a side effect.
|
|
1419
1539
|
*/
|
|
1420
1540
|
async function archive(id, options = {}) {
|
|
1541
|
+
await transport.require("pulse.archive", options);
|
|
1421
1542
|
return update(id, { archived: true }, options);
|
|
1422
1543
|
}
|
|
1423
1544
|
return {
|
|
@@ -1442,6 +1563,7 @@ function searchResource(transport) {
|
|
|
1442
1563
|
* server applies before ranking hydration.
|
|
1443
1564
|
*/
|
|
1444
1565
|
async function query(params = {}, options = {}) {
|
|
1566
|
+
await transport.require("search.query", options);
|
|
1445
1567
|
const response = await transport.requestParsed(SearchApiResponse, "/api/search", {
|
|
1446
1568
|
...options,
|
|
1447
1569
|
query: {
|
|
@@ -1467,6 +1589,7 @@ const SegmentApiList = z.array(Segment);
|
|
|
1467
1589
|
function segmentResource(transport) {
|
|
1468
1590
|
/** List every segment the caller can see. */
|
|
1469
1591
|
async function list(options = {}) {
|
|
1592
|
+
await transport.require("segment.list", options);
|
|
1470
1593
|
return {
|
|
1471
1594
|
data: await transport.requestParsed(SegmentApiList, "/api/segment", { ...options }),
|
|
1472
1595
|
total: null
|
|
@@ -1474,10 +1597,12 @@ function segmentResource(transport) {
|
|
|
1474
1597
|
}
|
|
1475
1598
|
/** Get one segment by id. */
|
|
1476
1599
|
async function get(id, options = {}) {
|
|
1600
|
+
await transport.require("segment.get", options);
|
|
1477
1601
|
return transport.requestParsed(Segment, `/api/segment/${id}`, { ...options });
|
|
1478
1602
|
}
|
|
1479
1603
|
/** Create a segment — a reusable row filter over one table — from a full segment body. */
|
|
1480
1604
|
async function create(params, options = {}) {
|
|
1605
|
+
await transport.require("segment.create", options);
|
|
1481
1606
|
return transport.requestParsed(Segment, "/api/segment", {
|
|
1482
1607
|
...options,
|
|
1483
1608
|
method: "POST",
|
|
@@ -1489,6 +1614,7 @@ function segmentResource(transport) {
|
|
|
1489
1614
|
* required: Metabase records every segment change in its revision history.
|
|
1490
1615
|
*/
|
|
1491
1616
|
async function update(id, params, options = {}) {
|
|
1617
|
+
await transport.require("segment.update", options);
|
|
1492
1618
|
return transport.requestParsed(Segment, `/api/segment/${id}`, {
|
|
1493
1619
|
...options,
|
|
1494
1620
|
method: "PUT",
|
|
@@ -1500,6 +1626,7 @@ function segmentResource(transport) {
|
|
|
1500
1626
|
* same required `revision_message`.
|
|
1501
1627
|
*/
|
|
1502
1628
|
async function archive(id, params, options = {}) {
|
|
1629
|
+
await transport.require("segment.archive", options);
|
|
1503
1630
|
return update(id, {
|
|
1504
1631
|
archived: true,
|
|
1505
1632
|
revision_message: params.revision_message
|
|
@@ -1524,6 +1651,7 @@ function rethrowSettingError(error, key) {
|
|
|
1524
1651
|
function settingResource(transport) {
|
|
1525
1652
|
/** Get all settings and their values, with descriptions and environment-variable names. */
|
|
1526
1653
|
async function list(options = {}) {
|
|
1654
|
+
await transport.require("setting.list", options);
|
|
1527
1655
|
return {
|
|
1528
1656
|
data: await transport.requestParsed(SettingApiList, "/api/setting", { ...options }),
|
|
1529
1657
|
total: null
|
|
@@ -1531,13 +1659,15 @@ function settingResource(transport) {
|
|
|
1531
1659
|
}
|
|
1532
1660
|
/**
|
|
1533
1661
|
* Fetch a single setting's value by key. An unset setting answers 204 rather than 404, which
|
|
1534
|
-
* reaches the caller as `null`;
|
|
1662
|
+
* reaches the caller as `null`; a string-typed setting answers bare text rather than JSON.
|
|
1535
1663
|
*/
|
|
1536
1664
|
async function get(key, options = {}) {
|
|
1665
|
+
await transport.require("setting.get", options);
|
|
1537
1666
|
return fetchOptionalParsed(transport, `/api/setting/${encodeURIComponent(key)}`, z.unknown(), options).catch((error) => rethrowSettingError(error, key));
|
|
1538
1667
|
}
|
|
1539
1668
|
/** Set a single setting's value by key. The endpoint answers 204 with no body. */
|
|
1540
1669
|
async function set(key, value, options = {}) {
|
|
1670
|
+
await transport.require("setting.set", options);
|
|
1541
1671
|
await transport.requestRaw(`/api/setting/${encodeURIComponent(key)}`, {
|
|
1542
1672
|
...options,
|
|
1543
1673
|
method: "PUT",
|
|
@@ -1559,6 +1689,7 @@ function setupResource(transport) {
|
|
|
1559
1689
|
* applying the instance preferences. The setup token is single-use.
|
|
1560
1690
|
*/
|
|
1561
1691
|
async function create(params, options = {}) {
|
|
1692
|
+
await transport.require("setup.create", options);
|
|
1562
1693
|
return transport.requestParsed(SetupResult, "/api/setup", {
|
|
1563
1694
|
...options,
|
|
1564
1695
|
method: "POST",
|
|
@@ -1573,6 +1704,7 @@ const SnippetApiList = z.array(Snippet);
|
|
|
1573
1704
|
function snippetResource(transport) {
|
|
1574
1705
|
/** List native query snippets. `archived` swaps the listing to archived snippets. */
|
|
1575
1706
|
async function list(params = {}, options = {}) {
|
|
1707
|
+
await transport.require("snippet.list", options);
|
|
1576
1708
|
return {
|
|
1577
1709
|
data: await transport.requestParsed(SnippetApiList, "/api/native-query-snippet", {
|
|
1578
1710
|
...options,
|
|
@@ -1583,10 +1715,12 @@ function snippetResource(transport) {
|
|
|
1583
1715
|
}
|
|
1584
1716
|
/** Get one native query snippet by id. */
|
|
1585
1717
|
async function get(id, options = {}) {
|
|
1718
|
+
await transport.require("snippet.get", options);
|
|
1586
1719
|
return transport.requestParsed(Snippet, `/api/native-query-snippet/${id}`, { ...options });
|
|
1587
1720
|
}
|
|
1588
1721
|
/** Create a native query snippet from a name, its SQL fragment, and an optional collection. */
|
|
1589
1722
|
async function create(params, options = {}) {
|
|
1723
|
+
await transport.require("snippet.create", options);
|
|
1590
1724
|
return transport.requestParsed(Snippet, "/api/native-query-snippet", {
|
|
1591
1725
|
...options,
|
|
1592
1726
|
method: "POST",
|
|
@@ -1595,6 +1729,7 @@ function snippetResource(transport) {
|
|
|
1595
1729
|
}
|
|
1596
1730
|
/** Update a native query snippet by id, patching only the fields the body carries. */
|
|
1597
1731
|
async function update(id, params, options = {}) {
|
|
1732
|
+
await transport.require("snippet.update", options);
|
|
1598
1733
|
return transport.requestParsed(Snippet, `/api/native-query-snippet/${id}`, {
|
|
1599
1734
|
...options,
|
|
1600
1735
|
method: "PUT",
|
|
@@ -1606,6 +1741,7 @@ function snippetResource(transport) {
|
|
|
1606
1741
|
* own endpoint.
|
|
1607
1742
|
*/
|
|
1608
1743
|
async function archive(id, options = {}) {
|
|
1744
|
+
await transport.require("snippet.archive", options);
|
|
1609
1745
|
return update(id, { archived: true }, options);
|
|
1610
1746
|
}
|
|
1611
1747
|
return {
|
|
@@ -1617,14 +1753,6 @@ function snippetResource(transport) {
|
|
|
1617
1753
|
};
|
|
1618
1754
|
}
|
|
1619
1755
|
//#endregion
|
|
1620
|
-
//#region ../client/src/resources/csv-upload.ts
|
|
1621
|
-
const CSV_CONTENT_TYPE = "text/csv";
|
|
1622
|
-
function buildCsvFormData(file) {
|
|
1623
|
-
const form = new FormData();
|
|
1624
|
-
form.append("file", new Blob([file.bytes], { type: CSV_CONTENT_TYPE }), file.filename);
|
|
1625
|
-
return form;
|
|
1626
|
-
}
|
|
1627
|
-
//#endregion
|
|
1628
1756
|
//#region ../client/src/resources/table.ts
|
|
1629
1757
|
const TableApiList = z.array(Table);
|
|
1630
1758
|
const UPLOAD_UPDATE_PATHS = {
|
|
@@ -1634,6 +1762,7 @@ const UPLOAD_UPDATE_PATHS = {
|
|
|
1634
1762
|
function tableResource(transport) {
|
|
1635
1763
|
/** List every table the caller can see, across all databases. */
|
|
1636
1764
|
async function list(options = {}) {
|
|
1765
|
+
await transport.require("table.list", options);
|
|
1637
1766
|
return {
|
|
1638
1767
|
data: await transport.requestParsed(TableApiList, "/api/table", { ...options }),
|
|
1639
1768
|
total: null
|
|
@@ -1641,10 +1770,12 @@ function tableResource(transport) {
|
|
|
1641
1770
|
}
|
|
1642
1771
|
/** Get one table by id, without its fields. */
|
|
1643
1772
|
async function get(id, options = {}) {
|
|
1773
|
+
await transport.require("table.get", options);
|
|
1644
1774
|
return transport.requestParsed(Table, `/api/table/${id}`, { ...options });
|
|
1645
1775
|
}
|
|
1646
1776
|
/** Update a table by id, patching only the fields the body carries. */
|
|
1647
1777
|
async function update(id, params, options = {}) {
|
|
1778
|
+
await transport.require("table.update", options);
|
|
1648
1779
|
return transport.requestParsed(Table, `/api/table/${id}`, {
|
|
1649
1780
|
...options,
|
|
1650
1781
|
method: "PUT",
|
|
@@ -1653,6 +1784,7 @@ function tableResource(transport) {
|
|
|
1653
1784
|
}
|
|
1654
1785
|
/** Get a table by id with its fields hydrated — the metadata the query builder runs on. */
|
|
1655
1786
|
async function queryMetadata(id, options = {}) {
|
|
1787
|
+
await transport.require("table.queryMetadata", options);
|
|
1656
1788
|
return transport.requestParsed(TableQueryMetadata, `/api/table/${id}/query_metadata`, { ...options });
|
|
1657
1789
|
}
|
|
1658
1790
|
async function updateFromCsv(id, action, file, options) {
|
|
@@ -1674,6 +1806,7 @@ function tableResource(transport) {
|
|
|
1674
1806
|
* The file may be at most 50 MB; larger uploads are rejected with a 413 response.
|
|
1675
1807
|
*/
|
|
1676
1808
|
async function appendCsv(id, file, options = {}) {
|
|
1809
|
+
await transport.require("table.appendCsv", options);
|
|
1677
1810
|
return updateFromCsv(id, "append", file, options);
|
|
1678
1811
|
}
|
|
1679
1812
|
/**
|
|
@@ -1683,6 +1816,7 @@ function tableResource(transport) {
|
|
|
1683
1816
|
* The file may be at most 50 MB; larger uploads are rejected with a 413 response.
|
|
1684
1817
|
*/
|
|
1685
1818
|
async function replaceCsv(id, file, options = {}) {
|
|
1819
|
+
await transport.require("table.replaceCsv", options);
|
|
1686
1820
|
return updateFromCsv(id, "replace", file, options);
|
|
1687
1821
|
}
|
|
1688
1822
|
return {
|
|
@@ -1699,10 +1833,12 @@ function tableResource(transport) {
|
|
|
1699
1833
|
function timelineEventResource(transport) {
|
|
1700
1834
|
/** Get one timeline event by id. */
|
|
1701
1835
|
async function get(id, options = {}) {
|
|
1836
|
+
await transport.require("timelineEvent.get", options);
|
|
1702
1837
|
return transport.requestParsed(TimelineEvent, `/api/timeline-event/${id}`, { ...options });
|
|
1703
1838
|
}
|
|
1704
1839
|
/** Create a timeline event on an existing timeline. */
|
|
1705
1840
|
async function create(params, options = {}) {
|
|
1841
|
+
await transport.require("timelineEvent.create", options);
|
|
1706
1842
|
return transport.requestParsed(TimelineEvent, "/api/timeline-event", {
|
|
1707
1843
|
...options,
|
|
1708
1844
|
method: "POST",
|
|
@@ -1714,6 +1850,7 @@ function timelineEventResource(transport) {
|
|
|
1714
1850
|
* the event to another timeline.
|
|
1715
1851
|
*/
|
|
1716
1852
|
async function update(id, params, options = {}) {
|
|
1853
|
+
await transport.require("timelineEvent.update", options);
|
|
1717
1854
|
return transport.requestParsed(TimelineEvent, `/api/timeline-event/${id}`, {
|
|
1718
1855
|
...options,
|
|
1719
1856
|
method: "PUT",
|
|
@@ -1725,10 +1862,12 @@ function timelineEventResource(transport) {
|
|
|
1725
1862
|
* endpoint.
|
|
1726
1863
|
*/
|
|
1727
1864
|
async function archive(id, options = {}) {
|
|
1865
|
+
await transport.require("timelineEvent.archive", options);
|
|
1728
1866
|
return update(id, { archived: true }, options);
|
|
1729
1867
|
}
|
|
1730
1868
|
/** Permanently delete a timeline event by id. The server answers with no body. */
|
|
1731
1869
|
async function remove(id, options = {}) {
|
|
1870
|
+
await transport.require("timelineEvent.delete", options);
|
|
1732
1871
|
await transport.requestRaw(`/api/timeline-event/${id}`, {
|
|
1733
1872
|
...options,
|
|
1734
1873
|
method: "DELETE",
|
|
@@ -1750,6 +1889,7 @@ const TimelineWithEvents = Timeline.required({ events: true });
|
|
|
1750
1889
|
function timelineResource(transport) {
|
|
1751
1890
|
/** List timelines. `archived` swaps the active listing for the archived one. */
|
|
1752
1891
|
async function list(params = {}, options = {}) {
|
|
1892
|
+
await transport.require("timeline.list", options);
|
|
1753
1893
|
return {
|
|
1754
1894
|
data: await transport.requestParsed(TimelineApiList, "/api/timeline", {
|
|
1755
1895
|
...options,
|
|
@@ -1760,6 +1900,7 @@ function timelineResource(transport) {
|
|
|
1760
1900
|
}
|
|
1761
1901
|
/** Get one timeline by id, without its events. */
|
|
1762
1902
|
async function get(id, options = {}) {
|
|
1903
|
+
await transport.require("timeline.get", options);
|
|
1763
1904
|
return transport.requestParsed(Timeline, `/api/timeline/${id}`, { ...options });
|
|
1764
1905
|
}
|
|
1765
1906
|
/**
|
|
@@ -1767,6 +1908,7 @@ function timelineResource(transport) {
|
|
|
1767
1908
|
* timeline read hydrates them on request, and `archived` chooses which of them come back.
|
|
1768
1909
|
*/
|
|
1769
1910
|
async function events(id, params = {}, options = {}) {
|
|
1911
|
+
await transport.require("timeline.events", options);
|
|
1770
1912
|
return {
|
|
1771
1913
|
data: (await transport.requestParsed(TimelineWithEvents, `/api/timeline/${id}`, {
|
|
1772
1914
|
...options,
|
|
@@ -1780,6 +1922,7 @@ function timelineResource(transport) {
|
|
|
1780
1922
|
}
|
|
1781
1923
|
/** Create a timeline from a full timeline body. */
|
|
1782
1924
|
async function create(params, options = {}) {
|
|
1925
|
+
await transport.require("timeline.create", options);
|
|
1783
1926
|
return transport.requestParsed(Timeline, "/api/timeline", {
|
|
1784
1927
|
...options,
|
|
1785
1928
|
method: "POST",
|
|
@@ -1791,6 +1934,7 @@ function timelineResource(transport) {
|
|
|
1791
1934
|
* cascades to every event on the timeline.
|
|
1792
1935
|
*/
|
|
1793
1936
|
async function update(id, params, options = {}) {
|
|
1937
|
+
await transport.require("timeline.update", options);
|
|
1794
1938
|
return transport.requestParsed(Timeline, `/api/timeline/${id}`, {
|
|
1795
1939
|
...options,
|
|
1796
1940
|
method: "PUT",
|
|
@@ -1802,10 +1946,12 @@ function timelineResource(transport) {
|
|
|
1802
1946
|
* not its own endpoint.
|
|
1803
1947
|
*/
|
|
1804
1948
|
async function archive(id, options = {}) {
|
|
1949
|
+
await transport.require("timeline.archive", options);
|
|
1805
1950
|
return update(id, { archived: true }, options);
|
|
1806
1951
|
}
|
|
1807
1952
|
/** Permanently delete a timeline and all its events by id. The server answers with no body. */
|
|
1808
1953
|
async function remove(id, options = {}) {
|
|
1954
|
+
await transport.require("timeline.delete", options);
|
|
1809
1955
|
await transport.requestRaw(`/api/timeline/${id}`, {
|
|
1810
1956
|
...options,
|
|
1811
1957
|
method: "DELETE",
|
|
@@ -1824,23 +1970,27 @@ function timelineResource(transport) {
|
|
|
1824
1970
|
}
|
|
1825
1971
|
//#endregion
|
|
1826
1972
|
//#region ../client/src/resources/transform-job.ts
|
|
1827
|
-
const TransformJobApiList = z.array(TransformJob);
|
|
1828
|
-
const TransformApiList$1 = z.array(Transform);
|
|
1829
1973
|
function transformJobResource(transport) {
|
|
1830
1974
|
/** List every transform job the caller can see. */
|
|
1831
1975
|
async function list(options = {}) {
|
|
1976
|
+
await transport.require("transformJob.list", options);
|
|
1977
|
+
const { features } = await transport.server(options);
|
|
1832
1978
|
return {
|
|
1833
|
-
data: await transport.requestParsed(
|
|
1979
|
+
data: await transport.requestParsed(z.array(transformJobSchema(features)), "/api/transform-job", { ...options }),
|
|
1834
1980
|
total: null
|
|
1835
1981
|
};
|
|
1836
1982
|
}
|
|
1837
1983
|
/** Get one transform job by id. */
|
|
1838
1984
|
async function get(id, options = {}) {
|
|
1839
|
-
|
|
1985
|
+
await transport.require("transformJob.get", options);
|
|
1986
|
+
const { features } = await transport.server(options);
|
|
1987
|
+
return transport.requestParsed(transformJobSchema(features), `/api/transform-job/${id}`, { ...options });
|
|
1840
1988
|
}
|
|
1841
1989
|
/** Create a transform job — a schedule plus the tags it runs — from a full body. */
|
|
1842
1990
|
async function create(params, options = {}) {
|
|
1843
|
-
|
|
1991
|
+
await transport.require("transformJob.create", options);
|
|
1992
|
+
const { features } = await transport.server(options);
|
|
1993
|
+
return transport.requestParsed(transformJobSchema(features), "/api/transform-job", {
|
|
1844
1994
|
...options,
|
|
1845
1995
|
method: "POST",
|
|
1846
1996
|
body: params
|
|
@@ -1848,7 +1998,9 @@ function transformJobResource(transport) {
|
|
|
1848
1998
|
}
|
|
1849
1999
|
/** Update a transform job by id, patching only the fields the body carries. */
|
|
1850
2000
|
async function update(id, params, options = {}) {
|
|
1851
|
-
|
|
2001
|
+
await transport.require("transformJob.update", options);
|
|
2002
|
+
const { features } = await transport.server(options);
|
|
2003
|
+
return transport.requestParsed(transformJobSchema(features), `/api/transform-job/${id}`, {
|
|
1852
2004
|
...options,
|
|
1853
2005
|
method: "PUT",
|
|
1854
2006
|
body: params
|
|
@@ -1856,6 +2008,7 @@ function transformJobResource(transport) {
|
|
|
1856
2008
|
}
|
|
1857
2009
|
/** Delete a transform job by id, leaving the transforms it ran untouched. */
|
|
1858
2010
|
async function remove(id, options = {}) {
|
|
2011
|
+
await transport.require("transformJob.delete", options);
|
|
1859
2012
|
await transport.requestRaw(`/api/transform-job/${id}`, {
|
|
1860
2013
|
...options,
|
|
1861
2014
|
method: "DELETE",
|
|
@@ -1867,7 +2020,9 @@ function transformJobResource(transport) {
|
|
|
1867
2020
|
* plus those transforms' dependencies; `run_all` re-runs dependencies that are already fresh.
|
|
1868
2021
|
*/
|
|
1869
2022
|
async function run(id, params = {}, options = {}) {
|
|
1870
|
-
|
|
2023
|
+
await transport.require("transformJob.run", options);
|
|
2024
|
+
const { features } = await transport.server(options);
|
|
2025
|
+
return transport.requestParsed(transformJobRunResultSchema(features), `/api/transform-job/${id}/run`, {
|
|
1871
2026
|
...options,
|
|
1872
2027
|
method: "POST",
|
|
1873
2028
|
body: { run_all: params.run_all }
|
|
@@ -1875,8 +2030,10 @@ function transformJobResource(transport) {
|
|
|
1875
2030
|
}
|
|
1876
2031
|
/** List the transforms a job would execute, resolved from the job's tags. */
|
|
1877
2032
|
async function transforms(id, options = {}) {
|
|
2033
|
+
await transport.require("transformJob.transforms", options);
|
|
2034
|
+
const { features } = await transport.server(options);
|
|
1878
2035
|
return {
|
|
1879
|
-
data: await transport.requestParsed(
|
|
2036
|
+
data: await transport.requestParsed(z.array(transformRowSchema(features)), `/api/transform-job/${id}/transforms`, { ...options }),
|
|
1880
2037
|
total: null
|
|
1881
2038
|
};
|
|
1882
2039
|
}
|
|
@@ -1885,6 +2042,7 @@ function transformJobResource(transport) {
|
|
|
1885
2042
|
* manual runs ignore the flag. The path carries no id and is a different endpoint from `update`.
|
|
1886
2043
|
*/
|
|
1887
2044
|
async function setActive(active, options = {}) {
|
|
2045
|
+
await transport.require("transformJob.setActive", options);
|
|
1888
2046
|
return transport.requestParsed(TransformJobActiveResult, "/api/transform-job/active", {
|
|
1889
2047
|
...options,
|
|
1890
2048
|
method: "PUT",
|
|
@@ -1904,26 +2062,40 @@ function transformJobResource(transport) {
|
|
|
1904
2062
|
}
|
|
1905
2063
|
//#endregion
|
|
1906
2064
|
//#region ../client/src/resources/transform.ts
|
|
1907
|
-
|
|
2065
|
+
function transformListSchema(features) {
|
|
2066
|
+
return z.array(transformRowSchema(features));
|
|
2067
|
+
}
|
|
1908
2068
|
const TransformRunKickoff = z.object({
|
|
1909
2069
|
message: z.string(),
|
|
1910
2070
|
run_id: z.number().int().positive().nullable()
|
|
1911
2071
|
});
|
|
1912
2072
|
function transformResource(transport) {
|
|
1913
|
-
|
|
1914
|
-
|
|
2073
|
+
async function requestTransformList(path, opts) {
|
|
2074
|
+
const { features } = await transport.server(opts);
|
|
1915
2075
|
return {
|
|
1916
|
-
data: await transport.requestParsed(
|
|
2076
|
+
data: await transport.requestParsed(transformListSchema(features), path, opts),
|
|
1917
2077
|
total: null
|
|
1918
2078
|
};
|
|
1919
2079
|
}
|
|
2080
|
+
async function requestTransform(path, opts) {
|
|
2081
|
+
const { features } = await transport.server(opts);
|
|
2082
|
+
return transport.requestParsed(transformRowSchema(features), path, opts);
|
|
2083
|
+
}
|
|
2084
|
+
/** List every transform the caller can see. */
|
|
2085
|
+
async function list(options = {}) {
|
|
2086
|
+
await transport.require("transform.list", options);
|
|
2087
|
+
return requestTransformList("/api/transform", { ...options });
|
|
2088
|
+
}
|
|
1920
2089
|
/** Get one transform by id. */
|
|
1921
2090
|
async function get(id, options = {}) {
|
|
1922
|
-
|
|
2091
|
+
await transport.require("transform.get", options);
|
|
2092
|
+
const { features } = await transport.server(options);
|
|
2093
|
+
return transport.requestParsed(transformDetailSchema(features), `/api/transform/${id}`, { ...options });
|
|
1923
2094
|
}
|
|
1924
2095
|
/** Create a transform — a query plus the warehouse table it writes — from a full body. */
|
|
1925
2096
|
async function create(params, options = {}) {
|
|
1926
|
-
|
|
2097
|
+
await transport.require("transform.create", options);
|
|
2098
|
+
return requestTransform("/api/transform", {
|
|
1927
2099
|
...options,
|
|
1928
2100
|
method: "POST",
|
|
1929
2101
|
body: params
|
|
@@ -1931,7 +2103,8 @@ function transformResource(transport) {
|
|
|
1931
2103
|
}
|
|
1932
2104
|
/** Update a transform by id, patching only the fields the body carries. */
|
|
1933
2105
|
async function update(id, params, options = {}) {
|
|
1934
|
-
|
|
2106
|
+
await transport.require("transform.update", options);
|
|
2107
|
+
return requestTransform(`/api/transform/${id}`, {
|
|
1935
2108
|
...options,
|
|
1936
2109
|
method: "PUT",
|
|
1937
2110
|
body: params
|
|
@@ -1939,6 +2112,7 @@ function transformResource(transport) {
|
|
|
1939
2112
|
}
|
|
1940
2113
|
/** Delete a transform by id, leaving any table it already materialized in place. */
|
|
1941
2114
|
async function remove(id, options = {}) {
|
|
2115
|
+
await transport.require("transform.delete", options);
|
|
1942
2116
|
await transport.requestRaw(`/api/transform/${id}`, {
|
|
1943
2117
|
...options,
|
|
1944
2118
|
method: "DELETE",
|
|
@@ -1947,6 +2121,7 @@ function transformResource(transport) {
|
|
|
1947
2121
|
}
|
|
1948
2122
|
/** Drop a transform's materialized output table, keeping the transform definition. */
|
|
1949
2123
|
async function deleteTable(id, options = {}) {
|
|
2124
|
+
await transport.require("transform.deleteTable", options);
|
|
1950
2125
|
await transport.requestRaw(`/api/transform/${id}/table`, {
|
|
1951
2126
|
...options,
|
|
1952
2127
|
method: "DELETE",
|
|
@@ -1955,13 +2130,12 @@ function transformResource(transport) {
|
|
|
1955
2130
|
}
|
|
1956
2131
|
/** List the upstream transforms a transform depends on. */
|
|
1957
2132
|
async function dependencies(id, options = {}) {
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
total: null
|
|
1961
|
-
};
|
|
2133
|
+
await transport.require("transform.dependencies", options);
|
|
2134
|
+
return requestTransformList(`/api/transform/${id}/dependencies`, { ...options });
|
|
1962
2135
|
}
|
|
1963
2136
|
/** Request cancellation of a transform's current run. */
|
|
1964
2137
|
async function cancel(id, options = {}) {
|
|
2138
|
+
await transport.require("transform.cancel", options);
|
|
1965
2139
|
await transport.requestRaw(`/api/transform/${id}/cancel`, {
|
|
1966
2140
|
...options,
|
|
1967
2141
|
method: "POST",
|
|
@@ -1970,11 +2144,13 @@ function transformResource(transport) {
|
|
|
1970
2144
|
}
|
|
1971
2145
|
/** Get one transform run by run id — not by the id of the transform that produced it. */
|
|
1972
2146
|
async function getRun(runId, options = {}) {
|
|
2147
|
+
await transport.require("transform.getRun", options);
|
|
1973
2148
|
return transport.requestParsed(TransformRun, `/api/transform/run/${runId}`, { ...options });
|
|
1974
2149
|
}
|
|
1975
2150
|
/** Walk the run history, newest first, optionally narrowed to a single transform. */
|
|
1976
|
-
function runPages(params = {}, options = {}) {
|
|
1977
|
-
|
|
2151
|
+
async function* runPages(params = {}, options = {}) {
|
|
2152
|
+
await transport.require("transform.runPages", options);
|
|
2153
|
+
yield* paginatePages(transport, "/api/transform/run", TransformRun, {
|
|
1978
2154
|
query: { "transform-ids": params["transform-ids"] },
|
|
1979
2155
|
...options.offset !== void 0 && { offset: options.offset },
|
|
1980
2156
|
...options.max !== void 0 && { max: options.max },
|
|
@@ -1988,6 +2164,7 @@ function transformResource(transport) {
|
|
|
1988
2164
|
* A server that answers no run id started nothing, and there is then nothing to poll.
|
|
1989
2165
|
*/
|
|
1990
2166
|
async function run(id, params = {}, options = {}) {
|
|
2167
|
+
await transport.require("transform.run", options);
|
|
1991
2168
|
const kickoff = await transport.requestParsed(TransformRunKickoff, `/api/transform/${id}/run`, {
|
|
1992
2169
|
...options,
|
|
1993
2170
|
method: "POST"
|
|
@@ -2018,10 +2195,10 @@ function transformResource(transport) {
|
|
|
2018
2195
|
}
|
|
2019
2196
|
async function awaitTargetTableId(id, wait, options) {
|
|
2020
2197
|
try {
|
|
2021
|
-
return
|
|
2198
|
+
return (await pollUntil(async (signal) => get(id, {
|
|
2022
2199
|
...options,
|
|
2023
2200
|
signal
|
|
2024
|
-
}), (transform) =>
|
|
2201
|
+
}), (transform) => transform.target_table_id !== null, wait)).target_table_id;
|
|
2025
2202
|
} catch (error) {
|
|
2026
2203
|
if (error instanceof TimeoutError) return null;
|
|
2027
2204
|
throw error;
|
|
@@ -2041,15 +2218,13 @@ function transformResource(transport) {
|
|
|
2041
2218
|
run
|
|
2042
2219
|
};
|
|
2043
2220
|
}
|
|
2044
|
-
function linkedTableId(transform) {
|
|
2045
|
-
return transform.target_table_id ?? transform.table?.id ?? null;
|
|
2046
|
-
}
|
|
2047
2221
|
//#endregion
|
|
2048
2222
|
//#region ../client/src/resources/transform-tag.ts
|
|
2049
2223
|
const TransformTagApiList = z.array(TransformTag);
|
|
2050
2224
|
function transformTagResource(transport) {
|
|
2051
2225
|
/** List every transform tag the caller can see, built-in tags included. */
|
|
2052
2226
|
async function list(options = {}) {
|
|
2227
|
+
await transport.require("transformTag.list", options);
|
|
2053
2228
|
return {
|
|
2054
2229
|
data: await transport.requestParsed(TransformTagApiList, "/api/transform-tag", { ...options }),
|
|
2055
2230
|
total: null
|
|
@@ -2057,6 +2232,7 @@ function transformTagResource(transport) {
|
|
|
2057
2232
|
}
|
|
2058
2233
|
/** Create a transform tag, the label a transform job matches transforms on. */
|
|
2059
2234
|
async function create(params, options = {}) {
|
|
2235
|
+
await transport.require("transformTag.create", options);
|
|
2060
2236
|
return transport.requestParsed(TransformTag, "/api/transform-tag", {
|
|
2061
2237
|
...options,
|
|
2062
2238
|
method: "POST",
|
|
@@ -2065,6 +2241,7 @@ function transformTagResource(transport) {
|
|
|
2065
2241
|
}
|
|
2066
2242
|
/** Rename a transform tag by id. */
|
|
2067
2243
|
async function update(id, params, options = {}) {
|
|
2244
|
+
await transport.require("transformTag.update", options);
|
|
2068
2245
|
return transport.requestParsed(TransformTag, `/api/transform-tag/${id}`, {
|
|
2069
2246
|
...options,
|
|
2070
2247
|
method: "PUT",
|
|
@@ -2073,6 +2250,7 @@ function transformTagResource(transport) {
|
|
|
2073
2250
|
}
|
|
2074
2251
|
/** Delete a transform tag by id, detaching it from every transform and job carrying it. */
|
|
2075
2252
|
async function remove(id, options = {}) {
|
|
2253
|
+
await transport.require("transformTag.delete", options);
|
|
2076
2254
|
await transport.requestRaw(`/api/transform-tag/${id}`, {
|
|
2077
2255
|
...options,
|
|
2078
2256
|
method: "DELETE",
|
|
@@ -2097,6 +2275,7 @@ function uploadResource(transport) {
|
|
|
2097
2275
|
* The file may be at most 50 MB; larger uploads are rejected with a 413 response.
|
|
2098
2276
|
*/
|
|
2099
2277
|
async function createFromCsv(file, params, options = {}) {
|
|
2278
|
+
await transport.require("upload.createFromCsv", options);
|
|
2100
2279
|
const form = buildCsvFormData(file);
|
|
2101
2280
|
form.append("collection_id", params.collection_id);
|
|
2102
2281
|
const response = await transport.requestRaw("/api/upload/csv", {
|
|
@@ -2149,6 +2328,7 @@ CurrentUser.pick({
|
|
|
2149
2328
|
function userResource(transport) {
|
|
2150
2329
|
/** Get the user the request's credentials authenticate as. */
|
|
2151
2330
|
async function current(options = {}) {
|
|
2331
|
+
await transport.require("user.current", options);
|
|
2152
2332
|
return transport.requestParsed(CurrentUser, "/api/user/current", { ...options });
|
|
2153
2333
|
}
|
|
2154
2334
|
return { current };
|
|
@@ -2161,6 +2341,7 @@ function createClient(config, options) {
|
|
|
2161
2341
|
return {
|
|
2162
2342
|
card: cardResource(transport),
|
|
2163
2343
|
collection: collectionResource(transport),
|
|
2344
|
+
contentTranslation: contentTranslationResource(transport),
|
|
2164
2345
|
dashboard: dashboardResource(transport),
|
|
2165
2346
|
database: databaseResource(transport),
|
|
2166
2347
|
dataset: datasetResource(transport),
|
|
@@ -2185,6 +2366,7 @@ function createClient(config, options) {
|
|
|
2185
2366
|
transformTag: transformTagResource(transport),
|
|
2186
2367
|
upload: uploadResource(transport),
|
|
2187
2368
|
user: userResource(transport),
|
|
2369
|
+
server: transport.server,
|
|
2188
2370
|
requestParsed: transport.requestParsed,
|
|
2189
2371
|
requestRaw: transport.requestRaw,
|
|
2190
2372
|
requestStream: transport.requestStream
|