@malloy-publisher/sdk 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1006,7 +1006,16 @@ type DocumentType = "dashboard" | "notebook";
1006
1006
  interface Workspace {
1007
1007
  name: string;
1008
1008
  writeable: boolean;
1009
+ /** What this place is, in the backend's own words. The editor shows it. */
1009
1010
  description: string;
1011
+ /**
1012
+ * This workspace holds the package's system of record: the editor opens
1013
+ * what it keeps and writes back to it, and treats the package file as a
1014
+ * deploy of it. Left out, the package file is the record and this is a
1015
+ * place a copy is kept beside it, which is what every host got before the
1016
+ * flag existed. At most one workspace per storage sets it.
1017
+ */
1018
+ authoritative?: boolean;
1010
1019
  }
1011
1020
 
1012
1021
  interface DocumentLocator {
@@ -1028,6 +1037,14 @@ interface DocumentStorage {
1028
1037
  }
1029
1038
  ```
1030
1039
 
1040
+ `getDocument`, `deleteDocument` and `moveDocument` reject with `DocumentNotFoundError`
1041
+ when the document is not there, and with anything else when the backend could not be
1042
+ asked. The distinction is load-bearing rather than cosmetic: a failed read reported as
1043
+ "there is no document" reads as "the package is the only copy", and saving on that
1044
+ belief overwrites the copy that was actually there. Use `isDocumentNotFound(error)`
1045
+ rather than `instanceof`, since the `es` and `cjs` builds carry their own copy of the
1046
+ class.
1047
+
1031
1048
  A document is a string; the `type` on its locator says what kind so a backend can keep kinds apart
1032
1049
  and a listing can ask for one. Every method rejects when the document is not there, so a caller can
1033
1050
  tell "missing" from "empty".
@@ -1471,6 +1488,8 @@ function EnvironmentList() {
1471
1488
  | `createEmbeddedQueryResult` | Serialize query config |
1472
1489
  | `BrowserDocumentStorage` | localStorage-based document storage |
1473
1490
  | `globalQueryClient` | Shared React Query client |
1491
+ | `DocumentNotFoundError` | Absence, not a failed read |
1492
+ | `isDocumentNotFound` | Absence check across es/cjs builds |
1474
1493
 
1475
1494
  ### Exported Types
1476
1495
 
@@ -62,7 +62,7 @@ function pa(...e) {
62
62
  function vn(e) {
63
63
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
64
64
  }
65
- function $1(e) {
65
+ function O1(e) {
66
66
  if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
67
67
  var t = e.default;
68
68
  if (typeof t == "function") {
@@ -3093,7 +3093,7 @@ function xm(e, t) {
3093
3093
  const Sm = ut(/* @__PURE__ */ v("path", {
3094
3094
  d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"
3095
3095
  }));
3096
- function O1({
3096
+ function E1({
3097
3097
  label: e,
3098
3098
  onClick: t,
3099
3099
  disabled: n
@@ -3112,7 +3112,7 @@ function O1({
3112
3112
  }
3113
3113
  );
3114
3114
  }
3115
- function E1({
3115
+ function A1({
3116
3116
  label: e,
3117
3117
  icon: t,
3118
3118
  onClick: n,
@@ -3143,7 +3143,7 @@ function E1({
3143
3143
  const Di = ut(/* @__PURE__ */ v("path", {
3144
3144
  d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
3145
3145
  }));
3146
- function A1({
3146
+ function F1({
3147
3147
  open: e,
3148
3148
  onClose: t,
3149
3149
  title: n,
@@ -3214,7 +3214,7 @@ function A1({
3214
3214
  }
3215
3215
  );
3216
3216
  }
3217
- function F1({
3217
+ function L1({
3218
3218
  left: e,
3219
3219
  children: t
3220
3220
  }) {
@@ -5851,7 +5851,7 @@ function Dt(e = []) {
5851
5851
  function hg(e) {
5852
5852
  return xe("MuiTypography", e);
5853
5853
  }
5854
- const L1 = ye("MuiTypography", ["root", "h1", "h2", "h3", "h4", "h5", "h6", "subtitle1", "subtitle2", "body1", "body2", "inherit", "button", "caption", "overline", "alignLeft", "alignRight", "alignCenter", "alignJustify", "noWrap", "gutterBottom", "paragraph"]), gg = {
5854
+ const N1 = ye("MuiTypography", ["root", "h1", "h2", "h3", "h4", "h5", "h6", "subtitle1", "subtitle2", "body1", "body2", "inherit", "button", "caption", "overline", "alignLeft", "alignRight", "alignCenter", "alignJustify", "noWrap", "gutterBottom", "paragraph"]), gg = {
5855
5855
  primary: !0,
5856
5856
  secondary: !0,
5857
5857
  error: !0,
@@ -21550,13 +21550,13 @@ const iP = /* @__PURE__ */ new Set([
21550
21550
  "link",
21551
21551
  "image"
21552
21552
  ]);
21553
- function N1(e, t) {
21553
+ function B1(e, t) {
21554
21554
  return t === "fill" ? "container" : t === "fixed" || !e ? "content" : iP.has(e) ? "container" : "content";
21555
21555
  }
21556
- function B1(e, t) {
21556
+ function V1(e, t) {
21557
21557
  return t === "fixed" ? !0 : t === "fill" ? !1 : e !== void 0 && aP.has(e);
21558
21558
  }
21559
- function V1(e) {
21559
+ function z1(e) {
21560
21560
  return e === "dashboard" ? 3 : 2;
21561
21561
  }
21562
21562
  function lP(e, t) {
@@ -21565,11 +21565,11 @@ function lP(e, t) {
21565
21565
  n = n.firstElementChild;
21566
21566
  return n;
21567
21567
  }
21568
- function z1(e, t) {
21568
+ function W1(e, t) {
21569
21569
  const n = lP(e, t);
21570
21570
  return n && (n.scrollHeight || n.offsetHeight) || 0;
21571
21571
  }
21572
- const cP = 400, W1 = 700, H1 = 600, _1 = 800, uP = 400, jl = 2e3;
21572
+ const cP = 400, H1 = 700, _1 = 600, U1 = 800, uP = 400, jl = 2e3;
21573
21573
  function dP(e) {
21574
21574
  return e === void 0 ? jl : Math.min(e, jl);
21575
21575
  }
@@ -21709,7 +21709,7 @@ function CP(e) {
21709
21709
  `)
