@ahoo-wang/wow-view-engine 10.0.0-alpha.7 → 10.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{actions-BWlediub.js → actions-ClYpI7gy.js} +2806 -2793
- package/dist/actions-ClYpI7gy.js.map +1 -0
- package/dist/{export-BCADqfu6.js → export-D1udIJPm.js} +2 -2
- package/dist/{export-BCADqfu6.js.map → export-D1udIJPm.js.map} +1 -1
- package/dist/index.js +139 -139
- package/dist/index.js.map +1 -1
- package/dist/react/actionRunner.d.ts +8 -0
- package/dist/react/actionRunner.d.ts.map +1 -1
- package/dist/react/useRecordActions.d.ts +2 -0
- package/dist/react/useRecordActions.d.ts.map +1 -1
- package/dist/react/useSaveCommands.d.ts +6 -0
- package/dist/react/useSaveCommands.d.ts.map +1 -1
- package/dist/{react-D1wSQhlr.js → react-Cqk337ck.js} +1353 -1347
- package/dist/react-Cqk337ck.js.map +1 -0
- package/dist/react.js +1 -1
- package/dist/runtime/actions.d.ts +23 -0
- package/dist/runtime/actions.d.ts.map +1 -1
- package/dist/runtime/failure/failures.d.ts.map +1 -1
- package/dist/runtime/failure/issueReport.d.ts.map +1 -1
- package/dist/runtime/permissions.d.ts.map +1 -1
- package/dist/runtime/resources.d.ts +4 -1
- package/dist/runtime/resources.d.ts.map +1 -1
- package/dist/runtime/viewEngine.d.ts +7 -1
- package/dist/runtime/viewEngine.d.ts.map +1 -1
- package/dist/store/MemoryViewStore.d.ts +8 -0
- package/dist/store/MemoryViewStore.d.ts.map +1 -1
- package/dist/store/ViewStore.d.ts +16 -0
- package/dist/store/ViewStore.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/testing.js +112 -112
- package/dist/testing.js.map +1 -1
- package/dist/ui/actions/ActionButtons.d.ts.map +1 -1
- package/dist/ui/actions/ActionDialog.d.ts.map +1 -1
- package/dist/ui/actions/ActionSurface.d.ts +6 -0
- package/dist/ui/actions/ActionSurface.d.ts.map +1 -1
- package/dist/ui/dashboard/DashboardPanelCard.d.ts.map +1 -1
- package/dist/ui/dashboard/OpensNumber.d.ts +17 -0
- package/dist/ui/dashboard/OpensNumber.d.ts.map +1 -0
- package/dist/ui/kit/popups.d.ts.map +1 -1
- package/dist/ui/messages/dashboard.d.ts +1 -0
- package/dist/ui/messages/dashboard.d.ts.map +1 -1
- package/dist/ui/messages/definition.d.ts +1 -0
- package/dist/ui/messages/definition.d.ts.map +1 -1
- package/dist/ui/messages/en.d.ts +3 -0
- package/dist/ui/messages/en.d.ts.map +1 -1
- package/dist/ui/messages/scope.d.ts +1 -0
- package/dist/ui/messages/scope.d.ts.map +1 -1
- package/dist/ui/messages/zh-CN.d.ts.map +1 -1
- package/dist/ui/record/RecordDetail.d.ts +7 -1
- package/dist/ui/record/RecordDetail.d.ts.map +1 -1
- package/dist/ui/workbench/MoreViewActions.d.ts.map +1 -1
- package/dist/ui/workbench/RecordParts.d.ts.map +1 -1
- package/dist/ui/workbench/SaveActions.d.ts.map +1 -1
- package/dist/ui/workbench/SaveAsDialog.d.ts +7 -1
- package/dist/ui/workbench/SaveAsDialog.d.ts.map +1 -1
- package/dist/ui/workbench/ViewEngineProvider.d.ts.map +1 -1
- package/dist/ui/workbench/WriteOutcome.d.ts.map +1 -1
- package/dist/ui/workbench/address.d.ts +4 -2
- package/dist/ui/workbench/address.d.ts.map +1 -1
- package/dist/ui.js +5372 -5299
- package/dist/ui.js.map +1 -1
- package/dist/{viewRuntimeTypes-BCdG5xRp.js → viewRuntimeTypes-D08oR6Ke.js} +670 -655
- package/dist/viewRuntimeTypes-D08oR6Ke.js.map +1 -0
- package/package.json +3 -3
- package/dist/actions-BWlediub.js.map +0 -1
- package/dist/react-D1wSQhlr.js.map +0 -1
- package/dist/viewRuntimeTypes-BCdG5xRp.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { $a as e, $i as t,
|
|
1
|
+
import { $a as e, $i as t, $t as n, A as r, Ai as i, Ar as a, B as o, Ba as s, Bi as c, Bn as l, Br as u, Bt as d, C as f, Ca as p, Cn as m, D as h, Di as g, Do as ee, E as _, Ei as te, En as ne, Eo as v, Er as re, Et as ie, F as ae, Fi as oe, Fn as se, G as ce, Ga as le, Gi as y, Gr as ue, Gt as de, Hi as fe, Ht as pe, I as me, In as he, Ir as ge, J as _e, Ja as ve, Jr as ye, Jt as be, K as xe, Ka as b, Ki as Se, Kr as Ce, Kt as we, L as Te, Li as Ee, Mi as De, Mn as Oe, Mo as ke, N as Ae, Na as x, Ni as je, Nn as Me, Nt as S, O as Ne, On as Pe, Ot as Fe, P as Ie, Pa as Le, Pr as Re, Pt as ze, Qa as Be, Qt as C, R as Ve, Rr as He, S as Ue, Si as We, Sr as Ge, St as Ke, T as qe, Ta as Je, Tt as Ye, Ui as Xe, Un as Ze, Ur as Qe, Ut as w, V as $e, Vi as et, Vn as tt, Vt as nt, W as rt, Wa as it, Wi as at, Wr as ot, Y as st, Ya as ct, Yt as lt, Z as ut, Zi as dt, Zt as T, _a as ft, _t as pt, aa as mt, at as ht, ba as gt, bi as _t, bo as E, br as vt, bt as yt, ci as bt, co as xt, ct as St, do as D, dt as Ct, ea as wt, eo as O, fo as Tt, ft as Et, ga as k, gr as Dt, gt as Ot, ha as A, hi as j, ho as M, hr as kt, ia as At, it as jt, j as Mt, ji as N, jo as Nt, jt as Pt, k as Ft, ki as It, kt as Lt, la as Rt, ma as P, mo as F, mt as zt, na as Bt, nn as Vt, no as Ht, nt as Ut, oi as Wt, pt as Gt, q as I, qa as Kt, ri as qt, rn as Jt, rt as Yt, sa as Xt, si as Zt, so as Qt, st as $t, ta as en, tn, to as nn, ua as rn, ut as an, vi as L, vr as on, vt as sn, wn as cn, x as ln, xt as un, ya as dn, yi as fn, yt as pn, z as mn, zi as hn, zr as gn, zt as _n } from "./actions-ClYpI7gy.js";
|
|
2
2
|
import { AggregationGroupType as vn, QueryErrorCodes as R } from "@ahoo-wang/wow-client/dsl";
|
|
3
3
|
import { dequal as z } from "dequal";
|
|
4
4
|
// src/model/config.ts
|
|
5
5
|
var yn = ["filterMode"], bn = {
|
|
6
|
-
record: [...yn, ...
|
|
7
|
-
analysis: [...yn, ...
|
|
8
|
-
dashboard:
|
|
6
|
+
record: [...yn, ...At],
|
|
7
|
+
analysis: [...yn, ...gt],
|
|
8
|
+
dashboard: Rt
|
|
9
9
|
};
|
|
10
10
|
function xn(e) {
|
|
11
11
|
return bn[e] ?? [];
|
|
12
12
|
}
|
|
13
13
|
var Sn = {
|
|
14
14
|
record: [],
|
|
15
|
-
analysis:
|
|
15
|
+
analysis: ft,
|
|
16
16
|
dashboard: []
|
|
17
17
|
};
|
|
18
18
|
function Cn(e) {
|
|
@@ -20,13 +20,13 @@ function Cn(e) {
|
|
|
20
20
|
}
|
|
21
21
|
// src/filter/search.ts
|
|
22
22
|
function wn(e, t) {
|
|
23
|
-
if (e.op !==
|
|
23
|
+
if (e.op !== E.AND) return "";
|
|
24
24
|
let n = e.children.find((e) => Dn(e) && e.field === t);
|
|
25
25
|
return n && typeof n.value == "string" ? n.value : "";
|
|
26
26
|
}
|
|
27
27
|
function Tn(e, t, n) {
|
|
28
|
-
let r = n.trim().length === 0, i = e.op ===
|
|
29
|
-
op:
|
|
28
|
+
let r = n.trim().length === 0, i = e.op === E.AND || r && e.children.length === 0 ? e : {
|
|
29
|
+
op: E.AND,
|
|
30
30
|
children: e.children.length > 0 ? [e] : []
|
|
31
31
|
}, a = i.children.findIndex((e) => Dn(e) && e.field === t);
|
|
32
32
|
if (r) return a < 0 ? i : {
|
|
@@ -35,7 +35,7 @@ function Tn(e, t, n) {
|
|
|
35
35
|
};
|
|
36
36
|
let o = {
|
|
37
37
|
field: t,
|
|
38
|
-
operator:
|
|
38
|
+
operator: E.SEARCH,
|
|
39
39
|
value: n
|
|
40
40
|
}, s = a < 0 ? [...i.children, o] : i.children.map((e, t) => t === a ? o : e);
|
|
41
41
|
return {
|
|
@@ -50,30 +50,30 @@ function Dn(e) {
|
|
|
50
50
|
return "field" in e;
|
|
51
51
|
}
|
|
52
52
|
// src/record/defaults.ts
|
|
53
|
-
function On(e,
|
|
54
|
-
let
|
|
55
|
-
if (!
|
|
56
|
-
let
|
|
53
|
+
function On(e, n = b) {
|
|
54
|
+
let r = e.record;
|
|
55
|
+
if (!r) throw Error(`Definition ${e.id} declares no record capability`);
|
|
56
|
+
let i = e.fields.filter((e) => !t(e.kind)).map((e) => e.name), a = r.defaults ?? {}, o = a.layout ?? r.layouts[0], s = Math.min(a.pageSize ?? (o === "card" ? ve(n.cardPageSizes, n.defaultPageSize) : n.defaultPageSize), n.maxPageSize);
|
|
57
57
|
return {
|
|
58
|
-
filter:
|
|
59
|
-
filterMode:
|
|
60
|
-
refresh:
|
|
58
|
+
filter: a.filter ?? te(),
|
|
59
|
+
filterMode: a.filterMode ?? "simple",
|
|
60
|
+
refresh: a.refresh ?? { interval: null },
|
|
61
61
|
kind: "record",
|
|
62
|
-
sort:
|
|
63
|
-
pageSize:
|
|
64
|
-
...
|
|
65
|
-
layout:
|
|
66
|
-
table:
|
|
67
|
-
card:
|
|
68
|
-
title:
|
|
69
|
-
fields:
|
|
62
|
+
sort: a.sort ?? [],
|
|
63
|
+
pageSize: s,
|
|
64
|
+
...a.summaries ? { summaries: a.summaries } : {},
|
|
65
|
+
layout: o,
|
|
66
|
+
table: a.table ?? { columns: i.slice(0, n.defaultColumns).map((e) => ({ field: e })) },
|
|
67
|
+
card: a.card ?? {
|
|
68
|
+
title: r.rowKey,
|
|
69
|
+
fields: i.filter((e) => e !== r.rowKey).slice(0, n.defaultCardFields)
|
|
70
70
|
},
|
|
71
|
-
...kn(e,
|
|
71
|
+
...kn(e, a)
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
function kn(e, t) {
|
|
75
75
|
if (!e.record?.layouts.includes("kanban")) return {};
|
|
76
|
-
let n = t.kanban ??
|
|
76
|
+
let n = t.kanban ?? a(e);
|
|
77
77
|
return n ? { kanban: n } : {};
|
|
78
78
|
}
|
|
79
79
|
// src/analysis/chartSlots.ts
|
|
@@ -83,58 +83,58 @@ function B(e, t, n, r = jn, i = Mn) {
|
|
|
83
83
|
groups: t.map((e) => e.alias),
|
|
84
84
|
metrics: n.map((e) => e.alias),
|
|
85
85
|
quantities: a,
|
|
86
|
-
fiveNumbers:
|
|
87
|
-
ohlc:
|
|
88
|
-
additive: new Set(n.filter(
|
|
89
|
-
trendable: new Set(n.filter((e) =>
|
|
90
|
-
dateGroups: t.filter((e) => e.type ===
|
|
91
|
-
dayGroups: t.filter((e) => e.type ===
|
|
86
|
+
fiveNumbers: vt(n, new Set(a)),
|
|
87
|
+
ohlc: on(n, new Set(a)),
|
|
88
|
+
additive: new Set(n.filter(kt).map((e) => e.alias)),
|
|
89
|
+
trendable: new Set(n.filter((e) => Dt(e, (e) => n.find((t) => t.alias === e))).map((e) => e.alias)),
|
|
90
|
+
dateGroups: t.filter((e) => e.type === F.DATE_HISTOGRAM).map((e) => e.alias),
|
|
91
|
+
dayGroups: t.filter((e) => e.type === F.DATE_HISTOGRAM && e.unit === D.DAY).map((e) => e.alias)
|
|
92
92
|
}, s = An(e, o);
|
|
93
93
|
return s !== e.type && (e = {
|
|
94
94
|
...e,
|
|
95
95
|
type: s
|
|
96
|
-
}),
|
|
96
|
+
}), se(e.type)?.fit(e, o) ?? e;
|
|
97
97
|
}
|
|
98
98
|
function An(e, t) {
|
|
99
|
-
return
|
|
99
|
+
return ke.includes(e.type) ? t.groups.length === 0 ? e.type === "funnel" || e.type === "gauge" ? e.type : "metric" : t.quantities.length === 0 ? Nt[e.type] === "cartesian" ? e.type : "bar" : e.type === "metric" ? t.groups.length === 1 && t.dateGroups.length === 1 && t.trendable.has(tt(e.metric?.metric, l(t))) ? "metric" : "bar" : e.type : e.type;
|
|
100
100
|
}
|
|
101
101
|
var jn = /* @__PURE__ */ new Set(), Mn = /* @__PURE__ */ new Map(), Nn = 1;
|
|
102
102
|
function V(e, t) {
|
|
103
|
-
return `${
|
|
103
|
+
return `${dt(e)}_${t}`;
|
|
104
104
|
}
|
|
105
105
|
var Pn = "(empty)";
|
|
106
|
-
function Fn(e,
|
|
106
|
+
function Fn(e, t = [], n, r) {
|
|
107
107
|
return {
|
|
108
108
|
field: e.name,
|
|
109
|
-
missingKey:
|
|
110
|
-
dateUnits:
|
|
111
|
-
...
|
|
112
|
-
groups:
|
|
113
|
-
dateParts:
|
|
109
|
+
missingKey: r?.missingKey !== !1 && wt(e, n),
|
|
110
|
+
dateUnits: t,
|
|
111
|
+
...r?.groups ? { dateParts: Je({
|
|
112
|
+
groups: r.groups,
|
|
113
|
+
dateParts: r.dateParts
|
|
114
114
|
}) } : {}
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
function In(e, t, n, r) {
|
|
118
118
|
switch (t) {
|
|
119
|
-
case
|
|
119
|
+
case F.DATE_HISTOGRAM: return {
|
|
120
120
|
type: t,
|
|
121
121
|
field: e.field,
|
|
122
122
|
alias: n,
|
|
123
|
-
unit: r ?? e.dateUnits[0] ??
|
|
123
|
+
unit: r ?? e.dateUnits[0] ?? D.DAY
|
|
124
124
|
};
|
|
125
|
-
case
|
|
125
|
+
case F.HISTOGRAM: return {
|
|
126
126
|
type: t,
|
|
127
127
|
field: e.field,
|
|
128
128
|
alias: n,
|
|
129
129
|
interval: Nn
|
|
130
130
|
};
|
|
131
|
-
case
|
|
131
|
+
case F.DATE_PART: return {
|
|
132
132
|
type: t,
|
|
133
133
|
field: e.field,
|
|
134
134
|
alias: n,
|
|
135
|
-
part: e.dateParts?.[0] ??
|
|
135
|
+
part: e.dateParts?.[0] ?? dn[0]
|
|
136
136
|
};
|
|
137
|
-
case
|
|
137
|
+
case F.TERMS: return {
|
|
138
138
|
type: t,
|
|
139
139
|
field: e.field,
|
|
140
140
|
alias: n,
|
|
@@ -147,52 +147,52 @@ function Ln(e, t) {
|
|
|
147
147
|
return e.filter((e) => e.groups.length > 0 && !n.has(e.field));
|
|
148
148
|
}
|
|
149
149
|
var Rn = {
|
|
150
|
-
[
|
|
151
|
-
[
|
|
152
|
-
[
|
|
153
|
-
[
|
|
154
|
-
[
|
|
150
|
+
[M.DISTINCT_COUNT]: "distinctCount",
|
|
151
|
+
[M.PERCENTILE]: "percentile",
|
|
152
|
+
[M.FIRST]: "firstLast",
|
|
153
|
+
[M.LAST]: "firstLast",
|
|
154
|
+
[M.ANY]: "any"
|
|
155
155
|
};
|
|
156
156
|
function zn(e) {
|
|
157
|
-
return
|
|
157
|
+
return p.flatMap((t) => t === M.NUMERIC ? [...e.functions] : e[Rn[t]] === !0 ? [t] : []);
|
|
158
158
|
}
|
|
159
159
|
function Bn(e) {
|
|
160
160
|
switch (e.type) {
|
|
161
|
-
case
|
|
162
|
-
case
|
|
163
|
-
case
|
|
164
|
-
case
|
|
165
|
-
case
|
|
166
|
-
case
|
|
161
|
+
case M.NUMERIC: return e.function;
|
|
162
|
+
case M.DISTINCT_COUNT:
|
|
163
|
+
case M.PERCENTILE:
|
|
164
|
+
case M.FIRST:
|
|
165
|
+
case M.LAST:
|
|
166
|
+
case M.ANY: return e.type;
|
|
167
167
|
default: return null;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
function H(e, t, n) {
|
|
171
171
|
let r = {
|
|
172
|
-
type:
|
|
172
|
+
type: Tt.FIELD,
|
|
173
173
|
field: e.field
|
|
174
174
|
};
|
|
175
175
|
switch (t) {
|
|
176
|
-
case
|
|
177
|
-
type:
|
|
176
|
+
case M.DISTINCT_COUNT: return {
|
|
177
|
+
type: M.DISTINCT_COUNT,
|
|
178
178
|
alias: n,
|
|
179
179
|
expression: r
|
|
180
180
|
};
|
|
181
|
-
case
|
|
182
|
-
type:
|
|
181
|
+
case M.PERCENTILE: return {
|
|
182
|
+
type: M.PERCENTILE,
|
|
183
183
|
alias: n,
|
|
184
184
|
expression: r,
|
|
185
185
|
percentile: 95
|
|
186
186
|
};
|
|
187
|
-
case
|
|
188
|
-
case
|
|
189
|
-
case
|
|
187
|
+
case M.ANY:
|
|
188
|
+
case M.FIRST:
|
|
189
|
+
case M.LAST: return {
|
|
190
190
|
type: t,
|
|
191
191
|
alias: n,
|
|
192
192
|
field: e.field
|
|
193
193
|
};
|
|
194
194
|
default: return {
|
|
195
|
-
type:
|
|
195
|
+
type: M.NUMERIC,
|
|
196
196
|
alias: n,
|
|
197
197
|
function: t,
|
|
198
198
|
expression: r
|
|
@@ -201,7 +201,7 @@ function H(e, t, n) {
|
|
|
201
201
|
}
|
|
202
202
|
function Vn(e, t) {
|
|
203
203
|
if (e) return {
|
|
204
|
-
type:
|
|
204
|
+
type: M.COUNT,
|
|
205
205
|
alias: "count"
|
|
206
206
|
};
|
|
207
207
|
let n = t.find((e) => e.functions.length > 0);
|
|
@@ -210,13 +210,13 @@ function Vn(e, t) {
|
|
|
210
210
|
return H(n, e, V(n.field, e.toLowerCase()));
|
|
211
211
|
}
|
|
212
212
|
let r = t.find((e) => e.distinctCount);
|
|
213
|
-
if (r) return H(r,
|
|
213
|
+
if (r) return H(r, M.DISTINCT_COUNT, V(r.field, "distinct"));
|
|
214
214
|
let i = t.find((e) => e.percentile);
|
|
215
|
-
if (i) return H(i,
|
|
215
|
+
if (i) return H(i, M.PERCENTILE, V(i.field, "p95"));
|
|
216
216
|
let a = t.find((e) => e.any);
|
|
217
|
-
if (a) return H(a,
|
|
217
|
+
if (a) return H(a, M.ANY, V(a.field, "any"));
|
|
218
218
|
let o = t.find((e) => e.firstLast);
|
|
219
|
-
if (o) return H(o,
|
|
219
|
+
if (o) return H(o, M.LAST, V(o.field, "last"));
|
|
220
220
|
throw Error("analysis capability declares no usable metric");
|
|
221
221
|
}
|
|
222
222
|
function Hn(e, t) {
|
|
@@ -227,14 +227,14 @@ function Hn(e, t) {
|
|
|
227
227
|
field: n.field,
|
|
228
228
|
missingKey: !1,
|
|
229
229
|
dateUnits: []
|
|
230
|
-
},
|
|
230
|
+
}, F.TERMS, V(n.field, "group"))];
|
|
231
231
|
}
|
|
232
|
-
function Un(e, t =
|
|
232
|
+
function Un(e, t = b) {
|
|
233
233
|
let n = e.analysis;
|
|
234
234
|
if (!n) throw Error(`Definition ${e.id} declares no analysis capability`);
|
|
235
|
-
let r =
|
|
235
|
+
let r = Me(e, n), i = Vn(n.count, [...r.aggregations.values()]), a = Oe([i], r.fields), o = Hn(e, n.fields), s = Ze(n, t).fallback;
|
|
236
236
|
return {
|
|
237
|
-
filter:
|
|
237
|
+
filter: te(),
|
|
238
238
|
filterMode: "simple",
|
|
239
239
|
refresh: { interval: null },
|
|
240
240
|
kind: "analysis",
|
|
@@ -242,10 +242,10 @@ function Un(e, t = _) {
|
|
|
242
242
|
metrics: [i],
|
|
243
243
|
sort: o.length === 0 ? [] : n.metricSort === !1 ? [{
|
|
244
244
|
alias: o[0].alias,
|
|
245
|
-
direction:
|
|
245
|
+
direction: v.ASC
|
|
246
246
|
}] : [{
|
|
247
247
|
alias: i.alias,
|
|
248
|
-
direction:
|
|
248
|
+
direction: v.DESC
|
|
249
249
|
}],
|
|
250
250
|
limit: s,
|
|
251
251
|
layout: o.length > 0 && a.size === 0 ? "chart" : "table",
|
|
@@ -254,9 +254,9 @@ function Un(e, t = _) {
|
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
256
|
function Wn(e, t) {
|
|
257
|
-
if (e.type !==
|
|
258
|
-
...
|
|
259
|
-
alias:
|
|
257
|
+
if (e.type !== M.DERIVED) return {
|
|
258
|
+
...y(y(e, "label"), "filter"),
|
|
259
|
+
alias: re(e.alias, t)
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
// src/dashboard/defaults.ts
|
|
@@ -266,7 +266,7 @@ function Gn() {
|
|
|
266
266
|
kind: "dashboard",
|
|
267
267
|
columns: 24,
|
|
268
268
|
width: "fixed",
|
|
269
|
-
fixed:
|
|
269
|
+
fixed: te(),
|
|
270
270
|
tabs: [],
|
|
271
271
|
fields: [],
|
|
272
272
|
panels: []
|
|
@@ -274,7 +274,7 @@ function Gn() {
|
|
|
274
274
|
}
|
|
275
275
|
// src/dashboard/layout.ts
|
|
276
276
|
function U(e, t = 24) {
|
|
277
|
-
return
|
|
277
|
+
return L(e) && Ot(e, [], t).length === 0;
|
|
278
278
|
}
|
|
279
279
|
function Kn(...e) {
|
|
280
280
|
let t = [], n = 0;
|
|
@@ -358,7 +358,7 @@ function Zn(e, t, n, r = 24, i) {
|
|
|
358
358
|
function Qn(e, t, n, r, i) {
|
|
359
359
|
let a = new Map(e.map((e) => [e.id, e])), o = new Map(t.map((e) => [e.id, e])), s = (e) => {
|
|
360
360
|
let t = a.get(e.id);
|
|
361
|
-
return e.id === r && (i.fixedHeight === !0 ||
|
|
361
|
+
return e.id === r && (i.fixedHeight === !0 || A(t) || e.h !== o.get(e.id).h) ? e.h : t.h;
|
|
362
362
|
}, c = /* @__PURE__ */ new Map(), l = K(n.map((e) => ({
|
|
363
363
|
box: e,
|
|
364
364
|
layout: e
|
|
@@ -383,32 +383,32 @@ function Qn(e, t, n, r, i) {
|
|
|
383
383
|
function $n(e, t) {
|
|
384
384
|
return e.y + e.h <= t.y && e.x < t.x + t.w && t.x < e.x + e.w;
|
|
385
385
|
}
|
|
386
|
-
function er(e, t,
|
|
387
|
-
let
|
|
388
|
-
if (!
|
|
389
|
-
let
|
|
390
|
-
return
|
|
386
|
+
function er(e, t, r) {
|
|
387
|
+
let i = n(e), a = i.find((e) => L(e) && e.id === t);
|
|
388
|
+
if (!a) return null;
|
|
389
|
+
let o = C(e, a);
|
|
390
|
+
return i.flatMap((t) => L(t) && typeof t.id == "string" && U(t.layout, r) && C(e, t) === o ? [{
|
|
391
391
|
id: t.id,
|
|
392
392
|
...q(t.layout)
|
|
393
393
|
}] : []);
|
|
394
394
|
}
|
|
395
|
-
function tr(e, t,
|
|
396
|
-
let
|
|
397
|
-
if (!
|
|
398
|
-
let t =
|
|
399
|
-
if (!t || !U(
|
|
400
|
-
let
|
|
395
|
+
function tr(e, t, r = 24) {
|
|
396
|
+
let i = n(e), a = new Map(t.map((e) => [e.id, e])), o = !1, s = i.map((e) => {
|
|
397
|
+
if (!L(e) || typeof e.id != "string") return e;
|
|
398
|
+
let t = a.get(e.id), n = e.layout;
|
|
399
|
+
if (!t || !U(n, r)) return e;
|
|
400
|
+
let i = A(t.fixedHeight === void 0 ? n : t), s = i ? {
|
|
401
401
|
...q(t),
|
|
402
402
|
fixedHeight: !0
|
|
403
403
|
} : q(t);
|
|
404
|
-
return sr(
|
|
404
|
+
return sr(n, s) && A(n) === i ? e : (o = !0, {
|
|
405
405
|
...e,
|
|
406
406
|
layout: s
|
|
407
407
|
});
|
|
408
408
|
});
|
|
409
|
-
return
|
|
409
|
+
return o ? {
|
|
410
410
|
...e,
|
|
411
|
-
panels:
|
|
411
|
+
panels: s
|
|
412
412
|
} : e;
|
|
413
413
|
}
|
|
414
414
|
function K(e) {
|
|
@@ -467,7 +467,7 @@ function rr(e, t) {
|
|
|
467
467
|
return e.map((e) => n.get(e.id) ?? e);
|
|
468
468
|
}
|
|
469
469
|
function ir(e, t) {
|
|
470
|
-
return
|
|
470
|
+
return A(e) ? {
|
|
471
471
|
...t,
|
|
472
472
|
fixedHeight: !0
|
|
473
473
|
} : t;
|
|
@@ -686,7 +686,7 @@ function xr(e) {
|
|
|
686
686
|
return e instanceof yr;
|
|
687
687
|
}
|
|
688
688
|
var Sr = class {
|
|
689
|
-
constructor(e =
|
|
689
|
+
constructor(e = b) {
|
|
690
690
|
this.byKey = /* @__PURE__ */ new Map(), this.queue = [], this.running = 0, this.reserved = 0, this.maxConcurrent = e.maxConcurrentQueries, this.maxQueued = e.maxQueuedQueries;
|
|
691
691
|
}
|
|
692
692
|
get active() {
|
|
@@ -759,7 +759,7 @@ function wr(e) {
|
|
|
759
759
|
concurrency: e.limits.referenceConcurrency,
|
|
760
760
|
timeout: e.limits.referenceTimeout,
|
|
761
761
|
timers: e.environment,
|
|
762
|
-
failed: (t, n) =>
|
|
762
|
+
failed: (t, n) => St(e.environment, {
|
|
763
763
|
kind: "query",
|
|
764
764
|
error: n,
|
|
765
765
|
context: {
|
|
@@ -947,9 +947,9 @@ function kr(e, t) {
|
|
|
947
947
|
};
|
|
948
948
|
}
|
|
949
949
|
function Ar(e, t, n = {}) {
|
|
950
|
-
let r = n.max ??
|
|
950
|
+
let r = n.max ?? b.maxDashboardPanels;
|
|
951
951
|
if (e.panels.length >= r) return null;
|
|
952
|
-
let i = Ur(e, n.tab), a = n.size ?? kr(t, n.view), o = Xn(Hr(e, i), a, 24, n.fromRow ?? 0), s =
|
|
952
|
+
let i = Ur(e, n.tab), a = n.size ?? kr(t, n.view), o = Xn(Hr(e, i), a, 24, n.fromRow ?? 0), s = we(e.panels.map((e) => L(e) ? e.id : void 0), "panel"), c = {
|
|
953
953
|
...t.kind === "view" ? { bindings: [] } : {},
|
|
954
954
|
...t,
|
|
955
955
|
id: s,
|
|
@@ -967,16 +967,16 @@ function Ar(e, t, n = {}) {
|
|
|
967
967
|
function jr(e, t) {
|
|
968
968
|
let n = Y(e, t);
|
|
969
969
|
if (!n) return e;
|
|
970
|
-
let r =
|
|
970
|
+
let r = C(e, n);
|
|
971
971
|
return Br({
|
|
972
972
|
...e,
|
|
973
973
|
panels: e.panels.filter((e) => e !== n)
|
|
974
974
|
}, r);
|
|
975
975
|
}
|
|
976
|
-
function Mr(e, t, n =
|
|
976
|
+
function Mr(e, t, n = b.maxDashboardPanels) {
|
|
977
977
|
let r = Y(e, t);
|
|
978
978
|
if (!r || !U(r.layout)) return null;
|
|
979
|
-
let i = r.layout, a =
|
|
979
|
+
let i = r.layout, a = C(e, r), o = Ar(e, y(y(y(r, "id"), "layout"), "tab"), {
|
|
980
980
|
tab: a ?? void 0,
|
|
981
981
|
fromRow: i.y,
|
|
982
982
|
size: {
|
|
@@ -985,7 +985,7 @@ function Mr(e, t, n = _.maxDashboardPanels) {
|
|
|
985
985
|
},
|
|
986
986
|
max: n
|
|
987
987
|
});
|
|
988
|
-
return o &&
|
|
988
|
+
return o && A(i) ? {
|
|
989
989
|
...o,
|
|
990
990
|
config: Nr(o.config, o.id)
|
|
991
991
|
} : o;
|
|
@@ -1004,12 +1004,12 @@ function Pr(e, t, n) {
|
|
|
1004
1004
|
return X(e, t, (e) => r === (e.title ?? "") ? e : r.length > 0 ? {
|
|
1005
1005
|
...e,
|
|
1006
1006
|
title: r
|
|
1007
|
-
} :
|
|
1007
|
+
} : y(e, "title"));
|
|
1008
1008
|
}
|
|
1009
1009
|
function Fr(e, t, n) {
|
|
1010
1010
|
return Wr(e, t, (e) => {
|
|
1011
1011
|
if (e.instanceId === n && e.presentation === void 0 && e.opens === void 0) return e;
|
|
1012
|
-
let t =
|
|
1012
|
+
let t = y(y(y(e, "owned"), "presentation"), "opens"), r = e.bindings, i = Array.isArray(r) ? r.filter((e) => !(L(e) && e.derived === !0)) : r;
|
|
1013
1013
|
return {
|
|
1014
1014
|
...t,
|
|
1015
1015
|
instanceId: n,
|
|
@@ -1019,31 +1019,31 @@ function Fr(e, t, n) {
|
|
|
1019
1019
|
}
|
|
1020
1020
|
function Ir(e, t, n) {
|
|
1021
1021
|
return Wr(e, t, (e) => e.owned === void 0 && e.instanceId === n ? e : {
|
|
1022
|
-
...
|
|
1022
|
+
...y(e, "owned"),
|
|
1023
1023
|
instanceId: n
|
|
1024
1024
|
});
|
|
1025
1025
|
}
|
|
1026
1026
|
function Lr(e, t, n) {
|
|
1027
1027
|
let r = n && Object.keys(n).length > 0 ? n : null;
|
|
1028
|
-
return Wr(e, t, (e) => r === null && e.presentation === void 0 ? e : r === null ?
|
|
1028
|
+
return Wr(e, t, (e) => r === null && e.presentation === void 0 ? e : r === null ? y(e, "presentation") : {
|
|
1029
1029
|
...e,
|
|
1030
1030
|
presentation: r
|
|
1031
1031
|
});
|
|
1032
1032
|
}
|
|
1033
1033
|
function Rr(e, t, n) {
|
|
1034
|
-
let r = X(e, t, (e) => e.kind === "view" || n.kind !== void 0 && n.kind !== e.kind ? e :
|
|
1034
|
+
let r = X(e, t, (e) => e.kind === "view" || n.kind !== void 0 && n.kind !== e.kind ? e : Xe(e, "title" in n ? y(n, "title") : n)), i = Y(r, t);
|
|
1035
1035
|
return "title" in n && i && i.kind !== "view" ? Pr(r, t, n.title ?? "") : r;
|
|
1036
1036
|
}
|
|
1037
1037
|
function zr(e, t, n) {
|
|
1038
1038
|
let r = Y(e, t);
|
|
1039
1039
|
if (!r || !e.tabs.some((e) => e.id === n)) return e;
|
|
1040
|
-
let i =
|
|
1040
|
+
let i = C(e, r);
|
|
1041
1041
|
if (i === n || !U(r.layout)) return e;
|
|
1042
1042
|
let a = Xn(Hr(e, n), r.layout);
|
|
1043
1043
|
return Br(X(e, t, (e) => ({
|
|
1044
1044
|
...e,
|
|
1045
1045
|
tab: n,
|
|
1046
|
-
layout:
|
|
1046
|
+
layout: A(r.layout) ? {
|
|
1047
1047
|
...a,
|
|
1048
1048
|
fixedHeight: !0
|
|
1049
1049
|
} : a
|
|
@@ -1053,22 +1053,22 @@ function Br(e, t) {
|
|
|
1053
1053
|
return tr(e, Jn(Hr(e, t)));
|
|
1054
1054
|
}
|
|
1055
1055
|
function Vr(e, t) {
|
|
1056
|
-
return
|
|
1056
|
+
return rn.includes(t) ? e.width === t ? e : {
|
|
1057
1057
|
...e,
|
|
1058
1058
|
width: t
|
|
1059
1059
|
} : e;
|
|
1060
1060
|
}
|
|
1061
1061
|
function Hr(e, t) {
|
|
1062
|
-
return e.panels.flatMap((n) =>
|
|
1062
|
+
return e.panels.flatMap((n) => L(n) && typeof n.id == "string" && U(n.layout) && C(e, n) === t ? [{
|
|
1063
1063
|
id: n.id,
|
|
1064
1064
|
...n.layout
|
|
1065
1065
|
}] : []);
|
|
1066
1066
|
}
|
|
1067
1067
|
function Ur(e, t) {
|
|
1068
|
-
return
|
|
1068
|
+
return C(e, { tab: t });
|
|
1069
1069
|
}
|
|
1070
1070
|
function Y(e, t) {
|
|
1071
|
-
return e.panels.find((e) =>
|
|
1071
|
+
return e.panels.find((e) => L(e) && e.id === t);
|
|
1072
1072
|
}
|
|
1073
1073
|
function X(e, t, n) {
|
|
1074
1074
|
let r = Y(e, t);
|
|
@@ -1088,32 +1088,32 @@ function Gr(e) {
|
|
|
1088
1088
|
return t.length === 1 ? t[0] : null;
|
|
1089
1089
|
}
|
|
1090
1090
|
function Kr(e) {
|
|
1091
|
-
return e !== void 0 &&
|
|
1091
|
+
return e !== void 0 && P(e.kind) === "date";
|
|
1092
1092
|
}
|
|
1093
1093
|
function qr(e) {
|
|
1094
|
-
return
|
|
1094
|
+
return d(e).filter(Kr);
|
|
1095
1095
|
}
|
|
1096
1096
|
function Jr(e, t) {
|
|
1097
|
-
let
|
|
1097
|
+
let r = Gr(e), i = !1, a = n(e).map((e) => {
|
|
1098
1098
|
if (!T(e)) return e;
|
|
1099
|
-
let
|
|
1100
|
-
globalField:
|
|
1099
|
+
let n = Xr(e), a = n.filter((e) => !Zr(e)), o = r && e.ignoresTime !== !0 ? t(e) : null, s = r && a.some((e) => L(e) && e.globalField === r.name), c = r && o && !s && k(r.kind, o.kind) ? [{
|
|
1100
|
+
globalField: r.name,
|
|
1101
1101
|
panelField: o.name,
|
|
1102
1102
|
auto: !0,
|
|
1103
1103
|
derived: !0
|
|
1104
1104
|
}] : [], l = [...a, ...c];
|
|
1105
|
-
return Qr(l,
|
|
1105
|
+
return Qr(l, n) ? e : (i = !0, {
|
|
1106
1106
|
...e,
|
|
1107
1107
|
bindings: l
|
|
1108
1108
|
});
|
|
1109
1109
|
});
|
|
1110
|
-
return
|
|
1110
|
+
return i ? {
|
|
1111
1111
|
...e,
|
|
1112
|
-
panels:
|
|
1112
|
+
panels: a
|
|
1113
1113
|
} : e;
|
|
1114
1114
|
}
|
|
1115
1115
|
function Yr(e) {
|
|
1116
|
-
let t =
|
|
1116
|
+
let t = n(e).map((e) => {
|
|
1117
1117
|
if (!T(e)) return e;
|
|
1118
1118
|
let t = Xr(e), n = t.filter((e) => !Zr(e));
|
|
1119
1119
|
return n.length === t.length ? e : {
|
|
@@ -1131,20 +1131,20 @@ function Xr(e) {
|
|
|
1131
1131
|
return Array.isArray(t) ? t : [];
|
|
1132
1132
|
}
|
|
1133
1133
|
function Zr(e) {
|
|
1134
|
-
return
|
|
1134
|
+
return L(e) && e.derived === !0;
|
|
1135
1135
|
}
|
|
1136
1136
|
function Qr(e, t) {
|
|
1137
1137
|
return e.length === t.length && e.every((e, n) => e === t[n] || JSON.stringify(e) === JSON.stringify(t[n]));
|
|
1138
1138
|
}
|
|
1139
1139
|
// src/dashboard/wiring.ts
|
|
1140
1140
|
function $r(e, t) {
|
|
1141
|
-
return t.filter((t) =>
|
|
1141
|
+
return t.filter((t) => k(e.kind, t.kind));
|
|
1142
1142
|
}
|
|
1143
1143
|
function ei(e, t, n) {
|
|
1144
1144
|
let r = {};
|
|
1145
1145
|
if (!T(t)) return r;
|
|
1146
|
-
let i =
|
|
1147
|
-
for (let t of
|
|
1146
|
+
let i = w(t);
|
|
1147
|
+
for (let t of d(e)) {
|
|
1148
1148
|
let e = i.find((e) => e.globalField === t.name);
|
|
1149
1149
|
e ? r[t.name] = {
|
|
1150
1150
|
wired: !0,
|
|
@@ -1166,30 +1166,30 @@ function ni(e, t, n, r, i) {
|
|
|
1166
1166
|
let a = {
|
|
1167
1167
|
config: e,
|
|
1168
1168
|
connected: []
|
|
1169
|
-
}, o =
|
|
1170
|
-
if (!o || !s || !c || !
|
|
1171
|
-
let l = [], u = Kr(o),
|
|
1172
|
-
if (e === s) return ci(u ?
|
|
1169
|
+
}, o = d(e).find((e) => e.name === t), s = ui(e, n), c = (s ? i(s) : null)?.find((e) => e.name === r);
|
|
1170
|
+
if (!o || !s || !c || !k(o.kind, c.kind)) return a;
|
|
1171
|
+
let l = [], u = Kr(o), f = e.panels.map((e) => {
|
|
1172
|
+
if (e === s) return ci(u ? y(e, "ignoresTime") : e, t, r, !1);
|
|
1173
1173
|
if (!T(e) || li(e, t) || u && e.ignoresTime === !0) return e;
|
|
1174
1174
|
let n = oi(o, i(e) ?? [], [r]);
|
|
1175
1175
|
return n ? (l.push(e.id), ci(e, t, n.name, !0)) : e;
|
|
1176
|
-
}),
|
|
1176
|
+
}), p = o.remote === void 0 && c.remote !== void 0 ? c.remote : void 0;
|
|
1177
1177
|
return {
|
|
1178
1178
|
config: {
|
|
1179
1179
|
...e,
|
|
1180
|
-
fields:
|
|
1180
|
+
fields: p === void 0 ? e.fields : e.fields.map((e) => e === o ? {
|
|
1181
1181
|
...e,
|
|
1182
|
-
remote:
|
|
1182
|
+
remote: p
|
|
1183
1183
|
} : e),
|
|
1184
|
-
panels:
|
|
1184
|
+
panels: f
|
|
1185
1185
|
},
|
|
1186
1186
|
connected: l
|
|
1187
1187
|
};
|
|
1188
1188
|
}
|
|
1189
1189
|
function ri(e, t, n, { byHand: r = !0 } = {}) {
|
|
1190
|
-
let i = !1, a = r && Kr(
|
|
1191
|
-
...
|
|
1192
|
-
bindings:
|
|
1190
|
+
let i = !1, a = r && Kr(d(e).find((e) => e.name === t)), o = e.panels.map((e) => !T(e) || !n.includes(e.id) || !li(e, t) ? e : (i = !0, {
|
|
1191
|
+
...de(e, t) ? y(e, "click") : e,
|
|
1192
|
+
bindings: w(e).filter((e) => e.globalField !== t),
|
|
1193
1193
|
...a ? { ignoresTime: !0 } : {}
|
|
1194
1194
|
}));
|
|
1195
1195
|
return i ? {
|
|
@@ -1201,7 +1201,7 @@ function ii(e, t, n) {
|
|
|
1201
1201
|
let r = /* @__PURE__ */ new Map();
|
|
1202
1202
|
for (let i of e.panels) {
|
|
1203
1203
|
if (!T(i)) continue;
|
|
1204
|
-
let e =
|
|
1204
|
+
let e = w(i).find((e) => e.globalField === t);
|
|
1205
1205
|
if (!e) continue;
|
|
1206
1206
|
let a = n(i)?.find((t) => t.name === e.panelField);
|
|
1207
1207
|
for (let e of a?.options ?? []) {
|
|
@@ -1216,7 +1216,7 @@ function ii(e, t, n) {
|
|
|
1216
1216
|
}
|
|
1217
1217
|
function ai(e, t, n = []) {
|
|
1218
1218
|
let r = [];
|
|
1219
|
-
for (let i of
|
|
1219
|
+
for (let i of d(e)) {
|
|
1220
1220
|
if (n.some((e) => e.globalField === i.name)) continue;
|
|
1221
1221
|
let a = oi(i, t, si(e, i.name));
|
|
1222
1222
|
a && r.push({
|
|
@@ -1228,11 +1228,11 @@ function ai(e, t, n = []) {
|
|
|
1228
1228
|
return r;
|
|
1229
1229
|
}
|
|
1230
1230
|
function oi(e, t, n) {
|
|
1231
|
-
return
|
|
1231
|
+
return P(e.kind) === "search" ? En(t) ?? void 0 : n.map((e) => t.find((t) => t.name === e)).find((t) => t !== void 0 && k(e.kind, t.kind));
|
|
1232
1232
|
}
|
|
1233
1233
|
function si(e, t) {
|
|
1234
1234
|
let n = /* @__PURE__ */ new Map();
|
|
1235
|
-
for (let r of e.panels) if (T(r)) for (let e of
|
|
1235
|
+
for (let r of e.panels) if (T(r)) for (let e of w(r)) e.globalField === t && n.set(e.panelField, (n.get(e.panelField) ?? 0) + 1);
|
|
1236
1236
|
let r = [...n.entries()].sort((e, t) => t[1] - e[1]).map(([e]) => e);
|
|
1237
1237
|
return r.includes(t) ? r : [...r, t];
|
|
1238
1238
|
}
|
|
@@ -1247,23 +1247,23 @@ function ci(e, t, n, r) {
|
|
|
1247
1247
|
};
|
|
1248
1248
|
return {
|
|
1249
1249
|
...e,
|
|
1250
|
-
bindings: [...
|
|
1250
|
+
bindings: [...w(e).filter((e) => e.globalField !== t), i]
|
|
1251
1251
|
};
|
|
1252
1252
|
}
|
|
1253
1253
|
function li(e, t) {
|
|
1254
|
-
return
|
|
1254
|
+
return w(e).some((e) => e.globalField === t);
|
|
1255
1255
|
}
|
|
1256
1256
|
function ui(e, t) {
|
|
1257
1257
|
return e.panels.find((e) => T(e) && e.id === t);
|
|
1258
1258
|
}
|
|
1259
1259
|
// src/dashboard/filterEdit.ts
|
|
1260
1260
|
function di(e, t) {
|
|
1261
|
-
let n =
|
|
1261
|
+
let n = d(e);
|
|
1262
1262
|
if (n.length >= 20) return null;
|
|
1263
|
-
let r =
|
|
1263
|
+
let r = we(n.map((e) => e.name), "filter"), i = {
|
|
1264
1264
|
name: r,
|
|
1265
1265
|
label: t.label.trim(),
|
|
1266
|
-
kind:
|
|
1266
|
+
kind: Xt[t.type][0]
|
|
1267
1267
|
};
|
|
1268
1268
|
return {
|
|
1269
1269
|
config: {
|
|
@@ -1281,25 +1281,25 @@ function fi(e, t, n) {
|
|
|
1281
1281
|
});
|
|
1282
1282
|
}
|
|
1283
1283
|
function pi(e, t, n) {
|
|
1284
|
-
let r =
|
|
1285
|
-
if (!r ||
|
|
1284
|
+
let r = d(e).find((e) => e.name === t);
|
|
1285
|
+
if (!r || P(r.kind) === n) return e;
|
|
1286
1286
|
let i = {
|
|
1287
1287
|
name: r.name,
|
|
1288
1288
|
label: r.label,
|
|
1289
|
-
kind:
|
|
1289
|
+
kind: Xt[n][0],
|
|
1290
1290
|
...r.multiple && (n === "text" || n === "id" || n === "number") ? { multiple: !0 } : {}
|
|
1291
1291
|
};
|
|
1292
1292
|
return Ci(Z(e, t, () => i), t);
|
|
1293
1293
|
}
|
|
1294
1294
|
function mi(e, t) {
|
|
1295
|
-
let n =
|
|
1295
|
+
let n = d(e);
|
|
1296
1296
|
return n.some((e) => e.name === t) ? Ci({
|
|
1297
1297
|
...e,
|
|
1298
1298
|
fields: n.filter((e) => e.name !== t)
|
|
1299
1299
|
}, t) : e;
|
|
1300
1300
|
}
|
|
1301
1301
|
function hi(e, t, n) {
|
|
1302
|
-
return Z(e, t, (e) => n === null ? e.default === void 0 ? e :
|
|
1302
|
+
return Z(e, t, (e) => n === null ? e.default === void 0 ? e : y(e, "default") : {
|
|
1303
1303
|
...e,
|
|
1304
1304
|
default: n
|
|
1305
1305
|
});
|
|
@@ -1308,15 +1308,15 @@ function gi(e, t, n) {
|
|
|
1308
1308
|
return Z(e, t, (e) => n === (e.required === !0) ? e : n ? {
|
|
1309
1309
|
...e,
|
|
1310
1310
|
required: !0
|
|
1311
|
-
} :
|
|
1311
|
+
} : y(e, "required"));
|
|
1312
1312
|
}
|
|
1313
1313
|
function _i(e, t, n) {
|
|
1314
1314
|
return Z(e, t, (e) => {
|
|
1315
1315
|
if (n === (e.oneDay === !0)) return e;
|
|
1316
|
-
if (!n) return
|
|
1316
|
+
if (!n) return y(e, "oneDay");
|
|
1317
1317
|
let t = e.default;
|
|
1318
1318
|
return {
|
|
1319
|
-
...t === void 0 ||
|
|
1319
|
+
...t === void 0 || nt(t) ? e : y(e, "default"),
|
|
1320
1320
|
oneDay: !0
|
|
1321
1321
|
};
|
|
1322
1322
|
});
|
|
@@ -1328,24 +1328,24 @@ function vi(e, t, n) {
|
|
|
1328
1328
|
...e,
|
|
1329
1329
|
multiple: !0
|
|
1330
1330
|
};
|
|
1331
|
-
let t =
|
|
1331
|
+
let t = y(e, "multiple"), r = e.default;
|
|
1332
1332
|
return Array.isArray(r) && r.length > 1 ? {
|
|
1333
1333
|
...t,
|
|
1334
1334
|
default: r.slice(0, 1)
|
|
1335
|
-
} :
|
|
1335
|
+
} : L(r) && Array.isArray(r.items) && r.items.length > 1 ? {
|
|
1336
1336
|
...t,
|
|
1337
1337
|
default: { items: r.items.slice(0, 1) }
|
|
1338
1338
|
} : t;
|
|
1339
1339
|
});
|
|
1340
1340
|
}
|
|
1341
1341
|
function yi(e, t, n) {
|
|
1342
|
-
return Z(e, t, (e) => n === null ? e.options === void 0 ? e :
|
|
1342
|
+
return Z(e, t, (e) => n === null ? e.options === void 0 ? e : y(e, "options") : {
|
|
1343
1343
|
...e,
|
|
1344
1344
|
options: n
|
|
1345
1345
|
});
|
|
1346
1346
|
}
|
|
1347
1347
|
function bi(e, t, n) {
|
|
1348
|
-
let r =
|
|
1348
|
+
let r = d(e), i = r.findIndex((e) => e.name === t), a = Math.max(0, Math.min(r.length - 1, Math.trunc(n)));
|
|
1349
1349
|
if (i < 0 || i === a) return e;
|
|
1350
1350
|
let o = [...r], [s] = o.splice(i, 1);
|
|
1351
1351
|
return o.splice(a, 0, s), {
|
|
@@ -1354,20 +1354,20 @@ function bi(e, t, n) {
|
|
|
1354
1354
|
};
|
|
1355
1355
|
}
|
|
1356
1356
|
function xi(e, t) {
|
|
1357
|
-
return t === null ? e.timeGrouping === void 0 ? e :
|
|
1357
|
+
return t === null ? e.timeGrouping === void 0 ? e : y(e, "timeGrouping") : {
|
|
1358
1358
|
...e,
|
|
1359
1359
|
timeGrouping: t
|
|
1360
1360
|
};
|
|
1361
1361
|
}
|
|
1362
1362
|
function Si(e) {
|
|
1363
1363
|
let { fixed: t } = e;
|
|
1364
|
-
return
|
|
1364
|
+
return L(t) && t.op === "and" && Array.isArray(t.children) && t.children.length === 0 ? e : {
|
|
1365
1365
|
...e,
|
|
1366
|
-
fixed:
|
|
1366
|
+
fixed: te()
|
|
1367
1367
|
};
|
|
1368
1368
|
}
|
|
1369
1369
|
function Z(e, t, n) {
|
|
1370
|
-
let r =
|
|
1370
|
+
let r = d(e).find((e) => e.name === t);
|
|
1371
1371
|
if (!r) return e;
|
|
1372
1372
|
let i = n(r);
|
|
1373
1373
|
return i === r ? e : {
|
|
@@ -1380,45 +1380,45 @@ function Ci(e, t) {
|
|
|
1380
1380
|
}
|
|
1381
1381
|
// src/dashboard/boardFields.ts
|
|
1382
1382
|
function wi(e, t) {
|
|
1383
|
-
return e === "record" ? t : t.filter((e) =>
|
|
1383
|
+
return e === "record" ? t : t.filter((e) => P(e.kind) !== "search");
|
|
1384
1384
|
}
|
|
1385
1385
|
// src/dashboard/panelFieldNames.ts
|
|
1386
|
-
function Ti(e, t,
|
|
1387
|
-
let
|
|
1386
|
+
function Ti(e, t, r) {
|
|
1387
|
+
let i = !1, a = n(e).map((e) => {
|
|
1388
1388
|
if (!T(e)) return e;
|
|
1389
|
-
let
|
|
1390
|
-
if (!
|
|
1391
|
-
let a = Ei(e,
|
|
1392
|
-
return a !== e && (
|
|
1389
|
+
let n = t(e);
|
|
1390
|
+
if (!n || Object.keys(n).length === 0) return e;
|
|
1391
|
+
let a = Ei(e, n, r);
|
|
1392
|
+
return a !== e && (i = !0), a;
|
|
1393
1393
|
});
|
|
1394
|
-
return
|
|
1394
|
+
return i ? {
|
|
1395
1395
|
...e,
|
|
1396
|
-
panels:
|
|
1396
|
+
panels: a
|
|
1397
1397
|
} : e;
|
|
1398
1398
|
}
|
|
1399
1399
|
function Ei(e, t, n) {
|
|
1400
1400
|
let r = (e) => t[e] ?? e, i = { ...e }, a = e.bindings;
|
|
1401
|
-
Array.isArray(a) && (i.bindings = a.map((e) =>
|
|
1401
|
+
Array.isArray(a) && (i.bindings = a.map((e) => L(e) && typeof e.panelField == "string" ? {
|
|
1402
1402
|
...e,
|
|
1403
1403
|
panelField: r(e.panelField)
|
|
1404
1404
|
} : e));
|
|
1405
1405
|
let o = e.click;
|
|
1406
|
-
|
|
1406
|
+
L(o) && (i.click = Di(o, r));
|
|
1407
1407
|
let s = e.owned;
|
|
1408
|
-
return
|
|
1408
|
+
return L(s) && L(s.config) && s.config.kind === "analysis" && (i.owned = {
|
|
1409
1409
|
...s,
|
|
1410
1410
|
config: n(s.config, t)
|
|
1411
|
-
}),
|
|
1411
|
+
}), at(i, e) ? e : i;
|
|
1412
1412
|
}
|
|
1413
1413
|
function Di(e, t) {
|
|
1414
1414
|
if (e.kind === "url" && typeof e.url == "string") return {
|
|
1415
1415
|
...e,
|
|
1416
|
-
url: e.url.replace(
|
|
1416
|
+
url: e.url.replace(Pt, (e, n) => e.replace(n, t(n)))
|
|
1417
1417
|
};
|
|
1418
1418
|
let n = e.values;
|
|
1419
|
-
return e.kind === "dashboard" &&
|
|
1419
|
+
return e.kind === "dashboard" && L(n) ? {
|
|
1420
1420
|
...e,
|
|
1421
|
-
values: Object.fromEntries(Object.entries(n).map(([e, n]) => [e,
|
|
1421
|
+
values: Object.fromEntries(Object.entries(n).map(([e, n]) => [e, L(n) && typeof n.dimension == "string" ? {
|
|
1422
1422
|
...n,
|
|
1423
1423
|
dimension: t(n.dimension)
|
|
1424
1424
|
} : n]))
|
|
@@ -1475,9 +1475,9 @@ var Oi = 1e4, ki = class {
|
|
|
1475
1475
|
];
|
|
1476
1476
|
function ji(e, t) {
|
|
1477
1477
|
let n = e ? {
|
|
1478
|
-
...
|
|
1478
|
+
...b,
|
|
1479
1479
|
...e
|
|
1480
|
-
} :
|
|
1480
|
+
} : b;
|
|
1481
1481
|
if (!t) return n;
|
|
1482
1482
|
let { limits: r } = t, i = Math.max(n.defaultPageSize, ...n.pageSizes, ...n.cardPageSizes), a = {
|
|
1483
1483
|
maxPageSize: r.maxPageSize ?? i,
|
|
@@ -1529,7 +1529,7 @@ function Ii(e) {
|
|
|
1529
1529
|
return (t) => {
|
|
1530
1530
|
let n = e(t);
|
|
1531
1531
|
if (!n) return;
|
|
1532
|
-
let { definition: r, instance: i } = n, a = i ?
|
|
1532
|
+
let { definition: r, instance: i } = n, a = i ? xt(i.id) : null, o = a?.definitionId === r.id ? r.views?.find((e) => e.id === a.viewId)?.timeField : void 0, s = o === void 0 ? r.timeField : o;
|
|
1533
1533
|
if (s !== void 0) return s === null ? null : r.fields.find((e) => e.name === s) ?? null;
|
|
1534
1534
|
};
|
|
1535
1535
|
}
|
|
@@ -1554,7 +1554,7 @@ function Ri(e, t, n) {
|
|
|
1554
1554
|
}
|
|
1555
1555
|
function zi(e, t) {
|
|
1556
1556
|
try {
|
|
1557
|
-
return
|
|
1557
|
+
return Ut(e, t);
|
|
1558
1558
|
} catch {
|
|
1559
1559
|
return e;
|
|
1560
1560
|
}
|
|
@@ -1582,15 +1582,15 @@ function Bi(e) {
|
|
|
1582
1582
|
// src/runtime/scope.ts
|
|
1583
1583
|
var Vi = [];
|
|
1584
1584
|
function Q(e, t) {
|
|
1585
|
-
return !t || !
|
|
1585
|
+
return !t || !i(e.filter) ? e : {
|
|
1586
1586
|
...e,
|
|
1587
|
-
filter:
|
|
1587
|
+
filter: je(e.filter, t)
|
|
1588
1588
|
};
|
|
1589
1589
|
}
|
|
1590
1590
|
function Hi(e, t, n) {
|
|
1591
|
-
if (!n || !
|
|
1592
|
-
let r = t.filter.op !== "and",
|
|
1593
|
-
return e.flatMap((e) =>
|
|
1591
|
+
if (!n || !i(t.filter)) return e;
|
|
1592
|
+
let r = t.filter.op !== "and", a = De(t.filter);
|
|
1593
|
+
return e.flatMap((e) => a && e.code === "config.filterMode.not-simple" ? [] : r && e.path[0] === "children" && e.path[1] === 0 ? [{
|
|
1594
1594
|
...e,
|
|
1595
1595
|
path: e.path.slice(2)
|
|
1596
1596
|
}] : [e]);
|
|
@@ -1631,7 +1631,7 @@ var qi = class {
|
|
|
1631
1631
|
syncAt(e) {
|
|
1632
1632
|
if (e !== null && e === this.spent || e === this.due && (e === null || this.handle !== void 0) || (this.stop(), e === null)) return;
|
|
1633
1633
|
this.due = e;
|
|
1634
|
-
let t = Math.min(Math.max(0, e - this.environment.now().getTime()),
|
|
1634
|
+
let t = Math.min(Math.max(0, e - this.environment.now().getTime()), Kt);
|
|
1635
1635
|
this.handle = this.environment.setTimeout(() => {
|
|
1636
1636
|
this.handle = void 0, this.environment.now().getTime() < e ? (this.due = null, this.syncAt(e)) : (this.due = null, this.spent = e, this.fire());
|
|
1637
1637
|
}, t);
|
|
@@ -1645,7 +1645,7 @@ function Yi(e) {
|
|
|
1645
1645
|
return typeof t == "number" && Number.isFinite(t) ? t : null;
|
|
1646
1646
|
}
|
|
1647
1647
|
function Xi(e, t) {
|
|
1648
|
-
return t || e === null ? null : Math.min(e * 1e3,
|
|
1648
|
+
return t || e === null ? null : Math.min(e * 1e3, Kt);
|
|
1649
1649
|
}
|
|
1650
1650
|
// src/runtime/runtimeStore.ts
|
|
1651
1651
|
function $(e) {
|
|
@@ -1731,33 +1731,33 @@ var Zi = 1e3, Qi = class {
|
|
|
1731
1731
|
this.timer.stop(), this.rollover.stop(), this.setDueAt(null);
|
|
1732
1732
|
}
|
|
1733
1733
|
}, $i = [
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1734
|
+
E.EQ,
|
|
1735
|
+
E.NE,
|
|
1736
|
+
E.IN,
|
|
1737
|
+
E.NOT_IN
|
|
1738
1738
|
], ea = "value", ta = "count";
|
|
1739
|
-
function na(e,
|
|
1740
|
-
let
|
|
1741
|
-
if (!
|
|
1742
|
-
let
|
|
1743
|
-
if (!
|
|
1744
|
-
let
|
|
1745
|
-
return !
|
|
1739
|
+
function na(e, t, n) {
|
|
1740
|
+
let r = e.analysis;
|
|
1741
|
+
if (!r?.count) return null;
|
|
1742
|
+
let i = e.fields.find((e) => e.name === t);
|
|
1743
|
+
if (!i || i.options || i.remote) return null;
|
|
1744
|
+
let a = n.get(i.kind);
|
|
1745
|
+
return !a || !wt(i, a) ? null : r.fields.some((e) => e.field === t && e.groups.includes(vn.TERMS)) ? i : null;
|
|
1746
1746
|
}
|
|
1747
1747
|
function ra(e, t) {
|
|
1748
|
-
let n = t.get(e.kind), r = n ?
|
|
1749
|
-
return r.includes(
|
|
1748
|
+
let n = t.get(e.kind), r = n ? Le(e, n) : [];
|
|
1749
|
+
return r.includes(E.CONTAINS) ? E.CONTAINS : r.includes(E.STARTS_WITH) ? E.STARTS_WITH : null;
|
|
1750
1750
|
}
|
|
1751
|
-
function ia(e, t =
|
|
1752
|
-
return Math.min(50,
|
|
1751
|
+
function ia(e, t = b) {
|
|
1752
|
+
return Math.min(50, Ze(e.analysis, t).max);
|
|
1753
1753
|
}
|
|
1754
|
-
function aa(e, t, n, r = "", i =
|
|
1754
|
+
function aa(e, t, n, r = "", i = b) {
|
|
1755
1755
|
let a = r.trim(), o = a ? ra(t, n) : null, s = {
|
|
1756
|
-
type:
|
|
1756
|
+
type: F.TERMS,
|
|
1757
1757
|
field: t.name,
|
|
1758
1758
|
alias: ea
|
|
1759
1759
|
}, c = {
|
|
1760
|
-
type:
|
|
1760
|
+
type: M.COUNT,
|
|
1761
1761
|
alias: ta
|
|
1762
1762
|
};
|
|
1763
1763
|
return {
|
|
@@ -1776,13 +1776,13 @@ function aa(e, t, n, r = "", i = _) {
|
|
|
1776
1776
|
metrics: [c],
|
|
1777
1777
|
sort: e.analysis?.metricSort === !1 ? [{
|
|
1778
1778
|
alias: ea,
|
|
1779
|
-
direction:
|
|
1779
|
+
direction: v.ASC
|
|
1780
1780
|
}] : [{
|
|
1781
1781
|
alias: ta,
|
|
1782
|
-
direction:
|
|
1782
|
+
direction: v.DESC
|
|
1783
1783
|
}, {
|
|
1784
1784
|
alias: ea,
|
|
1785
|
-
direction:
|
|
1785
|
+
direction: v.ASC
|
|
1786
1786
|
}],
|
|
1787
1787
|
limit: ia(e, i),
|
|
1788
1788
|
layout: "table",
|
|
@@ -1791,7 +1791,7 @@ function aa(e, t, n, r = "", i = _) {
|
|
|
1791
1791
|
};
|
|
1792
1792
|
}
|
|
1793
1793
|
function oa(e, t, n, r) {
|
|
1794
|
-
let i =
|
|
1794
|
+
let i = ne(e, t, r) > t.limit ? n.length <= t.limit : n.length < t.limit;
|
|
1795
1795
|
return {
|
|
1796
1796
|
values: n.slice(0, t.limit).flatMap((e) => {
|
|
1797
1797
|
let t = e[ea], n = e[ta];
|
|
@@ -1806,15 +1806,15 @@ function oa(e, t, n, r) {
|
|
|
1806
1806
|
function sa(e, t, n, r) {
|
|
1807
1807
|
let i = r.trim();
|
|
1808
1808
|
if (!i) return [...e];
|
|
1809
|
-
let a = t.stringComparison ===
|
|
1809
|
+
let a = t.stringComparison === ee.CASE_SENSITIVE, o = (e) => a ? e : e.toLowerCase(), s = o(i), c = ra(t, n) === E.STARTS_WITH;
|
|
1810
1810
|
return e.filter(({ value: e }) => c ? o(e).startsWith(s) : o(e).includes(s));
|
|
1811
1811
|
}
|
|
1812
1812
|
// src/analysis/chartSwitch.ts
|
|
1813
1813
|
function ca(e) {
|
|
1814
|
-
return
|
|
1814
|
+
return se(e.type)?.lead(e);
|
|
1815
1815
|
}
|
|
1816
1816
|
function la(e, t) {
|
|
1817
|
-
let n =
|
|
1817
|
+
let n = Nt[t] === Nt[e.type] || e.legend === void 0 ? {
|
|
1818
1818
|
...e,
|
|
1819
1819
|
type: t
|
|
1820
1820
|
} : {
|
|
@@ -1822,27 +1822,27 @@ function la(e, t) {
|
|
|
1822
1822
|
type: t,
|
|
1823
1823
|
legend: void 0
|
|
1824
1824
|
}, r = ca(e);
|
|
1825
|
-
return r === void 0 || r === "" || t === e.type ? n :
|
|
1825
|
+
return r === void 0 || r === "" || t === e.type ? n : se(t)?.carry(e, n, r) ?? n;
|
|
1826
1826
|
}
|
|
1827
1827
|
// src/analysis/drillFilter.ts
|
|
1828
1828
|
function ua(e, t) {
|
|
1829
|
-
if (!
|
|
1829
|
+
if (!De(e)) return {
|
|
1830
1830
|
op: "and",
|
|
1831
1831
|
children: [e, ...t]
|
|
1832
1832
|
};
|
|
1833
|
-
let n = [...e.children],
|
|
1833
|
+
let n = [...e.children], r = [], i = /* @__PURE__ */ new Map();
|
|
1834
1834
|
for (let e of t) {
|
|
1835
|
-
let t =
|
|
1835
|
+
let t = N(e) && e.operator !== E.EXPRESSION ? n.findIndex((t) => N(t) && t.operator !== E.EXPRESSION && t.field === e.field) : -1;
|
|
1836
1836
|
if (t < 0) {
|
|
1837
|
-
|
|
1837
|
+
r.push(e);
|
|
1838
1838
|
continue;
|
|
1839
1839
|
}
|
|
1840
|
-
let
|
|
1841
|
-
if (
|
|
1842
|
-
else if (da(n[t],
|
|
1840
|
+
let a = e, o = i.get(a.field);
|
|
1841
|
+
if (o) o.push(a);
|
|
1842
|
+
else if (da(n[t], a)) n[t] = a;
|
|
1843
1843
|
else {
|
|
1844
|
-
let e = [
|
|
1845
|
-
|
|
1844
|
+
let e = [a];
|
|
1845
|
+
i.set(a.field, e), r.push({
|
|
1846
1846
|
op: "and",
|
|
1847
1847
|
children: e
|
|
1848
1848
|
});
|
|
@@ -1850,18 +1850,18 @@ function ua(e, t) {
|
|
|
1850
1850
|
}
|
|
1851
1851
|
return {
|
|
1852
1852
|
op: "and",
|
|
1853
|
-
children: [...n, ...
|
|
1853
|
+
children: [...n, ...r]
|
|
1854
1854
|
};
|
|
1855
1855
|
}
|
|
1856
1856
|
function da(e, t) {
|
|
1857
|
-
if (e.operator !==
|
|
1857
|
+
if (e.operator !== E.BETWEEN || t.operator !== E.BETWEEN) return !1;
|
|
1858
1858
|
let n = pa(e.value), r = pa(t.value);
|
|
1859
1859
|
return n !== null && r !== null && n.from <= r.from && r.to <= n.to;
|
|
1860
1860
|
}
|
|
1861
1861
|
var fa = /(?:Z|[+-]\d{2}:?\d{2})$/i;
|
|
1862
1862
|
function pa(e) {
|
|
1863
|
-
if (!
|
|
1864
|
-
let t =
|
|
1863
|
+
if (!j(e) || e.type !== "absolute" || e.to === void 0 || !(e.timeZone !== void 0 || fa.test(e.from) && fa.test(e.to))) return null;
|
|
1864
|
+
let t = bt(e, /* @__PURE__ */ new Date(0), e.timeZone ?? "UTC"), n = Date.parse(t.from), r = t.to === void 0 ? NaN : Date.parse(t.to);
|
|
1865
1865
|
return Number.isFinite(n) && Number.isFinite(r) ? {
|
|
1866
1866
|
from: n,
|
|
1867
1867
|
to: r
|
|
@@ -1871,31 +1871,31 @@ function ma(e, t) {
|
|
|
1871
1871
|
let n = [], r = [e];
|
|
1872
1872
|
for (; r.length > 0;) {
|
|
1873
1873
|
let e = r.pop();
|
|
1874
|
-
|
|
1874
|
+
i(e) && e.op === "and" ? r.push(...e.children) : n.push(e);
|
|
1875
1875
|
}
|
|
1876
|
-
return t.every((e) => n.some((t) =>
|
|
1876
|
+
return t.every((e) => n.some((t) => hn(t, e)));
|
|
1877
1877
|
}
|
|
1878
1878
|
// src/analysis/drill.ts
|
|
1879
1879
|
function ha(e) {
|
|
1880
1880
|
return (e.elements?.length ?? 0) > 1 ? "nested-elements" : void 0;
|
|
1881
1881
|
}
|
|
1882
|
-
function ga(e, t, n,
|
|
1883
|
-
let
|
|
1884
|
-
if (
|
|
1882
|
+
function ga(e, t, n, r) {
|
|
1883
|
+
let i = r.flatMap((e) => e.conditions), a = e.elements ?? [];
|
|
1884
|
+
if (a.length === 0) return i;
|
|
1885
1885
|
if (ha(e)) return null;
|
|
1886
|
-
let [
|
|
1887
|
-
if (!
|
|
1888
|
-
let
|
|
1886
|
+
let [o] = a, s = (e) => e.field.startsWith(`${o.path}.`), c = i.filter((e) => !s(e)), l = i.filter(s), u = t.find((e) => e.name === o.path), d = u && n.get(u.kind);
|
|
1887
|
+
if (!u || !d || !Le(u, d).includes(E.ELEMENT_MATCH)) return null;
|
|
1888
|
+
let f = o.filter ?? {
|
|
1889
1889
|
op: "and",
|
|
1890
1890
|
children: []
|
|
1891
|
-
},
|
|
1891
|
+
}, p = new Set(l.map((e) => e.field)), m = f.children.some((e) => N(e) && p.has(e.field)) ? {
|
|
1892
1892
|
op: "and",
|
|
1893
|
-
children: [
|
|
1894
|
-
} : ua(
|
|
1895
|
-
return [...
|
|
1896
|
-
field:
|
|
1897
|
-
operator:
|
|
1898
|
-
value:
|
|
1893
|
+
children: [f, ...l]
|
|
1894
|
+
} : ua(f, l);
|
|
1895
|
+
return [...c, {
|
|
1896
|
+
field: u.name,
|
|
1897
|
+
operator: E.ELEMENT_MATCH,
|
|
1898
|
+
value: m
|
|
1899
1899
|
}];
|
|
1900
1900
|
}
|
|
1901
1901
|
function _a(e, t) {
|
|
@@ -1943,13 +1943,13 @@ function ya(e, t, n, r, i, a) {
|
|
|
1943
1943
|
let e = o.get(t.field);
|
|
1944
1944
|
if (!e) return null;
|
|
1945
1945
|
let l = r[t.alias], u = i[t.alias];
|
|
1946
|
-
if (t.type ===
|
|
1946
|
+
if (t.type === F.DATE_HISTOGRAM) {
|
|
1947
1947
|
let e = ba(t, l, u, a);
|
|
1948
1948
|
if (!e) return null;
|
|
1949
1949
|
c = !0, s.push(e);
|
|
1950
1950
|
continue;
|
|
1951
1951
|
}
|
|
1952
|
-
if (!
|
|
1952
|
+
if (!at(l, u)) continue;
|
|
1953
1953
|
let d = xa(t, l, e, n, a);
|
|
1954
1954
|
if (d === null) return null;
|
|
1955
1955
|
s.push({
|
|
@@ -1961,15 +1961,15 @@ function ya(e, t, n, r, i, a) {
|
|
|
1961
1961
|
return c ? s : null;
|
|
1962
1962
|
}
|
|
1963
1963
|
function ba(e, t, n, r) {
|
|
1964
|
-
let i =
|
|
1964
|
+
let i = qt(t)?.ms, a = qt(n)?.ms;
|
|
1965
1965
|
if (i === void 0 || a === void 0) return null;
|
|
1966
|
-
let o = Math.min(i, a), s = e.timeZone ?? r.timeZone, c =
|
|
1966
|
+
let o = Math.min(i, a), s = e.timeZone ?? r.timeZone, c = Ge(e.unit, Math.max(i, a), s).to;
|
|
1967
1967
|
return {
|
|
1968
1968
|
group: e,
|
|
1969
1969
|
value: o === i ? t : n,
|
|
1970
1970
|
conditions: [{
|
|
1971
1971
|
field: e.field,
|
|
1972
|
-
operator:
|
|
1972
|
+
operator: E.BETWEEN,
|
|
1973
1973
|
value: {
|
|
1974
1974
|
type: "absolute",
|
|
1975
1975
|
from: new Date(o).toISOString(),
|
|
@@ -1981,27 +1981,27 @@ function ba(e, t, n, r) {
|
|
|
1981
1981
|
}
|
|
1982
1982
|
function xa(e, t, n, r, i) {
|
|
1983
1983
|
switch (e.type) {
|
|
1984
|
-
case
|
|
1984
|
+
case F.TERMS: return t == null || e.missingKey !== void 0 && t === e.missingKey ? [{
|
|
1985
1985
|
field: e.field,
|
|
1986
|
-
operator:
|
|
1986
|
+
operator: E.IS_NULL,
|
|
1987
1987
|
value: null
|
|
1988
1988
|
}] : [Sa(e.field, t, n, r, i)];
|
|
1989
|
-
case
|
|
1989
|
+
case F.HISTOGRAM: return e.field === void 0 || typeof t != "number" || !Number.isFinite(t) ? null : [{
|
|
1990
1990
|
field: e.field,
|
|
1991
|
-
operator:
|
|
1991
|
+
operator: E.GTE,
|
|
1992
1992
|
value: t
|
|
1993
1993
|
}, {
|
|
1994
1994
|
field: e.field,
|
|
1995
|
-
operator:
|
|
1995
|
+
operator: E.LT,
|
|
1996
1996
|
value: t + e.interval
|
|
1997
1997
|
}];
|
|
1998
|
-
case
|
|
1999
|
-
let n =
|
|
1998
|
+
case F.DATE_HISTOGRAM: {
|
|
1999
|
+
let n = qt(t)?.ms;
|
|
2000
2000
|
if (n === void 0) return null;
|
|
2001
|
-
let r = e.timeZone ?? i.timeZone, a =
|
|
2001
|
+
let r = e.timeZone ?? i.timeZone, a = Ge(e.unit, n, r);
|
|
2002
2002
|
return [{
|
|
2003
2003
|
field: e.field,
|
|
2004
|
-
operator:
|
|
2004
|
+
operator: E.BETWEEN,
|
|
2005
2005
|
value: {
|
|
2006
2006
|
type: "absolute",
|
|
2007
2007
|
from: new Date(a.from).toISOString(),
|
|
@@ -2010,25 +2010,25 @@ function xa(e, t, n, r, i) {
|
|
|
2010
2010
|
}
|
|
2011
2011
|
}];
|
|
2012
2012
|
}
|
|
2013
|
-
case
|
|
2013
|
+
case F.DATE_PART: return null;
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
2016
2016
|
function Sa(e, t, n, r, i) {
|
|
2017
2017
|
let a = r.get(n.kind), o = t;
|
|
2018
|
-
return a?.operators.includes(
|
|
2018
|
+
return a?.operators.includes(E.EQ) ? {
|
|
2019
2019
|
field: e,
|
|
2020
|
-
operator:
|
|
2020
|
+
operator: E.EQ,
|
|
2021
2021
|
value: o
|
|
2022
2022
|
} : n.kind === "reference" ? {
|
|
2023
2023
|
field: e,
|
|
2024
|
-
operator:
|
|
2024
|
+
operator: E.IN,
|
|
2025
2025
|
value: { items: [{
|
|
2026
2026
|
id: o,
|
|
2027
2027
|
label: Ca(n, o, i)
|
|
2028
2028
|
}] }
|
|
2029
2029
|
} : {
|
|
2030
2030
|
field: e,
|
|
2031
|
-
operator:
|
|
2031
|
+
operator: E.IN,
|
|
2032
2032
|
value: [o]
|
|
2033
2033
|
};
|
|
2034
2034
|
}
|
|
@@ -2039,7 +2039,7 @@ function wa(e, t) {
|
|
|
2039
2039
|
let n = ua(e.filter, t);
|
|
2040
2040
|
return {
|
|
2041
2041
|
filter: n,
|
|
2042
|
-
filterMode:
|
|
2042
|
+
filterMode: De(n) ? e.filterMode : "advanced"
|
|
2043
2043
|
};
|
|
2044
2044
|
}
|
|
2045
2045
|
function Ta(e, t, n, r) {
|
|
@@ -2057,12 +2057,12 @@ function Ta(e, t, n, r) {
|
|
|
2057
2057
|
}
|
|
2058
2058
|
function Ea(e, t, n = /* @__PURE__ */ new Set()) {
|
|
2059
2059
|
let r = [t], i = B(e.chart, r, e.metrics, n);
|
|
2060
|
-
if (
|
|
2060
|
+
if (m({
|
|
2061
2061
|
groups: r,
|
|
2062
2062
|
metrics: e.metrics,
|
|
2063
2063
|
chart: i
|
|
2064
2064
|
}, n) === null && !Oa(e, t)) return i;
|
|
2065
|
-
let a =
|
|
2065
|
+
let a = cn({
|
|
2066
2066
|
groups: r,
|
|
2067
2067
|
metrics: e.metrics,
|
|
2068
2068
|
moments: n
|
|
@@ -2075,11 +2075,11 @@ var Da = [
|
|
|
2075
2075
|
"bar"
|
|
2076
2076
|
];
|
|
2077
2077
|
function Oa(e, t) {
|
|
2078
|
-
let n =
|
|
2078
|
+
let n = se(e.chart.type)?.boundTo(e.chart);
|
|
2079
2079
|
return n !== void 0 && e.groups.find((e) => e.alias === n)?.field !== t.field;
|
|
2080
2080
|
}
|
|
2081
2081
|
function ka(e, t, n) {
|
|
2082
|
-
let r = t.groups[0] ??
|
|
2082
|
+
let r = t.groups[0] ?? F.TERMS;
|
|
2083
2083
|
return In(Fn(e, t.dateUnits, n, t), r, V(e.name, "group"));
|
|
2084
2084
|
}
|
|
2085
2085
|
// src/runtime/dashboard/grouping.ts
|
|
@@ -2089,9 +2089,9 @@ function Aa(e, t, n, r) {
|
|
|
2089
2089
|
grouping: null,
|
|
2090
2090
|
issues: []
|
|
2091
2091
|
};
|
|
2092
|
-
if (n === void 0 || e.kind !== "analysis" || !e.groups.some((e) => e.type ===
|
|
2093
|
-
let a = t.analysis, o = a &&
|
|
2094
|
-
if (e.type !==
|
|
2092
|
+
if (n === void 0 || e.kind !== "analysis" || !e.groups.some((e) => e.type === F.DATE_HISTOGRAM)) return i;
|
|
2093
|
+
let a = t.analysis, o = a && Me(t, a, e), s = !1, c = [], l = e.groups.map((e) => {
|
|
2094
|
+
if (e.type !== F.DATE_HISTOGRAM) return e;
|
|
2095
2095
|
if (!(o?.aggregations.get(e.field)?.dateUnits ?? []).includes(n)) return c.push(e.unit), e;
|
|
2096
2096
|
if (s = !0, e.unit === n) return e;
|
|
2097
2097
|
let { label: t, ...r } = e;
|
|
@@ -2110,7 +2110,7 @@ function Aa(e, t, n, r) {
|
|
|
2110
2110
|
} : {
|
|
2111
2111
|
config: e,
|
|
2112
2112
|
grouping: "kept",
|
|
2113
|
-
issues: [
|
|
2113
|
+
issues: [x("dashboard.grouping.kept", r, { unit: c[0] }, "note")]
|
|
2114
2114
|
};
|
|
2115
2115
|
}
|
|
2116
2116
|
// src/runtime/dashboard/presentation.ts
|
|
@@ -2123,18 +2123,18 @@ var ja = {
|
|
|
2123
2123
|
]
|
|
2124
2124
|
};
|
|
2125
2125
|
function Ma(e, t, n, r) {
|
|
2126
|
-
if (!
|
|
2126
|
+
if (!L(t)) return {
|
|
2127
2127
|
config: e,
|
|
2128
2128
|
issues: []
|
|
2129
2129
|
};
|
|
2130
|
-
let i = Object.keys(t).filter(
|
|
2130
|
+
let i = Object.keys(t).filter(lt);
|
|
2131
2131
|
if (i.length === 0) return {
|
|
2132
2132
|
config: e,
|
|
2133
2133
|
issues: []
|
|
2134
2134
|
};
|
|
2135
2135
|
let a = {
|
|
2136
2136
|
config: e,
|
|
2137
|
-
issues: [
|
|
2137
|
+
issues: [x("dashboard.panel.presentation-dropped", r, {}, "warning")]
|
|
2138
2138
|
}, o = ja[e.kind];
|
|
2139
2139
|
if (i.some((e) => !o.includes(e))) return a;
|
|
2140
2140
|
let s = {};
|
|
@@ -2143,7 +2143,7 @@ function Ma(e, t, n, r) {
|
|
|
2143
2143
|
...e,
|
|
2144
2144
|
...s
|
|
2145
2145
|
};
|
|
2146
|
-
return $(
|
|
2146
|
+
return $(I(n, c)) ? $(I(n, e)) ? {
|
|
2147
2147
|
config: e,
|
|
2148
2148
|
issues: []
|
|
2149
2149
|
} : a : {
|
|
@@ -2155,47 +2155,47 @@ function Ma(e, t, n, r) {
|
|
|
2155
2155
|
function Na(e, t, n, r) {
|
|
2156
2156
|
let i = La(e);
|
|
2157
2157
|
if (!i) return null;
|
|
2158
|
-
let a = new Set(
|
|
2158
|
+
let a = new Set(d(n.applied).filter((e) => P(e.kind) === "date").map((e) => e.name)), o = t.filter((e) => e.panelField === i.field && a.has(e.globalField) && j(n.filters.values[e.globalField]));
|
|
2159
2159
|
if (o.length !== 1) return null;
|
|
2160
2160
|
let [s] = o, c = n.filters.values[s.globalField];
|
|
2161
|
-
if (!
|
|
2162
|
-
let { from: l, to: u } =
|
|
2163
|
-
if (u === void 0 ||
|
|
2164
|
-
let
|
|
2161
|
+
if (!j(c)) return null;
|
|
2162
|
+
let { from: l, to: u } = bt(c, r.now, r.timeZone);
|
|
2163
|
+
if (u === void 0 || Wt(l, u, r.timeZone) !== i.unit) return null;
|
|
2164
|
+
let f = {
|
|
2165
2165
|
from: l,
|
|
2166
2166
|
to: u
|
|
2167
|
-
},
|
|
2167
|
+
}, p = new Date(u), m = g(e.filter).includes(i.field), h = m ? Ra(e.filter, i.field, p, r.timeZone) : e.filter, ee = (m ? za(h, i.field, p, r.timeZone) : void 0) ?? Ia(f, i.unit, r.timeZone);
|
|
2168
2168
|
return {
|
|
2169
2169
|
binding: s,
|
|
2170
|
-
config:
|
|
2170
|
+
config: h === e.filter ? e : {
|
|
2171
2171
|
...e,
|
|
2172
|
-
filter:
|
|
2172
|
+
filter: h
|
|
2173
2173
|
},
|
|
2174
2174
|
leaf: {
|
|
2175
2175
|
field: i.field,
|
|
2176
|
-
operator:
|
|
2176
|
+
operator: E.BETWEEN,
|
|
2177
2177
|
value: {
|
|
2178
2178
|
type: "absolute",
|
|
2179
|
-
from:
|
|
2180
|
-
to:
|
|
2179
|
+
from: ee,
|
|
2180
|
+
to: f.to
|
|
2181
2181
|
}
|
|
2182
2182
|
}
|
|
2183
2183
|
};
|
|
2184
2184
|
}
|
|
2185
2185
|
var Pa = {
|
|
2186
|
-
[
|
|
2187
|
-
[
|
|
2188
|
-
[
|
|
2186
|
+
[D.SECOND]: 1e3,
|
|
2187
|
+
[D.MINUTE]: 6e4,
|
|
2188
|
+
[D.HOUR]: 36e5
|
|
2189
2189
|
}, Fa = {
|
|
2190
|
-
[
|
|
2191
|
-
[
|
|
2192
|
-
[
|
|
2193
|
-
[
|
|
2194
|
-
[
|
|
2190
|
+
[D.DAY]: "day",
|
|
2191
|
+
[D.WEEK]: "week",
|
|
2192
|
+
[D.MONTH]: "month",
|
|
2193
|
+
[D.QUARTER]: "quarter",
|
|
2194
|
+
[D.YEAR]: "year"
|
|
2195
2195
|
};
|
|
2196
2196
|
function Ia(e, t, n) {
|
|
2197
2197
|
let r = Pa[t], i = Fa[t];
|
|
2198
|
-
return r !== void 0 || i === void 0 ? new Date(Date.parse(e.from) - (r ?? 0)).toISOString() :
|
|
2198
|
+
return r !== void 0 || i === void 0 ? new Date(Date.parse(e.from) - (r ?? 0)).toISOString() : bt({
|
|
2199
2199
|
type: "relative",
|
|
2200
2200
|
amount: 2,
|
|
2201
2201
|
unit: i
|
|
@@ -2209,23 +2209,23 @@ function La(e) {
|
|
|
2209
2209
|
if (!n || n.headline === "whole") return null;
|
|
2210
2210
|
let r = e.groups;
|
|
2211
2211
|
if (!Array.isArray(r)) return null;
|
|
2212
|
-
let i = r.find((e) => e.alias === n.x && e.type ===
|
|
2213
|
-
return i?.type ===
|
|
2212
|
+
let i = r.find((e) => e.alias === n.x && e.type === F.DATE_HISTOGRAM);
|
|
2213
|
+
return i?.type === F.DATE_HISTOGRAM ? {
|
|
2214
2214
|
field: i.field,
|
|
2215
2215
|
unit: i.unit
|
|
2216
2216
|
} : null;
|
|
2217
2217
|
}
|
|
2218
|
-
function Ra(e, t, n,
|
|
2218
|
+
function Ra(e, t, n, r) {
|
|
2219
2219
|
let a = (e) => {
|
|
2220
|
-
if (
|
|
2220
|
+
if (i(e)) return {
|
|
2221
2221
|
...e,
|
|
2222
2222
|
children: e.children.map(a)
|
|
2223
2223
|
};
|
|
2224
|
-
if (!
|
|
2224
|
+
if (!N(e) || e.field !== t) return e;
|
|
2225
2225
|
let o = e.value;
|
|
2226
|
-
if (!
|
|
2227
|
-
if (e.operator ===
|
|
2228
|
-
let t =
|
|
2226
|
+
if (!j(o) || o.type === "absolute") return e;
|
|
2227
|
+
if (e.operator === E.BETWEEN) {
|
|
2228
|
+
let t = bt(o, n, r);
|
|
2229
2229
|
return {
|
|
2230
2230
|
...e,
|
|
2231
2231
|
value: {
|
|
@@ -2234,13 +2234,13 @@ function Ra(e, t, n, i) {
|
|
|
2234
2234
|
}
|
|
2235
2235
|
};
|
|
2236
2236
|
}
|
|
2237
|
-
if (e.operator !==
|
|
2238
|
-
let s = e.operator ===
|
|
2237
|
+
if (e.operator !== E.GTE && e.operator !== E.LTE) return e;
|
|
2238
|
+
let s = e.operator === E.GTE ? "start" : "end";
|
|
2239
2239
|
return {
|
|
2240
2240
|
...e,
|
|
2241
2241
|
value: {
|
|
2242
2242
|
type: "absolute",
|
|
2243
|
-
from:
|
|
2243
|
+
from: Zt(o, n, r, s)
|
|
2244
2244
|
}
|
|
2245
2245
|
};
|
|
2246
2246
|
};
|
|
@@ -2249,17 +2249,17 @@ function Ra(e, t, n, i) {
|
|
|
2249
2249
|
children: e.children.map(a)
|
|
2250
2250
|
};
|
|
2251
2251
|
}
|
|
2252
|
-
function za(e, t, n,
|
|
2252
|
+
function za(e, t, n, r) {
|
|
2253
2253
|
if (e.op !== "and") return;
|
|
2254
|
-
let
|
|
2255
|
-
for (let
|
|
2256
|
-
if (!
|
|
2257
|
-
let e =
|
|
2258
|
-
if (!
|
|
2259
|
-
let
|
|
2260
|
-
!Number.isNaN(
|
|
2254
|
+
let i;
|
|
2255
|
+
for (let a of e.children) {
|
|
2256
|
+
if (!N(a) || a.field !== t || a.operator !== E.BETWEEN && a.operator !== E.GTE) continue;
|
|
2257
|
+
let e = a.value;
|
|
2258
|
+
if (!j(e)) continue;
|
|
2259
|
+
let o = Date.parse(bt(e, n, r).from);
|
|
2260
|
+
!Number.isNaN(o) && (i === void 0 || o > i) && (i = o);
|
|
2261
2261
|
}
|
|
2262
|
-
return
|
|
2262
|
+
return i === void 0 ? void 0 : new Date(i).toISOString();
|
|
2263
2263
|
}
|
|
2264
2264
|
// src/runtime/dashboard/panelRun.ts
|
|
2265
2265
|
function Ba(e, t, n, r) {
|
|
@@ -2290,8 +2290,8 @@ function Ba(e, t, n, r) {
|
|
|
2290
2290
|
};
|
|
2291
2291
|
}
|
|
2292
2292
|
function Va(e, t, n = null) {
|
|
2293
|
-
let { applied: r, filters: i, kinds: a } = t, o =
|
|
2294
|
-
return
|
|
2293
|
+
let { applied: r, filters: i, kinds: a } = t, o = w(e), s = Ha(qa(e, i), n), c = pe(r, i, s, a);
|
|
2294
|
+
return je(Ke(un(r), o), n ? {
|
|
2295
2295
|
op: "and",
|
|
2296
2296
|
children: [...c?.children ?? [], n.leaf]
|
|
2297
2297
|
} : c);
|
|
@@ -2300,11 +2300,11 @@ function Ha(e, t) {
|
|
|
2300
2300
|
return t ? e.filter((e) => e.globalField !== t.binding.globalField) : e;
|
|
2301
2301
|
}
|
|
2302
2302
|
function Ua(e, t, n = null) {
|
|
2303
|
-
let { applied: r, filters: i, held: a, kinds: o } = t, s = Ha(qa(e, i), n), c = (e) => n && a(n.binding.globalField) === e ? [n.leaf] : [], l = (e) => ({ values: Object.fromEntries(Object.entries(i.values).filter(([t]) => a(t) === e)) }), u =
|
|
2304
|
-
...Ka(
|
|
2305
|
-
...Ka(
|
|
2303
|
+
let { applied: r, filters: i, held: a, kinds: o } = t, s = Ha(qa(e, i), n), c = (e) => n && a(n.binding.globalField) === e ? [n.leaf] : [], l = (e) => ({ values: Object.fromEntries(Object.entries(i.values).filter(([t]) => a(t) === e)) }), u = w(e), d = [
|
|
2304
|
+
...Ka(Ke(un(r), u)),
|
|
2305
|
+
...Ka(pe(r, l(!0), s, o)),
|
|
2306
2306
|
...c(!0)
|
|
2307
|
-
], f = [...Ka(
|
|
2307
|
+
], f = [...Ka(pe(r, l(!1), s, o)), ...c(!1)];
|
|
2308
2308
|
return {
|
|
2309
2309
|
scopeFilter: d.length > 0 ? {
|
|
2310
2310
|
op: "and",
|
|
@@ -2317,10 +2317,10 @@ function Ua(e, t, n = null) {
|
|
|
2317
2317
|
};
|
|
2318
2318
|
}
|
|
2319
2319
|
function Wa(e) {
|
|
2320
|
-
let { applied: t, issues: r, tab: i, filters: a } = e, o =
|
|
2321
|
-
return
|
|
2322
|
-
if (!
|
|
2323
|
-
let c = r.filter((e) =>
|
|
2320
|
+
let { applied: t, issues: r, tab: i, filters: a } = e, o = Mt(r);
|
|
2321
|
+
return n(t).flatMap((n, s) => {
|
|
2322
|
+
if (!L(n)) return [];
|
|
2323
|
+
let c = r.filter((e) => me(e) === s), l = C(t, n), u = l === i, d = T(n) ? n : null, f = d !== null && !o, p = f ? u ? e.run(d, s, c) : e.hold(d, s, c) : null, m = d && e.viewOf(d), { runtime: h, issues: g } = p ?? {
|
|
2324
2324
|
runtime: null,
|
|
2325
2325
|
issues: c
|
|
2326
2326
|
};
|
|
@@ -2332,38 +2332,38 @@ function Wa(e) {
|
|
|
2332
2332
|
tab: l,
|
|
2333
2333
|
waiting: f && !u && h === null && !$(c),
|
|
2334
2334
|
fields: m?.definition.fields ?? [],
|
|
2335
|
-
...
|
|
2335
|
+
...Ae(n, g, e.held),
|
|
2336
2336
|
...Ja(t, n, m, a)
|
|
2337
2337
|
}];
|
|
2338
2338
|
});
|
|
2339
2339
|
}
|
|
2340
|
-
function Ga(e, t,
|
|
2341
|
-
let { applied:
|
|
2342
|
-
if (!
|
|
2343
|
-
let
|
|
2344
|
-
...
|
|
2345
|
-
applied:
|
|
2346
|
-
filters:
|
|
2347
|
-
},
|
|
2348
|
-
return
|
|
2349
|
-
...
|
|
2340
|
+
function Ga(e, t, r) {
|
|
2341
|
+
let { applied: i, filters: a, saved: o, title: s, tab: c } = t, l = n(i).find((t) => T(t) && t.id === e);
|
|
2342
|
+
if (!l) return null;
|
|
2343
|
+
let u = Ua(l, {
|
|
2344
|
+
...r,
|
|
2345
|
+
applied: i,
|
|
2346
|
+
filters: a
|
|
2347
|
+
}, r.anchor?.(e) ?? null);
|
|
2348
|
+
return o ? {
|
|
2349
|
+
...u,
|
|
2350
2350
|
from: {
|
|
2351
|
-
title:
|
|
2351
|
+
title: s,
|
|
2352
2352
|
back: {
|
|
2353
2353
|
kind: "dashboard",
|
|
2354
|
-
definitionId:
|
|
2355
|
-
instanceId:
|
|
2356
|
-
filters:
|
|
2357
|
-
tab:
|
|
2354
|
+
definitionId: r.definitionId,
|
|
2355
|
+
instanceId: o.id,
|
|
2356
|
+
filters: a,
|
|
2357
|
+
tab: c
|
|
2358
2358
|
}
|
|
2359
2359
|
}
|
|
2360
|
-
} :
|
|
2360
|
+
} : u;
|
|
2361
2361
|
}
|
|
2362
2362
|
function Ka(e) {
|
|
2363
|
-
return !e ||
|
|
2363
|
+
return !e || It(e) ? [] : e.op === "and" ? e.children : [e];
|
|
2364
2364
|
}
|
|
2365
2365
|
function qa(e, t) {
|
|
2366
|
-
return
|
|
2366
|
+
return w(e).filter((n) => t.from?.[n.globalField] !== e.id);
|
|
2367
2367
|
}
|
|
2368
2368
|
function Ja(e, t, n, r) {
|
|
2369
2369
|
return {
|
|
@@ -2373,7 +2373,7 @@ function Ja(e, t, n, r) {
|
|
|
2373
2373
|
}
|
|
2374
2374
|
// src/runtime/failure/queryFailure.ts
|
|
2375
2375
|
async function Ya(e, t, n) {
|
|
2376
|
-
return e instanceof br ?
|
|
2376
|
+
return e instanceof br ? x("runtime.query.queue-full", []) : Za(await Gt(e), t, n);
|
|
2377
2377
|
}
|
|
2378
2378
|
function Xa(e, t, n, r) {
|
|
2379
2379
|
return {
|
|
@@ -2385,12 +2385,12 @@ function Xa(e, t, n, r) {
|
|
|
2385
2385
|
}
|
|
2386
2386
|
function Za(e, t, n) {
|
|
2387
2387
|
let { reason: r, violation: i } = e;
|
|
2388
|
-
if (
|
|
2388
|
+
if (Et(e)) return x("runtime.query.forbidden", [], {
|
|
2389
2389
|
reason: r,
|
|
2390
2390
|
...e.errorCode ? { errorCode: e.errorCode } : {}
|
|
2391
2391
|
});
|
|
2392
|
-
if (e.unreachable) return
|
|
2393
|
-
if (!i) return
|
|
2392
|
+
if (e.unreachable) return x("runtime.query.unreachable", [], { reason: r });
|
|
2393
|
+
if (!i) return x("runtime.query.failed", [], { reason: r });
|
|
2394
2394
|
let a = Qa(t.fields, i.path), o = {
|
|
2395
2395
|
reason: r,
|
|
2396
2396
|
code: i.code,
|
|
@@ -2399,7 +2399,7 @@ function Za(e, t, n) {
|
|
|
2399
2399
|
};
|
|
2400
2400
|
a && (o.name = a.name);
|
|
2401
2401
|
let s = a && n ? $a(n, a.name, a.root) : null;
|
|
2402
|
-
return
|
|
2402
|
+
return x(`runtime.query.failed.${i.code}`, s ?? [], o);
|
|
2403
2403
|
}
|
|
2404
2404
|
function Qa(e, t) {
|
|
2405
2405
|
if (!t) return null;
|
|
@@ -2420,11 +2420,11 @@ function Qa(e, t) {
|
|
|
2420
2420
|
return null;
|
|
2421
2421
|
}
|
|
2422
2422
|
function $a(e, t, n) {
|
|
2423
|
-
let r = (e,
|
|
2424
|
-
if (
|
|
2423
|
+
let r = (e, a) => {
|
|
2424
|
+
if (i(e)) {
|
|
2425
2425
|
for (let [t, n] of e.children.entries()) {
|
|
2426
2426
|
let e = r(n, [
|
|
2427
|
-
...
|
|
2427
|
+
...a,
|
|
2428
2428
|
"children",
|
|
2429
2429
|
t
|
|
2430
2430
|
]);
|
|
@@ -2432,8 +2432,8 @@ function $a(e, t, n) {
|
|
|
2432
2432
|
}
|
|
2433
2433
|
return null;
|
|
2434
2434
|
}
|
|
2435
|
-
let
|
|
2436
|
-
return
|
|
2435
|
+
let o = e?.field;
|
|
2436
|
+
return o === t || n !== void 0 && o === n ? a : null;
|
|
2437
2437
|
};
|
|
2438
2438
|
return r(e, []);
|
|
2439
2439
|
}
|
|
@@ -2486,7 +2486,7 @@ function ao(e, t) {
|
|
|
2486
2486
|
let t = n.get(r);
|
|
2487
2487
|
t || n.set(r, t = /* @__PURE__ */ new Set());
|
|
2488
2488
|
for (let n of e) {
|
|
2489
|
-
let e = a ? n[i] :
|
|
2489
|
+
let e = a ? n[i] : Qe(n, i);
|
|
2490
2490
|
(typeof e == "string" || typeof e == "number") && t.add(e);
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
@@ -2494,7 +2494,7 @@ function ao(e, t) {
|
|
|
2494
2494
|
}
|
|
2495
2495
|
function oo(e) {
|
|
2496
2496
|
return e.flatMap((e) => {
|
|
2497
|
-
let { remote: t } =
|
|
2497
|
+
let { remote: t } = en(e);
|
|
2498
2498
|
return t ? [{
|
|
2499
2499
|
remote: t,
|
|
2500
2500
|
path: e.name
|
|
@@ -2505,7 +2505,7 @@ function so(e, t, n = /* @__PURE__ */ new Map()) {
|
|
|
2505
2505
|
let r = new Map(e.map((e) => [e.name, e]));
|
|
2506
2506
|
for (let { field: e, value: i } of t) {
|
|
2507
2507
|
let t = r.get(e);
|
|
2508
|
-
if (!t?.remote || !
|
|
2508
|
+
if (!t?.remote || !Bt(t) || !fn(i)) continue;
|
|
2509
2509
|
let a = n.get(t.remote);
|
|
2510
2510
|
a || n.set(t.remote, a = /* @__PURE__ */ new Set());
|
|
2511
2511
|
for (let { id: e, label: t } of i.items) t === String(e) && a.add(e);
|
|
@@ -2513,7 +2513,7 @@ function so(e, t, n = /* @__PURE__ */ new Map()) {
|
|
|
2513
2513
|
return n;
|
|
2514
2514
|
}
|
|
2515
2515
|
function* co(e) {
|
|
2516
|
-
for (let { node: t } of
|
|
2516
|
+
for (let { node: t } of fe(e)) N(t) && (yield t);
|
|
2517
2517
|
}
|
|
2518
2518
|
function lo(e, t, n) {
|
|
2519
2519
|
let r = io(t.data), i = so(e.fields, co(t.config.filter), r);
|
|
@@ -2579,7 +2579,7 @@ var mo = class {
|
|
|
2579
2579
|
hold(e) {
|
|
2580
2580
|
let t = e?.values ?? {}, n = new Set(Object.keys(t)), r = e !== null && e.unit !== void 0, i = n.size !== this.held.size || [...n].some((e) => !this.held.has(e)) || r !== this.heldUnit;
|
|
2581
2581
|
this.held = n, this.heldUnit = r, i && this.candidates.reset();
|
|
2582
|
-
let a = this.host.applied(), o = this.host.current(), s =
|
|
2582
|
+
let a = this.host.applied(), o = this.host.current(), s = ze(a), c = {
|
|
2583
2583
|
...o,
|
|
2584
2584
|
values: { ...o.values }
|
|
2585
2585
|
};
|
|
@@ -2591,7 +2591,7 @@ var mo = class {
|
|
|
2591
2591
|
let t = e?.unit ?? s.unit;
|
|
2592
2592
|
t !== void 0 && (c.unit = t);
|
|
2593
2593
|
}
|
|
2594
|
-
let { filters: l, refused: u } =
|
|
2594
|
+
let { filters: l, refused: u } = S(a, c, this.host.kinds);
|
|
2595
2595
|
return z(l, o) || this.commit(l), {
|
|
2596
2596
|
refused: u,
|
|
2597
2597
|
moved: i
|
|
@@ -2626,51 +2626,51 @@ var mo = class {
|
|
|
2626
2626
|
});
|
|
2627
2627
|
}
|
|
2628
2628
|
put(e) {
|
|
2629
|
-
let { filters: t, refused: n } =
|
|
2629
|
+
let { filters: t, refused: n } = S(this.host.applied(), e, this.host.kinds);
|
|
2630
2630
|
return n.length > 0 ? n : (z(t, this.host.current()) || this.commit(t), []);
|
|
2631
2631
|
}
|
|
2632
2632
|
take(e) {
|
|
2633
|
-
let { filters: t, refused: n } =
|
|
2633
|
+
let { filters: t, refused: n } = S(this.host.applied(), e, this.host.kinds);
|
|
2634
2634
|
return z(t, this.host.current()) || this.commit(t), n;
|
|
2635
2635
|
}
|
|
2636
2636
|
commit(e) {
|
|
2637
2637
|
this.host.commit(e), this.host.started() && (this.timer.stop(), this.timer.sync(300));
|
|
2638
2638
|
}
|
|
2639
2639
|
on(e) {
|
|
2640
|
-
let t = this.host.current(), { filters: n } =
|
|
2640
|
+
let t = this.host.current(), { filters: n } = S(e, t, this.host.kinds);
|
|
2641
2641
|
return z(n, t) ? t : n;
|
|
2642
2642
|
}
|
|
2643
2643
|
askLabels(e, t) {
|
|
2644
|
-
let n = [...co(
|
|
2644
|
+
let n = [...co(un(e)), ...Object.entries(t.values).map(([e, t]) => ({
|
|
2645
2645
|
field: e,
|
|
2646
2646
|
value: t
|
|
2647
|
-
}))], r = so(
|
|
2647
|
+
}))], r = so(d(e), n);
|
|
2648
2648
|
this.labelReads = uo(this.host.labels, r, this.labelReads);
|
|
2649
2649
|
}
|
|
2650
2650
|
candidatesOf(e) {
|
|
2651
|
-
let t = this.host.applied(),
|
|
2652
|
-
if (!
|
|
2653
|
-
let
|
|
2651
|
+
let t = this.host.applied(), r = d(t).find((t) => t.name === e);
|
|
2652
|
+
if (!r || P(r.kind) !== "text" || r.options || this.optionsOf(e)) return null;
|
|
2653
|
+
let i = n(t).flatMap((t) => {
|
|
2654
2654
|
if (!T(t)) return [];
|
|
2655
|
-
let
|
|
2656
|
-
return !
|
|
2655
|
+
let r = w(t).find((t) => t.globalField === e), i = r && this.host.viewOf(t);
|
|
2656
|
+
return !r || !i ? [] : [{
|
|
2657
2657
|
panelId: t.id,
|
|
2658
|
-
definition:
|
|
2659
|
-
field:
|
|
2658
|
+
definition: i.definition,
|
|
2659
|
+
field: r.panelField,
|
|
2660
2660
|
scope: () => {
|
|
2661
|
-
let e = this.host.applied(),
|
|
2661
|
+
let e = this.host.applied(), r = Va(n(e).filter(T).find((e) => e.id === t.id) ?? t, {
|
|
2662
2662
|
applied: e,
|
|
2663
2663
|
filters: { values: this.heldValues() },
|
|
2664
2664
|
kinds: this.host.kinds
|
|
2665
2665
|
});
|
|
2666
|
-
return
|
|
2666
|
+
return It(r) ? null : r;
|
|
2667
2667
|
}
|
|
2668
2668
|
}];
|
|
2669
2669
|
});
|
|
2670
|
-
return this.candidates.of(e,
|
|
2670
|
+
return this.candidates.of(e, i);
|
|
2671
2671
|
}
|
|
2672
2672
|
optionsOf(e) {
|
|
2673
|
-
let t = this.host.applied(), n =
|
|
2673
|
+
let t = this.host.applied(), n = d(t).find((t) => t.name === e);
|
|
2674
2674
|
return !n || n.options ? null : ii(t, e, (e) => this.host.viewOf(e)?.definition.fields ?? null);
|
|
2675
2675
|
}
|
|
2676
2676
|
heldValues() {
|
|
@@ -2682,7 +2682,7 @@ var mo = class {
|
|
|
2682
2682
|
}
|
|
2683
2683
|
};
|
|
2684
2684
|
function ho(e) {
|
|
2685
|
-
return
|
|
2685
|
+
return x("dashboard.filter.held", ["filters", e], { field: e });
|
|
2686
2686
|
}
|
|
2687
2687
|
// src/runtime/dashboard/press.ts
|
|
2688
2688
|
var go = class {
|
|
@@ -2712,8 +2712,8 @@ var go = class {
|
|
|
2712
2712
|
pressed(e, t) {
|
|
2713
2713
|
let n = this.panelOf(e), r = this.host.filters();
|
|
2714
2714
|
if (!n || !r.from) return !1;
|
|
2715
|
-
let i = new Map(
|
|
2716
|
-
return
|
|
2715
|
+
let i = new Map(d(this.host.applied()).map((e) => [e.name, e]));
|
|
2716
|
+
return w(n.panel).some((n) => {
|
|
2717
2717
|
let a = i.get(n.globalField);
|
|
2718
2718
|
if (!a || r.from?.[a.name] !== e) return !1;
|
|
2719
2719
|
let o = this.valueOf(e, a, n.panelField, t), s = r.values[a.name];
|
|
@@ -2723,13 +2723,13 @@ var go = class {
|
|
|
2723
2723
|
spanFilters(e) {
|
|
2724
2724
|
let t = this.panelOf(e), n = this.host.child(e)?.getSnapshot().result?.config;
|
|
2725
2725
|
if (!t || n?.kind !== "analysis" || n.elements?.length) return [];
|
|
2726
|
-
let r = n.groups.filter((e) => e.type ===
|
|
2727
|
-
return
|
|
2726
|
+
let r = n.groups.filter((e) => e.type === F.DATE_HISTOGRAM);
|
|
2727
|
+
return Ye(d(this.host.applied()), t.panel, r).map((e) => e.filter).filter((e) => P(e.kind) === "date" && !this.host.held(e.name));
|
|
2728
2728
|
}
|
|
2729
2729
|
pressSpan(e, t, n, r) {
|
|
2730
2730
|
let i = this.spanFilters(e).find((e) => e.name === t), a = this.panelOf(e), o = this.host.child(e), s = o?.getSnapshot().result?.config;
|
|
2731
2731
|
if (!i || !a || !o || s?.kind !== "analysis") return { kind: "none" };
|
|
2732
|
-
let c =
|
|
2732
|
+
let c = w(a.panel).find((e) => e.globalField === t)?.panelField, l = ya(s, o.fields, this.host.kinds, n, r, { timeZone: o.environment.timeZone })?.find((e) => e.group.field === c && e.group.type === F.DATE_HISTOGRAM), u = l ? _o("date", l) : null;
|
|
2733
2733
|
return u === null || this.host.press(t, u, e).length > 0 ? {
|
|
2734
2734
|
kind: "no-value",
|
|
2735
2735
|
filter: i
|
|
@@ -2750,16 +2750,16 @@ var go = class {
|
|
|
2750
2750
|
"click"
|
|
2751
2751
|
];
|
|
2752
2752
|
if (r.kind === "url") {
|
|
2753
|
-
let e =
|
|
2754
|
-
return e === null ? { refused:
|
|
2753
|
+
let e = ie(r.url, Co(i.groups));
|
|
2754
|
+
return e === null ? { refused: x("dashboard.click.url-unsafe", a) } : { to: {
|
|
2755
2755
|
kind: "url",
|
|
2756
2756
|
url: e
|
|
2757
2757
|
} };
|
|
2758
2758
|
}
|
|
2759
2759
|
if (r.kind === "dashboard") return this.toBoard(r, i, a);
|
|
2760
2760
|
let o = await this.host.reference(r.instanceId);
|
|
2761
|
-
if (!o) return { refused:
|
|
2762
|
-
if (o.instance.config.kind === "dashboard") return { refused:
|
|
2761
|
+
if (!o) return { refused: x("dashboard.click.destination-unavailable", a) };
|
|
2762
|
+
if (o.instance.config.kind === "dashboard") return { refused: x("dashboard.click.destination-unsupported", a) };
|
|
2763
2763
|
let s = bo(this.host.child(e)?.fields ?? [], o.fields), c = i.groups.flatMap((e) => e.group.field !== void 0 && s(e.group.field) ? e.conditions : []), l = this.host.handOver(e), u = xo(l?.filter ?? null, s);
|
|
2764
2764
|
return { to: {
|
|
2765
2765
|
kind: "view",
|
|
@@ -2779,40 +2779,40 @@ var go = class {
|
|
|
2779
2779
|
}
|
|
2780
2780
|
async toBoard(e, t, n) {
|
|
2781
2781
|
let r = await this.host.reference(e.instanceId), i = this.host.panel(t.panel.id), a = r?.instance.config;
|
|
2782
|
-
if (!i?.click || !r || a?.kind !== "dashboard") return { fallback: i?.clickFinding ??
|
|
2783
|
-
let o =
|
|
2782
|
+
if (!i?.click || !r || a?.kind !== "dashboard") return { fallback: i?.clickFinding ?? x("dashboard.click.board-gone", n) };
|
|
2783
|
+
let o = ze(a), s = new Map(d(a).map((e) => [e.name, e])), c = this.host.filters().values;
|
|
2784
2784
|
for (let [n, r] of Object.entries(e.values)) {
|
|
2785
2785
|
let e = s.get(n);
|
|
2786
2786
|
if (!e) continue;
|
|
2787
2787
|
let i = "filter" in r ? c[r.filter] ?? null : this.groupValue(e, r.dimension, t);
|
|
2788
|
-
i !== null &&
|
|
2788
|
+
i !== null && _n(e, i, this.host.kinds, [n]).length === 0 && (o.values[n] = i);
|
|
2789
2789
|
}
|
|
2790
2790
|
return { to: {
|
|
2791
2791
|
kind: "dashboard",
|
|
2792
2792
|
definitionId: r.instance.definitionId,
|
|
2793
2793
|
instanceId: e.instanceId,
|
|
2794
2794
|
filters: o,
|
|
2795
|
-
...e.tab &&
|
|
2795
|
+
...e.tab && Vt(a).some((t) => t.id === e.tab) ? { tab: e.tab } : {}
|
|
2796
2796
|
} };
|
|
2797
2797
|
}
|
|
2798
2798
|
groupValue(e, t, n) {
|
|
2799
|
-
let r =
|
|
2799
|
+
let r = P(e.kind), i = n.groups.find((e) => e.group.field === t && Lt(r, e.group.type));
|
|
2800
2800
|
return i ? _o(r, i) : null;
|
|
2801
2801
|
}
|
|
2802
2802
|
filterOf(e) {
|
|
2803
2803
|
let t = this.panelOf(e)?.panel, n = this.host.panel(e)?.click;
|
|
2804
2804
|
if (!t || n?.kind !== "filter") return null;
|
|
2805
|
-
let r =
|
|
2805
|
+
let r = d(this.host.applied()).find((e) => e.name === n.filter), i = r && w(t).find((e) => e.globalField === r.name);
|
|
2806
2806
|
return r && i ? {
|
|
2807
2807
|
filter: r,
|
|
2808
2808
|
field: i.panelField
|
|
2809
2809
|
} : null;
|
|
2810
2810
|
}
|
|
2811
2811
|
panelOf(e) {
|
|
2812
|
-
let t =
|
|
2813
|
-
return
|
|
2814
|
-
panel: t[
|
|
2815
|
-
index:
|
|
2812
|
+
let t = n(this.host.applied()), r = t.findIndex((t) => T(t) && t.id === e);
|
|
2813
|
+
return r < 0 ? null : {
|
|
2814
|
+
panel: t[r],
|
|
2815
|
+
index: r
|
|
2816
2816
|
};
|
|
2817
2817
|
}
|
|
2818
2818
|
pressedOn(e, t) {
|
|
@@ -2828,18 +2828,18 @@ var go = class {
|
|
|
2828
2828
|
} : null;
|
|
2829
2829
|
}
|
|
2830
2830
|
valueOf(e, t, n, r) {
|
|
2831
|
-
let i = this.pressedOn(e, r), a =
|
|
2831
|
+
let i = this.pressedOn(e, r), a = P(t.kind), o = i?.groups.find((e) => e.group.field === n && Lt(a, e.group.type));
|
|
2832
2832
|
return o ? _o(a, o) : null;
|
|
2833
2833
|
}
|
|
2834
2834
|
};
|
|
2835
2835
|
function _o(e, t) {
|
|
2836
2836
|
let [n] = t.conditions;
|
|
2837
|
-
if (!n || n.operator ===
|
|
2837
|
+
if (!n || n.operator === E.IS_NULL) return null;
|
|
2838
2838
|
let r = t.value;
|
|
2839
2839
|
switch (e) {
|
|
2840
2840
|
case "date": return n.value;
|
|
2841
2841
|
case "boolean": return typeof r == "boolean" ? r : null;
|
|
2842
|
-
case "id": return
|
|
2842
|
+
case "id": return fn(n.value) ? n.value : { items: [{
|
|
2843
2843
|
id: r,
|
|
2844
2844
|
label: String(r)
|
|
2845
2845
|
}] };
|
|
@@ -2864,11 +2864,11 @@ function bo(e, t) {
|
|
|
2864
2864
|
let n = new Map(t.map((e) => [e.name, e]));
|
|
2865
2865
|
return (t) => {
|
|
2866
2866
|
let r = e.find((e) => e.name === t), i = n.get(t);
|
|
2867
|
-
return !!r && !!i &&
|
|
2867
|
+
return !!r && !!i && k(r.kind, i.kind);
|
|
2868
2868
|
};
|
|
2869
2869
|
}
|
|
2870
2870
|
function xo(e, t) {
|
|
2871
|
-
return e ? (e.op === "and" ? e.children : [e]).filter((e) =>
|
|
2871
|
+
return e ? (e.op === "and" ? e.children : [e]).filter((e) => g({
|
|
2872
2872
|
op: "and",
|
|
2873
2873
|
children: [e]
|
|
2874
2874
|
}).every(t)) : [];
|
|
@@ -2882,8 +2882,8 @@ function So(e) {
|
|
|
2882
2882
|
function Co(e) {
|
|
2883
2883
|
let t = {};
|
|
2884
2884
|
for (let { group: n, value: r, conditions: i } of e) {
|
|
2885
|
-
if (n.field === void 0 || i[0]?.operator ===
|
|
2886
|
-
let e = n.type ===
|
|
2885
|
+
if (n.field === void 0 || i[0]?.operator === E.IS_NULL) continue;
|
|
2886
|
+
let e = n.type === F.DATE_HISTOGRAM ? qt(r)?.ms : void 0;
|
|
2887
2887
|
t[n.field] = e === void 0 ? String(r) : new Date(e).toISOString();
|
|
2888
2888
|
}
|
|
2889
2889
|
return t;
|
|
@@ -2957,7 +2957,7 @@ var Oo = class {
|
|
|
2957
2957
|
}
|
|
2958
2958
|
};
|
|
2959
2959
|
function ko(e, t) {
|
|
2960
|
-
return Object.keys(t).every((n) => e[n] === t[n]) ? e :
|
|
2960
|
+
return Object.keys(t).every((n) => e[n] === t[n]) ? e : Xe(e, t);
|
|
2961
2961
|
}
|
|
2962
2962
|
function Ao(e, t) {
|
|
2963
2963
|
let n = {
|
|
@@ -3001,7 +3001,7 @@ function Po(e) {
|
|
|
3001
3001
|
return a ? (e.commit(ko(r, a.draft), ko(i, a.applied), t.state), a.step) : null;
|
|
3002
3002
|
}, a = (e, t, n) => {
|
|
3003
3003
|
if (!n) return null;
|
|
3004
|
-
let i = n.config.panels.find((e) =>
|
|
3004
|
+
let i = n.config.panels.find((e) => L(e) && e.id === n.id);
|
|
3005
3005
|
return r(e, n.id, (e) => e === t ? n.config : i ? {
|
|
3006
3006
|
...e,
|
|
3007
3007
|
panels: [...e.panels, i]
|
|
@@ -3031,17 +3031,17 @@ function Po(e) {
|
|
|
3031
3031
|
editPanelContent: (e, t) => r("editPanelContent", e, (n) => Rr(n, e, t)),
|
|
3032
3032
|
movePanelToTab: (e, t) => r("movePanelToTab", e, (n) => zr(n, e, t)),
|
|
3033
3033
|
setPresentation: (e, t) => r("setPresentation", e, (n) => Lr(n, e, t)),
|
|
3034
|
-
setPanelClick: (e, t) => r("setPanelClick", e, (n) =>
|
|
3034
|
+
setPanelClick: (e, t) => r("setPanelClick", e, (n) => Fe(n, e, t)),
|
|
3035
3035
|
referToSaved(t, i) {
|
|
3036
3036
|
n() && (e.seed(i), r("referToSaved", t, (e) => Ir(e, t, i.id)));
|
|
3037
3037
|
},
|
|
3038
3038
|
addTab(e, t) {
|
|
3039
|
-
let i = n(), a = i &&
|
|
3040
|
-
return !i || !a ? null : (r("addTab", a.id, (n) => n === i ? a.config :
|
|
3039
|
+
let i = n(), a = i && pt(i, e, t);
|
|
3040
|
+
return !i || !a ? null : (r("addTab", a.id, (n) => n === i ? a.config : pt(n, e, t)?.config ?? n), a.id);
|
|
3041
3041
|
},
|
|
3042
|
-
renameTab: (e, t) => r("renameTab", e, (n) =>
|
|
3043
|
-
moveTab: (e, t) => r("moveTab", e, (n) =>
|
|
3044
|
-
removeTab: (e) => r("removeTab", e, (t) =>
|
|
3042
|
+
renameTab: (e, t) => r("renameTab", e, (n) => yt(n, e, t)),
|
|
3043
|
+
moveTab: (e, t) => r("moveTab", e, (n) => sn(n, e, t)),
|
|
3044
|
+
removeTab: (e) => r("removeTab", e, (t) => pn(t, e)),
|
|
3045
3045
|
place: (e, t, n) => r("place", e, (r) => Zn(r, e, t, void 0, n)),
|
|
3046
3046
|
reorderPanel: (e, t) => r("reorderPanel", e, (n) => or(n, e, t)),
|
|
3047
3047
|
setWidth: (e) => r("setWidth", null, (t) => Vr(t, e)),
|
|
@@ -3052,7 +3052,7 @@ function Po(e) {
|
|
|
3052
3052
|
},
|
|
3053
3053
|
defaultOf(t) {
|
|
3054
3054
|
let n = e.draft();
|
|
3055
|
-
return (n &&
|
|
3055
|
+
return (n && d(n).find((e) => e.name === t)?.default) ?? null;
|
|
3056
3056
|
},
|
|
3057
3057
|
...Fo(e, r, n)
|
|
3058
3058
|
};
|
|
@@ -3313,14 +3313,14 @@ function Vo(e) {
|
|
|
3313
3313
|
let { columns: n = [], ...r } = e.table ?? {};
|
|
3314
3314
|
return t.table = {
|
|
3315
3315
|
...r,
|
|
3316
|
-
shown: n.filter((e) => !
|
|
3316
|
+
shown: n.filter((e) => !mt(e.hidden)).map((e) => e.field).sort()
|
|
3317
3317
|
}, t;
|
|
3318
3318
|
}
|
|
3319
3319
|
// src/runtime/dashboard/children.ts
|
|
3320
3320
|
function Ho(e, t, n, r) {
|
|
3321
3321
|
let i = e.owned;
|
|
3322
3322
|
if (i !== void 0) {
|
|
3323
|
-
if (!
|
|
3323
|
+
if (!L(i) || typeof i.definitionId != "string") return null;
|
|
3324
3324
|
let t = n(i.definitionId);
|
|
3325
3325
|
return t?.definition.kind === "data" ? {
|
|
3326
3326
|
instance: null,
|
|
@@ -3351,45 +3351,45 @@ var Uo = class {
|
|
|
3351
3351
|
runtimeOf(e) {
|
|
3352
3352
|
return this.children.get(e)?.runtime ?? null;
|
|
3353
3353
|
}
|
|
3354
|
-
sync(e, t, n,
|
|
3355
|
-
let
|
|
3356
|
-
if (
|
|
3357
|
-
|
|
3358
|
-
let
|
|
3359
|
-
|
|
3360
|
-
let
|
|
3361
|
-
return $(
|
|
3354
|
+
sync(e, t, n, i, a) {
|
|
3355
|
+
let o = this.children.get(e);
|
|
3356
|
+
if (o && Ko(o.view, i)) {
|
|
3357
|
+
o.index = t, o.own = n;
|
|
3358
|
+
let s = !z(o.view.config, i.config), c = s && !Go(o.view.config, i.config);
|
|
3359
|
+
s && o.runtime.edit(Wo(o.view.config, i.config)), o.view = i;
|
|
3360
|
+
let l = !z(o.runtime.scopeFilter, a ?? null), u = s ? [...o.runtime.getSnapshot().issues] : [];
|
|
3361
|
+
return $(u) || u.push(...o.runtime.setScopeFilter(a)), $(u) ? (this.drop(e), {
|
|
3362
3362
|
runtime: null,
|
|
3363
|
-
issues: [...n, ...
|
|
3364
|
-
}) : (
|
|
3365
|
-
runtime:
|
|
3366
|
-
issues:
|
|
3363
|
+
issues: [...n, ...r(t, u)]
|
|
3364
|
+
}) : (c ? o.runtime.apply() : o.missed && !l && o.runtime.refresh(), o.missed = !1, {
|
|
3365
|
+
runtime: o.runtime,
|
|
3366
|
+
issues: ae(t, n, o.runtime)
|
|
3367
3367
|
});
|
|
3368
3368
|
}
|
|
3369
|
-
|
|
3370
|
-
let
|
|
3371
|
-
if ($(
|
|
3369
|
+
o && this.drop(e);
|
|
3370
|
+
let s = this.create(i, a), c = [...s.refusedScope, ...s.getSnapshot().issues];
|
|
3371
|
+
if ($(c)) return s.dispose(), {
|
|
3372
3372
|
runtime: null,
|
|
3373
|
-
issues: [...n, ...
|
|
3373
|
+
issues: [...n, ...r(t, c)]
|
|
3374
3374
|
};
|
|
3375
|
-
let
|
|
3375
|
+
let l = s.subscribe(() => this.notified(e));
|
|
3376
3376
|
return this.children.set(e, {
|
|
3377
|
-
runtime:
|
|
3378
|
-
view:
|
|
3379
|
-
unsubscribe:
|
|
3377
|
+
runtime: s,
|
|
3378
|
+
view: i,
|
|
3379
|
+
unsubscribe: l,
|
|
3380
3380
|
index: t,
|
|
3381
3381
|
own: n,
|
|
3382
3382
|
missed: !1
|
|
3383
|
-
}),
|
|
3384
|
-
runtime:
|
|
3385
|
-
issues:
|
|
3383
|
+
}), s.apply(), {
|
|
3384
|
+
runtime: s,
|
|
3385
|
+
issues: ae(t, n, s)
|
|
3386
3386
|
};
|
|
3387
3387
|
}
|
|
3388
3388
|
hold(e, t, n) {
|
|
3389
3389
|
let r = this.children.get(e);
|
|
3390
3390
|
return r ? (r.index = t, r.own = n, {
|
|
3391
3391
|
runtime: r.runtime,
|
|
3392
|
-
issues:
|
|
3392
|
+
issues: ae(t, n, r.runtime)
|
|
3393
3393
|
}) : null;
|
|
3394
3394
|
}
|
|
3395
3395
|
keepOnly(e) {
|
|
@@ -3455,9 +3455,9 @@ var qo = class {
|
|
|
3455
3455
|
return this.failures.get(e);
|
|
3456
3456
|
}
|
|
3457
3457
|
load(e, t) {
|
|
3458
|
-
let
|
|
3459
|
-
if (
|
|
3460
|
-
for (let e of
|
|
3458
|
+
let r = new Set(n(e).map(tn).filter((e) => e !== void 0 && !this.references.has(e) && !this.pending.has(e)));
|
|
3459
|
+
if (r.size === 0) return !1;
|
|
3460
|
+
for (let e of r) this.start(e, t);
|
|
3461
3461
|
return !0;
|
|
3462
3462
|
}
|
|
3463
3463
|
fetch(e) {
|
|
@@ -3477,10 +3477,10 @@ var qo = class {
|
|
|
3477
3477
|
let [, t] = e.path, n = e.params?.instance;
|
|
3478
3478
|
if (e.code !== "dashboard.panel.unavailable" || typeof t != "number" || typeof n != "string") return e;
|
|
3479
3479
|
let r = this.failures.get(n);
|
|
3480
|
-
return r === void 0 ? e :
|
|
3480
|
+
return r === void 0 ? e : Ie(t, n, r);
|
|
3481
3481
|
}
|
|
3482
3482
|
start(e, t) {
|
|
3483
|
-
let n = this.resolve(e).then((t) => this.resolved(e, t), (t) => Jo(t) ? this.resolved(e, null) : this.unreadable(e,
|
|
3483
|
+
let n = this.resolve(e).then((t) => this.resolved(e, t), (t) => Jo(t) ? this.resolved(e, null) : this.unreadable(e, Te(t))), r = t ? n : n.catch((t) => this.failed(e, t));
|
|
3484
3484
|
return this.pending.set(e, r), r;
|
|
3485
3485
|
}
|
|
3486
3486
|
async ready() {
|
|
@@ -3493,19 +3493,19 @@ var qo = class {
|
|
|
3493
3493
|
this.pending.delete(e), this.references.set(e, t), this.settled();
|
|
3494
3494
|
}
|
|
3495
3495
|
failed(e, t) {
|
|
3496
|
-
this.failures.set(e,
|
|
3496
|
+
this.failures.set(e, Te(t)), this.settled();
|
|
3497
3497
|
}
|
|
3498
3498
|
unreadable(e, t) {
|
|
3499
3499
|
this.pending.delete(e), this.references.set(e, null), this.failures.set(e, t), this.settled();
|
|
3500
3500
|
}
|
|
3501
3501
|
};
|
|
3502
3502
|
function Jo(e) {
|
|
3503
|
-
return
|
|
3503
|
+
return le(e) ? e.code !== "UNAVAILABLE" : Ne(e) && e.issue.code !== "view.definition.not-found";
|
|
3504
3504
|
}
|
|
3505
3505
|
// src/runtime/dashboard/opening.ts
|
|
3506
3506
|
var Yo = { status: "idle" };
|
|
3507
3507
|
function Xo(e) {
|
|
3508
|
-
let { saved: t, title: n, scope: r, config: i, issues: a, kinds:
|
|
3508
|
+
let { saved: t, title: n, scope: r, config: i, issues: a, kinds: s } = e;
|
|
3509
3509
|
return {
|
|
3510
3510
|
saved: t,
|
|
3511
3511
|
title: n,
|
|
@@ -3523,8 +3523,8 @@ function Xo(e) {
|
|
|
3523
3523
|
nextRefreshAt: null,
|
|
3524
3524
|
panels: [],
|
|
3525
3525
|
resolving: !1,
|
|
3526
|
-
tab:
|
|
3527
|
-
filters:
|
|
3526
|
+
tab: o(i, null),
|
|
3527
|
+
filters: S(i, null, s).filters,
|
|
3528
3528
|
history: wo,
|
|
3529
3529
|
building: !1,
|
|
3530
3530
|
readerRefresh: null,
|
|
@@ -3591,19 +3591,19 @@ var Zo = class extends Ro {
|
|
|
3591
3591
|
apply: () => this.apply(),
|
|
3592
3592
|
showTab: (e) => this.showTab(e)
|
|
3593
3593
|
});
|
|
3594
|
-
let t = Li(e.saved ?? null, this.canonical),
|
|
3594
|
+
let t = Li(e.saved ?? null, this.canonical), n = this.canonical(e.config);
|
|
3595
3595
|
this.store = new Qi({
|
|
3596
3596
|
state: Xo({
|
|
3597
3597
|
saved: t,
|
|
3598
3598
|
title: e.title,
|
|
3599
3599
|
scope: e.scope,
|
|
3600
|
-
config:
|
|
3601
|
-
issues: this.admit(
|
|
3600
|
+
config: n,
|
|
3601
|
+
issues: this.admit(n, e.scope),
|
|
3602
3602
|
kinds: e.kinds
|
|
3603
3603
|
}),
|
|
3604
3604
|
environment: e.environment,
|
|
3605
3605
|
admit: (e) => this.admit(e, this.state.scope),
|
|
3606
|
-
blocking:
|
|
3606
|
+
blocking: Mt,
|
|
3607
3607
|
apply: () => this.apply(),
|
|
3608
3608
|
refresh: () => this.rerun(Qo),
|
|
3609
3609
|
holding: () => this.rules.holdsTimer() || this.children.loading(),
|
|
@@ -3613,7 +3613,7 @@ var Zo = class extends Ro {
|
|
|
3613
3613
|
this.values.stop(), this.children.disposeAll();
|
|
3614
3614
|
},
|
|
3615
3615
|
restored: (e) => this.load(e)
|
|
3616
|
-
}), this.load(
|
|
3616
|
+
}), this.load(n, !0);
|
|
3617
3617
|
}
|
|
3618
3618
|
get disposed() {
|
|
3619
3619
|
return this.store.disposed;
|
|
@@ -3625,7 +3625,7 @@ var Zo = class extends Ro {
|
|
|
3625
3625
|
return this.store.state;
|
|
3626
3626
|
}
|
|
3627
3627
|
get fields() {
|
|
3628
|
-
return
|
|
3628
|
+
return d(this.state.draft);
|
|
3629
3629
|
}
|
|
3630
3630
|
get scopeFilter() {
|
|
3631
3631
|
return null;
|
|
@@ -3650,7 +3650,7 @@ var Zo = class extends Ro {
|
|
|
3650
3650
|
}
|
|
3651
3651
|
edit(e) {
|
|
3652
3652
|
if (this.disposed) return;
|
|
3653
|
-
let t =
|
|
3653
|
+
let t = Xe(this.state.draft, Do(e));
|
|
3654
3654
|
this.store.setState({
|
|
3655
3655
|
draft: t,
|
|
3656
3656
|
issues: this.admit(t, this.state.scope),
|
|
@@ -3658,7 +3658,7 @@ var Zo = class extends Ro {
|
|
|
3658
3658
|
});
|
|
3659
3659
|
}
|
|
3660
3660
|
apply() {
|
|
3661
|
-
this.disposed ||
|
|
3661
|
+
this.disposed || Mt(this.state.issues) || this.sync({ applied: this.state.draft });
|
|
3662
3662
|
}
|
|
3663
3663
|
revert() {
|
|
3664
3664
|
this.disposed || (this.store.revert(), this.store.setState({ history: this.edits.forget() }));
|
|
@@ -3677,7 +3677,7 @@ var Zo = class extends Ro {
|
|
|
3677
3677
|
return (n) => e.some((e) => e.id === n && e.tab === t);
|
|
3678
3678
|
}
|
|
3679
3679
|
showTab(e) {
|
|
3680
|
-
this.disposed || (this.requestedTab = e, this.synced ? this.sync() : this.store.setState({ tab:
|
|
3680
|
+
this.disposed || (this.requestedTab = e, this.synced ? this.sync() : this.store.setState({ tab: o(this.state.applied, e) }));
|
|
3681
3681
|
}
|
|
3682
3682
|
commit(e, t, n) {
|
|
3683
3683
|
let r = this.canonical(e), i = this.canonical(t);
|
|
@@ -3697,13 +3697,13 @@ var Zo = class extends Ro {
|
|
|
3697
3697
|
refreshPanel(e) {
|
|
3698
3698
|
if (this.disposed) return;
|
|
3699
3699
|
let t = this.state.panels.find((t) => t.id === e);
|
|
3700
|
-
this.references.retry(
|
|
3700
|
+
this.references.retry(tn(t?.panel)) ? this.store.setState({ resolving: !0 }) : this.children.runtimeOf(e)?.refresh();
|
|
3701
3701
|
}
|
|
3702
3702
|
patch(e) {
|
|
3703
3703
|
this.store.setState(e);
|
|
3704
3704
|
}
|
|
3705
3705
|
setScopeFilter(e) {
|
|
3706
|
-
return this.disposed ? this.refusedScope : this.store.refuse(e ? [
|
|
3706
|
+
return this.disposed ? this.refusedScope : this.store.refuse(e ? [x("dashboard.scope.unsupported", [])] : []);
|
|
3707
3707
|
}
|
|
3708
3708
|
handOver(e) {
|
|
3709
3709
|
return this.disposed ? null : Ga(e, this.state, {
|
|
@@ -3758,7 +3758,7 @@ var Zo = class extends Ro {
|
|
|
3758
3758
|
return this.children.runtimeOf(e);
|
|
3759
3759
|
}
|
|
3760
3760
|
admit(e, t) {
|
|
3761
|
-
return
|
|
3761
|
+
return qe(e, t, this.references.known, this.kinds, {
|
|
3762
3762
|
limits: this.options.limits,
|
|
3763
3763
|
definitions: this.options.definitions
|
|
3764
3764
|
}).map((e) => this.references.restate(e));
|
|
@@ -3778,7 +3778,7 @@ var Zo = class extends Ro {
|
|
|
3778
3778
|
sync(e = {}) {
|
|
3779
3779
|
if (this.disposed) return;
|
|
3780
3780
|
this.synced = !0;
|
|
3781
|
-
let t = e.applied ?? this.state.applied, n = this.admit(t, this.state.scope), r =
|
|
3781
|
+
let t = e.applied ?? this.state.applied, n = this.admit(t, this.state.scope), r = o(t, this.requestedTab), i = this.values.on(t);
|
|
3782
3782
|
this.values.askLabels(t, i);
|
|
3783
3783
|
let a = Wa({
|
|
3784
3784
|
applied: t,
|
|
@@ -3791,20 +3791,20 @@ var Zo = class extends Ro {
|
|
|
3791
3791
|
hold: (e, t, n) => this.children.hold(e.id, t, n)
|
|
3792
3792
|
});
|
|
3793
3793
|
this.children.keepOnly(new Set(a.flatMap((e) => e.runtime ? [e.id] : [])));
|
|
3794
|
-
let
|
|
3794
|
+
let s = e.filtersRun ?? this.state.filtersRun + +!z(i, this.filtersOut);
|
|
3795
3795
|
this.filtersOut = i, this.store.setState({
|
|
3796
3796
|
...e,
|
|
3797
3797
|
tab: r,
|
|
3798
3798
|
filters: i,
|
|
3799
|
-
filtersRun:
|
|
3800
|
-
panels:
|
|
3799
|
+
filtersRun: s,
|
|
3800
|
+
panels: mn(this.state.panels, a) ? this.state.panels : a
|
|
3801
3801
|
});
|
|
3802
3802
|
}
|
|
3803
3803
|
syncPanel(e, t, n, r, i) {
|
|
3804
|
-
let a =
|
|
3804
|
+
let a = tn(e) ?? "", o = this.references.failure(a);
|
|
3805
3805
|
if (o !== void 0) return {
|
|
3806
3806
|
runtime: null,
|
|
3807
|
-
issues: i.some((e) => e.code === "dashboard.panel.failed") ? i : [...i,
|
|
3807
|
+
issues: i.some((e) => e.code === "dashboard.panel.failed") ? i : [...i, Ie(t, a, o)]
|
|
3808
3808
|
};
|
|
3809
3809
|
let s = this.viewOf(e);
|
|
3810
3810
|
if (!s || $(i)) return {
|
|
@@ -3827,7 +3827,7 @@ var Zo = class extends Ro {
|
|
|
3827
3827
|
return Ho(e, (e) => this.references.get(e), this.options.definitions, this.store?.getSnapshot().scope ?? this.options.scope);
|
|
3828
3828
|
}
|
|
3829
3829
|
refreshPanelIssues(e) {
|
|
3830
|
-
let t =
|
|
3830
|
+
let t = Ve(this.state.panels, this.children.get(e));
|
|
3831
3831
|
t && this.store.setState({ panels: t });
|
|
3832
3832
|
}
|
|
3833
3833
|
};
|
|
@@ -3836,25 +3836,25 @@ function Qo(e) {
|
|
|
3836
3836
|
}
|
|
3837
3837
|
// src/runtime/commandChecks.ts
|
|
3838
3838
|
function $o(e) {
|
|
3839
|
-
switch (
|
|
3840
|
-
case "empty": throw new
|
|
3841
|
-
case "too-long": throw new
|
|
3839
|
+
switch (nn(e)) {
|
|
3840
|
+
case "empty": throw new _(x("view.title.empty", ["title"]));
|
|
3841
|
+
case "too-long": throw new _(x("view.title.too-long", ["title"], { max: 120 }));
|
|
3842
3842
|
default: return e.trim();
|
|
3843
3843
|
}
|
|
3844
3844
|
}
|
|
3845
3845
|
function es(e, t) {
|
|
3846
3846
|
return ts(e.stored?.(t) ?? t);
|
|
3847
3847
|
}
|
|
3848
|
-
function ts(
|
|
3849
|
-
let
|
|
3850
|
-
if (
|
|
3851
|
-
size: Math.ceil(
|
|
3852
|
-
max:
|
|
3848
|
+
function ts(t) {
|
|
3849
|
+
let n = e(t);
|
|
3850
|
+
if (n > 245760) throw new _(x("view.config.too-large", [], {
|
|
3851
|
+
size: Math.ceil(n / 1024),
|
|
3852
|
+
max: ct / 1024
|
|
3853
3853
|
}));
|
|
3854
|
-
return
|
|
3854
|
+
return t;
|
|
3855
3855
|
}
|
|
3856
3856
|
function ns(e, t) {
|
|
3857
|
-
if (
|
|
3857
|
+
if ($e(e.kind, t)) throw new _(x("view.config.invalid", []));
|
|
3858
3858
|
}
|
|
3859
3859
|
// src/runtime/instanceWrites.ts
|
|
3860
3860
|
var rs = class {
|
|
@@ -3873,9 +3873,9 @@ var rs = class {
|
|
|
3873
3873
|
}
|
|
3874
3874
|
async changeAudience(e, t) {
|
|
3875
3875
|
let { store: n, ledger: r } = this.host;
|
|
3876
|
-
if (!n.changeAudience) throw new
|
|
3876
|
+
if (!n.changeAudience) throw new _(x("view.changeAudience.unsupported", []));
|
|
3877
3877
|
let { revision: i, scope: a, runtime: o } = await this.locate(e, "changeAudience");
|
|
3878
|
-
if (
|
|
3878
|
+
if (Be(a) === t) return o?.getSnapshot().saved ?? n.get(e);
|
|
3879
3879
|
let s = {
|
|
3880
3880
|
action: "changeAudience",
|
|
3881
3881
|
id: e,
|
|
@@ -3895,9 +3895,9 @@ var rs = class {
|
|
|
3895
3895
|
}
|
|
3896
3896
|
async addToDashboard(e, t) {
|
|
3897
3897
|
let { store: n, ledger: r, maxDashboardPanels: i } = this.host, { revision: a, definitionId: o, runtime: s } = await this.locate(e, "save");
|
|
3898
|
-
if (this.host.definition(o).kind !== "dashboard") throw new
|
|
3898
|
+
if (this.host.definition(o).kind !== "dashboard") throw new _(x("view.addToDashboard.not-board", []));
|
|
3899
3899
|
let c = this.host.holders(e);
|
|
3900
|
-
if (c.some((e) => e.getSnapshot().dirty)) throw new
|
|
3900
|
+
if (c.some((e) => e.getSnapshot().dirty)) throw new _(x("view.addToDashboard.unsaved", []));
|
|
3901
3901
|
let l = s?.getSnapshot().saved ?? await n.get(e), u = await n.get(t), d = Ar(l.config, {
|
|
3902
3902
|
kind: "view",
|
|
3903
3903
|
instanceId: t
|
|
@@ -3905,7 +3905,7 @@ var rs = class {
|
|
|
3905
3905
|
view: u.config,
|
|
3906
3906
|
max: i
|
|
3907
3907
|
});
|
|
3908
|
-
if (!d) throw new
|
|
3908
|
+
if (!d) throw new _(x("view.addToDashboard.full", [], { max: i }));
|
|
3909
3909
|
let f = await r.dispatch({
|
|
3910
3910
|
action: "save",
|
|
3911
3911
|
id: e,
|
|
@@ -3916,7 +3916,7 @@ var rs = class {
|
|
|
3916
3916
|
return f;
|
|
3917
3917
|
}
|
|
3918
3918
|
async locate(e, t) {
|
|
3919
|
-
if (
|
|
3919
|
+
if (xt(e)) throw new _(x("view.system.read-only", [], { action: t }));
|
|
3920
3920
|
this.host.prune();
|
|
3921
3921
|
let [n] = this.host.holders(e), r = n?.getSnapshot().saved ?? this.host.listed(e) ?? await this.host.store.get(e);
|
|
3922
3922
|
return this.host.guard.requireInstance(r, t), {
|
|
@@ -3935,18 +3935,18 @@ var rs = class {
|
|
|
3935
3935
|
}
|
|
3936
3936
|
async save(e, t, n, r) {
|
|
3937
3937
|
let i = e instanceof Zo ? e : null, a = i && os(i, t, n);
|
|
3938
|
-
if (!i || !a) throw new
|
|
3938
|
+
if (!i || !a) throw new _(x(is[n], [], { panel: t }));
|
|
3939
3939
|
let { definitionId: o, config: s } = a, c = this.host.registry.require(o), l = $o(r.title);
|
|
3940
|
-
if (c.kind !== "data" || s.kind === "dashboard") throw new
|
|
3940
|
+
if (c.kind !== "data" || s.kind === "dashboard") throw new _(x("runtime.kind.not-declared", [], {
|
|
3941
3941
|
definition: o,
|
|
3942
3942
|
kind: s.kind
|
|
3943
3943
|
}));
|
|
3944
3944
|
let { kinds: u, limits: d } = this.host;
|
|
3945
|
-
if (
|
|
3945
|
+
if (I({
|
|
3946
3946
|
definition: c,
|
|
3947
3947
|
kinds: u,
|
|
3948
3948
|
limits: d
|
|
3949
|
-
}, s).some((e) => e.severity === "error")) throw new
|
|
3949
|
+
}, s).some((e) => e.severity === "error")) throw new _(x("view.config.invalid", []));
|
|
3950
3950
|
this.host.guard.requireCreate(o, r.scope);
|
|
3951
3951
|
let { scope: f } = r;
|
|
3952
3952
|
ts(s);
|
|
@@ -3965,7 +3965,7 @@ var rs = class {
|
|
|
3965
3965
|
};
|
|
3966
3966
|
function os(e, t, n) {
|
|
3967
3967
|
let r = e.getSnapshot().draft.panels.find((e) => e.id === t);
|
|
3968
|
-
if (n === "owned") return
|
|
3968
|
+
if (n === "owned") return be(r) ? r.owned : null;
|
|
3969
3969
|
let i = e.panelRuntime(t)?.getSnapshot().saved;
|
|
3970
3970
|
return T(r) && r.owned === void 0 && i?.id === r.instanceId ? i : null;
|
|
3971
3971
|
}
|
|
@@ -3985,41 +3985,41 @@ function ss() {
|
|
|
3985
3985
|
].join("-");
|
|
3986
3986
|
}
|
|
3987
3987
|
// src/runtime/publish.ts
|
|
3988
|
-
async function cs(t, n, r
|
|
3989
|
-
let
|
|
3990
|
-
if (!
|
|
3991
|
-
let { definitionId:
|
|
3992
|
-
return
|
|
3988
|
+
async function cs(e, t, n, r) {
|
|
3989
|
+
let i = Qt(n) ? null : await r();
|
|
3990
|
+
if (!i || O(i.scope)) throw new _(x("view.system.read-only", [], { action: "publish" }));
|
|
3991
|
+
let { definitionId: a, title: o, config: s } = i;
|
|
3992
|
+
return e.requireCreate(a, "system"), await t.dispatch({
|
|
3993
3993
|
action: "create",
|
|
3994
3994
|
input: {
|
|
3995
|
-
definitionId:
|
|
3996
|
-
title:
|
|
3995
|
+
definitionId: a,
|
|
3996
|
+
title: o,
|
|
3997
3997
|
scope: "system",
|
|
3998
|
-
config: ts(
|
|
3998
|
+
config: ts(s)
|
|
3999
3999
|
},
|
|
4000
4000
|
intent: "save-as"
|
|
4001
4001
|
}, void 0);
|
|
4002
4002
|
}
|
|
4003
|
-
async function ls(t, n
|
|
4004
|
-
if (!
|
|
4005
|
-
let
|
|
4006
|
-
for (let
|
|
4007
|
-
if (!T(
|
|
4008
|
-
let
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
].filter((e) => typeof e == "string" && e !== ""),
|
|
4003
|
+
async function ls(e, t, n = "system") {
|
|
4004
|
+
if (!O(n) || e.kind !== "dashboard") return;
|
|
4005
|
+
let r = [];
|
|
4006
|
+
for (let n of e.panels) {
|
|
4007
|
+
if (!T(n)) continue;
|
|
4008
|
+
let e = [
|
|
4009
|
+
n.owned === void 0 ? n.instanceId : void 0,
|
|
4010
|
+
n.opens,
|
|
4011
|
+
n.click && "instanceId" in n.click ? n.click.instanceId : void 0
|
|
4012
|
+
].filter((e) => typeof e == "string" && e !== ""), i = await Promise.all(e.map(async (e) => Qt(e) ? {
|
|
4013
4013
|
scope: "system",
|
|
4014
4014
|
title: ""
|
|
4015
|
-
} :
|
|
4016
|
-
if (
|
|
4017
|
-
let
|
|
4018
|
-
|
|
4019
|
-
}
|
|
4020
|
-
if (
|
|
4021
|
-
panels:
|
|
4022
|
-
count:
|
|
4015
|
+
} : t(e)));
|
|
4016
|
+
if (i.every((e) => e !== void 0 && O(e.scope))) continue;
|
|
4017
|
+
let a = n.owned === void 0 ? i[0]?.title : void 0;
|
|
4018
|
+
r.push(n.title ?? a ?? n.id);
|
|
4019
|
+
}
|
|
4020
|
+
if (r.length > 0) throw new _(x("dashboard.system.non-system-panels", [], {
|
|
4021
|
+
panels: Se(r),
|
|
4022
|
+
count: r.length
|
|
4023
4023
|
}));
|
|
4024
4024
|
}
|
|
4025
4025
|
function us(e, t) {
|
|
@@ -4050,13 +4050,13 @@ var ds = class {
|
|
|
4050
4050
|
}
|
|
4051
4051
|
async resolveConflict(e, t) {
|
|
4052
4052
|
let { requestId: n, state: r } = this.requireWrite(e);
|
|
4053
|
-
if (r.kind !== "conflict") throw new
|
|
4053
|
+
if (r.kind !== "conflict") throw new _(x("view.write.not-a-conflict", [], { kind: r.kind }));
|
|
4054
4054
|
let i = this.owners.get(n);
|
|
4055
4055
|
return t === "reload" ? (this.settle(n), this.reload(r, i)) : (this.settle(n), this.dispatch(hs(r.payload, r.remote), i));
|
|
4056
4056
|
}
|
|
4057
4057
|
async replay(e, t, n) {
|
|
4058
4058
|
let r = ms(e, n);
|
|
4059
|
-
if (this.inFlight.has(r)) throw new
|
|
4059
|
+
if (this.inFlight.has(r)) throw new _(x("view.write.in-flight", [], { action: e.action }));
|
|
4060
4060
|
this.requireNoUnknownWrite(r, t), this.inFlight.add(r);
|
|
4061
4061
|
let i = { requestId: t };
|
|
4062
4062
|
n && this.owners.set(t, n);
|
|
@@ -4065,7 +4065,7 @@ var ds = class {
|
|
|
4065
4065
|
return this.applyEffect(e, r, n), this.settle(t), r;
|
|
4066
4066
|
} catch (r) {
|
|
4067
4067
|
let i = await this.toWriteState(r, t, e);
|
|
4068
|
-
throw this.writes.set(t, i), n && this.mayShow(n, e, t) && n.setWrite(i), new
|
|
4068
|
+
throw this.writes.set(t, i), n && this.mayShow(n, e, t) && n.setWrite(i), new h(i);
|
|
4069
4069
|
} finally {
|
|
4070
4070
|
this.inFlight.delete(r);
|
|
4071
4071
|
}
|
|
@@ -4120,7 +4120,7 @@ var ds = class {
|
|
|
4120
4120
|
}
|
|
4121
4121
|
}
|
|
4122
4122
|
async toWriteState(e, t, n) {
|
|
4123
|
-
if (!
|
|
4123
|
+
if (!le(e)) return {
|
|
4124
4124
|
kind: "unknown",
|
|
4125
4125
|
requestId: t,
|
|
4126
4126
|
payload: n
|
|
@@ -4130,12 +4130,12 @@ var ds = class {
|
|
|
4130
4130
|
kind: "unknown",
|
|
4131
4131
|
requestId: t,
|
|
4132
4132
|
payload: n,
|
|
4133
|
-
issue:
|
|
4133
|
+
issue: x("view.write.storage", [], { reason: e.message })
|
|
4134
4134
|
} : e.reachable === !0 ? {
|
|
4135
4135
|
kind: "unknown",
|
|
4136
4136
|
requestId: t,
|
|
4137
4137
|
payload: n,
|
|
4138
|
-
issue:
|
|
4138
|
+
issue: x("view.write.unavailable.server", [], { reason: e.message })
|
|
4139
4139
|
} : {
|
|
4140
4140
|
kind: "unknown",
|
|
4141
4141
|
requestId: t,
|
|
@@ -4152,7 +4152,7 @@ var ds = class {
|
|
|
4152
4152
|
kind: "rejected",
|
|
4153
4153
|
requestId: t,
|
|
4154
4154
|
payload: n,
|
|
4155
|
-
issue:
|
|
4155
|
+
issue: x("view.write.conflict-unreadable", [])
|
|
4156
4156
|
};
|
|
4157
4157
|
}
|
|
4158
4158
|
default: return {
|
|
@@ -4178,14 +4178,14 @@ var ds = class {
|
|
|
4178
4178
|
}
|
|
4179
4179
|
requireWrite(e) {
|
|
4180
4180
|
let t = ps(e) ? e.getSnapshot().write?.requestId : e.id, n = t ? this.writes.get(t) : void 0;
|
|
4181
|
-
if (!t || !n) throw new
|
|
4181
|
+
if (!t || !n) throw new _(x("view.write.not-pending", []));
|
|
4182
4182
|
return {
|
|
4183
4183
|
requestId: t,
|
|
4184
4184
|
state: n
|
|
4185
4185
|
};
|
|
4186
4186
|
}
|
|
4187
4187
|
requireNoUnknownWrite(e, t) {
|
|
4188
|
-
for (let [n, r] of this.writes) if (n !== t && r.kind === "unknown" && ms(r.payload, this.owners.get(n)) === e) throw new
|
|
4188
|
+
for (let [n, r] of this.writes) if (n !== t && r.kind === "unknown" && ms(r.payload, this.owners.get(n)) === e) throw new _(x("view.write.unknown-pending", [], { action: r.payload.action }));
|
|
4189
4189
|
}
|
|
4190
4190
|
settle(e) {
|
|
4191
4191
|
this.writes.delete(e);
|
|
@@ -4195,14 +4195,14 @@ var ds = class {
|
|
|
4195
4195
|
};
|
|
4196
4196
|
function fs(e, t) {
|
|
4197
4197
|
let n = { reason: t.message };
|
|
4198
|
-
if (e.action === "create" && e.input.scope === "system" && t.code === "FORBIDDEN") return
|
|
4199
|
-
if (e.action !== "changeAudience" || t.code !== "INVALID") return
|
|
4198
|
+
if (e.action === "create" && e.input.scope === "system" && t.code === "FORBIDDEN") return x("view.publish.forbidden", [], n);
|
|
4199
|
+
if (e.action !== "changeAudience" || t.code !== "INVALID") return x(`view.write.${t.code.toLowerCase()}`, [], n);
|
|
4200
4200
|
let r = t.boards ?? [];
|
|
4201
|
-
return r.length > 0 ?
|
|
4201
|
+
return r.length > 0 ? x("view.changeAudience.invalid.shared-boards", [], {
|
|
4202
4202
|
...n,
|
|
4203
|
-
boards:
|
|
4203
|
+
boards: Se(r),
|
|
4204
4204
|
count: r.length
|
|
4205
|
-
}) :
|
|
4205
|
+
}) : x("view.changeAudience.invalid", [], n);
|
|
4206
4206
|
}
|
|
4207
4207
|
function ps(e) {
|
|
4208
4208
|
return typeof e.getSnapshot == "function";
|
|
@@ -4234,7 +4234,7 @@ function hs(e, t) {
|
|
|
4234
4234
|
// src/runtime/viewChanges.ts
|
|
4235
4235
|
var gs = class {
|
|
4236
4236
|
constructor(e) {
|
|
4237
|
-
this.listeners = Bi((e) => this.report(
|
|
4237
|
+
this.listeners = Bi((e) => this.report(x("view.change.notify-failed", [], { reason: _s(e) }))), this.report = e;
|
|
4238
4238
|
}
|
|
4239
4239
|
subscribe(e) {
|
|
4240
4240
|
return this.listeners.subscribe(e);
|
|
@@ -4267,49 +4267,58 @@ var vs = {
|
|
|
4267
4267
|
delete: !1,
|
|
4268
4268
|
changeAudience: !1
|
|
4269
4269
|
};
|
|
4270
|
-
function bs(
|
|
4271
|
-
if (
|
|
4272
|
-
if (!xs(
|
|
4270
|
+
function bs(e, t) {
|
|
4271
|
+
if (e.scope !== void 0 && O(e.scope)) {
|
|
4272
|
+
if (!xs(e, t)) return {
|
|
4273
4273
|
...ys,
|
|
4274
4274
|
readOnly: !0
|
|
4275
4275
|
};
|
|
4276
|
-
let { save:
|
|
4276
|
+
let { save: n, rename: r, delete: i } = t.instance(e.id);
|
|
4277
4277
|
return {
|
|
4278
|
-
save:
|
|
4278
|
+
save: n,
|
|
4279
4279
|
rename: r,
|
|
4280
4280
|
delete: i,
|
|
4281
4281
|
changeAudience: !1,
|
|
4282
|
-
readOnly: !(
|
|
4282
|
+
readOnly: !(n || r || i)
|
|
4283
4283
|
};
|
|
4284
4284
|
}
|
|
4285
|
-
let
|
|
4285
|
+
let n = t.instance(e.id), r = e.scope === void 0 ? !0 : Be(e.scope) === "personal" ? t.createShared : t.createPersonal;
|
|
4286
4286
|
return {
|
|
4287
|
-
save:
|
|
4288
|
-
rename:
|
|
4289
|
-
delete:
|
|
4290
|
-
changeAudience:
|
|
4287
|
+
save: n.save,
|
|
4288
|
+
rename: n.rename,
|
|
4289
|
+
delete: n.delete,
|
|
4290
|
+
changeAudience: n.changeAudience !== !1 && r,
|
|
4291
4291
|
readOnly: !1
|
|
4292
4292
|
};
|
|
4293
4293
|
}
|
|
4294
4294
|
function xs(e, t) {
|
|
4295
|
-
return e.stored === !0 && t.editSystem === !0 && !
|
|
4295
|
+
return e.stored === !0 && t.editSystem === !0 && !Qt(e.id);
|
|
4296
4296
|
}
|
|
4297
4297
|
var Ss = class {
|
|
4298
4298
|
constructor(e) {
|
|
4299
4299
|
this.store = e;
|
|
4300
4300
|
}
|
|
4301
4301
|
of(e) {
|
|
4302
|
-
let t = this.store.permissions?.(e) ?? vs
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
reorder: t.reorder,
|
|
4307
|
-
setDefault: t.setDefault,
|
|
4308
|
-
...t.editSystem === void 0 ? {} : { editSystem: t.editSystem },
|
|
4302
|
+
let t = this.store.permissions?.(e) ?? vs, n = this.store.local ? {
|
|
4303
|
+
...t,
|
|
4304
|
+
createShared: !1,
|
|
4305
|
+
local: !0,
|
|
4309
4306
|
instance: (e) => ({
|
|
4310
4307
|
...t.instance(e),
|
|
4311
4308
|
changeAudience: !1
|
|
4312
4309
|
})
|
|
4310
|
+
} : t;
|
|
4311
|
+
return this.store.changeAudience ? n : {
|
|
4312
|
+
createPersonal: n.createPersonal,
|
|
4313
|
+
createShared: n.createShared,
|
|
4314
|
+
reorder: n.reorder,
|
|
4315
|
+
setDefault: n.setDefault,
|
|
4316
|
+
...n.local === void 0 ? {} : { local: n.local },
|
|
4317
|
+
...n.editSystem === void 0 ? {} : { editSystem: n.editSystem },
|
|
4318
|
+
instance: (e) => ({
|
|
4319
|
+
...n.instance(e),
|
|
4320
|
+
changeAudience: !1
|
|
4321
|
+
})
|
|
4313
4322
|
};
|
|
4314
4323
|
}
|
|
4315
4324
|
requireCreate(e, t) {
|
|
@@ -4317,14 +4326,14 @@ var Ss = class {
|
|
|
4317
4326
|
}
|
|
4318
4327
|
requireInstance(e, t) {
|
|
4319
4328
|
let n = bs(e, this.of(e.definitionId));
|
|
4320
|
-
if (!n[t]) throw new
|
|
4329
|
+
if (!n[t]) throw new _(n.readOnly ? x("view.system.read-only", [], { action: t }) : x(`view.${t}.forbidden`, []));
|
|
4321
4330
|
}
|
|
4322
4331
|
require(e, t) {
|
|
4323
|
-
if (!e) throw new
|
|
4332
|
+
if (!e) throw new _(x(t, []));
|
|
4324
4333
|
}
|
|
4325
4334
|
};
|
|
4326
|
-
function Cs(
|
|
4327
|
-
return
|
|
4335
|
+
function Cs(e, t) {
|
|
4336
|
+
return O(t) ? e.editSystem === !0 : Be(t) === "shared" ? e.createShared : e.createPersonal;
|
|
4328
4337
|
}
|
|
4329
4338
|
// src/runtime/preferences.ts
|
|
4330
4339
|
var ws = class {
|
|
@@ -4391,17 +4400,17 @@ var Ds = class {
|
|
|
4391
4400
|
async ask(e, t, n, r) {
|
|
4392
4401
|
let i = Os(e.name, t), a = this.answers.get(i);
|
|
4393
4402
|
if (a) return a;
|
|
4394
|
-
let { definition: o, kinds: s, limits: c, environment: l, source: u } = this.context, d = Q(aa(o, e, s, t, c), n),
|
|
4395
|
-
if ($(
|
|
4396
|
-
let
|
|
4403
|
+
let { definition: o, kinds: s, limits: c, environment: l, source: u } = this.context, d = Q(aa(o, e, s, t, c), n), f = Jt(o, d, s, { limits: c });
|
|
4404
|
+
if ($(f)) throw Error(`The values of ${e.name} cannot be asked for: ${f.filter((e) => e.severity === "error").map((e) => e.code).join(", ")}`);
|
|
4405
|
+
let p = Pe(o, d, s, {
|
|
4397
4406
|
now: l.now(),
|
|
4398
4407
|
timeZone: l.timeZone
|
|
4399
|
-
}, c),
|
|
4400
|
-
throw
|
|
4408
|
+
}, c), m = this.generation, h = await u.aggregate(p, { signal: r }).catch((e) => {
|
|
4409
|
+
throw ht(e, r) || this.context.queryFailed("candidates", e), e;
|
|
4401
4410
|
});
|
|
4402
4411
|
r?.throwIfAborted();
|
|
4403
|
-
let
|
|
4404
|
-
return
|
|
4412
|
+
let g = oa(o, d, h, c);
|
|
4413
|
+
return m === this.generation && this.answers.set(i, g), g;
|
|
4405
4414
|
}
|
|
4406
4415
|
};
|
|
4407
4416
|
function Os(e, t) {
|
|
@@ -4412,17 +4421,17 @@ function ks(e, t) {
|
|
|
4412
4421
|
return js(e, t) ?? Ns(e, t);
|
|
4413
4422
|
}
|
|
4414
4423
|
async function As(e, t) {
|
|
4415
|
-
return js(e, t) ??
|
|
4424
|
+
return js(e, t) ?? x(t, [], { reason: await zt(e) });
|
|
4416
4425
|
}
|
|
4417
4426
|
function js(e, t) {
|
|
4418
|
-
return
|
|
4427
|
+
return Ne(e) ? e.issue : Ft(e) ? e.state.kind === "rejected" ? e.state.issue : x(`${t}.${e.state.kind}`, []) : le(e) ? x(`${t}.${Ms(e)}`, [], { reason: e.message }) : null;
|
|
4419
4428
|
}
|
|
4420
4429
|
function Ms(e) {
|
|
4421
4430
|
let t = e.code.toLowerCase();
|
|
4422
4431
|
return e.code === "UNAVAILABLE" && e.reachable ? `${t}.server` : t;
|
|
4423
4432
|
}
|
|
4424
4433
|
function Ns(e, t) {
|
|
4425
|
-
return
|
|
4434
|
+
return x(t, [], { reason: e instanceof Error ? e.message : String(e) });
|
|
4426
4435
|
}
|
|
4427
4436
|
async function Ps(e) {
|
|
4428
4437
|
return As(e, Fs(e) ? "record.detail.forbidden" : "record.detail.failed");
|
|
@@ -4481,7 +4490,7 @@ function Bs(e, t) {
|
|
|
4481
4490
|
}
|
|
4482
4491
|
if (n === "groups" && typeof r == "number") {
|
|
4483
4492
|
if (!e.groups[r] || i !== "missingKey" && i !== "dense") return null;
|
|
4484
|
-
let t = e.groups.map((e, t) => t === r ?
|
|
4493
|
+
let t = e.groups.map((e, t) => t === r ? y(e, i) : e);
|
|
4485
4494
|
return {
|
|
4486
4495
|
...e,
|
|
4487
4496
|
groups: t
|
|
@@ -4506,11 +4515,11 @@ function Bs(e, t) {
|
|
|
4506
4515
|
function Vs(e, t) {
|
|
4507
4516
|
let n = t.path.slice(3);
|
|
4508
4517
|
if (n[0] === "children") return Hs(e, n);
|
|
4509
|
-
let
|
|
4510
|
-
if (typeof
|
|
4511
|
-
let
|
|
4512
|
-
for (let t of
|
|
4513
|
-
return
|
|
4518
|
+
let r = t.params?.field;
|
|
4519
|
+
if (typeof r != "string") return null;
|
|
4520
|
+
let i = [];
|
|
4521
|
+
for (let t of et(e)) N(t.node) && t.node.field === r && i.push(t.path.filter((e) => typeof e == "number"));
|
|
4522
|
+
return i.length === 0 ? null : Ws(e, i.reverse().reduce((e, t) => Ee(e, t), e));
|
|
4514
4523
|
}
|
|
4515
4524
|
function Hs(e, t) {
|
|
4516
4525
|
let n = Us(e, t), r = null;
|
|
@@ -4518,11 +4527,11 @@ function Hs(e, t) {
|
|
|
4518
4527
|
let { tree: t, at: i } = n[e];
|
|
4519
4528
|
if (r === null) {
|
|
4520
4529
|
if (i.length === 0) continue;
|
|
4521
|
-
r =
|
|
4522
|
-
} else if (
|
|
4530
|
+
r = Ee(t, i);
|
|
4531
|
+
} else if (It(r)) r = Ee(t, i);
|
|
4523
4532
|
else {
|
|
4524
4533
|
let e = r;
|
|
4525
|
-
r =
|
|
4534
|
+
r = c(t, i, (t) => ({
|
|
4526
4535
|
...t,
|
|
4527
4536
|
value: e
|
|
4528
4537
|
}));
|
|
@@ -4536,11 +4545,11 @@ function Us(e, t) {
|
|
|
4536
4545
|
at: []
|
|
4537
4546
|
}];
|
|
4538
4547
|
for (let e = 0; e + 1 < t.length && t[e] === "children";) {
|
|
4539
|
-
let
|
|
4540
|
-
if (typeof
|
|
4541
|
-
let a = n[n.length - 1], o =
|
|
4542
|
-
if (
|
|
4543
|
-
else if (
|
|
4548
|
+
let r = t[e + 1];
|
|
4549
|
+
if (typeof r != "number") break;
|
|
4550
|
+
let a = n[n.length - 1], o = oe(a.tree, a.at);
|
|
4551
|
+
if (i(o)) a.at = [...a.at, r], e += 2;
|
|
4552
|
+
else if (N(o) && i(o.value)) n.push({
|
|
4544
4553
|
tree: o.value,
|
|
4545
4554
|
at: []
|
|
4546
4555
|
});
|
|
@@ -4549,7 +4558,7 @@ function Us(e, t) {
|
|
|
4549
4558
|
return n;
|
|
4550
4559
|
}
|
|
4551
4560
|
function Ws(e, t) {
|
|
4552
|
-
return
|
|
4561
|
+
return hn(e, t) ? null : t;
|
|
4553
4562
|
}
|
|
4554
4563
|
function Gs(e) {
|
|
4555
4564
|
return e.severity === "error";
|
|
@@ -4566,7 +4575,7 @@ var qs = { status: "idle" }, Js = class {
|
|
|
4566
4575
|
limits: e.limits,
|
|
4567
4576
|
environment: e.environment,
|
|
4568
4577
|
source: e.source,
|
|
4569
|
-
queryFailed:
|
|
4578
|
+
queryFailed: $t(e.environment, () => Ct(this))
|
|
4570
4579
|
}, this.candidates = new Ds(this.context, () => this.injectedScope);
|
|
4571
4580
|
let t = e.saved ?? null, n = e.scopeFilter ?? null, r = this.admit(e.config, null), i = n === null ? r : this.admit(e.config, n), a = Ui(r, i), o = a.length > 0;
|
|
4572
4581
|
this.injectedScope = o ? null : n;
|
|
@@ -4593,7 +4602,7 @@ var qs = { status: "idle" }, Js = class {
|
|
|
4593
4602
|
admit: (e) => this.admit(e),
|
|
4594
4603
|
apply: () => this.apply(),
|
|
4595
4604
|
refresh: () => this.refresh(),
|
|
4596
|
-
asked: (e) =>
|
|
4605
|
+
asked: (e) => _t(e, this.fields, this.kinds),
|
|
4597
4606
|
holding: () => !this.autoRefresh || !this.refreshing || this.state.query.status === "loading" || eo(this.state.query.error) || this.holds(),
|
|
4598
4607
|
release: () => this.runner.cancel(this.id),
|
|
4599
4608
|
expiresAt: () => this.autoRefresh ? this.rolloverAt() : null
|
|
@@ -4604,7 +4613,7 @@ var qs = { status: "idle" }, Js = class {
|
|
|
4604
4613
|
if (!e || e.data.kind !== "analysis") return null;
|
|
4605
4614
|
let t = this.state.draft;
|
|
4606
4615
|
if (t.kind !== "analysis" || e.config.kind !== "analysis") return null;
|
|
4607
|
-
let n = e.receivedAt - e.elapsedMs, r =
|
|
4616
|
+
let n = e.receivedAt - e.elapsedMs, r = he({
|
|
4608
4617
|
...e.config,
|
|
4609
4618
|
chart: t.chart
|
|
4610
4619
|
}, e.data.view.rows, {
|
|
@@ -4648,7 +4657,7 @@ var qs = { status: "idle" }, Js = class {
|
|
|
4648
4657
|
}
|
|
4649
4658
|
edit(e) {
|
|
4650
4659
|
if (this.disposed) return;
|
|
4651
|
-
let t =
|
|
4660
|
+
let t = Xe(this.state.draft, e);
|
|
4652
4661
|
this.store.setState({
|
|
4653
4662
|
draft: t,
|
|
4654
4663
|
issues: this.admit(t),
|
|
@@ -4747,14 +4756,14 @@ var qs = { status: "idle" }, Js = class {
|
|
|
4747
4756
|
}
|
|
4748
4757
|
}
|
|
4749
4758
|
renameFields(e) {
|
|
4750
|
-
let t =
|
|
4759
|
+
let t = Yt(this.state, e);
|
|
4751
4760
|
t && this.store.setState(t);
|
|
4752
4761
|
}
|
|
4753
4762
|
unavailableOf(e, t = this.admit(e)) {
|
|
4754
4763
|
let n = this.capabilities?.declared;
|
|
4755
4764
|
if (!n) return [];
|
|
4756
4765
|
let r = Q(e, this.injectedScope);
|
|
4757
|
-
return Is(t,
|
|
4766
|
+
return Is(t, I({
|
|
4758
4767
|
...this.context,
|
|
4759
4768
|
definition: n
|
|
4760
4769
|
}, r));
|
|
@@ -4770,7 +4779,7 @@ var qs = { status: "idle" }, Js = class {
|
|
|
4770
4779
|
return !1;
|
|
4771
4780
|
}
|
|
4772
4781
|
admit(e, t = this.injectedScope) {
|
|
4773
|
-
let n = Hi(
|
|
4782
|
+
let n = Hi(I(this.context, Q(e, t)), e, t);
|
|
4774
4783
|
return this.refusal ? [this.refusal, ...n] : n;
|
|
4775
4784
|
}
|
|
4776
4785
|
execute(e) {
|
|
@@ -4778,7 +4787,7 @@ var qs = { status: "idle" }, Js = class {
|
|
|
4778
4787
|
this.store.setState({ query: {
|
|
4779
4788
|
status: a,
|
|
4780
4789
|
requestId: i
|
|
4781
|
-
} }), this.runner.run(this.id, (t) => e.fetch ? e.fetch(r, t) :
|
|
4790
|
+
} }), this.runner.run(this.id, (t) => e.fetch ? e.fetch(r, t) : rt(this.context, r, this.pageNow(), t)).then((a) => this.onSuccess(i, r, n, a, e.keepSelection, t), (e) => this.onFailure(i, n, r, e));
|
|
4782
4791
|
}
|
|
4783
4792
|
onSuccess(e, t, n, r, i, a) {
|
|
4784
4793
|
if (!this.isCurrent(e)) return;
|
|
@@ -4807,7 +4816,7 @@ var qs = { status: "idle" }, Js = class {
|
|
|
4807
4816
|
}), this.labelReads = lo(this, c, this.labelReads);
|
|
4808
4817
|
}
|
|
4809
4818
|
onFailure(e, t, n, r) {
|
|
4810
|
-
!xr(r) && this.isCurrent(e) && (r instanceof br ? this.failed(e, t, n, r) :
|
|
4819
|
+
!xr(r) && this.isCurrent(e) && (r instanceof br ? this.failed(e, t, n, r) : Gt(r).then((i) => {
|
|
4811
4820
|
this.capabilities && Pi({
|
|
4812
4821
|
reason: i.reason,
|
|
4813
4822
|
...i.violation ? { code: i.violation.code } : {},
|
|
@@ -4841,7 +4850,7 @@ var qs = { status: "idle" }, Js = class {
|
|
|
4841
4850
|
return this.prune(), [...this.runtimes];
|
|
4842
4851
|
}
|
|
4843
4852
|
require(e) {
|
|
4844
|
-
if (!Xs(e) || !this.runtimes.has(e)) throw new
|
|
4853
|
+
if (!Xs(e) || !this.runtimes.has(e)) throw new _(x("view.runtime.not-owned", []));
|
|
4845
4854
|
return e;
|
|
4846
4855
|
}
|
|
4847
4856
|
holders(e, t) {
|
|
@@ -4878,7 +4887,7 @@ async function Zs(e, t, n, { limit: r, signal: i }) {
|
|
|
4878
4887
|
...o === null ? {} : { cursor: o },
|
|
4879
4888
|
...i === void 0 ? {} : { signal: i }
|
|
4880
4889
|
});
|
|
4881
|
-
for (let e of r.items)
|
|
4890
|
+
for (let e of r.items) Qt(e.id) ? n(e.id) : a.has(e.id) || a.set(e.id, e);
|
|
4882
4891
|
o = r.nextCursor;
|
|
4883
4892
|
} while (o !== null && a.size < r);
|
|
4884
4893
|
let s = [...a.values()].slice(0, r), c = o !== null || a.size > r ? r : void 0;
|
|
@@ -4903,7 +4912,7 @@ var Qs = class {
|
|
|
4903
4912
|
for (let t of e) this.cache.set(t.id, t);
|
|
4904
4913
|
}
|
|
4905
4914
|
note(e) {
|
|
4906
|
-
this.cache.set(e.id,
|
|
4915
|
+
this.cache.set(e.id, Ht(e));
|
|
4907
4916
|
}
|
|
4908
4917
|
drop(e) {
|
|
4909
4918
|
this.cache.delete(e);
|
|
@@ -4932,7 +4941,7 @@ var Qs = class {
|
|
|
4932
4941
|
});
|
|
4933
4942
|
}
|
|
4934
4943
|
} catch (e) {
|
|
4935
|
-
|
|
4944
|
+
Ft(e) && this.host.abandon(e.handle);
|
|
4936
4945
|
} finally {
|
|
4937
4946
|
this.writing.delete(r), this.wanted.delete(r);
|
|
4938
4947
|
}
|
|
@@ -4950,7 +4959,7 @@ var Qs = class {
|
|
|
4950
4959
|
}
|
|
4951
4960
|
};
|
|
4952
4961
|
function ec(e, t) {
|
|
4953
|
-
return typeof t == "string" && e.kind === "dashboard" &&
|
|
4962
|
+
return typeof t == "string" && e.kind === "dashboard" && Vt(e).some((e) => e.id === t);
|
|
4954
4963
|
}
|
|
4955
4964
|
// src/runtime/exportRows.ts
|
|
4956
4965
|
var tc = class extends Error {
|
|
@@ -4959,10 +4968,10 @@ var tc = class extends Error {
|
|
|
4959
4968
|
}
|
|
4960
4969
|
};
|
|
4961
4970
|
function nc(e) {
|
|
4962
|
-
return
|
|
4971
|
+
return it(e, "ExportCancelledError");
|
|
4963
4972
|
}
|
|
4964
4973
|
function rc(e, t, n) {
|
|
4965
|
-
let r = n ?? e.exportMax, i = Number.isFinite(r) ? Math.floor(r) :
|
|
4974
|
+
let r = n ?? e.exportMax, i = Number.isFinite(r) ? Math.floor(r) : b.exportMax, a = u(t, e), o = Math.max(1, Math.min(Math.floor(e.maxPageSize) || b.maxPageSize, a ?? Infinity)), s = He(o, a);
|
|
4966
4975
|
return {
|
|
4967
4976
|
size: o,
|
|
4968
4977
|
max: s === void 0 ? i : Math.min(i, s * o)
|
|
@@ -4975,17 +4984,17 @@ async function ic(e, t, n = {}) {
|
|
|
4975
4984
|
}, u = {
|
|
4976
4985
|
...t,
|
|
4977
4986
|
pageSize: s
|
|
4978
|
-
}, d = r.record?.paging === "cursor", f = [], p, m = d ?
|
|
4987
|
+
}, d = r.record?.paging === "cursor", f = [], p, m = d ? ot.cursor : ot.paged;
|
|
4979
4988
|
for (;;) {
|
|
4980
4989
|
if (f.length >= c) return sc(f, c, p, !0);
|
|
4981
4990
|
cc(n.signal);
|
|
4982
|
-
let t = await oc(e,
|
|
4991
|
+
let t = await oc(e, ue(r, u, i, l, m), m, s, n.signal);
|
|
4983
4992
|
if (cc(n.signal), f.push(...t.list), t.total !== void 0 && (p = t.total), n.onProgress?.(Math.min(f.length, c), p), t.next === null || t.list.length === 0) return sc(f, c, p, !1);
|
|
4984
4993
|
m = t.next;
|
|
4985
4994
|
}
|
|
4986
4995
|
}
|
|
4987
4996
|
async function ac(e, t, n, r, i) {
|
|
4988
|
-
let { columns: a } =
|
|
4997
|
+
let { columns: a } = Re(t.definition, n, {
|
|
4989
4998
|
list: [],
|
|
4990
4999
|
total: 0,
|
|
4991
5000
|
exact: !0
|
|
@@ -5053,7 +5062,7 @@ async function dc(e, t, n, r, i) {
|
|
|
5053
5062
|
op: "and",
|
|
5054
5063
|
children: [{
|
|
5055
5064
|
field: l.rowKey,
|
|
5056
|
-
operator:
|
|
5065
|
+
operator: E.EQ,
|
|
5057
5066
|
value: r
|
|
5058
5067
|
}]
|
|
5059
5068
|
},
|
|
@@ -5062,19 +5071,19 @@ async function dc(e, t, n, r, i) {
|
|
|
5062
5071
|
}, n), d = {
|
|
5063
5072
|
now: s.now(),
|
|
5064
5073
|
timeZone: s.timeZone
|
|
5065
|
-
}, f = l.paging === "cursor", p = fc(
|
|
5074
|
+
}, f = l.paging === "cursor", p = fc(ue(a, u, o, d, f ? ot.cursor : ot.paged)), m = uc(i);
|
|
5066
5075
|
return (f ? await c.cursor(p, { signal: m.signal }) : await c.paged(p, { signal: m.signal })).list[0] ?? null;
|
|
5067
5076
|
}
|
|
5068
5077
|
function fc(e) {
|
|
5069
5078
|
return {
|
|
5070
|
-
..."projection" in e ?
|
|
5079
|
+
..."projection" in e ? y(e, "projection") : e,
|
|
5071
5080
|
sort: []
|
|
5072
5081
|
};
|
|
5073
5082
|
}
|
|
5074
5083
|
// src/runtime/recordRuntime.ts
|
|
5075
5084
|
var pc = class extends Js {
|
|
5076
5085
|
constructor(e) {
|
|
5077
|
-
super(e), this.restarted = !1, this.exportFailed =
|
|
5086
|
+
super(e), this.restarted = !1, this.exportFailed = jt(this.environment, "export", () => Ct(this)), this.target = xe(e.definition);
|
|
5078
5087
|
}
|
|
5079
5088
|
page(e) {
|
|
5080
5089
|
!this.disposed && this.appliedAdmitted && (this.target = e, this.store.setState({ selection: [] }), this.execute({ keepSelection: !1 }));
|
|
@@ -5087,7 +5096,7 @@ var pc = class extends Js {
|
|
|
5087
5096
|
i.kind === "record" && i.view.lanes?.find((t) => t.id === e)?.next && this.execute({
|
|
5088
5097
|
keepSelection: !0,
|
|
5089
5098
|
quiet: !0,
|
|
5090
|
-
fetch: (t, n) =>
|
|
5099
|
+
fetch: (t, n) => _e(this.context, t, i.view, e, i.issues, n)
|
|
5091
5100
|
});
|
|
5092
5101
|
}
|
|
5093
5102
|
select(e) {
|
|
@@ -5099,12 +5108,12 @@ var pc = class extends Js {
|
|
|
5099
5108
|
if (this.disposed) return Promise.reject(/* @__PURE__ */ Error(`View ${this.id} is closed`));
|
|
5100
5109
|
let t = Q(this.state.applied, this.scopeFilter);
|
|
5101
5110
|
return ic(this.context, t, e).then(async (n) => (await ac(this.labels, this.context, t, n.rows, e.signal), n)).catch((t) => {
|
|
5102
|
-
throw !nc(t) && !
|
|
5111
|
+
throw !nc(t) && !ht(t, e.signal) && this.exportFailed("fetch", t), t;
|
|
5103
5112
|
});
|
|
5104
5113
|
}
|
|
5105
5114
|
fetchRecord(e, t) {
|
|
5106
5115
|
return this.disposed ? Promise.reject(/* @__PURE__ */ Error(`View ${this.id} is closed`)) : dc(this.context, this.state.applied, this.scopeFilter, e, t).then((e) => (e && this.askRecordLabels(e, t), e), (e) => {
|
|
5107
|
-
throw
|
|
5116
|
+
throw ht(e, t) || this.context.queryFailed("record", e), e;
|
|
5108
5117
|
});
|
|
5109
5118
|
}
|
|
5110
5119
|
askRecordLabels(e, t) {
|
|
@@ -5118,11 +5127,11 @@ var pc = class extends Js {
|
|
|
5118
5127
|
if (i.kind !== "record" || z(t.own, e)) return null;
|
|
5119
5128
|
let a = zo(t.own, e);
|
|
5120
5129
|
if (a === null) return null;
|
|
5121
|
-
let o =
|
|
5130
|
+
let o = ge(this.context.definition, e, i.view);
|
|
5122
5131
|
if (a === "summaries") return () => this.execute({
|
|
5123
5132
|
keepSelection: !0,
|
|
5124
5133
|
quiet: !0,
|
|
5125
|
-
fetch: (e, t) =>
|
|
5134
|
+
fetch: (e, t) => ce(this.context, e, o, t)
|
|
5126
5135
|
});
|
|
5127
5136
|
let s = Q(e, this.scopeFilter);
|
|
5128
5137
|
return () => this.store.setState({ result: {
|
|
@@ -5136,14 +5145,14 @@ var pc = class extends Js {
|
|
|
5136
5145
|
} });
|
|
5137
5146
|
}
|
|
5138
5147
|
startOver() {
|
|
5139
|
-
return this.target =
|
|
5148
|
+
return this.target = xe(this.context.definition), { selection: [] };
|
|
5140
5149
|
}
|
|
5141
5150
|
pageNow() {
|
|
5142
5151
|
return this.target;
|
|
5143
5152
|
}
|
|
5144
5153
|
recovers(e) {
|
|
5145
5154
|
let t = this.target;
|
|
5146
|
-
return this.restarted || !t || !("cursor" in t) || t.cursor === null || !hc(e) ? !1 : (this.restarted = !0, this.target =
|
|
5155
|
+
return this.restarted || !t || !("cursor" in t) || t.cursor === null || !hc(e) ? !1 : (this.restarted = !0, this.target = xe(this.context.definition), !0);
|
|
5147
5156
|
}
|
|
5148
5157
|
settle(e, t) {
|
|
5149
5158
|
this.restarted = !1;
|
|
@@ -5158,7 +5167,7 @@ var pc = class extends Js {
|
|
|
5158
5167
|
}
|
|
5159
5168
|
shrunkTo(e) {
|
|
5160
5169
|
let t = this.target;
|
|
5161
|
-
return e.kind !== "record" || !t || !("index" in t) ? null :
|
|
5170
|
+
return e.kind !== "record" || !t || !("index" in t) ? null : gn(e.view.paging, t.index, e.view.rows.length);
|
|
5162
5171
|
}
|
|
5163
5172
|
retainSelection(e) {
|
|
5164
5173
|
if (this.state.selection.length === 0 || e.kind !== "record") return this.state.selection;
|
|
@@ -5185,6 +5194,7 @@ var vc = [
|
|
|
5185
5194
|
["definition.text.fallback", "Give the key words in the Provider's `messages` for this language: the engine's starting words are showing in its place."],
|
|
5186
5195
|
["definition.source.unregistered", "Register the definition with its source: `resources: [{ definition, source }]`."],
|
|
5187
5196
|
["binding.definition.unknown", "Bind the definition by the id it is registered under: `bind(definition.id, …)`."],
|
|
5197
|
+
["binding.action.primary-extra", "Mark one action `primary`: the one readers press most."],
|
|
5188
5198
|
["definition.time", "Name a time field the definition declares, of a temporal kind (`defineView` `timeField`)."],
|
|
5189
5199
|
["definition.field", "Fix the field in the definition: `defineView` takes the facts from the descriptor, so narrow it rather than restate it."],
|
|
5190
5200
|
["definition.view", "Fix the system view: a unique id without the separator, of a kind the definition declares."],
|
|
@@ -5247,7 +5257,7 @@ function Tc(e, t, n) {
|
|
|
5247
5257
|
let t = e.definition, n = e.getSnapshot().applied;
|
|
5248
5258
|
if (r?.definition === t && r.applied === n) return r.paths;
|
|
5249
5259
|
let i = {
|
|
5250
|
-
fetched:
|
|
5260
|
+
fetched: Ce(t, n).include ?? [],
|
|
5251
5261
|
declared: Ec(t.fields)
|
|
5252
5262
|
};
|
|
5253
5263
|
return r = {
|
|
@@ -5262,7 +5272,7 @@ function Tc(e, t, n) {
|
|
|
5262
5272
|
o,
|
|
5263
5273
|
r
|
|
5264
5274
|
].join("\0");
|
|
5265
|
-
n.has(s) || (n.add(s), t(
|
|
5275
|
+
n.has(s) || (n.add(s), t(x("record.action.unfetched", [], {
|
|
5266
5276
|
action: i,
|
|
5267
5277
|
field: r,
|
|
5268
5278
|
definition: a,
|
|
@@ -5272,12 +5282,12 @@ function Tc(e, t, n) {
|
|
|
5272
5282
|
});
|
|
5273
5283
|
}
|
|
5274
5284
|
function Ec(e) {
|
|
5275
|
-
let
|
|
5276
|
-
for (let
|
|
5277
|
-
|
|
5278
|
-
for (let e of
|
|
5285
|
+
let n = /* @__PURE__ */ new Set();
|
|
5286
|
+
for (let r of e) if (!(t(r.kind) || r.projectable === !1)) {
|
|
5287
|
+
n.add(r.name);
|
|
5288
|
+
for (let e of r.elements ?? []) n.add(`${r.name}.${e.name}`);
|
|
5279
5289
|
}
|
|
5280
|
-
return
|
|
5290
|
+
return n;
|
|
5281
5291
|
}
|
|
5282
5292
|
function Dc(e, t, n) {
|
|
5283
5293
|
let r = t ? wc.get(t) : void 0;
|
|
@@ -5378,7 +5388,7 @@ var Ac = 3, jc = class {
|
|
|
5378
5388
|
return i.setScopeFilter(r), i;
|
|
5379
5389
|
}
|
|
5380
5390
|
buildData(e, t, n, r) {
|
|
5381
|
-
if (e.kind !== "data" || !Fc(e, t)) throw new
|
|
5391
|
+
if (e.kind !== "data" || !Fc(e, t)) throw new _(x("runtime.kind.not-declared", [], {
|
|
5382
5392
|
definition: e.id,
|
|
5383
5393
|
kind: t.kind
|
|
5384
5394
|
}));
|
|
@@ -5405,7 +5415,7 @@ var Ac = 3, jc = class {
|
|
|
5405
5415
|
return t && _c(e) && Tc(e, t, this.toldUnfetched), e;
|
|
5406
5416
|
}
|
|
5407
5417
|
buildDashboard(e, t, n) {
|
|
5408
|
-
if (e.kind !== "dashboard") throw new
|
|
5418
|
+
if (e.kind !== "dashboard") throw new _(x("runtime.kind.not-declared", [], {
|
|
5409
5419
|
definition: e.id,
|
|
5410
5420
|
kind: t.kind
|
|
5411
5421
|
}));
|
|
@@ -5429,7 +5439,7 @@ var Ac = 3, jc = class {
|
|
|
5429
5439
|
limits: this.host.capabilities.effective(e).limits,
|
|
5430
5440
|
environment: this.host.environment,
|
|
5431
5441
|
source: this.host.resolveSource(e.source),
|
|
5432
|
-
queryFailed:
|
|
5442
|
+
queryFailed: $t(this.host.environment, () => ({ definitionId: e.id }))
|
|
5433
5443
|
}, t)
|
|
5434
5444
|
});
|
|
5435
5445
|
try {
|
|
@@ -5439,13 +5449,13 @@ var Ac = 3, jc = class {
|
|
|
5439
5449
|
}
|
|
5440
5450
|
}
|
|
5441
5451
|
holdRoom(e) {
|
|
5442
|
-
let t = () =>
|
|
5452
|
+
let t = () => n(e.getSnapshot().draft).length * Ac, r = t(), i = this.host.runner.reserve(r), a = e.subscribe(() => {
|
|
5443
5453
|
if (e.disposed) {
|
|
5444
|
-
|
|
5454
|
+
i(), a();
|
|
5445
5455
|
return;
|
|
5446
5456
|
}
|
|
5447
|
-
let
|
|
5448
|
-
|
|
5457
|
+
let n = t();
|
|
5458
|
+
n !== r && (i(), r = n, i = this.host.runner.reserve(r));
|
|
5449
5459
|
});
|
|
5450
5460
|
return e;
|
|
5451
5461
|
}
|
|
@@ -5470,7 +5480,7 @@ var Ac = 3, jc = class {
|
|
|
5470
5480
|
};
|
|
5471
5481
|
function Mc(e, t, n) {
|
|
5472
5482
|
if (t.kind !== "data") return e;
|
|
5473
|
-
let r =
|
|
5483
|
+
let r = Ut(e, t.narrowing?.renamed ?? {}), i = We(t.fields, r.filter, n), a = i === r.filter ? r : {
|
|
5474
5484
|
...r,
|
|
5475
5485
|
filter: i
|
|
5476
5486
|
};
|
|
@@ -5478,10 +5488,10 @@ function Mc(e, t, n) {
|
|
|
5478
5488
|
}
|
|
5479
5489
|
function Nc(e, t, n, r) {
|
|
5480
5490
|
if (!Array.isArray(e.metrics)) return e;
|
|
5481
|
-
let i = Array.isArray(e.elements) ? e.elements : [], a = [...
|
|
5491
|
+
let i = Array.isArray(e.elements) ? e.elements : [], a = [...Me(t, n, { elements: i }).reachable.values()], o = (e) => {
|
|
5482
5492
|
let t = e?.filter;
|
|
5483
5493
|
if (!t) return e;
|
|
5484
|
-
let n =
|
|
5494
|
+
let n = We(a, t, r);
|
|
5485
5495
|
return n === t ? e : {
|
|
5486
5496
|
...e,
|
|
5487
5497
|
filter: n
|
|
@@ -5512,7 +5522,7 @@ var Lc = class {
|
|
|
5512
5522
|
constructor(e) {
|
|
5513
5523
|
this.narrowed = /* @__PURE__ */ new Map(), this.limitsBySource = /* @__PURE__ */ new Map(), this.watchers = /* @__PURE__ */ new Map(), this.host = e, this.fallback = ji(e.limits, null), this.cache = new ki({
|
|
5514
5524
|
now: () => e.environment.now().getTime(),
|
|
5515
|
-
failed: (t) => e.report(
|
|
5525
|
+
failed: (t) => e.report(x("capability.descriptor.unavailable", [], { source: t }, "note")),
|
|
5516
5526
|
changed: (e) => {
|
|
5517
5527
|
for (let t of [...this.watchers.get(e) ?? []]) t();
|
|
5518
5528
|
}
|
|
@@ -5526,10 +5536,10 @@ var Lc = class {
|
|
|
5526
5536
|
let t = this.host.declared(e.definitionId);
|
|
5527
5537
|
if (!t) return;
|
|
5528
5538
|
if (t.kind === "data") return this.prepare(t);
|
|
5529
|
-
let
|
|
5530
|
-
if (
|
|
5531
|
-
let
|
|
5532
|
-
await Promise.all(
|
|
5539
|
+
let r = e.config;
|
|
5540
|
+
if (r.kind !== "dashboard") return;
|
|
5541
|
+
let i = n(r).filter(be).map((e) => this.host.declared(e.owned.definitionId)).filter((e) => e !== void 0);
|
|
5542
|
+
await Promise.all(i.map((e) => this.prepare(e)));
|
|
5533
5543
|
}
|
|
5534
5544
|
async prepare(e) {
|
|
5535
5545
|
if (e.kind !== "data") return;
|
|
@@ -5537,7 +5547,7 @@ var Lc = class {
|
|
|
5537
5547
|
if (!n) return;
|
|
5538
5548
|
let { environment: r } = this.host, i, a = new Promise((e) => {
|
|
5539
5549
|
i = r.setTimeout(() => {
|
|
5540
|
-
this.host.report(
|
|
5550
|
+
this.host.report(x("capability.descriptor.unavailable", [], { source: t }, "note")), e();
|
|
5541
5551
|
}, Oi);
|
|
5542
5552
|
});
|
|
5543
5553
|
try {
|
|
@@ -5560,7 +5570,7 @@ var Lc = class {
|
|
|
5560
5570
|
}
|
|
5561
5571
|
async recheck(e, t) {
|
|
5562
5572
|
let n = this.cache.current(e)?.version;
|
|
5563
|
-
return n !== void 0 && (await this.cache.revalidate(e, !0), this.cache.current(e)?.version !== n || (this.host.report(
|
|
5573
|
+
return n !== void 0 && (await this.cache.revalidate(e, !0), this.cache.current(e)?.version !== n || (this.host.report(x("capability.descriptor.disagrees", [], {
|
|
5564
5574
|
source: e,
|
|
5565
5575
|
code: t ?? "",
|
|
5566
5576
|
version: n
|
|
@@ -5573,7 +5583,7 @@ var Lc = class {
|
|
|
5573
5583
|
limits: this.fallback
|
|
5574
5584
|
};
|
|
5575
5585
|
let { definition: n, findings: r } = this.narrow(e.id, e, t), i = r.filter((e) => e.severity === "error");
|
|
5576
|
-
if (i.length > 0) throw new
|
|
5586
|
+
if (i.length > 0) throw new _(x("view.definition.invalid", [], {
|
|
5577
5587
|
id: e.id,
|
|
5578
5588
|
issues: i.length
|
|
5579
5589
|
}));
|
|
@@ -5597,7 +5607,7 @@ var Lc = class {
|
|
|
5597
5607
|
narrow(e, t, n) {
|
|
5598
5608
|
let r = this.host.declared(e), i = r?.kind === "data" ? r : t, a = this.narrowed.get(e);
|
|
5599
5609
|
if (a?.version === n.version && a.definition === i) return a.result;
|
|
5600
|
-
let o =
|
|
5610
|
+
let o = ut(i, n, this.host.kinds);
|
|
5601
5611
|
this.narrowed.set(e, {
|
|
5602
5612
|
version: n.version,
|
|
5603
5613
|
definition: i,
|
|
@@ -5638,9 +5648,9 @@ var Lc = class {
|
|
|
5638
5648
|
}
|
|
5639
5649
|
}, zc = class {
|
|
5640
5650
|
constructor(e, t, n) {
|
|
5641
|
-
this.host = e, this.sources = /* @__PURE__ */ new Map(), this.wordings = /* @__PURE__ */ new Map(), this.lacking = /* @__PURE__ */ new Set(), this.unbound = /* @__PURE__ */ new Set(), this.reporter = e.onIssue ? (t) => e.onIssue?.(t) : Cc(), this.text = new Rc(e.text && ((t) => e.text?.(t)), () =>
|
|
5642
|
-
for (let { definition: t, source: n, wording: r } of e.resources) n && t.kind === "data" && !this.sources.has(t.source) && this.sources.set(t.source,
|
|
5643
|
-
this.registry = new
|
|
5651
|
+
this.host = e, this.sources = /* @__PURE__ */ new Map(), this.wordings = /* @__PURE__ */ new Map(), this.lacking = /* @__PURE__ */ new Set(), this.unbound = /* @__PURE__ */ new Set(), this.primaries = /* @__PURE__ */ new Set(), this.reporter = e.onIssue ? (t) => e.onIssue?.(t) : Cc(), this.text = new Rc(e.text && ((t) => e.text?.(t)), () => s([...this.registry.definitions.values()]));
|
|
5652
|
+
for (let { definition: t, source: n, wording: r } of e.resources) n && t.kind === "data" && !this.sources.has(t.source) && this.sources.set(t.source, st(n)), r && this.wordings.set(t.id, r);
|
|
5653
|
+
this.registry = new ln({
|
|
5644
5654
|
definitions: e.resources.map(({ definition: e }) => e),
|
|
5645
5655
|
hasSource: (e) => this.sources.has(e),
|
|
5646
5656
|
...e.text ? { text: (t) => e.text?.(t) } : {}
|
|
@@ -5654,7 +5664,7 @@ var Lc = class {
|
|
|
5654
5664
|
}
|
|
5655
5665
|
setText(e, t = "") {
|
|
5656
5666
|
if (!this.text.set(e) || !e) return;
|
|
5657
|
-
let n = [...this.definitions.values()].flatMap((t) =>
|
|
5667
|
+
let n = [...this.definitions.values()].flatMap((t) => Ue(t, e).findings.map((e) => ({
|
|
5658
5668
|
found: e,
|
|
5659
5669
|
definition: t.id,
|
|
5660
5670
|
key: String(e.params?.key)
|
|
@@ -5670,15 +5680,20 @@ var Lc = class {
|
|
|
5670
5680
|
}
|
|
5671
5681
|
for (let e of this.lacking) e.startsWith(`${t}\u0000`) && !i.has(e) && this.lacking.delete(e);
|
|
5672
5682
|
}
|
|
5673
|
-
checkBinding(e) {
|
|
5674
|
-
|
|
5683
|
+
checkBinding(e, t) {
|
|
5684
|
+
let n = (t ?? []).filter((e) => e.primary === !0);
|
|
5685
|
+
return n.length > 1 && !this.primaries.has(e) && (this.primaries.add(e), this.report(x("binding.action.primary-extra", [], {
|
|
5686
|
+
id: e,
|
|
5687
|
+
first: n[0].id,
|
|
5688
|
+
others: n.slice(1).map((e) => e.id).join(", ")
|
|
5689
|
+
}, "warning"), e)), this.definitions.has(e) ? !0 : (this.unbound.has(e) || (this.unbound.add(e), this.report(x("binding.definition.unknown", [], { id: e }, "warning"), e)), !1);
|
|
5675
5690
|
}
|
|
5676
5691
|
report(e, t) {
|
|
5677
5692
|
this.reporter?.(e, t);
|
|
5678
5693
|
}
|
|
5679
5694
|
register(e) {
|
|
5680
5695
|
let { definition: t, source: n, wording: r } = e;
|
|
5681
|
-
n && t.kind === "data" && this.sources.set(t.source,
|
|
5696
|
+
n && t.kind === "data" && this.sources.set(t.source, st(n)), r ? this.wordings.set(t.id, r) : this.wordings.delete(t.id), this.registry.register(t);
|
|
5682
5697
|
}
|
|
5683
5698
|
wordingOf(e) {
|
|
5684
5699
|
return this.wordings.get(e);
|
|
@@ -5689,12 +5704,12 @@ var Lc = class {
|
|
|
5689
5704
|
}
|
|
5690
5705
|
resolveSource(e) {
|
|
5691
5706
|
let t = this.sources.get(e);
|
|
5692
|
-
if (!t) throw new
|
|
5707
|
+
if (!t) throw new _(x("runtime.source.unresolved", [], { source: e }));
|
|
5693
5708
|
return t;
|
|
5694
5709
|
}
|
|
5695
5710
|
resolveOptions(e) {
|
|
5696
5711
|
let t = this.host.resolveOptions;
|
|
5697
|
-
if (!t) throw new
|
|
5712
|
+
if (!t) throw new _(x("runtime.options.unresolved", [], { source: e }));
|
|
5698
5713
|
return t(e);
|
|
5699
5714
|
}
|
|
5700
5715
|
}, Bc = class {
|
|
@@ -5703,7 +5718,7 @@ var Lc = class {
|
|
|
5703
5718
|
current: (e) => this.preferenceCache.current(e),
|
|
5704
5719
|
write: (e, t) => this.writePreferences(e, t),
|
|
5705
5720
|
abandon: (e) => this.ledger.abandonWrite(e)
|
|
5706
|
-
}), this.options = e, this.environment = e.environment ?? vr(), this.store =
|
|
5721
|
+
}), this.options = e, this.environment = e.environment ?? vr(), this.store = an(e.store, this.environment), this.kinds = e.kinds ?? ye, this.capabilities = new Lc({
|
|
5707
5722
|
kinds: this.kinds,
|
|
5708
5723
|
limits: e.limits,
|
|
5709
5724
|
environment: this.environment,
|
|
@@ -5754,8 +5769,8 @@ var Lc = class {
|
|
|
5754
5769
|
startingWord(e) {
|
|
5755
5770
|
return this.resources.startingWord(e);
|
|
5756
5771
|
}
|
|
5757
|
-
checkBinding(e) {
|
|
5758
|
-
return this.resources.checkBinding(e);
|
|
5772
|
+
checkBinding(e, t) {
|
|
5773
|
+
return this.resources.checkBinding(e, t);
|
|
5759
5774
|
}
|
|
5760
5775
|
wordingOf(e) {
|
|
5761
5776
|
return this.resources.wordingOf(e);
|
|
@@ -5770,7 +5785,7 @@ var Lc = class {
|
|
|
5770
5785
|
return this.guard.of(e);
|
|
5771
5786
|
}
|
|
5772
5787
|
async list(e, t = {}) {
|
|
5773
|
-
let n = this.registry.require(e), r =
|
|
5788
|
+
let n = this.registry.require(e), r = f(n).map(Ht), { stored: i, ...a } = await Zs(this.store, e, (t) => this.resources.report(x("view.list.reserved-id", [], { id: t }), e), {
|
|
5774
5789
|
limit: this.limits.listedViews,
|
|
5775
5790
|
...t.signal === void 0 ? {} : { signal: t.signal }
|
|
5776
5791
|
}), o = [...r, ...i];
|
|
@@ -5797,7 +5812,7 @@ var Lc = class {
|
|
|
5797
5812
|
return n?.aborted && (this.runtimes.forget(a), n.throwIfAborted()), a.apply(), a;
|
|
5798
5813
|
}
|
|
5799
5814
|
async readInstance(e, t) {
|
|
5800
|
-
let n =
|
|
5815
|
+
let n = xt(e);
|
|
5801
5816
|
return n ? this.registry.systemInstance(n.definitionId, n.viewId) : this.store.get(e, t === void 0 ? {} : { signal: t });
|
|
5802
5817
|
}
|
|
5803
5818
|
create(e, t) {
|
|
@@ -5974,4 +5989,4 @@ function Uc(e) {
|
|
|
5974
5989
|
}
|
|
5975
5990
|
export { Wn as $, la as A, Yn as B, ya as C, Ta as D, ka as E, ti as F, nr as G, Kn as H, $r as I, Un as J, Gn as K, Cr as L, Yi as M, Bi as N, ua as O, wi as P, H as Q, _r as R, ga as S, wa as T, G as U, rr as V, K as W, In as X, Vn as Y, Ln as Z, no as _, Dc as a, En as at, ha as b, rc as c, As as d, zn as et, ks as f, ss as g, Cs as h, Bc as i, wn as it, $i as j, ma as k, nc as l, bs as m, Hc as n, B as nt, _c as o, Tn as ot, Ts as p, Pn as q, Vc as r, On as rt, tc as s, xn as st, Uc as t, Bn as tt, Ps as u, to as v, _a as w, va as x, eo as y, vr as z };
|
|
5976
5991
|
|
|
5977
|
-
//# sourceMappingURL=viewRuntimeTypes-
|
|
5992
|
+
//# sourceMappingURL=viewRuntimeTypes-D08oR6Ke.js.map
|