@malloy-publisher/server 0.18.0 → 0.18.2
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/app/api-doc.yaml +37 -6
- package/dist/app/assets/{EnvironmentPage-BYi5H87v.js → EnvironmentPage-CsFUI8IX.js} +1 -1
- package/dist/app/assets/{HomePage-DB-CSs0p.js → HomePage-B_FVtnN-.js} +1 -1
- package/dist/app/assets/{MainPage-2j-MpcYJ.js → MainPage-wFF9nPEr.js} +1 -1
- package/dist/app/assets/{ModelPage-BQE-ZC6E.js → ModelPage-CxenqDcz.js} +2 -2
- package/dist/app/assets/PackagePage-dcF6vrvw.js +1 -0
- package/dist/app/assets/PackageSplatRoute-CASBZk0k.js +2 -0
- package/dist/app/assets/{RenderedResult-QdYnecnr.es-PKDmuES7.js → RenderedResult--fYcsY1h.es-DzOt5Lwv.js} +3 -3
- package/dist/app/assets/{RouteError-7Fw_wYUy.js → RouteError-CUIolYwb.js} +1 -1
- package/dist/app/assets/{ThemeEditorPage-DmiRg7rU.js → ThemeEditorPage-DgU2YYq6.js} +1 -1
- package/dist/app/assets/{ToggleButtonGroup-BXVbLuei.js → ToggleButtonGroup-Dmr-hVlD.js} +1 -1
- package/dist/app/assets/{documentRoutes-DWIPC8nU.js → documentRoutes-Drv-WDwO.js} +1 -1
- package/dist/app/assets/{editPageMounted-BaGHeFZ5.js → editPageMounted-C5yJiIVi.js} +2 -2
- package/dist/app/assets/{index-CHfKShi-.js → index-BIoSdsU9.js} +1 -1
- package/dist/app/assets/{index-OQqQyWrE.js → index-BSyL0zds.js} +97 -97
- package/dist/app/assets/{index-BRdik0lA.js → index-Dtw4eTxH.js} +1 -1
- package/dist/app/assets/{index-APmAmrTn.js → index-DxF3kMLJ.js} +1 -1
- package/dist/app/assets/{index.es-DLFu6xFm.js → index.es-CX9m4CBD.js} +10 -10
- package/dist/app/assets/usePackageLinkNavigate-qNjcXPcY.js +1 -0
- package/dist/app/assets/{usePackageRoute-pIAy965Q.js → usePackageRoute-wJGaZEiY.js} +1 -1
- package/dist/app/index.html +1 -1
- package/dist/instrumentation.mjs +16 -7
- package/dist/package_load_worker.mjs +172 -68
- package/dist/runtime/publisher.colorScheme.spec.ts +167 -0
- package/dist/runtime/publisher.js +173 -3
- package/dist/runtime/publisher_embed.spec.ts +108 -0
- package/dist/server.mjs +1652 -614
- package/package.json +1 -1
- package/dist/app/assets/PackagePage-BMv6ojk4.js +0 -1
- package/dist/app/assets/PackageSplatRoute-BOAFRQKR.js +0 -2
- package/dist/app/assets/usePackageLinkNavigate-DTlEYsed.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as u,r as c}from"./index-BSyL0zds.js";import{w as e}from"./usePackageRoute-wJGaZEiY.js";function p(t,a,r){const s=u();return c.useCallback((o,i)=>s(e(o,t,a,r),i),[s,t,a,r])}export{p as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as f,a9 as p}from"./index-
|
|
1
|
+
import{C as f,a9 as p}from"./index-BSyL0zds.js";const $=/^(latest|[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?)$/,m="latest",l=e=>$.test(e),g=e=>{const n=e.indexOf("/"),o=n===-1?e:e.slice(0,n);if(l(o))return{segment:o,rest:n===-1?"":e.slice(n+1)}},h=e=>e===void 0||e===m?void 0:e,I=(e,n,o)=>`/${encodeURIComponent(e)}/${encodeURIComponent(n)}${o===void 0?"":`/${encodeURIComponent(o)}`}`,E=(e,n,o,t)=>{if(t===void 0)return e;const i=[`/${encodeURIComponent(n)}/${encodeURIComponent(o)}`,`/${n}/${o}`];for(const s of i){if(e!==s&&!e.startsWith(`${s}/`))continue;const r=e.slice(s.length).replace(/^\//,"");return`${I(n,o,t)}${r===""?"":`/${r}`}`}return e};function R(e={}){const n=f(),o=n.environmentName,t=n.packageName,i=n["*"],s=i===void 0?void 0:g(i),{versions:r,isPending:d,isError:v,refetch:u}=p(o??"",t??"",{enabled:e.always===!0||s!==void 0}),a=r.length>0,c=s&&a?s:void 0;return{environmentName:o,packageName:t,versionSegment:c?.segment,versionId:h(c?.segment),path:c?c.rest:i,versioned:a,deciding:s!==void 0&&d,undecided:s!==void 0&&v,retry:u,writable:!a&&!d&&!v}}export{m as L,I as p,R as u,h as v,E as w};
|
package/dist/app/index.html
CHANGED
|
@@ -16,7 +16,7 @@ SPDX-License-Identifier: MIT
|
|
|
16
16
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
|
|
17
17
|
/>
|
|
18
18
|
<title>Malloy Publisher</title>
|
|
19
|
-
<script type="module" crossorigin src="/assets/index-
|
|
19
|
+
<script type="module" crossorigin src="/assets/index-BSyL0zds.js"></script>
|
|
20
20
|
<link rel="stylesheet" crossorigin href="/assets/index-DUqldpo0.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
package/dist/instrumentation.mjs
CHANGED
|
@@ -556,7 +556,7 @@ var init_launch = __esm(() => {
|
|
|
556
556
|
default: false,
|
|
557
557
|
kind: "launch",
|
|
558
558
|
description: "Wipe persisted storage and re-sync it from the config.",
|
|
559
|
-
notes: "Set to `true` (or pass `--init`) to **wipe persisted storage** (`publisher_data/`) and re-sync it from the config on boot. A first boot with empty storage loads the config automatically, so you only need this to reset state or pick up config changes. Also exposed as the `start:init` / `start:dev:init` scripts.",
|
|
559
|
+
notes: "Set to `true` (or pass `--init`) to **wipe persisted storage** (`publisher_data/`) and re-sync it from the config on boot. A first boot with empty storage loads the config automatically, so you only need this to reset state or pick up config changes. The search index (stored value reads, embeddings and LLM output) is kept, since each entry is reused only while what it was built from is unchanged; the rows of a package the config no longer lists are deleted. Also exposed as the `start:init` / `start:dev:init` scripts.",
|
|
560
560
|
shortFlags: ["--init"],
|
|
561
561
|
aliases: {
|
|
562
562
|
env: ["INITIALIZE_STORAGE"],
|
|
@@ -810,7 +810,7 @@ var init_provider_names = __esm(() => {
|
|
|
810
810
|
var EGRESS_PRESETS, DEFAULT_LLM_TIMEOUT_MS = 30000, DEFAULT_LLM_CONCURRENCY = 4, DEFAULT_LLM_MAX_CALLS_PER_SYNC = 300, DEFAULT_LLM_MAX_CALLS_PER_REQUEST = 20, DIMENSION_VALUE_DEFAULTS;
|
|
811
811
|
var init_defaults = __esm(() => {
|
|
812
812
|
EGRESS_PRESETS = ["default", "full"];
|
|
813
|
-
DIMENSION_VALUE_DEFAULTS = { enabled: true };
|
|
813
|
+
DIMENSION_VALUE_DEFAULTS = { enabled: true, givens: {} };
|
|
814
814
|
});
|
|
815
815
|
|
|
816
816
|
// src/settings/registry/retrieval.ts
|
|
@@ -825,7 +825,7 @@ var init_retrieval = __esm(() => {
|
|
|
825
825
|
key: "retrieval",
|
|
826
826
|
type: structured(),
|
|
827
827
|
kind: "structured",
|
|
828
|
-
description: "Semantic retrieval: indexing limits, the LLM, the embedding provider and
|
|
828
|
+
description: "Semantic retrieval: indexing limits, the LLM, the embedding provider and value search.",
|
|
829
829
|
aliases: { file: ["retrieval"] }
|
|
830
830
|
}),
|
|
831
831
|
setting({
|
|
@@ -926,9 +926,9 @@ var init_retrieval = __esm(() => {
|
|
|
926
926
|
setting({
|
|
927
927
|
key: "retrieval.egress.preset",
|
|
928
928
|
type: oneOf(EGRESS_PRESETS),
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
929
|
+
description: "No longer read: #(index) alone decides whether a dimension's values reach the embedding provider and LLM. Setting it logs a startup warning.",
|
|
930
|
+
notes: "Retired. An earlier release sent `#(index)` values to the embedding provider and the LLM only under `full`. Now the `#(index)` tag decides, as it does on a hosted index. To keep values on the machine, leave `EMBEDDING_API_KEY` unset, set `retrieval.fcj.valueEmbeddings` to `false` in the package's `publisher.json`, or set `retrieval.dimensionValues.enabled` to `false`. Access predicates (`#(access_filter)`, `#(authorize)`) never leave.",
|
|
931
|
+
defaultText: "_ignored_",
|
|
932
932
|
aliases: { file: ["retrieval.egress.preset"] }
|
|
933
933
|
}),
|
|
934
934
|
setting({
|
|
@@ -941,6 +941,15 @@ var init_retrieval = __esm(() => {
|
|
|
941
941
|
today: { file: "json-boolean" }
|
|
942
942
|
}
|
|
943
943
|
}),
|
|
944
|
+
setting({
|
|
945
|
+
key: "retrieval.dimensionValues.givens",
|
|
946
|
+
type: structured(),
|
|
947
|
+
kind: "structured",
|
|
948
|
+
description: "Local development: per package, the givens the value index reads with, so a source gated by `column = $GIVEN` is indexed for the listed values only.",
|
|
949
|
+
notes: 'An object of packages, each an object of givens, each one value or a list: `{ "<package>": { "REPORT_ID": [123, 456] } }`. Each `#(index)` dimension is read once per combination of the listed values (at most 50), through its gate. A source gated by `column = $GIVEN` is skipped unless its given is listed here. Never published with a package, and not a way to limit what hosted Credible indexes. See "Dimension value search" below.',
|
|
950
|
+
defaultText: "_unset_ (gated sources skipped)",
|
|
951
|
+
aliases: { file: ["retrieval.dimensionValues.givens"] }
|
|
952
|
+
}),
|
|
944
953
|
setting({
|
|
945
954
|
key: "retrieval.embedding.apiKey",
|
|
946
955
|
type: string(),
|
|
@@ -167076,7 +167085,7 @@ var init_telemetry = __esm(() => {
|
|
|
167076
167085
|
});
|
|
167077
167086
|
|
|
167078
167087
|
// package.json
|
|
167079
|
-
var version = "0.18.
|
|
167088
|
+
var version = "0.18.2";
|
|
167080
167089
|
var init_package = () => {};
|
|
167081
167090
|
|
|
167082
167091
|
// src/version.ts
|
|
@@ -979,7 +979,7 @@ var init_launch = __esm(() => {
|
|
|
979
979
|
default: false,
|
|
980
980
|
kind: "launch",
|
|
981
981
|
description: "Wipe persisted storage and re-sync it from the config.",
|
|
982
|
-
notes: "Set to `true` (or pass `--init`) to **wipe persisted storage** (`publisher_data/`) and re-sync it from the config on boot. A first boot with empty storage loads the config automatically, so you only need this to reset state or pick up config changes. Also exposed as the `start:init` / `start:dev:init` scripts.",
|
|
982
|
+
notes: "Set to `true` (or pass `--init`) to **wipe persisted storage** (`publisher_data/`) and re-sync it from the config on boot. A first boot with empty storage loads the config automatically, so you only need this to reset state or pick up config changes. The search index (stored value reads, embeddings and LLM output) is kept, since each entry is reused only while what it was built from is unchanged; the rows of a package the config no longer lists are deleted. Also exposed as the `start:init` / `start:dev:init` scripts.",
|
|
983
983
|
shortFlags: ["--init"],
|
|
984
984
|
aliases: {
|
|
985
985
|
env: ["INITIALIZE_STORAGE"],
|
|
@@ -1233,7 +1233,7 @@ var init_provider_names = __esm(() => {
|
|
|
1233
1233
|
var EGRESS_PRESETS, DEFAULT_LLM_TIMEOUT_MS = 30000, DEFAULT_LLM_CONCURRENCY = 4, DEFAULT_LLM_MAX_CALLS_PER_SYNC = 300, DEFAULT_LLM_MAX_CALLS_PER_REQUEST = 20, DIMENSION_VALUE_DEFAULTS;
|
|
1234
1234
|
var init_defaults = __esm(() => {
|
|
1235
1235
|
EGRESS_PRESETS = ["default", "full"];
|
|
1236
|
-
DIMENSION_VALUE_DEFAULTS = { enabled: true };
|
|
1236
|
+
DIMENSION_VALUE_DEFAULTS = { enabled: true, givens: {} };
|
|
1237
1237
|
});
|
|
1238
1238
|
|
|
1239
1239
|
// src/settings/registry/retrieval.ts
|
|
@@ -1248,7 +1248,7 @@ var init_retrieval = __esm(() => {
|
|
|
1248
1248
|
key: "retrieval",
|
|
1249
1249
|
type: structured(),
|
|
1250
1250
|
kind: "structured",
|
|
1251
|
-
description: "Semantic retrieval: indexing limits, the LLM, the embedding provider and
|
|
1251
|
+
description: "Semantic retrieval: indexing limits, the LLM, the embedding provider and value search.",
|
|
1252
1252
|
aliases: { file: ["retrieval"] }
|
|
1253
1253
|
}),
|
|
1254
1254
|
setting({
|
|
@@ -1349,9 +1349,9 @@ var init_retrieval = __esm(() => {
|
|
|
1349
1349
|
setting({
|
|
1350
1350
|
key: "retrieval.egress.preset",
|
|
1351
1351
|
type: oneOf(EGRESS_PRESETS),
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1352
|
+
description: "No longer read: #(index) alone decides whether a dimension's values reach the embedding provider and LLM. Setting it logs a startup warning.",
|
|
1353
|
+
notes: "Retired. An earlier release sent `#(index)` values to the embedding provider and the LLM only under `full`. Now the `#(index)` tag decides, as it does on a hosted index. To keep values on the machine, leave `EMBEDDING_API_KEY` unset, set `retrieval.fcj.valueEmbeddings` to `false` in the package's `publisher.json`, or set `retrieval.dimensionValues.enabled` to `false`. Access predicates (`#(access_filter)`, `#(authorize)`) never leave.",
|
|
1354
|
+
defaultText: "_ignored_",
|
|
1355
1355
|
aliases: { file: ["retrieval.egress.preset"] }
|
|
1356
1356
|
}),
|
|
1357
1357
|
setting({
|
|
@@ -1364,6 +1364,15 @@ var init_retrieval = __esm(() => {
|
|
|
1364
1364
|
today: { file: "json-boolean" }
|
|
1365
1365
|
}
|
|
1366
1366
|
}),
|
|
1367
|
+
setting({
|
|
1368
|
+
key: "retrieval.dimensionValues.givens",
|
|
1369
|
+
type: structured(),
|
|
1370
|
+
kind: "structured",
|
|
1371
|
+
description: "Local development: per package, the givens the value index reads with, so a source gated by `column = $GIVEN` is indexed for the listed values only.",
|
|
1372
|
+
notes: 'An object of packages, each an object of givens, each one value or a list: `{ "<package>": { "REPORT_ID": [123, 456] } }`. Each `#(index)` dimension is read once per combination of the listed values (at most 50), through its gate. A source gated by `column = $GIVEN` is skipped unless its given is listed here. Never published with a package, and not a way to limit what hosted Credible indexes. See "Dimension value search" below.',
|
|
1373
|
+
defaultText: "_unset_ (gated sources skipped)",
|
|
1374
|
+
aliases: { file: ["retrieval.dimensionValues.givens"] }
|
|
1375
|
+
}),
|
|
1367
1376
|
setting({
|
|
1368
1377
|
key: "retrieval.embedding.apiKey",
|
|
1369
1378
|
type: string(),
|
|
@@ -13357,13 +13366,15 @@ var init_errors2 = __esm(() => {
|
|
|
13357
13366
|
};
|
|
13358
13367
|
ManifestBindFailedError = class ManifestBindFailedError extends Error {
|
|
13359
13368
|
applied;
|
|
13369
|
+
problem;
|
|
13360
13370
|
get kind() {
|
|
13361
13371
|
return "manifest_bind_failed";
|
|
13362
13372
|
}
|
|
13363
|
-
constructor(manifestLocation, cause, applied) {
|
|
13373
|
+
constructor(manifestLocation, cause, applied, problem) {
|
|
13364
13374
|
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
13365
13375
|
super(`The build manifest ${manifestLocation} could not be bound ` + `(${detail}), so it was not applied: the package serves what ` + `it served before.`, { cause });
|
|
13366
13376
|
this.applied = applied;
|
|
13377
|
+
this.problem = problem;
|
|
13367
13378
|
this.name = "ManifestBindFailedError";
|
|
13368
13379
|
}
|
|
13369
13380
|
};
|
|
@@ -13826,8 +13837,8 @@ var init_errors2 = __esm(() => {
|
|
|
13826
13837
|
connection_save: { status: 500, mcp: { advice: "internal" } },
|
|
13827
13838
|
write_rolled_back: { status: 500, mcp: { advice: "internal" } },
|
|
13828
13839
|
manifest_bind_failed: {
|
|
13829
|
-
status: 500,
|
|
13830
|
-
reason: "MANIFEST_BIND_FAILED",
|
|
13840
|
+
status: (error) => error.problem === "not_found" ? 400 : error.problem === "invalid" ? 422 : 500,
|
|
13841
|
+
reason: (error) => error.problem === "not_found" ? "MANIFEST_NOT_FOUND" : error.problem === "invalid" ? "MANIFEST_INVALID" : "MANIFEST_BIND_FAILED",
|
|
13831
13842
|
mcp: { advice: "internal" }
|
|
13832
13843
|
},
|
|
13833
13844
|
service_unavailable: BACK_PRESSURE,
|
|
@@ -31837,7 +31848,9 @@ function columnCompare(args, isString, collation, name) {
|
|
|
31837
31848
|
}
|
|
31838
31849
|
if (args.stackedOn !== undefined)
|
|
31839
31850
|
return args.stackedOn;
|
|
31840
|
-
|
|
31851
|
+
return liveCompare(args.live?.get(name));
|
|
31852
|
+
}
|
|
31853
|
+
function liveCompare(live) {
|
|
31841
31854
|
return live === "binary" ? "exact" : live === "deterministic" ? "equality" : "none";
|
|
31842
31855
|
}
|
|
31843
31856
|
function weakestStringCompare(upstreams) {
|
|
@@ -35841,21 +35854,33 @@ function fieldPathsIn(e, out = [], depth = 0) {
|
|
|
35841
35854
|
}
|
|
35842
35855
|
|
|
35843
35856
|
// src/service/materialization/serve/stored_upstream.ts
|
|
35857
|
+
function querySourceIDs(modelDef) {
|
|
35858
|
+
if (modelDef === null || typeof modelDef !== "object")
|
|
35859
|
+
return new Map;
|
|
35860
|
+
let out = querySourcesMemo.get(modelDef);
|
|
35861
|
+
if (out)
|
|
35862
|
+
return out;
|
|
35863
|
+
out = new Map;
|
|
35864
|
+
const contents = modelDef.contents ?? {};
|
|
35865
|
+
for (const c of Object.values(contents)) {
|
|
35866
|
+
const d = c;
|
|
35867
|
+
if (typeof d?.sourceID !== "string" || d.query === undefined)
|
|
35868
|
+
continue;
|
|
35869
|
+
const q = JSON.stringify(d.query);
|
|
35870
|
+
out.set(q, [...out.get(q) ?? [], d.sourceID]);
|
|
35871
|
+
}
|
|
35872
|
+
querySourcesMemo.set(modelDef, out);
|
|
35873
|
+
return out;
|
|
35874
|
+
}
|
|
35844
35875
|
function storedUpstreamResolver(modelDef, stored) {
|
|
35845
35876
|
let byID;
|
|
35846
|
-
let byQuery;
|
|
35847
35877
|
const index = () => {
|
|
35848
35878
|
byID = new Map;
|
|
35849
|
-
byQuery = new Map;
|
|
35850
35879
|
const contents = modelDef?.contents ?? {};
|
|
35851
35880
|
for (const c of Object.values(contents)) {
|
|
35852
35881
|
const d = c;
|
|
35853
|
-
if (typeof d?.sourceID
|
|
35854
|
-
|
|
35855
|
-
byID.set(d.sourceID, d);
|
|
35856
|
-
if (stored.has(d.sourceID) && d.query !== undefined) {
|
|
35857
|
-
byQuery.set(JSON.stringify(d.query), d.sourceID);
|
|
35858
|
-
}
|
|
35882
|
+
if (typeof d?.sourceID === "string")
|
|
35883
|
+
byID.set(d.sourceID, d);
|
|
35859
35884
|
}
|
|
35860
35885
|
};
|
|
35861
35886
|
return (owner) => {
|
|
@@ -35867,7 +35892,7 @@ function storedUpstreamResolver(modelDef, stored) {
|
|
|
35867
35892
|
if (byID === undefined)
|
|
35868
35893
|
index();
|
|
35869
35894
|
if (at.query !== undefined) {
|
|
35870
|
-
const id =
|
|
35895
|
+
const id = (querySourceIDs(modelDef).get(JSON.stringify(at.query)) ?? []).findLast((x) => stored.has(x));
|
|
35871
35896
|
if (id !== undefined)
|
|
35872
35897
|
return id;
|
|
35873
35898
|
}
|
|
@@ -35880,6 +35905,10 @@ function storedUpstreamResolver(modelDef, stored) {
|
|
|
35880
35905
|
return;
|
|
35881
35906
|
};
|
|
35882
35907
|
}
|
|
35908
|
+
var querySourcesMemo;
|
|
35909
|
+
var init_stored_upstream = __esm(() => {
|
|
35910
|
+
querySourcesMemo = new WeakMap;
|
|
35911
|
+
});
|
|
35883
35912
|
|
|
35884
35913
|
// src/service/materialization/serve/gate_reads.ts
|
|
35885
35914
|
function gateIdentifiers(exprs) {
|
|
@@ -36190,22 +36219,7 @@ class GateReadWalk {
|
|
|
36190
36219
|
if (s?.query === undefined)
|
|
36191
36220
|
return false;
|
|
36192
36221
|
const query = JSON.stringify(s.query);
|
|
36193
|
-
return this.
|
|
36194
|
-
}
|
|
36195
|
-
storedQueriesMemo;
|
|
36196
|
-
storedQueries() {
|
|
36197
|
-
if (this.storedQueriesMemo)
|
|
36198
|
-
return this.storedQueriesMemo;
|
|
36199
|
-
const out = new Set;
|
|
36200
|
-
const contents = this.modelDef?.contents ?? {};
|
|
36201
|
-
for (const c of Object.values(contents)) {
|
|
36202
|
-
const d = c;
|
|
36203
|
-
if (typeof d?.sourceID === "string" && this.stored.has(d.sourceID) && d.query !== undefined) {
|
|
36204
|
-
out.add(JSON.stringify(d.query));
|
|
36205
|
-
}
|
|
36206
|
-
}
|
|
36207
|
-
this.storedQueriesMemo = out;
|
|
36208
|
-
return out;
|
|
36222
|
+
return (querySourceIDs(this.modelDef).get(query) ?? []).some((id) => this.stored.has(id));
|
|
36209
36223
|
}
|
|
36210
36224
|
tooDeep() {
|
|
36211
36225
|
return ++this.steps > 4096;
|
|
@@ -36916,6 +36930,7 @@ var init_gate_reads = __esm(() => {
|
|
|
36916
36930
|
init_prepared_query();
|
|
36917
36931
|
init_malloy_lexer_core();
|
|
36918
36932
|
init_query_text();
|
|
36933
|
+
init_stored_upstream();
|
|
36919
36934
|
GATE_KEYWORDS = new Set([
|
|
36920
36935
|
"and",
|
|
36921
36936
|
"or",
|
|
@@ -37982,6 +37997,7 @@ var RANGE_OPERATORS, EQUALITY_OPERATORS, ORDERING_FUNCTIONS, EQUALITY_FUNCTIONS,
|
|
|
37982
37997
|
var init_result_reads = __esm(() => {
|
|
37983
37998
|
init_prepared_query();
|
|
37984
37999
|
init_dialect();
|
|
38000
|
+
init_stored_upstream();
|
|
37985
38001
|
RANGE_OPERATORS = new Set([">", "<", ">=", "<="]);
|
|
37986
38002
|
EQUALITY_OPERATORS = new Set(["=", "!=", "like", "!like"]);
|
|
37987
38003
|
ORDERING_FUNCTIONS = new Set([
|
|
@@ -43114,7 +43130,7 @@ var init_package_retrieval_settings = __esm(() => {
|
|
|
43114
43130
|
questions: "auto",
|
|
43115
43131
|
docParts: "auto",
|
|
43116
43132
|
values: true,
|
|
43117
|
-
valueCap:
|
|
43133
|
+
valueCap: 5000,
|
|
43118
43134
|
valueEmbeddings: true,
|
|
43119
43135
|
judge: "auto",
|
|
43120
43136
|
contenderShare: 0,
|
|
@@ -45248,14 +45264,34 @@ function parseEmbedding(raw) {
|
|
|
45248
45264
|
documentPrefix: plainString(obj.documentPrefix, "retrieval.embedding.documentPrefix", `"documentPrefix": "search_document: "`) ?? ""
|
|
45249
45265
|
};
|
|
45250
45266
|
}
|
|
45251
|
-
function
|
|
45252
|
-
const
|
|
45253
|
-
|
|
45254
|
-
|
|
45255
|
-
|
|
45256
|
-
throw new Error(`Invalid retrieval.egress.preset: expected one of ${EGRESS_PRESETS.join(", ")}, got ${describe2(obj.preset)}. ` + `Fix: "preset": "default" (names, doc text and schema context) or "full" (also code and dimension values).`);
|
|
45267
|
+
function parseValueGivens(raw) {
|
|
45268
|
+
const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
45269
|
+
const isValue = (v) => typeof v === "string" || typeof v === "boolean" || typeof v === "number" && Number.isFinite(v);
|
|
45270
|
+
if (!isObject(raw)) {
|
|
45271
|
+
throw new Error(`Invalid retrieval.dimensionValues.givens: expected an object of packages, got ${describe2(raw)}. Fix: ${GIVENS_FIX}`);
|
|
45257
45272
|
}
|
|
45258
|
-
|
|
45273
|
+
const out = {};
|
|
45274
|
+
for (const [pkg, givens] of Object.entries(raw)) {
|
|
45275
|
+
const at = `retrieval.dimensionValues.givens.${pkg}`;
|
|
45276
|
+
if (!isObject(givens)) {
|
|
45277
|
+
throw new Error(`Invalid ${at}: expected an object of givens, got ${describe2(givens)}. Fix: ${GIVENS_FIX}`);
|
|
45278
|
+
}
|
|
45279
|
+
const parsed = {};
|
|
45280
|
+
let combinations = 1;
|
|
45281
|
+
for (const [name, value] of Object.entries(givens)) {
|
|
45282
|
+
const list = Array.isArray(value) ? value : [value];
|
|
45283
|
+
if (list.length === 0 || !list.every(isValue)) {
|
|
45284
|
+
throw new Error(`Invalid ${at}.${name}: expected a string, number or boolean, or a non-empty list of them, got ${describe2(value)}. Fix: ${GIVENS_FIX}`);
|
|
45285
|
+
}
|
|
45286
|
+
parsed[name] = [...new Set(list)];
|
|
45287
|
+
combinations *= parsed[name].length;
|
|
45288
|
+
}
|
|
45289
|
+
if (combinations > MAX_GIVEN_COMBINATIONS) {
|
|
45290
|
+
throw new Error(`Invalid ${at}: its lists make ${combinations} combinations, and each is one read per indexed dimension; at most ${MAX_GIVEN_COMBINATIONS}. Fix: list fewer values`);
|
|
45291
|
+
}
|
|
45292
|
+
out[pkg] = parsed;
|
|
45293
|
+
}
|
|
45294
|
+
return out;
|
|
45259
45295
|
}
|
|
45260
45296
|
function parseDimensionValues(raw) {
|
|
45261
45297
|
const fields = block(raw, "retrieval.dimensionValues", DIMENSION_VALUE_KEYS, `"dimensionValues": { "enabled": false }`);
|
|
@@ -45266,6 +45302,9 @@ function parseDimensionValues(raw) {
|
|
|
45266
45302
|
}
|
|
45267
45303
|
out.enabled = fields.enabled;
|
|
45268
45304
|
}
|
|
45305
|
+
if (fields.givens !== undefined && fields.givens !== null) {
|
|
45306
|
+
out.givens = parseValueGivens(fields.givens);
|
|
45307
|
+
}
|
|
45269
45308
|
return out;
|
|
45270
45309
|
}
|
|
45271
45310
|
function parseRetrievalConfig(raw) {
|
|
@@ -45292,17 +45331,16 @@ function parseRetrievalConfig(raw) {
|
|
|
45292
45331
|
if (embedding)
|
|
45293
45332
|
out.embedding = embedding;
|
|
45294
45333
|
}
|
|
45295
|
-
if (input.egress !== undefined
|
|
45296
|
-
|
|
45297
|
-
if (egress)
|
|
45298
|
-
out.egress = egress;
|
|
45299
|
-
}
|
|
45334
|
+
if (input.egress !== undefined)
|
|
45335
|
+
out.egressIgnored = true;
|
|
45300
45336
|
if (input.dimensionValues !== undefined && input.dimensionValues !== null) {
|
|
45301
45337
|
out.dimensionValues = parseDimensionValues(input.dimensionValues);
|
|
45302
45338
|
}
|
|
45303
45339
|
return out;
|
|
45304
45340
|
}
|
|
45305
45341
|
function setRetrievalConfig(config) {
|
|
45342
|
+
if (config?.egressIgnored)
|
|
45343
|
+
logger.warn(RETIRED_EGRESS_WARNING);
|
|
45306
45344
|
loaded = config;
|
|
45307
45345
|
}
|
|
45308
45346
|
function loadedRetrievalConfig() {
|
|
@@ -45311,14 +45349,12 @@ function loadedRetrievalConfig() {
|
|
|
45311
45349
|
function getDimensionValueSettings() {
|
|
45312
45350
|
return { ...DIMENSION_VALUE_DEFAULTS, ...loaded?.dimensionValues };
|
|
45313
45351
|
}
|
|
45314
|
-
|
|
45315
|
-
return loaded?.egress?.preset ?? "default";
|
|
45316
|
-
}
|
|
45317
|
-
var DIMENSION_VALUE_KEYS, loaded;
|
|
45352
|
+
var RETIRED_EGRESS_WARNING = "retrieval.egress is no longer read and is ignored. The values of #(index) dimensions are now sent to the configured embedding provider and LLM whenever one is configured. To keep them on this machine, set retrieval.dimensionValues.enabled to false in publisher.config.json. Leaving EMBEDDING_API_KEY unset, or setting retrieval.fcj.valueEmbeddings to false, only stops values being embedded: a configured LLM still sees them. Remove the egress block to silence this warning.", MAX_GIVEN_COMBINATIONS = 50, DIMENSION_VALUE_KEYS, GIVENS_FIX = `"givens": { "<package>": { "REPORT_ID": [123, 456] } }`, loaded;
|
|
45318
45353
|
var init_config = __esm(() => {
|
|
45354
|
+
init_logger();
|
|
45319
45355
|
init_types2();
|
|
45320
45356
|
init_defaults();
|
|
45321
|
-
DIMENSION_VALUE_KEYS = ["enabled"];
|
|
45357
|
+
DIMENSION_VALUE_KEYS = ["enabled", "givens"];
|
|
45322
45358
|
});
|
|
45323
45359
|
|
|
45324
45360
|
// src/config.ts
|
|
@@ -45547,7 +45583,7 @@ function assembleRetrieval(file) {
|
|
|
45547
45583
|
return { block: file, ignored };
|
|
45548
45584
|
}
|
|
45549
45585
|
const block = file ? structuredClone(file) : {};
|
|
45550
|
-
for (const leaf of REGISTRY.filter((entry) => entry.key.startsWith("retrieval.")
|
|
45586
|
+
for (const leaf of REGISTRY.filter((entry) => entry.key.startsWith("retrieval."))) {
|
|
45551
45587
|
const pathInBlock = leaf.key.split(".").slice(1);
|
|
45552
45588
|
const parent = nodeAt(block, pathInBlock.slice(0, -1));
|
|
45553
45589
|
const last = pathInBlock[pathInBlock.length - 1];
|
|
@@ -46645,6 +46681,13 @@ function gateRefusalReason(routes) {
|
|
|
46645
46681
|
}
|
|
46646
46682
|
|
|
46647
46683
|
// src/service/materialization/domain/compiled_build_plan.ts
|
|
46684
|
+
function stringCapabilityKey(sourceID, destination) {
|
|
46685
|
+
return JSON.stringify([sourceID, destination]);
|
|
46686
|
+
}
|
|
46687
|
+
function stringCapabilityKeyParts(key) {
|
|
46688
|
+
const [sourceID, destination] = JSON.parse(key);
|
|
46689
|
+
return { sourceID, destination };
|
|
46690
|
+
}
|
|
46648
46691
|
function* sourcesInBuildOrder(build, tables) {
|
|
46649
46692
|
for (const sourceID of build.order) {
|
|
46650
46693
|
const source = tables[sourceID]?.source;
|
|
@@ -50392,6 +50435,18 @@ function reachedUpstreams(root, modelDef, map) {
|
|
|
50392
50435
|
}
|
|
50393
50436
|
return out;
|
|
50394
50437
|
}
|
|
50438
|
+
function materializedUpstream(sourceID, map) {
|
|
50439
|
+
const node = map.node(sourceID);
|
|
50440
|
+
const def = node?.def;
|
|
50441
|
+
const notes = ownLevelNotes(def?.annotations);
|
|
50442
|
+
if (notesDeclarePersist(notes.filter((n) => routeOfNote(n.text) === "@"))) {
|
|
50443
|
+
return;
|
|
50444
|
+
}
|
|
50445
|
+
if (!notes.some((n) => routeOfNote(n.text) === "materialize")) {
|
|
50446
|
+
return;
|
|
50447
|
+
}
|
|
50448
|
+
return { name: node?.name ?? sourceID, dialect: def?.dialect };
|
|
50449
|
+
}
|
|
50395
50450
|
function storedElsewhereReason(upstreams) {
|
|
50396
50451
|
const stored = upstreams.find((u) => u.storage !== undefined);
|
|
50397
50452
|
return stored ? `its upstream '${stored.name}' is stored in the storage= destination ` + `'${stored.storage}', whose table a build in the warehouse cannot ` + `read, and a downstream is never built by recomputing its upstream ` + `from raw; it is ` + `answered live, over '${stored.name}''s table` : undefined;
|
|
@@ -55503,6 +55558,32 @@ function recordedCompare(names, contract) {
|
|
|
55503
55558
|
}
|
|
55504
55559
|
return "none";
|
|
55505
55560
|
}
|
|
55561
|
+
function unboundStringReadsRefusal(reads, unbound) {
|
|
55562
|
+
if ("refused" in reads)
|
|
55563
|
+
return;
|
|
55564
|
+
for (const read of reads.reads) {
|
|
55565
|
+
const upstream = read.upstream === undefined ? undefined : unbound.get(read.upstream);
|
|
55566
|
+
if (upstream === undefined)
|
|
55567
|
+
continue;
|
|
55568
|
+
const name = read.names[read.names.length - 1] ?? "?";
|
|
55569
|
+
const verb = read.need === "exact" ? "orders" : "groups or compares";
|
|
55570
|
+
const { capability } = upstream;
|
|
55571
|
+
if (capability === "unread") {
|
|
55572
|
+
return `it ${verb} '${name}' from '${upstream.name}', whose table is not ` + `bound yet and whose source's string comparison has not been ` + `read yet`;
|
|
55573
|
+
}
|
|
55574
|
+
const live = [...read.names].reverse().map((n) => capability.fields.get(n)).find((c) => c !== undefined);
|
|
55575
|
+
const compare = liveCompare(live);
|
|
55576
|
+
if (!MEETS[read.need].has(compare)) {
|
|
55577
|
+
return `it ${verb} '${name}' from '${upstream.name}', whose table is not ` + `bound yet and whose source compares it ` + `${compare === "none" ? "unlike byte order" : `by ${compare} only`}`;
|
|
55578
|
+
}
|
|
55579
|
+
}
|
|
55580
|
+
return;
|
|
55581
|
+
}
|
|
55582
|
+
function capabilityFingerprint(judged) {
|
|
55583
|
+
if (typeof judged === "string")
|
|
55584
|
+
return judged;
|
|
55585
|
+
return JSON.stringify([...judged.fields].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
|
|
55586
|
+
}
|
|
55506
55587
|
var MEETS;
|
|
55507
55588
|
var init_string_reads = __esm(() => {
|
|
55508
55589
|
init_column_contract();
|
|
@@ -56272,7 +56353,8 @@ function emptyBuildPlanParts() {
|
|
|
56272
56353
|
modelGateLines: noModelGateLines(),
|
|
56273
56354
|
persistedViews: {},
|
|
56274
56355
|
omittedSources: [],
|
|
56275
|
-
accessReads: []
|
|
56356
|
+
accessReads: [],
|
|
56357
|
+
stringCapabilityReads: {}
|
|
56276
56358
|
};
|
|
56277
56359
|
}
|
|
56278
56360
|
function mergeBuildPlanParts(into, from) {
|
|
@@ -56290,6 +56372,7 @@ function mergeBuildPlanParts(into, from) {
|
|
|
56290
56372
|
into.accessReads = [
|
|
56291
56373
|
...new Set([...into.accessReads, ...from.accessReads])
|
|
56292
56374
|
].sort();
|
|
56375
|
+
Object.assign(into.stringCapabilityReads, from.stringCapabilityReads);
|
|
56293
56376
|
}
|
|
56294
56377
|
function addAnnotationFinding(parts, finding) {
|
|
56295
56378
|
const key = (f) => [f.code, f.model ?? "", f.subject ?? "", f.message].join("\x00");
|
|
@@ -56483,7 +56566,10 @@ async function collectGeneratedRollups(parts, args) {
|
|
|
56483
56566
|
measures: plan.measures.map((m) => m.name)
|
|
56484
56567
|
},
|
|
56485
56568
|
stored: [storedBase.baseSourceID]
|
|
56486
|
-
}, plan.storage
|
|
56569
|
+
}, plan.storage, {
|
|
56570
|
+
modelDef: args.modelDef,
|
|
56571
|
+
judged: parts.stringCapabilityReads
|
|
56572
|
+
}) : undefined;
|
|
56487
56573
|
const overStored = provenRollupOverStored(source, plan, generated.overStoredBases.get(source.sourceID), parts.tables);
|
|
56488
56574
|
const unusableUpstream = storedBase && plan.storage !== undefined ? storedBaseDecline(args, source, plan, storedBase, plan.storage) : !storedBase && !overStored.overStoredBase ? rollupOverDefinition(args, plan) : undefined;
|
|
56489
56575
|
parts.tables[source.sourceID] = {
|
|
@@ -56510,7 +56596,7 @@ function provenRollupOverStored(source, plan, variant, tables) {
|
|
|
56510
56596
|
return {};
|
|
56511
56597
|
return overStoredProven(source, variant, base.source) ? { overStoredBase: variant } : {};
|
|
56512
56598
|
}
|
|
56513
|
-
async function planStringReads(ports, materializer, request, destination) {
|
|
56599
|
+
async function planStringReads(ports, materializer, request, destination, upstreams) {
|
|
56514
56600
|
if (!ports) {
|
|
56515
56601
|
return { refused: "this package reads no string a build compares" };
|
|
56516
56602
|
}
|
|
@@ -56523,14 +56609,30 @@ async function planStringReads(ports, materializer, request, destination) {
|
|
|
56523
56609
|
const unstored = unstoredReadRefusal(reads);
|
|
56524
56610
|
if (unstored !== undefined)
|
|
56525
56611
|
return { refused: unstored, unstored: true };
|
|
56526
|
-
if ("refused" in reads
|
|
56527
|
-
return reads;
|
|
56528
|
-
const contracts = new Map(request.stored.map((id) => [id, ports.boundContract(id, destination)]));
|
|
56529
|
-
if ([...contracts.values()].some((c) => c === undefined))
|
|
56612
|
+
if ("refused" in reads)
|
|
56530
56613
|
return reads;
|
|
56531
|
-
const
|
|
56614
|
+
const contracts = new Map(request.stored.map((id) => [id, ports.boundContract?.(id, destination)]));
|
|
56615
|
+
const why = ports.boundContract && [...contracts.values()].every((c) => c !== undefined) ? stringReadsRefusal(reads, contracts) : unboundStringReadsRefusal(reads, await unboundCapabilities(ports, reads, request.stored.filter((id) => contracts.get(id) === undefined), destination, upstreams));
|
|
56532
56616
|
return why === undefined ? reads : { refused: why };
|
|
56533
56617
|
}
|
|
56618
|
+
async function unboundCapabilities(ports, reads, unbound, destination, upstreams) {
|
|
56619
|
+
const out = new Map;
|
|
56620
|
+
if ("refused" in reads)
|
|
56621
|
+
return out;
|
|
56622
|
+
const map = SourceMap.of(upstreams.modelDef);
|
|
56623
|
+
for (const id of unbound) {
|
|
56624
|
+
if (!reads.reads.some((r) => r.upstream === id))
|
|
56625
|
+
continue;
|
|
56626
|
+
const upstream = materializedUpstream(id, map);
|
|
56627
|
+
if (upstream === undefined || capabilitiesOf(upstream.dialect).stringCollation !== "column") {
|
|
56628
|
+
continue;
|
|
56629
|
+
}
|
|
56630
|
+
const capability = ports.capability ? await ports.capability(id).catch(() => "unread") : "unread";
|
|
56631
|
+
upstreams.judged[stringCapabilityKey(id, destination)] = capabilityFingerprint(capability);
|
|
56632
|
+
out.set(id, { name: upstream.name, capability });
|
|
56633
|
+
}
|
|
56634
|
+
return out;
|
|
56635
|
+
}
|
|
56534
56636
|
function viewUnusableUpstream(generated, sourceID, proven) {
|
|
56535
56637
|
const unusable = generated.overStoredUnusable.get(sourceID);
|
|
56536
56638
|
if (unusable !== undefined)
|
|
@@ -56591,11 +56693,11 @@ function storedBaseDecline(args, source, plan, storedBase, destination) {
|
|
|
56591
56693
|
return `its model does not declare ${base}`;
|
|
56592
56694
|
return "declined" in text ? `${base} cannot be re-rooted on that table: ${text.declined}` : undefined;
|
|
56593
56695
|
}
|
|
56594
|
-
function inDestinationStringReads(args, stored, planned) {
|
|
56696
|
+
function inDestinationStringReads(args, stored, planned, upstreams) {
|
|
56595
56697
|
const run = planned.kind === "query" ? `run: ${quotedIdentifier(planned.queryName)}` : `run: ${quotedIdentifier(planned.sourceName)} -> ${quotedIdentifier(planned.viewName)}`;
|
|
56596
|
-
return planStringReads(args.stringReads, args.materializer, { run, stored: stored.upstreams.map((u) => u.sourceID) }, planned.storage);
|
|
56698
|
+
return planStringReads(args.stringReads, args.materializer, { run, stored: stored.upstreams.map((u) => u.sourceID) }, planned.storage, upstreams);
|
|
56597
56699
|
}
|
|
56598
|
-
async function chainedStringReads(source, modelDef, materializer, ports) {
|
|
56700
|
+
async function chainedStringReads(source, modelDef, materializer, ports, judged) {
|
|
56599
56701
|
const destination = declaredStorage(source)?.trim();
|
|
56600
56702
|
if (!destination)
|
|
56601
56703
|
return;
|
|
@@ -56607,7 +56709,7 @@ async function chainedStringReads(source, modelDef, materializer, ports) {
|
|
|
56607
56709
|
const stored = reachedUpstreams(def, modelDef, map).filter((u) => u.storage === destination && u.sourceID !== source.sourceID).map((u) => u.sourceID);
|
|
56608
56710
|
if (stored.length === 0)
|
|
56609
56711
|
return;
|
|
56610
|
-
const reads = await planStringReads(ports, materializer, { downstream: source.name, stored }, destination);
|
|
56712
|
+
const reads = await planStringReads(ports, materializer, { downstream: source.name, stored }, destination, { modelDef, judged });
|
|
56611
56713
|
if (!("refused" in reads) || !reads.unstored)
|
|
56612
56714
|
return reads;
|
|
56613
56715
|
const persisted = new Set(reachedUpstreams(def, modelDef, map).map((u) => u.sourceID));
|
|
@@ -56690,7 +56792,7 @@ async function collectGeneratedPersistedViews(parts, args) {
|
|
|
56690
56792
|
continue;
|
|
56691
56793
|
}
|
|
56692
56794
|
kept++;
|
|
56693
|
-
const stringReads = inDestination && "stored" in inDestination ? await inDestinationStringReads(args, inDestination.stored, query ?? plan) : undefined;
|
|
56795
|
+
const stringReads = inDestination && "stored" in inDestination ? await inDestinationStringReads(args, inDestination.stored, query ?? plan, { modelDef: authorDef, judged: parts.stringCapabilityReads }) : undefined;
|
|
56694
56796
|
const unusableUpstream = viewUnusableUpstream(generated, source.sourceID, overStoredBase !== undefined);
|
|
56695
56797
|
parts.tables[source.sourceID] = {
|
|
56696
56798
|
kind: "view",
|
|
@@ -56991,7 +57093,7 @@ async function planV1PersistSources(parts, planned, args) {
|
|
|
56991
57093
|
modelDef: modelDefOf(malloyModel),
|
|
56992
57094
|
deps: gateDepsFor(malloyModel, modelPath)
|
|
56993
57095
|
};
|
|
56994
|
-
const stringReads = declaringModelPath(sourceIDFileURL(sourceID), packagePath, modelPath) === modelPath ? await chainedStringReads(source, classificationCtx.modelDef, materializer, args.stringReads) : parts.tables[sourceID]?.stringReads;
|
|
57096
|
+
const stringReads = declaringModelPath(sourceIDFileURL(sourceID), packagePath, modelPath) === modelPath ? await chainedStringReads(source, classificationCtx.modelDef, materializer, args.stringReads, parts.stringCapabilityReads) : parts.tables[sourceID]?.stringReads;
|
|
56995
57097
|
const destination = declaredStorage(source)?.trim();
|
|
56996
57098
|
const map = SourceMap.of(classificationCtx.modelDef);
|
|
56997
57099
|
const query = map.node(sourceID)?.def?.query;
|
|
@@ -57353,6 +57455,7 @@ function derivePackagePlan(compiled, materializationConfig, counts = {}) {
|
|
|
57353
57455
|
materializePlans: materializePlansOf(compiled.tables),
|
|
57354
57456
|
asOfBuild,
|
|
57355
57457
|
accessReads: [...compiled.accessReads ?? []],
|
|
57458
|
+
...compiled.stringCapabilityReads && Object.keys(compiled.stringCapabilityReads).length > 0 ? { stringCapabilityReads: { ...compiled.stringCapabilityReads } } : {},
|
|
57356
57459
|
eligibilityRefused: { ...counts }
|
|
57357
57460
|
};
|
|
57358
57461
|
}
|
|
@@ -57653,6 +57756,7 @@ var init_build_plan = __esm(() => {
|
|
|
57653
57756
|
init_over_stored_proof();
|
|
57654
57757
|
init_downstream_upstreams();
|
|
57655
57758
|
init_string_reads();
|
|
57759
|
+
init_dialect();
|
|
57656
57760
|
init_column_contract();
|
|
57657
57761
|
init_source_map();
|
|
57658
57762
|
init_author_model();
|