@malloy-publisher/server 0.2.7 → 0.3.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.
Files changed (33) hide show
  1. package/dist/app/api-doc.yaml +39 -1
  2. package/dist/app/assets/{EnvironmentPage-CKXJ6QGP.js → EnvironmentPage-CMNz23OH.js} +1 -1
  3. package/dist/app/assets/{HomePage-DghEH50P.js → HomePage-CIFBQm1O.js} +1 -1
  4. package/dist/app/assets/{LightMode-DzHSrjJH.js → LightMode-230hA2MG.js} +1 -1
  5. package/dist/app/assets/{MainPage-Cj5zf5FO.js → MainPage-DBgaP8G6.js} +2 -2
  6. package/dist/app/assets/{MaterializationsPage-BzNjmRO4.js → MaterializationsPage-B5tdbpRJ.js} +1 -1
  7. package/dist/app/assets/ModelPage-A6Kd1_wx.js +2 -0
  8. package/dist/app/assets/{PackagePage-C_e4oVtx.js → PackagePage-JUM3EcgJ.js} +1 -1
  9. package/dist/app/assets/RenderedResult-mDE-4u8S.es-s0zwv__L.js +116 -0
  10. package/dist/app/assets/{RouteError-DfNOfBXe.js → RouteError-BJAZkbpg.js} +1 -1
  11. package/dist/app/assets/{ThemeEditorPage-CGkhNJr8.js → ThemeEditorPage-a0QNervK.js} +1 -1
  12. package/dist/app/assets/core-B8oMW4sm.es-hOkwvru5.js +148 -0
  13. package/dist/app/assets/index-B5_U5YBb.js +1 -0
  14. package/dist/app/assets/index-BR3mOYNn.js +1322 -0
  15. package/dist/app/assets/{index-B07Dq5kA.js → index-CNMFq7Ua.js} +1 -1
  16. package/dist/app/assets/index-CRAwrhYM.js +2 -0
  17. package/dist/app/assets/index-DUqldpo0.css +1 -0
  18. package/dist/app/assets/index-DplzDOL2.js +453 -0
  19. package/dist/app/assets/index-JaIfCAcq.js +443 -0
  20. package/dist/app/assets/index.es-CB4dOn75.js +106 -0
  21. package/dist/app/index.html +2 -2
  22. package/dist/instrumentation.mjs +62738 -42960
  23. package/dist/package_load_worker.mjs +78 -3
  24. package/dist/server.mjs +61676 -40040
  25. package/dist/sshcrypto-xqan60jb.node +0 -0
  26. package/package.json +1 -1
  27. package/dist/app/assets/ModelPage-Dl4N2pr_.js +0 -1
  28. package/dist/app/assets/WorkbookPage-WwPVhKNa.js +0 -1
  29. package/dist/app/assets/core-BY7vB5gN.es-BZH9lmb3.js +0 -148
  30. package/dist/app/assets/index-5eLCcNmP.css +0 -1
  31. package/dist/app/assets/index-BW-8erNY.js +0 -632
  32. package/dist/app/assets/index-Ca7nDqKT.js +0 -2
  33. package/dist/app/assets/index-Kff4bm9s.js +0 -1774
@@ -14820,6 +14820,9 @@ var init_motly = __esm(() => {
14820
14820
  });
14821
14821
 
14822
14822
  // src/service/given.ts
14823
+ import {
14824
+ isSourceDef as isSourceDef5
14825
+ } from "@malloydata/malloy";
14823
14826
  function presentText(tag, ...path) {
14824
14827
  const raw = tagText(tag, ...path);
14825
14828
  return raw !== undefined && raw.trim() !== "" ? raw : undefined;
@@ -14875,8 +14878,78 @@ function malloyGivenToApi(given) {
14875
14878
  default: given._internal?.defaultText
14876
14879
  };
14877
14880
  }
