@malloy-publisher/server 0.18.1 → 0.18.3
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 +7 -3
- package/dist/instrumentation.mjs +1 -1
- package/dist/package_load_worker.mjs +56 -34
- package/dist/server.mjs +151 -78
- package/package.json +1 -1
package/dist/app/api-doc.yaml
CHANGED
|
@@ -8812,9 +8812,13 @@ components:
|
|
|
8812
8812
|
a destination the environment does not configure),
|
|
8813
8813
|
`connection_cannot_hold_table` (its connection creates no tables),
|
|
8814
8814
|
`materialization_off` (only the served copy reads it, and the
|
|
8815
|
-
served copy is off)
|
|
8816
|
-
it, and the served copy does not re-root it)
|
|
8817
|
-
|
|
8815
|
+
served copy is off), `served_copy` (only the served copy reads
|
|
8816
|
+
it, and the served copy does not re-root it), `incompatible` (the
|
|
8817
|
+
table no longer matches the column contract its build recorded) or
|
|
8818
|
+
`contract_missing` (its build recorded no usable contract); a
|
|
8819
|
+
`storage=` table with either of the last two is reported
|
|
8820
|
+
`NOT_SERVED`, not `NOT_BUILT`. An open set: treat a code you do not
|
|
8821
|
+
know as a warning like any other.
|
|
8818
8822
|
tableId:
|
|
8819
8823
|
type: string
|
|
8820
8824
|
description: The table, as `considered` names it.
|
package/dist/instrumentation.mjs
CHANGED
|
@@ -167085,7 +167085,7 @@ var init_telemetry = __esm(() => {
|
|
|
167085
167085
|
});
|
|
167086
167086
|
|
|
167087
167087
|
// package.json
|
|
167088
|
-
var version = "0.18.
|
|
167088
|
+
var version = "0.18.3";
|
|
167089
167089
|
var init_package = () => {};
|
|
167090
167090
|
|
|
167091
167091
|
// src/version.ts
|
|
@@ -31546,13 +31546,26 @@ function duckdbTableCollations(definition) {
|
|
|
31546
31546
|
function unquoted(name) {
|
|
31547
31547
|
return /^".*"$/.test(name) ? name.slice(1, -1).replace(/""/g, '"') : name;
|
|
31548
31548
|
}
|
|
31549
|
+
function bigqueryNamesNoCollation(name) {
|
|
31550
|
+
return typeof name !== "string" || BQ_NO_COLLATION.includes(name.trim().toUpperCase());
|
|
31551
|
+
}
|
|
31552
|
+
function bigqueryCollatedSql(column) {
|
|
31553
|
+
return `UPPER(TRIM(COALESCE(${column}, ''))) NOT IN (${BQ_NO_COLLATION.map((v) => `'${v}'`).join(", ")})`;
|
|
31554
|
+
}
|
|
31549
31555
|
function bigqueryColumnCollation(name) {
|
|
31550
|
-
return
|
|
31556
|
+
return bigqueryNamesNoCollation(name) ? BINARY_COLLATION : `bigquery:${name.trim()}`;
|
|
31557
|
+
}
|
|
31558
|
+
function canonicalCollation(identity) {
|
|
31559
|
+
const prefix = "bigquery:";
|
|
31560
|
+
return identity.startsWith(prefix) && bigqueryNamesNoCollation(identity.slice(prefix.length)) ? BINARY_COLLATION : identity;
|
|
31551
31561
|
}
|
|
31552
31562
|
function postgresColumnCollation(identity, judged) {
|
|
31553
31563
|
return judged === "binary" ? BINARY_COLLATION : `postgres:${identity}`;
|
|
31554
31564
|
}
|
|
31555
|
-
var BINARY_COLLATION = "binary", PG_COLLATION_COLUMNS = "c.collname AS name, c.collisdeterministic AS det, c.collcollate AS cc, c.collprovider AS prov, d.datcollate AS dbc, to_jsonb(d) ->> 'datlocprovider' AS dbp", PG_COLLATION_IDENTITY = `CASE WHEN c.collname = 'default' AND c.collnamespace = 'pg_catalog'::regnamespace THEN concat_ws('|', 'db', coalesce(to_jsonb(d) ->> 'datlocprovider', ''), d.datcollate, d.datctype, coalesce(to_jsonb(d) ->> 'daticulocale', ''), coalesce(to_jsonb(d) ->> 'datlocale', ''), coalesce(to_jsonb(d) ->> 'daticurules', ''), coalesce(to_jsonb(d) ->> 'datcollversion', '')) ELSE concat_ws('|', 'coll', c.collprovider, c.collisdeterministic::text, coalesce(c.collcollate, ''), coalesce(c.collctype, ''), coalesce(to_jsonb(c) ->> 'colliculocale', ''), coalesce(to_jsonb(c) ->> 'colllocale', ''), coalesce(to_jsonb(c) ->> 'collicurules', ''), coalesce(to_jsonb(c) ->> 'collversion', '')) END`, DUCKDB_COLLATE_DEFINITIONS = "SELECT (SELECT count(*) FROM duckdb_tables() WHERE NOT internal AND sql ILIKE '%collate%') + (SELECT count(*) FROM duckdb_views() WHERE NOT internal AND sql ILIKE '%collate%') + (SELECT count(*) FROM duckdb_functions() WHERE NOT internal AND function_type IN ('macro', 'table_macro') AND (macro_definition IS NULL OR macro_definition ILIKE '%collate%')) AS n";
|
|
31565
|
+
var BINARY_COLLATION = "binary", PG_COLLATION_COLUMNS = "c.collname AS name, c.collisdeterministic AS det, c.collcollate AS cc, c.collprovider AS prov, d.datcollate AS dbc, to_jsonb(d) ->> 'datlocprovider' AS dbp", PG_COLLATION_IDENTITY = `CASE WHEN c.collname = 'default' AND c.collnamespace = 'pg_catalog'::regnamespace THEN concat_ws('|', 'db', coalesce(to_jsonb(d) ->> 'datlocprovider', ''), d.datcollate, d.datctype, coalesce(to_jsonb(d) ->> 'daticulocale', ''), coalesce(to_jsonb(d) ->> 'datlocale', ''), coalesce(to_jsonb(d) ->> 'daticurules', ''), coalesce(to_jsonb(d) ->> 'datcollversion', '')) ELSE concat_ws('|', 'coll', c.collprovider, c.collisdeterministic::text, coalesce(c.collcollate, ''), coalesce(c.collctype, ''), coalesce(to_jsonb(c) ->> 'colliculocale', ''), coalesce(to_jsonb(c) ->> 'colllocale', ''), coalesce(to_jsonb(c) ->> 'collicurules', ''), coalesce(to_jsonb(c) ->> 'collversion', '')) END`, BQ_NO_COLLATION, DUCKDB_COLLATE_DEFINITIONS = "SELECT (SELECT count(*) FROM duckdb_tables() WHERE NOT internal AND sql ILIKE '%collate%') + (SELECT count(*) FROM duckdb_views() WHERE NOT internal AND sql ILIKE '%collate%') + (SELECT count(*) FROM duckdb_functions() WHERE NOT internal AND function_type IN ('macro', 'table_macro') AND (macro_definition IS NULL OR macro_definition ILIKE '%collate%')) AS n";
|
|
31566
|
+
var init_collation = __esm(() => {
|
|
31567
|
+
BQ_NO_COLLATION = ["", "NULL"];
|
|
31568
|
+
});
|
|
31556
31569
|
|
|
31557
31570
|
// src/service/materialization/domain/vocabulary.ts
|
|
31558
31571
|
var init_vocabulary = () => {};
|
|
@@ -31728,7 +31741,7 @@ function parseContract(raw) {
|
|
|
31728
31741
|
columns.push({
|
|
31729
31742
|
name: c.name,
|
|
31730
31743
|
nativeType: c.nativeType,
|
|
31731
|
-
collation: typeof c.collation === "string" ? c.collation : null,
|
|
31744
|
+
collation: typeof c.collation === "string" ? canonicalCollation(c.collation) : null,
|
|
31732
31745
|
compare: typeof c.compare === "string" && COMPARES.has(c.compare) ? c.compare : "none",
|
|
31733
31746
|
gateExact: c.gateExact === true,
|
|
31734
31747
|
...typeof c.declaredType === "string" && c.declaredType !== "" ? { declaredType: c.declaredType } : {}
|
|
@@ -31771,13 +31784,16 @@ function columnNamed(columns, name) {
|
|
|
31771
31784
|
const folded = columns.filter((c) => c.name.toLowerCase() === name.toLowerCase());
|
|
31772
31785
|
return folded.length === 1 ? folded[0] : undefined;
|
|
31773
31786
|
}
|
|
31774
|
-
function
|
|
31775
|
-
return nativeType.replace(
|
|
31787
|
+
function committedNativeType(nativeType, dialect) {
|
|
31788
|
+
return dialect === STORAGE_DIALECT ? nativeType.replace(DUCKDB_GEOMETRY_CRS, "GEOMETRY") : nativeType;
|
|
31789
|
+
}
|
|
31790
|
+
function spelledType(nativeType, dialect) {
|
|
31791
|
+
return committedNativeType(nativeType, dialect).replace(/\s+/g, " ").replace(/\s*([(),])\s*/g, "$1").trim().toUpperCase();
|
|
31776
31792
|
}
|
|
31777
31793
|
function contractDigest(contract) {
|
|
31778
31794
|
const canonical = contract.columns.map((c) => [
|
|
31779
31795
|
c.name,
|
|
31780
|
-
spelledType(c.nativeType),
|
|
31796
|
+
spelledType(c.nativeType, contract.dialect),
|
|
31781
31797
|
c.collation
|
|
31782
31798
|
]);
|
|
31783
31799
|
return createHash("sha256").update(JSON.stringify(canonical)).digest("hex").slice(0, 32);
|
|
@@ -31817,7 +31833,7 @@ function deriveContract(args) {
|
|
|
31817
31833
|
const collation = c.isString && stored.collations ? collationOf(stored.collations, c.name) : null;
|
|
31818
31834
|
return {
|
|
31819
31835
|
name: c.name,
|
|
31820
|
-
nativeType: c.nativeType,
|
|
31836
|
+
nativeType: committedNativeType(c.nativeType, stored.dialect),
|
|
31821
31837
|
collation,
|
|
31822
31838
|
compare: columnCompare(args, c.isString, collation, c.name),
|
|
31823
31839
|
gateExact: tier === "database" ? c.storedAsDouble !== true : gateColumnTypeExact(c.nativeType, upstreamTypeNamed(args.upstreamTypes, c.name)),
|
|
@@ -31877,7 +31893,7 @@ function compatible(contract, observed) {
|
|
|
31877
31893
|
continue;
|
|
31878
31894
|
}
|
|
31879
31895
|
const type = now.nativeType ?? now.type;
|
|
31880
|
-
if (type === undefined || spelledType(type) !== spelledType(c.nativeType)) {
|
|
31896
|
+
if (type === undefined || spelledType(type, contract.dialect) !== spelledType(c.nativeType, contract.dialect)) {
|
|
31881
31897
|
retyped.push(c.name);
|
|
31882
31898
|
continue;
|
|
31883
31899
|
}
|
|
@@ -31910,10 +31926,13 @@ function declaredMoves(contract, declared) {
|
|
|
31910
31926
|
return now !== undefined && now !== "" && now !== c.declaredType ? [c.name] : [];
|
|
31911
31927
|
});
|
|
31912
31928
|
}
|
|
31913
|
-
var CONTRACT_VERSION = 1, COMPARES, COMPARE_RANK;
|
|
31929
|
+
var CONTRACT_VERSION = 1, COMPARES, DUCKDB_GEOMETRY_CRS, COMPARE_RANK;
|
|
31914
31930
|
var init_column_contract = __esm(() => {
|
|
31931
|
+
init_collation();
|
|
31932
|
+
init_dialect();
|
|
31915
31933
|
init_gate_policy();
|
|
31916
31934
|
COMPARES = new Set(["exact", "equality", "none"]);
|
|
31935
|
+
DUCKDB_GEOMETRY_CRS = /\bGEOMETRY\s*\(\s*'(?:[^']|'')*'\s*\)/gi;
|
|
31917
31936
|
COMPARE_RANK = {
|
|
31918
31937
|
none: 0,
|
|
31919
31938
|
equality: 1,
|
|
@@ -35854,21 +35873,33 @@ function fieldPathsIn(e, out = [], depth = 0) {
|
|
|
35854
35873
|
}
|
|
35855
35874
|
|
|
35856
35875
|
// src/service/materialization/serve/stored_upstream.ts
|
|
35876
|
+
function querySourceIDs(modelDef) {
|
|
35877
|
+
if (modelDef === null || typeof modelDef !== "object")
|
|
35878
|
+
return new Map;
|
|
35879
|
+
let out = querySourcesMemo.get(modelDef);
|
|
35880
|
+
if (out)
|
|
35881
|
+
return out;
|
|
35882
|
+
out = new Map;
|
|
35883
|
+
const contents = modelDef.contents ?? {};
|
|
35884
|
+
for (const c of Object.values(contents)) {
|
|
35885
|
+
const d = c;
|
|
35886
|
+
if (typeof d?.sourceID !== "string" || d.query === undefined)
|
|
35887
|
+
continue;
|
|
35888
|
+
const q = JSON.stringify(d.query);
|
|
35889
|
+
out.set(q, [...out.get(q) ?? [], d.sourceID]);
|
|
35890
|
+
}
|
|
35891
|
+
querySourcesMemo.set(modelDef, out);
|
|
35892
|
+
return out;
|
|
35893
|
+
}
|
|
35857
35894
|
function storedUpstreamResolver(modelDef, stored) {
|
|
35858
35895
|
let byID;
|
|
35859
|
-
let byQuery;
|
|
35860
35896
|
const index = () => {
|
|
35861
35897
|
byID = new Map;
|
|
35862
|
-
byQuery = new Map;
|
|
35863
35898
|
const contents = modelDef?.contents ?? {};
|
|
35864
35899
|
for (const c of Object.values(contents)) {
|
|
35865
35900
|
const d = c;
|
|
35866
|
-
if (typeof d?.sourceID
|
|
35867
|
-
|
|
35868
|
-
byID.set(d.sourceID, d);
|
|
35869
|
-
if (stored.has(d.sourceID) && d.query !== undefined) {
|
|
35870
|
-
byQuery.set(JSON.stringify(d.query), d.sourceID);
|
|
35871
|
-
}
|
|
35901
|
+
if (typeof d?.sourceID === "string")
|
|
35902
|
+
byID.set(d.sourceID, d);
|
|
35872
35903
|
}
|
|
35873
35904
|
};
|
|
35874
35905
|
return (owner) => {
|
|
@@ -35880,7 +35911,7 @@ function storedUpstreamResolver(modelDef, stored) {
|
|
|
35880
35911
|
if (byID === undefined)
|
|
35881
35912
|
index();
|
|
35882
35913
|
if (at.query !== undefined) {
|
|
35883
|
-
const id =
|
|
35914
|
+
const id = (querySourceIDs(modelDef).get(JSON.stringify(at.query)) ?? []).findLast((x) => stored.has(x));
|
|
35884
35915
|
if (id !== undefined)
|
|
35885
35916
|
return id;
|
|
35886
35917
|
}
|
|
@@ -35893,6 +35924,10 @@ function storedUpstreamResolver(modelDef, stored) {
|
|
|
35893
35924
|
return;
|
|
35894
35925
|
};
|
|
35895
35926
|
}
|
|
35927
|
+
var querySourcesMemo;
|
|
35928
|
+
var init_stored_upstream = __esm(() => {
|
|
35929
|
+
querySourcesMemo = new WeakMap;
|
|
35930
|
+
});
|
|
35896
35931
|
|
|
35897
35932
|
// src/service/materialization/serve/gate_reads.ts
|
|
35898
35933
|
function gateIdentifiers(exprs) {
|
|
@@ -36203,22 +36238,7 @@ class GateReadWalk {
|
|
|
36203
36238
|
if (s?.query === undefined)
|
|
36204
36239
|
return false;
|
|
36205
36240
|
const query = JSON.stringify(s.query);
|
|
36206
|
-
return this.
|
|
36207
|
-
}
|
|
36208
|
-
storedQueriesMemo;
|
|
36209
|
-
storedQueries() {
|
|
36210
|
-
if (this.storedQueriesMemo)
|
|
36211
|
-
return this.storedQueriesMemo;
|
|
36212
|
-
const out = new Set;
|
|
36213
|
-
const contents = this.modelDef?.contents ?? {};
|
|
36214
|
-
for (const c of Object.values(contents)) {
|
|
36215
|
-
const d = c;
|
|
36216
|
-
if (typeof d?.sourceID === "string" && this.stored.has(d.sourceID) && d.query !== undefined) {
|
|
36217
|
-
out.add(JSON.stringify(d.query));
|
|
36218
|
-
}
|
|
36219
|
-
}
|
|
36220
|
-
this.storedQueriesMemo = out;
|
|
36221
|
-
return out;
|
|
36241
|
+
return (querySourceIDs(this.modelDef).get(query) ?? []).some((id) => this.stored.has(id));
|
|
36222
36242
|
}
|
|
36223
36243
|
tooDeep() {
|
|
36224
36244
|
return ++this.steps > 4096;
|
|
@@ -36929,6 +36949,7 @@ var init_gate_reads = __esm(() => {
|
|
|
36929
36949
|
init_prepared_query();
|
|
36930
36950
|
init_malloy_lexer_core();
|
|
36931
36951
|
init_query_text();
|
|
36952
|
+
init_stored_upstream();
|
|
36932
36953
|
GATE_KEYWORDS = new Set([
|
|
36933
36954
|
"and",
|
|
36934
36955
|
"or",
|
|
@@ -37995,6 +38016,7 @@ var RANGE_OPERATORS, EQUALITY_OPERATORS, ORDERING_FUNCTIONS, EQUALITY_FUNCTIONS,
|
|
|
37995
38016
|
var init_result_reads = __esm(() => {
|
|
37996
38017
|
init_prepared_query();
|
|
37997
38018
|
init_dialect();
|
|
38019
|
+
init_stored_upstream();
|
|
37998
38020
|
RANGE_OPERATORS = new Set([">", "<", ">=", "<="]);
|
|
37999
38021
|
EQUALITY_OPERATORS = new Set(["=", "!=", "like", "!like"]);
|
|
38000
38022
|
ORDERING_FUNCTIONS = new Set([
|
package/dist/server.mjs
CHANGED
|
@@ -135178,13 +135178,26 @@ function duckdbTableCollations(definition) {
|
|
|
135178
135178
|
function unquoted(name) {
|
|
135179
135179
|
return /^".*"$/.test(name) ? name.slice(1, -1).replace(/""/g, '"') : name;
|
|
135180
135180
|
}
|
|
135181
|
+
function bigqueryNamesNoCollation(name) {
|
|
135182
|
+
return typeof name !== "string" || BQ_NO_COLLATION.includes(name.trim().toUpperCase());
|
|
135183
|
+
}
|
|
135184
|
+
function bigqueryCollatedSql(column) {
|
|
135185
|
+
return `UPPER(TRIM(COALESCE(${column}, ''))) NOT IN (${BQ_NO_COLLATION.map((v) => `'${v}'`).join(", ")})`;
|
|
135186
|
+
}
|
|
135181
135187
|
function bigqueryColumnCollation(name) {
|
|
135182
|
-
return
|
|
135188
|
+
return bigqueryNamesNoCollation(name) ? BINARY_COLLATION : `bigquery:${name.trim()}`;
|
|
135189
|
+
}
|
|
135190
|
+
function canonicalCollation(identity) {
|
|
135191
|
+
const prefix = "bigquery:";
|
|
135192
|
+
return identity.startsWith(prefix) && bigqueryNamesNoCollation(identity.slice(prefix.length)) ? BINARY_COLLATION : identity;
|
|
135183
135193
|
}
|
|
135184
135194
|
function postgresColumnCollation(identity, judged) {
|
|
135185
135195
|
return judged === "binary" ? BINARY_COLLATION : `postgres:${identity}`;
|
|
135186
135196
|
}
|
|
135187
|
-
var BINARY_COLLATION = "binary", PG_COLLATION_COLUMNS = "c.collname AS name, c.collisdeterministic AS det, c.collcollate AS cc, c.collprovider AS prov, d.datcollate AS dbc, to_jsonb(d) ->> 'datlocprovider' AS dbp", PG_COLLATION_IDENTITY = `CASE WHEN c.collname = 'default' AND c.collnamespace = 'pg_catalog'::regnamespace THEN concat_ws('|', 'db', coalesce(to_jsonb(d) ->> 'datlocprovider', ''), d.datcollate, d.datctype, coalesce(to_jsonb(d) ->> 'daticulocale', ''), coalesce(to_jsonb(d) ->> 'datlocale', ''), coalesce(to_jsonb(d) ->> 'daticurules', ''), coalesce(to_jsonb(d) ->> 'datcollversion', '')) ELSE concat_ws('|', 'coll', c.collprovider, c.collisdeterministic::text, coalesce(c.collcollate, ''), coalesce(c.collctype, ''), coalesce(to_jsonb(c) ->> 'colliculocale', ''), coalesce(to_jsonb(c) ->> 'colllocale', ''), coalesce(to_jsonb(c) ->> 'collicurules', ''), coalesce(to_jsonb(c) ->> 'collversion', '')) END`, DUCKDB_COLLATE_DEFINITIONS = "SELECT (SELECT count(*) FROM duckdb_tables() WHERE NOT internal AND sql ILIKE '%collate%') + (SELECT count(*) FROM duckdb_views() WHERE NOT internal AND sql ILIKE '%collate%') + (SELECT count(*) FROM duckdb_functions() WHERE NOT internal AND function_type IN ('macro', 'table_macro') AND (macro_definition IS NULL OR macro_definition ILIKE '%collate%')) AS n";
|
|
135197
|
+
var BINARY_COLLATION = "binary", PG_COLLATION_COLUMNS = "c.collname AS name, c.collisdeterministic AS det, c.collcollate AS cc, c.collprovider AS prov, d.datcollate AS dbc, to_jsonb(d) ->> 'datlocprovider' AS dbp", PG_COLLATION_IDENTITY = `CASE WHEN c.collname = 'default' AND c.collnamespace = 'pg_catalog'::regnamespace THEN concat_ws('|', 'db', coalesce(to_jsonb(d) ->> 'datlocprovider', ''), d.datcollate, d.datctype, coalesce(to_jsonb(d) ->> 'daticulocale', ''), coalesce(to_jsonb(d) ->> 'datlocale', ''), coalesce(to_jsonb(d) ->> 'daticurules', ''), coalesce(to_jsonb(d) ->> 'datcollversion', '')) ELSE concat_ws('|', 'coll', c.collprovider, c.collisdeterministic::text, coalesce(c.collcollate, ''), coalesce(c.collctype, ''), coalesce(to_jsonb(c) ->> 'colliculocale', ''), coalesce(to_jsonb(c) ->> 'colllocale', ''), coalesce(to_jsonb(c) ->> 'collicurules', ''), coalesce(to_jsonb(c) ->> 'collversion', '')) END`, BQ_NO_COLLATION, DUCKDB_COLLATE_DEFINITIONS = "SELECT (SELECT count(*) FROM duckdb_tables() WHERE NOT internal AND sql ILIKE '%collate%') + (SELECT count(*) FROM duckdb_views() WHERE NOT internal AND sql ILIKE '%collate%') + (SELECT count(*) FROM duckdb_functions() WHERE NOT internal AND function_type IN ('macro', 'table_macro') AND (macro_definition IS NULL OR macro_definition ILIKE '%collate%')) AS n";
|
|
135198
|
+
var init_collation = __esm(() => {
|
|
135199
|
+
BQ_NO_COLLATION = ["", "NULL"];
|
|
135200
|
+
});
|
|
135188
135201
|
|
|
135189
135202
|
// src/service/materialization/domain/vocabulary.ts
|
|
135190
135203
|
var init_vocabulary = () => {};
|
|
@@ -135360,7 +135373,7 @@ function parseContract(raw) {
|
|
|
135360
135373
|
columns.push({
|
|
135361
135374
|
name: c.name,
|
|
135362
135375
|
nativeType: c.nativeType,
|
|
135363
|
-
collation: typeof c.collation === "string" ? c.collation : null,
|
|
135376
|
+
collation: typeof c.collation === "string" ? canonicalCollation(c.collation) : null,
|
|
135364
135377
|
compare: typeof c.compare === "string" && COMPARES.has(c.compare) ? c.compare : "none",
|
|
135365
135378
|
gateExact: c.gateExact === true,
|
|
135366
135379
|
...typeof c.declaredType === "string" && c.declaredType !== "" ? { declaredType: c.declaredType } : {}
|
|
@@ -135403,13 +135416,16 @@ function columnNamed(columns, name) {
|
|
|
135403
135416
|
const folded = columns.filter((c) => c.name.toLowerCase() === name.toLowerCase());
|
|
135404
135417
|
return folded.length === 1 ? folded[0] : undefined;
|
|
135405
135418
|
}
|
|
135406
|
-
function
|
|
135407
|
-
return nativeType.replace(
|
|
135419
|
+
function committedNativeType(nativeType, dialect) {
|
|
135420
|
+
return dialect === STORAGE_DIALECT ? nativeType.replace(DUCKDB_GEOMETRY_CRS, "GEOMETRY") : nativeType;
|
|
135421
|
+
}
|
|
135422
|
+
function spelledType(nativeType, dialect) {
|
|
135423
|
+
return committedNativeType(nativeType, dialect).replace(/\s+/g, " ").replace(/\s*([(),])\s*/g, "$1").trim().toUpperCase();
|
|
135408
135424
|
}
|
|
135409
135425
|
function contractDigest(contract) {
|
|
135410
135426
|
const canonical = contract.columns.map((c) => [
|
|
135411
135427
|
c.name,
|
|
135412
|
-
spelledType(c.nativeType),
|
|
135428
|
+
spelledType(c.nativeType, contract.dialect),
|
|
135413
135429
|
c.collation
|
|
135414
135430
|
]);
|
|
135415
135431
|
return createHash5("sha256").update(JSON.stringify(canonical)).digest("hex").slice(0, 32);
|
|
@@ -135449,7 +135465,7 @@ function deriveContract(args) {
|
|
|
135449
135465
|
const collation = c.isString && stored.collations ? collationOf(stored.collations, c.name) : null;
|
|
135450
135466
|
return {
|
|
135451
135467
|
name: c.name,
|
|
135452
|
-
nativeType: c.nativeType,
|
|
135468
|
+
nativeType: committedNativeType(c.nativeType, stored.dialect),
|
|
135453
135469
|
collation,
|
|
135454
135470
|
compare: columnCompare(args, c.isString, collation, c.name),
|
|
135455
135471
|
gateExact: tier === "database" ? c.storedAsDouble !== true : gateColumnTypeExact(c.nativeType, upstreamTypeNamed(args.upstreamTypes, c.name)),
|
|
@@ -135509,7 +135525,7 @@ function compatible(contract, observed) {
|
|
|
135509
135525
|
continue;
|
|
135510
135526
|
}
|
|
135511
135527
|
const type = now.nativeType ?? now.type;
|
|
135512
|
-
if (type === undefined || spelledType(type) !== spelledType(c.nativeType)) {
|
|
135528
|
+
if (type === undefined || spelledType(type, contract.dialect) !== spelledType(c.nativeType, contract.dialect)) {
|
|
135513
135529
|
retyped.push(c.name);
|
|
135514
135530
|
continue;
|
|
135515
135531
|
}
|
|
@@ -135542,10 +135558,13 @@ function declaredMoves(contract, declared) {
|
|
|
135542
135558
|
return now !== undefined && now !== "" && now !== c.declaredType ? [c.name] : [];
|
|
135543
135559
|
});
|
|
135544
135560
|
}
|
|
135545
|
-
var CONTRACT_VERSION = 1, COMPARES, COMPARE_RANK;
|
|
135561
|
+
var CONTRACT_VERSION = 1, COMPARES, DUCKDB_GEOMETRY_CRS, COMPARE_RANK;
|
|
135546
135562
|
var init_column_contract = __esm(() => {
|
|
135563
|
+
init_collation();
|
|
135564
|
+
init_dialect();
|
|
135547
135565
|
init_gate_policy();
|
|
135548
135566
|
COMPARES = new Set(["exact", "equality", "none"]);
|
|
135567
|
+
DUCKDB_GEOMETRY_CRS = /\bGEOMETRY\s*\(\s*'(?:[^']|'')*'\s*\)/gi;
|
|
135549
135568
|
COMPARE_RANK = {
|
|
135550
135569
|
none: 0,
|
|
135551
135570
|
equality: 1,
|
|
@@ -138623,9 +138642,11 @@ class BigQueryCatalog {
|
|
|
138623
138642
|
return bigqueryProbeOnce(this.reads, [this.connectionName, "dataset", dataset], () => bigqueryDatasetTables(this.io, dataset));
|
|
138624
138643
|
}
|
|
138625
138644
|
}
|
|
138626
|
-
var BQ_COLLATED
|
|
138645
|
+
var BQ_COLLATED, MAX_PROJECT_DATASETS = 1e4, TABLE_TYPES, PROJECT_ID, BIGQUERY_COLLATION;
|
|
138627
138646
|
var init_bigquery2 = __esm(() => {
|
|
138628
138647
|
init_quoting();
|
|
138648
|
+
init_collation();
|
|
138649
|
+
BQ_COLLATED = bigqueryCollatedSql("collation_name");
|
|
138629
138650
|
TABLE_TYPES = new Set(["BASE TABLE", "CLONE", "SNAPSHOT"]);
|
|
138630
138651
|
PROJECT_ID = /^(?:[a-z0-9.-]+:)?[a-z][a-z0-9-]{4,28}[a-z0-9]$/;
|
|
138631
138652
|
BIGQUERY_COLLATION = Object.freeze({ scope: "dataset" });
|
|
@@ -138663,6 +138684,7 @@ async function duckdbTableListed(io, tablePath) {
|
|
|
138663
138684
|
}
|
|
138664
138685
|
var DUCKDB_COLLATION;
|
|
138665
138686
|
var init_duckdb2 = __esm(() => {
|
|
138687
|
+
init_collation();
|
|
138666
138688
|
DUCKDB_COLLATION = Object.freeze({
|
|
138667
138689
|
scope: "instance",
|
|
138668
138690
|
sourceColumns: duckdbCollation,
|
|
@@ -138716,6 +138738,7 @@ async function postgresTableListed(io, tablePath) {
|
|
|
138716
138738
|
}
|
|
138717
138739
|
var POSTGRES_COLLATION;
|
|
138718
138740
|
var init_postgres2 = __esm(() => {
|
|
138741
|
+
init_collation();
|
|
138719
138742
|
POSTGRES_COLLATION = Object.freeze({
|
|
138720
138743
|
scope: "column",
|
|
138721
138744
|
sourceColumns: (io, sql) => postgresCollation(io, unfinalizedPostgresSQL(sql)),
|
|
@@ -138734,7 +138757,7 @@ function collationReaderOf(dialect) {
|
|
|
138734
138757
|
return name !== undefined && Object.hasOwn(COLLATION_READERS, name) ? COLLATION_READERS[name] : undefined;
|
|
138735
138758
|
}
|
|
138736
138759
|
var COLLATION_READERS;
|
|
138737
|
-
var
|
|
138760
|
+
var init_collation2 = __esm(() => {
|
|
138738
138761
|
init_dialect();
|
|
138739
138762
|
init_bigquery2();
|
|
138740
138763
|
init_duckdb2();
|
|
@@ -139112,6 +139135,8 @@ var init_source_capability = __esm(() => {
|
|
|
139112
139135
|
init_malloy_text();
|
|
139113
139136
|
init_source_reads();
|
|
139114
139137
|
init_collation();
|
|
139138
|
+
init_collation();
|
|
139139
|
+
init_collation2();
|
|
139115
139140
|
init_bigquery2();
|
|
139116
139141
|
init_postgres2();
|
|
139117
139142
|
init_catalog_io();
|
|
@@ -139288,6 +139313,26 @@ var init_composite_row_filter = __esm(() => {
|
|
|
139288
139313
|
init_authorize_routes();
|
|
139289
139314
|
});
|
|
139290
139315
|
|
|
139316
|
+
// src/service/event_loop_yield.ts
|
|
139317
|
+
function yieldToEventLoop() {
|
|
139318
|
+
return new Promise((resolve) => setImmediate(resolve));
|
|
139319
|
+
}
|
|
139320
|
+
function createEventLoopYielder() {
|
|
139321
|
+
let since = performance.now();
|
|
139322
|
+
return {
|
|
139323
|
+
async maybeYield() {
|
|
139324
|
+
if (performance.now() - since < budgetMs)
|
|
139325
|
+
return;
|
|
139326
|
+
await yieldToEventLoop();
|
|
139327
|
+
since = performance.now();
|
|
139328
|
+
}
|
|
139329
|
+
};
|
|
139330
|
+
}
|
|
139331
|
+
var DEFAULT_BUDGET_MS = 10, budgetMs;
|
|
139332
|
+
var init_event_loop_yield = __esm(() => {
|
|
139333
|
+
budgetMs = DEFAULT_BUDGET_MS;
|
|
139334
|
+
});
|
|
139335
|
+
|
|
139291
139336
|
// src/service/materialization/serve/gate_paths.ts
|
|
139292
139337
|
function fieldPathsIn(e, out = [], depth = 0) {
|
|
139293
139338
|
if (depth > 64 || e === null || typeof e !== "object")
|
|
@@ -139307,21 +139352,33 @@ function fieldPathsIn(e, out = [], depth = 0) {
|
|
|
139307
139352
|
}
|
|
139308
139353
|
|
|
139309
139354
|
// src/service/materialization/serve/stored_upstream.ts
|
|
139355
|
+
function querySourceIDs(modelDef) {
|
|
139356
|
+
if (modelDef === null || typeof modelDef !== "object")
|
|
139357
|
+
return new Map;
|
|
139358
|
+
let out = querySourcesMemo.get(modelDef);
|
|
139359
|
+
if (out)
|
|
139360
|
+
return out;
|
|
139361
|
+
out = new Map;
|
|
139362
|
+
const contents = modelDef.contents ?? {};
|
|
139363
|
+
for (const c of Object.values(contents)) {
|
|
139364
|
+
const d = c;
|
|
139365
|
+
if (typeof d?.sourceID !== "string" || d.query === undefined)
|
|
139366
|
+
continue;
|
|
139367
|
+
const q = JSON.stringify(d.query);
|
|
139368
|
+
out.set(q, [...out.get(q) ?? [], d.sourceID]);
|
|
139369
|
+
}
|
|
139370
|
+
querySourcesMemo.set(modelDef, out);
|
|
139371
|
+
return out;
|
|
139372
|
+
}
|
|
139310
139373
|
function storedUpstreamResolver(modelDef, stored) {
|
|
139311
139374
|
let byID;
|
|
139312
|
-
let byQuery;
|
|
139313
139375
|
const index = () => {
|
|
139314
139376
|
byID = new Map;
|
|
139315
|
-
byQuery = new Map;
|
|
139316
139377
|
const contents = modelDef?.contents ?? {};
|
|
139317
139378
|
for (const c of Object.values(contents)) {
|
|
139318
139379
|
const d = c;
|
|
139319
|
-
if (typeof d?.sourceID
|
|
139320
|
-
|
|
139321
|
-
byID.set(d.sourceID, d);
|
|
139322
|
-
if (stored.has(d.sourceID) && d.query !== undefined) {
|
|
139323
|
-
byQuery.set(JSON.stringify(d.query), d.sourceID);
|
|
139324
|
-
}
|
|
139380
|
+
if (typeof d?.sourceID === "string")
|
|
139381
|
+
byID.set(d.sourceID, d);
|
|
139325
139382
|
}
|
|
139326
139383
|
};
|
|
139327
139384
|
return (owner) => {
|
|
@@ -139333,7 +139390,7 @@ function storedUpstreamResolver(modelDef, stored) {
|
|
|
139333
139390
|
if (byID === undefined)
|
|
139334
139391
|
index();
|
|
139335
139392
|
if (at.query !== undefined) {
|
|
139336
|
-
const id =
|
|
139393
|
+
const id = (querySourceIDs(modelDef).get(JSON.stringify(at.query)) ?? []).findLast((x) => stored.has(x));
|
|
139337
139394
|
if (id !== undefined)
|
|
139338
139395
|
return id;
|
|
139339
139396
|
}
|
|
@@ -139346,6 +139403,10 @@ function storedUpstreamResolver(modelDef, stored) {
|
|
|
139346
139403
|
return;
|
|
139347
139404
|
};
|
|
139348
139405
|
}
|
|
139406
|
+
var querySourcesMemo;
|
|
139407
|
+
var init_stored_upstream = __esm(() => {
|
|
139408
|
+
querySourcesMemo = new WeakMap;
|
|
139409
|
+
});
|
|
139349
139410
|
|
|
139350
139411
|
// src/service/materialization/serve/gate_reads.ts
|
|
139351
139412
|
function gateIdentifiers(exprs) {
|
|
@@ -139656,22 +139717,7 @@ class GateReadWalk {
|
|
|
139656
139717
|
if (s?.query === undefined)
|
|
139657
139718
|
return false;
|
|
139658
139719
|
const query = JSON.stringify(s.query);
|
|
139659
|
-
return this.
|
|
139660
|
-
}
|
|
139661
|
-
storedQueriesMemo;
|
|
139662
|
-
storedQueries() {
|
|
139663
|
-
if (this.storedQueriesMemo)
|
|
139664
|
-
return this.storedQueriesMemo;
|
|
139665
|
-
const out = new Set;
|
|
139666
|
-
const contents = this.modelDef?.contents ?? {};
|
|
139667
|
-
for (const c of Object.values(contents)) {
|
|
139668
|
-
const d = c;
|
|
139669
|
-
if (typeof d?.sourceID === "string" && this.stored.has(d.sourceID) && d.query !== undefined) {
|
|
139670
|
-
out.add(JSON.stringify(d.query));
|
|
139671
|
-
}
|
|
139672
|
-
}
|
|
139673
|
-
this.storedQueriesMemo = out;
|
|
139674
|
-
return out;
|
|
139720
|
+
return (querySourceIDs(this.modelDef).get(query) ?? []).some((id) => this.stored.has(id));
|
|
139675
139721
|
}
|
|
139676
139722
|
tooDeep() {
|
|
139677
139723
|
return ++this.steps > 4096;
|
|
@@ -140382,6 +140428,7 @@ var init_gate_reads = __esm(() => {
|
|
|
140382
140428
|
init_prepared_query();
|
|
140383
140429
|
init_malloy_lexer_core();
|
|
140384
140430
|
init_query_text();
|
|
140431
|
+
init_stored_upstream();
|
|
140385
140432
|
GATE_KEYWORDS = new Set([
|
|
140386
140433
|
"and",
|
|
140387
140434
|
"or",
|
|
@@ -140453,8 +140500,15 @@ function readsKey(name, stored, rerooted) {
|
|
|
140453
140500
|
function readsNothing(r) {
|
|
140454
140501
|
return r !== undefined && !r.unresolved && !r.scoped && !r.gated && r.columns.length === 0 && r.names.size === 0 && r.entryPaths.length === 0;
|
|
140455
140502
|
}
|
|
140456
|
-
function
|
|
140503
|
+
function disjoint(a, b) {
|
|
140504
|
+
for (const id of a)
|
|
140505
|
+
if (b.has(id))
|
|
140506
|
+
return false;
|
|
140507
|
+
return true;
|
|
140508
|
+
}
|
|
140509
|
+
async function recordScopeFacts(runtime, args) {
|
|
140457
140510
|
const { modelDef, snapshot, lane } = args;
|
|
140511
|
+
const yielder = createEventLoopYielder();
|
|
140458
140512
|
const flags = new Map;
|
|
140459
140513
|
const reads = new Map;
|
|
140460
140514
|
const empty = new Set;
|
|
@@ -140472,6 +140526,7 @@ function recordScopeFacts(runtime, args) {
|
|
|
140472
140526
|
addSet(b.sourceIDs ?? []);
|
|
140473
140527
|
}
|
|
140474
140528
|
for (const name of Object.keys(modelDef.contents ?? {})) {
|
|
140529
|
+
await yielder.maybeYield();
|
|
140475
140530
|
const struct = resolveStructRefSource(name, modelDef);
|
|
140476
140531
|
if (struct === undefined)
|
|
140477
140532
|
continue;
|
|
@@ -140479,22 +140534,33 @@ function recordScopeFacts(runtime, args) {
|
|
|
140479
140534
|
carriesGate: carriesAGate(struct),
|
|
140480
140535
|
compositeRowFilter: compositeOf(struct, modelDef)
|
|
140481
140536
|
});
|
|
140482
|
-
const
|
|
140537
|
+
const askedStored = new AskedSet;
|
|
140538
|
+
const askedRerooted = new AskedSet;
|
|
140539
|
+
const none = gateReadsOfSource(struct, modelDef, askedStored, askedRerooted);
|
|
140483
140540
|
if (readsNothing(none)) {
|
|
140484
140541
|
reads.set(readsKey(name), none);
|
|
140485
140542
|
continue;
|
|
140486
140543
|
}
|
|
140487
140544
|
reads.set(readsKey(name, empty, empty), none);
|
|
140545
|
+
const readsOver = (set, rerooted) => {
|
|
140546
|
+
if (disjoint(set, askedStored.asked) && disjoint(rerooted, askedRerooted.asked)) {
|
|
140547
|
+
walks.reused++;
|
|
140548
|
+
return none;
|
|
140549
|
+
}
|
|
140550
|
+
walks.walked++;
|
|
140551
|
+
return gateReadsOfSource(struct, modelDef, set, rerooted);
|
|
140552
|
+
};
|
|
140488
140553
|
for (const set of storedSets) {
|
|
140489
140554
|
for (const rerooted of lane ? [empty, lane.rerooted] : [empty]) {
|
|
140490
140555
|
const key = readsKey(name, set, rerooted);
|
|
140491
140556
|
if (!reads.has(key)) {
|
|
140492
|
-
reads.set(key,
|
|
140557
|
+
reads.set(key, readsOver(set, rerooted));
|
|
140558
|
+
await yielder.maybeYield();
|
|
140493
140559
|
}
|
|
140494
140560
|
}
|
|
140495
140561
|
}
|
|
140496
140562
|
if (lane) {
|
|
140497
|
-
reads.set(readsKey(name, lane.stored, lane.rerooted),
|
|
140563
|
+
reads.set(readsKey(name, lane.stored, lane.rerooted), readsOver(lane.stored, lane.rerooted));
|
|
140498
140564
|
}
|
|
140499
140565
|
}
|
|
140500
140566
|
recorded3.set(runtime, {
|
|
@@ -140568,13 +140634,22 @@ function carriesAGate(node, seen = new WeakSet, depth = 0) {
|
|
|
140568
140634
|
}
|
|
140569
140635
|
return Object.values(record).some((v) => carriesAGate(v, seen, depth + 1));
|
|
140570
140636
|
}
|
|
140571
|
-
var recorded3, tablesMemo, MAX_GATE_WALK_DEPTH = 200;
|
|
140637
|
+
var recorded3, AskedSet, walks, tablesMemo, MAX_GATE_WALK_DEPTH = 200;
|
|
140572
140638
|
var init_scope_facts = __esm(() => {
|
|
140573
140639
|
init_authorize();
|
|
140574
140640
|
init_composite_row_filter();
|
|
140641
|
+
init_event_loop_yield();
|
|
140575
140642
|
init_prepared_query();
|
|
140576
140643
|
init_gate_reads();
|
|
140577
140644
|
recorded3 = new WeakMap;
|
|
140645
|
+
AskedSet = class AskedSet extends Set {
|
|
140646
|
+
asked = new Set;
|
|
140647
|
+
has(value) {
|
|
140648
|
+
this.asked.add(value);
|
|
140649
|
+
return super.has(value);
|
|
140650
|
+
}
|
|
140651
|
+
};
|
|
140652
|
+
walks = { walked: 0, reused: 0 };
|
|
140578
140653
|
tablesMemo = new WeakMap;
|
|
140579
140654
|
});
|
|
140580
140655
|
|
|
@@ -157233,6 +157308,7 @@ var RelationProbeUnsupportedError, CURRENT_SCHEMA_SQL, DUCKDB_CATALOGS_SQL = "SE
|
|
|
157233
157308
|
var init_warehouse_sql = __esm(() => {
|
|
157234
157309
|
init_introspection_sql();
|
|
157235
157310
|
init_quoting();
|
|
157311
|
+
init_collation();
|
|
157236
157312
|
init_dialect();
|
|
157237
157313
|
RelationProbeUnsupportedError = class RelationProbeUnsupportedError extends Error {
|
|
157238
157314
|
};
|
|
@@ -157515,7 +157591,7 @@ function movedColumns(built, read) {
|
|
|
157515
157591
|
if (!now)
|
|
157516
157592
|
return { kind: "moved", reason: `its column '${name}' is gone` };
|
|
157517
157593
|
const nowType = now.nativeType ?? now.type ?? "";
|
|
157518
|
-
if (now.storedAsDouble ||
|
|
157594
|
+
if (now.storedAsDouble || spelledType(nowType, read.dialect) !== spelledType(type, read.dialect)) {
|
|
157519
157595
|
return {
|
|
157520
157596
|
kind: "moved",
|
|
157521
157597
|
reason: `its column '${name}' was built as ${type} and is now ` + `${nowType || "of no readable type"}`
|
|
@@ -157543,9 +157619,6 @@ function storedUpstreamMove(entry, read) {
|
|
|
157543
157619
|
const reason = verdict.code === "column_gone" ? `its column '${name}' is gone` : verdict.code === "column_retyped" ? `its column '${name}' was built as ${built?.nativeType ?? "?"} ` + `and is now ${now?.nativeType ?? now?.type ?? "of no readable type"}` : `its column '${name}' no longer matches the contract its build ` + `recorded (${verdict.code})`;
|
|
157544
157620
|
return { kind: "moved", reason };
|
|
157545
157621
|
}
|
|
157546
|
-
function spelled(nativeType) {
|
|
157547
|
-
return nativeType.replace(/\s+/g, " ").replace(/\s*([(),])\s*/g, "$1").trim().toUpperCase();
|
|
157548
|
-
}
|
|
157549
157622
|
function columnNamed2(columns, name) {
|
|
157550
157623
|
const exact = columns.find((c) => c.name === name);
|
|
157551
157624
|
if (exact)
|
|
@@ -158077,7 +158150,7 @@ var init_generated_files = __esm(() => {
|
|
|
158077
158150
|
});
|
|
158078
158151
|
|
|
158079
158152
|
// package.json
|
|
158080
|
-
var version = "0.18.
|
|
158153
|
+
var version = "0.18.3";
|
|
158081
158154
|
var init_package = () => {};
|
|
158082
158155
|
|
|
158083
158156
|
// src/version.ts
|
|
@@ -163478,26 +163551,6 @@ var init_build_plan = __esm(() => {
|
|
|
163478
163551
|
};
|
|
163479
163552
|
});
|
|
163480
163553
|
|
|
163481
|
-
// src/service/event_loop_yield.ts
|
|
163482
|
-
function yieldToEventLoop() {
|
|
163483
|
-
return new Promise((resolve) => setImmediate(resolve));
|
|
163484
|
-
}
|
|
163485
|
-
function createEventLoopYielder() {
|
|
163486
|
-
let since = performance.now();
|
|
163487
|
-
return {
|
|
163488
|
-
async maybeYield() {
|
|
163489
|
-
if (performance.now() - since < budgetMs)
|
|
163490
|
-
return;
|
|
163491
|
-
await yieldToEventLoop();
|
|
163492
|
-
since = performance.now();
|
|
163493
|
-
}
|
|
163494
|
-
};
|
|
163495
|
-
}
|
|
163496
|
-
var DEFAULT_BUDGET_MS = 10, budgetMs;
|
|
163497
|
-
var init_event_loop_yield = __esm(() => {
|
|
163498
|
-
budgetMs = DEFAULT_BUDGET_MS;
|
|
163499
|
-
});
|
|
163500
|
-
|
|
163501
163554
|
// src/data_styles.ts
|
|
163502
163555
|
function compileDataStyles(styles) {
|
|
163503
163556
|
try {
|
|
@@ -169673,15 +169726,15 @@ var init_served_copy_checks = __esm(() => {
|
|
|
169673
169726
|
|
|
169674
169727
|
// src/service/materialization/serve/query_walks.ts
|
|
169675
169728
|
function reportQueryWalk(site) {
|
|
169676
|
-
|
|
169729
|
+
walks2.set(site, (walks2.get(site) ?? 0) + 1);
|
|
169677
169730
|
observer?.queryWalk(site);
|
|
169678
169731
|
}
|
|
169679
169732
|
function observeAdmission(o) {
|
|
169680
169733
|
observer = o;
|
|
169681
169734
|
}
|
|
169682
|
-
var observer,
|
|
169735
|
+
var observer, walks2;
|
|
169683
169736
|
var init_query_walks = __esm(() => {
|
|
169684
|
-
|
|
169737
|
+
walks2 = new Map;
|
|
169685
169738
|
});
|
|
169686
169739
|
|
|
169687
169740
|
// src/service/materialization/serve/result_reads.ts
|
|
@@ -170393,6 +170446,7 @@ var RANGE_OPERATORS, EQUALITY_OPERATORS, ORDERING_FUNCTIONS, EQUALITY_FUNCTIONS,
|
|
|
170393
170446
|
var init_result_reads = __esm(() => {
|
|
170394
170447
|
init_prepared_query();
|
|
170395
170448
|
init_dialect();
|
|
170449
|
+
init_stored_upstream();
|
|
170396
170450
|
RANGE_OPERATORS = new Set([">", "<", ">=", "<="]);
|
|
170397
170451
|
EQUALITY_OPERATORS = new Set(["=", "!=", "like", "!like"]);
|
|
170398
170452
|
ORDERING_FUNCTIONS = new Set([
|
|
@@ -181142,6 +181196,12 @@ function verdictExplains(reason, verdict) {
|
|
|
181142
181196
|
return true;
|
|
181143
181197
|
return reason === "ROW_LEVEL_GATE" && (verdict === "row_level_gate" || verdict === "refused");
|
|
181144
181198
|
}
|
|
181199
|
+
function contractVerdictOfTwin(candidate, tier, verdicts) {
|
|
181200
|
+
if (tier !== "database" || candidate.reason !== "NOT_BUILT")
|
|
181201
|
+
return;
|
|
181202
|
+
const twin = verdicts.get(liveVerdictKey("storage", candidate.tableId));
|
|
181203
|
+
return twin && CONTRACT_VERDICTS.has(twin.reason) ? twin : undefined;
|
|
181204
|
+
}
|
|
181145
181205
|
function applyServeVerdicts(considered, tierOf, input) {
|
|
181146
181206
|
const verdicts = input.catalog?.liveVerdicts ?? new Map;
|
|
181147
181207
|
const warnings = [];
|
|
@@ -181156,7 +181216,7 @@ function applyServeVerdicts(considered, tierOf, input) {
|
|
|
181156
181216
|
const tier = tierOf.get(candidate);
|
|
181157
181217
|
if (!tier)
|
|
181158
181218
|
continue;
|
|
181159
|
-
const verdict = verdicts.get(liveVerdictKey(tier, candidate.tableId));
|
|
181219
|
+
const verdict = verdicts.get(liveVerdictKey(tier, candidate.tableId)) ?? contractVerdictOfTwin(candidate, tier, verdicts);
|
|
181160
181220
|
if (!verdict || !verdictExplains(candidate.reason, verdict.reason)) {
|
|
181161
181221
|
if (own && ownVerdictExplains(candidate, own)) {
|
|
181162
181222
|
candidate.reason = "NOT_SERVED";
|
|
@@ -181233,6 +181293,10 @@ function verdictWarningMessage(reason) {
|
|
|
181233
181293
|
return "This table's storage destination is not configured on this server, so its queries are answered live.";
|
|
181234
181294
|
case "connection_cannot_hold_table":
|
|
181235
181295
|
return "This table's connection cannot hold a table, so its queries are answered live.";
|
|
181296
|
+
case "incompatible":
|
|
181297
|
+
return "This table no longer matches the column contract its build recorded, so its queries are answered live until a build rebuilds it.";
|
|
181298
|
+
case "contract_missing":
|
|
181299
|
+
return "This table carries no column contract, so its queries are answered live until a build rebuilds it in full.";
|
|
181236
181300
|
case "types_unrecorded":
|
|
181237
181301
|
return "This table's build recorded no column types, so a change since the build cannot be ruled out; its queries are answered live until it is rebuilt.";
|
|
181238
181302
|
default:
|
|
@@ -181496,10 +181560,11 @@ function fieldPathsIn2(e) {
|
|
|
181496
181560
|
}, { skipKeys: FIELD_PATH_SKIPPED_KEYS3 });
|
|
181497
181561
|
return out;
|
|
181498
181562
|
}
|
|
181499
|
-
var MAX_NOT_CONSIDERED = 10, FIELD_PATH_SKIPPED_KEYS3;
|
|
181563
|
+
var MAX_NOT_CONSIDERED = 10, CONTRACT_VERDICTS, FIELD_PATH_SKIPPED_KEYS3;
|
|
181500
181564
|
var init_query_path = __esm(() => {
|
|
181501
181565
|
init_array_query();
|
|
181502
181566
|
init_leg_decline();
|
|
181567
|
+
CONTRACT_VERDICTS = new Set(["incompatible", "contract_missing"]);
|
|
181503
181568
|
FIELD_PATH_SKIPPED_KEYS3 = new Set(["overload", "at"]);
|
|
181504
181569
|
});
|
|
181505
181570
|
|
|
@@ -183717,7 +183782,7 @@ class PackageMaterialization {
|
|
|
183717
183782
|
}
|
|
183718
183783
|
if (next.bindings.length > 0 || Object.keys(next.entries).length > 0) {
|
|
183719
183784
|
for (const model of this.owner.models().values()) {
|
|
183720
|
-
model.recordScopeFactsOver(next);
|
|
183785
|
+
await model.recordScopeFactsOver(next);
|
|
183721
183786
|
}
|
|
183722
183787
|
}
|
|
183723
183788
|
} finally {
|
|
@@ -184331,10 +184396,17 @@ class PackageMaterialization {
|
|
|
184331
184396
|
if (bindings === this.publishedBindings && !models)
|
|
184332
184397
|
return;
|
|
184333
184398
|
this.publishedBindings = bindings;
|
|
184334
|
-
|
|
184399
|
+
const targets = [...this.owner.models().values()];
|
|
184400
|
+
for (const model of targets)
|
|
184335
184401
|
this.setServedCopyContextOn(model);
|
|
184336
|
-
|
|
184337
|
-
|
|
184402
|
+
const run = this.commitChain.then(async () => {
|
|
184403
|
+
if (this.disposed)
|
|
184404
|
+
return;
|
|
184405
|
+
await Promise.all(targets.map((model) => model.prepareServedCopy()));
|
|
184406
|
+
});
|
|
184407
|
+
this.commitChain = run.catch(() => {
|
|
184408
|
+
return;
|
|
184409
|
+
});
|
|
184338
184410
|
this.bindTypeFindings(bindings);
|
|
184339
184411
|
this.scheduleLapse();
|
|
184340
184412
|
}
|
|
@@ -373874,6 +373946,7 @@ var init_admission_lookup = __esm(() => {
|
|
|
373874
373946
|
init_prepared_query();
|
|
373875
373947
|
init_source_reads();
|
|
373876
373948
|
init_collation();
|
|
373949
|
+
init_collation2();
|
|
373877
373950
|
init_bigquery2();
|
|
373878
373951
|
init_string_paths();
|
|
373879
373952
|
init_gate_reads();
|
|
@@ -381792,7 +381865,7 @@ var init_model = __esm(() => {
|
|
|
381792
381865
|
await this.refreshStringCapabilities();
|
|
381793
381866
|
const snapshot = this.servingSnapshot();
|
|
381794
381867
|
await this.prepareServedCopyOver(snapshot);
|
|
381795
|
-
this.recordScopeFactsOver(snapshot);
|
|
381868
|
+
await this.recordScopeFactsOver(snapshot);
|
|
381796
381869
|
}
|
|
381797
381870
|
stringCapabilityRuntime() {
|
|
381798
381871
|
return this.modelMaterializer?.runtime;
|
|
@@ -381819,7 +381892,7 @@ var init_model = __esm(() => {
|
|
|
381819
381892
|
});
|
|
381820
381893
|
}
|
|
381821
381894
|
}
|
|
381822
|
-
recordScopeFactsOver(snapshot = this.servingSnapshot()) {
|
|
381895
|
+
async recordScopeFactsOver(snapshot = this.servingSnapshot()) {
|
|
381823
381896
|
const lane = this.servedCopyEnabled() ? this.servedCopy.scopeLane() : undefined;
|
|
381824
381897
|
const runtime = this.modelMaterializer?.runtime;
|
|
381825
381898
|
const modelDef = this.modelDef;
|
|
@@ -381828,7 +381901,7 @@ var init_model = __esm(() => {
|
|
|
381828
381901
|
return;
|
|
381829
381902
|
}
|
|
381830
381903
|
try {
|
|
381831
|
-
record(runtime, {
|
|
381904
|
+
await record(runtime, {
|
|
381832
381905
|
modelDef,
|
|
381833
381906
|
snapshot,
|
|
381834
381907
|
...lane ? { lane } : {}
|
package/package.json
CHANGED