@malloy-publisher/sdk 0.0.33 → 0.0.35

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.
Files changed (336) hide show
  1. package/README.md +21 -0
  2. package/dist/RenderedResult-DphykkT6.cjs +1 -0
  3. package/dist/client/api.d.ts +18 -0
  4. package/dist/components/ApiErrorDisplay.d.ts +13 -0
  5. package/dist/components/Model/ModelCell.d.ts +1 -6
  6. package/dist/components/Package/Config.d.ts +1 -9
  7. package/dist/components/Package/Connections.d.ts +1 -8
  8. package/dist/components/Package/Databases.d.ts +1 -9
  9. package/dist/components/Package/Models.d.ts +1 -6
  10. package/dist/components/Package/Notebooks.d.ts +2 -7
  11. package/dist/components/Package/Package.d.ts +1 -6
  12. package/dist/components/Package/PackageProvider.d.ts +14 -0
  13. package/dist/components/Package/Schedules.d.ts +1 -9
  14. package/dist/components/Package/index.d.ts +2 -1
  15. package/dist/components/Project/About.d.ts +1 -7
  16. package/dist/components/Project/ConnectionExplorer.d.ts +1 -4
  17. package/dist/components/Project/Packages.d.ts +2 -5
  18. package/dist/components/Project/Project.d.ts +11 -3
  19. package/dist/components/Project/index.d.ts +1 -1
  20. package/dist/components/QueryResult/QueryResult.d.ts +1 -6
  21. package/dist/components/RenderedResult/RenderedResult.d.ts +4 -1
  22. package/dist/index-nKbldp0y.cjs +3000 -0
  23. package/dist/index.cjs.js +1 -2914
  24. package/dist/sdk.css +1 -1
  25. package/package.json +5 -5
  26. package/src/components/ApiErrorDisplay.tsx +40 -0
  27. package/src/components/Home/Home.tsx +8 -1
  28. package/src/components/Model/Model.tsx +59 -28
  29. package/src/components/Model/ModelCell.tsx +26 -63
  30. package/src/components/Model/NamedQueries.tsx +2 -2
  31. package/src/components/Model/SourcesExplorer.tsx +14 -15
  32. package/src/components/MutableNotebook/ModelPicker.tsx +13 -3
  33. package/src/components/MutableNotebook/MutableCell.tsx +6 -10
  34. package/src/components/MutableNotebook/MutableNotebook.tsx +2 -2
  35. package/src/components/Notebook/Notebook.tsx +48 -24
  36. package/src/components/Notebook/NotebookCell.tsx +7 -5
  37. package/src/components/Package/Config.tsx +10 -18
  38. package/src/components/Package/Connections.tsx +10 -12
  39. package/src/components/Package/Databases.tsx +93 -198
  40. package/src/components/Package/FileTreeView.tsx +21 -4
  41. package/src/components/Package/Models.tsx +21 -31
  42. package/src/components/Package/Notebooks.tsx +22 -32
  43. package/src/components/Package/Package.tsx +31 -89
  44. package/src/components/Package/PackageProvider.tsx +46 -0
  45. package/src/components/Package/Schedules.tsx +10 -19
  46. package/src/components/Package/index.ts +6 -1
  47. package/src/components/Project/About.tsx +7 -15
  48. package/src/components/Project/ConnectionExplorer.tsx +131 -52
  49. package/src/components/Project/Packages.tsx +12 -13
  50. package/src/components/Project/Project.tsx +35 -16
  51. package/src/components/Project/index.ts +1 -1
  52. package/src/components/QueryResult/QueryResult.tsx +12 -15
  53. package/src/components/RenderedResult/RenderedResult.tsx +50 -11
  54. package/src/components/RenderedResult/ResultContainer.tsx +24 -9
  55. package/dist/RenderedResult-B9Gth8IY.cjs +0 -1
  56. package/dist/RenderedResult-Drg_uJPZ.js +0 -30
  57. package/dist/abap-BmBUA35e.js +0 -6
  58. package/dist/actionscript-3-zFUbzQa9.js +0 -6
  59. package/dist/ada-CBvPkFpZ.js +0 -6
  60. package/dist/andromeeda-uXNdzNpk.js +0 -4
  61. package/dist/angular-html-0fTdLuKf.js +0 -32
  62. package/dist/angular-ts-wkniW60G.js +0 -21
  63. package/dist/apache-CVNlsSDc.js +0 -6
  64. package/dist/apex-DFk3KRB1.js +0 -6
  65. package/dist/apl-TLDHFJX6.js +0 -16
  66. package/dist/applescript-CYMR_y0g.js +0 -6
  67. package/dist/ara-4QmU5e04.js +0 -6
  68. package/dist/asciidoc-v_1bjgUg.js +0 -6
  69. package/dist/asm-RC0Yh-NZ.js +0 -6
  70. package/dist/astro-Uf8_VxKJ.js +0 -16
  71. package/dist/aurora-x-BwoVEUWZ.js +0 -4
  72. package/dist/awk-gPH8MVMW.js +0 -6
  73. package/dist/ayu-dark-CxPZkpb2.js +0 -4
  74. package/dist/ballerina-kvLnRU_e.js +0 -6
  75. package/dist/bat-BHYy44sT.js +0 -6
  76. package/dist/beancount-D-MADTs_.js +0 -6
  77. package/dist/berry-Ci9U0o4h.js +0 -6
  78. package/dist/bibtex-CX618D15.js +0 -6
  79. package/dist/bicep-iuYiPopT.js +0 -6
  80. package/dist/blade-BtR00Gx0.js +0 -18
  81. package/dist/bsl-BIXPNqL4.js +0 -8
  82. package/dist/c-DASdrs7p.js +0 -6
  83. package/dist/cadence-BDALQi26.js +0 -6
  84. package/dist/cairo-tXZKA2PT.js +0 -8
  85. package/dist/catppuccin-frappe-BrTOiad2.js +0 -4
  86. package/dist/catppuccin-latte-D-dc_R4m.js +0 -4
  87. package/dist/catppuccin-macchiato-DN4jOp0G.js +0 -4
  88. package/dist/catppuccin-mocha-B8yCE3-3.js +0 -4
  89. package/dist/clarity-CNgV2Ths.js +0 -6
  90. package/dist/clojure-CsKKFGwv.js +0 -6
  91. package/dist/cmake-Dr-A3iJx.js +0 -6
  92. package/dist/cobol-DMssKNmC.js +0 -10
  93. package/dist/codeowners-Bt9yU6NX.js +0 -6
  94. package/dist/codeql-DBNTqJi1.js +0 -6
  95. package/dist/coffee-D_GzM8k1.js +0 -8
  96. package/dist/common-lisp-r7ZEOG7T.js +0 -6
  97. package/dist/components/Package/PublisherPackageProvider.d.ts +0 -14
  98. package/dist/components/Project/TablesInSchema.d.ts +0 -10
  99. package/dist/coq-CB6Pv_W9.js +0 -6
  100. package/dist/cpp-CJF2i3ah.js +0 -18
  101. package/dist/crystal-BKWnaU3g.js +0 -18
  102. package/dist/csharp-CYWRhZ2R.js +0 -6
  103. package/dist/css-D1aVdRIU.js +0 -6
  104. package/dist/csv-DvCncUGQ.js +0 -6
  105. package/dist/cue-BXMrmvay.js +0 -6
  106. package/dist/cypher-DTm5zNR1.js +0 -6
  107. package/dist/d-D6ZXmn3l.js +0 -6
  108. package/dist/dark-plus-pUHDTVV0.js +0 -4
  109. package/dist/dart-Dz59Is3F.js +0 -6
  110. package/dist/dax-DTVGzydb.js +0 -6
  111. package/dist/desktop-Db9vb-dl.js +0 -6
  112. package/dist/diff-XmNrvgM1.js +0 -6
  113. package/dist/docker-DWH2onkn.js +0 -6
  114. package/dist/dotenv-4337wvzu.js +0 -6
  115. package/dist/dracula-BtZx2Kac.js +0 -4
  116. package/dist/dracula-soft-BKa-aqBv.js +0 -4
  117. package/dist/dream-maker-CvvfrJSx.js +0 -6
  118. package/dist/edge-CgxR-qhM.js +0 -12
  119. package/dist/elixir-DZkeSPwW.js +0 -8
  120. package/dist/elm-BKuV1HE1.js +0 -8
  121. package/dist/emacs-lisp-BAefI874.js +0 -6
  122. package/dist/erb-BLwkpXUJ.js +0 -10
  123. package/dist/erlang-CmIiwF3I.js +0 -6
  124. package/dist/everforest-dark-DMCBqXCK.js +0 -4
  125. package/dist/everforest-light-BbXl82Em.js +0 -4
  126. package/dist/fennel-DNqkz9pE.js +0 -6
  127. package/dist/fish-DIm72t2T.js +0 -6
  128. package/dist/fluent-BapTxJsC.js +0 -6
  129. package/dist/fortran-fixed-form-s9Hnb3av.js +0 -8
  130. package/dist/fortran-free-form-CNDsBFUj.js +0 -6
  131. package/dist/fsharp-Cv0x43wb.js +0 -8
  132. package/dist/gdresource-CMcKXvgJ.js +0 -10
  133. package/dist/gdscript-D7aheHm-.js +0 -6
  134. package/dist/gdshader-BGJEsM2Z.js +0 -6
  135. package/dist/genie-C9gPjc6J.js +0 -6
  136. package/dist/gherkin-bka1Exbx.js +0 -6
  137. package/dist/git-commit-BspYIY3P.js +0 -8
  138. package/dist/git-rebase--zLBTjUa.js +0 -8
  139. package/dist/github-dark-DenFmJkN.js +0 -4
  140. package/dist/github-dark-default-BJPUVz4H.js +0 -4
  141. package/dist/github-dark-dimmed-DUshB20C.js +0 -4
  142. package/dist/github-dark-high-contrast-D3aGCnF8.js +0 -4
  143. package/dist/github-light-JYsPkUQd.js +0 -4
  144. package/dist/github-light-default-D99KPAby.js +0 -4
  145. package/dist/github-light-high-contrast-BbmZE-Mp.js +0 -4
  146. package/dist/gleam-B4k9YFGD.js +0 -6
  147. package/dist/glimmer-js-DhY9umHJ.js +0 -14
  148. package/dist/glimmer-ts-CCrHcYH5.js +0 -14
  149. package/dist/glsl-XLGYNq5B.js +0 -8
  150. package/dist/gnuplot-DnWoRZt-.js +0 -6
  151. package/dist/go-BErP6iv1.js +0 -6
  152. package/dist/graphql-DWpQF4JI.js +0 -14
  153. package/dist/groovy-IWs5-NIO.js +0 -6
  154. package/dist/hack-CQrV-ytR.js +0 -10
  155. package/dist/haml-CMN0hQaL.js +0 -10
  156. package/dist/handlebars-Cc-7fXX5.js +0 -14
  157. package/dist/haskell-CtlGos0K.js +0 -6
  158. package/dist/haxe-CZZ33vZw.js +0 -6
  159. package/dist/hcl-6hOg9WP4.js +0 -6
  160. package/dist/hjson-CgwED-oz.js +0 -6
  161. package/dist/hlsl-3-lv4gi7.js +0 -6
  162. package/dist/houston-BDYrDoDW.js +0 -4
  163. package/dist/html-B0P_v3yU.js +0 -10
  164. package/dist/html-derivative-D59SHfh8.js +0 -8
  165. package/dist/http-Dcjm_K1m.js +0 -14
  166. package/dist/hxml-BNKImryz.js +0 -8
  167. package/dist/hy-C2xHhR6I.js +0 -6
  168. package/dist/imba-Drd0AMDo.js +0 -8
  169. package/dist/index.es.js +0 -140061
  170. package/dist/ini-BUcvsX-U.js +0 -6
  171. package/dist/java-B7odJ7Ap.js +0 -6
  172. package/dist/javascript-fa8UlHZE.js +0 -6
  173. package/dist/jinja-CCSYduCH.js +0 -11
  174. package/dist/jison-BygvlveW.js +0 -8
  175. package/dist/json-71t8ZF9g.js +0 -6
  176. package/dist/json5-Z7F6rA6a.js +0 -6
  177. package/dist/jsonc-Dphhs4m2.js +0 -6
  178. package/dist/jsonl-D9jj92Gg.js +0 -6
  179. package/dist/jsonnet-DEQ7IUoJ.js +0 -6
  180. package/dist/jssm-j74e88UX.js +0 -6
  181. package/dist/jsx-Bkesy5tT.js +0 -6
  182. package/dist/julia-CiahampL.js +0 -16
  183. package/dist/kanagawa-dragon-CiKur4Hl.js +0 -4
  184. package/dist/kanagawa-lotus-BKu-smKu.js +0 -4
  185. package/dist/kanagawa-wave-CQwozSzG.js +0 -4
  186. package/dist/kotlin-DCgZY7Ii.js +0 -6
  187. package/dist/kusto-Cw029H-v.js +0 -6
  188. package/dist/laserwave-6a00oqik.js +0 -4
  189. package/dist/latex-LfGCYGw5.js +0 -8
  190. package/dist/lean-CYSet4vs.js +0 -6
  191. package/dist/less-DQA4v-Nm.js +0 -6
  192. package/dist/light-plus-CZuVqSLX.js +0 -4
  193. package/dist/liquid-CvufO3kO.js +0 -14
  194. package/dist/log-D2eRfqDn.js +0 -6
  195. package/dist/logo-QEAtGWZ9.js +0 -6
  196. package/dist/lua-BVfhNLDr.js +0 -8
  197. package/dist/luau-BjYGiqID.js +0 -6
  198. package/dist/make-BjuHP00g.js +0 -6
  199. package/dist/malloy-explorer.css +0 -497
  200. package/dist/markdown-B6guhLWd.js +0 -6
  201. package/dist/marko-CHlMS8w5.js +0 -14
  202. package/dist/material-theme-D6KBX41T.js +0 -4
  203. package/dist/material-theme-darker-CkRroheE.js +0 -4
  204. package/dist/material-theme-lighter-BUBw43Yz.js +0 -4
  205. package/dist/material-theme-ocean-ClGX14Ja.js +0 -4
  206. package/dist/material-theme-palenight-C1RVm8K1.js +0 -4
  207. package/dist/matlab-BpQlIJiw.js +0 -6
  208. package/dist/mdc-4K6B6lHG.js +0 -12
  209. package/dist/mdx-DIoECIFU.js +0 -6
  210. package/dist/mermaid-BZ7WHNIe.js +0 -6
  211. package/dist/min-dark-C7ak0t6c.js +0 -4
  212. package/dist/min-light-CKFxVcPp.js +0 -4
  213. package/dist/mipsasm-DusDYkFc.js +0 -6
  214. package/dist/mojo-CY9jaezJ.js +0 -6
  215. package/dist/monokai-C1KBYcO0.js +0 -4
  216. package/dist/move-ChphFumd.js +0 -6
  217. package/dist/narrat-Dz4d7OmN.js +0 -6
  218. package/dist/nextflow-DW0Yq9a2.js +0 -6
  219. package/dist/nginx-Can2eAjw.js +0 -8
  220. package/dist/night-owl-Bm2rzalh.js +0 -4
  221. package/dist/nim-B3r2RtQZ.js +0 -20
  222. package/dist/nix-Cg5uV_xg.js +0 -6
  223. package/dist/nord-CC5OiUXg.js +0 -4
  224. package/dist/nushell-BfRnzRWn.js +0 -6
  225. package/dist/objective-c-BGg9R27G.js +0 -6
  226. package/dist/objective-cpp-CJ3y3V_5.js +0 -6
  227. package/dist/ocaml-BZLsfx_o.js +0 -6
  228. package/dist/one-dark-pro-D7-kP8fv.js +0 -4
  229. package/dist/one-light-D9sNaUtq.js +0 -4
  230. package/dist/pascal-l2bqd7Dz.js +0 -6
  231. package/dist/perl-DaMQyPwp.js +0 -16
  232. package/dist/php-BL3EfPBi.js +0 -18
  233. package/dist/plastic-CSTz3KZp.js +0 -4
  234. package/dist/plsql-oVq_K_wH.js +0 -6
  235. package/dist/po-5jaeIyVd.js +0 -6
  236. package/dist/poimandres-C-VADXHD.js +0 -4
  237. package/dist/polar-wcLp8ci7.js +0 -6
  238. package/dist/postcss-BZ3MNRIJ.js +0 -6
  239. package/dist/powerquery-CgRa2XRw.js +0 -6
  240. package/dist/powershell-Diwyv8Eh.js +0 -6
  241. package/dist/prisma-COL_v1x4.js +0 -6
  242. package/dist/prolog-CuvJOxqT.js +0 -6
  243. package/dist/proto-o9HLmF90.js +0 -6
  244. package/dist/pug-HKe4Luo3.js +0 -12
  245. package/dist/puppet-wpGOnQp5.js +0 -6
  246. package/dist/purescript-B_1NgE2N.js +0 -6
  247. package/dist/python-xYxLFJY-.js +0 -6
  248. package/dist/qml-FlMIyjU9.js +0 -8
  249. package/dist/qmldir-BInDYbpo.js +0 -6
  250. package/dist/qss-D-h4NdUG.js +0 -6
  251. package/dist/r-F-9I-ITZ.js +0 -6
  252. package/dist/racket-BoD1TBFT.js +0 -6
  253. package/dist/raku-IaYcw19m.js +0 -6
  254. package/dist/razor-CeqqNtyB.js +0 -10
  255. package/dist/red-7y8PH7HH.js +0 -4
  256. package/dist/reg-CMUdAgIP.js +0 -6
  257. package/dist/regexp-GiFkbxS-.js +0 -6
  258. package/dist/rel-BaRn3QX7.js +0 -6
  259. package/dist/riscv-B9V3SsvW.js +0 -6
  260. package/dist/rose-pine-DhT-HZE9.js +0 -4
  261. package/dist/rose-pine-dawn-DiCjL2i4.js +0 -4
  262. package/dist/rose-pine-moon-BNmGHlcn.js +0 -4
  263. package/dist/rst-C3D6-dqL.js +0 -22
  264. package/dist/ruby-DcPLUUK3.js +0 -30
  265. package/dist/rust-Pc7DCsZD.js +0 -6
  266. package/dist/sas-tDSYjXcL.js +0 -8
  267. package/dist/sass-iCyS6eP9.js +0 -6
  268. package/dist/scala-Cly-fENF.js +0 -6
  269. package/dist/scheme-Zi24oEYu.js +0 -6
  270. package/dist/scss-DhHc4lxB.js +0 -8
  271. package/dist/sdbl-BBamrXFL.js +0 -6
  272. package/dist/shaderlab-CvqEIoL0.js +0 -8
  273. package/dist/shellscript-Dn0-btNd.js +0 -6
  274. package/dist/shellsession-8OLo3sB6.js +0 -8
  275. package/dist/slack-dark-i7wN4OET.js +0 -4
  276. package/dist/slack-ochin-ndHf0LoP.js +0 -4
  277. package/dist/smalltalk-Cns31tKw.js +0 -6
  278. package/dist/snazzy-light-BlSJXAu4.js +0 -4
  279. package/dist/solarized-dark-UTmkh7lw.js +0 -4
  280. package/dist/solarized-light-BheCkDPT.js +0 -4
  281. package/dist/solidity-BG_k8fA_.js +0 -6
  282. package/dist/soy-EwHMOVPj.js +0 -8
  283. package/dist/sparql-DhuelBut.js +0 -8
  284. package/dist/splunk-CTqDjQdo.js +0 -6
  285. package/dist/sql-DCkt643-.js +0 -6
  286. package/dist/ssh-config-DHHGll-v.js +0 -6
  287. package/dist/stata-Dok6hMw0.js +0 -8
  288. package/dist/stylus-n_9f0QQ5.js +0 -6
  289. package/dist/svelte-01qw6Rxm.js +0 -14
  290. package/dist/swift-BAWqNR8A.js +0 -6
  291. package/dist/synthwave-84-NU3C_KFZ.js +0 -4
  292. package/dist/system-verilog-Cui-g-ut.js +0 -6
  293. package/dist/systemd-CsKYQIQK.js +0 -6
  294. package/dist/talonscript-D2dGh8FO.js +0 -6
  295. package/dist/tasl-D3W8HMV6.js +0 -6
  296. package/dist/tcl-2y0Fuc4S.js +0 -6
  297. package/dist/templ-Hmy8U0DD.js +0 -12
  298. package/dist/terraform-BGW6Oerf.js +0 -6
  299. package/dist/tex-mHs7a43s.js +0 -8
  300. package/dist/tokyo-night-LhP3hHhi.js +0 -4
  301. package/dist/toml-CQSfOn0e.js +0 -6
  302. package/dist/ts-tags-DYZ4SGcN.js +0 -41
  303. package/dist/tsv-BtvSkaG0.js +0 -6
  304. package/dist/tsx-DiGsgWT8.js +0 -6
  305. package/dist/turtle-BJ2wmjPc.js +0 -6
  306. package/dist/twig-BmytkGQV.js +0 -18
  307. package/dist/typescript-buWNZFwO.js +0 -6
  308. package/dist/typespec-bLbdsxJL.js +0 -6
  309. package/dist/typst-Y9_SmXTs.js +0 -6
  310. package/dist/v-wa8Orrdd.js +0 -6
  311. package/dist/vala-DRdriFr_.js +0 -6
  312. package/dist/vb-E2_-jk4M.js +0 -6
  313. package/dist/vendor-DfRellEl.js +0 -75318
  314. package/dist/verilog-B1iBoR5_.js +0 -6
  315. package/dist/vesper-CJsaOsSM.js +0 -4
  316. package/dist/vhdl-CRVaAhXk.js +0 -6
  317. package/dist/viml-B-zWOd7Z.js +0 -6
  318. package/dist/vitesse-black-BoGvW84i.js +0 -4
  319. package/dist/vitesse-dark-Cym-eLtO.js +0 -4
  320. package/dist/vitesse-light-CcmG315c.js +0 -4
  321. package/dist/vue-Bl1uVNsA.js +0 -31
  322. package/dist/vue-html-DHr5wjBG.js +0 -10
  323. package/dist/vyper-DWutKXpa.js +0 -6
  324. package/dist/wasm-Bv5f0gKv.js +0 -6
  325. package/dist/wasm-DQxwEHae.js +0 -7
  326. package/dist/wenyan-BMYnfus1.js +0 -6
  327. package/dist/wgsl-DnPoPGDU.js +0 -6
  328. package/dist/wikitext-CntM04PE.js +0 -6
  329. package/dist/wolfram-Ws5qPlX9.js +0 -6
  330. package/dist/xml-ChBsf5uy.js +0 -8
  331. package/dist/xsl-BefjlXrd.js +0 -8
  332. package/dist/yaml-Bbg74JKr.js +0 -6
  333. package/dist/zenscript-C0RKE4nU.js +0 -6
  334. package/dist/zig-D6SXBGNm.js +0 -6
  335. package/src/components/Package/PublisherPackageProvider.tsx +0 -48
  336. package/src/components/Project/TablesInSchema.tsx +0 -84