14881
+ function collectGivenRefs(value, into) {
14882
+ if (Array.isArray(value)) {
14883
+ for (const item of value)
14884
+ collectGivenRefs(item, into);
14885
+ return;
14886
+ }
14887
+ if (value === null || typeof value !== "object")
14888
+ return;
14889
+ const node = value;
14890
+ if (node.node === "given" && typeof node.refName === "string") {
14891
+ into.add(node.refName);
14892
+ }
14893
+ for (const child of Object.values(node))
14894
+ collectGivenRefs(child, into);
14895
+ }
14896
+ function suggestGivenLookup(modelDef, authorizeBySource, surfaced) {
14897
+ const registry = modelDef.givens ?? {};
14898
+ const bySource = new Map;
14899
+ const byQuery = new Map;
14900
+ for (const obj of Object.values(modelDef.contents)) {
14901
+ if (isSourceDef5(obj)) {
14902
+ const name = obj.as || obj.name;
14903
+ const refs = new Set;
14904
+ collectGivenRefs(obj.filterList, refs);
14905
+ for (const expr of authorizeBySource(name) ?? []) {
14906
+ for (const given of referencedGivenNames(expr))
14907
+ refs.add(given);
14908
+ }
14909
+ bySource.set(name, Array.from(refs));
14910
+ } else if (obj.type === "query") {
14911
+ const query = obj;
14912
+ byQuery.set(query.as || query.name, {
14913
+ own: (query.givenUsage ?? []).map((usage) => registry[usage.id]?.name).filter((n) => n !== undefined),
14914
+ source: typeof query.structRef === "string" ? query.structRef : undefined
14915
+ });
14916
+ }
14917
+ }
14918
+ const narrow = (names) => Array.from(new Set(names)).filter((name) => surfaced === undefined || surfaced.has(name));
14919
+ return {
14920
+ forSource: (name) => {
14921
+ const found = bySource.get(name);
14922
+ return found && narrow(found);
14923
+ },
14924
+ forQuery: (name) => {
14925
+ const found = byQuery.get(name);
14926
+ if (!found)
14927
+ return;
14928
+ return narrow([
14929
+ ...found.own,
14930
+ ...found.source ? bySource.get(found.source) ?? [] : []
14931
+ ]);
14932
+ }
14933
+ };
14934
+ }
14935
+ function suggestGivenNames(suggest, lookup) {
14936
+ const names = suggest.query !== undefined ? lookup.forQuery(suggest.query) : suggest.source !== undefined ? lookup.forSource(suggest.source) : undefined;
14937
+ return names && names.length > 0 ? names : undefined;
14938
+ }
14939
+ function attachSuggestGivenNames(givens, lookup) {
14940
+ for (const given of givens ?? []) {
14941
+ if (!given.suggest)
14942
+ continue;
14943
+ const names = suggestGivenNames(given.suggest, lookup);
14944
+ if (names)
14945
+ given.suggest.givenNames = names;
14946
+ else
14947
+ delete given.suggest.givenNames;
14948
+ }
14949
+ }
14878
14950
  var init_given = __esm(() => {
14879
14951
  init_annotations();
14952
+ init_authorize();
14880
14953
  init_motly();
14881
14954
  });
14882
14955
 
@@ -14914,7 +14987,7 @@ init_gate_dimension();
14914
14987
  var import_recursive_readdir = __toESM(require_recursive_readdir(), 1);
14915
14988
  import {
14916
14989
  contextOverlay,
14917
- isSourceDef as isSourceDef5,
14990
+ isSourceDef as isSourceDef6,
14918
14991
  MalloyConfig,
14919
14992
  MalloyError as MalloyError2,
14920
14993
  modelDefToModelInfo,
@@ -15415,6 +15488,7 @@ async function compileMalloyModel(job, malloyConfig, modelPath) {
15415
15488
  authorizeOwnNotes,
15416
15489
  attributedAuthorizeOwnNotes
15417
15490
  } = extractSources(modelDef, givens);
15491
+ attachSuggestGivenNames(givens, suggestGivenLookup(modelDef, (name) => sources.find((source) => source.name === name)?.authorize, new Set((givens ?? []).map((given) => given.name))));
15418
15492
  const queryResult = extractQueries(modelDef);
15419
15493
  const queries = queryResult.queries;
15420
15494
  assertPartitionAnnotationsValid(modelDef);
@@ -15434,7 +15508,7 @@ async function compileMalloyModel(job, malloyConfig, modelPath) {
15434
15508
  onRowLevelGateUnexpressible: authorizeWarningCollection.onRowLevelGateUnexpressible,
15435
15509
  onOwnRowLevelConditionCompiled: (sourceName, condition) => {
15436
15510
  const struct = modelDef.contents[sourceName];
15437
- if (!struct || !isSourceDef5(struct))
15511
+ if (!struct || !isSourceDef6(struct))
15438
15512
  return;
15439
15513
  validateSourceLineGateGivenUsage(sourceName, struct, condition.refSummary, condition.e, modelDef, (cause, detail) => {
15440
15514
  recordRowLevelGateRejected(cause);
@@ -15553,6 +15627,7 @@ async function compileNotebookModel(job, malloyConfig, modelPath) {
15553
15627
  finalSourceInfos = collected.sourceInfos;
15554
15628
  const extracted = extractSources(finalModelDef, finalGivens);
15555
15629
  finalSources = extracted.sources;
15630
+ attachSuggestGivenNames(finalGivens, suggestGivenLookup(finalModelDef, (name) => extracted.sources.find((source) => source.name === name)?.authorize, new Set((finalGivens ?? []).map((given) => given.name))));
15556
15631
  finalFilterMap = extracted.filterMap;
15557
15632
  const finalQueryResult = extractQueries(finalModelDef);
15558
15633
  finalQueries = finalQueryResult.queries;
@@ -15573,7 +15648,7 @@ async function compileNotebookModel(job, malloyConfig, modelPath) {
15573
15648
  onRowLevelGateUnexpressible: authorizeWarningCollection.onRowLevelGateUnexpressible,
15574
15649
  onOwnRowLevelConditionCompiled: (sourceName, condition) => {
15575
15650
  const struct = finalCompiledModelDef.contents[sourceName];
15576
- if (!struct || !isSourceDef5(struct))
15651
+ if (!struct || !isSourceDef6(struct))
15577
15652
  return;
15578
15653
  validateSourceLineGateGivenUsage(sourceName, struct, condition.refSummary, condition.e, finalCompiledModelDef, (cause, detail) => {
15579
15654
  recordRowLevelGateRejected(cause);