react-semaphor 0.1.416 → 0.1.417
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 +1 -1
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +2 -2
- package/dist/chunks/{analyze-result-contract-DPjm6btg.js → analyze-result-contract-B0O3oIYu.js} +2 -1
- package/dist/chunks/analyze-result-contract-CL97m8X8.js +1 -0
- package/dist/chunks/{calendar-preferences-dialog-B8FmFRHX.js → calendar-preferences-dialog-BOfryj8P.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-ck4AU-to.js → calendar-preferences-dialog-Rq9qiG3X.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Br_1IK1z.js → dashboard-briefing-launcher-D_P0cNQ_.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-Tr2SqDMK.js → dashboard-briefing-launcher-DgvlOcRI.js} +4 -4
- package/dist/chunks/{dashboard-controls-B7OObDNl.js → dashboard-controls-DzVA-wWu.js} +1 -1
- package/dist/chunks/{dashboard-controls-B2bEv8uG.js → dashboard-controls-JYTKRokc.js} +5 -5
- package/dist/chunks/{dashboard-json-DNixjalS.js → dashboard-json-D5TEri2w.js} +1 -1
- package/dist/chunks/{dashboard-json-DAB8WVyb.js → dashboard-json-h6YMk_-l.js} +3 -3
- package/dist/chunks/{edit-dashboard-visual-Dh8Ge3-B.js → edit-dashboard-visual-DOtCYmDn.js} +4 -4
- package/dist/chunks/{edit-dashboard-visual-DWygSAp3.js → edit-dashboard-visual-kfbu03n9.js} +1 -1
- package/dist/chunks/{index-CQIMj-FF.js → index-Beol8cOo.js} +2 -2
- package/dist/chunks/{index-BkTLAfKy.js → index-BgESS5r7.js} +5 -5
- package/dist/chunks/{switch-DMlqgIx_.js → switch--FHwRAOL.js} +1 -1
- package/dist/chunks/{switch-DgiogS4X.js → switch-C8_t4Pio.js} +1 -1
- package/dist/chunks/update-policy-B50M0Jeg.js +3 -0
- package/dist/chunks/{update-policy-BnEbPhHW.js → update-policy-CQLHKQ_h.js} +304 -290
- package/dist/chunks/{use-create-flow-overlay-state-CZA-dSns.js → use-create-flow-overlay-state-BEPWzqQn.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-uujasvbD.js → use-create-flow-overlay-state-NEs9ePDy.js} +3 -3
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +1 -1
- 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 +18 -18
- package/dist/data-app-codegen-node/index.js +81 -81
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +1 -1
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +1 -1
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +1 -1
- package/dist/types/data-app-codegen-node.d.ts +4 -3
- package/dist/types/data-app-codegen.d.ts +4 -3
- package/package.json +1 -1
- package/dist/chunks/analyze-result-contract-8nxUOWp8.js +0 -1
- package/dist/chunks/update-policy-CWg9c08k.js +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as wn, a as $n, i as In, v as Fn } from "../chunks/analyze-result-contract-
|
|
2
|
-
import { c as Ve, G as me, a as ke, b as Re } from "../chunks/update-policy-
|
|
3
|
-
import { C as Vn, e as kn, R as Rn, f as Mn, g as Nn, h as xn, i as Cn, j as On, v as Gn, d as Kn } from "../chunks/update-policy-
|
|
1
|
+
import { S as wn, a as $n, i as In, v as Fn } from "../chunks/analyze-result-contract-B0O3oIYu.js";
|
|
2
|
+
import { c as Ve, G as me, a as ke, b as Re } from "../chunks/update-policy-CQLHKQ_h.js";
|
|
3
|
+
import { C as Vn, e as kn, R as Rn, f as Mn, g as Nn, h as xn, i as Cn, j as On, v as Gn, d as Kn } from "../chunks/update-policy-CQLHKQ_h.js";
|
|
4
4
|
import { createHash as fe } from "node:crypto";
|
|
5
5
|
const yn = "src/semaphor/generated", H = `// Generated by Semaphor Agent Plugin. Do not hand-edit analytics wiring here.
|
|
6
6
|
// Regenerate from the accepted semaphor_plan_data_app codegenSummary when the plan changes.
|
|
@@ -39,7 +39,7 @@ function gn(e, n = {}) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function Me(e) {
|
|
42
|
-
var l, u, d, m, c,
|
|
42
|
+
var l, u, d, m, c, $, F, b, R, G, V, N;
|
|
43
43
|
const n = [], r = [];
|
|
44
44
|
for (const s of e.inputs) {
|
|
45
45
|
g(r, s.fieldRef);
|
|
@@ -48,14 +48,14 @@ function Me(e) {
|
|
|
48
48
|
g(r, (l = s.optionQuery) == null ? void 0 : l.valueFieldRef), g(r, (u = s.optionQuery) == null ? void 0 : u.labelFieldRef), g(r, (d = s.optionQuery) == null ? void 0 : d.filterFieldRef), T(r, (m = s.optionQuery) == null ? void 0 : m.spec);
|
|
49
49
|
}
|
|
50
50
|
for (const s of e.filterContracts) {
|
|
51
|
-
g(r, s.fieldRef), g(r, (c = s.optionQuery) == null ? void 0 : c.valueFieldRef), g(r, (
|
|
51
|
+
g(r, s.fieldRef), g(r, (c = s.optionQuery) == null ? void 0 : c.valueFieldRef), g(r, ($ = s.optionQuery) == null ? void 0 : $.labelFieldRef), g(r, (F = s.optionQuery) == null ? void 0 : F.filterFieldRef), T(r, (b = s.optionQuery) == null ? void 0 : b.spec);
|
|
52
52
|
for (const S of s.bindings || [])
|
|
53
53
|
g(r, S.fieldRef);
|
|
54
54
|
}
|
|
55
55
|
for (const s of e.views) {
|
|
56
56
|
for (const S of s.fields || [])
|
|
57
57
|
g(r, S);
|
|
58
|
-
T(r, (
|
|
58
|
+
T(r, (R = s.sdkSpec) == null ? void 0 : R.spec), T(r, s.visualSpec);
|
|
59
59
|
}
|
|
60
60
|
const o = e.implementationChecklist || {};
|
|
61
61
|
for (const s of Object.values(o.bindingsByView || {}))
|
|
@@ -75,7 +75,7 @@ function Me(e) {
|
|
|
75
75
|
]
|
|
76
76
|
);
|
|
77
77
|
v(t, (s) => {
|
|
78
|
-
const S =
|
|
78
|
+
const S = w(s.raw);
|
|
79
79
|
return Q(
|
|
80
80
|
s.raw.label || (S == null ? void 0 : S.datasetName) || (S == null ? void 0 : S.datasetId) || (S == null ? void 0 : S.name) || s.raw.kind || "source"
|
|
81
81
|
);
|
|
@@ -123,7 +123,7 @@ function Me(e) {
|
|
|
123
123
|
v(i, (s) => s.name);
|
|
124
124
|
const I = e.views.filter((s) => ce(s) && !("sdkSpec" in s)).map((s) => rn(s));
|
|
125
125
|
for (const s of e.views)
|
|
126
|
-
(!("sdkSpec" in s) || !((V = s.sdkSpec) != null && V.builder) || !((
|
|
126
|
+
(!("sdkSpec" in s) || !((V = s.sdkSpec) != null && V.builder) || !((N = s.sdkSpec) != null && N.spec)) && !ce(s) && n.push(`Skipped view ${s.id || s.title || "unknown"} because it has no sdkSpec.`);
|
|
127
127
|
return Ne({
|
|
128
128
|
inputs: h,
|
|
129
129
|
views: i,
|
|
@@ -404,7 +404,7 @@ function Be(e, n) {
|
|
|
404
404
|
}
|
|
405
405
|
function je(e) {
|
|
406
406
|
const n = e.inputs.map((d) => {
|
|
407
|
-
const m =
|
|
407
|
+
const m = M(d.raw.fieldRef, e), c = [
|
|
408
408
|
`id: ${JSON.stringify(d.raw.id)}`,
|
|
409
409
|
`label: ${JSON.stringify(d.raw.label || d.raw.id)}`,
|
|
410
410
|
`operator: ${JSON.stringify(ln(d.raw))}`
|
|
@@ -414,20 +414,20 @@ function je(e) {
|
|
|
414
414
|
return ` ${d.name}: semaphor.filter({ ${c.join(", ")} }),`;
|
|
415
415
|
}).join(`
|
|
416
416
|
`), r = e.inputs.map((d) => `filterSpecs.${d.name}`).join(", "), o = e.inputs.map((d) => JSON.stringify(d.raw.id)).join(", "), t = e.optionQueries.map((d) => {
|
|
417
|
-
const m = d.input.raw, c = d.raw,
|
|
418
|
-
id:
|
|
419
|
-
inputId:
|
|
420
|
-
source:
|
|
417
|
+
const m = d.input.raw, c = d.raw, $ = w(c.spec) || {}, {
|
|
418
|
+
id: F,
|
|
419
|
+
inputId: b,
|
|
420
|
+
source: R,
|
|
421
421
|
sourceKey: G,
|
|
422
422
|
valueField: V,
|
|
423
|
-
labelField:
|
|
423
|
+
labelField: N,
|
|
424
424
|
population: s,
|
|
425
425
|
dependencies: S,
|
|
426
426
|
limit: j,
|
|
427
427
|
...ee
|
|
428
|
-
} =
|
|
428
|
+
} = $, U = c.sourceKey ? { sourceKey: c.sourceKey } : c.source || R || (typeof G == "string" ? { sourceKey: G } : void 0), ne = Se(U, e), re = M(c.valueFieldRef, e), te = M(c.labelFieldRef, e), oe = ye(d), se = {
|
|
429
429
|
...ee,
|
|
430
|
-
id: c.id ||
|
|
430
|
+
id: c.id || $.id || `${m.id}-options`,
|
|
431
431
|
inputId: m.id,
|
|
432
432
|
source: U,
|
|
433
433
|
valueField: c.valueFieldRef,
|
|
@@ -442,21 +442,21 @@ function je(e) {
|
|
|
442
442
|
return ` ${d.name}: semaphor.inputOptions({ ${Ie.join(", ")} }),`;
|
|
443
443
|
}).join(`
|
|
444
444
|
`), a = e.optionQueries.map((d) => {
|
|
445
|
-
const
|
|
446
|
-
const b =
|
|
445
|
+
const m = Te(e, d), c = m.length > 0 ? "inputHandles" : "_inputHandles", $ = m.map((F) => {
|
|
446
|
+
const b = M(F.raw.fieldRef, e);
|
|
447
447
|
if (!b)
|
|
448
448
|
throw new Error(
|
|
449
|
-
`Input option query ${d.raw.id || `${d.input.raw.id}-options`} references input ${
|
|
449
|
+
`Input option query ${d.raw.id || `${d.input.raw.id}-options`} references input ${F.raw.id} without a generated field reference.`
|
|
450
450
|
);
|
|
451
|
-
const
|
|
452
|
-
return ` if (${
|
|
453
|
-
inputs.push(semaphor.bindInput(${
|
|
451
|
+
const R = `inputHandles[${JSON.stringify(F.raw.id)}]`;
|
|
452
|
+
return ` if (${R}) {
|
|
453
|
+
inputs.push(semaphor.bindInput(${R}, { field: fields.${b} }));
|
|
454
454
|
}`;
|
|
455
455
|
}).join(`
|
|
456
456
|
`);
|
|
457
|
-
return ` ${d.name}(
|
|
457
|
+
return ` ${d.name}(${c}: SemaphorGeneratedInputHandleMap): SemaphorInputReference[] {
|
|
458
458
|
const inputs: SemaphorInputReference[] = [];
|
|
459
|
-
${
|
|
459
|
+
${$}
|
|
460
460
|
return inputs;
|
|
461
461
|
},`;
|
|
462
462
|
}).join(`
|
|
@@ -538,15 +538,15 @@ function ye(e) {
|
|
|
538
538
|
}
|
|
539
539
|
function Qe(e) {
|
|
540
540
|
const n = e.views.map((u) => {
|
|
541
|
-
var c,
|
|
541
|
+
var c, $, F, b, R, G;
|
|
542
542
|
const d = B(u.raw.sdkSpec.builder), m = _e(u);
|
|
543
543
|
if (W(u) && He(u)) {
|
|
544
|
-
const V = (c = u.raw.visualSpec) == null ? void 0 : c.tableBehavior,
|
|
544
|
+
const V = (c = u.raw.visualSpec) == null ? void 0 : c.tableBehavior, N = w(m.pagination), s = E(u), S = K(u), j = (($ = V == null ? void 0 : V.pagination) == null ? void 0 : $.pageSize) || J(N == null ? void 0 : N.pageSize) || J(m.limit) || 100, ee = S ? z(u, e) : [], U = S ? Pe({
|
|
545
545
|
view: u,
|
|
546
546
|
contract: e,
|
|
547
547
|
sortFields: ee,
|
|
548
|
-
defaultField: (
|
|
549
|
-
}) : void 0, ne = S ? (
|
|
548
|
+
defaultField: (F = V == null ? void 0 : V.sorting) == null ? void 0 : F.defaultField
|
|
549
|
+
}) : void 0, ne = S ? (b = V == null ? void 0 : V.sorting) == null ? void 0 : b.defaultDirection : void 0, re = De({
|
|
550
550
|
viewName: u.name,
|
|
551
551
|
supportsPagination: s,
|
|
552
552
|
supportsSort: S
|
|
@@ -568,7 +568,7 @@ ${oe}${se} });
|
|
|
568
568
|
},`;
|
|
569
569
|
}
|
|
570
570
|
if (ue(u) && E(u)) {
|
|
571
|
-
const V = (
|
|
571
|
+
const V = (R = u.raw.visualSpec) == null ? void 0 : R.tableBehavior, N = w(m.pagination), s = ((G = V == null ? void 0 : V.pagination) == null ? void 0 : G.pageSize) || J(N == null ? void 0 : N.pageSize) || J(m.limit) || 100;
|
|
572
572
|
return ` ${u.name}(
|
|
573
573
|
params: SemaphorGeneratedServerPaginationParams = {},
|
|
574
574
|
) {
|
|
@@ -669,7 +669,7 @@ ${a ? `function resolveServerTablePagination(
|
|
|
669
669
|
}
|
|
670
670
|
function _e(e) {
|
|
671
671
|
var a, p;
|
|
672
|
-
const n =
|
|
672
|
+
const n = w((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {}, { kind: r, id: o, ...t } = n;
|
|
673
673
|
return {
|
|
674
674
|
...t,
|
|
675
675
|
id: e.raw.id,
|
|
@@ -678,13 +678,13 @@ function _e(e) {
|
|
|
678
678
|
}
|
|
679
679
|
function z(e, n) {
|
|
680
680
|
var a, p;
|
|
681
|
-
const r = [], o =
|
|
681
|
+
const r = [], o = w((a = e.raw.sdkSpec) == null ? void 0 : a.spec) || {};
|
|
682
682
|
for (const f of q(o.fields)) g(r, f);
|
|
683
|
-
g(r, o.dateField), g(r, (p =
|
|
683
|
+
g(r, o.dateField), g(r, (p = w(o.orderBy)) == null ? void 0 : p.field);
|
|
684
684
|
for (const f of e.raw.fields || []) g(r, f);
|
|
685
685
|
return X(
|
|
686
686
|
r.map((f) => {
|
|
687
|
-
const h =
|
|
687
|
+
const h = M(f, n);
|
|
688
688
|
if (!(!f.name || !h))
|
|
689
689
|
return {
|
|
690
690
|
key: h,
|
|
@@ -709,7 +709,7 @@ function Pe({
|
|
|
709
709
|
const a = r.filter((i) => i.rawName === o);
|
|
710
710
|
if (a.length === 1)
|
|
711
711
|
return a[0].key;
|
|
712
|
-
const p =
|
|
712
|
+
const p = w((h = e.raw.sdkSpec) == null ? void 0 : h.spec), f = M((y = w(p == null ? void 0 : p.orderBy)) == null ? void 0 : y.field, n);
|
|
713
713
|
return f && t.has(f) ? f : void 0;
|
|
714
714
|
}
|
|
715
715
|
function De({
|
|
@@ -722,22 +722,22 @@ function De({
|
|
|
722
722
|
function Ue(e) {
|
|
723
723
|
const n = e.views.map((i) => {
|
|
724
724
|
const l = Le(e, i.raw.id).map((u) => {
|
|
725
|
-
const d = u.inputId, m =
|
|
725
|
+
const d = u.inputId, m = M(u.fieldRef, e);
|
|
726
726
|
if (!d || !m)
|
|
727
727
|
return "";
|
|
728
728
|
const c = [`field: fields.${m}`];
|
|
729
729
|
if (u.relationshipHint)
|
|
730
730
|
c.push(`relationshipHint: ${k(u.relationshipHint)}`);
|
|
731
731
|
else if (Array.isArray(u.relationshipsUsed) && u.relationshipsUsed.length > 0) {
|
|
732
|
-
const
|
|
733
|
-
var
|
|
734
|
-
return (
|
|
735
|
-
}).filter((
|
|
736
|
-
|
|
732
|
+
const F = u.relationshipsUsed.map((b) => {
|
|
733
|
+
var R;
|
|
734
|
+
return (R = w(b)) == null ? void 0 : R.id;
|
|
735
|
+
}).filter((b) => typeof b == "string" && b.length > 0);
|
|
736
|
+
F.length > 0 && c.push(`relationshipHint: ${k({ relationshipIds: F })}`);
|
|
737
737
|
}
|
|
738
|
-
const
|
|
739
|
-
return ` if (${
|
|
740
|
-
inputs.push(semaphor.bindInput(${
|
|
738
|
+
const $ = `inputHandles[${JSON.stringify(d)}]`;
|
|
739
|
+
return ` if (${$}) {
|
|
740
|
+
inputs.push(semaphor.bindInput(${$}, { ${c.join(", ")} }));
|
|
741
741
|
}`;
|
|
742
742
|
}).filter(Boolean).join(`
|
|
743
743
|
`);
|
|
@@ -816,7 +816,7 @@ function Le(e, n) {
|
|
|
816
816
|
function Je(e) {
|
|
817
817
|
const n = e.views.map((l) => {
|
|
818
818
|
const d = Y(l, e).map((m) => {
|
|
819
|
-
const c =
|
|
819
|
+
const c = M(m.raw, e);
|
|
820
820
|
return c ? ` ${m.name}: fields.${c},` : "";
|
|
821
821
|
}).filter(Boolean).join(`
|
|
822
822
|
`);
|
|
@@ -826,7 +826,7 @@ ${d}
|
|
|
826
826
|
}).join(`
|
|
827
827
|
`), r = e.views.map((l) => {
|
|
828
828
|
const d = L(l, e).map((m) => {
|
|
829
|
-
const c =
|
|
829
|
+
const c = M(m.raw, e);
|
|
830
830
|
return c ? ` ${m.name}: fields.${c},` : "";
|
|
831
831
|
}).filter(Boolean).join(`
|
|
832
832
|
`);
|
|
@@ -835,13 +835,13 @@ ${d}
|
|
|
835
835
|
},`;
|
|
836
836
|
}).join(`
|
|
837
837
|
`), o = e.views.map((l) => {
|
|
838
|
-
const u = L(l, e), d = en(u), m = Xe(u), c = u.map((
|
|
839
|
-
const
|
|
838
|
+
const u = L(l, e), d = en(u), m = Xe(u), c = u.map(($) => {
|
|
839
|
+
const F = Array.from(
|
|
840
840
|
new Set(
|
|
841
|
-
ge(
|
|
841
|
+
ge($.raw).filter((b) => m.has(b))
|
|
842
842
|
)
|
|
843
843
|
);
|
|
844
|
-
return ` ${
|
|
844
|
+
return ` ${$.name}: metricKeysForField(metricFieldsForView.${l.name}.${$.name}, { allowNameFallback: ${d.has($.raw.name) ? "false" : "true"}, excludedKeys: ${k(F)} }),`;
|
|
845
845
|
}).join(`
|
|
846
846
|
`);
|
|
847
847
|
return ` ${l.name}: {
|
|
@@ -862,8 +862,8 @@ ${d}
|
|
|
862
862
|
return {};
|
|
863
863
|
},`;
|
|
864
864
|
const d = Ze(l, u), m = u.map((c) => {
|
|
865
|
-
const
|
|
866
|
-
return ` ${c.name}: ${
|
|
865
|
+
const $ = `metricMeasureKeysForView.${l.name}.${c.name}`, F = `metricMeasureBindingKeysForView.${l.name}.${c.name}`, b = d.has(c.name) ? `readMetricValueByBindingWithFallback(measures, measureBindings, ${F}, ${$}, scalarValue)` : `readMetricValueByBinding(measures, measureBindings, ${F}, ${$})`;
|
|
866
|
+
return ` ${c.name}: ${b},`;
|
|
867
867
|
}).join(`
|
|
868
868
|
`);
|
|
869
869
|
return ` ${l.name}(result: SemaphorGeneratedMetricResult): Record<keyof typeof metricFieldsForView.${l.name}, unknown> {
|
|
@@ -1262,7 +1262,7 @@ function ze(e, n) {
|
|
|
1262
1262
|
(K(e) ? z(e, n) : []).map((t) => [t.fieldName, t.key])
|
|
1263
1263
|
);
|
|
1264
1264
|
return r.map((t) => {
|
|
1265
|
-
const a =
|
|
1265
|
+
const a = M(t.raw, n), p = a ? o.get(a) : void 0;
|
|
1266
1266
|
return A({
|
|
1267
1267
|
key: t.name,
|
|
1268
1268
|
label: t.raw.label || t.raw.name,
|
|
@@ -1366,7 +1366,7 @@ function T(e, n) {
|
|
|
1366
1366
|
for (const r of n) T(e, r);
|
|
1367
1367
|
return;
|
|
1368
1368
|
}
|
|
1369
|
-
|
|
1369
|
+
x(n) && g(e, P(n));
|
|
1370
1370
|
for (const r of Object.values(n))
|
|
1371
1371
|
T(e, r);
|
|
1372
1372
|
}
|
|
@@ -1377,7 +1377,7 @@ function Y(e, n) {
|
|
|
1377
1377
|
for (const t of e.raw.fields || [])
|
|
1378
1378
|
g(r, t);
|
|
1379
1379
|
const o = X(
|
|
1380
|
-
r.filter((t) => t.name &&
|
|
1380
|
+
r.filter((t) => t.name && M(t, n)).map((t) => ({ raw: t, key: D(t), name: "" })),
|
|
1381
1381
|
(t) => t.key
|
|
1382
1382
|
);
|
|
1383
1383
|
return v(
|
|
@@ -1388,12 +1388,12 @@ function Y(e, n) {
|
|
|
1388
1388
|
function L(e, n) {
|
|
1389
1389
|
if (B(e.raw.sdkSpec.builder) !== "metric")
|
|
1390
1390
|
return [];
|
|
1391
|
-
const r =
|
|
1391
|
+
const r = w(e.raw.sdkSpec.spec), o = [];
|
|
1392
1392
|
g(o, r == null ? void 0 : r.primaryMeasure);
|
|
1393
1393
|
for (const a of q(r == null ? void 0 : r.measures))
|
|
1394
1394
|
g(o, a);
|
|
1395
1395
|
const t = X(
|
|
1396
|
-
o.filter((a) => a.name &&
|
|
1396
|
+
o.filter((a) => a.name && M(a, n)).map((a) => ({ raw: a, key: D(a), name: "" })),
|
|
1397
1397
|
(a) => a.key
|
|
1398
1398
|
);
|
|
1399
1399
|
return v(
|
|
@@ -1404,8 +1404,8 @@ function L(e, n) {
|
|
|
1404
1404
|
function Ze(e, n) {
|
|
1405
1405
|
if (n.length === 1)
|
|
1406
1406
|
return /* @__PURE__ */ new Set([n[0].name]);
|
|
1407
|
-
const r =
|
|
1408
|
-
if (!
|
|
1407
|
+
const r = w(e.raw.sdkSpec.spec);
|
|
1408
|
+
if (!x(r == null ? void 0 : r.primaryMeasure))
|
|
1409
1409
|
return /* @__PURE__ */ new Set();
|
|
1410
1410
|
const o = D(P(r.primaryMeasure)), t = n.find((a) => a.key === o);
|
|
1411
1411
|
return t ? /* @__PURE__ */ new Set([t.name]) : /* @__PURE__ */ new Set();
|
|
@@ -1438,7 +1438,7 @@ function en(e) {
|
|
|
1438
1438
|
);
|
|
1439
1439
|
}
|
|
1440
1440
|
function nn(e, n) {
|
|
1441
|
-
const r =
|
|
1441
|
+
const r = w(n.spec);
|
|
1442
1442
|
if (!r)
|
|
1443
1443
|
return;
|
|
1444
1444
|
const o = B(n.builder);
|
|
@@ -1462,7 +1462,7 @@ function nn(e, n) {
|
|
|
1462
1462
|
for (const f of t) le(e, f);
|
|
1463
1463
|
for (const f of a) le(e, f);
|
|
1464
1464
|
for (const f of p) {
|
|
1465
|
-
const h =
|
|
1465
|
+
const h = w(f);
|
|
1466
1466
|
g(e, h == null ? void 0 : h.field), g(e, h == null ? void 0 : h.measure);
|
|
1467
1467
|
}
|
|
1468
1468
|
}
|
|
@@ -1470,23 +1470,23 @@ function nn(e, n) {
|
|
|
1470
1470
|
function pe(e) {
|
|
1471
1471
|
if (Array.isArray(e))
|
|
1472
1472
|
return e;
|
|
1473
|
-
const n =
|
|
1473
|
+
const n = w(e);
|
|
1474
1474
|
return Array.isArray(n == null ? void 0 : n.levels) ? n.levels : [];
|
|
1475
1475
|
}
|
|
1476
1476
|
function le(e, n) {
|
|
1477
1477
|
var r;
|
|
1478
|
-
if (
|
|
1478
|
+
if (x(n)) {
|
|
1479
1479
|
g(e, n);
|
|
1480
1480
|
return;
|
|
1481
1481
|
}
|
|
1482
|
-
g(e, (r =
|
|
1482
|
+
g(e, (r = w(n)) == null ? void 0 : r.field);
|
|
1483
1483
|
}
|
|
1484
1484
|
function ce(e) {
|
|
1485
1485
|
var n, r, o, t;
|
|
1486
1486
|
return ((n = e == null ? void 0 : e.computation) == null ? void 0 : n.kind) === "presentation_only" || ((r = e == null ? void 0 : e.computation) == null ? void 0 : r.kind) === "derived" || ((o = e == null ? void 0 : e.computation) == null ? void 0 : o.kind) === "unsupported" || (e == null ? void 0 : e.visual) === "text_block" || ((t = e == null ? void 0 : e.visualSpec) == null ? void 0 : t.visualType) === "text_block";
|
|
1487
1487
|
}
|
|
1488
1488
|
function rn(e) {
|
|
1489
|
-
const n =
|
|
1489
|
+
const n = w(e) || {};
|
|
1490
1490
|
return A({
|
|
1491
1491
|
id: e.id,
|
|
1492
1492
|
title: e.title,
|
|
@@ -1502,7 +1502,7 @@ function rn(e) {
|
|
|
1502
1502
|
});
|
|
1503
1503
|
}
|
|
1504
1504
|
function g(e, n) {
|
|
1505
|
-
|
|
1505
|
+
x(n) && e.push(P(n));
|
|
1506
1506
|
}
|
|
1507
1507
|
function P(e) {
|
|
1508
1508
|
return {
|
|
@@ -1530,12 +1530,12 @@ function tn(e) {
|
|
|
1530
1530
|
name: ""
|
|
1531
1531
|
};
|
|
1532
1532
|
}
|
|
1533
|
-
function
|
|
1534
|
-
const n =
|
|
1533
|
+
function x(e) {
|
|
1534
|
+
const n = w(e);
|
|
1535
1535
|
return !!(n && typeof n.name == "string" && (typeof n.role == "string" || typeof n.dataType == "string" || typeof n.aggregate == "string" || n.source || n.sourceKey));
|
|
1536
1536
|
}
|
|
1537
1537
|
function he(e) {
|
|
1538
|
-
const n =
|
|
1538
|
+
const n = w(e);
|
|
1539
1539
|
return !!(n && (typeof n.sourceKey == "string" || n.kind === "semantic" || typeof n.datasetName == "string" && typeof n.domainId == "string"));
|
|
1540
1540
|
}
|
|
1541
1541
|
function C(e, n) {
|
|
@@ -1545,22 +1545,22 @@ function C(e, n) {
|
|
|
1545
1545
|
return JSON.stringify(e);
|
|
1546
1546
|
if (Array.isArray(e))
|
|
1547
1547
|
return `[${e.map((t) => C(t, n)).join(", ")}]`;
|
|
1548
|
-
if (
|
|
1549
|
-
const t =
|
|
1548
|
+
if (x(e)) {
|
|
1549
|
+
const t = M(P(e), n);
|
|
1550
1550
|
if (t) return `fields.${t}`;
|
|
1551
1551
|
}
|
|
1552
1552
|
if (he(e)) {
|
|
1553
1553
|
const t = Se(e, n);
|
|
1554
1554
|
if (t) return `sources.${t}`;
|
|
1555
1555
|
}
|
|
1556
|
-
const r =
|
|
1556
|
+
const r = w(e);
|
|
1557
1557
|
return r ? `{ ${Object.entries(r).filter(([, t]) => t !== void 0).map(([t, a]) => `${JSON.stringify(t)}: ${C(a, n)}`).join(", ")} }` : JSON.stringify(e);
|
|
1558
1558
|
}
|
|
1559
1559
|
function k(e) {
|
|
1560
1560
|
return JSON.stringify(e, null, 2);
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1563
|
-
if (
|
|
1562
|
+
function M(e, n) {
|
|
1563
|
+
if (x(e))
|
|
1564
1564
|
return n.fieldNameByKey.get(D(P(e)));
|
|
1565
1565
|
}
|
|
1566
1566
|
function Se(e, n) {
|
|
@@ -1580,12 +1580,12 @@ function D(e) {
|
|
|
1580
1580
|
].join("|");
|
|
1581
1581
|
}
|
|
1582
1582
|
function on(e, n) {
|
|
1583
|
-
return !
|
|
1583
|
+
return !x(e) || !x(n) || e.name !== n.name ? !1 : ie(e).some(
|
|
1584
1584
|
(r) => ie(n).includes(r)
|
|
1585
1585
|
);
|
|
1586
1586
|
}
|
|
1587
1587
|
function sn(e) {
|
|
1588
|
-
return
|
|
1588
|
+
return x(e) && e.role === "id";
|
|
1589
1589
|
}
|
|
1590
1590
|
function an(e) {
|
|
1591
1591
|
const n = [], r = /* @__PURE__ */ new Map();
|
|
@@ -1619,7 +1619,7 @@ function we(e) {
|
|
|
1619
1619
|
return Z(e)[0] || de(e);
|
|
1620
1620
|
}
|
|
1621
1621
|
function Z(e) {
|
|
1622
|
-
const n =
|
|
1622
|
+
const n = w(e);
|
|
1623
1623
|
if (!n)
|
|
1624
1624
|
return [];
|
|
1625
1625
|
const r = [];
|
|
@@ -1633,14 +1633,14 @@ function $e(e) {
|
|
|
1633
1633
|
return Z(e);
|
|
1634
1634
|
}
|
|
1635
1635
|
function de(e) {
|
|
1636
|
-
const n =
|
|
1636
|
+
const n = w(e);
|
|
1637
1637
|
return n ? typeof n.sourceKey == "string" ? n.sourceKey : JSON.stringify(n) : "";
|
|
1638
1638
|
}
|
|
1639
1639
|
function dn(e) {
|
|
1640
|
-
return
|
|
1640
|
+
return x(e) && ie(e)[0] || "";
|
|
1641
1641
|
}
|
|
1642
1642
|
function ie(e) {
|
|
1643
|
-
return
|
|
1643
|
+
return x(e) ? _([
|
|
1644
1644
|
...typeof e.sourceKey == "string" ? [e.sourceKey] : [],
|
|
1645
1645
|
...e.source ? Z(e.source) : []
|
|
1646
1646
|
]) : [];
|
|
@@ -1656,7 +1656,7 @@ function pn(e) {
|
|
|
1656
1656
|
return n === "records" || n === "sql";
|
|
1657
1657
|
}
|
|
1658
1658
|
function ln(e) {
|
|
1659
|
-
const n =
|
|
1659
|
+
const n = w(e);
|
|
1660
1660
|
return typeof (n == null ? void 0 : n.operator) == "string" ? n.operator : e.type === "date_range" ? "between" : e.type === "multi_select" || e.type === "select" ? "in" : "=";
|
|
1661
1661
|
}
|
|
1662
1662
|
function v(e, n) {
|
|
@@ -1691,7 +1691,7 @@ function cn(e) {
|
|
|
1691
1691
|
function A(e) {
|
|
1692
1692
|
return Object.fromEntries(Object.entries(e).filter(([, n]) => n !== void 0));
|
|
1693
1693
|
}
|
|
1694
|
-
function
|
|
1694
|
+
function w(e) {
|
|
1695
1695
|
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
1696
1696
|
}
|
|
1697
1697
|
function q(e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../data-app-sdk-adapters/index.cjs"),i=require("react/jsx-runtime"),c=require("react"),Be=require("../chunks/source-identity-BM2FvJDP.js");require("../chunks/analyze-result-contract-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../data-app-sdk-adapters/index.cjs"),i=require("react/jsx-runtime"),c=require("react"),Be=require("../chunks/source-identity-BM2FvJDP.js");require("../chunks/analyze-result-contract-CL97m8X8.js");const se=require("../chunks/search-DNCejM7Z.js"),Ke=require("../chunks/x-B6ghREd2.js"),$r=require("../chunks/validators-JzI7olk4.js");function de(e,r,t={}){return{...t,name:e,role:r}}function Or(e){return e}function Br(e){return e}const Kr={source:{semantic(e){return{...e,kind:"semantic"}},sql(e){return{...e,kind:"sql"}}},field:{measure(e,r){return de(e,"measure",r)},dimension(e,r){return de(e,"dimension",r)},date(e,r){return de(e,"date",r)},id(e,r){return de(e,"id",r)}},filter(e){return{...e,kind:"filter"}},bindInput(e,r){return{toAnalyticsInput(){const[t]=w.toSemaphorInputSnapshots([e]),n=w.toSemaphorInputBinding({...r,inputId:r.inputId||t.inputId});return{...t,inputId:n.inputId,...n.kind?{kind:n.kind}:{},...n.controlRole?{controlRole:n.controlRole}:{},...n.operator?{operator:n.operator}:{},...n.field?{field:n.field}:{},...n.relationshipHint?{relationshipHint:n.relationshipHint}:{}}}}},control(e){return{...e,kind:"control"}},sqlParam(e){return{...e,kind:"control",role:"sqlParam"}},derivedField(e){return{...e,kind:"derived_field",expressionLanguage:e.expressionLanguage||"semaphor_sql_template"}},metric(e){return{...e,queryKind:"metric"}},analysis(e){return{...e,queryKind:"analysis"}},records(e){return{...e,queryKind:"records"}},inputOptions(e){return{...e,queryKind:"inputOptions"}},sql(e){return{...e,queryKind:"sql"}},matrix(e){return{...e,queryKind:"matrix"}}},ie=10,Re=8;function Wr(e){const r=e==null?void 0:e.result;if(r)switch(r.kind){case"records":return te({title:"Records",rowNoun:"rows",records:r.records,columns:r.columns,rowCount:r.rowCount});case"sql":return te({title:"SQL Rows",rowNoun:"rows",records:r.records,columns:r.columns,rowCount:r.rowCount});case"inputOptions":return te({title:"Options",rowNoun:"options",records:r.options.slice(0,ie).map(t=>{var n;return{label:t.label,value:t.value,count:t.count,disambiguation:(n=t.disambiguation)==null?void 0:n.join(" / ")}}),columns:[{key:"label",label:"Label"},{key:"value",label:"Value"},{key:"count",label:"Count"},{key:"disambiguation",label:"Disambiguation"}],rowCount:r.rowCount??r.options.length});case"metric":{const t=[{metric:"value",value:r.value}];return r.comparison&&t.push({metric:`${r.comparison.kind} value`,value:r.comparison.value},{metric:"delta",value:r.comparison.delta},{metric:"deltaPercent",value:r.comparison.deltaPercent}),te({title:"Metric",rowNoun:"values",records:t,columns:[{key:"metric",label:"Metric"},{key:"value",label:"Value"}],rowCount:t.length})}case"matrix":return te({title:"Matrix Cells",rowNoun:"cells",records:r.cells.slice(0,ie).map(t=>{const n=r.nodesById[t.rowId],s=t.columnId?r.nodesById[t.columnId]:void 0,o=r.measuresById[t.measureId];return{row:(n==null?void 0:n.label)||t.rowId,column:(s==null?void 0:s.label)||t.columnId||"Total",measure:(o==null?void 0:o.label)||t.measureId,value:t.formattedValue??t.value,role:t.role}}),columns:[{key:"row",label:"Row"},{key:"column",label:"Column"},{key:"measure",label:"Measure"},{key:"value",label:"Value"},{key:"role",label:"Role"}],rowCount:r.rowCount??r.cells.length});default:return _r(r)}}function te({title:e,rowNoun:r,records:t,columns:n,rowCount:s}){const o=Mr(n,t);if(!o.length)return;const u=s??t.length,p=t.slice(0,ie);return{title:e,summary:`${Pr(u)} ${r}`,columns:o.slice(0,Re),rows:p,truncatedRows:u>p.length,truncatedColumns:o.length>Re}}function Mr(e,r){if(e!=null&&e.length)return e.filter(n=>n.key).map(n=>({key:n.key,label:n.label||n.key}));const t=new Set;return r.slice(0,ie).forEach(n=>{Object.keys(n).forEach(s=>t.add(s))}),[...t].map(n=>({key:n,label:n}))}function _r(e){throw new Error(`Unhandled Semaphor result kind: ${ur(e)}`)}function Nr(e){return e===null?"null":e===void 0?"":typeof e=="string"?Xe(e):typeof e=="number"||typeof e=="boolean"?String(e):Xe(ur(e))}function Pr(e){return typeof e=="number"?e.toLocaleString():"-"}function ur(e){return JSON.stringify(e,null,2)??"undefined"}function Xe(e){return e.length>80?`${e.slice(0,77)}...`:e}function ye(e){return e.viewTitle||e.queryLabel||e.viewId||e.queryId}function zr(e){if(e.label)return e.label;if(e.queryKind!=="inputOptions")return;const t=e.labelField.label||e.valueField.label||e.labelField.name||e.valueField.name||e.inputId;return`${Fr(t)} Options`}function Fr(e){return(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\bfilter\b/gi," ").replace(/\boptions?\b/gi," ").replace(/\bid\b/gi," ").replace(/\s+/g," ").trim()||e).split(" ").filter(Boolean).map(n=>n===n.toUpperCase()&&n.length>1?n:`${n.slice(0,1).toUpperCase()}${n.slice(1)}`).join(" ")}function We(e){return e.flatMap(r=>{var y,m,v,g;const t=r.latestAttempt,n=t==null?void 0:t.executionResult,s=xe((y=n==null?void 0:n.validation)==null?void 0:y.warnings),o=xe((m=n==null?void 0:n.validation)==null?void 0:m.errors),u=Ur((v=n==null?void 0:n.coverage)==null?void 0:v.missingObligations),p=xe((g=n==null?void 0:n.coverage)==null?void 0:g.warnings),d=[],f=ye(r);(t==null?void 0:t.status)==="error"&&d.push({trace:r,tone:"error",title:f,message:t.errorMessage||"Query attempt failed."});for(const h of r.clientWarnings)d.push({trace:r,tone:"warning",title:f,message:h});for(const h of s)d.push({trace:r,tone:"warning",title:f,...h});for(const h of o)d.push({trace:r,tone:"error",title:f,...h});for(const h of u)d.push({trace:r,tone:"warning",title:f,message:h});for(const h of p)d.push({trace:r,tone:"warning",title:f,...h});return d})}function Hr(e){return{traceId:e.trace.traceId,queryId:e.trace.queryId,viewId:e.trace.viewId,viewTitle:e.trace.viewTitle,queryLabel:e.trace.queryLabel,severity:e.tone,title:e.title,message:e.message,code:e.code,path:e.path}}function Vr(e,r){return e.filter(t=>t.trace.traceId===r.traceId).length}function Qr(e){const r=We(e),t=e.filter(u=>{var p;return((p=u.latestAttempt)==null?void 0:p.status)==="error"}).length,n=e.filter(u=>{var p;return((p=u.latestAttempt)==null?void 0:p.status)==="loading"}).length,s=r.filter(u=>u.tone==="error").length,o=r.filter(u=>u.tone==="warning").length;return{total:e.length,failed:t,loading:n,errorCount:s,warningCount:o,issueCount:r.length,severity:t||s?"error":o?"warning":n?"loading":"ok"}}function Ur(e){return Array.isArray(e)?e.filter(r=>typeof r=="string"):[]}function xe(e){return Array.isArray(e)?e.map(Gr).filter(r=>!!r):[]}function Gr(e){if(typeof e=="string")return{message:e};if(!e||typeof e!="object"||Array.isArray(e))return;const r=e,t=typeof r.message=="string"?r.message:"",n=typeof r.code=="string"?r.code:"",s=typeof r.path=="string"?r.path:"";return t&&n?{message:s?`${t} (${n}, ${s})`:`${t} (${n})`,code:n,...s?{path:s}:{}}:t?{message:t,...s?{path:s}:{}}:n?{message:n,code:n}:void 0}function Jr(e){if(!e.enabled)return e;const r=e.queries.map(cr);return{enabled:e.enabled,queries:r,issues:e.issues,getQuery:t=>r.find(n=>n.queryId===t),getQueries:t=>r.filter(n=>n.queryId===t)}}function Ze(e){return e?cr(e):void 0}function cr(e){var r;return(r=e==null?void 0:e.latestAttempt)!=null&&r.executionResult?{...e,latestAttempt:{...e.latestAttempt,executionResult:Yr(e.latestAttempt.executionResult)}}:e}function Yr(e){const{compiledQuery:r,intent:t,result:n,...s}=e,o=Xr(s.metadata);return{...s,...o?{metadata:o}:{}}}function Xr(e){if(!e||typeof e!="object"||Array.isArray(e))return e;const r=e.dataAppDebug;if(!r||typeof r!="object"||Array.isArray(r))return e;const{compiledSql:t,...n}=r;return{...e,dataAppDebug:n}}function Zr(e){return e==="relative"?{position:"relative",top:"auto",right:"auto",bottom:"auto",left:"auto"}:{top:e.startsWith("top")?20:"auto",right:e.endsWith("right")?20:"auto",bottom:e.startsWith("bottom")?20:"auto",left:e.endsWith("left")?20:"auto"}}function et(e){return e==="error"?{borderColor:"var(--sd-error-border)",background:"var(--sd-error-bg)",color:"var(--sd-error-fg)"}:e==="warning"?{borderColor:"var(--sd-warning-border)",background:"var(--sd-warning-bg)",color:"var(--sd-warning-fg)"}:e==="loading"?{borderColor:"var(--sd-loading-border)",background:"var(--sd-loading-bg)",color:"var(--sd-loading-fg)"}:{borderColor:"var(--sd-success-border)",background:"var(--sd-success-bg)",color:"var(--sd-success-fg)"}}function rt(e){return e==="right"?{top:16,right:16,bottom:16,left:"auto",width:"min(720px, calc(100vw - 32px))",height:"auto",borderRadius:6}:{top:"auto",right:16,bottom:16,left:16,width:"auto",height:"min(420px, 45vh)",borderRadius:6}}function tt(e){return e==="right"?{gridTemplateColumns:"minmax(210px, 280px) minmax(0, 1fr)"}:{gridTemplateColumns:"minmax(260px, 340px) minmax(0, 1fr)"}}function nt(e){return{borderRight:"1px solid var(--sd-border)",borderBottom:0}}function fr(e){return e==="error"?{background:"var(--sd-error-dot)"}:e==="success"?{background:"var(--sd-success-dot)"}:e==="loading"?{background:"var(--sd-loading-dot)"}:{background:"var(--sd-idle-dot)"}}function st(e){return e==="error"?{borderColor:"var(--sd-error-border)",color:"var(--sd-error-fg)"}:e==="success"?{borderColor:"var(--sd-success-border)",color:"var(--sd-success-fg)"}:e==="loading"?{borderColor:"var(--sd-loading-border)",color:"var(--sd-loading-fg)"}:{borderColor:"var(--sd-border)",color:"var(--sd-fg-muted)"}}const er="semaphor-devtools-stylesheet",T="semaphor-devtools",it=`
|
|
2
2
|
.${T} {
|
|
3
3
|
--sd-bg: #ffffff;
|
|
4
4
|
--sd-bg-muted: #fafafa;
|
|
@@ -3,7 +3,7 @@ import { jsxs as p, Fragment as yr, jsx as a } from "react/jsx-runtime";
|
|
|
3
3
|
import { createContext as Ie, useContext as Q, useState as F, useRef as E, useEffect as B, useMemo as I, Fragment as Gr, useId as hr, useCallback as O, useReducer as Jr } from "react";
|
|
4
4
|
import { a as Yr, m as Xr } from "../chunks/source-identity-Cv4Nm3TM.js";
|
|
5
5
|
import { d as ro } from "../chunks/source-identity-Cv4Nm3TM.js";
|
|
6
|
-
import "../chunks/analyze-result-contract-
|
|
6
|
+
import "../chunks/analyze-result-contract-B0O3oIYu.js";
|
|
7
7
|
import { M as Zr, a as et, S as rt, E as tt, C as nt } from "../chunks/search-BHsQIWBV.js";
|
|
8
8
|
import { X as it, C as ot, j as st } from "../chunks/x-CXDkqdur.js";
|
|
9
9
|
import { b as at } from "../chunks/validators-UqQI3Cg_.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../chunks/operators-DrTQsJXv.js"),m=require("../chunks/source-identity-BM2FvJDP.js");require("../chunks/analyze-result-contract-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../chunks/operators-DrTQsJXv.js"),m=require("../chunks/source-identity-BM2FvJDP.js");require("../chunks/analyze-result-contract-CL97m8X8.js");function p(i){var n,e,a;const t=b(i);return{version:1,kind:"metric",id:i.id,label:i.label,source:u(i),measures:t,primaryMeasure:M(i,t),dateField:i.dateField?o(i.dateField,"date"):void 0,timeGrain:i.timeGrain,dimensions:(n=i.dimensions)==null?void 0:n.map(r=>o(r,"dimension")),comparison:G(i.comparison),orderBy:i.orderBy?{field:o(i.orderBy.field),direction:i.orderBy.direction}:void 0,inputs:l(i.inputs),...(e=i.filters)!=null&&e.length?{filters:i.filters}:{},...i.relationshipHint?{relationshipHint:i.relationshipHint}:{},limit:i.limit,...(a=i.derivedFields)!=null&&a.length?{derivedFields:i.derivedFields}:{}}}function c(i){return{...p(i),...i.timeWindow?{timeWindow:i.timeWindow}:{},...i.analysis?{analysis:i.analysis}:{}}}function F(i){return{...i.chartTitle?{chartTitle:i.chartTitle}:{},...i.chartType?{chartType:i.chartType}:{},...i.driverMode?{driverMode:i.driverMode}:{},...i.includePopulation!==void 0?{includePopulation:i.includePopulation}:{},...i.calendarContext?{calendarContext:i.calendarContext}:{}}}function M(i,t){if(!i.primaryMeasure)return t[0]||{name:"",role:"measure"};const n=o(i.primaryMeasure,"measure"),e=k(n,t),a=e.length===1?e[0]:void 0;return a?I(n,a):n}function b(i){const t=[];for(const n of i.measures.map(e=>o(e,"measure"))){if(!n.name)continue;const e=t.findIndex(a=>R(a,n));if(e===-1){t.push(n);continue}t[e]=I(t[e],n)}return t}function R(i,t){return m.semaphorFieldRefsMatch(i,t)&&d(i)===d(t)}function H(i,t){return d(t)===d(i)}function w(i,t){return t.name!==i.name||i.source&&!m.semaphorFieldRefsMatch(t,i)?!1:H(i,t)}function k(i,t){const n=t.filter(e=>w(i,e));return i.aggregate!==void 0,n}function d(i){return(i.aggregate||"SUM").toUpperCase()}function I(i,t){if(i.aggregate&&t.aggregate&&i.aggregate!==t.aggregate)throw new Error(`Measure "${i.name}" was requested with conflicting aggregate semantics: ${i.aggregate} and ${t.aggregate}.`);return{...m.preferSemaphorFieldRefMetadata(i,t),aggregate:i.aggregate||t.aggregate}}function A(i){var n,e;if("sort"in i)throw new Error("semaphor.records supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!V(i))throw new Error("semaphor.records needs at least one field.");const t=B(i.fields);return{version:1,kind:"records",id:i.id,label:i.label,source:u(i),fields:t,dateField:i.dateField?o(i.dateField,"date"):void 0,timeGrain:i.timeGrain,...i.timeWindow?{timeWindow:i.timeWindow}:{},...(n=i.filters)!=null&&n.length?{filters:i.filters}:{},orderBy:i.orderBy?{field:o(i.orderBy.field),direction:i.orderBy.direction}:void 0,inputs:l(i.inputs),...i.relationshipHint?{relationshipHint:i.relationshipHint}:{},limit:i.limit,...i.pagination?{pagination:i.pagination}:{},...i.totals?{totals:{mode:"server",measures:i.totals.measures.map(a=>o(a,"measure"))}}:{},...(e=i.derivedFields)!=null&&e.length?{derivedFields:i.derivedFields}:{}}}function B(i){return i.map(t=>{const n=o(t);if(!n.role)throw new Error(`semaphor.records field "${n.name}" needs an explicit role.`);return n})}function x(i){var t,n,e;return{version:1,kind:"inputOptions",id:i.id,label:i.label,inputId:i.inputId,source:u(i),labelField:o(i.labelField,"dimension"),valueField:o(i.valueField,"dimension"),...i.searchField?{searchField:o(i.searchField,"dimension")}:{},...(t=i.disambiguationFields)!=null&&t.length?{disambiguationFields:i.disambiguationFields.map(a=>o(a,"dimension"))}:{},...i.population?{population:i.population}:{},...i.dependencies?{dependencies:i.dependencies}:{},search:i.search,limit:i.limit,...(n=i.inputs)!=null&&n.length?{inputs:i.inputs.map(a=>f(a))}:{},...(e=i.derivedFields)!=null&&e.length?{derivedFields:i.derivedFields}:{}}}function O(i){var t;return{version:1,kind:"sql",id:i.id,label:i.label,source:i.source,sql:i.sql,...i.defaultParameters?{defaultParameters:i.defaultParameters}:{},...i.pythonCode?{pythonCode:i.pythonCode}:{},...(t=i.fields)!=null&&t.length?{fields:i.fields.map(n=>o(n))}:{},inputs:l(i.inputs),limit:i.limit,...i.pagination?{pagination:i.pagination}:{},rationale:i.rationale}}function C(i){var t,n;return{version:1,kind:"matrix",id:i.id,label:i.label,source:u(i),rows:i.rows.map(e=>g(e,"dimension")),...i.columns?{columns:i.columns.map(e=>g(e,"dimension"))}:{},values:i.values.map(P),...(t=i.filters)!=null&&t.length?{filters:i.filters}:{},inputs:l(i.inputs),...i.relationshipHint?{relationshipHint:i.relationshipHint}:{},...i.totals?{totals:i.totals}:{},...(n=i.sort)!=null&&n.length?{sort:i.sort}:{},...i.expansion?{expansion:i.expansion}:{},...i.layout?{layout:i.layout}:{},...i.displayLimits?{displayLimits:i.displayLimits}:{}}}function g(i,t){return z(i)?{...i,field:o(i.field,t)}:{field:o(i,t)}}function P(i){return T(i)?{...i,field:o(i.field,"measure")}:{field:o(i,"measure"),aggregate:i.aggregate}}function z(i){return"field"in i}function T(i){return"field"in i}function f(i){if("toAnalyticsInput"in i){const r=i.toAnalyticsInput();return{inputId:r.inputId,kind:r.kind,...r.controlRole?{controlRole:r.controlRole}:{},...r.operator?{operator:r.operator}:{},...r.field?{field:r.field}:{},...r.relationshipHint?{relationshipHint:r.relationshipHint}:{}}}if("id"in i){const r=h(i);return{inputId:r.inputId,kind:r.kind,...r.controlRole?{controlRole:r.controlRole}:{},...r.operator?{operator:r.operator}:{},...r.field?{field:r.field}:{},...r.relationshipHint?{relationshipHint:r.relationshipHint}:{}}}const t="kind"in i?i.kind:void 0,n="operator"in i?S(i.operator,i.inputId):void 0,e="controlRole"in i?i.controlRole:"role"in i?i.role:void 0,a=q(e)?e:void 0;return{inputId:i.inputId,...t?{kind:t}:{},...a?{controlRole:a}:{},...n?{operator:n}:{},...i.field?{field:i.field}:{},...i.relationshipHint?{relationshipHint:i.relationshipHint}:{}}}function q(i){return i==="grain"||i==="measure"||i==="dimension"||i==="aggregation"||i==="sqlParam"}function W(i){const t=l(i);return t.length>0?t:void 0}function y(i){return(i||[]).map(L)}function $(i){return y(i).filter(t=>t.isActive)}function h(i){if(i.kind==="filter"){const t=S(i.operator,i.id);return{inputId:i.id,kind:i.kind,label:i.label,field:o(i.field,"dimension"),operator:t||"in",...i.relationshipHint?{relationshipHint:i.relationshipHint}:{}}}return{inputId:i.id,kind:i.kind,label:i.label,controlRole:i.role}}function E(i=[]){return i.map(t=>typeof t=="object"?t:{label:String(t),value:t})}function s(i){return i==null?!1:Array.isArray(i)?i.length>0:typeof i=="string"?i.trim().length>0:!0}function L(i){if("toAnalyticsInput"in i)return i.toAnalyticsInput();if("kind"in i&&"isActive"in i)return i;if("id"in i){const t=h(i),n=Object.prototype.hasOwnProperty.call(i,"value")?i.value:i.defaultValue;return{inputId:t.inputId,kind:t.kind,label:t.label,...t.field?{field:t.field}:{},...t.operator?{operator:t.operator}:{},...t.controlRole?{controlRole:t.controlRole}:{},...t.relationshipHint?{relationshipHint:t.relationshipHint}:{},value:n,isActive:s(n)}}return{...i,kind:"filter",isActive:s(i.value),value:i.value}}function u(i){return i.source}function V(i){var t;return!!((t=i.fields)!=null&&t.length)}function o(i,t){return{...i,role:i.role||t}}function l(i){return(i||[]).map(f)}function G(i){if(i)return i}function S(i,t){if(i===void 0)return;const n=v.normalizeSemaphorInputOperator(i);if(!n)throw new Error(`useSemaphorInput "${t}" uses unsupported filter operator "${i}".`);return n}exports.hasSemaphorInputValue=s;exports.normalizeSemaphorInputOptions=E;exports.toSemaphorActiveInputSnapshots=$;exports.toSemaphorAnalysisIntent=c;exports.toSemaphorAnalysisQueryOptions=F;exports.toSemaphorInputBinding=f;exports.toSemaphorInputBindings=W;exports.toSemaphorInputOptionsIntent=x;exports.toSemaphorInputSnapshots=y;exports.toSemaphorInputSpec=h;exports.toSemaphorMatrixIntent=C;exports.toSemaphorMetricIntent=p;exports.toSemaphorRecordsIntent=A;exports.toSemaphorSqlIntent=O;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as I } from "../chunks/operators-C8TxpM4C.js";
|
|
2
2
|
import { s as m, p as F } from "../chunks/source-identity-Cv4Nm3TM.js";
|
|
3
|
-
import "../chunks/analyze-result-contract-
|
|
3
|
+
import "../chunks/analyze-result-contract-B0O3oIYu.js";
|
|
4
4
|
function p(i) {
|
|
5
5
|
var n, r, a;
|
|
6
6
|
const t = c(i);
|