21710
21710
  };
21711
21711
  }
21712
- const wP = Cd(() => import("./RenderedResult-BnPzJ9Jf.es.js").then((e) => e.c));
21712
+ const wP = Cd(() => import("./RenderedResult-CvrmYyr5.es.js").then((e) => e.c));
21713
21713
  function PP({
21714
21714
  result: e,
21715
21715
  maxHeight: t,
@@ -21887,7 +21887,7 @@ const cd = 20, OP = {
21887
21887
  radius: "8px",
21888
21888
  padding: `${cd}px`
21889
21889
  };
21890
- function U1(e, t = OP) {
21890
+ function Y1(e, t = OP) {
21891
21891
  return {
21892
21892
  "--malloy-render--font-family": e.font.family,
21893
21893
  "--malloy-render--table-font-size": `${e.font.size}px`,
@@ -23839,7 +23839,7 @@ function tc(e) {
23839
23839
  return e instanceof Date ? Number.isNaN(e.getTime()) ? void 0 : e.toISOString().slice(0, 10) : /^(\d{4}-\d{2}-\d{2})/.exec(String(e))?.[1];
23840
23840
  }
23841
23841
  const fi = "[A-Za-z_][A-Za-z0-9_]*", nc = (e) => new RegExp(`^${fi}$`).test(e);
23842
- function Y1(e, t, n) {
23842
+ function j1(e, t, n) {
23843
23843
  const r = /* @__PURE__ */ new Map(), o = new RegExp(
23844
23844
  `^\\s*${n}:\\s*(${fi})\\s+is\\b\\s*(.*)$`
23845
23845
  );
@@ -23858,14 +23858,14 @@ function Y1(e, t, n) {
23858
23858
  }
23859
23859
  return r;
23860
23860
  }
23861
- function j1(e, t, n) {
23861
+ function G1(e, t, n) {
23862
23862
  const r = new RegExp(`^\\s*${t}:\\s*${n}\\s+is\\b`);
23863
23863
  return e.findIndex((o) => r.test(o));
23864
23864
  }
23865
- const G1 = (e) => e.findIndex(
23865
+ const K1 = (e) => e.findIndex(
23866
23866
  (t) => t.trimStart().startsWith("##") && t.includes("artifact")
23867
23867
  );
23868
- function K1(e) {
23868
+ function q1(e) {
23869
23869
  const t = /* @__PURE__ */ new Map(), n = (o) => /^([A-Z_][A-Z0-9_]*)\s*::/.exec(o)?.[1], r = (o, s, i) => {
23870
23870
  const a = s.trim(), l = n(a);
23871
23871
  l && t.set(l, {
@@ -24079,7 +24079,7 @@ function y1({
24079
24079
  }
24080
24080
  );
24081
24081
  }
24082
- function q1({
24082
+ function Q1({
24083
24083
  resourceUri: e,
24084
24084
  dashboard: t,
24085
24085
  givens: n,
@@ -24295,17 +24295,17 @@ function b1({
24295
24295
  t && /* @__PURE__ */ v(sP, { variant: "caption", children: t })
24296
24296
  ] });
24297
24297
  }
24298
- const Q1 = ut(/* @__PURE__ */ v("path", {
24298
+ const X1 = ut(/* @__PURE__ */ v("path", {
24299
24299
  d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"
24300
24300
  })), sa = wd(void 0);
24301
- function X1({
24301
+ function Z1({
24302
24302
  children: e,
24303
24303
  documentStorage: t
24304
24304
  }) {
24305
24305
  const n = ot(() => ({ documentStorage: t }), [t]);
24306
24306
  return /* @__PURE__ */ v(sa.Provider, { value: n, children: e });
24307
24307
  }
24308
- function Z1() {
24308
+ function J1() {
24309
24309
  const e = ac(sa);
24310
24310
  if (!e)
24311
24311
  throw new Error(
@@ -24313,131 +24313,139 @@ function Z1() {
24313
24313
  );
24314
24314
  return e;
24315
24315
  }
24316
- function J1() {
24316
+ function ek() {
24317
24317
  return ac(sa);
24318
24318
  }
24319
+ class v1 extends Error {
24320
+ constructor(t) {
24321
+ super(t), this.name = "DocumentNotFoundError";
24322
+ }
24323
+ }
24324
+ const tk = (e) => e instanceof v1 || e instanceof Error && e.name === "DocumentNotFoundError";
24319
24325
  export {
24320
- He as $,
24326
+ fr as $,
24321
24327
  Sm as A,
24322
- Gl as B,
24323
- Q1 as C,
24328
+ cP as B,
24329
+ X1 as C,
24324
24330
  cd as D,
24325
- eP as E,
24326
- us as F,
24331
+ Gl as E,
24332
+ eP as F,
24327
24333
  mP as G,
24328
- Yc as H,
24329
- pe as I,
24330
- Kc as J,
24331
- Le as K,
24334
+ us as H,
24335
+ Yc as I,
24336
+ pe as J,
24337
+ Kc as K,
24332
24338
  Qr as L,
24333
- no as M,
24334
- mt as N,
24335
- xe as O,
24339
+ Le as M,
24340
+ no as N,
24341
+ mt as O,
24336
24342
  sP as P,
24337
- ye as Q,
24338
- $e as R,
24339
- E1 as S,
24343
+ xe as Q,
24344
+ ye as R,
24345
+ A1 as S,
24340
24346
  EP as T,
24341
- _ as U,
24342
- fe as V,
24343
- ve as W,
24344
- hr as X,
24345
- Te as Y,
24346
- Kp as Z,
24347
- fr as _,
24348
- B1 as a,
24349
- uP as a$,
24350
- jo as a0,
24351
- ce as a1,
24352
- oh as a2,
24353
- O1 as a3,
24354
- Yd as a4,
24355
- rm as a5,
24356
- to as a6,
24357
- zr as a7,
24358
- zn as a8,
24359
- L1 as a9,
24360
- vP as aA,
24361
- PP as aB,
24362
- _1 as aC,
24363
- ad as aD,
24364
- xP as aE,
24365
- ld as aF,
24366
- H1 as aG,
24367
- ud as aH,
24368
- a1 as aI,
24369
- l1 as aJ,
24370
- ih as aK,
24371
- W1 as aL,
24372
- Ti as aM,
24373
- Zs as aN,
24374
- q1 as aO,
24375
- Bs as aP,
24376
- $c as aQ,
24377
- cs as aR,
24378
- zm as aS,
24379
- Oc as aT,
24380
- Vm as aU,
24381
- Wm as aV,
24382
- Xw as aW,
24383
- o1 as aX,
24384
- jl as aY,
24385
- dP as aZ,
24386
- pP as a_,
24387
- lt as aa,
24388
- jr as ab,
24389
- Yt as ac,
24390
- Yu as ad,
24391
- mr as ae,
24392
- go as af,
24393
- sh as ag,
24394
- ze as ah,
24395
- Au as ai,
24396
- Eu as aj,
24397
- Uu as ak,
24398
- r1 as al,
24399
- uu as am,
24400
- Ho as an,
24401
- ei as ao,
24402
- qo as ap,
24403
- Tc as aq,
24404
- c1 as ar,
24405
- $1 as as,
24406
- vn as at,
24407
- Di as au,
24408
- Ft as av,
24409
- jt as aw,
24410
- xm as ax,
24411
- Dt as ay,
24412
- gr as az,
24413
- U1 as b,
24414
- X1 as b0,
24415
- Z1 as b1,
24416
- Xm as b2,
24417
- th as b3,
24418
- bP as b4,
24347
+ $e as U,
24348
+ _ as V,
24349
+ fe as W,
24350
+ ve as X,
24351
+ hr as Y,
24352
+ Te as Z,
24353
+ Kp as _,
24354
+ V1 as a,
24355
+ dP as a$,
24356
+ He as a0,
24357
+ jo as a1,
24358
+ ce as a2,
24359
+ oh as a3,
24360
+ E1 as a4,
24361
+ Yd as a5,
24362
+ rm as a6,
24363
+ to as a7,
24364
+ zr as a8,
24365
+ zn as a9,
24366
+ gr as aA,
24367
+ vP as aB,
24368
+ PP as aC,
24369
+ U1 as aD,
24370
+ ad as aE,
24371
+ xP as aF,
24372
+ ld as aG,
24373
+ _1 as aH,
24374
+ ud as aI,
24375
+ a1 as aJ,
24376
+ l1 as aK,
24377
+ ih as aL,
24378
+ H1 as aM,
24379
+ Ti as aN,
24380
+ Zs as aO,
24381
+ v1 as aP,
24382
+ Q1 as aQ,
24383
+ Bs as aR,
24384
+ $c as aS,
24385
+ cs as aT,
24386
+ zm as aU,
24387
+ Oc as aV,
24388
+ Vm as aW,
24389
+ Wm as aX,
24390
+ Xw as aY,
24391
+ o1 as aZ,
24392
+ jl as a_,
24393
+ N1 as aa,
24394
+ lt as ab,
24395
+ jr as ac,
24396
+ Yt as ad,
24397
+ Yu as ae,
24398
+ mr as af,
24399
+ go as ag,
24400
+ sh as ah,
24401
+ ze as ai,
24402
+ Au as aj,
24403
+ Eu as ak,
24404
+ Uu as al,
24405
+ r1 as am,
24406
+ uu as an,
24407
+ Ho as ao,
24408
+ ei as ap,
24409
+ qo as aq,
24410
+ Tc as ar,
24411
+ c1 as as,
24412
+ O1 as at,
24413
+ vn as au,
24414
+ Di as av,
24415
+ Ft as aw,
24416
+ jt as ax,
24417
+ xm as ay,
24418
+ Dt as az,
24419
+ Y1 as b,
24420
+ pP as b0,
24421
+ uP as b1,
24422
+ Z1 as b2,
24423
+ J1 as b3,
24424
+ Xm as b4,
24425
+ th as b5,
24426
+ bP as b6,
24419
24427
  lP as c,
24420
- V1 as d,
24428
+ z1 as d,
24421
24429
  ut as e,
24422
- F1 as f,
24423
- A1 as g,
24430
+ L1 as f,
24431
+ F1 as g,
24424
24432
  AP as h,
24425
- Y1 as i,
24426
- K1 as j,
24427
- G1 as k,
24428
- j1 as l,
24429
- z1 as m,
24433
+ j1 as i,
24434
+ q1 as j,
24435
+ K1 as k,
24436
+ G1 as l,
24437
+ W1 as m,
24430
24438
  fP as n,
24431
24439
  rc as o,
24432
24440
  b1 as p,
24433
24441
  gP as q,
24434
- N1 as r,
24442
+ B1 as r,
24435
24443
  u1 as s,
24436
24444
  p1 as t,
24437
- J1 as u,
24445
+ ek as u,
24438
24446
  Ri as v,
24439
- vi as w,
24440
- rh as x,
24441
- Kl as y,
24442
- cP as z
24447
+ tk as w,
24448
+ vi as x,
24449
+ rh as y,
24450
+ Kl as z
24443
24451
  };