@malloy-publisher/server 0.12.3 → 0.12.4

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 (26) hide show
  1. package/dist/app/api-doc.yaml +17 -1
  2. package/dist/app/assets/{EnvironmentPage-CewgI-x8.js → EnvironmentPage-gNvDKTtA.js} +1 -1
  3. package/dist/app/assets/{HomePage-B-7xHDxu.js → HomePage-lrIG8Qjk.js} +1 -1
  4. package/dist/app/assets/{MainPage-swHGcEfw.js → MainPage-CJf3Uuul.js} +1 -1
  5. package/dist/app/assets/{ModelPage-BP7XeFQu.js → ModelPage-t_Ln0qr1.js} +2 -2
  6. package/dist/app/assets/{PackagePage-CMIewiLY.js → PackagePage-Cxa0_alv.js} +1 -1
  7. package/dist/app/assets/{PackageSplatRoute-CfR6aEOF.js → PackageSplatRoute-FyScmoYw.js} +2 -2
  8. package/dist/app/assets/{RenderedResult-DqPvGZgL.es-Cga6-xj5.js → RenderedResult-DqPvGZgL.es-BNxk46Vn.js} +1 -1
  9. package/dist/app/assets/{RouteError-JKbL4qo3.js → RouteError-BZUUKmNE.js} +1 -1
  10. package/dist/app/assets/{ThemeEditorPage-DomLLlrf.js → ThemeEditorPage-vDnfPmZz.js} +1 -1
  11. package/dist/app/assets/{ToggleButtonGroup-D5xHfdFe.js → ToggleButtonGroup-DdUWm7cB.js} +1 -1
  12. package/dist/app/assets/{documentRoutes-BxF_zGoi.js → documentRoutes-DtWdqG6B.js} +1 -1
  13. package/dist/app/assets/{editPageMounted-C972ZdQO.js → editPageMounted-vEdUjhAX.js} +2 -2
  14. package/dist/app/assets/{index-Dc7yoJFF.js → index-D-htCO4q.js} +6 -6
  15. package/dist/app/assets/{index-p8cCzaE5.js → index-DYHeNKEh.js} +1 -1
  16. package/dist/app/assets/{index-NoukhIo4.js → index-dUom3Bdm.js} +1 -1
  17. package/dist/app/assets/{index-DhoAPSk5.js → index-diN_kmcj.js} +1 -1
  18. package/dist/app/assets/{index.es-COxgMbi1.js → index.es-DpNxHwgw.js} +1 -1
  19. package/dist/app/assets/usePackageLinkNavigate-D2TepxAX.js +1 -0
  20. package/dist/app/assets/{usePackageRoute-1hM9kuTm.js → usePackageRoute-CjGpnrTp.js} +1 -1
  21. package/dist/app/index.html +1 -1
  22. package/dist/instrumentation.mjs +1 -1
  23. package/dist/package_load_worker.mjs +33 -10
  24. package/dist/server.mjs +4364 -3124
  25. package/package.json +1 -1
  26. package/dist/app/assets/usePackageLinkNavigate-Do-ihosf.js +0 -1
@@ -14328,6 +14328,11 @@ function assertNoAuthorizeTagLike(callerText) {
14328
14328
  lastRefusalKind = "whole_text";
14329
14329
  refuseCallerAuthorizeAnnotation();
14330
14330
  }
14331
+ function assertNoCallerClassificationAnnotation(callerText) {
14332
+ if (!CLASSIFICATION_TAG_LIKE.test(callerText))
14333
+ return;
14334
+ throw new BadRequestError("A `classification` or `carries` annotation is not permitted in " + "caller-submitted Malloy text. Classes are declared by the model " + "author on the field or source; a query is checked against them.");
14335
+ }
14331
14336
  function refuseCallerAuthorizeAnnotation() {
14332
14337
  throw new BadRequestError("An `authorize` annotation is not permitted in caller-submitted Malloy " + "text. Access gates are declared by the model author on the source; a " + "request cannot introduce, replace, or relax one. To validate a gate " + "you are authoring, save it to the package's model file and reload the " + "package — model load validates every `#(authorize)` annotation it " + "declares.");
14333
14338
  }