@@ -17,6 +17,7 @@ import LinkOutlinedIcon from "@mui/icons-material/LinkOutlined";
17
17
  import ContentCopyIcon from "@mui/icons-material/ContentCopy";
18
18
  import { useEffect } from "react";
19
19
  import { highlight } from "../highlighter";
20
+ import { usePackage } from "../Package/PackageProvider";
20
21
 
21
22
  const StyledCard = styled(Card)({
22
23
  display: "flex",
@@ -25,75 +26,60 @@ const StyledCard = styled(Card)({
25
26
  });
26
27
 
27
28
  interface ModelCellProps {
28
- server: string;
29
- projectName: string;
30
- packageName: string;
31
29
  modelPath: string;
32
- versionId: string;
33
30
  sourceName?: string;
34
31
  queryName: string;
35
32
  expandResult?: boolean;
36
33
  hideResultIcon?: boolean;
37
34
  expandEmbedding?: boolean;
38
35
  hideEmbeddingIcon?: boolean;
39
- accessToken?: string;
40
36
  noView?: boolean;
41
37
  annotations?: string[];
42
38
  }
43
39
 
44
40
  export function ModelCell({
45
- server,
46
- projectName,
47
- packageName,
48
41
  modelPath,
49
- versionId,
50
42
  sourceName,
51
43
  queryName,
52
44
  expandResult,
53
45
  hideResultIcon,
54
46
  expandEmbedding,
55
47
  hideEmbeddingIcon,
56
- accessToken,
57
48
  noView,
58
49
  annotations,
59
50
  }: ModelCellProps) {
60
51
  const [resultsExpanded, setResultsExpanded] = React.useState(expandResult);
61
52
  const [embeddingExpanded, setEmbeddingExpanded] =
62
- React.useState(expandEmbedding);
53
+ React.useState<boolean>(expandEmbedding);
63
54
  const [highlightedEmbedCode, setHighlightedEmbedCode] =
64
55
  React.useState<string>();
65
56
  const [highlightedAnnotations, setHighlightedAnnotations] =
66
57
  React.useState<string>();
67
58
 
68
- useEffect(() => {
69
- highlight(
70
- getQueryResultCodeSnippet(
71
- server,
72
- projectName,
73
- packageName,
74
- modelPath,
75
- versionId,
76
- sourceName,
77
- queryName,
78
- ),
79
- "typescript",
80
- ).then((code) => {
81
- setHighlightedEmbedCode(code);
82
- });
83
- }, [
59
+ const { server, projectName, packageName, versionId } = usePackage();
60
+
61
+ const queryResultCodeSnippet = getQueryResultCodeSnippet(
84
62
  server,
85
63
  projectName,
86
64
  packageName,
87
- modelPath,
88
65
  versionId,
89
66
  sourceName,
90
67
  queryName,
91
- ]);
68
+ );
69
+
70
+ useEffect(() => {
71
+ highlight(queryResultCodeSnippet, "typescript").then((code) => {
72
+ setHighlightedEmbedCode(code);
73
+ });
74
+ }, [embeddingExpanded, queryResultCodeSnippet]);
92
75
 
93
76
  useEffect(() => {
94
- if (annotations) {
95
- highlight(getAnnotations(annotations), "malloy").then((code) => {
96
- setHighlightedAnnotations(code);
77
+ if (annotations && annotations.length > 0) {
78
+ const code = annotations
79
+ .map((annotation) => `// ${annotation}`)
80
+ .join("\n");
81
+ highlight(code, "typescript").then((highlightedCode) => {
82
+ setHighlightedAnnotations(highlightedCode);
97
83
  });
98
84
  }
99
85
  }, [annotations]);
@@ -155,39 +141,33 @@ export function ModelCell({
155
141
  </CardActions>
156
142
  </Stack>
157
143
  <Collapse in={embeddingExpanded} timeout="auto" unmountOnExit>
158
- <Divider sx={{ mb: "10px" }} />
144
+ <Divider />
159
145
  <Stack
160
146
  sx={{
147
+ p: "10px",
161
148
  borderRadius: 0,
162
149
  flexDirection: "row",
163
150
  justifyContent: "space-between",
164
151
  }}
165
152
  >
166
153
  <Typography
167
- fontSize="12px"
168
- sx={{ fontSize: "12px", "& .line": { textWrap: "wrap" } }}
154
+ sx={{
155
+ fontSize: "12px",
156
+ "& .line": { textWrap: "wrap" },
157
+ }}
169
158
  >
170
159
  <div
171
- className="content"
172
160
  dangerouslySetInnerHTML={{
173
161
  __html: highlightedEmbedCode,
174
162
  }}
175
163
  />
176
164
  </Typography>
177
- <Tooltip title="View Code">
165
+ <Tooltip title="Copy Embeddable Code">
178
166
  <IconButton
179
167
  sx={{ width: "24px", height: "24px" }}
180
168
  onClick={() => {
181
169
  navigator.clipboard.writeText(
182
- getQueryResultCodeSnippet(
183
- server,
184
- projectName,
185
- packageName,
186
- modelPath,
187
- versionId,
188
- sourceName,
189
- queryName,
190
- ),
170
+ queryResultCodeSnippet,
191
171
  );
192
172
  }}
193
173
  >
@@ -227,14 +207,9 @@ export function ModelCell({
227
207
  )}
228
208
  <CardContent>
229
209
  <QueryResult
230
- server={server}
231
- projectName={projectName}
232
- packageName={packageName}
233
210
  modelPath={modelPath}
234
- versionId={versionId}
235
211
  sourceName={sourceName}
236
212
  queryName={queryName}
237
- accessToken={accessToken}
238
213
  />
239
214
  </CardContent>
240
215
  </Collapse>
@@ -247,7 +222,6 @@ function getQueryResultCodeSnippet(
247
222
  server: string,
248
223
  projectName: string,
249
224
  packageName: string,
250
- modelPath: string,
251
225
  versionId: string,
252
226
  sourceName: string,
253
227
  queryName: string,
@@ -257,19 +231,8 @@ server="${server}"
257
231
  accessToken={accessToken}
258
232
  projectName="${projectName}"
259
233
  packageName="${packageName}"
260
- modelPath="${modelPath}"
261
234
  versionId="${versionId}"
262
235
  sourceName="${sourceName}"
263
236
  queryName="${queryName}"
264
237
  />`;
265
238
  }
266
-
267
- function getAnnotations(annotations: string[]): string {
268
- let res = "";
269
-
270
- for (const an of annotations) {
271
- res += an;
272
- }
273
-
274
- return res;
275
- }
@@ -10,7 +10,7 @@ import { StyledCard, StyledCardContent } from "../styles";
10
10
 
11
11
  import { QueryClient, useMutation } from "@tanstack/react-query";
12
12
  import { Configuration } from "../../client";
13
- import { usePublisherPackage } from "../Package";
13
+ import { usePackage } from "../Package";
14
14
  import React from "react";
15
15
  import ResultContainer from "../RenderedResult/ResultContainer";
16
16
 
@@ -27,7 +27,7 @@ export default function NamedQueries({
27
27
  modelPath,
28
28
  }: NamedQueryProps) {
29
29
  const { server, projectName, packageName, versionId, accessToken } =
30
- usePublisherPackage();
30
+ usePackage();
31
31
  const [namedQueryResults, setNamedQueryResults] = React.useState<
32
32
  Record<string, string>
33
33
  >({});
@@ -21,7 +21,7 @@ import { styled } from "@mui/material/styles";
21
21
  import { QueryClient, useMutation } from "@tanstack/react-query";
22
22
  import React from "react";
23
23
  import { Configuration, QueryresultsApi } from "../../client";
24
- import { usePublisherPackage } from "../Package/PublisherPackageProvider";
24
+ import { usePackage } from "../Package/PackageProvider";
25
25
 
26
26
  const queryResultsApi = new QueryresultsApi(new Configuration());
27
27
  const queryClient = new QueryClient();
@@ -87,8 +87,8 @@ export function SourcesExplorer({
87
87
  const [selectedTab, setSelectedTab] = React.useState(
88
88
  existingSourceName
89
89
  ? sourceAndPaths.findIndex(
90
- (entry) => entry.sourceInfo.name === existingSourceName,
91
- )
90
+ (entry) => entry.sourceInfo.name === existingSourceName,
91
+ )
92
92
  : 0,
93
93
  );
94
94
 
@@ -193,7 +193,7 @@ export function SourceExplorerComponent({
193
193
  }
194
194
  }, [onChange, query]);
195
195
  const { server, projectName, packageName, versionId, accessToken } =
196
- usePublisherPackage();
196
+ usePackage();
197
197
  const mutation = useMutation(
198
198
  {
199
199
  mutationFn: () => {
@@ -272,7 +272,6 @@ export function SourceExplorerComponent({
272
272
  onFocusedNestViewPathChange={setFocusedNestViewPath}
273
273
  onDrill={(params) => {
274
274
  console.info(params);
275
- window.alert("Drill!");
276
275
  }}
277
276
  >
278
277
  <div
@@ -324,16 +323,16 @@ export function SourceExplorerComponent({
324
323
  submittedQuery={
325
324
  query?.malloyQuery
326
325
  ? {
327
- executionState: mutation.isPending
328
- ? "running"
329
- : "finished",
330
- response: {
331
- result: query.malloyResult,
332
- },
333
- query: query.malloyQuery,
334
- queryResolutionStartMillis: Date.now(),
335
- onCancel: mutation.reset,
336
- }
326
+ executionState: mutation.isPending
327
+ ? "running"
328
+ : "finished",
329
+ response: {
330
+ result: query.malloyResult,
331
+ },
332
+ query: query.malloyQuery,
333
+ queryResolutionStartMillis: Date.now(),
334
+ onCancel: mutation.reset,
335
+ }
337
336
  : undefined
338
337
  }
339
338
  options={{ showRawQuery: true }}
@@ -18,8 +18,9 @@ import {
18
18
  import { QueryClient, useQuery } from "@tanstack/react-query";
19
19
  import React from "react";
20
20
  import { Configuration, ModelsApi } from "../../client";
21
- import { usePublisherPackage } from "../Package/PublisherPackageProvider";
21
+ import { usePackage } from "../Package/PackageProvider";
22
22
  import { StyledCard } from "../styles";
23
+ import { ApiErrorDisplay } from "../ApiErrorDisplay";
23
24
 
24
25
  const modelsApi = new ModelsApi(new Configuration());
25
26
  const queryClient = new QueryClient();
@@ -38,7 +39,7 @@ export function ModelPicker({
38
39
  onModelChange,
39
40
  }: ModelPickerProps) {
40
41
  const { server, projectName, packageName, versionId, accessToken } =
41
- usePublisherPackage();
42
+ usePackage();
42
43
  const { data, isLoading, isSuccess, isError, error } = useQuery(
43
44
  {
44
45
  queryKey: ["models", server, projectName, packageName, versionId],
@@ -51,6 +52,7 @@ export function ModelPicker({
51
52
  },
52
53
  }),
53
54
  retry: false,
55
+ throwOnError: false,
54
56
  },
55
57
  queryClient,
56
58
  );
@@ -83,6 +85,15 @@ export function ModelPicker({
83
85
  .map((model) => model.path);
84
86
  }
85
87
 
88
+ if (isError) {
89
+ return (
90
+ <ApiErrorDisplay
91
+ error={error}
92
+ context={`${projectName} > ${packageName} > Model Picker`}
93
+ />
94
+ );
95
+ }
96
+
86
97
  return (
87
98
  <StyledCard
88
99
  sx={{ maxWidth: 400, marginLeft: "10px", padding: "10px 5px 5px 5px" }}
@@ -90,7 +101,6 @@ export function ModelPicker({
90
101
  <Typography variant="h6">Imported Models</Typography>
91
102
  <FormControl fullWidth>
92
103
  {isLoading && <Typography>Loading...</Typography>}
93
- {isError && <Typography>Error: {error.message}</Typography>}
94
104
  <Stack
95
105
  direction="row"
96
106
  spacing={1}
@@ -26,7 +26,7 @@ import MDEditor from "@uiw/react-md-editor";
26
26
  import { EditableMalloyCell } from "./EditableMalloyCell";
27
27
  import { NotebookCellValue } from "../NotebookManager";
28
28
  import { SourceAndPath } from "../Model/SourcesExplorer";
29
- const RenderedResult = lazy(() => import("../RenderedResult/RenderedResult"));
29
+ import ResultContainer from "../RenderedResult/ResultContainer";
30
30
 
31
31
  interface NotebookCellProps {
32
32
  cell: NotebookCellValue;
@@ -293,15 +293,11 @@ export function MutableCell({
293
293
  />
294
294
  ))}
295
295
  {!editingMalloy && cell.result && (
296
- <>
297
- <CardContent
298
- sx={{ maxHeight: "400px", overflow: "auto" }}
299
- >
300
- <Suspense fallback="Loading malloy...">
301
- <RenderedResult result={cell.result} />
302
- </Suspense>
303
- </CardContent>
304
- </>
296
+ <ResultContainer
297
+ result={cell.result}
298
+ minHeight={300}
299
+ maxHeight={800}
300
+ />
305
301
  )}
306
302
  </>
307
303
  ))}
@@ -20,7 +20,7 @@ import { useRouterClickHandler } from "../click_helper";
20
20
  import { Configuration, ModelsApi } from "../../client";
21
21
  import { SourceAndPath } from "../Model/SourcesExplorer";
22
22
  import { NotebookManager } from "../NotebookManager";
23
- import { usePublisherPackage } from "../Package";
23
+ import { usePackage } from "../Package";
24
24
  import { StyledCard, StyledCardContent, StyledCardMedia } from "../styles";
25
25
  import { ModelPicker } from "./ModelPicker";
26
26
  import { MutableCell } from "./MutableCell";
@@ -48,7 +48,7 @@ export default function MutableNotebook({
48
48
  }: MutableNotebookProps) {
49
49
  const navigate = useRouterClickHandler();
50
50
  const { server, projectName, packageName, versionId, accessToken } =
51
- usePublisherPackage();
51
+ usePackage();
52
52
  if (!projectName || !packageName) {
53
53
  throw new Error(
54
54
  "Project and package must be provided via PubliserPackageProvider",
@@ -11,11 +11,13 @@ import {
11
11
  import Stack from "@mui/material/Stack";
12
12
  import { QueryClient, useQuery } from "@tanstack/react-query";
13
13
  import React, { useEffect } from "react";
14
- import { Configuration, NotebooksApi } from "../../client";
14
+ import { Configuration, NotebooksApi, CompiledNotebook } from "../../client";
15
15
  import { highlight } from "../highlighter";
16
- import { usePublisherPackage } from "../Package";
16
+ import { usePackage } from "../Package";
17
17
  import { StyledCard, StyledCardContent, StyledCardMedia } from "../styles";
18
18
  import { NotebookCell } from "./NotebookCell";
19
+ import { ApiErrorDisplay, ApiError } from "../ApiErrorDisplay";
20
+ import { AxiosError } from "axios";
19
21
 
20
22
  const notebooksApi = new NotebooksApi(new Configuration());
21
23
  const queryClient = new QueryClient();
@@ -27,7 +29,7 @@ interface NotebookProps {
27
29
  expandEmbeddings?: boolean;
28
30
  hideEmbeddingIcons?: boolean;
29
31
  }
30
- // Requires PublisherPackageProvider
32
+ // Requires PackageProvider
31
33
  export default function Notebook({
32
34
  notebookPath,
33
35
  expandCodeCells,
@@ -40,7 +42,7 @@ export default function Notebook({
40
42
  const [highlightedEmbedCode, setHighlightedEmbedCode] =
41
43
  React.useState<string>();
42
44
  const { server, projectName, packageName, accessToken, versionId } =
43
- usePublisherPackage();
45
+ usePackage();
44
46
  const notebookCodeSnippet = getNotebookCodeSnippet(
45
47
  server,
46
48
  packageName,
@@ -59,7 +61,7 @@ export default function Notebook({
59
61
  isSuccess,
60
62
  isError,
61
63
  error,
62
- } = useQuery(
64
+ } = useQuery<CompiledNotebook, ApiError>(
63
65
  {
64
66
  queryKey: [
65
67
  "notebook",
@@ -69,21 +71,44 @@ export default function Notebook({
69
71
  notebookPath,
70
72
  versionId,
71
73
  ],
72
- queryFn: () =>
73
- notebooksApi.getNotebook(
74
- projectName,
75
- packageName,
76
- notebookPath,
77
- versionId,
78
- {
79
- baseURL: server,
80
- withCredentials: !accessToken,
81
- headers: {
82
- Authorization: accessToken && `Bearer ${accessToken}`,
74
+ queryFn: async () => {
75
+ try {
76
+ const response = await notebooksApi.getNotebook(
77
+ projectName,
78
+ packageName,
79
+ notebookPath,
80
+ versionId,
81
+ {
82
+ baseURL: server,
83
+ withCredentials: !accessToken,
84
+ headers: {
85
+ Authorization: accessToken && `Bearer ${accessToken}`,
86
+ },
83
87
  },
84
- },
85
- ),
88
+ );
89
+ return response.data;
90
+ } catch (err) {
91
+ // If it's an Axios error, it will have response data
92
+ if (err && typeof err === "object" && "response" in err) {
93
+ const axiosError = err as AxiosError<{
94
+ code: string;
95
+ message: string;
96
+ }>;
97
+ if (axiosError.response?.data) {
98
+ const apiError: ApiError = new Error(
99
+ axiosError.response.data.message || axiosError.message,
100
+ );
101
+ apiError.status = axiosError.response.status;
102
+ apiError.data = axiosError.response.data;
103
+ throw apiError;
104
+ }
105
+ }
106
+ // For other errors, throw as is
107
+ throw err;
108
+ }
109
+ },
86
110
  retry: false,
111
+ throwOnError: false,
87
112
  },
88
113
  queryClient,
89
114
  );
@@ -171,7 +196,7 @@ export default function Notebook({
171
196
  </Typography>
172
197
  )}
173
198
  {isSuccess &&
174
- notebook.data.notebookCells?.map((cell, index) => (
199
+ notebook.notebookCells?.map((cell, index) => (
175
200
  <NotebookCell
176
201
  cell={cell}
177
202
  notebookPath={notebookPath}
@@ -190,11 +215,10 @@ export default function Notebook({
190
215
  />
191
216
  ))}
192
217
  {isError && (
193
- <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
194
- {(error.message.includes("404") &&
195
- `${notebookPath} does not exist`) ||
196
- `${projectName} > ${packageName} > ${notebookPath} > ${versionId} - ${error.message}`}
197
- </Typography>
218
+ <ApiErrorDisplay
219
+ error={error}
220
+ context={`${projectName} > ${packageName} > ${notebookPath}`}
221
+ />
198
222
  )}
199
223
  </Stack>
200
224
  </StyledCardMedia>
@@ -225,11 +225,13 @@ export function NotebookCell({
225
225
  />
226
226
  </Collapse>
227
227
  {cell.result && !sourcesExpanded && (
228
- <ResultContainer
229
- result={cell.result}
230
- minHeight={200}
231
- maxHeight={800}
232
- />
228
+ <>
229
+ <ResultContainer
230
+ result={cell.result}
231
+ minHeight={300}
232
+ maxHeight={700}
233
+ />
234
+ </>
233
235
  )}
234
236
  </StyledCard>
235
237
  ))
@@ -11,26 +11,16 @@ import { QueryClient, useQuery } from "@tanstack/react-query";
11
11
  import axios from "axios";
12
12
  import { Configuration, PackagesApi } from "../../client";
13
13
  import { StyledCard, StyledCardContent } from "../styles";
14
+ import { usePackage } from "./PackageProvider";
15
+ import { ApiErrorDisplay } from "../ApiErrorDisplay";
14
16
 
15
- axios.defaults.baseURL = "http://localhost:4000";
16
17
  const packagesApi = new PackagesApi(new Configuration());
17
18
  const queryClient = new QueryClient();
18
19
 
19
- interface PackageProps {
20
- server?: string;
21
- projectName: string;
22
- packageName: string;
23
- versionId?: string;
24
- accessToken?: string;
25
- }
20
+ export default function Config() {
21
+ const { server, projectName, packageName, versionId, accessToken } =
22
+ usePackage();
26
23
 
27
- export default function Package({
28
- server,
29
- projectName,
30
- packageName,
31
- versionId,
32
- accessToken,
33
- }: PackageProps) {
34
24
  const { data, isSuccess, isError, error } = useQuery(
35
25
  {
36
26
  queryKey: ["package", server, projectName, packageName, versionId],
@@ -43,6 +33,7 @@ export default function Package({
43
33
  },
44
34
  }),
45
35
  retry: false,
36
+ throwOnError: false,
46
37
  },
47
38
  queryClient,
48
39
  );
@@ -94,9 +85,10 @@ export default function Package({
94
85
  </ListItem>
95
86
  ))}
96
87
  {isError && (
97
- <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
98
- {`${projectName} > ${packageName} > ${versionId} - ${error.message}`}
99
- </Typography>
88
+ <ApiErrorDisplay
89
+ error={error}
90
+ context={`${projectName} > ${packageName} > ${versionId}`}
91
+ />
100
92
  )}
101
93
  </List>
102
94
  </Box>
@@ -11,17 +11,12 @@ import { QueryClient, useQuery } from "@tanstack/react-query";
11
11
  import { Configuration, ConnectionsApi } from "../../client";
12
12
  import { Connection as ApiConnection } from "../../client/api";
13
13
  import { StyledCard, StyledCardContent } from "../styles";
14
+ import { usePackage } from "./PackageProvider";
15
+ import { ApiErrorDisplay } from "../ApiErrorDisplay";
14
16
 
15
17
  const connectionsApi = new ConnectionsApi(new Configuration());
16
18
  const queryClient = new QueryClient();
17
19
 
18
- interface ConnectionsProps {
19
- server?: string;
20
- projectName: string;
21
- accessToken: string;
22
- navigate: (to: string, event?: React.MouseEvent) => void;
23
- }
24
-
25
20
  // TODO(jjs) - Move this UI to the ConnectionExplorer component
26
21
  function Connection({ connection }: { connection: ApiConnection }) {
27
22
  return (
@@ -36,8 +31,9 @@ function Connection({ connection }: { connection: ApiConnection }) {
36
31
  );
37
32
  }
38
33
 
39
- export default function Connections(connectionProps: ConnectionsProps) {
40
- const { server, projectName, accessToken } = connectionProps;
34
+ export default function Connections() {
35
+ const { server, projectName, accessToken } = usePackage();
36
+
41
37
  const { data, isSuccess, isError, error } = useQuery(
42
38
  {
43
39
  queryKey: ["connections", server, projectName],
@@ -50,6 +46,7 @@ export default function Connections(connectionProps: ConnectionsProps) {
50
46
  },
51
47
  }),
52
48
  retry: false,
49
+ throwOnError: false,
53
50
  },
54
51
  queryClient,
55
52
  );
@@ -98,9 +95,10 @@ export default function Connections(connectionProps: ConnectionsProps) {
98
95
  <Typography variant="body2">No Connections</Typography>
99
96
  )}
100
97
  {isError && (
101
- <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
102
- {`${projectName} - ${error.message}`}
103
- </Typography>
98
+ <ApiErrorDisplay
99
+ error={error}
100
+ context={`${projectName} > Connections`}
101
+ />
104
102
  )}
105
103
  </Box>
106
104
  </StyledCardContent>