react-semaphor 0.1.468 → 0.1.470
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/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +110 -106
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +4 -4
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +4 -4
- package/dist/chunks/{analyze-result-contract-kaCNxjA7.js → analyze-result-contract-B3agc2XU.js} +1 -1
- package/dist/chunks/{analyze-result-contract-CMwVg9w2.cjs → analyze-result-contract-OgPk-zGu.cjs} +1 -1
- package/dist/chunks/{common-types-tRK8fhXV.cjs → common-types-C1IM7gao.cjs} +1 -1
- package/dist/chunks/{common-types-BgI-ymBp.js → common-types-g_1fKJLK.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DjBmkS6v.js → dashboard-briefing-launcher-DEVbQCQE.js} +9 -9
- package/dist/chunks/{dashboard-briefing-launcher-Bo4GmnB7.cjs → dashboard-briefing-launcher-exfJnSop.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-CstKugeB.cjs → dashboard-controls-8D1m_ECN.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-CvrCyVPZ.js → dashboard-controls-DPK-CRWL.js} +9 -9
- package/dist/chunks/{dashboard-filter-value-compatibility-o-kufPZB.js → dashboard-filter-value-compatibility-BAaqJGjt.js} +78 -78
- package/dist/chunks/dashboard-filter-value-compatibility-CYrWe1U6.cjs +1 -0
- package/dist/chunks/{dashboard-input-contract-12mPNhCF.cjs → dashboard-input-contract-JFJZgenC.cjs} +1 -1
- package/dist/chunks/{dashboard-input-contract-Ciboc347.js → dashboard-input-contract-Vr_3ApfF.js} +1 -1
- package/dist/chunks/{dashboard-json-D9r_xere.js → dashboard-json-DVWLTmIJ.js} +7 -7
- package/dist/chunks/{dashboard-json-ZGqzmExU.cjs → dashboard-json-DhKOoHwK.cjs} +1 -1
- package/dist/chunks/edit-dashboard-visual-B6zidwTu.cjs +172 -0
- package/dist/chunks/{edit-dashboard-visual-D64tmqA4.js → edit-dashboard-visual-CxEC3bPx.js} +7283 -7417
- package/dist/chunks/{editor-action-buttons-BXJlZl7z.cjs → editor-action-buttons-B3S00DsB.cjs} +1 -1
- package/dist/chunks/{editor-action-buttons-C2msc_en.js → editor-action-buttons-HfJ-Bohl.js} +6 -6
- package/dist/chunks/{index-CQN-X1jN.cjs → index-B4VxBoJg.cjs} +1 -1
- package/dist/chunks/index-DVBYvkj0.cjs +1404 -0
- package/dist/chunks/{index-DO4BESNy.js → index-oVXvCLH-.js} +9 -9
- package/dist/chunks/{index-B6cfDHwn.js → index-tsB3LfTQ.js} +33898 -33887
- package/dist/chunks/matrix-result-contract-DoU9diAh.js +822 -0
- package/dist/chunks/matrix-result-contract-SrzyG_KQ.cjs +1 -0
- package/dist/chunks/{pivot-header-presentation-OpY8xzdT.js → pivot-header-presentation-BW0Ay7WV.js} +2 -2
- package/dist/chunks/{pivot-header-presentation-DyV0iOZ_.cjs → pivot-header-presentation-DVBTHug2.cjs} +1 -1
- package/dist/chunks/{pivot-result-identity-CCMpd8ZA.js → pivot-result-identity-5v4hRVbc.js} +1 -1
- package/dist/chunks/{pivot-result-identity-gsOwOjHi.cjs → pivot-result-identity-DRUlTWUq.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-CEfU43GZ.cjs → pivot-result-lifecycle-DJgO2P0H.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-B38AZx4a.js → pivot-result-lifecycle-O_roVguV.js} +7 -7
- package/dist/chunks/{raw-temporal-contract-r_EMdR85.js → raw-temporal-contract-BEMf3avg.js} +1 -1
- package/dist/chunks/{raw-temporal-contract-UdblxoVB.cjs → raw-temporal-contract-D8YuxTAg.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-Dvy818KV.js → report-preferences-dialog-D-VpoQJz.js} +6 -6
- package/dist/chunks/{report-preferences-dialog-B89ypIJ-.cjs → report-preferences-dialog-DvNWNrlj.cjs} +1 -1
- package/dist/chunks/{report-runtime-context-CcXUjpb-.js → report-runtime-context-DnNbpkGo.js} +1 -1
- package/dist/chunks/{report-runtime-context-CLtzrZdC.cjs → report-runtime-context-RFiWq4wK.cjs} +1 -1
- package/dist/chunks/{saved-temporal-bucket-format-hylaofsQ.js → saved-temporal-bucket-format-CygnBDO2.js} +24 -24
- package/dist/chunks/{saved-temporal-bucket-format-Ca4hUfTo.cjs → saved-temporal-bucket-format-DNMtD77o.cjs} +1 -1
- package/dist/chunks/{switch-8PklEEN1.js → switch-DnbD-yCM.js} +248 -233
- package/dist/chunks/{switch-DykyqM66.cjs → switch-NAbuOQNg.cjs} +2 -2
- package/dist/chunks/{temporal-bucket-BDRcWdVv.cjs → temporal-bucket-9Wz9Ds6H.cjs} +1 -1
- package/dist/chunks/{temporal-bucket-Cc9fmx8s.js → temporal-bucket-CUKJktCl.js} +1 -1
- package/dist/chunks/{temporal-bucket-authoring-DjPFtRSF.js → temporal-bucket-authoring-CZoJV2L6.js} +3 -3
- package/dist/chunks/{temporal-bucket-authoring-C6sZAVqS.cjs → temporal-bucket-authoring-DSpzgXHc.cjs} +1 -1
- package/dist/chunks/{temporal-bucket-contract-vrOkax-r.cjs → temporal-bucket-contract-BD862TAa.cjs} +1 -1
- package/dist/chunks/{temporal-bucket-contract-DT4kU0VY.js → temporal-bucket-contract-Cno9TlYr.js} +1 -1
- package/dist/chunks/{token-types-DALtlgbG.cjs → token-types-CoHsSJ4E.cjs} +1 -1
- package/dist/chunks/{token-types-Z889rD6g.js → token-types-W3EHNW-D.js} +1 -1
- package/dist/chunks/{update-policy-Cyufdviq.cjs → update-policy-BGNXFgBU.cjs} +1 -1
- package/dist/chunks/{update-policy-Bu5Tw43R.js → update-policy-kRNJwwUV.js} +1 -1
- package/dist/chunks/{validators-DhTaCK1O.js → validators-B5t1s8oh.js} +274 -266
- package/dist/chunks/validators-DcshgK7w.cjs +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +4 -4
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +1 -1
- package/dist/data-app-codegen-node/index.js +3 -3
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +3 -3
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +3 -3
- package/dist/format-utils/index.cjs +1 -1
- package/dist/format-utils/index.js +12 -12
- package/dist/index.cjs +1 -1
- package/dist/index.js +14 -14
- package/dist/report-runtime-context/index.cjs +1 -1
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +3 -3
- package/dist/types/analytics-protocol.d.ts +69 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +4 -4
- package/dist/types/main.d.ts +1 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-filter-value-compatibility-Bnl2lsng.cjs +0 -1
- package/dist/chunks/edit-dashboard-visual-BzVDWVyZ.cjs +0 -172
- package/dist/chunks/index-DZdmd5AL.cjs +0 -1392
- package/dist/chunks/matrix-result-contract-C3cGHj_y.js +0 -598
- package/dist/chunks/matrix-result-contract-CkRVx693.cjs +0 -1
- package/dist/chunks/validators-DO-YuzgO.cjs +0 -1
|
@@ -0,0 +1,822 @@
|
|
|
1
|
+
var P = Object.defineProperty;
|
|
2
|
+
var R = (e, t, a) => t in e ? P(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
+
var g = (e, t, a) => R(e, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
+
import { p as j } from "./temporal-bucket-CUKJktCl.js";
|
|
5
|
+
import { a6 as K } from "./validators-B5t1s8oh.js";
|
|
6
|
+
import { v as O } from "./temporal-bucket-contract-Cno9TlYr.js";
|
|
7
|
+
function w(e) {
|
|
8
|
+
const t = E(e);
|
|
9
|
+
return t.length > 0 ? t.join(".") : void 0;
|
|
10
|
+
}
|
|
11
|
+
function q(e) {
|
|
12
|
+
const t = w(
|
|
13
|
+
e.qualifiedName
|
|
14
|
+
), a = (t == null ? void 0 : t.split(".")) || [];
|
|
15
|
+
if (a.length === 0) return {};
|
|
16
|
+
const r = {};
|
|
17
|
+
let s = a.length - 1;
|
|
18
|
+
for (let i = e.capabilities.prefixLevels.length - 1; i >= 0 && s >= 0; i -= 1, s -= 1)
|
|
19
|
+
A(
|
|
20
|
+
r,
|
|
21
|
+
e.capabilities.prefixLevels[i],
|
|
22
|
+
a[s]
|
|
23
|
+
);
|
|
24
|
+
return r;
|
|
25
|
+
}
|
|
26
|
+
function $(e) {
|
|
27
|
+
return !e.left.tableName || !e.right.tableName ? !1 : e.capabilities.prefixLevels.every((t) => {
|
|
28
|
+
const a = p(e.left, t), r = p(e.right, t);
|
|
29
|
+
return !a || !r || a === r;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function ce(e) {
|
|
33
|
+
return e.capabilities.prefixLevels.every((t) => {
|
|
34
|
+
const a = p(e.requested, t);
|
|
35
|
+
return a ? p(e.allowed, t) === a : !0;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function v(e, t = {}) {
|
|
39
|
+
const a = T(e), r = {
|
|
40
|
+
connectionId: t.connectionId,
|
|
41
|
+
connectionType: e,
|
|
42
|
+
path: ["database", "schema", "table"],
|
|
43
|
+
labels: {
|
|
44
|
+
database: "Database",
|
|
45
|
+
schema: "Schema",
|
|
46
|
+
table: "Table"
|
|
47
|
+
},
|
|
48
|
+
prefixLevels: ["database", "schema", "table"],
|
|
49
|
+
dialect: "postgres",
|
|
50
|
+
supportsFilterClause: !0
|
|
51
|
+
};
|
|
52
|
+
return a.includes("postgres") ? {
|
|
53
|
+
...r,
|
|
54
|
+
prefixLevels: ["schema", "table"],
|
|
55
|
+
dialect: "postgres"
|
|
56
|
+
} : a.includes("mysql") ? {
|
|
57
|
+
...r,
|
|
58
|
+
prefixLevels: ["database", "table"],
|
|
59
|
+
dialect: "mysql",
|
|
60
|
+
supportsFilterClause: !1
|
|
61
|
+
} : a.includes("mssql") || a.includes("sqlserver") ? {
|
|
62
|
+
...r,
|
|
63
|
+
dialect: "mssql",
|
|
64
|
+
supportsFilterClause: !1
|
|
65
|
+
} : a.includes("redshift") ? {
|
|
66
|
+
...r,
|
|
67
|
+
prefixLevels: ["schema", "table"],
|
|
68
|
+
dialect: "redshift"
|
|
69
|
+
} : a.includes("snowflake") ? {
|
|
70
|
+
...r,
|
|
71
|
+
dialect: "snowflake"
|
|
72
|
+
} : a.includes("clickhouse") ? {
|
|
73
|
+
connectionId: t.connectionId,
|
|
74
|
+
connectionType: e,
|
|
75
|
+
path: ["database", "table"],
|
|
76
|
+
labels: {
|
|
77
|
+
database: "Database",
|
|
78
|
+
table: "Table"
|
|
79
|
+
},
|
|
80
|
+
prefixLevels: ["database", "table"],
|
|
81
|
+
dialect: "clickhouse",
|
|
82
|
+
supportsFilterClause: !1
|
|
83
|
+
} : a === "s3" || a === "api" ? {
|
|
84
|
+
connectionId: t.connectionId,
|
|
85
|
+
connectionType: e,
|
|
86
|
+
path: ["table"],
|
|
87
|
+
labels: {
|
|
88
|
+
table: a === "api" ? "API Table" : "File Table"
|
|
89
|
+
},
|
|
90
|
+
prefixLevels: ["table"],
|
|
91
|
+
dialect: "duckdb",
|
|
92
|
+
supportsFilterClause: !0
|
|
93
|
+
} : a === "googlesheets" || a === "fileupload" ? {
|
|
94
|
+
connectionId: t.connectionId,
|
|
95
|
+
connectionType: e,
|
|
96
|
+
path: ["table"],
|
|
97
|
+
labels: {
|
|
98
|
+
table: "Table"
|
|
99
|
+
},
|
|
100
|
+
prefixLevels: ["table"],
|
|
101
|
+
dialect: "postgres",
|
|
102
|
+
supportsFilterClause: !0
|
|
103
|
+
} : a === "s3tables" ? {
|
|
104
|
+
...r,
|
|
105
|
+
labels: {
|
|
106
|
+
database: "Database",
|
|
107
|
+
schema: "Namespace",
|
|
108
|
+
table: "Table"
|
|
109
|
+
},
|
|
110
|
+
dialect: "duckdb"
|
|
111
|
+
} : a === "bigquery" ? {
|
|
112
|
+
...r,
|
|
113
|
+
labels: {
|
|
114
|
+
database: "Project",
|
|
115
|
+
schema: "Dataset",
|
|
116
|
+
table: "Table"
|
|
117
|
+
},
|
|
118
|
+
prefixLevels: ["schema", "table"],
|
|
119
|
+
dialect: "bigquery",
|
|
120
|
+
supportsFilterClause: !1
|
|
121
|
+
} : r;
|
|
122
|
+
}
|
|
123
|
+
function de(e) {
|
|
124
|
+
const t = T(e);
|
|
125
|
+
switch (t) {
|
|
126
|
+
case "mysql":
|
|
127
|
+
case "bigquery":
|
|
128
|
+
case "redshift":
|
|
129
|
+
case "snowflake":
|
|
130
|
+
case "clickhouse":
|
|
131
|
+
case "duckdb":
|
|
132
|
+
case "sqlite":
|
|
133
|
+
return t;
|
|
134
|
+
case "mssql":
|
|
135
|
+
case "sqlserver":
|
|
136
|
+
return "mssql";
|
|
137
|
+
case "postgres":
|
|
138
|
+
case "postgresql":
|
|
139
|
+
return "postgres";
|
|
140
|
+
default:
|
|
141
|
+
return "unknown";
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function ue(e) {
|
|
145
|
+
return e.capabilities.prefixLevels.every(
|
|
146
|
+
(t) => !!p(e.source, t)
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
function fe(e) {
|
|
150
|
+
const t = e.quoteIdentifier ?? F;
|
|
151
|
+
return e.capabilities.prefixLevels.map((a) => p(e.source, a)).filter((a) => !!a).map((a) => t(a, e.capabilities.dialect)).join(".");
|
|
152
|
+
}
|
|
153
|
+
function p(e, t) {
|
|
154
|
+
return t === "database" ? e.databaseName : t === "schema" ? e.schemaName : e.tableName;
|
|
155
|
+
}
|
|
156
|
+
function A(e, t, a) {
|
|
157
|
+
t === "database" ? e.databaseName = a : t === "schema" ? e.schemaName = a : e.tableName = a;
|
|
158
|
+
}
|
|
159
|
+
function E(e) {
|
|
160
|
+
const t = e == null ? void 0 : e.trim();
|
|
161
|
+
if (!t) return [];
|
|
162
|
+
const a = t.split(".").map((r) => {
|
|
163
|
+
const s = r.trim();
|
|
164
|
+
return s.length >= 2 && s.startsWith('"') && s.endsWith('"') ? s.slice(1, -1) : s;
|
|
165
|
+
});
|
|
166
|
+
return a.some((r) => !r) ? [] : a;
|
|
167
|
+
}
|
|
168
|
+
function F(e, t) {
|
|
169
|
+
return t === "mysql" || t === "bigquery" || t === "clickhouse" || t === "duckdb" ? `\`${e.replace(/`/g, "``")}\`` : t === "mssql" ? `[${e.replace(/]/g, "]]")}]` : `"${e.replace(/"/g, '""')}"`;
|
|
170
|
+
}
|
|
171
|
+
function T(e) {
|
|
172
|
+
if (typeof e != "string")
|
|
173
|
+
return "";
|
|
174
|
+
const t = [];
|
|
175
|
+
for (const a of e.trim().toLowerCase())
|
|
176
|
+
V(a) && t.push(a);
|
|
177
|
+
return t.join("");
|
|
178
|
+
}
|
|
179
|
+
function V(e) {
|
|
180
|
+
const t = e.charCodeAt(0);
|
|
181
|
+
return t >= 48 && t <= 57 || t >= 97 && t <= 122;
|
|
182
|
+
}
|
|
183
|
+
function m(e) {
|
|
184
|
+
return typeof e == "string" && e.trim() ? e.trim() : void 0;
|
|
185
|
+
}
|
|
186
|
+
function I(e) {
|
|
187
|
+
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
188
|
+
}
|
|
189
|
+
function G(e) {
|
|
190
|
+
const t = I(e);
|
|
191
|
+
return !t || !m(t.name) || t.type === "model" ? !1 : t.type === "dataset" ? t.datasetType === "physical" : !0;
|
|
192
|
+
}
|
|
193
|
+
function y(e) {
|
|
194
|
+
const t = I(e);
|
|
195
|
+
if (!t) return {};
|
|
196
|
+
const a = m(t.table) || m(t.name);
|
|
197
|
+
return {
|
|
198
|
+
...m(t.database) ? { databaseName: m(t.database) } : {},
|
|
199
|
+
...m(t.schema) ? { schemaName: m(t.schema) } : {},
|
|
200
|
+
...a ? { tableName: a } : {}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function me(e) {
|
|
204
|
+
const t = e.entities.filter(G), a = Q(e), r = z({
|
|
205
|
+
entities: t,
|
|
206
|
+
connectionType: e.connectionType
|
|
207
|
+
});
|
|
208
|
+
if (!r) return { kind: "incompatible_capabilities" };
|
|
209
|
+
const s = D({
|
|
210
|
+
hints: e.qualifiedHints || [],
|
|
211
|
+
coordinateHint: e.coordinateHint,
|
|
212
|
+
capabilities: r
|
|
213
|
+
});
|
|
214
|
+
if (s.kind !== "valid")
|
|
215
|
+
return { kind: s.kind };
|
|
216
|
+
const i = s.coordinates, n = i ? t.filter(
|
|
217
|
+
(c) => $({
|
|
218
|
+
left: y(c),
|
|
219
|
+
right: i,
|
|
220
|
+
capabilities: r
|
|
221
|
+
})
|
|
222
|
+
) : t;
|
|
223
|
+
if (i && n.length === 0)
|
|
224
|
+
return {
|
|
225
|
+
kind: "not_found",
|
|
226
|
+
basis: "qualified",
|
|
227
|
+
coordinates: i
|
|
228
|
+
};
|
|
229
|
+
if (i && n.length === 1) {
|
|
230
|
+
const c = n[0];
|
|
231
|
+
return {
|
|
232
|
+
kind: "resolved",
|
|
233
|
+
basis: "qualified",
|
|
234
|
+
entity: c,
|
|
235
|
+
coordinates: Y(
|
|
236
|
+
y(c),
|
|
237
|
+
i
|
|
238
|
+
)
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
const l = N([
|
|
242
|
+
...e.bareHints || [],
|
|
243
|
+
...s.bareHints,
|
|
244
|
+
i == null ? void 0 : i.tableName
|
|
245
|
+
]);
|
|
246
|
+
if (l.size > 0) {
|
|
247
|
+
const c = n.filter((u) => {
|
|
248
|
+
const h = X(u);
|
|
249
|
+
return Array.from(l).some((d) => h.has(d));
|
|
250
|
+
});
|
|
251
|
+
if (c.length === 1) {
|
|
252
|
+
const u = c[0];
|
|
253
|
+
return {
|
|
254
|
+
kind: "resolved",
|
|
255
|
+
basis: "bare",
|
|
256
|
+
entity: u,
|
|
257
|
+
coordinates: y(u)
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
return c.length > 1 ? { kind: "ambiguous", basis: "bare" } : { kind: "not_found", basis: "bare" };
|
|
261
|
+
}
|
|
262
|
+
if (i)
|
|
263
|
+
return { kind: "ambiguous", basis: "qualified" };
|
|
264
|
+
if (a)
|
|
265
|
+
return { kind: "not_found", basis: a };
|
|
266
|
+
if (t.length === 1) {
|
|
267
|
+
const c = t[0];
|
|
268
|
+
return {
|
|
269
|
+
kind: "resolved",
|
|
270
|
+
basis: "unqualified",
|
|
271
|
+
entity: c,
|
|
272
|
+
coordinates: y(c)
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
return { kind: "unqualified" };
|
|
276
|
+
}
|
|
277
|
+
function Q(e) {
|
|
278
|
+
const t = (e.qualifiedHints || []).map(m).filter((r) => !!r);
|
|
279
|
+
return Object.values(e.coordinateHint || {}).some(
|
|
280
|
+
(r) => !!m(r)
|
|
281
|
+
) || t.some((r) => r.includes(".")) ? "qualified" : [...t, ...e.bareHints || []].some(
|
|
282
|
+
(r) => !!m(r)
|
|
283
|
+
) ? "bare" : void 0;
|
|
284
|
+
}
|
|
285
|
+
function z(e) {
|
|
286
|
+
var r;
|
|
287
|
+
const t = m(e.connectionType);
|
|
288
|
+
if (t)
|
|
289
|
+
return v(t);
|
|
290
|
+
const a = e.entities.flatMap((s) => {
|
|
291
|
+
var l;
|
|
292
|
+
const i = m((l = I(s)) == null ? void 0 : l.connectionType);
|
|
293
|
+
if (!i) return [];
|
|
294
|
+
const n = v(i);
|
|
295
|
+
return [
|
|
296
|
+
{
|
|
297
|
+
capabilities: n,
|
|
298
|
+
signature: `${n.dialect}:${n.prefixLevels.join(".")}`
|
|
299
|
+
}
|
|
300
|
+
];
|
|
301
|
+
});
|
|
302
|
+
if (!(new Set(a.map((s) => s.signature)).size > 1))
|
|
303
|
+
return ((r = a[0]) == null ? void 0 : r.capabilities) || v(void 0);
|
|
304
|
+
}
|
|
305
|
+
function D(e) {
|
|
306
|
+
const t = [], a = [];
|
|
307
|
+
for (const u of e.hints) {
|
|
308
|
+
const h = m(u);
|
|
309
|
+
if (!h) continue;
|
|
310
|
+
if (!h.includes(".")) {
|
|
311
|
+
a.push(h);
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
const d = w(h);
|
|
315
|
+
if (!d) return { kind: "malformed" };
|
|
316
|
+
t.push(d);
|
|
317
|
+
}
|
|
318
|
+
const r = J(e.coordinateHint);
|
|
319
|
+
if (r.kind === "malformed") return r;
|
|
320
|
+
const s = Array.from(new Set(t)).map(
|
|
321
|
+
(u) => q({
|
|
322
|
+
qualifiedName: u,
|
|
323
|
+
capabilities: e.capabilities
|
|
324
|
+
})
|
|
325
|
+
);
|
|
326
|
+
if (!U(s, e.capabilities))
|
|
327
|
+
return { kind: "conflicting" };
|
|
328
|
+
const i = [...new Set(t)].sort(
|
|
329
|
+
(u, h) => h.split(".").length - u.split(".").length
|
|
330
|
+
)[0], n = i ? q({
|
|
331
|
+
qualifiedName: i,
|
|
332
|
+
capabilities: e.capabilities
|
|
333
|
+
}) : void 0, l = W(
|
|
334
|
+
r.coordinates,
|
|
335
|
+
e.capabilities
|
|
336
|
+
), c = !!(l.tableName && (l.databaseName || l.schemaName));
|
|
337
|
+
return n && c && !$({
|
|
338
|
+
left: n,
|
|
339
|
+
right: l,
|
|
340
|
+
capabilities: e.capabilities
|
|
341
|
+
}) ? { kind: "conflicting" } : {
|
|
342
|
+
kind: "valid",
|
|
343
|
+
coordinates: n ? c ? { ...n, ...l } : n : c ? l : void 0,
|
|
344
|
+
bareHints: [
|
|
345
|
+
...a,
|
|
346
|
+
...!c && l.tableName ? [l.tableName] : []
|
|
347
|
+
]
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function J(e) {
|
|
351
|
+
const t = {};
|
|
352
|
+
for (const [a, r] of Object.entries(e || {})) {
|
|
353
|
+
const s = m(r);
|
|
354
|
+
if (!s) continue;
|
|
355
|
+
const i = w(s);
|
|
356
|
+
if (!i) return { kind: "malformed" };
|
|
357
|
+
t[a] = i;
|
|
358
|
+
}
|
|
359
|
+
return { kind: "valid", coordinates: t };
|
|
360
|
+
}
|
|
361
|
+
function W(e, t) {
|
|
362
|
+
return {
|
|
363
|
+
...t.prefixLevels.includes("database") && e.databaseName ? { databaseName: e.databaseName } : {},
|
|
364
|
+
...t.prefixLevels.includes("schema") && e.schemaName ? { schemaName: e.schemaName } : {},
|
|
365
|
+
...e.tableName ? { tableName: e.tableName } : {}
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function U(e, t) {
|
|
369
|
+
return e.every(
|
|
370
|
+
(a, r) => e.slice(r + 1).every(
|
|
371
|
+
(s) => $({
|
|
372
|
+
left: a,
|
|
373
|
+
right: s,
|
|
374
|
+
capabilities: t
|
|
375
|
+
})
|
|
376
|
+
)
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
function N(e) {
|
|
380
|
+
return new Set(
|
|
381
|
+
e.map(m).map(w).filter((t) => !!t)
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
function X(e) {
|
|
385
|
+
const t = I(e);
|
|
386
|
+
return t ? N([
|
|
387
|
+
m(t.name),
|
|
388
|
+
m(t.table),
|
|
389
|
+
m(t.id)
|
|
390
|
+
]) : /* @__PURE__ */ new Set();
|
|
391
|
+
}
|
|
392
|
+
function Y(e, t) {
|
|
393
|
+
return {
|
|
394
|
+
...t,
|
|
395
|
+
...e
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
class H extends Error {
|
|
399
|
+
constructor(a) {
|
|
400
|
+
super(a.message);
|
|
401
|
+
g(this, "code");
|
|
402
|
+
g(this, "path");
|
|
403
|
+
this.name = "MatrixResultContractError", this.code = a.code, this.path = a.path;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function he(e) {
|
|
407
|
+
var c, u, h;
|
|
408
|
+
const t = ie(e);
|
|
409
|
+
if (t !== 2)
|
|
410
|
+
throw new H({
|
|
411
|
+
code: "unsupported_matrix_result_version",
|
|
412
|
+
message: `Canonical Matrix results require schemaVersion 2; received ${String(t)}.`,
|
|
413
|
+
path: "schemaVersion"
|
|
414
|
+
});
|
|
415
|
+
const a = K.safeParse(e);
|
|
416
|
+
if (!a.success) {
|
|
417
|
+
const d = a.error.issues[0];
|
|
418
|
+
throw o(
|
|
419
|
+
(d == null ? void 0 : d.message) || "Canonical Matrix result has an invalid shape.",
|
|
420
|
+
d == null ? void 0 : d.path.join(".")
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
const r = a.data, s = {
|
|
424
|
+
row: S(r.axes.rows.levels, "axes.rows.levels"),
|
|
425
|
+
column: S(
|
|
426
|
+
r.axes.columns.levels,
|
|
427
|
+
"axes.columns.levels"
|
|
428
|
+
)
|
|
429
|
+
};
|
|
430
|
+
re(r), B(r, "row"), B(r, "column");
|
|
431
|
+
const i = /* @__PURE__ */ new Set([
|
|
432
|
+
...r.axes.rows.nodeIds,
|
|
433
|
+
...r.axes.columns.nodeIds
|
|
434
|
+
]), n = /* @__PURE__ */ new Set();
|
|
435
|
+
for (const [d, f] of Object.entries(r.nodesById)) {
|
|
436
|
+
if (f.id !== d)
|
|
437
|
+
throw o(
|
|
438
|
+
"Matrix node directory key must equal node.id.",
|
|
439
|
+
`nodesById.${d}.id`
|
|
440
|
+
);
|
|
441
|
+
if (!i.has(d))
|
|
442
|
+
throw o(
|
|
443
|
+
"Matrix node directory cannot contain nodes omitted from both axes.",
|
|
444
|
+
`nodesById.${d}`
|
|
445
|
+
);
|
|
446
|
+
Z(f, s[f.axis], `nodesById.${d}`);
|
|
447
|
+
const b = JSON.stringify([
|
|
448
|
+
f.axis,
|
|
449
|
+
f.path,
|
|
450
|
+
f.isSubtotal === !0,
|
|
451
|
+
f.isGrandTotal === !0
|
|
452
|
+
]);
|
|
453
|
+
if (n.has(b))
|
|
454
|
+
throw o(
|
|
455
|
+
"Matrix nodes must have unique canonical path and total-role identity.",
|
|
456
|
+
`nodesById.${d}`
|
|
457
|
+
);
|
|
458
|
+
n.add(b), ae(r, f, `nodesById.${d}`);
|
|
459
|
+
}
|
|
460
|
+
const l = /* @__PURE__ */ new Set();
|
|
461
|
+
for (const [d, f] of r.cells.entries()) {
|
|
462
|
+
if (!((c = r.nodesById[f.rowId]) != null && c.axis) || ((u = r.nodesById[f.rowId]) == null ? void 0 : u.axis) !== "row")
|
|
463
|
+
throw o(
|
|
464
|
+
"Matrix cell rowId must reference a row node.",
|
|
465
|
+
`cells.${d}.rowId`
|
|
466
|
+
);
|
|
467
|
+
if (f.columnId && ((h = r.nodesById[f.columnId]) == null ? void 0 : h.axis) !== "column")
|
|
468
|
+
throw o(
|
|
469
|
+
"Matrix cell columnId must reference a column node.",
|
|
470
|
+
`cells.${d}.columnId`
|
|
471
|
+
);
|
|
472
|
+
if (!r.measuresById[f.measureId])
|
|
473
|
+
throw o(
|
|
474
|
+
"Matrix cell measureId must reference a measure.",
|
|
475
|
+
`cells.${d}.measureId`
|
|
476
|
+
);
|
|
477
|
+
const b = ee(
|
|
478
|
+
r.nodesById[f.rowId],
|
|
479
|
+
f.columnId ? r.nodesById[f.columnId] : void 0
|
|
480
|
+
);
|
|
481
|
+
if (f.role !== b)
|
|
482
|
+
throw o(
|
|
483
|
+
"Matrix cell role must match its referenced row and column total roles.",
|
|
484
|
+
`cells.${d}.role`
|
|
485
|
+
);
|
|
486
|
+
const k = JSON.stringify([
|
|
487
|
+
f.rowId,
|
|
488
|
+
f.columnId ?? null,
|
|
489
|
+
f.measureId
|
|
490
|
+
]);
|
|
491
|
+
if (l.has(k))
|
|
492
|
+
throw o(
|
|
493
|
+
"Matrix result cannot contain duplicate physical cell addresses.",
|
|
494
|
+
`cells.${d}`
|
|
495
|
+
);
|
|
496
|
+
l.add(k);
|
|
497
|
+
}
|
|
498
|
+
return te(r, s), r;
|
|
499
|
+
}
|
|
500
|
+
function S(e, t) {
|
|
501
|
+
var r;
|
|
502
|
+
const a = /* @__PURE__ */ new Map();
|
|
503
|
+
for (const [s, i] of e.entries()) {
|
|
504
|
+
const n = `${t}.${s}`;
|
|
505
|
+
if (a.has(i.instanceId))
|
|
506
|
+
throw o(
|
|
507
|
+
"Matrix axis level ids must be unique.",
|
|
508
|
+
`${n}.instanceId`
|
|
509
|
+
);
|
|
510
|
+
a.set(i.instanceId, i);
|
|
511
|
+
const l = i.field.role === "date" || i.field.dataType === "date" || i.field.dataType === "datetime", c = i.field.dataType === "string" || i.field.dataType === "number" || i.field.dataType === "boolean";
|
|
512
|
+
if (l && !i.grain)
|
|
513
|
+
throw o(
|
|
514
|
+
"Temporal Matrix axis level is missing its explicit grain.",
|
|
515
|
+
`${n}.grain`
|
|
516
|
+
);
|
|
517
|
+
if (c && i.grain)
|
|
518
|
+
throw o(
|
|
519
|
+
"Non-temporal Matrix axis level cannot carry a grain.",
|
|
520
|
+
`${n}.grain`
|
|
521
|
+
);
|
|
522
|
+
if (i.grain) {
|
|
523
|
+
if (!i.temporalBucket)
|
|
524
|
+
throw o(
|
|
525
|
+
"Temporal Matrix axis level is missing governed bucket metadata.",
|
|
526
|
+
`${n}.temporalBucket`
|
|
527
|
+
);
|
|
528
|
+
const u = O(i.temporalBucket);
|
|
529
|
+
if (!u.ok || ((r = u.value) == null ? void 0 : r.granularity) !== i.grain)
|
|
530
|
+
throw o(
|
|
531
|
+
"Matrix axis grain and temporal metadata must agree.",
|
|
532
|
+
`${n}.temporalBucket`
|
|
533
|
+
);
|
|
534
|
+
} else if (i.temporalBucket)
|
|
535
|
+
throw o(
|
|
536
|
+
"Non-temporal Matrix axis levels cannot carry temporal bucket metadata.",
|
|
537
|
+
n
|
|
538
|
+
);
|
|
539
|
+
}
|
|
540
|
+
return a;
|
|
541
|
+
}
|
|
542
|
+
function B(e, t) {
|
|
543
|
+
var s;
|
|
544
|
+
const a = t === "row" ? e.axes.rows : e.axes.columns, r = /* @__PURE__ */ new Set();
|
|
545
|
+
for (const [i, n] of a.nodeIds.entries()) {
|
|
546
|
+
if (r.has(n))
|
|
547
|
+
throw o(
|
|
548
|
+
"Matrix axis node ids must be unique.",
|
|
549
|
+
`axes.${t === "row" ? "rows" : "columns"}.nodeIds.${i}`
|
|
550
|
+
);
|
|
551
|
+
if (r.add(n), ((s = e.nodesById[n]) == null ? void 0 : s.axis) !== t)
|
|
552
|
+
throw o(
|
|
553
|
+
"Matrix axis node id references the wrong axis.",
|
|
554
|
+
`axes.${t === "row" ? "rows" : "columns"}.nodeIds.${i}`
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
function Z(e, t, a) {
|
|
559
|
+
if (e.isGrandTotal) {
|
|
560
|
+
if (e.isSubtotal)
|
|
561
|
+
throw o(
|
|
562
|
+
"Matrix nodes cannot be both subtotal and grand total.",
|
|
563
|
+
a
|
|
564
|
+
);
|
|
565
|
+
if (e.path.length !== 0)
|
|
566
|
+
throw o(
|
|
567
|
+
"Matrix grand-total nodes must have an empty member path.",
|
|
568
|
+
`${a}.path`
|
|
569
|
+
);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
if (!e.path.length || e.level !== e.path.length - 1)
|
|
573
|
+
throw o(
|
|
574
|
+
"Ordinary and subtotal Matrix nodes require a level-aligned non-empty path.",
|
|
575
|
+
a
|
|
576
|
+
);
|
|
577
|
+
const r = [...t.values()];
|
|
578
|
+
if (e.path.length > r.length)
|
|
579
|
+
throw o(
|
|
580
|
+
"Matrix node path exceeds its authored axis depth.",
|
|
581
|
+
`${a}.path`
|
|
582
|
+
);
|
|
583
|
+
if (e.isSubtotal && e.path.length >= r.length)
|
|
584
|
+
throw o(
|
|
585
|
+
"Matrix subtotal nodes must identify a proper authored-axis prefix.",
|
|
586
|
+
`${a}.path`
|
|
587
|
+
);
|
|
588
|
+
e.path.forEach((l, c) => {
|
|
589
|
+
const u = r[c];
|
|
590
|
+
if (l.instanceId === "__matrix_remaining__" && l.fieldKey === "__matrix_remaining__" && l.value === "__matrix_remaining__") {
|
|
591
|
+
if (c !== e.path.length - 1)
|
|
592
|
+
throw o(
|
|
593
|
+
"Matrix remaining-member identity must be the terminal path segment.",
|
|
594
|
+
`${a}.path.${c}`
|
|
595
|
+
);
|
|
596
|
+
if (typeof l.label != "string")
|
|
597
|
+
throw o(
|
|
598
|
+
"Matrix remaining-member paths require their explicit display label.",
|
|
599
|
+
`${a}.path.${c}.label`
|
|
600
|
+
);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
if (!u || l.instanceId !== u.instanceId || l.fieldKey !== u.fieldKey)
|
|
604
|
+
throw o(
|
|
605
|
+
"Matrix member path must follow authored axis order and identity.",
|
|
606
|
+
`${a}.path.${c}`
|
|
607
|
+
);
|
|
608
|
+
L(l, u, `${a}.path.${c}`);
|
|
609
|
+
});
|
|
610
|
+
const s = e.path[e.path.length - 1], i = s.instanceId === "__matrix_remaining__" && s.fieldKey === "__matrix_remaining__" && s.value === "__matrix_remaining__";
|
|
611
|
+
if (!M(e.value, s.value))
|
|
612
|
+
throw o(
|
|
613
|
+
"Matrix node value must equal its final canonical path member.",
|
|
614
|
+
`${a}.value`
|
|
615
|
+
);
|
|
616
|
+
const n = r[e.path.length - 1];
|
|
617
|
+
if (n != null && n.temporalBucket && !e.isSubtotal && !i && e.label !== void 0)
|
|
618
|
+
throw o(
|
|
619
|
+
"Temporal Matrix nodes cannot transport display labels.",
|
|
620
|
+
`${a}.label`
|
|
621
|
+
);
|
|
622
|
+
if ((!(n != null && n.temporalBucket) || i) && typeof e.label != "string")
|
|
623
|
+
throw o(
|
|
624
|
+
"Non-temporal Matrix nodes require a display label.",
|
|
625
|
+
`${a}.label`
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
function ee(e, t) {
|
|
629
|
+
return e.isGrandTotal && (t != null && t.isGrandTotal) ? "matrixGrandTotal" : e.isGrandTotal ? "rowGrandTotal" : t != null && t.isGrandTotal ? "columnGrandTotal" : e.isSubtotal && (t != null && t.isSubtotal) ? "subtotalIntersection" : e.isSubtotal ? "rowSubtotal" : t != null && t.isSubtotal ? "columnSubtotal" : "value";
|
|
630
|
+
}
|
|
631
|
+
function L(e, t, a) {
|
|
632
|
+
if (t.temporalBucket) {
|
|
633
|
+
if (e.label !== void 0)
|
|
634
|
+
throw o(
|
|
635
|
+
"Temporal Matrix path members cannot transport display labels.",
|
|
636
|
+
`${a}.label`
|
|
637
|
+
);
|
|
638
|
+
if (e.value !== null && typeof e.value != "string")
|
|
639
|
+
throw o(
|
|
640
|
+
"Temporal Matrix member values must be canonical strings or null.",
|
|
641
|
+
`${a}.value`
|
|
642
|
+
);
|
|
643
|
+
const r = j(
|
|
644
|
+
e.value,
|
|
645
|
+
t.temporalBucket
|
|
646
|
+
);
|
|
647
|
+
if (!r.ok)
|
|
648
|
+
throw o(r.error.message, `${a}.value`);
|
|
649
|
+
} else if (typeof e.label != "string")
|
|
650
|
+
throw o(
|
|
651
|
+
"Non-temporal Matrix path members require a display label.",
|
|
652
|
+
`${a}.label`
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
function te(e, t) {
|
|
656
|
+
const a = [...t.row.values()];
|
|
657
|
+
if (e.layout.rowHeaderLevels.length !== a.length)
|
|
658
|
+
throw o(
|
|
659
|
+
"Matrix row-header layout must describe every row-axis level exactly once.",
|
|
660
|
+
"layout.rowHeaderLevels"
|
|
661
|
+
);
|
|
662
|
+
e.layout.rowHeaderLevels.forEach((s, i) => {
|
|
663
|
+
var n;
|
|
664
|
+
if (s.fieldInstanceId !== ((n = a[i]) == null ? void 0 : n.instanceId))
|
|
665
|
+
throw o(
|
|
666
|
+
"Matrix row-header layout must follow authored row-axis order.",
|
|
667
|
+
`layout.rowHeaderLevels.${i}.fieldInstanceId`
|
|
668
|
+
);
|
|
669
|
+
});
|
|
670
|
+
for (const [s, i] of e.layout.columnHeaderRows.entries())
|
|
671
|
+
for (const [n, l] of i.cells.entries()) {
|
|
672
|
+
if (C(
|
|
673
|
+
l.columnPath,
|
|
674
|
+
t.column,
|
|
675
|
+
`layout.columnHeaderRows.${s}.cells.${n}.columnPath`
|
|
676
|
+
), l.measureInstanceId && !e.measuresById[l.measureInstanceId])
|
|
677
|
+
throw o(
|
|
678
|
+
"Matrix header measureInstanceId must reference a measure.",
|
|
679
|
+
`layout.columnHeaderRows.${s}.cells.${n}.measureInstanceId`
|
|
680
|
+
);
|
|
681
|
+
if (l.role === "columnHeader" && l.label !== void 0)
|
|
682
|
+
throw o(
|
|
683
|
+
"Matrix member headers cannot transport composed display labels.",
|
|
684
|
+
`layout.columnHeaderRows.${s}.cells.${n}.label`
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
const r = /* @__PURE__ */ new Set();
|
|
688
|
+
for (const [s, i] of e.layout.columns.entries()) {
|
|
689
|
+
if (r.has(i.id))
|
|
690
|
+
throw o(
|
|
691
|
+
"Matrix layout column ids must be unique.",
|
|
692
|
+
`layout.columns.${s}.id`
|
|
693
|
+
);
|
|
694
|
+
if (r.add(i.id), C(
|
|
695
|
+
i.columnPath,
|
|
696
|
+
t.column,
|
|
697
|
+
`layout.columns.${s}.columnPath`
|
|
698
|
+
), i.role === "value" && i.columnPath.length > 0 && i.label !== void 0)
|
|
699
|
+
throw o(
|
|
700
|
+
"Matrix value columns with member paths cannot transport composed display labels.",
|
|
701
|
+
`layout.columns.${s}.label`
|
|
702
|
+
);
|
|
703
|
+
if (!e.measuresById[i.measureInstanceId])
|
|
704
|
+
throw o(
|
|
705
|
+
"Matrix layout column measureInstanceId must reference a measure.",
|
|
706
|
+
`layout.columns.${s}.measureInstanceId`
|
|
707
|
+
);
|
|
708
|
+
if (i.columnNodeId) {
|
|
709
|
+
const n = e.nodesById[i.columnNodeId];
|
|
710
|
+
if ((n == null ? void 0 : n.axis) !== "column" || !M(n.path, i.columnPath))
|
|
711
|
+
throw o(
|
|
712
|
+
"Matrix layout column must match its referenced column node path.",
|
|
713
|
+
`layout.columns.${s}.columnNodeId`
|
|
714
|
+
);
|
|
715
|
+
} else if (t.column.size > 0)
|
|
716
|
+
throw o(
|
|
717
|
+
"Matrix columns with an authored column axis require a columnNodeId.",
|
|
718
|
+
`layout.columns.${s}.columnNodeId`
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
function C(e, t, a) {
|
|
723
|
+
const r = [...t.values()];
|
|
724
|
+
if (e.length > r.length)
|
|
725
|
+
throw o(
|
|
726
|
+
"Matrix layout path exceeds its authored axis depth.",
|
|
727
|
+
a
|
|
728
|
+
);
|
|
729
|
+
e.forEach((s, i) => {
|
|
730
|
+
const n = r[i];
|
|
731
|
+
if (!n || s.instanceId !== n.instanceId || s.fieldKey !== n.fieldKey)
|
|
732
|
+
throw o(
|
|
733
|
+
"Matrix layout path must follow authored axis order and identity.",
|
|
734
|
+
`${a}.${i}`
|
|
735
|
+
);
|
|
736
|
+
L(s, n, `${a}.${i}`);
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
function ae(e, t, a) {
|
|
740
|
+
if (!t.parentId) return;
|
|
741
|
+
const r = e.nodesById[t.parentId];
|
|
742
|
+
if (!r)
|
|
743
|
+
throw o(
|
|
744
|
+
"Matrix parentId must reference an existing node.",
|
|
745
|
+
`${a}.parentId`
|
|
746
|
+
);
|
|
747
|
+
if (r.axis !== t.axis || r.path.length !== t.path.length - 1 || !M(r.path, t.path.slice(0, -1)))
|
|
748
|
+
throw o(
|
|
749
|
+
"Matrix parentId must reference the immediate same-axis path prefix.",
|
|
750
|
+
`${a}.parentId`
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
function re(e) {
|
|
754
|
+
for (const [t, a] of [
|
|
755
|
+
["rows", e.axes.rows],
|
|
756
|
+
["columns", e.axes.columns]
|
|
757
|
+
]) {
|
|
758
|
+
const r = t === "rows" ? "row" : "column";
|
|
759
|
+
a.levels.forEach((s, i) => {
|
|
760
|
+
const n = e.fieldsById[s.instanceId];
|
|
761
|
+
if (!n || n.instanceId !== s.instanceId || n.fieldKey !== s.fieldKey || n.role !== r || !_(n.field, s.field))
|
|
762
|
+
throw o(
|
|
763
|
+
"Matrix axis level must have one matching role-scoped field descriptor.",
|
|
764
|
+
`axes.${t}.levels.${i}`
|
|
765
|
+
);
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
for (const [t, a] of Object.entries(e.measuresById)) {
|
|
769
|
+
if (a.instanceId !== t)
|
|
770
|
+
throw o(
|
|
771
|
+
"Matrix measure directory key must equal measure.instanceId.",
|
|
772
|
+
`measuresById.${t}.instanceId`
|
|
773
|
+
);
|
|
774
|
+
const r = e.fieldsById[t];
|
|
775
|
+
if (!r || r.instanceId !== t || r.fieldKey !== a.fieldKey || r.role !== "measure" || !_(r.field, a.field))
|
|
776
|
+
throw o(
|
|
777
|
+
"Matrix measure must have one matching field descriptor.",
|
|
778
|
+
`measuresById.${t}`
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
function ie(e) {
|
|
783
|
+
return e && typeof e == "object" ? e.schemaVersion : void 0;
|
|
784
|
+
}
|
|
785
|
+
function M(e, t) {
|
|
786
|
+
return JSON.stringify(e) === JSON.stringify(t);
|
|
787
|
+
}
|
|
788
|
+
function _(e, t) {
|
|
789
|
+
return x(e) === x(t);
|
|
790
|
+
}
|
|
791
|
+
function x(e) {
|
|
792
|
+
if (Array.isArray(e))
|
|
793
|
+
return `[${e.map(x).join(",")}]`;
|
|
794
|
+
if (e && typeof e == "object") {
|
|
795
|
+
const t = e;
|
|
796
|
+
return `{${Object.keys(t).filter((a) => t[a] !== void 0).sort().map(
|
|
797
|
+
(a) => `${JSON.stringify(a)}:${x(t[a])}`
|
|
798
|
+
).join(",")}}`;
|
|
799
|
+
}
|
|
800
|
+
return e === void 0 ? "undefined" : JSON.stringify(e);
|
|
801
|
+
}
|
|
802
|
+
function o(e, t) {
|
|
803
|
+
return new H({
|
|
804
|
+
code: "invalid_matrix_result_contract",
|
|
805
|
+
message: e,
|
|
806
|
+
path: t
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
export {
|
|
810
|
+
H as M,
|
|
811
|
+
ce as a,
|
|
812
|
+
ue as b,
|
|
813
|
+
w as c,
|
|
814
|
+
fe as d,
|
|
815
|
+
he as e,
|
|
816
|
+
v as g,
|
|
817
|
+
G as i,
|
|
818
|
+
de as n,
|
|
819
|
+
q as p,
|
|
820
|
+
me as r,
|
|
821
|
+
$ as s
|
|
822
|
+
};
|