@@ -14526,7 +14531,7 @@ ${rewrites}
14526
14531
  ` + `Test that the rewrite gates the same rows and check the row count ` + `matches what the string form served.`
14527
14532
  });
14528
14533
  }
14529
- var AUTHORIZE_TAG_LIKE, AUTHORIZE_ANNOTATION_ANYWHERE, REGEXP_SPECIAL, PROSE_ROUTES, makeMalloyParser, parserLoader, warnedNoParser = false, lastLexed, lastRefusalKind = "lexed", lexerMissing = false, GIVEN_REF_PATTERN, SINGLE_QUOTE_ESCAPE, DOUBLE_QUOTE_ESCAPE, STRING_LITERAL_PATTERN, everyMemberOf = () => (...members) => members, ROW_LEVEL_GATE_REJECTION_CAUSES, WHOLE_BODY_QUOTED_STRING, WHOLE_BODY_SINGLE_QUOTED_STRING;
14534
+ var AUTHORIZE_TAG_LIKE, AUTHORIZE_ANNOTATION_ANYWHERE, REGEXP_SPECIAL, PROSE_ROUTES, makeMalloyParser, parserLoader, warnedNoParser = false, lastLexed, lastRefusalKind = "lexed", lexerMissing = false, CLASSIFICATION_TAG_LIKE, GIVEN_REF_PATTERN, SINGLE_QUOTE_ESCAPE, DOUBLE_QUOTE_ESCAPE, STRING_LITERAL_PATTERN, everyMemberOf = () => (...members) => members, ROW_LEVEL_GATE_REJECTION_CAUSES, WHOLE_BODY_QUOTED_STRING, WHOLE_BODY_SINGLE_QUOTED_STRING;
14530
14535
  var init_authorize = __esm(() => {
14531
14536
  init_errors2();
14532
14537
  init_authorize_routes();
@@ -14539,6 +14544,7 @@ var init_authorize = __esm(() => {
14539
14544
  text: "",
14540
14545
  prose: []
14541
14546
  };
14547
+ CLASSIFICATION_TAG_LIKE = new RegExp(String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:classification|carries)(?=[)\]}>]|[ \t]|$)`, "iu");
14542
14548
  GIVEN_REF_PATTERN = /\$([A-Za-z_][A-Za-z0-9_]*)/g;
14543
14549
  SINGLE_QUOTE_ESCAPE = /\\(['\\])/g;
14544
14550
  DOUBLE_QUOTE_ESCAPE = /\\(["\\])/g;
@@ -14731,6 +14737,7 @@ var init_translator_error = __esm(() => {
14731
14737
 
14732
14738
  // src/service/authorize_grammar.ts
14733
14739
  import { routeOf as routeOf3 } from "@malloydata/malloy";
14740
+ import { ParseUtil } from "@malloydata/malloy-tag";
14734
14741
  function noteRoute2(text) {
14735
14742
  return routeOf3({ value: text.trimStart() });
14736
14743
  }
@@ -14894,7 +14901,12 @@ function parseTerm(sourceName, body, term, givenDeclaredTypes) {
14894
14901
  }
14895
14902
  }
14896
14903
  if (leftIsLiteral) {
14897
- return { scope: "source_level", literal: left, given };
14904
+ return {
14905
+ scope: "source_level",
14906
+ literal: ParseUtil.parseString(left, left[0]),
14907
+ given,
14908
+ operator
14909
+ };
14898
14910
  }
14899
14911
  return {
14900
14912
  scope: "row_level",
@@ -15153,10 +15165,13 @@ function resolveDeclaredSource(struct, modelDef) {
15153
15165
  }
15154
15166
  return sawBrokenEntry ? { kind: "unresolvable" } : { kind: "none" };
15155
15167
  }
15168
+ function gateAtLevel(annotations, route) {
15169
+ return collectAuthorizeExprsForRoute(ownLevelNotes(annotations).map((note) => note.text), route);
15170
+ }
15156
15171
  function ancestorGateExprs(struct, modelDef, route, seen = new Set) {
15157
15172
  let inherited = struct.annotations?.inherits;
15158
15173
  for (let depth = 0;inherited && depth < ANCESTOR_WALK_MAX_DEPTH; depth++) {
15159
- const exprs2 = collectAuthorizeExprsForRoute(ownLevelNoteTexts(inherited), route);
15174
+ const exprs2 = gateAtLevel(inherited, route);
15160
15175
  if (exprs2.length > 0)
15161
15176
  return exprs2;
15162
15177
  inherited = inherited.inherits;
@@ -15173,7 +15188,7 @@ function ancestorGateExprs(struct, modelDef, route, seen = new Set) {
15173
15188
  }
15174
15189
  if (declared.kind === "none" || seen.has(declared.source))
15175
15190
  return [];
15176
- const exprs = collectAuthorizeExprsForRoute(ownLevelNoteTexts(declared.source.annotations), route);
15191
+ const exprs = gateAtLevel(declared.source.annotations, route);
15177
15192
  return exprs.length > 0 ? exprs : ancestorGateExprs(declared.source, modelDef, route, seen);
15178
15193
  }
15179
15194
  function resolveQuerySourceBase(struct, modelDef) {
@@ -15203,18 +15218,25 @@ function effectiveAncestorGateExprs(struct, modelDef, route, seen = new Set) {
15203
15218
  groups.push(["false"]);
15204
15219
  }
15205
15220
  } else if (!seen.has(base)) {
15206
- const ownExprs = collectAuthorizeExprsForRoute(ownLevelNoteTexts(base.annotations), route);
15221
+ const ownExprs = gateAtLevel(base.annotations, route);
15207
15222
  groups.push(...ownExprs.length > 0 ? [ownExprs] : effectiveAncestorGateExprs(base, modelDef, route, seen));
15208
15223
  }
15209
15224
  const composite = resolveCompositeResolvedBase(struct);
15210
15225
  if (composite && !seen.has(composite)) {
15211
15226
  const parentOwnNotes = base ? ownLevelNotes(base.annotations) : [];
15212
15227
  const compositeOwnNotes = ownLevelNotes(composite.annotations).filter((note) => !parentOwnNotes.includes(note));
15213
- const compositeOwn = collectAuthorizeExprsForRoute(compositeOwnNotes.map((note) => note.text), route);
15228
+ const compositeOwn = gateAtLevel({ notes: compositeOwnNotes }, route);
15214
15229
  groups.push(...compositeOwn.length > 0 ? [compositeOwn] : effectiveAncestorGateExprs(composite, modelDef, route, seen));
15215
15230
  }
15216
15231
  return groups;
15217
15232
  }
15233
+ function gateExprsForRoute(struct, modelDef, route) {
15234
+ const own = gateAtLevel(struct.annotations, route);
15235
+ if (own.length === 0) {
15236
+ return effectiveAncestorGateExprs(struct, modelDef, route, new Set);
15237
+ }
15238
+ return struct.type === "query_source" ? [own, ...effectiveAncestorGateExprs(struct, modelDef, route, new Set)] : [own];
15239
+ }
15218
15240
  function derivedStructsReachable(roots, modelDef) {
15219
15241
  const seen = new Set(roots);
15220
15242
  const found = [];
@@ -15512,8 +15534,11 @@ function assertAuthorizeGrammarValid(modelDef, authorizeMap, authorizeOwnNotes,
15512
15534
  const struct = modelDef.contents[sourceName];
15513
15535
  const ownGroupTerms = [];
15514
15536
  const declaredAdmitAllRoutes = [];
15537
+ const ownRoutesSeen = new Set;
15515
15538
  for (const { route, exprs } of groups) {
15516
- const isOwn = (authorizeOwnNotes.get(sourceName)?.get(route)?.length ?? 0) > 0;
15539
+ const isOwn = (authorizeOwnNotes.get(sourceName)?.get(route)?.length ?? 0) > 0 && !ownRoutesSeen.has(route);
15540
+ if (isOwn)
15541
+ ownRoutesSeen.add(route);
15517
15542
  const filteredExprs = exprs.filter((expr) => (isOwn || expr !== "false") && !isLegacyQuotedPayload(expr));
15518
15543
  const groupTerms = [];
15519
15544
  for (const expr of filteredExprs) {
@@ -16599,7 +16624,6 @@ function extractSourcesFromModelDef(modelDef, givens, onParseError) {
16599
16624
  onParseError?.(sourceName, err);
16600
16625
  }
16601
16626
  }
16602
- const ownNotes = ownLevelNoteTexts(struct.annotations);
16603
16627
  const ownAuthorizeNotes = ownLevelNotes(struct.annotations).filter((note) => containsAuthorizeAnnotationTag([note.text]));
16604
16628
  const ownNotesByRoute = new Map;
16605
16629
  const attributedOwnNotesByRoute = new Map;
@@ -16613,8 +16637,7 @@ function extractSourcesFromModelDef(modelDef, givens, onParseError) {
16613
16637
  const groupsForSource = [];
16614
16638
  const routeGroupsByRoute = new Map;
16615
16639
  for (const route of CANONICAL_AUTHORIZE_ROUTES) {
16616
- const ownExprsForRoute = collectAuthorizeExprsForRoute(ownNotes, route);
16617
- const groupsForRoute = ownExprsForRoute.length > 0 ? [ownExprsForRoute] : effectiveAncestorGateExprs(struct, modelDef, route);
16640
+ const groupsForRoute = gateExprsForRoute(struct, modelDef, route);
16618
16641
  for (const exprs of groupsForRoute) {
16619
16642
  groupsForSource.push({ route, exprs });
16620
16643
  }