@modelform/react-native 0.14.0 → 0.16.0
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/README.md +7 -3
- package/dist/{chunk-XWSPLZNC.js → chunk-PVLALJT5.js} +740 -416
- package/dist/{chunk-72OFPTDE.mjs → chunk-Q5GMOQT7.mjs} +652 -328
- package/dist/core/authoring.d.ts +2 -2
- package/dist/core/formFill.d.ts +1 -9
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +4 -2
- package/dist/core/index.mjs +3 -1
- package/dist/core/ruleFill.d.ts +12 -0
- package/dist/core/schema.d.ts +7 -1
- package/dist/index.js +164 -162
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
- package/schema/dashboard.schema.json +5 -1
|
@@ -382,8 +382,8 @@ function interpolate(text, ctx) {
|
|
|
382
382
|
const builtins = builtinValues(ctx);
|
|
383
383
|
return text.replace(
|
|
384
384
|
/\$(\w+)|\$\{(\w+)(?::(\w+))?\}|\[\[(\w+)(?::(\w+))?\]\]/g,
|
|
385
|
-
(match,
|
|
386
|
-
const name = _nullishCoalesce(_nullishCoalesce(
|
|
385
|
+
(match, plain2, braced, bracedFmt, old, oldFmt) => {
|
|
386
|
+
const name = _nullishCoalesce(_nullishCoalesce(plain2, () => ( braced)), () => ( old));
|
|
387
387
|
const format3 = _nullishCoalesce(bracedFmt, () => ( oldFmt));
|
|
388
388
|
const scoped = _optionalChain([ctx, 'access', _30 => _30.scoped, 'optionalAccess', _31 => _31[name]]);
|
|
389
389
|
const value = scoped ? scoped.value : ctx.values[name];
|
|
@@ -1694,7 +1694,10 @@ function parseSpokenDuration(text) {
|
|
|
1694
1694
|
return clock[1] != null ? h * 3600 + m * 60 + s + Number(`0.${f}`) : m * 60 + s + Number(`0.${f}`);
|
|
1695
1695
|
}
|
|
1696
1696
|
}
|
|
1697
|
-
const lower = text.toLowerCase().replace(
|
|
1697
|
+
const lower = text.toLowerCase().replace(
|
|
1698
|
+
/\b(?:(?:a|one|three) )?(half|quarters?)(?: of)? an? (hour|minute)\b/g,
|
|
1699
|
+
(m, part, unit) => `${part === "half" ? 0.5 : m.startsWith("three") ? 0.75 : 0.25} ${unit}`
|
|
1700
|
+
).replace(/\ban hour\b/g, "one hour").replace(/\ba minute\b/g, "one minute").replace(/(\S+) (hours?|minutes?) and a half/g, "$1 and a half $2");
|
|
1698
1701
|
const parts = lower.split(/\b(hours?|hrs?|minutes?|mins?|seconds?|secs?)\b/);
|
|
1699
1702
|
const scale = (unit) => unit.startsWith("h") ? 3600 : unit.startsWith("m") ? 60 : 1;
|
|
1700
1703
|
let total = 0;
|
|
@@ -1954,66 +1957,6 @@ function readFill(form, answer) {
|
|
|
1954
1957
|
}
|
|
1955
1958
|
return result;
|
|
1956
1959
|
}
|
|
1957
|
-
var UNIT_WORDS = {
|
|
1958
|
-
kg: ["kg", "kgs", "kilo", "kilos", "kilogram", "kilograms"],
|
|
1959
|
-
lb: ["lb", "lbs", "pound", "pounds"],
|
|
1960
|
-
h: ["h", "hr", "hrs", "hour", "hours"],
|
|
1961
|
-
min: ["min", "mins", "minute", "minutes"],
|
|
1962
|
-
s: ["s", "sec", "secs", "second", "seconds"],
|
|
1963
|
-
km: ["km", "kms", "kilometer", "kilometers", "kilometre", "kilometres", "k"],
|
|
1964
|
-
mi: ["mi", "mile", "miles"],
|
|
1965
|
-
m: ["m", "meter", "meters", "metre", "metres"]
|
|
1966
|
-
};
|
|
1967
|
-
var NUMBER_WORD = "(?:-?\\d+(?:[.,]\\d+)?|zero|oh|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety|hundred|thousand|point|and|a|half|quarter|minus)";
|
|
1968
|
-
var escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1969
|
-
function namesOf(f) {
|
|
1970
|
-
const names = /* @__PURE__ */ new Set([f.label.toLowerCase(), f.key.toLowerCase().replace(/[-_]+/g, " ")]);
|
|
1971
|
-
return [...names].filter((n) => n.trim().length > 1);
|
|
1972
|
-
}
|
|
1973
|
-
var LEAD = /^[\s,:;.-]*(?:(?:is|was|were|of|at|about|around|to|=)\b[\s,:;.-]*)*/i;
|
|
1974
|
-
function ruleFill(form, said) {
|
|
1975
|
-
const lower = said.toLowerCase();
|
|
1976
|
-
const hits = [];
|
|
1977
|
-
for (const f of form.fields)
|
|
1978
|
-
for (const name of namesOf(f)) {
|
|
1979
|
-
const re = new RegExp(`(?<![\\p{L}\\p{N}])${escape(name)}(?![\\p{L}\\p{N}])`, "gu");
|
|
1980
|
-
for (const m of lower.matchAll(re)) {
|
|
1981
|
-
const at = m.index;
|
|
1982
|
-
const end = at + m[0].length;
|
|
1983
|
-
if (!hits.some((h) => at < h.end && end > h.at)) hits.push({ key: f.key, at, end });
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
hits.sort((a, b) => a.at - b.at);
|
|
1987
|
-
const segments = {};
|
|
1988
|
-
const used = [];
|
|
1989
|
-
hits.forEach((h, i) => {
|
|
1990
|
-
const stop = i + 1 < hits.length ? hits[i + 1].at : said.length;
|
|
1991
|
-
if (h.key in segments) return;
|
|
1992
|
-
segments[h.key] = said.slice(h.end, stop).replace(LEAD, "").replace(/[\s,;.]+$/, "");
|
|
1993
|
-
used.push([h.at, stop]);
|
|
1994
|
-
});
|
|
1995
|
-
const answer = {};
|
|
1996
|
-
for (const f of form.fields) if (segments[f.key]) answer[f.key] = segments[f.key];
|
|
1997
|
-
const rest = used.reduceRight((text, [a, b]) => text.slice(0, a) + " ".repeat(b - a) + text.slice(b), said);
|
|
1998
|
-
for (const f of form.fields) {
|
|
1999
|
-
if (f.key in answer) continue;
|
|
2000
|
-
if (f.type === "number" && f.unit) {
|
|
2001
|
-
const words2 = _nullishCoalesce(UNIT_WORDS[f.unit.toLowerCase()], () => ( [f.unit.toLowerCase()]));
|
|
2002
|
-
const unitRe = new RegExp(`(?<![\\p{L}\\p{N}])((?:${NUMBER_WORD}[\\s-]+)+)(?:${words2.map(escape).join("|")})(?![\\p{L}\\p{N}])`, "iu");
|
|
2003
|
-
const m = unitRe.exec(rest);
|
|
2004
|
-
if (m && m[1].trim()) answer[f.key] = m[1];
|
|
2005
|
-
} else if ((f.type === "choice" || f.type === "choices") && f.choices) {
|
|
2006
|
-
const options = f.choices.map((label) => ({ label, value: label }));
|
|
2007
|
-
const hits2 = matchChoices(rest, options);
|
|
2008
|
-
const shared = form.fields.some(
|
|
2009
|
-
(g) => g !== f && !(g.key in answer) && (g.type === "choice" || g.type === "choices") && matchChoices(rest, (_nullishCoalesce(g.choices, () => ( []))).map((l) => ({ label: l, value: l }))).length
|
|
2010
|
-
);
|
|
2011
|
-
if (hits2.length && !shared) answer[f.key] = f.type === "choices" ? hits2 : hits2[0];
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
return readFill(form, answer);
|
|
2015
|
-
}
|
|
2016
|
-
var ruleFiller = async (form, said) => ruleFill(form, said);
|
|
2017
1960
|
function modelFiller(generate, fallback) {
|
|
2018
1961
|
return async (form, said) => {
|
|
2019
1962
|
let result = null;
|
|
@@ -2042,6 +1985,358 @@ function fillHints(form) {
|
|
|
2042
1985
|
return [...out];
|
|
2043
1986
|
}
|
|
2044
1987
|
|
|
1988
|
+
// src/core/ruleFill.ts
|
|
1989
|
+
var IRREGULAR = {
|
|
1990
|
+
slept: "sleep",
|
|
1991
|
+
felt: "feel",
|
|
1992
|
+
ran: "run",
|
|
1993
|
+
swam: "swim",
|
|
1994
|
+
rode: "ride",
|
|
1995
|
+
drank: "drink",
|
|
1996
|
+
drunk: "drink",
|
|
1997
|
+
ate: "eat",
|
|
1998
|
+
weigh: "weight",
|
|
1999
|
+
weighs: "weight",
|
|
2000
|
+
weighed: "weight",
|
|
2001
|
+
weighing: "weight"
|
|
2002
|
+
};
|
|
2003
|
+
var SYNONYMS = [
|
|
2004
|
+
["alcohol", "drink", "drinks", "booze"],
|
|
2005
|
+
["mood", "feel", "feeling"],
|
|
2006
|
+
["run", "jog"],
|
|
2007
|
+
["ride", "bike", "cycle"],
|
|
2008
|
+
["strength", "gym", "lift"]
|
|
2009
|
+
];
|
|
2010
|
+
var STOP = /* @__PURE__ */ new Set(["a", "an", "the", "and", "or", "no", "not", "i", "it", "is", "was", "at", "in", "of", "to", "for", "my", "me", "on", "yes"]);
|
|
2011
|
+
function stem(word) {
|
|
2012
|
+
let w = word.toLowerCase().replace(/['’]/g, "");
|
|
2013
|
+
w = _nullishCoalesce(IRREGULAR[w], () => ( w));
|
|
2014
|
+
const cut = (suffix, add = "") => {
|
|
2015
|
+
if (!w.endsWith(suffix) || w.length - suffix.length < 3) return false;
|
|
2016
|
+
w = w.slice(0, -suffix.length) + add;
|
|
2017
|
+
return true;
|
|
2018
|
+
};
|
|
2019
|
+
const cutDone = cut("ations", "at") || cut("ation", "at") || cut("ing") || cut("ed");
|
|
2020
|
+
if (!cutDone && !w.endsWith("ss")) cut("s");
|
|
2021
|
+
if (cutDone && /([b-df-hj-np-tv-z])\1$/.test(w) && !/(ll|ss|ff|zz)$/.test(w)) w = w.slice(0, -1);
|
|
2022
|
+
if (w.length > 3 && w.endsWith("e")) w = w.slice(0, -1);
|
|
2023
|
+
return w;
|
|
2024
|
+
}
|
|
2025
|
+
var GLUED_UNIT = /^(\d+(?:[.,]\d+)?)(k|km|kms|kg|kgs|lb|lbs|h|hr|hrs|min|mins|s|sec|secs|mi|m)$/;
|
|
2026
|
+
function tokenize(said) {
|
|
2027
|
+
const out = [];
|
|
2028
|
+
const add = (text, at, end) => out.push({ text, stem: stem(text), at, end });
|
|
2029
|
+
for (const m of said.matchAll(/[\p{L}\p{N}]+(?:['’.,][\p{L}\p{N}]+)*/gu)) {
|
|
2030
|
+
const at = m.index;
|
|
2031
|
+
const raw = m[0].toLowerCase();
|
|
2032
|
+
const glued = GLUED_UNIT.exec(raw);
|
|
2033
|
+
if (glued) {
|
|
2034
|
+
add(glued[1], at, at + glued[1].length);
|
|
2035
|
+
add(glued[2], at + glued[1].length, at + raw.length);
|
|
2036
|
+
} else add(raw, at, at + raw.length);
|
|
2037
|
+
}
|
|
2038
|
+
return out;
|
|
2039
|
+
}
|
|
2040
|
+
var plain = (t) => t.text.replace(/['’]/g, "");
|
|
2041
|
+
var phrase = (text, label, synonym = false) => {
|
|
2042
|
+
const words2 = tokenize(text).map((t) => t.text);
|
|
2043
|
+
if (!words2.length || !label && words2.length === 1 && STOP.has(words2[0])) return null;
|
|
2044
|
+
return { words: words2, stems: words2.map(stem), synonym, label };
|
|
2045
|
+
};
|
|
2046
|
+
function phrasesFor(names, label = false) {
|
|
2047
|
+
const out = [];
|
|
2048
|
+
for (const name of names) {
|
|
2049
|
+
const p = phrase(name, label);
|
|
2050
|
+
if (!p) continue;
|
|
2051
|
+
out.push(p);
|
|
2052
|
+
if (p.stems.length === 1) {
|
|
2053
|
+
for (const group of SYNONYMS)
|
|
2054
|
+
if (group.some((g) => stem(g) === p.stems[0])) {
|
|
2055
|
+
for (const g of group) if (stem(g) !== p.stems[0]) out.push(phrase(g, label, true));
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
return out;
|
|
2060
|
+
}
|
|
2061
|
+
function findPhrases(tokens, targets) {
|
|
2062
|
+
const all = targets.flatMap((t) => t.phrases.map((p) => ({ ...t, p }))).sort((a, b) => b.p.stems.length - a.p.stems.length);
|
|
2063
|
+
const hits = [];
|
|
2064
|
+
for (const { key, label, p } of all)
|
|
2065
|
+
for (let i = 0; i + p.stems.length <= tokens.length; i++) {
|
|
2066
|
+
const span = tokens.slice(i, i + p.stems.length);
|
|
2067
|
+
if (span.some((t, n) => !t.stem || t.stem !== p.stems[n] || !p.label && STOP.has(t.text))) continue;
|
|
2068
|
+
const end = i + p.stems.length;
|
|
2069
|
+
if (hits.some((h) => i < h.end && end > h.start)) continue;
|
|
2070
|
+
const exact = span.every((t, n) => t.text === p.words[n]);
|
|
2071
|
+
hits.push({ key, label, start: i, end, kind: p.synonym ? "synonym" : exact ? "exact" : "form" });
|
|
2072
|
+
}
|
|
2073
|
+
return hits.sort((a, b) => a.start - b.start);
|
|
2074
|
+
}
|
|
2075
|
+
var namesOf = (f) => [.../* @__PURE__ */ new Set([f.label, f.key.replace(/[-_]+/g, " ")])];
|
|
2076
|
+
var NUMBER_WORDS = new Set(
|
|
2077
|
+
"zero oh nought one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty thirty forty fifty sixty seventy eighty ninety hundred thousand".split(" ")
|
|
2078
|
+
);
|
|
2079
|
+
var TIME_UNITS = {
|
|
2080
|
+
s: 1,
|
|
2081
|
+
sec: 1,
|
|
2082
|
+
secs: 1,
|
|
2083
|
+
second: 1,
|
|
2084
|
+
seconds: 1,
|
|
2085
|
+
min: 60,
|
|
2086
|
+
mins: 60,
|
|
2087
|
+
minute: 60,
|
|
2088
|
+
minutes: 60,
|
|
2089
|
+
h: 3600,
|
|
2090
|
+
hr: 3600,
|
|
2091
|
+
hrs: 3600,
|
|
2092
|
+
hour: 3600,
|
|
2093
|
+
hours: 3600
|
|
2094
|
+
};
|
|
2095
|
+
var UNIT_WORDS = {
|
|
2096
|
+
kg: ["kg", "kgs", "kilo", "kilos", "kilogram", "kilograms"],
|
|
2097
|
+
lb: ["lb", "lbs", "pound", "pounds"],
|
|
2098
|
+
km: ["km", "kms", "kilometer", "kilometers", "kilometre", "kilometres", "k"],
|
|
2099
|
+
mi: ["mi", "mile", "miles"],
|
|
2100
|
+
m: ["m", "meter", "meters", "metre", "metres"]
|
|
2101
|
+
};
|
|
2102
|
+
var isDigits = (t) => !!t && /^\d/.test(t.text);
|
|
2103
|
+
var isNumberWord2 = (t) => !!t && NUMBER_WORDS.has(t.text);
|
|
2104
|
+
var isTimeUnit = (t) => !!t && t.text in TIME_UNITS;
|
|
2105
|
+
var is = (t, ...words2) => !!t && words2.includes(t.text);
|
|
2106
|
+
var timeScale = (unit) => unit ? TIME_UNITS[unit.toLowerCase()] : void 0;
|
|
2107
|
+
var unitWords = (unit) => _nullishCoalesce(UNIT_WORDS[unit.toLowerCase()], () => ( [unit.toLowerCase()]));
|
|
2108
|
+
function numberStarts(tokens, i) {
|
|
2109
|
+
const t = tokens[i];
|
|
2110
|
+
const next = tokens[i + 1];
|
|
2111
|
+
if (isDigits(t) || isNumberWord2(t)) return true;
|
|
2112
|
+
if (is(t, "a", "an")) return is(next, "half", "quarter", "hundred", "thousand", "hour", "minute");
|
|
2113
|
+
if (is(t, "half", "quarter")) return is(next, "a", "an", "of", "hour", "minute");
|
|
2114
|
+
return false;
|
|
2115
|
+
}
|
|
2116
|
+
function numberAt(said, tokens, i, stop) {
|
|
2117
|
+
let k = i;
|
|
2118
|
+
let time = false;
|
|
2119
|
+
const numberish = (j) => {
|
|
2120
|
+
const t = tokens[j];
|
|
2121
|
+
const next = tokens[j + 1];
|
|
2122
|
+
if (isDigits(t) || isNumberWord2(t) || is(t, "point", "half", "quarter")) return true;
|
|
2123
|
+
if (is(t, "and")) return j + 1 < stop && (isDigits(next) || isNumberWord2(next) || is(next, "a"));
|
|
2124
|
+
if (is(t, "a", "an")) return is(next, "half", "quarter", "hundred", "thousand", "hour", "minute");
|
|
2125
|
+
if (is(t, "of")) return is(tokens[j - 1], "half", "quarter") && is(next, "a", "an");
|
|
2126
|
+
return false;
|
|
2127
|
+
};
|
|
2128
|
+
while (k < stop) {
|
|
2129
|
+
if (numberish(k)) k++;
|
|
2130
|
+
else if (isTimeUnit(tokens[k])) {
|
|
2131
|
+
time = true;
|
|
2132
|
+
k++;
|
|
2133
|
+
if (!(k < stop && (numberStarts(tokens, k) || is(tokens[k], "and") && numberish(k)))) break;
|
|
2134
|
+
} else break;
|
|
2135
|
+
}
|
|
2136
|
+
while (k > i && is(tokens[k - 1], "and", "a", "an", "of")) k--;
|
|
2137
|
+
if (k <= i) return null;
|
|
2138
|
+
const text = said.slice(tokens[i].at, tokens[k - 1].end);
|
|
2139
|
+
if (time) {
|
|
2140
|
+
const seconds = parseSpokenDuration(text);
|
|
2141
|
+
return seconds == null ? null : { end: k, text, seconds };
|
|
2142
|
+
}
|
|
2143
|
+
if (parseSpokenNumber(text) == null) return null;
|
|
2144
|
+
const unit = k < stop && !STOP.has(tokens[k].text) ? tokens[k].text : void 0;
|
|
2145
|
+
return { end: unit ? k + 1 : k, text, unit };
|
|
2146
|
+
}
|
|
2147
|
+
var round = (n) => Math.round(n * 1e3) / 1e3;
|
|
2148
|
+
function spanValue(f, span) {
|
|
2149
|
+
const scale = timeScale(f.unit);
|
|
2150
|
+
if (span.seconds != null) {
|
|
2151
|
+
if (f.type === "duration") return span.seconds;
|
|
2152
|
+
return scale ? round(span.seconds / scale) : null;
|
|
2153
|
+
}
|
|
2154
|
+
if (span.unit && f.unit && !scale && !unitWords(f.unit).includes(span.unit) && Object.values(UNIT_WORDS).some((ws) => ws.includes(span.unit))) return null;
|
|
2155
|
+
return f.type === "duration" ? span.text : parseSpokenNumber(span.text);
|
|
2156
|
+
}
|
|
2157
|
+
var SCALE_WORDS = {
|
|
2158
|
+
terrible: 0,
|
|
2159
|
+
awful: 0,
|
|
2160
|
+
horrible: 0,
|
|
2161
|
+
dreadful: 0,
|
|
2162
|
+
miserable: 0,
|
|
2163
|
+
worst: 0,
|
|
2164
|
+
bad: 0.25,
|
|
2165
|
+
low: 0.25,
|
|
2166
|
+
poor: 0.25,
|
|
2167
|
+
rough: 0.25,
|
|
2168
|
+
down: 0.25,
|
|
2169
|
+
rubbish: 0.25,
|
|
2170
|
+
easy: 0,
|
|
2171
|
+
light: 0.25,
|
|
2172
|
+
ok: 0.5,
|
|
2173
|
+
okay: 0.5,
|
|
2174
|
+
fine: 0.5,
|
|
2175
|
+
alright: 0.5,
|
|
2176
|
+
average: 0.5,
|
|
2177
|
+
meh: 0.5,
|
|
2178
|
+
moderate: 0.5,
|
|
2179
|
+
normal: 0.5,
|
|
2180
|
+
good: 0.75,
|
|
2181
|
+
decent: 0.75,
|
|
2182
|
+
nice: 0.75,
|
|
2183
|
+
happy: 0.75,
|
|
2184
|
+
high: 0.75,
|
|
2185
|
+
hard: 0.75,
|
|
2186
|
+
tough: 0.75,
|
|
2187
|
+
great: 1,
|
|
2188
|
+
amazing: 1,
|
|
2189
|
+
excellent: 1,
|
|
2190
|
+
fantastic: 1,
|
|
2191
|
+
brilliant: 1,
|
|
2192
|
+
awesome: 1,
|
|
2193
|
+
wonderful: 1,
|
|
2194
|
+
perfect: 1,
|
|
2195
|
+
best: 1,
|
|
2196
|
+
brutal: 1
|
|
2197
|
+
};
|
|
2198
|
+
var INTENSIFIERS = /* @__PURE__ */ new Set(["very", "really", "super", "so", "extremely", "totally", "incredibly"]);
|
|
2199
|
+
function scaleValue(f, tokens, from, to) {
|
|
2200
|
+
if (f.min == null || f.max == null || f.unit) return null;
|
|
2201
|
+
for (let j = Math.max(0, from); j < to; j++) {
|
|
2202
|
+
const w = plain(tokens[j]);
|
|
2203
|
+
if (!(w in SCALE_WORDS)) continue;
|
|
2204
|
+
if (is(tokens[j - 1], "not") || is(tokens[j - 2], "not")) return null;
|
|
2205
|
+
let x = SCALE_WORDS[w];
|
|
2206
|
+
if (INTENSIFIERS.has(_nullishCoalesce(_optionalChain([tokens, 'access', _158 => _158[j - 1], 'optionalAccess', _159 => _159.text]), () => ( ""))) && x !== 0.5) x = x < 0.5 ? Math.max(0, x - 0.25) : Math.min(1, x + 0.25);
|
|
2207
|
+
return { value: Math.round(f.min + x * (f.max - f.min)), at: j };
|
|
2208
|
+
}
|
|
2209
|
+
return null;
|
|
2210
|
+
}
|
|
2211
|
+
var NEGATIONS = /* @__PURE__ */ new Set(["no", "not", "didnt", "dont", "never", "skipped", "skip", "without", "zero", "none", "havent", "hasnt", "wasnt", "nope", "cant", "couldnt"]);
|
|
2212
|
+
function negatedBefore(tokens, start, free) {
|
|
2213
|
+
for (let j = start - 1; j >= Math.max(0, start - 3); j--) {
|
|
2214
|
+
if (!free[j]) return null;
|
|
2215
|
+
if (NEGATIONS.has(plain(tokens[j])) && !is(tokens[j + 1], "wait")) return j;
|
|
2216
|
+
}
|
|
2217
|
+
return null;
|
|
2218
|
+
}
|
|
2219
|
+
var CORRECTIONS = [["no", "wait"], ["wait"], ["sorry"], ["actually"], ["i", "mean"], ["make", "that"], ["scratch", "that"], ["or", "rather"], ["correction"]];
|
|
2220
|
+
function lastCorrection(tokens, from, to) {
|
|
2221
|
+
let last = null;
|
|
2222
|
+
for (let j = from; j < to; j++)
|
|
2223
|
+
for (const c of CORRECTIONS) if (c.every((w, n) => _optionalChain([tokens, 'access', _160 => _160[j + n], 'optionalAccess', _161 => _161.text]) === w) && j + c.length <= to) last = j + c.length;
|
|
2224
|
+
return last;
|
|
2225
|
+
}
|
|
2226
|
+
var LEAD = /^[\s,:;.-]*(?:(?:is|was|were|of|at|about|around|to|=)\b[\s,:;.-]*)*/i;
|
|
2227
|
+
var MAX_GAP = 4;
|
|
2228
|
+
function valueAfter(said, f, h, tokens, stop, free, nextIsToggle) {
|
|
2229
|
+
const from = h.end;
|
|
2230
|
+
if (f.type === "text") {
|
|
2231
|
+
if (from >= stop) return null;
|
|
2232
|
+
const text = said.slice(tokens[from].at, tokens[stop - 1].end).replace(LEAD, "").replace(/[\s,;.]+$/, "");
|
|
2233
|
+
return text ? { value: text, end: stop } : null;
|
|
2234
|
+
}
|
|
2235
|
+
if (f.type === "boolean") {
|
|
2236
|
+
const after = tokens.slice(from, Math.min(stop, from + 2));
|
|
2237
|
+
const last = after[after.length - 1];
|
|
2238
|
+
const lastIsNo = !!last && from + after.length === stop && nextIsToggle && NEGATIONS.has(plain(last));
|
|
2239
|
+
const yes = lastIsNo ? null : parseSpokenYesNo(after.map((t) => t.text).join(" "));
|
|
2240
|
+
if (yes != null) return { value: yes, end: from + after.length };
|
|
2241
|
+
const neg = negatedBefore(tokens, h.start, free);
|
|
2242
|
+
if (neg != null) return { value: false, end: h.end, start: neg };
|
|
2243
|
+
return h.kind === "synonym" ? null : { value: true, end: h.end };
|
|
2244
|
+
}
|
|
2245
|
+
if (f.type === "choice" || f.type === "choices") {
|
|
2246
|
+
if (from >= stop) return null;
|
|
2247
|
+
const labels = choiceLabels(f, tokens.slice(from, stop));
|
|
2248
|
+
if (!labels.length || f.type === "choice" && labels.length > 1) return null;
|
|
2249
|
+
return { value: f.type === "choice" ? labels[0] : labels, end: stop };
|
|
2250
|
+
}
|
|
2251
|
+
const fix = lastCorrection(tokens, from, stop);
|
|
2252
|
+
for (const start of fix != null ? [fix, from] : [from])
|
|
2253
|
+
for (let j = start; j < Math.min(stop, start + MAX_GAP + 1); j++) {
|
|
2254
|
+
if (!numberStarts(tokens, j)) continue;
|
|
2255
|
+
const span = numberAt(said, tokens, j, stop);
|
|
2256
|
+
const value = span && spanValue(f, span);
|
|
2257
|
+
if (span && value != null) return { value, end: span.end };
|
|
2258
|
+
break;
|
|
2259
|
+
}
|
|
2260
|
+
const near = Math.min(stop, from + 3);
|
|
2261
|
+
if (f.choices && from < near) {
|
|
2262
|
+
const [hit] = matchChoices(said.slice(tokens[from].at, tokens[near - 1].end), f.choices.map((label) => ({ label, value: label })));
|
|
2263
|
+
if (hit != null) return { value: hit, end: near };
|
|
2264
|
+
}
|
|
2265
|
+
const scale = scaleValue(f, tokens, from, near);
|
|
2266
|
+
if (scale) return { value: scale.value, end: scale.at + 1 };
|
|
2267
|
+
const before = scaleValue(f, tokens, h.start - 2, h.start);
|
|
2268
|
+
if (before && tokens.slice(before.at, h.start).every((_, n) => free[before.at + n]) && !/[,.;]/.test(said.slice(tokens[before.at].end, tokens[h.start].at)))
|
|
2269
|
+
return { value: before.value, end: h.end, start: before.at };
|
|
2270
|
+
return null;
|
|
2271
|
+
}
|
|
2272
|
+
function choiceLabels(f, tokens) {
|
|
2273
|
+
const hits = findPhrases(tokens, (_nullishCoalesce(f.choices, () => ( []))).map((label) => ({ key: f.key, label, phrases: phrasesFor([label], true) })));
|
|
2274
|
+
return [...new Set(hits.map((h) => h.label))];
|
|
2275
|
+
}
|
|
2276
|
+
function ruleFill(form, said) {
|
|
2277
|
+
const tokens = tokenize(said);
|
|
2278
|
+
const free = tokens.map(() => true);
|
|
2279
|
+
const take = (from, to) => {
|
|
2280
|
+
for (let j = from; j < to; j++) free[j] = false;
|
|
2281
|
+
};
|
|
2282
|
+
const fieldOf = (key) => form.fields.find((f) => f.key === key);
|
|
2283
|
+
const named = [];
|
|
2284
|
+
let inText = false;
|
|
2285
|
+
for (const h of findPhrases(tokens, form.fields.map((f) => ({ key: f.key, phrases: phrasesFor(namesOf(f)) })))) {
|
|
2286
|
+
if (inText && h.kind !== "exact") continue;
|
|
2287
|
+
named.push(h);
|
|
2288
|
+
inText = fieldOf(h.key).type === "text";
|
|
2289
|
+
}
|
|
2290
|
+
for (const h of named) take(h.start, h.end);
|
|
2291
|
+
const answer = {};
|
|
2292
|
+
for (const f of form.fields) {
|
|
2293
|
+
const mine = named.map((h, i) => ({ h, i })).filter(({ h }) => h.key === f.key);
|
|
2294
|
+
for (const { h, i } of mine.reverse()) {
|
|
2295
|
+
const stop = _nullishCoalesce(_optionalChain([named, 'access', _162 => _162[i + 1], 'optionalAccess', _163 => _163.start]), () => ( tokens.length));
|
|
2296
|
+
const nextIsToggle = !!named[i + 1] && fieldOf(named[i + 1].key).type === "boolean";
|
|
2297
|
+
const found = valueAfter(said, f, h, tokens, stop, free, nextIsToggle);
|
|
2298
|
+
if (!found) continue;
|
|
2299
|
+
answer[f.key] = found.value;
|
|
2300
|
+
take(_nullishCoalesce(found.start, () => ( h.start)), found.end);
|
|
2301
|
+
break;
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
const open = (f) => !(f.key in answer);
|
|
2305
|
+
const timeFields = () => form.fields.filter((f) => open(f) && (f.type === "duration" || f.type === "number" && timeScale(f.unit)));
|
|
2306
|
+
for (let j = 0; j < tokens.length; j++) {
|
|
2307
|
+
if (!free[j] || !numberStarts(tokens, j)) continue;
|
|
2308
|
+
let stop = j;
|
|
2309
|
+
while (stop < tokens.length && free[stop]) stop++;
|
|
2310
|
+
const span = numberAt(said, tokens, j, stop);
|
|
2311
|
+
if (!span) continue;
|
|
2312
|
+
let field2;
|
|
2313
|
+
if (span.seconds != null) {
|
|
2314
|
+
const unitSaid = tokens.slice(j, span.end).find(isTimeUnit).text;
|
|
2315
|
+
const candidates = timeFields();
|
|
2316
|
+
field2 = _nullishCoalesce(candidates.find((f) => timeScale(f.unit) === TIME_UNITS[unitSaid]), () => ( (candidates.length === 1 ? candidates[0] : void 0)));
|
|
2317
|
+
} else if (span.unit) {
|
|
2318
|
+
const matching = form.fields.filter((f) => open(f) && f.type === "number" && f.unit && !timeScale(f.unit) && unitWords(f.unit).includes(span.unit));
|
|
2319
|
+
if (matching.length === 1) field2 = matching[0];
|
|
2320
|
+
}
|
|
2321
|
+
const value = field2 && spanValue(field2, span);
|
|
2322
|
+
if (field2 && value != null) {
|
|
2323
|
+
answer[field2.key] = value;
|
|
2324
|
+
take(j, span.end);
|
|
2325
|
+
j = span.end - 1;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
const unclaimed = tokens.map((t, j) => free[j] ? t : { ...t, stem: "", text: "" });
|
|
2329
|
+
const choiceFields = form.fields.filter((f) => open(f) && (f.type === "choice" || f.type === "choices"));
|
|
2330
|
+
const mentioned = choiceFields.map((f) => ({ f, labels: choiceLabels(f, unclaimed) })).filter((c) => c.labels.length);
|
|
2331
|
+
if (mentioned.length === 1) {
|
|
2332
|
+
const [{ f, labels }] = mentioned;
|
|
2333
|
+
if (f.type === "choices") answer[f.key] = labels;
|
|
2334
|
+
else if (labels.length === 1) answer[f.key] = labels[0];
|
|
2335
|
+
}
|
|
2336
|
+
return readFill(form, answer);
|
|
2337
|
+
}
|
|
2338
|
+
var ruleFiller = async (form, said) => ruleFill(form, said);
|
|
2339
|
+
|
|
2045
2340
|
// src/core/local.ts
|
|
2046
2341
|
var LOCAL_DATASOURCE_TYPE = "modelform-local";
|
|
2047
2342
|
var LEGACY_LOCAL_DATASOURCE_TYPE = "dashkit-local";
|
|
@@ -2118,7 +2413,7 @@ function buildFrames(target, entries, request, label, siblings = []) {
|
|
|
2118
2413
|
const fill = _nullishCoalesce(target.fillZero, () => ( (aggregate === "sum" || aggregate === "count")));
|
|
2119
2414
|
({ times, values } = bucketize(rows, aggregate, bucket, request.range, fill));
|
|
2120
2415
|
}
|
|
2121
|
-
const display = group == null ? name : _nullishCoalesce(_optionalChain([label, 'optionalCall',
|
|
2416
|
+
const display = group == null ? name : _nullishCoalesce(_optionalChain([label, 'optionalCall', _164 => _164(labelKey, group)]), () => ( group));
|
|
2122
2417
|
return {
|
|
2123
2418
|
name,
|
|
2124
2419
|
refId: target.refId,
|
|
@@ -2174,7 +2469,7 @@ function bucketize(rows, aggregate, bucket, range, fillZero) {
|
|
|
2174
2469
|
const keys = fillZero ? step.range(range.from, range.to) : [...sums.keys()].sort((a, b) => a - b);
|
|
2175
2470
|
const values = keys.map((k) => {
|
|
2176
2471
|
const vs = sums.get(k);
|
|
2177
|
-
return _optionalChain([vs, 'optionalAccess',
|
|
2472
|
+
return _optionalChain([vs, 'optionalAccess', _165 => _165.length]) ? reduce2(vs, aggregate) : fillZero ? 0 : null;
|
|
2178
2473
|
});
|
|
2179
2474
|
return { times: keys, values };
|
|
2180
2475
|
}
|
|
@@ -2255,17 +2550,17 @@ function parseGazetteer(json) {
|
|
|
2255
2550
|
};
|
|
2256
2551
|
if (Array.isArray(json)) {
|
|
2257
2552
|
for (const item of json) {
|
|
2258
|
-
const lat = Number(_nullishCoalesce(_optionalChain([item, 'optionalAccess',
|
|
2259
|
-
const lon = Number(_nullishCoalesce(_nullishCoalesce(_optionalChain([item, 'optionalAccess',
|
|
2553
|
+
const lat = Number(_nullishCoalesce(_optionalChain([item, 'optionalAccess', _166 => _166.latitude]), () => ( _optionalChain([item, 'optionalAccess', _167 => _167.lat]))));
|
|
2554
|
+
const lon = Number(_nullishCoalesce(_nullishCoalesce(_optionalChain([item, 'optionalAccess', _168 => _168.longitude]), () => ( _optionalChain([item, 'optionalAccess', _169 => _169.lon]))), () => ( _optionalChain([item, 'optionalAccess', _170 => _170.lng]))));
|
|
2260
2555
|
if (!Number.isFinite(lat) || !Number.isFinite(lon)) continue;
|
|
2261
2556
|
const p = { lon, lat };
|
|
2262
2557
|
add(item.key, p);
|
|
2263
2558
|
for (const k of [..._nullishCoalesce(item.keys, () => ( [])), ..._nullishCoalesce(item.keywords, () => ( []))]) add(k, p);
|
|
2264
2559
|
add(item.name, p);
|
|
2265
2560
|
}
|
|
2266
|
-
} else if (_optionalChain([json, 'optionalAccess',
|
|
2561
|
+
} else if (_optionalChain([json, 'optionalAccess', _171 => _171.type]) === "FeatureCollection") {
|
|
2267
2562
|
for (const f of _nullishCoalesce(json.features, () => ( []))) {
|
|
2268
|
-
const p = featurePoint(_optionalChain([f, 'optionalAccess',
|
|
2563
|
+
const p = featurePoint(_optionalChain([f, 'optionalAccess', _172 => _172.geometry]));
|
|
2269
2564
|
if (!p) continue;
|
|
2270
2565
|
add(f.id, p);
|
|
2271
2566
|
for (const v of Object.values(_nullishCoalesce(f.properties, () => ( {})))) if (typeof v === "string") add(v, p);
|
|
@@ -2274,7 +2569,7 @@ function parseGazetteer(json) {
|
|
|
2274
2569
|
return { find: (key) => _nullishCoalesce(exact.get(key), () => ( folded.get(key.toLowerCase()))) };
|
|
2275
2570
|
}
|
|
2276
2571
|
function featurePoint(geometry) {
|
|
2277
|
-
if (!_optionalChain([geometry, 'optionalAccess',
|
|
2572
|
+
if (!_optionalChain([geometry, 'optionalAccess', _173 => _173.coordinates])) return void 0;
|
|
2278
2573
|
if (geometry.type === "Point") {
|
|
2279
2574
|
const [lon, lat] = geometry.coordinates;
|
|
2280
2575
|
return Number.isFinite(lon) && Number.isFinite(lat) ? { lon, lat } : void 0;
|
|
@@ -2303,7 +2598,7 @@ function loadGazetteer(path, ds) {
|
|
|
2303
2598
|
const json = absolute ? fetch(path).then((r) => {
|
|
2304
2599
|
if (!r.ok) throw new Error(`${r.status} ${r.statusText}`);
|
|
2305
2600
|
return r.json();
|
|
2306
|
-
}) : _optionalChain([ds, 'optionalAccess',
|
|
2601
|
+
}) : _optionalChain([ds, 'optionalAccess', _174 => _174.publicFile]) ? ds.publicFile(path) : Promise.reject(new Error(`${path} is served by Grafana, and this dashboard has no Grafana connection`));
|
|
2307
2602
|
const run2 = json.then(parseGazetteer);
|
|
2308
2603
|
run2.catch(() => loaded.get(path) === run2 && loaded.delete(path));
|
|
2309
2604
|
loaded.set(path, run2);
|
|
@@ -2343,7 +2638,7 @@ function macro(path, format3, ctx) {
|
|
|
2343
2638
|
switch (head) {
|
|
2344
2639
|
case "__from":
|
|
2345
2640
|
case "__to": {
|
|
2346
|
-
const ms = head === "__from" ? _optionalChain([ctx, 'access',
|
|
2641
|
+
const ms = head === "__from" ? _optionalChain([ctx, 'access', _175 => _175.range, 'optionalAccess', _176 => _176.from]) : _optionalChain([ctx, 'access', _177 => _177.range, 'optionalAccess', _178 => _178.to]);
|
|
2347
2642
|
if (ms == null) return void 0;
|
|
2348
2643
|
if (format3 === "date" || format3 === "date:iso") return new Date(ms).toISOString();
|
|
2349
2644
|
if (format3 === "date:seconds") return String(Math.floor(ms / 1e3));
|
|
@@ -2380,13 +2675,13 @@ function macro(path, format3, ctx) {
|
|
|
2380
2675
|
}
|
|
2381
2676
|
return void 0;
|
|
2382
2677
|
case "__series":
|
|
2383
|
-
return rest[0] === "name" ? _nullishCoalesce(_nullishCoalesce(d.seriesName, () => ( _optionalChain([d, 'access',
|
|
2678
|
+
return rest[0] === "name" ? _nullishCoalesce(_nullishCoalesce(d.seriesName, () => ( _optionalChain([d, 'access', _179 => _179.frame, 'optionalAccess', _180 => _180.name]))), () => ( d.fieldName)) : void 0;
|
|
2384
2679
|
case "__data": {
|
|
2385
2680
|
const m = /^fields(?:\.([\w-]+)|\["([^"]*)"\]|\[(\d+)\])/.exec(rest.join("."));
|
|
2386
2681
|
if (!m || !d.frame || d.row == null) return void 0;
|
|
2387
2682
|
const key = _nullishCoalesce(m[1], () => ( m[2]));
|
|
2388
|
-
const f = key != null ? d.frame.fields.find((x) => x.name === key || _optionalChain([x, 'access',
|
|
2389
|
-
const v = _optionalChain([f, 'optionalAccess',
|
|
2683
|
+
const f = key != null ? d.frame.fields.find((x) => x.name === key || _optionalChain([x, 'access', _181 => _181.config, 'optionalAccess', _182 => _182.displayName]) === key) : d.frame.fields[Number(m[3])];
|
|
2684
|
+
const v = _optionalChain([f, 'optionalAccess', _183 => _183.values, 'access', _184 => _184[d.row]]);
|
|
2390
2685
|
if (v == null) return void 0;
|
|
2391
2686
|
return f.type === "time" ? String(toMillis(v)) : String(v);
|
|
2392
2687
|
}
|
|
@@ -2397,9 +2692,9 @@ function urlTime(raw, ms) {
|
|
|
2397
2692
|
return raw.trim().startsWith("now") ? encodeURIComponent(raw.trim()) : String(ms);
|
|
2398
2693
|
}
|
|
2399
2694
|
function allVariables(ctx) {
|
|
2400
|
-
const names = (_nullishCoalesce(_optionalChain([ctx, 'access',
|
|
2695
|
+
const names = (_nullishCoalesce(_optionalChain([ctx, 'access', _185 => _185.dashboard, 'optionalAccess', _186 => _186.templating, 'optionalAccess', _187 => _187.list]), () => ( []))).filter((v) => v.type !== "adhoc").map((v) => v.name);
|
|
2401
2696
|
return (names.length ? names : Object.keys(ctx.values)).flatMap((n) => {
|
|
2402
|
-
const v = _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
2697
|
+
const v = _nullishCoalesce(_optionalChain([ctx, 'access', _188 => _188.scoped, 'optionalAccess', _189 => _189[n], 'optionalAccess', _190 => _190.value]), () => ( ctx.values[n]));
|
|
2403
2698
|
return v == null ? [] : [queryParam(n, v)];
|
|
2404
2699
|
}).join("&");
|
|
2405
2700
|
}
|
|
@@ -2410,7 +2705,7 @@ function parseDashboardLink(href, grafanaUrl) {
|
|
|
2410
2705
|
const base = grafanaUrl ? /^(?:[a-z][a-z0-9+.-]*:)?\/\/([^/?#]+)([^?#]*)/i.exec(grafanaUrl.trim()) : null;
|
|
2411
2706
|
if (host && (!base || base[1].toLowerCase() !== host.toLowerCase())) return null;
|
|
2412
2707
|
if (scheme && !/^https?:$/i.test(scheme)) return null;
|
|
2413
|
-
const prefix = (_nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
2708
|
+
const prefix = (_nullishCoalesce(_optionalChain([base, 'optionalAccess', _191 => _191[2]]), () => ( ""))).replace(/\/+$/, "");
|
|
2414
2709
|
const path = prefix && rawPath.startsWith(prefix + "/") ? rawPath.slice(prefix.length) : rawPath;
|
|
2415
2710
|
const p = /^\/d\/([^/]+)(?:\/[^/]*)?\/?$/.exec(path);
|
|
2416
2711
|
if (!p) return null;
|
|
@@ -2434,12 +2729,12 @@ function decode(s) {
|
|
|
2434
2729
|
}
|
|
2435
2730
|
}
|
|
2436
2731
|
function applyDashboardLink(dashboard, target) {
|
|
2437
|
-
const time = target.from || target.to ? { from: target.from || _optionalChain([dashboard, 'access',
|
|
2438
|
-
const list = _optionalChain([dashboard, 'access',
|
|
2732
|
+
const time = target.from || target.to ? { from: target.from || _optionalChain([dashboard, 'access', _192 => _192.time, 'optionalAccess', _193 => _193.from]) || "now-6h", to: target.to || _optionalChain([dashboard, 'access', _194 => _194.time, 'optionalAccess', _195 => _195.to]) || "now" } : dashboard.time;
|
|
2733
|
+
const list = _optionalChain([dashboard, 'access', _196 => _196.templating, 'optionalAccess', _197 => _197.list, 'access', _198 => _198.map, 'call', _199 => _199((v) => {
|
|
2439
2734
|
const values = target.vars[v.name];
|
|
2440
|
-
if (!_optionalChain([values, 'optionalAccess',
|
|
2735
|
+
if (!_optionalChain([values, 'optionalAccess', _200 => _200.length])) return v;
|
|
2441
2736
|
const value = v.multi ? values : values[0];
|
|
2442
|
-
const text = (Array.isArray(value) ? value : [value]).map((x) => x === "$__all" ? "All" : _nullishCoalesce(_optionalChain([v, 'access',
|
|
2737
|
+
const text = (Array.isArray(value) ? value : [value]).map((x) => x === "$__all" ? "All" : _nullishCoalesce(_optionalChain([v, 'access', _201 => _201.options, 'optionalAccess', _202 => _202.find, 'call', _203 => _203((o) => o.value === x), 'optionalAccess', _204 => _204.text]), () => ( x)));
|
|
2443
2738
|
return { ...v, current: { text: v.multi ? text : text[0], value } };
|
|
2444
2739
|
})]);
|
|
2445
2740
|
return { ...dashboard, time, templating: list ? { ...dashboard.templating, list } : dashboard.templating };
|
|
@@ -2646,6 +2941,10 @@ var dashboard_schema_default = {
|
|
|
2646
2941
|
$ref: "#/definitions/DocumentKind",
|
|
2647
2942
|
description: "Whether this document is a form (for recording entries) or a dashboard (for showing them). Without it, a document with input-* panels counts as a form. See documentKind()."
|
|
2648
2943
|
},
|
|
2944
|
+
localOnly: {
|
|
2945
|
+
type: "boolean",
|
|
2946
|
+
description: "Forms: keep what this form records on the device where it's recorded. Apps that sync entries (to an account, other devices, a server) must leave these out. Off by default."
|
|
2947
|
+
},
|
|
2649
2948
|
uid: {
|
|
2650
2949
|
type: "string"
|
|
2651
2950
|
},
|
|
@@ -2745,7 +3044,7 @@ var dashboard_schema_default = {
|
|
|
2745
3044
|
"form",
|
|
2746
3045
|
"dashboard"
|
|
2747
3046
|
],
|
|
2748
|
-
description: "The subset of the Grafana dashboard JSON model that modelform understands. Unknown keys are tolerated and ignored, so dashboards exported from Grafana load as-is. See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/view-dashboard-json-model/\n\nmodelform adds
|
|
3047
|
+
description: "The subset of the Grafana dashboard JSON model that modelform understands. Unknown keys are tolerated and ignored, so dashboards exported from Grafana load as-is. See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/view-dashboard-json-model/\n\nmodelform adds four extensions, all of which Grafana ignores: - `kind` to say whether the document is a form or a dashboard - `localOnly` to keep a form's entries on the device that records them - `panel.mobile` to tune phone layout per panel - `input-*` panel types for data entry forms (see inputs.ts)"
|
|
2749
3048
|
},
|
|
2750
3049
|
Panel: {
|
|
2751
3050
|
type: "object",
|
|
@@ -4248,7 +4547,7 @@ function validate12(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
4248
4547
|
validate12.errors = vErrors;
|
|
4249
4548
|
return errors === 0;
|
|
4250
4549
|
}
|
|
4251
|
-
var schema18 = { "type": "string", "enum": ["form", "dashboard"], "description": "The subset of the Grafana dashboard JSON model that modelform understands. Unknown keys are tolerated and ignored, so dashboards exported from Grafana load as-is. See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/view-dashboard-json-model/\n\nmodelform adds
|
|
4550
|
+
var schema18 = { "type": "string", "enum": ["form", "dashboard"], "description": "The subset of the Grafana dashboard JSON model that modelform understands. Unknown keys are tolerated and ignored, so dashboards exported from Grafana load as-is. See https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/view-dashboard-json-model/\n\nmodelform adds four extensions, all of which Grafana ignores: - `kind` to say whether the document is a form or a dashboard - `localOnly` to keep a form's entries on the device that records them - `panel.mobile` to tune phone layout per panel - `input-*` panel types for data entry forms (see inputs.ts)" };
|
|
4252
4551
|
var schema19 = { "type": "object", "properties": { "id": { "type": "number" }, "type": { "type": "string", "examples": ["row", "timeseries", "trend", "xychart", "stat", "gauge", "bargauge", "piechart", "barchart", "table", "text", "geomap", "input-number", "input-slider", "input-select", "input-toggle", "input-rating", "input-text", "input-counter", "input-duration", "input-group"] }, "title": { "type": "string" }, "description": { "type": "string" }, "gridPos": { "$ref": "#/definitions/GridPos" }, "datasource": { "anyOf": [{ "$ref": "#/definitions/DataSourceRef" }, { "type": "string" }, { "type": "null" }] }, "targets": { "type": "array", "items": { "$ref": "#/definitions/Target" } }, "fieldConfig": { "type": "object", "properties": { "defaults": { "$ref": "#/definitions/FieldConfig" }, "overrides": { "type": "array", "items": { "$ref": "#/definitions/FieldOverride" } } } }, "options": { "type": "object" }, "transformations": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "options": { "type": "object" }, "disabled": { "type": "boolean" } }, "required": ["id"] }, "description": "Applied in order to the query results. See transform.ts for the ones modelform implements." }, "collapsed": { "type": "boolean", "description": "Rows only." }, "panels": { "type": "array", "items": { "$ref": "#/definitions/Panel" }, "description": "Rows only: children of a collapsed row live here instead of at the top level." }, "repeat": { "type": "string", "description": "Repeat this row (or panel) once per selected value of the named variable." }, "repeatDirection": { "type": "string", "enum": ["h", "v"], "description": "Panel repeats: side by side (`h`, wrapping at maxPerRow) or stacked (`v`)." }, "maxPerRow": { "type": "number" }, "scopedVars": { "type": "object", "additionalProperties": { "type": "object", "properties": { "text": { "type": "string" }, "value": { "type": "string" } }, "required": ["text", "value"] }, "description": "Set on each copy of a repeated row or panel: the single value it was repeated for." }, "mobile": { "$ref": "#/definitions/MobileOptions" }, "links": { "type": "array", "items": { "$ref": "#/definitions/DataLink" }, "description": "Panel links, from the panel header menu in Grafana." } }, "required": ["type", "gridPos"], "additionalProperties": {}, "allOf": [{ "if": { "properties": { "type": { "pattern": "^input-(?!group$)" } }, "required": ["type"] }, "then": { "required": ["options"], "properties": { "options": { "$ref": "#/definitions/InputOptions" } } } }, { "if": { "properties": { "type": { "const": "input-group" } }, "required": ["type"] }, "then": { "required": ["options"], "properties": { "options": { "$ref": "#/definitions/InputGroupOptions" } } } }] };
|
|
4253
4552
|
var pattern1 = new RegExp("^input-(?!group$)", "u");
|
|
4254
4553
|
var schema20 = { "type": "object", "properties": { "metric": { "type": "string", "description": "The metric this input records to. Visualization queries select data by this name." }, "unit": { "type": "string" }, "min": { "type": "number" }, "max": { "type": "number" }, "step": { "type": "number" }, "placeholder": { "type": "string" }, "labels": { "type": "array", "items": { "type": "string" }, "description": 'input-slider only: text spaced evenly along the track, first at min and last at max, e.g. ["Understeer", "Neutral", "Oversteer"]. Replaces the numeric min/max labels.' }, "default": { "anyOf": [{ "type": "number" }, { "type": "string" }, { "type": "boolean" }, { "type": "string", "const": "last" }], "description": 'Initial value: a literal, or "last" to start from the most recent entry.' }, "record": { "type": "string", "enum": ["changed", "always"], "description": '"changed" (the default) records the value only when it was edited before Save; "always" records it on every Save, so a default like "last" is kept with each save.' }, "required": { "type": "boolean", "description": "Save waits until this has a value." }, "choices": { "type": "array", "items": { "$ref": "#/definitions/InputChoice" }, "description": "input-select only." }, "choicesFrom": { "type": "string", "description": "input-select only: take the choices from the app at runtime instead of `choices`, for lists that live in app data (e.g. wheel sets). Names a key of InputForm's `choices` prop." }, "multi": { "type": "boolean", "description": "input-select only: allow selecting several. Each selection is recorded as its own entry." }, "increment": { "type": "number", "description": "input-counter only: the amount each tap records (default 1)." }, "suggest": { "type": "boolean", "description": "input-text only: a single-line field that suggests values recorded earlier, matching what's typed." }, "suggestWith": { "type": "string", "description": "input-text with `suggest` only: another input's metric whose current value narrows the suggestions to values saved alongside it (e.g. configurations of the chosen track). Falls back to every earlier value when none were." } }, "required": ["metric"] };
|
|
@@ -7533,9 +7832,9 @@ function validate37(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
7533
7832
|
errors++;
|
|
7534
7833
|
}
|
|
7535
7834
|
}
|
|
7536
|
-
if (data.
|
|
7537
|
-
if (typeof data.
|
|
7538
|
-
const err4 = { instancePath: instancePath + "/
|
|
7835
|
+
if (data.localOnly !== void 0) {
|
|
7836
|
+
if (typeof data.localOnly !== "boolean") {
|
|
7837
|
+
const err4 = { instancePath: instancePath + "/localOnly", schemaPath: "#/properties/localOnly/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
|
|
7539
7838
|
if (vErrors === null) {
|
|
7540
7839
|
vErrors = [err4];
|
|
7541
7840
|
} else {
|
|
@@ -7544,9 +7843,9 @@ function validate37(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
7544
7843
|
errors++;
|
|
7545
7844
|
}
|
|
7546
7845
|
}
|
|
7547
|
-
if (data.
|
|
7548
|
-
if (typeof data.
|
|
7549
|
-
const err5 = { instancePath: instancePath + "/
|
|
7846
|
+
if (data.uid !== void 0) {
|
|
7847
|
+
if (typeof data.uid !== "string") {
|
|
7848
|
+
const err5 = { instancePath: instancePath + "/uid", schemaPath: "#/properties/uid/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
7550
7849
|
if (vErrors === null) {
|
|
7551
7850
|
vErrors = [err5];
|
|
7552
7851
|
} else {
|
|
@@ -7555,9 +7854,9 @@ function validate37(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
7555
7854
|
errors++;
|
|
7556
7855
|
}
|
|
7557
7856
|
}
|
|
7558
|
-
if (data.
|
|
7559
|
-
if (typeof data.
|
|
7560
|
-
const err6 = { instancePath: instancePath + "/
|
|
7857
|
+
if (data.title !== void 0) {
|
|
7858
|
+
if (typeof data.title !== "string") {
|
|
7859
|
+
const err6 = { instancePath: instancePath + "/title", schemaPath: "#/properties/title/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
7561
7860
|
if (vErrors === null) {
|
|
7562
7861
|
vErrors = [err6];
|
|
7563
7862
|
} else {
|
|
@@ -7566,209 +7865,220 @@ function validate37(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
7566
7865
|
errors++;
|
|
7567
7866
|
}
|
|
7568
7867
|
}
|
|
7868
|
+
if (data.description !== void 0) {
|
|
7869
|
+
if (typeof data.description !== "string") {
|
|
7870
|
+
const err7 = { instancePath: instancePath + "/description", schemaPath: "#/properties/description/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
7871
|
+
if (vErrors === null) {
|
|
7872
|
+
vErrors = [err7];
|
|
7873
|
+
} else {
|
|
7874
|
+
vErrors.push(err7);
|
|
7875
|
+
}
|
|
7876
|
+
errors++;
|
|
7877
|
+
}
|
|
7878
|
+
}
|
|
7569
7879
|
if (data.tags !== void 0) {
|
|
7570
|
-
let
|
|
7571
|
-
if (Array.isArray(
|
|
7572
|
-
const len0 =
|
|
7880
|
+
let data5 = data.tags;
|
|
7881
|
+
if (Array.isArray(data5)) {
|
|
7882
|
+
const len0 = data5.length;
|
|
7573
7883
|
for (let i0 = 0; i0 < len0; i0++) {
|
|
7574
|
-
if (typeof
|
|
7575
|
-
const
|
|
7884
|
+
if (typeof data5[i0] !== "string") {
|
|
7885
|
+
const err8 = { instancePath: instancePath + "/tags/" + i0, schemaPath: "#/properties/tags/items/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
7576
7886
|
if (vErrors === null) {
|
|
7577
|
-
vErrors = [
|
|
7887
|
+
vErrors = [err8];
|
|
7578
7888
|
} else {
|
|
7579
|
-
vErrors.push(
|
|
7889
|
+
vErrors.push(err8);
|
|
7580
7890
|
}
|
|
7581
7891
|
errors++;
|
|
7582
7892
|
}
|
|
7583
7893
|
}
|
|
7584
7894
|
} else {
|
|
7585
|
-
const
|
|
7895
|
+
const err9 = { instancePath: instancePath + "/tags", schemaPath: "#/properties/tags/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
7586
7896
|
if (vErrors === null) {
|
|
7587
|
-
vErrors = [
|
|
7897
|
+
vErrors = [err9];
|
|
7588
7898
|
} else {
|
|
7589
|
-
vErrors.push(
|
|
7899
|
+
vErrors.push(err9);
|
|
7590
7900
|
}
|
|
7591
7901
|
errors++;
|
|
7592
7902
|
}
|
|
7593
7903
|
}
|
|
7594
7904
|
if (data.panels !== void 0) {
|
|
7595
|
-
let
|
|
7596
|
-
if (Array.isArray(
|
|
7597
|
-
const len1 =
|
|
7905
|
+
let data7 = data.panels;
|
|
7906
|
+
if (Array.isArray(data7)) {
|
|
7907
|
+
const len1 = data7.length;
|
|
7598
7908
|
for (let i1 = 0; i1 < len1; i1++) {
|
|
7599
|
-
if (!validate18(
|
|
7909
|
+
if (!validate18(data7[i1], { instancePath: instancePath + "/panels/" + i1, parentData: data7, parentDataProperty: i1, rootData })) {
|
|
7600
7910
|
vErrors = vErrors === null ? validate18.errors : vErrors.concat(validate18.errors);
|
|
7601
7911
|
errors = vErrors.length;
|
|
7602
7912
|
}
|
|
7603
7913
|
}
|
|
7604
7914
|
} else {
|
|
7605
|
-
const
|
|
7915
|
+
const err10 = { instancePath: instancePath + "/panels", schemaPath: "#/properties/panels/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
7606
7916
|
if (vErrors === null) {
|
|
7607
|
-
vErrors = [
|
|
7917
|
+
vErrors = [err10];
|
|
7608
7918
|
} else {
|
|
7609
|
-
vErrors.push(
|
|
7919
|
+
vErrors.push(err10);
|
|
7610
7920
|
}
|
|
7611
7921
|
errors++;
|
|
7612
7922
|
}
|
|
7613
7923
|
}
|
|
7614
7924
|
if (data.templating !== void 0) {
|
|
7615
|
-
let
|
|
7616
|
-
if (
|
|
7617
|
-
if (
|
|
7618
|
-
const
|
|
7925
|
+
let data9 = data.templating;
|
|
7926
|
+
if (data9 && typeof data9 == "object" && !Array.isArray(data9)) {
|
|
7927
|
+
if (data9.list === void 0) {
|
|
7928
|
+
const err11 = { instancePath: instancePath + "/templating", schemaPath: "#/properties/templating/required", keyword: "required", params: { missingProperty: "list" }, message: "must have required property 'list'" };
|
|
7619
7929
|
if (vErrors === null) {
|
|
7620
|
-
vErrors = [
|
|
7930
|
+
vErrors = [err11];
|
|
7621
7931
|
} else {
|
|
7622
|
-
vErrors.push(
|
|
7932
|
+
vErrors.push(err11);
|
|
7623
7933
|
}
|
|
7624
7934
|
errors++;
|
|
7625
7935
|
}
|
|
7626
|
-
if (
|
|
7627
|
-
let
|
|
7628
|
-
if (Array.isArray(
|
|
7629
|
-
const len2 =
|
|
7936
|
+
if (data9.list !== void 0) {
|
|
7937
|
+
let data10 = data9.list;
|
|
7938
|
+
if (Array.isArray(data10)) {
|
|
7939
|
+
const len2 = data10.length;
|
|
7630
7940
|
for (let i2 = 0; i2 < len2; i2++) {
|
|
7631
|
-
if (!validate33(
|
|
7941
|
+
if (!validate33(data10[i2], { instancePath: instancePath + "/templating/list/" + i2, parentData: data10, parentDataProperty: i2, rootData })) {
|
|
7632
7942
|
vErrors = vErrors === null ? validate33.errors : vErrors.concat(validate33.errors);
|
|
7633
7943
|
errors = vErrors.length;
|
|
7634
7944
|
}
|
|
7635
7945
|
}
|
|
7636
7946
|
} else {
|
|
7637
|
-
const
|
|
7947
|
+
const err12 = { instancePath: instancePath + "/templating/list", schemaPath: "#/properties/templating/properties/list/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
7638
7948
|
if (vErrors === null) {
|
|
7639
|
-
vErrors = [
|
|
7949
|
+
vErrors = [err12];
|
|
7640
7950
|
} else {
|
|
7641
|
-
vErrors.push(
|
|
7951
|
+
vErrors.push(err12);
|
|
7642
7952
|
}
|
|
7643
7953
|
errors++;
|
|
7644
7954
|
}
|
|
7645
7955
|
}
|
|
7646
7956
|
} else {
|
|
7647
|
-
const
|
|
7957
|
+
const err13 = { instancePath: instancePath + "/templating", schemaPath: "#/properties/templating/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
7648
7958
|
if (vErrors === null) {
|
|
7649
|
-
vErrors = [
|
|
7959
|
+
vErrors = [err13];
|
|
7650
7960
|
} else {
|
|
7651
|
-
vErrors.push(
|
|
7961
|
+
vErrors.push(err13);
|
|
7652
7962
|
}
|
|
7653
7963
|
errors++;
|
|
7654
7964
|
}
|
|
7655
7965
|
}
|
|
7656
7966
|
if (data.time !== void 0) {
|
|
7657
|
-
let
|
|
7658
|
-
if (
|
|
7659
|
-
if (
|
|
7660
|
-
const
|
|
7967
|
+
let data12 = data.time;
|
|
7968
|
+
if (data12 && typeof data12 == "object" && !Array.isArray(data12)) {
|
|
7969
|
+
if (data12.from === void 0) {
|
|
7970
|
+
const err14 = { instancePath: instancePath + "/time", schemaPath: "#/properties/time/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
|
|
7661
7971
|
if (vErrors === null) {
|
|
7662
|
-
vErrors = [
|
|
7972
|
+
vErrors = [err14];
|
|
7663
7973
|
} else {
|
|
7664
|
-
vErrors.push(
|
|
7974
|
+
vErrors.push(err14);
|
|
7665
7975
|
}
|
|
7666
7976
|
errors++;
|
|
7667
7977
|
}
|
|
7668
|
-
if (
|
|
7669
|
-
const
|
|
7978
|
+
if (data12.to === void 0) {
|
|
7979
|
+
const err15 = { instancePath: instancePath + "/time", schemaPath: "#/properties/time/required", keyword: "required", params: { missingProperty: "to" }, message: "must have required property 'to'" };
|
|
7670
7980
|
if (vErrors === null) {
|
|
7671
|
-
vErrors = [
|
|
7981
|
+
vErrors = [err15];
|
|
7672
7982
|
} else {
|
|
7673
|
-
vErrors.push(
|
|
7983
|
+
vErrors.push(err15);
|
|
7674
7984
|
}
|
|
7675
7985
|
errors++;
|
|
7676
7986
|
}
|
|
7677
|
-
if (
|
|
7678
|
-
if (typeof
|
|
7679
|
-
const
|
|
7987
|
+
if (data12.from !== void 0) {
|
|
7988
|
+
if (typeof data12.from !== "string") {
|
|
7989
|
+
const err16 = { instancePath: instancePath + "/time/from", schemaPath: "#/properties/time/properties/from/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
7680
7990
|
if (vErrors === null) {
|
|
7681
|
-
vErrors = [
|
|
7991
|
+
vErrors = [err16];
|
|
7682
7992
|
} else {
|
|
7683
|
-
vErrors.push(
|
|
7993
|
+
vErrors.push(err16);
|
|
7684
7994
|
}
|
|
7685
7995
|
errors++;
|
|
7686
7996
|
}
|
|
7687
7997
|
}
|
|
7688
|
-
if (
|
|
7689
|
-
if (typeof
|
|
7690
|
-
const
|
|
7998
|
+
if (data12.to !== void 0) {
|
|
7999
|
+
if (typeof data12.to !== "string") {
|
|
8000
|
+
const err17 = { instancePath: instancePath + "/time/to", schemaPath: "#/properties/time/properties/to/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
7691
8001
|
if (vErrors === null) {
|
|
7692
|
-
vErrors = [
|
|
8002
|
+
vErrors = [err17];
|
|
7693
8003
|
} else {
|
|
7694
|
-
vErrors.push(
|
|
8004
|
+
vErrors.push(err17);
|
|
7695
8005
|
}
|
|
7696
8006
|
errors++;
|
|
7697
8007
|
}
|
|
7698
8008
|
}
|
|
7699
8009
|
} else {
|
|
7700
|
-
const
|
|
8010
|
+
const err18 = { instancePath: instancePath + "/time", schemaPath: "#/properties/time/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
7701
8011
|
if (vErrors === null) {
|
|
7702
|
-
vErrors = [
|
|
8012
|
+
vErrors = [err18];
|
|
7703
8013
|
} else {
|
|
7704
|
-
vErrors.push(
|
|
8014
|
+
vErrors.push(err18);
|
|
7705
8015
|
}
|
|
7706
8016
|
errors++;
|
|
7707
8017
|
}
|
|
7708
8018
|
}
|
|
7709
8019
|
if (data.timezone !== void 0) {
|
|
7710
8020
|
if (typeof data.timezone !== "string") {
|
|
7711
|
-
const
|
|
8021
|
+
const err19 = { instancePath: instancePath + "/timezone", schemaPath: "#/properties/timezone/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
7712
8022
|
if (vErrors === null) {
|
|
7713
|
-
vErrors = [
|
|
8023
|
+
vErrors = [err19];
|
|
7714
8024
|
} else {
|
|
7715
|
-
vErrors.push(
|
|
8025
|
+
vErrors.push(err19);
|
|
7716
8026
|
}
|
|
7717
8027
|
errors++;
|
|
7718
8028
|
}
|
|
7719
8029
|
}
|
|
7720
8030
|
if (data.refresh !== void 0) {
|
|
7721
|
-
let
|
|
7722
|
-
const
|
|
8031
|
+
let data16 = data.refresh;
|
|
8032
|
+
const _errs33 = errors;
|
|
7723
8033
|
let valid10 = false;
|
|
7724
|
-
const
|
|
7725
|
-
if (typeof
|
|
7726
|
-
const
|
|
8034
|
+
const _errs34 = errors;
|
|
8035
|
+
if (typeof data16 !== "string") {
|
|
8036
|
+
const err20 = { instancePath: instancePath + "/refresh", schemaPath: "#/properties/refresh/anyOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
7727
8037
|
if (vErrors === null) {
|
|
7728
|
-
vErrors = [
|
|
8038
|
+
vErrors = [err20];
|
|
7729
8039
|
} else {
|
|
7730
|
-
vErrors.push(
|
|
8040
|
+
vErrors.push(err20);
|
|
7731
8041
|
}
|
|
7732
8042
|
errors++;
|
|
7733
8043
|
}
|
|
7734
|
-
var _valid0 =
|
|
8044
|
+
var _valid0 = _errs34 === errors;
|
|
7735
8045
|
valid10 = valid10 || _valid0;
|
|
7736
8046
|
if (!valid10) {
|
|
7737
|
-
const
|
|
7738
|
-
if (typeof
|
|
7739
|
-
const
|
|
8047
|
+
const _errs36 = errors;
|
|
8048
|
+
if (typeof data16 !== "boolean") {
|
|
8049
|
+
const err21 = { instancePath: instancePath + "/refresh", schemaPath: "#/properties/refresh/anyOf/1/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
|
|
7740
8050
|
if (vErrors === null) {
|
|
7741
|
-
vErrors = [
|
|
8051
|
+
vErrors = [err21];
|
|
7742
8052
|
} else {
|
|
7743
|
-
vErrors.push(
|
|
8053
|
+
vErrors.push(err21);
|
|
7744
8054
|
}
|
|
7745
8055
|
errors++;
|
|
7746
8056
|
}
|
|
7747
|
-
if (false !==
|
|
7748
|
-
const
|
|
8057
|
+
if (false !== data16) {
|
|
8058
|
+
const err22 = { instancePath: instancePath + "/refresh", schemaPath: "#/properties/refresh/anyOf/1/const", keyword: "const", params: { allowedValue: false }, message: "must be equal to constant" };
|
|
7749
8059
|
if (vErrors === null) {
|
|
7750
|
-
vErrors = [
|
|
8060
|
+
vErrors = [err22];
|
|
7751
8061
|
} else {
|
|
7752
|
-
vErrors.push(
|
|
8062
|
+
vErrors.push(err22);
|
|
7753
8063
|
}
|
|
7754
8064
|
errors++;
|
|
7755
8065
|
}
|
|
7756
|
-
var _valid0 =
|
|
8066
|
+
var _valid0 = _errs36 === errors;
|
|
7757
8067
|
valid10 = valid10 || _valid0;
|
|
7758
8068
|
}
|
|
7759
8069
|
if (!valid10) {
|
|
7760
|
-
const
|
|
8070
|
+
const err23 = { instancePath: instancePath + "/refresh", schemaPath: "#/properties/refresh/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
7761
8071
|
if (vErrors === null) {
|
|
7762
|
-
vErrors = [
|
|
8072
|
+
vErrors = [err23];
|
|
7763
8073
|
} else {
|
|
7764
|
-
vErrors.push(
|
|
8074
|
+
vErrors.push(err23);
|
|
7765
8075
|
}
|
|
7766
8076
|
errors++;
|
|
7767
8077
|
} else {
|
|
7768
|
-
errors =
|
|
8078
|
+
errors = _errs33;
|
|
7769
8079
|
if (vErrors !== null) {
|
|
7770
|
-
if (
|
|
7771
|
-
vErrors.length =
|
|
8080
|
+
if (_errs33) {
|
|
8081
|
+
vErrors.length = _errs33;
|
|
7772
8082
|
} else {
|
|
7773
8083
|
vErrors = null;
|
|
7774
8084
|
}
|
|
@@ -7776,89 +8086,89 @@ function validate37(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
7776
8086
|
}
|
|
7777
8087
|
}
|
|
7778
8088
|
if (data.__inputs !== void 0) {
|
|
7779
|
-
let
|
|
7780
|
-
if (Array.isArray(
|
|
7781
|
-
const len3 =
|
|
8089
|
+
let data17 = data.__inputs;
|
|
8090
|
+
if (Array.isArray(data17)) {
|
|
8091
|
+
const len3 = data17.length;
|
|
7782
8092
|
for (let i3 = 0; i3 < len3; i3++) {
|
|
7783
|
-
let
|
|
7784
|
-
if (
|
|
7785
|
-
if (
|
|
7786
|
-
const
|
|
8093
|
+
let data18 = data17[i3];
|
|
8094
|
+
if (data18 && typeof data18 == "object" && !Array.isArray(data18)) {
|
|
8095
|
+
if (data18.name === void 0) {
|
|
8096
|
+
const err24 = { instancePath: instancePath + "/__inputs/" + i3, schemaPath: "#/properties/__inputs/items/required", keyword: "required", params: { missingProperty: "name" }, message: "must have required property 'name'" };
|
|
7787
8097
|
if (vErrors === null) {
|
|
7788
|
-
vErrors = [
|
|
8098
|
+
vErrors = [err24];
|
|
7789
8099
|
} else {
|
|
7790
|
-
vErrors.push(
|
|
8100
|
+
vErrors.push(err24);
|
|
7791
8101
|
}
|
|
7792
8102
|
errors++;
|
|
7793
8103
|
}
|
|
7794
|
-
if (
|
|
7795
|
-
const
|
|
8104
|
+
if (data18.type === void 0) {
|
|
8105
|
+
const err25 = { instancePath: instancePath + "/__inputs/" + i3, schemaPath: "#/properties/__inputs/items/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
7796
8106
|
if (vErrors === null) {
|
|
7797
|
-
vErrors = [
|
|
8107
|
+
vErrors = [err25];
|
|
7798
8108
|
} else {
|
|
7799
|
-
vErrors.push(
|
|
8109
|
+
vErrors.push(err25);
|
|
7800
8110
|
}
|
|
7801
8111
|
errors++;
|
|
7802
8112
|
}
|
|
7803
|
-
if (
|
|
7804
|
-
if (typeof
|
|
7805
|
-
const
|
|
8113
|
+
if (data18.name !== void 0) {
|
|
8114
|
+
if (typeof data18.name !== "string") {
|
|
8115
|
+
const err26 = { instancePath: instancePath + "/__inputs/" + i3 + "/name", schemaPath: "#/properties/__inputs/items/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
7806
8116
|
if (vErrors === null) {
|
|
7807
|
-
vErrors = [
|
|
8117
|
+
vErrors = [err26];
|
|
7808
8118
|
} else {
|
|
7809
|
-
vErrors.push(
|
|
8119
|
+
vErrors.push(err26);
|
|
7810
8120
|
}
|
|
7811
8121
|
errors++;
|
|
7812
8122
|
}
|
|
7813
8123
|
}
|
|
7814
|
-
if (
|
|
7815
|
-
if (typeof
|
|
7816
|
-
const
|
|
8124
|
+
if (data18.type !== void 0) {
|
|
8125
|
+
if (typeof data18.type !== "string") {
|
|
8126
|
+
const err27 = { instancePath: instancePath + "/__inputs/" + i3 + "/type", schemaPath: "#/properties/__inputs/items/properties/type/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
7817
8127
|
if (vErrors === null) {
|
|
7818
|
-
vErrors = [
|
|
8128
|
+
vErrors = [err27];
|
|
7819
8129
|
} else {
|
|
7820
|
-
vErrors.push(
|
|
8130
|
+
vErrors.push(err27);
|
|
7821
8131
|
}
|
|
7822
8132
|
errors++;
|
|
7823
8133
|
}
|
|
7824
8134
|
}
|
|
7825
|
-
if (
|
|
7826
|
-
if (typeof
|
|
7827
|
-
const
|
|
8135
|
+
if (data18.pluginId !== void 0) {
|
|
8136
|
+
if (typeof data18.pluginId !== "string") {
|
|
8137
|
+
const err28 = { instancePath: instancePath + "/__inputs/" + i3 + "/pluginId", schemaPath: "#/properties/__inputs/items/properties/pluginId/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
7828
8138
|
if (vErrors === null) {
|
|
7829
|
-
vErrors = [
|
|
8139
|
+
vErrors = [err28];
|
|
7830
8140
|
} else {
|
|
7831
|
-
vErrors.push(
|
|
8141
|
+
vErrors.push(err28);
|
|
7832
8142
|
}
|
|
7833
8143
|
errors++;
|
|
7834
8144
|
}
|
|
7835
8145
|
}
|
|
7836
8146
|
} else {
|
|
7837
|
-
const
|
|
8147
|
+
const err29 = { instancePath: instancePath + "/__inputs/" + i3, schemaPath: "#/properties/__inputs/items/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
7838
8148
|
if (vErrors === null) {
|
|
7839
|
-
vErrors = [
|
|
8149
|
+
vErrors = [err29];
|
|
7840
8150
|
} else {
|
|
7841
|
-
vErrors.push(
|
|
8151
|
+
vErrors.push(err29);
|
|
7842
8152
|
}
|
|
7843
8153
|
errors++;
|
|
7844
8154
|
}
|
|
7845
8155
|
}
|
|
7846
8156
|
} else {
|
|
7847
|
-
const
|
|
8157
|
+
const err30 = { instancePath: instancePath + "/__inputs", schemaPath: "#/properties/__inputs/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
7848
8158
|
if (vErrors === null) {
|
|
7849
|
-
vErrors = [
|
|
8159
|
+
vErrors = [err30];
|
|
7850
8160
|
} else {
|
|
7851
|
-
vErrors.push(
|
|
8161
|
+
vErrors.push(err30);
|
|
7852
8162
|
}
|
|
7853
8163
|
errors++;
|
|
7854
8164
|
}
|
|
7855
8165
|
}
|
|
7856
8166
|
} else {
|
|
7857
|
-
const
|
|
8167
|
+
const err31 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
7858
8168
|
if (vErrors === null) {
|
|
7859
|
-
vErrors = [
|
|
8169
|
+
vErrors = [err31];
|
|
7860
8170
|
} else {
|
|
7861
|
-
vErrors.push(
|
|
8171
|
+
vErrors.push(err31);
|
|
7862
8172
|
}
|
|
7863
8173
|
errors++;
|
|
7864
8174
|
}
|
|
@@ -8125,9 +8435,9 @@ function validate17(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
8125
8435
|
errors++;
|
|
8126
8436
|
}
|
|
8127
8437
|
}
|
|
8128
|
-
if (data.
|
|
8129
|
-
if (typeof data.
|
|
8130
|
-
const err4 = { instancePath: instancePath + "/
|
|
8438
|
+
if (data.localOnly !== void 0) {
|
|
8439
|
+
if (typeof data.localOnly !== "boolean") {
|
|
8440
|
+
const err4 = { instancePath: instancePath + "/localOnly", schemaPath: "#/properties/localOnly/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
|
|
8131
8441
|
if (vErrors === null) {
|
|
8132
8442
|
vErrors = [err4];
|
|
8133
8443
|
} else {
|
|
@@ -8136,9 +8446,9 @@ function validate17(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
8136
8446
|
errors++;
|
|
8137
8447
|
}
|
|
8138
8448
|
}
|
|
8139
|
-
if (data.
|
|
8140
|
-
if (typeof data.
|
|
8141
|
-
const err5 = { instancePath: instancePath + "/
|
|
8449
|
+
if (data.uid !== void 0) {
|
|
8450
|
+
if (typeof data.uid !== "string") {
|
|
8451
|
+
const err5 = { instancePath: instancePath + "/uid", schemaPath: "#/properties/uid/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
8142
8452
|
if (vErrors === null) {
|
|
8143
8453
|
vErrors = [err5];
|
|
8144
8454
|
} else {
|
|
@@ -8147,9 +8457,9 @@ function validate17(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
8147
8457
|
errors++;
|
|
8148
8458
|
}
|
|
8149
8459
|
}
|
|
8150
|
-
if (data.
|
|
8151
|
-
if (typeof data.
|
|
8152
|
-
const err6 = { instancePath: instancePath + "/
|
|
8460
|
+
if (data.title !== void 0) {
|
|
8461
|
+
if (typeof data.title !== "string") {
|
|
8462
|
+
const err6 = { instancePath: instancePath + "/title", schemaPath: "#/properties/title/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
8153
8463
|
if (vErrors === null) {
|
|
8154
8464
|
vErrors = [err6];
|
|
8155
8465
|
} else {
|
|
@@ -8158,209 +8468,220 @@ function validate17(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
8158
8468
|
errors++;
|
|
8159
8469
|
}
|
|
8160
8470
|
}
|
|
8471
|
+
if (data.description !== void 0) {
|
|
8472
|
+
if (typeof data.description !== "string") {
|
|
8473
|
+
const err7 = { instancePath: instancePath + "/description", schemaPath: "#/properties/description/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
8474
|
+
if (vErrors === null) {
|
|
8475
|
+
vErrors = [err7];
|
|
8476
|
+
} else {
|
|
8477
|
+
vErrors.push(err7);
|
|
8478
|
+
}
|
|
8479
|
+
errors++;
|
|
8480
|
+
}
|
|
8481
|
+
}
|
|
8161
8482
|
if (data.tags !== void 0) {
|
|
8162
|
-
let
|
|
8163
|
-
if (Array.isArray(
|
|
8164
|
-
const len0 =
|
|
8483
|
+
let data5 = data.tags;
|
|
8484
|
+
if (Array.isArray(data5)) {
|
|
8485
|
+
const len0 = data5.length;
|
|
8165
8486
|
for (let i0 = 0; i0 < len0; i0++) {
|
|
8166
|
-
if (typeof
|
|
8167
|
-
const
|
|
8487
|
+
if (typeof data5[i0] !== "string") {
|
|
8488
|
+
const err8 = { instancePath: instancePath + "/tags/" + i0, schemaPath: "#/properties/tags/items/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
8168
8489
|
if (vErrors === null) {
|
|
8169
|
-
vErrors = [
|
|
8490
|
+
vErrors = [err8];
|
|
8170
8491
|
} else {
|
|
8171
|
-
vErrors.push(
|
|
8492
|
+
vErrors.push(err8);
|
|
8172
8493
|
}
|
|
8173
8494
|
errors++;
|
|
8174
8495
|
}
|
|
8175
8496
|
}
|
|
8176
8497
|
} else {
|
|
8177
|
-
const
|
|
8498
|
+
const err9 = { instancePath: instancePath + "/tags", schemaPath: "#/properties/tags/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
8178
8499
|
if (vErrors === null) {
|
|
8179
|
-
vErrors = [
|
|
8500
|
+
vErrors = [err9];
|
|
8180
8501
|
} else {
|
|
8181
|
-
vErrors.push(
|
|
8502
|
+
vErrors.push(err9);
|
|
8182
8503
|
}
|
|
8183
8504
|
errors++;
|
|
8184
8505
|
}
|
|
8185
8506
|
}
|
|
8186
8507
|
if (data.panels !== void 0) {
|
|
8187
|
-
let
|
|
8188
|
-
if (Array.isArray(
|
|
8189
|
-
const len1 =
|
|
8508
|
+
let data7 = data.panels;
|
|
8509
|
+
if (Array.isArray(data7)) {
|
|
8510
|
+
const len1 = data7.length;
|
|
8190
8511
|
for (let i1 = 0; i1 < len1; i1++) {
|
|
8191
|
-
if (!validate18(
|
|
8512
|
+
if (!validate18(data7[i1], { instancePath: instancePath + "/panels/" + i1, parentData: data7, parentDataProperty: i1, rootData })) {
|
|
8192
8513
|
vErrors = vErrors === null ? validate18.errors : vErrors.concat(validate18.errors);
|
|
8193
8514
|
errors = vErrors.length;
|
|
8194
8515
|
}
|
|
8195
8516
|
}
|
|
8196
8517
|
} else {
|
|
8197
|
-
const
|
|
8518
|
+
const err10 = { instancePath: instancePath + "/panels", schemaPath: "#/properties/panels/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
8198
8519
|
if (vErrors === null) {
|
|
8199
|
-
vErrors = [
|
|
8520
|
+
vErrors = [err10];
|
|
8200
8521
|
} else {
|
|
8201
|
-
vErrors.push(
|
|
8522
|
+
vErrors.push(err10);
|
|
8202
8523
|
}
|
|
8203
8524
|
errors++;
|
|
8204
8525
|
}
|
|
8205
8526
|
}
|
|
8206
8527
|
if (data.templating !== void 0) {
|
|
8207
|
-
let
|
|
8208
|
-
if (
|
|
8209
|
-
if (
|
|
8210
|
-
const
|
|
8528
|
+
let data9 = data.templating;
|
|
8529
|
+
if (data9 && typeof data9 == "object" && !Array.isArray(data9)) {
|
|
8530
|
+
if (data9.list === void 0) {
|
|
8531
|
+
const err11 = { instancePath: instancePath + "/templating", schemaPath: "#/properties/templating/required", keyword: "required", params: { missingProperty: "list" }, message: "must have required property 'list'" };
|
|
8211
8532
|
if (vErrors === null) {
|
|
8212
|
-
vErrors = [
|
|
8533
|
+
vErrors = [err11];
|
|
8213
8534
|
} else {
|
|
8214
|
-
vErrors.push(
|
|
8535
|
+
vErrors.push(err11);
|
|
8215
8536
|
}
|
|
8216
8537
|
errors++;
|
|
8217
8538
|
}
|
|
8218
|
-
if (
|
|
8219
|
-
let
|
|
8220
|
-
if (Array.isArray(
|
|
8221
|
-
const len2 =
|
|
8539
|
+
if (data9.list !== void 0) {
|
|
8540
|
+
let data10 = data9.list;
|
|
8541
|
+
if (Array.isArray(data10)) {
|
|
8542
|
+
const len2 = data10.length;
|
|
8222
8543
|
for (let i2 = 0; i2 < len2; i2++) {
|
|
8223
|
-
if (!validate33(
|
|
8544
|
+
if (!validate33(data10[i2], { instancePath: instancePath + "/templating/list/" + i2, parentData: data10, parentDataProperty: i2, rootData })) {
|
|
8224
8545
|
vErrors = vErrors === null ? validate33.errors : vErrors.concat(validate33.errors);
|
|
8225
8546
|
errors = vErrors.length;
|
|
8226
8547
|
}
|
|
8227
8548
|
}
|
|
8228
8549
|
} else {
|
|
8229
|
-
const
|
|
8550
|
+
const err12 = { instancePath: instancePath + "/templating/list", schemaPath: "#/properties/templating/properties/list/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
8230
8551
|
if (vErrors === null) {
|
|
8231
|
-
vErrors = [
|
|
8552
|
+
vErrors = [err12];
|
|
8232
8553
|
} else {
|
|
8233
|
-
vErrors.push(
|
|
8554
|
+
vErrors.push(err12);
|
|
8234
8555
|
}
|
|
8235
8556
|
errors++;
|
|
8236
8557
|
}
|
|
8237
8558
|
}
|
|
8238
8559
|
} else {
|
|
8239
|
-
const
|
|
8560
|
+
const err13 = { instancePath: instancePath + "/templating", schemaPath: "#/properties/templating/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
8240
8561
|
if (vErrors === null) {
|
|
8241
|
-
vErrors = [
|
|
8562
|
+
vErrors = [err13];
|
|
8242
8563
|
} else {
|
|
8243
|
-
vErrors.push(
|
|
8564
|
+
vErrors.push(err13);
|
|
8244
8565
|
}
|
|
8245
8566
|
errors++;
|
|
8246
8567
|
}
|
|
8247
8568
|
}
|
|
8248
8569
|
if (data.time !== void 0) {
|
|
8249
|
-
let
|
|
8250
|
-
if (
|
|
8251
|
-
if (
|
|
8252
|
-
const
|
|
8570
|
+
let data12 = data.time;
|
|
8571
|
+
if (data12 && typeof data12 == "object" && !Array.isArray(data12)) {
|
|
8572
|
+
if (data12.from === void 0) {
|
|
8573
|
+
const err14 = { instancePath: instancePath + "/time", schemaPath: "#/properties/time/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
|
|
8253
8574
|
if (vErrors === null) {
|
|
8254
|
-
vErrors = [
|
|
8575
|
+
vErrors = [err14];
|
|
8255
8576
|
} else {
|
|
8256
|
-
vErrors.push(
|
|
8577
|
+
vErrors.push(err14);
|
|
8257
8578
|
}
|
|
8258
8579
|
errors++;
|
|
8259
8580
|
}
|
|
8260
|
-
if (
|
|
8261
|
-
const
|
|
8581
|
+
if (data12.to === void 0) {
|
|
8582
|
+
const err15 = { instancePath: instancePath + "/time", schemaPath: "#/properties/time/required", keyword: "required", params: { missingProperty: "to" }, message: "must have required property 'to'" };
|
|
8262
8583
|
if (vErrors === null) {
|
|
8263
|
-
vErrors = [
|
|
8584
|
+
vErrors = [err15];
|
|
8264
8585
|
} else {
|
|
8265
|
-
vErrors.push(
|
|
8586
|
+
vErrors.push(err15);
|
|
8266
8587
|
}
|
|
8267
8588
|
errors++;
|
|
8268
8589
|
}
|
|
8269
|
-
if (
|
|
8270
|
-
if (typeof
|
|
8271
|
-
const
|
|
8590
|
+
if (data12.from !== void 0) {
|
|
8591
|
+
if (typeof data12.from !== "string") {
|
|
8592
|
+
const err16 = { instancePath: instancePath + "/time/from", schemaPath: "#/properties/time/properties/from/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
8272
8593
|
if (vErrors === null) {
|
|
8273
|
-
vErrors = [
|
|
8594
|
+
vErrors = [err16];
|
|
8274
8595
|
} else {
|
|
8275
|
-
vErrors.push(
|
|
8596
|
+
vErrors.push(err16);
|
|
8276
8597
|
}
|
|
8277
8598
|
errors++;
|
|
8278
8599
|
}
|
|
8279
8600
|
}
|
|
8280
|
-
if (
|
|
8281
|
-
if (typeof
|
|
8282
|
-
const
|
|
8601
|
+
if (data12.to !== void 0) {
|
|
8602
|
+
if (typeof data12.to !== "string") {
|
|
8603
|
+
const err17 = { instancePath: instancePath + "/time/to", schemaPath: "#/properties/time/properties/to/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
8283
8604
|
if (vErrors === null) {
|
|
8284
|
-
vErrors = [
|
|
8605
|
+
vErrors = [err17];
|
|
8285
8606
|
} else {
|
|
8286
|
-
vErrors.push(
|
|
8607
|
+
vErrors.push(err17);
|
|
8287
8608
|
}
|
|
8288
8609
|
errors++;
|
|
8289
8610
|
}
|
|
8290
8611
|
}
|
|
8291
8612
|
} else {
|
|
8292
|
-
const
|
|
8613
|
+
const err18 = { instancePath: instancePath + "/time", schemaPath: "#/properties/time/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
8293
8614
|
if (vErrors === null) {
|
|
8294
|
-
vErrors = [
|
|
8615
|
+
vErrors = [err18];
|
|
8295
8616
|
} else {
|
|
8296
|
-
vErrors.push(
|
|
8617
|
+
vErrors.push(err18);
|
|
8297
8618
|
}
|
|
8298
8619
|
errors++;
|
|
8299
8620
|
}
|
|
8300
8621
|
}
|
|
8301
8622
|
if (data.timezone !== void 0) {
|
|
8302
8623
|
if (typeof data.timezone !== "string") {
|
|
8303
|
-
const
|
|
8624
|
+
const err19 = { instancePath: instancePath + "/timezone", schemaPath: "#/properties/timezone/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
8304
8625
|
if (vErrors === null) {
|
|
8305
|
-
vErrors = [
|
|
8626
|
+
vErrors = [err19];
|
|
8306
8627
|
} else {
|
|
8307
|
-
vErrors.push(
|
|
8628
|
+
vErrors.push(err19);
|
|
8308
8629
|
}
|
|
8309
8630
|
errors++;
|
|
8310
8631
|
}
|
|
8311
8632
|
}
|
|
8312
8633
|
if (data.refresh !== void 0) {
|
|
8313
|
-
let
|
|
8314
|
-
const
|
|
8634
|
+
let data16 = data.refresh;
|
|
8635
|
+
const _errs33 = errors;
|
|
8315
8636
|
let valid10 = false;
|
|
8316
|
-
const
|
|
8317
|
-
if (typeof
|
|
8318
|
-
const
|
|
8637
|
+
const _errs34 = errors;
|
|
8638
|
+
if (typeof data16 !== "string") {
|
|
8639
|
+
const err20 = { instancePath: instancePath + "/refresh", schemaPath: "#/properties/refresh/anyOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
8319
8640
|
if (vErrors === null) {
|
|
8320
|
-
vErrors = [
|
|
8641
|
+
vErrors = [err20];
|
|
8321
8642
|
} else {
|
|
8322
|
-
vErrors.push(
|
|
8643
|
+
vErrors.push(err20);
|
|
8323
8644
|
}
|
|
8324
8645
|
errors++;
|
|
8325
8646
|
}
|
|
8326
|
-
var _valid0 =
|
|
8647
|
+
var _valid0 = _errs34 === errors;
|
|
8327
8648
|
valid10 = valid10 || _valid0;
|
|
8328
8649
|
if (!valid10) {
|
|
8329
|
-
const
|
|
8330
|
-
if (typeof
|
|
8331
|
-
const
|
|
8650
|
+
const _errs36 = errors;
|
|
8651
|
+
if (typeof data16 !== "boolean") {
|
|
8652
|
+
const err21 = { instancePath: instancePath + "/refresh", schemaPath: "#/properties/refresh/anyOf/1/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" };
|
|
8332
8653
|
if (vErrors === null) {
|
|
8333
|
-
vErrors = [
|
|
8654
|
+
vErrors = [err21];
|
|
8334
8655
|
} else {
|
|
8335
|
-
vErrors.push(
|
|
8656
|
+
vErrors.push(err21);
|
|
8336
8657
|
}
|
|
8337
8658
|
errors++;
|
|
8338
8659
|
}
|
|
8339
|
-
if (false !==
|
|
8340
|
-
const
|
|
8660
|
+
if (false !== data16) {
|
|
8661
|
+
const err22 = { instancePath: instancePath + "/refresh", schemaPath: "#/properties/refresh/anyOf/1/const", keyword: "const", params: { allowedValue: false }, message: "must be equal to constant" };
|
|
8341
8662
|
if (vErrors === null) {
|
|
8342
|
-
vErrors = [
|
|
8663
|
+
vErrors = [err22];
|
|
8343
8664
|
} else {
|
|
8344
|
-
vErrors.push(
|
|
8665
|
+
vErrors.push(err22);
|
|
8345
8666
|
}
|
|
8346
8667
|
errors++;
|
|
8347
8668
|
}
|
|
8348
|
-
var _valid0 =
|
|
8669
|
+
var _valid0 = _errs36 === errors;
|
|
8349
8670
|
valid10 = valid10 || _valid0;
|
|
8350
8671
|
}
|
|
8351
8672
|
if (!valid10) {
|
|
8352
|
-
const
|
|
8673
|
+
const err23 = { instancePath: instancePath + "/refresh", schemaPath: "#/properties/refresh/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
8353
8674
|
if (vErrors === null) {
|
|
8354
|
-
vErrors = [
|
|
8675
|
+
vErrors = [err23];
|
|
8355
8676
|
} else {
|
|
8356
|
-
vErrors.push(
|
|
8677
|
+
vErrors.push(err23);
|
|
8357
8678
|
}
|
|
8358
8679
|
errors++;
|
|
8359
8680
|
} else {
|
|
8360
|
-
errors =
|
|
8681
|
+
errors = _errs33;
|
|
8361
8682
|
if (vErrors !== null) {
|
|
8362
|
-
if (
|
|
8363
|
-
vErrors.length =
|
|
8683
|
+
if (_errs33) {
|
|
8684
|
+
vErrors.length = _errs33;
|
|
8364
8685
|
} else {
|
|
8365
8686
|
vErrors = null;
|
|
8366
8687
|
}
|
|
@@ -8368,89 +8689,89 @@ function validate17(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
8368
8689
|
}
|
|
8369
8690
|
}
|
|
8370
8691
|
if (data.__inputs !== void 0) {
|
|
8371
|
-
let
|
|
8372
|
-
if (Array.isArray(
|
|
8373
|
-
const len3 =
|
|
8692
|
+
let data17 = data.__inputs;
|
|
8693
|
+
if (Array.isArray(data17)) {
|
|
8694
|
+
const len3 = data17.length;
|
|
8374
8695
|
for (let i3 = 0; i3 < len3; i3++) {
|
|
8375
|
-
let
|
|
8376
|
-
if (
|
|
8377
|
-
if (
|
|
8378
|
-
const
|
|
8696
|
+
let data18 = data17[i3];
|
|
8697
|
+
if (data18 && typeof data18 == "object" && !Array.isArray(data18)) {
|
|
8698
|
+
if (data18.name === void 0) {
|
|
8699
|
+
const err24 = { instancePath: instancePath + "/__inputs/" + i3, schemaPath: "#/properties/__inputs/items/required", keyword: "required", params: { missingProperty: "name" }, message: "must have required property 'name'" };
|
|
8379
8700
|
if (vErrors === null) {
|
|
8380
|
-
vErrors = [
|
|
8701
|
+
vErrors = [err24];
|
|
8381
8702
|
} else {
|
|
8382
|
-
vErrors.push(
|
|
8703
|
+
vErrors.push(err24);
|
|
8383
8704
|
}
|
|
8384
8705
|
errors++;
|
|
8385
8706
|
}
|
|
8386
|
-
if (
|
|
8387
|
-
const
|
|
8707
|
+
if (data18.type === void 0) {
|
|
8708
|
+
const err25 = { instancePath: instancePath + "/__inputs/" + i3, schemaPath: "#/properties/__inputs/items/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
8388
8709
|
if (vErrors === null) {
|
|
8389
|
-
vErrors = [
|
|
8710
|
+
vErrors = [err25];
|
|
8390
8711
|
} else {
|
|
8391
|
-
vErrors.push(
|
|
8712
|
+
vErrors.push(err25);
|
|
8392
8713
|
}
|
|
8393
8714
|
errors++;
|
|
8394
8715
|
}
|
|
8395
|
-
if (
|
|
8396
|
-
if (typeof
|
|
8397
|
-
const
|
|
8716
|
+
if (data18.name !== void 0) {
|
|
8717
|
+
if (typeof data18.name !== "string") {
|
|
8718
|
+
const err26 = { instancePath: instancePath + "/__inputs/" + i3 + "/name", schemaPath: "#/properties/__inputs/items/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
8398
8719
|
if (vErrors === null) {
|
|
8399
|
-
vErrors = [
|
|
8720
|
+
vErrors = [err26];
|
|
8400
8721
|
} else {
|
|
8401
|
-
vErrors.push(
|
|
8722
|
+
vErrors.push(err26);
|
|
8402
8723
|
}
|
|
8403
8724
|
errors++;
|
|
8404
8725
|
}
|
|
8405
8726
|
}
|
|
8406
|
-
if (
|
|
8407
|
-
if (typeof
|
|
8408
|
-
const
|
|
8727
|
+
if (data18.type !== void 0) {
|
|
8728
|
+
if (typeof data18.type !== "string") {
|
|
8729
|
+
const err27 = { instancePath: instancePath + "/__inputs/" + i3 + "/type", schemaPath: "#/properties/__inputs/items/properties/type/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
8409
8730
|
if (vErrors === null) {
|
|
8410
|
-
vErrors = [
|
|
8731
|
+
vErrors = [err27];
|
|
8411
8732
|
} else {
|
|
8412
|
-
vErrors.push(
|
|
8733
|
+
vErrors.push(err27);
|
|
8413
8734
|
}
|
|
8414
8735
|
errors++;
|
|
8415
8736
|
}
|
|
8416
8737
|
}
|
|
8417
|
-
if (
|
|
8418
|
-
if (typeof
|
|
8419
|
-
const
|
|
8738
|
+
if (data18.pluginId !== void 0) {
|
|
8739
|
+
if (typeof data18.pluginId !== "string") {
|
|
8740
|
+
const err28 = { instancePath: instancePath + "/__inputs/" + i3 + "/pluginId", schemaPath: "#/properties/__inputs/items/properties/pluginId/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
8420
8741
|
if (vErrors === null) {
|
|
8421
|
-
vErrors = [
|
|
8742
|
+
vErrors = [err28];
|
|
8422
8743
|
} else {
|
|
8423
|
-
vErrors.push(
|
|
8744
|
+
vErrors.push(err28);
|
|
8424
8745
|
}
|
|
8425
8746
|
errors++;
|
|
8426
8747
|
}
|
|
8427
8748
|
}
|
|
8428
8749
|
} else {
|
|
8429
|
-
const
|
|
8750
|
+
const err29 = { instancePath: instancePath + "/__inputs/" + i3, schemaPath: "#/properties/__inputs/items/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
8430
8751
|
if (vErrors === null) {
|
|
8431
|
-
vErrors = [
|
|
8752
|
+
vErrors = [err29];
|
|
8432
8753
|
} else {
|
|
8433
|
-
vErrors.push(
|
|
8754
|
+
vErrors.push(err29);
|
|
8434
8755
|
}
|
|
8435
8756
|
errors++;
|
|
8436
8757
|
}
|
|
8437
8758
|
}
|
|
8438
8759
|
} else {
|
|
8439
|
-
const
|
|
8760
|
+
const err30 = { instancePath: instancePath + "/__inputs", schemaPath: "#/properties/__inputs/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
8440
8761
|
if (vErrors === null) {
|
|
8441
|
-
vErrors = [
|
|
8762
|
+
vErrors = [err30];
|
|
8442
8763
|
} else {
|
|
8443
|
-
vErrors.push(
|
|
8764
|
+
vErrors.push(err30);
|
|
8444
8765
|
}
|
|
8445
8766
|
errors++;
|
|
8446
8767
|
}
|
|
8447
8768
|
}
|
|
8448
8769
|
} else {
|
|
8449
|
-
const
|
|
8770
|
+
const err31 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
8450
8771
|
if (vErrors === null) {
|
|
8451
|
-
vErrors = [
|
|
8772
|
+
vErrors = [err31];
|
|
8452
8773
|
} else {
|
|
8453
|
-
vErrors.push(
|
|
8774
|
+
vErrors.push(err31);
|
|
8454
8775
|
}
|
|
8455
8776
|
errors++;
|
|
8456
8777
|
}
|
|
@@ -8573,7 +8894,7 @@ function removeAt(root, pointer) {
|
|
|
8573
8894
|
const segs = pointer.split("/").slice(1).map((s) => s.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
8574
8895
|
const last = segs.pop();
|
|
8575
8896
|
let parent = root;
|
|
8576
|
-
for (const s of segs) parent = _optionalChain([parent, 'optionalAccess',
|
|
8897
|
+
for (const s of segs) parent = _optionalChain([parent, 'optionalAccess', _205 => _205[s]]);
|
|
8577
8898
|
if (Array.isArray(parent)) {
|
|
8578
8899
|
parent.splice(Number(last), 1);
|
|
8579
8900
|
return { array: parentOf(pointer), index: Number(last) };
|
|
@@ -8585,7 +8906,7 @@ function cleanDashboard(json) {
|
|
|
8585
8906
|
const value = structuredClone(json);
|
|
8586
8907
|
const removed = [];
|
|
8587
8908
|
const deletedKeys = /* @__PURE__ */ new Set();
|
|
8588
|
-
for (let
|
|
8909
|
+
for (let round2 = 0; round2 < 10 && !validateDashboard(value); round2++) {
|
|
8589
8910
|
const errors = collapseUnions((_nullishCoalesce(validateDashboard.errors, () => ( []))).filter((e) => !noise(e)));
|
|
8590
8911
|
const targets = /* @__PURE__ */ new Map();
|
|
8591
8912
|
for (const e of errors) {
|
|
@@ -8746,7 +9067,7 @@ var STANDARD = [
|
|
|
8746
9067
|
]
|
|
8747
9068
|
}
|
|
8748
9069
|
},
|
|
8749
|
-
{ path: field("color.fixedColor"), label: "Color", category: "Standard options", control: { kind: "color" }, showIf: (p) => _optionalChain([p, 'access',
|
|
9070
|
+
{ path: field("color.fixedColor"), label: "Color", category: "Standard options", control: { kind: "color" }, showIf: (p) => _optionalChain([p, 'access', _206 => _206.fieldConfig, 'optionalAccess', _207 => _207.defaults, 'optionalAccess', _208 => _208.color, 'optionalAccess', _209 => _209.mode]) === "fixed" }
|
|
8750
9071
|
];
|
|
8751
9072
|
var THRESHOLDS = {
|
|
8752
9073
|
path: field("thresholds"),
|
|
@@ -8772,7 +9093,7 @@ var CALC = {
|
|
|
8772
9093
|
default: "lastNotNull",
|
|
8773
9094
|
control: { kind: "select", choices: Object.entries(REDUCER_LABELS).map(([value, label]) => ({ label, value })) },
|
|
8774
9095
|
stored: "string[]",
|
|
8775
|
-
get: (p) => _optionalChain([p, 'access',
|
|
9096
|
+
get: (p) => _optionalChain([p, 'access', _210 => _210.options, 'optionalAccess', _211 => _211.reduceOptions, 'optionalAccess', _212 => _212.calcs, 'optionalAccess', _213 => _213[0]]),
|
|
8776
9097
|
set: (p, v) => setOptionValue(p, "options.reduceOptions.calcs", v === void 0 ? void 0 : [v])
|
|
8777
9098
|
};
|
|
8778
9099
|
var LEGEND = {
|
|
@@ -8782,9 +9103,9 @@ var LEGEND = {
|
|
|
8782
9103
|
help: "When there are two or more series.",
|
|
8783
9104
|
default: true,
|
|
8784
9105
|
control: { kind: "boolean" },
|
|
8785
|
-
get: (p) => _optionalChain([p, 'access',
|
|
9106
|
+
get: (p) => _optionalChain([p, 'access', _214 => _214.options, 'optionalAccess', _215 => _215.legend, 'optionalAccess', _216 => _216.showLegend]) !== false && _optionalChain([p, 'access', _217 => _217.options, 'optionalAccess', _218 => _218.legend, 'optionalAccess', _219 => _219.displayMode]) !== "hidden",
|
|
8786
9107
|
// Grafana's older displayMode "hidden" would otherwise keep it hidden.
|
|
8787
|
-
set: (p, v) => setOptionValue(v ? setOptionValue(p, "options.legend.displayMode", _optionalChain([p, 'access',
|
|
9108
|
+
set: (p, v) => setOptionValue(v ? setOptionValue(p, "options.legend.displayMode", _optionalChain([p, 'access', _220 => _220.options, 'optionalAccess', _221 => _221.legend, 'optionalAccess', _222 => _222.displayMode]) === "hidden" ? void 0 : _optionalChain([p, 'access', _223 => _223.options, 'optionalAccess', _224 => _224.legend, 'optionalAccess', _225 => _225.displayMode])) : p, "options.legend.showLegend", v ? void 0 : false)
|
|
8788
9109
|
};
|
|
8789
9110
|
var AXIS_LABEL = { path: field("custom.axisLabel"), label: "Axis label", category: "Axis", control: { kind: "text" } };
|
|
8790
9111
|
var AXIS_PLACEMENT = {
|
|
@@ -9038,7 +9359,7 @@ function overrideProperties(type) {
|
|
|
9038
9359
|
return out;
|
|
9039
9360
|
}
|
|
9040
9361
|
function panelOverrides(panel) {
|
|
9041
|
-
const o = _optionalChain([panel, 'access',
|
|
9362
|
+
const o = _optionalChain([panel, 'access', _226 => _226.fieldConfig, 'optionalAccess', _227 => _227.overrides]);
|
|
9042
9363
|
return Array.isArray(o) ? o : [];
|
|
9043
9364
|
}
|
|
9044
9365
|
function setOverrides(panel, overrides) {
|
|
@@ -9086,7 +9407,7 @@ function prepareDashboard(json, file) {
|
|
|
9086
9407
|
});
|
|
9087
9408
|
dashboard.panels.forEach((p, i) => {
|
|
9088
9409
|
for (const r of cleanPanelOptions(p)) removed.push({ path: `panels[${i}]${r.path}`, message: r.message });
|
|
9089
|
-
_optionalChain([p, 'access',
|
|
9410
|
+
_optionalChain([p, 'access', _228 => _228.panels, 'optionalAccess', _229 => _229.forEach, 'call', _230 => _230((child, j) => {
|
|
9090
9411
|
for (const r of cleanPanelOptions(child)) removed.push({ path: `panels[${i}].panels[${j}]${r.path}`, message: r.message });
|
|
9091
9412
|
})]);
|
|
9092
9413
|
});
|
|
@@ -9109,7 +9430,7 @@ function groupIssues(dashboard) {
|
|
|
9109
9430
|
for (const { p, at } of located2) if (isInputPanel(p) && !recordedAt.has(p.options.metric)) recordedAt.set(p.options.metric, at);
|
|
9110
9431
|
for (const { p, at } of located2) {
|
|
9111
9432
|
if (p.type !== INPUT_GROUP) continue;
|
|
9112
|
-
const fields = _optionalChain([p, 'access',
|
|
9433
|
+
const fields = _optionalChain([p, 'access', _231 => _231.options, 'optionalAccess', _232 => _232.fields]);
|
|
9113
9434
|
if (!Array.isArray(fields) || !fields.length) {
|
|
9114
9435
|
out.push({ path: `${at}.options.fields`, message: "a group needs at least one field" });
|
|
9115
9436
|
continue;
|
|
@@ -9126,7 +9447,7 @@ function groupIssues(dashboard) {
|
|
|
9126
9447
|
else recordedAt.set(metric, fat);
|
|
9127
9448
|
mine.push(metric);
|
|
9128
9449
|
});
|
|
9129
|
-
const titleFrom = _optionalChain([p, 'access',
|
|
9450
|
+
const titleFrom = _optionalChain([p, 'access', _233 => _233.options, 'optionalAccess', _234 => _234.titleFrom]);
|
|
9130
9451
|
if (titleFrom !== void 0 && !mine.includes(titleFrom)) out.push({ path: `${at}.options.titleFrom`, message: `must be the metric of one of the group\u2019s fields` });
|
|
9131
9452
|
}
|
|
9132
9453
|
return out;
|
|
@@ -9137,7 +9458,7 @@ function panelProblem(p) {
|
|
|
9137
9458
|
const g = p.gridPos;
|
|
9138
9459
|
if (!isObject3(g) || !["x", "y", "w", "h"].every((k) => typeof g[k] === "number"))
|
|
9139
9460
|
return { at: ".gridPos", message: "must have numeric x, y, w and h", summary: "has no usable gridPos" };
|
|
9140
|
-
if (p.type.startsWith("input-") && p.type !== INPUT_GROUP && !nonEmptyString(_optionalChain([p, 'access',
|
|
9461
|
+
if (p.type.startsWith("input-") && p.type !== INPUT_GROUP && !nonEmptyString(_optionalChain([p, 'access', _235 => _235.options, 'optionalAccess', _236 => _236.metric]))) {
|
|
9141
9462
|
const message = `${p.type} needs a metric to record to`;
|
|
9142
9463
|
return { at: ".options.metric", message, summary: message };
|
|
9143
9464
|
}
|
|
@@ -9213,17 +9534,17 @@ function resolveUrl(base, rel) {
|
|
|
9213
9534
|
function httpFetchJson(options = {}) {
|
|
9214
9535
|
const seen = /* @__PURE__ */ new Map();
|
|
9215
9536
|
return async (url, { accept = "application/json", signal } = {}) => {
|
|
9216
|
-
const extra = await _asyncNullishCoalesce(await _optionalChain([options, 'access',
|
|
9537
|
+
const extra = await _asyncNullishCoalesce(await _optionalChain([options, 'access', _237 => _237.headers, 'optionalCall', _238 => _238()]), async () => ( {}));
|
|
9217
9538
|
const key = JSON.stringify([url, accept, extra]);
|
|
9218
9539
|
const last = seen.get(key);
|
|
9219
9540
|
const get = (etag2) => fetch(url, { headers: { Accept: accept, ...extra, ...etag2 && { "If-None-Match": etag2 } }, cache: "no-store", signal });
|
|
9220
|
-
const res = await get(_optionalChain([last, 'optionalAccess',
|
|
9221
|
-
if (!last || _optionalChain([signal, 'optionalAccess',
|
|
9541
|
+
const res = await get(_optionalChain([last, 'optionalAccess', _239 => _239.etag])).catch((e) => {
|
|
9542
|
+
if (!last || _optionalChain([signal, 'optionalAccess', _240 => _240.aborted])) throw e;
|
|
9222
9543
|
seen.delete(key);
|
|
9223
9544
|
return get();
|
|
9224
9545
|
});
|
|
9225
9546
|
if (res.status === 304 && last) return last.json;
|
|
9226
|
-
if (!res.ok) throw new Error(_nullishCoalesce(_optionalChain([options, 'access',
|
|
9547
|
+
if (!res.ok) throw new Error(_nullishCoalesce(_optionalChain([options, 'access', _241 => _241.httpError, 'optionalCall', _242 => _242(res.status)]), () => ( `HTTP ${res.status}`)));
|
|
9227
9548
|
const json = JSON.parse(await res.text());
|
|
9228
9549
|
const etag = res.headers.get("ETag");
|
|
9229
9550
|
if (etag) seen.set(key, { etag, json });
|
|
@@ -9345,8 +9666,8 @@ var ConfigLoader = (_class2 = class {
|
|
|
9345
9666
|
async start() {
|
|
9346
9667
|
const { url, cache: cache2 } = this.options;
|
|
9347
9668
|
if (!url) return;
|
|
9348
|
-
const cached = await _optionalChain([cache2, 'optionalAccess',
|
|
9349
|
-
const bundle = _optionalChain([cached, 'optionalAccess',
|
|
9669
|
+
const cached = await _optionalChain([cache2, 'optionalAccess', _243 => _243.read, 'call', _244 => _244(), 'access', _245 => _245.catch, 'call', _246 => _246(() => null)]);
|
|
9670
|
+
const bundle = _optionalChain([cached, 'optionalAccess', _247 => _247.url]) === url ? revalidateBundle(cached.bundle) : void 0;
|
|
9350
9671
|
if (cached && bundle && !this.snapshot.fetchedAt) {
|
|
9351
9672
|
this.lastJson = JSON.stringify(bundle);
|
|
9352
9673
|
this.set({ bundle, source: "cache", fetchedAt: cached.fetchedAt, revision: cached.revision });
|
|
@@ -9376,7 +9697,7 @@ var ConfigLoader = (_class2 = class {
|
|
|
9376
9697
|
if (!bundle) {
|
|
9377
9698
|
const errors = issues.filter((i) => i.severity === "error").length;
|
|
9378
9699
|
const needsUpdate = issues.some((i) => i.code === "newer-version");
|
|
9379
|
-
const error = unreachable ? _optionalChain([issues, 'access',
|
|
9700
|
+
const error = unreachable ? _optionalChain([issues, 'access', _248 => _248[0], 'optionalAccess', _249 => _249.message]) : needsUpdate ? "a newer format" : errors === 1 ? "1 error" : `${errors} errors`;
|
|
9380
9701
|
return this.set(
|
|
9381
9702
|
{ loading: false, error, unreachable: !!unreachable, needsUpdate, issues },
|
|
9382
9703
|
this.snapshot.loading || error !== this.snapshot.error || !!unreachable !== !!this.snapshot.unreachable || needsUpdate !== !!this.snapshot.needsUpdate || !sameIssues(issues, this.snapshot.issues)
|
|
@@ -9386,7 +9707,7 @@ var ConfigLoader = (_class2 = class {
|
|
|
9386
9707
|
const changed = json !== this.lastJson;
|
|
9387
9708
|
this.lastJson = json;
|
|
9388
9709
|
const fetchedAt = Date.now();
|
|
9389
|
-
if (changed || revision !== this.snapshot.revision) _optionalChain([cache2, 'optionalAccess',
|
|
9710
|
+
if (changed || revision !== this.snapshot.revision) _optionalChain([cache2, 'optionalAccess', _250 => _250.write, 'call', _251 => _251({ url, fetchedAt, bundle, revision }), 'access', _252 => _252.catch, 'call', _253 => _253(() => {
|
|
9390
9711
|
})]);
|
|
9391
9712
|
this.set(
|
|
9392
9713
|
{ ...changed && { bundle }, source: "remote", fetchedAt, revision, loading: false, error: void 0, unreachable: void 0, needsUpdate: void 0, issues },
|
|
@@ -9403,7 +9724,7 @@ var ConfigLoader = (_class2 = class {
|
|
|
9403
9724
|
/** Stops the loader: cancels a fetch in flight, and nothing it does afterwards changes the state or the cache. */
|
|
9404
9725
|
dispose() {
|
|
9405
9726
|
this.disposed = true;
|
|
9406
|
-
_optionalChain([this, 'access',
|
|
9727
|
+
_optionalChain([this, 'access', _254 => _254.controller, 'optionalAccess', _255 => _255.abort, 'call', _256 => _256()]);
|
|
9407
9728
|
this.listeners.clear();
|
|
9408
9729
|
}
|
|
9409
9730
|
/** `notify: false` drops the patch, so the snapshot only changes when listeners hear about it. */
|
|
@@ -9424,7 +9745,7 @@ function tabIdFor(title, taken) {
|
|
|
9424
9745
|
}
|
|
9425
9746
|
function screenOfType(type, from, docs) {
|
|
9426
9747
|
const shown = from ? screenDocuments(from) : [];
|
|
9427
|
-
const firstOf = (ids) => _nullishCoalesce(_nullishCoalesce(_optionalChain([shown, 'access',
|
|
9748
|
+
const firstOf = (ids) => _nullishCoalesce(_nullishCoalesce(_optionalChain([shown, 'access', _257 => _257.find, 'call', _258 => _258((d) => ids.includes(d.id)), 'optionalAccess', _259 => _259.id]), () => ( ids[0])), () => ( ""));
|
|
9428
9749
|
switch (type) {
|
|
9429
9750
|
case "dashboard":
|
|
9430
9751
|
return { type, dashboard: firstOf(docs.dashboards) };
|
|
@@ -9437,7 +9758,7 @@ function screenOfType(type, from, docs) {
|
|
|
9437
9758
|
}
|
|
9438
9759
|
}
|
|
9439
9760
|
function screenDocuments(screen) {
|
|
9440
|
-
switch (_optionalChain([screen, 'optionalAccess',
|
|
9761
|
+
switch (_optionalChain([screen, 'optionalAccess', _260 => _260.type])) {
|
|
9441
9762
|
case "dashboard":
|
|
9442
9763
|
return [{ id: screen.dashboard, kind: "dashboard" }];
|
|
9443
9764
|
case "forms":
|
|
@@ -10852,8 +11173,8 @@ function removeNode(text, path) {
|
|
|
10852
11173
|
const tree = parseTree2(text);
|
|
10853
11174
|
const value = tree && findNodeAtLocation2(tree, path);
|
|
10854
11175
|
if (!value) return text;
|
|
10855
|
-
const node = _optionalChain([value, 'access',
|
|
10856
|
-
const siblings = _nullishCoalesce(_optionalChain([node, 'access',
|
|
11176
|
+
const node = _optionalChain([value, 'access', _261 => _261.parent, 'optionalAccess', _262 => _262.type]) === "property" ? value.parent : value;
|
|
11177
|
+
const siblings = _nullishCoalesce(_optionalChain([node, 'access', _263 => _263.parent, 'optionalAccess', _264 => _264.children]), () => ( []));
|
|
10857
11178
|
const i = siblings.indexOf(node);
|
|
10858
11179
|
const next = siblings[i + 1];
|
|
10859
11180
|
const prev = siblings[i - 1];
|
|
@@ -10936,20 +11257,20 @@ function removeDocumentFromManifest(text, id) {
|
|
|
10936
11257
|
const edits = [];
|
|
10937
11258
|
const removedTabs = [];
|
|
10938
11259
|
for (let i = tabs.length - 1; i >= 0; i--) {
|
|
10939
|
-
const screen = _optionalChain([tabs, 'access',
|
|
11260
|
+
const screen = _optionalChain([tabs, 'access', _265 => _265[i], 'optionalAccess', _266 => _266.screen]);
|
|
10940
11261
|
const at = ["tabs", i, "screen"];
|
|
10941
11262
|
const removeTab = () => {
|
|
10942
11263
|
edits.push({ path: ["tabs", i], remove: true });
|
|
10943
11264
|
removedTabs.unshift(_nullishCoalesce(tabs[i].title, () => ( tabs[i].id)));
|
|
10944
11265
|
};
|
|
10945
|
-
if (_optionalChain([screen, 'optionalAccess',
|
|
10946
|
-
else if (_optionalChain([screen, 'optionalAccess',
|
|
11266
|
+
if (_optionalChain([screen, 'optionalAccess', _267 => _267.type]) === "dashboard" && screen.dashboard === id) removeTab();
|
|
11267
|
+
else if (_optionalChain([screen, 'optionalAccess', _268 => _268.type]) === "forms" && Array.isArray(screen.forms) && screen.forms.includes(id)) {
|
|
10947
11268
|
if (screen.forms.every((f) => f === id)) removeTab();
|
|
10948
11269
|
else for (let j = screen.forms.length - 1; j >= 0; j--) if (screen.forms[j] === id) edits.push({ path: [...at, "forms", j], remove: true });
|
|
10949
|
-
} else if (_optionalChain([screen, 'optionalAccess',
|
|
11270
|
+
} else if (_optionalChain([screen, 'optionalAccess', _269 => _269.type]) === "menu" && Array.isArray(screen.items))
|
|
10950
11271
|
for (let j = screen.items.length - 1; j >= 0; j--) {
|
|
10951
11272
|
const item = screen.items[j];
|
|
10952
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
11273
|
+
if (_optionalChain([item, 'optionalAccess', _270 => _270.dashboard]) === id || _optionalChain([item, 'optionalAccess', _271 => _271.form]) === id) edits.push({ path: [...at, "items", j], remove: true });
|
|
10953
11274
|
}
|
|
10954
11275
|
}
|
|
10955
11276
|
if (tabs.length && removedTabs.length === tabs.length) throw new Error(`Every tab shows only "${id}". Add another tab first`);
|
|
@@ -10962,21 +11283,21 @@ function renameDocumentInManifest(text, from, to, path) {
|
|
|
10962
11283
|
if (to !== from && to in manifest.documents) throw new Error(`There\u2019s already a document "${to}"`);
|
|
10963
11284
|
const edits = [];
|
|
10964
11285
|
(Array.isArray(manifest.tabs) ? manifest.tabs : []).forEach((tab, i) => {
|
|
10965
|
-
const screen = _optionalChain([tab, 'optionalAccess',
|
|
11286
|
+
const screen = _optionalChain([tab, 'optionalAccess', _272 => _272.screen]);
|
|
10966
11287
|
const at = ["tabs", i, "screen"];
|
|
10967
|
-
if (_optionalChain([screen, 'optionalAccess',
|
|
10968
|
-
if (_optionalChain([screen, 'optionalAccess',
|
|
11288
|
+
if (_optionalChain([screen, 'optionalAccess', _273 => _273.type]) === "dashboard" && screen.dashboard === from) edits.push({ path: [...at, "dashboard"], value: to });
|
|
11289
|
+
if (_optionalChain([screen, 'optionalAccess', _274 => _274.type]) === "forms" && Array.isArray(screen.forms))
|
|
10969
11290
|
screen.forms.forEach((f, j) => f === from && edits.push({ path: [...at, "forms", j], value: to }));
|
|
10970
|
-
if (_optionalChain([screen, 'optionalAccess',
|
|
11291
|
+
if (_optionalChain([screen, 'optionalAccess', _275 => _275.type]) === "menu" && Array.isArray(screen.items))
|
|
10971
11292
|
screen.items.forEach((item, j) => {
|
|
10972
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
10973
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
11293
|
+
if (_optionalChain([item, 'optionalAccess', _276 => _276.dashboard]) === from) edits.push({ path: [...at, "items", j, "dashboard"], value: to });
|
|
11294
|
+
if (_optionalChain([item, 'optionalAccess', _277 => _277.form]) === from) edits.push({ path: [...at, "items", j, "form"], value: to });
|
|
10974
11295
|
});
|
|
10975
11296
|
});
|
|
10976
11297
|
if (path !== void 0) edits.push({ path: ["documents", from], value: path });
|
|
10977
11298
|
let out = applyJsonEdits(text, edits);
|
|
10978
11299
|
if (to !== from) {
|
|
10979
|
-
const key = _optionalChain([findNodeAtLocation2, 'call',
|
|
11300
|
+
const key = _optionalChain([findNodeAtLocation2, 'call', _278 => _278(parseTree2(out), ["documents", from]), 'optionalAccess', _279 => _279.parent, 'optionalAccess', _280 => _280.children, 'optionalAccess', _281 => _281[0]]);
|
|
10980
11301
|
if (key) out = out.slice(0, key.offset) + JSON.stringify(to) + out.slice(key.offset + key.length);
|
|
10981
11302
|
}
|
|
10982
11303
|
return out;
|
|
@@ -10997,7 +11318,7 @@ function inputs(text) {
|
|
|
10997
11318
|
if (d)
|
|
10998
11319
|
for (const p of d.panels.flatMap((x) => x.type === "row" ? [x, ..._nullishCoalesce(x.panels, () => ( []))] : [x])) {
|
|
10999
11320
|
if (typeof p.id !== "number") continue;
|
|
11000
|
-
if (isInputGroup(p)) p.options.fields.forEach((f, i) => typeof _optionalChain([f, 'optionalAccess',
|
|
11321
|
+
if (isInputGroup(p)) p.options.fields.forEach((f, i) => typeof _optionalChain([f, 'optionalAccess', _282 => _282.options, 'optionalAccess', _283 => _283.metric]) === "string" && out.set(`${p.id}.${i}`, { metric: f.options.metric, title: f.title }));
|
|
11001
11322
|
else if (isInputPanel(p)) out.set(String(p.id), { metric: p.options.metric, title: p.title });
|
|
11002
11323
|
}
|
|
11003
11324
|
} catch (e17) {
|
|
@@ -11007,7 +11328,7 @@ function inputs(text) {
|
|
|
11007
11328
|
function reads(text, metric) {
|
|
11008
11329
|
const d = parse2(text);
|
|
11009
11330
|
const panels = d ? d.panels.flatMap((p) => p.type === "row" ? [p, ..._nullishCoalesce(p.panels, () => ( []))] : [p]) : [];
|
|
11010
|
-
return panels.some((p) => (_nullishCoalesce(_optionalChain([p, 'optionalAccess',
|
|
11331
|
+
return panels.some((p) => (_nullishCoalesce(_optionalChain([p, 'optionalAccess', _284 => _284.targets]), () => ( []))).some((t) => t.metric === metric));
|
|
11011
11332
|
}
|
|
11012
11333
|
function metricChanges(before, after) {
|
|
11013
11334
|
const merged = { ...before, ...after };
|
|
@@ -11022,7 +11343,7 @@ function metricChanges(before, after) {
|
|
|
11022
11343
|
for (const [file, text] of Object.entries(after)) {
|
|
11023
11344
|
const old = inputs(before[file]);
|
|
11024
11345
|
for (const [id, input] of inputs(text))
|
|
11025
|
-
if (_optionalChain([old, 'access',
|
|
11346
|
+
if (_optionalChain([old, 'access', _285 => _285.get, 'call', _286 => _286(id), 'optionalAccess', _287 => _287.metric]) === metric && input.metric !== metric) rename ??= { metric, renamedTo: input.metric, file, input: input.title, readBy };
|
|
11026
11347
|
}
|
|
11027
11348
|
changes.push(_nullishCoalesce(rename, () => ( { metric, readBy })));
|
|
11028
11349
|
}
|
|
@@ -11062,14 +11383,14 @@ function variableWithType(v, type) {
|
|
|
11062
11383
|
}
|
|
11063
11384
|
function currentFor(v, value) {
|
|
11064
11385
|
const options = variableOptions({ ...v, current: void 0 });
|
|
11065
|
-
const text = (x) => x === ALL ? "All" : _nullishCoalesce(_optionalChain([options, 'access',
|
|
11386
|
+
const text = (x) => x === ALL ? "All" : _nullishCoalesce(_optionalChain([options, 'access', _288 => _288.find, 'call', _289 => _289((o) => o.value === x), 'optionalAccess', _290 => _290.text]), () => ( x));
|
|
11066
11387
|
return Array.isArray(value) ? { text: value.map(text), value } : { text: text(value), value };
|
|
11067
11388
|
}
|
|
11068
11389
|
function variableWithQuery(v, query) {
|
|
11069
11390
|
const { options: _, current, ...rest } = v;
|
|
11070
11391
|
const next = { ...rest, query };
|
|
11071
11392
|
if (v.type === "textbox" || v.type === "constant") return { ...next, current: { text: query, value: query } };
|
|
11072
|
-
const value = selectValue(next, _optionalChain([current, 'optionalAccess',
|
|
11393
|
+
const value = selectValue(next, _optionalChain([current, 'optionalAccess', _291 => _291.value]), variableOptions(next));
|
|
11073
11394
|
return { ...next, current: currentFor(next, value) };
|
|
11074
11395
|
}
|
|
11075
11396
|
function variableWithCurrent(v, value) {
|
|
@@ -11079,13 +11400,13 @@ function variableWithFlags(v, flags) {
|
|
|
11079
11400
|
const next = { ...v, ...flags };
|
|
11080
11401
|
if (!next.multi) delete next.multi;
|
|
11081
11402
|
if (!next.includeAll) delete next.includeAll;
|
|
11082
|
-
const raw = _optionalChain([v, 'access',
|
|
11403
|
+
const raw = _optionalChain([v, 'access', _292 => _292.current, 'optionalAccess', _293 => _293.value]);
|
|
11083
11404
|
const current = next.multi ? raw == null ? [] : Array.isArray(raw) ? raw : [raw] : Array.isArray(raw) ? raw[0] : raw;
|
|
11084
11405
|
return variableWithCurrent(next, selectValue(next, current, variableOptions({ ...next, current: void 0 })));
|
|
11085
11406
|
}
|
|
11086
11407
|
var refers = (name, flags) => new RegExp(`\\$${name}\\b|\\$\\{${name}(:\\w+)?\\}|\\[\\[${name}(:\\w+)?\\]\\]`, flags);
|
|
11087
11408
|
function allPanels2(dashboard) {
|
|
11088
|
-
return (_nullishCoalesce(dashboard.panels, () => ( []))).flatMap((p) => _optionalChain([p, 'optionalAccess',
|
|
11409
|
+
return (_nullishCoalesce(dashboard.panels, () => ( []))).flatMap((p) => _optionalChain([p, 'optionalAccess', _294 => _294.type]) === "row" ? [p, ..._nullishCoalesce(p.panels, () => ( []))] : [p]).filter((p) => p && typeof p === "object");
|
|
11089
11410
|
}
|
|
11090
11411
|
function variableUses(dashboard, name) {
|
|
11091
11412
|
const re = refers(name);
|
|
@@ -11157,7 +11478,7 @@ function locate(text, tree, path) {
|
|
|
11157
11478
|
for (let n = segs.length; n >= 0; n--) {
|
|
11158
11479
|
const node = findNodeAtLocation2(tree, segs.slice(0, n));
|
|
11159
11480
|
if (!node) continue;
|
|
11160
|
-
const key = _optionalChain([node, 'access',
|
|
11481
|
+
const key = _optionalChain([node, 'access', _295 => _295.parent, 'optionalAccess', _296 => _296.type]) === "property" ? _optionalChain([node, 'access', _297 => _297.parent, 'access', _298 => _298.children, 'optionalAccess', _299 => _299[0]]) : void 0;
|
|
11161
11482
|
if ((node.type === "object" || node.type === "array") && key) return located(text, key.offset, key.length);
|
|
11162
11483
|
if (node.type === "object" || node.type === "array") return located(text, node.offset, 1);
|
|
11163
11484
|
return located(text, node.offset, node.length);
|
|
@@ -11291,7 +11612,7 @@ async function errorText(res) {
|
|
|
11291
11612
|
}
|
|
11292
11613
|
}
|
|
11293
11614
|
async function authHeaders(token) {
|
|
11294
|
-
const t = await _optionalChain([token, 'optionalCall',
|
|
11615
|
+
const t = await _optionalChain([token, 'optionalCall', _300 => _300()]);
|
|
11295
11616
|
return t ? { Authorization: `Bearer ${t}` } : {};
|
|
11296
11617
|
}
|
|
11297
11618
|
var HttpConfigFiles = (_class3 = class {
|
|
@@ -11397,14 +11718,14 @@ function fetchJsonWithToken(token) {
|
|
|
11397
11718
|
return httpFetchJson({ headers: () => authHeaders(token), httpError: (status) => status === 401 ? "not signed in" : `HTTP ${status}` });
|
|
11398
11719
|
}
|
|
11399
11720
|
async function readConfigFiles(source) {
|
|
11400
|
-
const all = await _optionalChain([source, 'access',
|
|
11721
|
+
const all = await _optionalChain([source, 'access', _301 => _301.readAll, 'optionalCall', _302 => _302()]);
|
|
11401
11722
|
const read = all ? async (p) => {
|
|
11402
11723
|
if (!(p in all)) throw new Error(NOT_FOUND);
|
|
11403
11724
|
return all[p];
|
|
11404
11725
|
} : (p) => source.read(p);
|
|
11405
11726
|
const files = { [source.manifestPath]: await read(source.manifestPath) };
|
|
11406
11727
|
const { value } = parseJsonText(files[source.manifestPath]);
|
|
11407
|
-
const documents = _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
11728
|
+
const documents = _nullishCoalesce(_optionalChain([value, 'optionalAccess', _303 => _303.documents]), () => ( {}));
|
|
11408
11729
|
const paths = [...new Set(Object.values(documents).filter((d) => typeof d === "string"))];
|
|
11409
11730
|
await Promise.all(
|
|
11410
11731
|
paths.map(async (p) => {
|
|
@@ -11458,7 +11779,7 @@ var CANVAS_ROW_HEADER = 32;
|
|
|
11458
11779
|
function panelSize(panel, mode) {
|
|
11459
11780
|
const p = pos(panel);
|
|
11460
11781
|
if (mode === "grid") return { span: clampW(p.w), h: clampH(p.h) };
|
|
11461
|
-
return { span: panelSpan(panel, "phone"), h: clampH(_nullishCoalesce(_optionalChain([panel, 'access',
|
|
11782
|
+
return { span: panelSpan(panel, "phone"), h: clampH(_nullishCoalesce(_optionalChain([panel, 'access', _304 => _304.mobile, 'optionalAccess', _305 => _305.h]), () => ( p.h))) };
|
|
11462
11783
|
}
|
|
11463
11784
|
function layoutCanvas(panels, order, mode, width, override) {
|
|
11464
11785
|
return mode === "grid" ? layoutGridCanvas(panels, width, override) : layoutPhoneCanvas(panels, order, width, override);
|
|
@@ -11478,7 +11799,7 @@ function layoutGridCanvas(panels, width, override) {
|
|
|
11478
11799
|
boxes = [...boxes];
|
|
11479
11800
|
boxes[override.index] = b;
|
|
11480
11801
|
}
|
|
11481
|
-
const settled = settleBoxes(boxes, _optionalChain([override, 'optionalAccess',
|
|
11802
|
+
const settled = settleBoxes(boxes, _optionalChain([override, 'optionalAccess', _306 => _306.index]));
|
|
11482
11803
|
const items = settled.map((b, index) => {
|
|
11483
11804
|
const row = isRow(panels[index]);
|
|
11484
11805
|
return { index, row, x: b.x * colW, y: gridOffsetPx(b.y), width: b.w * colW - CANVAS_GAP, height: row ? gridUnitsToPx(1) : gridUnitsToPx(b.h), span: b.w, h: b.h };
|
|
@@ -11522,12 +11843,12 @@ function layoutPhoneCanvas(panels, order, width, override) {
|
|
|
11522
11843
|
y += CANVAS_ROW_HEADER + CANVAS_GAP;
|
|
11523
11844
|
continue;
|
|
11524
11845
|
}
|
|
11525
|
-
if (mode === "phone" && _optionalChain([panel, 'access',
|
|
11846
|
+
if (mode === "phone" && _optionalChain([panel, 'access', _307 => _307.mobile, 'optionalAccess', _308 => _308.hidden])) {
|
|
11526
11847
|
hidden.push(index);
|
|
11527
11848
|
continue;
|
|
11528
11849
|
}
|
|
11529
11850
|
const natural = panelSize(panel, mode);
|
|
11530
|
-
const size = _optionalChain([override, 'optionalAccess',
|
|
11851
|
+
const size = _optionalChain([override, 'optionalAccess', _309 => _309.index]) === index ? { span: clampW(_nullishCoalesce(override.span, () => ( natural.span))), h: clampH(_nullishCoalesce(override.h, () => ( natural.h))) } : natural;
|
|
11531
11852
|
if (used + size.span > GRID_COLUMNS) flush();
|
|
11532
11853
|
line.push({ index, row: false, x: 0, y: 0, width: 0, height: 0, ...size });
|
|
11533
11854
|
used += size.span;
|
|
@@ -11545,7 +11866,7 @@ function dropTarget(canvas, x, y, dragging) {
|
|
|
11545
11866
|
for (const c of pool) if (distance(c) < distance(best)) best = c;
|
|
11546
11867
|
const after = best.row ? y > best.y + best.height / 2 : x > best.x + best.width / 2;
|
|
11547
11868
|
if (!after) return best.index;
|
|
11548
|
-
return _nullishCoalesce(_optionalChain([items, 'access',
|
|
11869
|
+
return _nullishCoalesce(_optionalChain([items, 'access', _310 => _310[items.indexOf(best) + 1], 'optionalAccess', _311 => _311.index]), () => ( null));
|
|
11549
11870
|
}
|
|
11550
11871
|
function movePanel(panels, index, before) {
|
|
11551
11872
|
if (before === index) return panels;
|
|
@@ -11757,9 +12078,9 @@ var refers2 = (name) => new RegExp(`\\$${name}\\b|\\$\\{${name}(:\\w+)?\\}|\\[\\
|
|
|
11757
12078
|
var withChildren = (p) => [p, ...isRow(p) ? _nullishCoalesce(p.panels, () => ( [])) : []];
|
|
11758
12079
|
function panelMetrics(p) {
|
|
11759
12080
|
const found = [];
|
|
11760
|
-
if (isInputType(p.type) && typeof _optionalChain([p, 'access',
|
|
11761
|
-
if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access',
|
|
11762
|
-
for (const f of p.options.fields) if (typeof _optionalChain([f, 'optionalAccess',
|
|
12081
|
+
if (isInputType(p.type) && typeof _optionalChain([p, 'access', _312 => _312.options, 'optionalAccess', _313 => _313.metric]) === "string") found.push(p.options.metric);
|
|
12082
|
+
if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access', _314 => _314.options, 'optionalAccess', _315 => _315.fields]))) {
|
|
12083
|
+
for (const f of p.options.fields) if (typeof _optionalChain([f, 'optionalAccess', _316 => _316.options, 'optionalAccess', _317 => _317.metric]) === "string") found.push(f.options.metric);
|
|
11763
12084
|
}
|
|
11764
12085
|
for (const t of _nullishCoalesce(p.targets, () => ( []))) if (typeof t.metric === "string" && t.metric && !t.metric.startsWith("$")) found.push(t.metric);
|
|
11765
12086
|
return found;
|
|
@@ -11767,15 +12088,15 @@ function panelMetrics(p) {
|
|
|
11767
12088
|
function renameMetrics(panels, map) {
|
|
11768
12089
|
const rename = (p) => {
|
|
11769
12090
|
let out = p;
|
|
11770
|
-
if (isInputType(p.type) && typeof _optionalChain([p, 'access',
|
|
11771
|
-
if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access',
|
|
12091
|
+
if (isInputType(p.type) && typeof _optionalChain([p, 'access', _318 => _318.options, 'optionalAccess', _319 => _319.metric]) === "string" && map[p.options.metric]) out = { ...out, options: { ...out.options, metric: map[p.options.metric] } };
|
|
12092
|
+
if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access', _320 => _320.options, 'optionalAccess', _321 => _321.fields]))) {
|
|
11772
12093
|
const to = (m) => typeof m === "string" && map[m] || m;
|
|
11773
|
-
const fields = p.options.fields.map((f) => _optionalChain([f, 'optionalAccess',
|
|
12094
|
+
const fields = p.options.fields.map((f) => _optionalChain([f, 'optionalAccess', _322 => _322.options]) && to(f.options.metric) !== f.options.metric ? { ...f, options: { ...f.options, metric: to(f.options.metric) } } : f);
|
|
11774
12095
|
const titleFrom = to(p.options.titleFrom);
|
|
11775
12096
|
out = { ...out, options: { ...out.options, fields, ...titleFrom !== void 0 && { titleFrom } } };
|
|
11776
12097
|
}
|
|
11777
|
-
if (_optionalChain([p, 'access',
|
|
11778
|
-
if (_optionalChain([p, 'access',
|
|
12098
|
+
if (_optionalChain([p, 'access', _323 => _323.targets, 'optionalAccess', _324 => _324.some, 'call', _325 => _325((t) => typeof t.metric === "string" && map[t.metric])])) out = { ...out, targets: p.targets.map((t) => typeof t.metric === "string" && map[t.metric] ? { ...t, metric: map[t.metric] } : t) };
|
|
12099
|
+
if (_optionalChain([p, 'access', _326 => _326.panels, 'optionalAccess', _327 => _327.length])) out = { ...out, panels: p.panels.map(rename) };
|
|
11779
12100
|
return out;
|
|
11780
12101
|
};
|
|
11781
12102
|
return panels.map(rename);
|
|
@@ -11795,7 +12116,7 @@ function copyPanels(dashboard, indices) {
|
|
|
11795
12116
|
}
|
|
11796
12117
|
}
|
|
11797
12118
|
const chosen = order.filter((i) => picked.has(i)).map((i) => panels[i]);
|
|
11798
|
-
return snippetOf(chosen, _nullishCoalesce(_optionalChain([dashboard, 'access',
|
|
12119
|
+
return snippetOf(chosen, _nullishCoalesce(_optionalChain([dashboard, 'access', _328 => _328.templating, 'optionalAccess', _329 => _329.list]), () => ( [])));
|
|
11799
12120
|
}
|
|
11800
12121
|
function snippetOf(panels, available) {
|
|
11801
12122
|
const left = Math.min(...panels.map((p) => pos2(p).x));
|
|
@@ -11863,7 +12184,7 @@ var sameVariable = (a, b) => {
|
|
|
11863
12184
|
return strip(a) === strip(b);
|
|
11864
12185
|
};
|
|
11865
12186
|
function previewPaste(dashboard, snippet) {
|
|
11866
|
-
const { added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access',
|
|
12187
|
+
const { added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access', _330 => _330.templating, 'optionalAccess', _331 => _331.list]), () => ( [])), snippet.variables);
|
|
11867
12188
|
return { added, renamed };
|
|
11868
12189
|
}
|
|
11869
12190
|
function mergeVariables(existing, incoming) {
|
|
@@ -11900,7 +12221,7 @@ function pasteSnippet(dashboard, snippet, options = {}) {
|
|
|
11900
12221
|
return true;
|
|
11901
12222
|
};
|
|
11902
12223
|
let incoming = snippet.panels.filter(keep).map((p) => p.panels ? { ...p, panels: p.panels.filter(keep) } : p);
|
|
11903
|
-
const { variables, added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access',
|
|
12224
|
+
const { variables, added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access', _332 => _332.templating, 'optionalAccess', _333 => _333.list]), () => ( [])), snippet.variables);
|
|
11904
12225
|
for (const [from, to] of Object.entries(renamed)) incoming = renameVariableInPanels(incoming, from, to);
|
|
11905
12226
|
if (options.metrics) incoming = renameMetrics(incoming, options.metrics);
|
|
11906
12227
|
const after = options.after != null ? existing[options.after] : void 0;
|
|
@@ -11965,7 +12286,7 @@ function parseTemplate(text) {
|
|
|
11965
12286
|
if (seen.has(d.id)) return { error: `Two documents are called "${d.id}"` };
|
|
11966
12287
|
seen.add(d.id);
|
|
11967
12288
|
const { dashboard, issues } = prepareDashboard(d.dashboard, d.id);
|
|
11968
|
-
if (!dashboard) return { error: `"${d.id}" can\u2019t be shown: ${_nullishCoalesce(_optionalChain([issues, 'access',
|
|
12289
|
+
if (!dashboard) return { error: `"${d.id}" can\u2019t be shown: ${_nullishCoalesce(_optionalChain([issues, 'access', _334 => _334.find, 'call', _335 => _335((x) => x.severity === "error"), 'optionalAccess', _336 => _336.message]), () => ( "it isn\u2019t a dashboard"))}` };
|
|
11969
12290
|
if (dashboard.kind && dashboard.kind !== d.kind) return { error: `"${d.id}" is listed as a ${d.kind} but says it\u2019s a ${dashboard.kind}` };
|
|
11970
12291
|
documents.push({ kind: d.kind, id: d.id, dashboard });
|
|
11971
12292
|
}
|
|
@@ -12043,9 +12364,9 @@ function applyTemplate(manifestText, paths, template, options = {}) {
|
|
|
12043
12364
|
}
|
|
12044
12365
|
const tabIds = (_nullishCoalesce(manifest.tabs, () => ( []))).map((t) => t.id);
|
|
12045
12366
|
const added = [];
|
|
12046
|
-
let at = _nullishCoalesce(_optionalChain([manifest, 'access',
|
|
12367
|
+
let at = _nullishCoalesce(_optionalChain([manifest, 'access', _337 => _337.tabs, 'optionalAccess', _338 => _338.length]), () => ( 0));
|
|
12047
12368
|
for (const tab of template.tabs) {
|
|
12048
|
-
if (!_optionalChain([options, 'access',
|
|
12369
|
+
if (!_optionalChain([options, 'access', _339 => _339.tabs, 'optionalAccess', _340 => _340.includes, 'call', _341 => _341(tab.id)])) continue;
|
|
12049
12370
|
const screen = retarget(tab.screen, ids);
|
|
12050
12371
|
if (!screen) continue;
|
|
12051
12372
|
const id = tabIdFor(tab.id, tabIds);
|
|
@@ -12086,6 +12407,8 @@ Forms hold input panels. Each records to a \`metric\` (lowercase words joined wi
|
|
|
12086
12407
|
| input-counter | taps that add up, e.g. glasses of water | increment, unit |
|
|
12087
12408
|
| input-duration | a length of time, recorded in seconds | placeholder |
|
|
12088
12409
|
|
|
12410
|
+
A form can set \`"localOnly": true\` (beside \`"kind"\`) to keep what it records on the device where it's recorded: it's never synced to an account, other devices or assistants. Use it only when asked, e.g. for a private journal.
|
|
12411
|
+
|
|
12089
12412
|
Any input (not counter) can also take \`required: true\`, \`default\` (a value, or \`"last"\` for the last one saved), and \`record: "always"\` to record its value on every save even when it wasn't changed.
|
|
12090
12413
|
|
|
12091
12414
|
\`input-group\` repeats fields once per item, for things like the sets of a workout or the dishes of a meal. Give it \`h: 12\` and options \`{ "itemTitle": "Set", "titleFrom": "<a field's metric>", "start": 1 | "last", "min", "max", "fields": [ { "type": "input-\u2026", "title", "span": 1\u201324, "options": { "metric", \u2026 } } ] }\`. Fields can be any input but input-counter.
|
|
@@ -12267,7 +12590,7 @@ function readTemplateAnswer(text) {
|
|
|
12267
12590
|
);
|
|
12268
12591
|
const kept = new Set(template.tabs.map((t) => t.id));
|
|
12269
12592
|
for (const [i, tab] of (Array.isArray(raw.tabs) ? raw.tabs : []).entries()) {
|
|
12270
|
-
const id = _optionalChain([tab, 'optionalAccess',
|
|
12593
|
+
const id = _optionalChain([tab, 'optionalAccess', _342 => _342.id]);
|
|
12271
12594
|
if (typeof id !== "string" || !kept.has(id)) warnings.push(`tabs[${i}] was left out: it needs an id, a title and a screen showing only this template\u2019s documents`);
|
|
12272
12595
|
}
|
|
12273
12596
|
const kinds = new Map(template.documents.map((d) => [d.id, d.kind]));
|
|
@@ -12315,9 +12638,9 @@ function readDocumentAnswer(text, kind) {
|
|
|
12315
12638
|
return { error: e.message };
|
|
12316
12639
|
}
|
|
12317
12640
|
const wrapper = json;
|
|
12318
|
-
if (_optionalChain([wrapper, 'optionalAccess',
|
|
12641
|
+
if (_optionalChain([wrapper, 'optionalAccess', _343 => _343.$modelform]) === "template") {
|
|
12319
12642
|
if (!Array.isArray(wrapper.documents) || wrapper.documents.length !== 1) return { error: `That\u2019s a template, not one ${kind}` };
|
|
12320
|
-
json = _optionalChain([wrapper, 'access',
|
|
12643
|
+
json = _optionalChain([wrapper, 'access', _344 => _344.documents, 'access', _345 => _345[0], 'optionalAccess', _346 => _346.dashboard]);
|
|
12321
12644
|
}
|
|
12322
12645
|
if (!json || typeof json !== "object" || Array.isArray(json)) return { error: `That isn\u2019t a ${kind}` };
|
|
12323
12646
|
const raw = json;
|
|
@@ -12356,8 +12679,8 @@ function documentChanges(before, after) {
|
|
|
12356
12679
|
const what = [];
|
|
12357
12680
|
if (was.title !== p.title) what.push("title");
|
|
12358
12681
|
if (was.type !== p.type) what.push("type");
|
|
12359
|
-
if (_optionalChain([was, 'access',
|
|
12360
|
-
if (_optionalChain([was, 'access',
|
|
12682
|
+
if (_optionalChain([was, 'access', _347 => _347.gridPos, 'optionalAccess', _348 => _348.x]) !== _optionalChain([p, 'access', _349 => _349.gridPos, 'optionalAccess', _350 => _350.x]) || _optionalChain([was, 'access', _351 => _351.gridPos, 'optionalAccess', _352 => _352.y]) !== _optionalChain([p, 'access', _353 => _353.gridPos, 'optionalAccess', _354 => _354.y])) what.push("position");
|
|
12683
|
+
if (_optionalChain([was, 'access', _355 => _355.gridPos, 'optionalAccess', _356 => _356.w]) !== _optionalChain([p, 'access', _357 => _357.gridPos, 'optionalAccess', _358 => _358.w]) || _optionalChain([was, 'access', _359 => _359.gridPos, 'optionalAccess', _360 => _360.h]) !== _optionalChain([p, 'access', _361 => _361.gridPos, 'optionalAccess', _362 => _362.h])) what.push("size");
|
|
12361
12684
|
if (!same(was.options, p.options)) what.push("options");
|
|
12362
12685
|
if (!same(was.targets, p.targets) || !same(was.datasource, p.datasource) || !same(was.transformations, p.transformations)) what.push("queries");
|
|
12363
12686
|
if (!same(was.fieldConfig, p.fieldConfig)) what.push("field config");
|
|
@@ -12623,4 +12946,5 @@ function documentChanges(before, after) {
|
|
|
12623
12946
|
|
|
12624
12947
|
|
|
12625
12948
|
|
|
12626
|
-
|
|
12949
|
+
|
|
12950
|
+
exports.frameLength = frameLength; exports.timeField = timeField; exports.numberFields = numberFields; exports.fieldDisplayName = fieldDisplayName; exports.toSeries = toSeries; exports.toXYSeries = toXYSeries; exports.uniqueNames = uniqueNames; exports.toMillis = toMillis; exports.parseTime = parseTime; exports.parseRange = parseRange; exports.addTime = addTime; exports.startOf = startOf; exports.parseDuration = parseDuration; exports.calculateInterval = calculateInterval; exports.formatDuration = formatDuration; exports.TIME_PRESETS = TIME_PRESETS; exports.RELATIVE_RANGES = RELATIVE_RANGES; exports.parseLocalDateTime = parseLocalDateTime; exports.formatLocalDateTime = formatLocalDateTime; exports.timeExprError = timeExprError; exports.describeRange = describeRange; exports.zoomRange = zoomRange; exports.ALL = ALL; exports.initialVariableValues = initialVariableValues; exports.variableOptions = variableOptions; exports.variableInfo = variableInfo; exports.visibleVariables = visibleVariables; exports.isSqlDatasource = isSqlDatasource; exports.framesToOptions = framesToOptions; exports.refineOptions = refineOptions; exports.selectValue = selectValue; exports.variableReferences = variableReferences; exports.interpolate = interpolate; exports.queryParam = queryParam; exports.interpolateDeep = interpolateDeep; exports.resolveTimezone = resolveTimezone; exports.valueText = valueText; exports.GRID_COLUMNS = GRID_COLUMNS; exports.gridUnitsToPx = gridUnitsToPx; exports.gridOffsetPx = gridOffsetPx; exports.compactGrid = compactGrid; exports.isRow = isRow; exports.layoutDashboard = layoutDashboard; exports.repeatOptions = repeatOptions; exports.panelKey = panelKey; exports.panelSpan = panelSpan; exports.applyTransformations = applyTransformations; exports.DASHBOARD_DS = DASHBOARD_DS; exports.dashboardSourceIds = dashboardSourceIds; exports.panelHasQueries = panelHasQueries; exports.queryPanel = queryPanel; exports.normalizeRef = normalizeRef; exports.refreshedVariables = refreshedVariables; exports.variableDependents = variableDependents; exports.variableOrder = variableOrder; exports.resolveVariables = resolveVariables; exports.REDUCER_LABELS = REDUCER_LABELS; exports.isReducer = isReducer; exports.reduce = reduce; exports.INPUT_OPTION_KEYS = INPUT_OPTION_KEYS; exports.INPUT_TYPES = INPUT_TYPES; exports.isInputType = isInputType; exports.isInputPanel = isInputPanel; exports.INPUT_GROUP = INPUT_GROUP; exports.isFormPanelType = isFormPanelType; exports.isInputGroup = isInputGroup; exports.GROUP_FIELD_TYPES = GROUP_FIELD_TYPES; exports.groupFields = groupFields; exports.inputPanels = inputPanels; exports.documentKind = documentKind; exports.inputGroups = inputGroups; exports.plainInputPanels = plainInputPanels; exports.parseClockDigits = parseClockDigits; exports.formatClock = formatClock; exports.toEntries = toEntries; exports.newSaveId = newSaveId; exports.isEmptyItem = isEmptyItem; exports.groupToEntries = groupToEntries; exports.entriesToItems = entriesToItems; exports.groupProblems = groupProblems; exports.sameSave = sameSave; exports.inputProblem = inputProblem; exports.entryToInputValue = entryToInputValue; exports.textSuggestions = textSuggestions; exports.entriesSavedWith = entriesSavedWith; exports.formatValue = formatValue; exports.thresholdStep = thresholdStep; exports.NAMED_COLORS = NAMED_COLORS; exports.resolveColor = resolveColor; exports.SERIES_PALETTE = SERIES_PALETTE; exports.seriesColor = seriesColor; exports.mappedResult = mappedResult; exports.formatDisplay = formatDisplay; exports.valueColor = valueColor; exports.resolveFieldConfig = resolveFieldConfig; exports.fieldMatches = fieldMatches; exports.GrafanaError = GrafanaError; exports.GrafanaClient = GrafanaClient; exports.GrafanaDataSource = GrafanaDataSource; exports.fromWire = fromWire; exports.parseSpokenNumber = parseSpokenNumber; exports.parseSpokenDuration = parseSpokenDuration; exports.matchChoices = matchChoices; exports.parseSpokenYesNo = parseSpokenYesNo; exports.spokenValue = spokenValue; exports.DICTATION_TYPES = DICTATION_TYPES; exports.takesDictation = takesDictation; exports.dictationHints = dictationHints; exports.choicesOf = choicesOf; exports.fillForm = fillForm; exports.fillSchema = fillSchema; exports.fillPrompt = fillPrompt; exports.parseFillAnswer = parseFillAnswer; exports.readFill = readFill; exports.modelFiller = modelFiller; exports.fillHints = fillHints; exports.ruleFill = ruleFill; exports.ruleFiller = ruleFiller; exports.LOCAL_DATASOURCE_TYPE = LOCAL_DATASOURCE_TYPE; exports.isLocalDatasource = isLocalDatasource; exports.LocalDataSource = LocalDataSource; exports.groupField = groupField; exports.buildFrames = buildFrames; exports.MemoryEntryStore = MemoryEntryStore; exports.DEFAULT_GAZETTEER = DEFAULT_GAZETTEER; exports.parseGazetteer = parseGazetteer; exports.loadGazetteer = loadGazetteer; exports.resolveLinks = resolveLinks; exports.parseDashboardLink = parseDashboardLink; exports.applyDashboardLink = applyDashboardLink; exports.appSchema = appSchema; exports.dashboardSchema = dashboardSchema; exports.pointerToPath = pointerToPath; exports.manifestSchemaIssues = manifestSchemaIssues; exports.dashboardSchemaIssues = dashboardSchemaIssues; exports.cleanDashboard = cleanDashboard; exports.MAPPING_TYPES = MAPPING_TYPES; exports.SPECIAL_MATCHES = SPECIAL_MATCHES; exports.mappingRows = mappingRows; exports.rowsToMappings = rowsToMappings; exports.mappingRow = mappingRow; exports.mappingProblem = mappingProblem; exports.OPTION_CATEGORIES = OPTION_CATEGORIES; exports.UNIT_CHOICES = UNIT_CHOICES; exports.panelOptions = panelOptions; exports.getPath = getPath; exports.optionValue = optionValue; exports.setOption = setOption; exports.setOptionValue = setOptionValue; exports.cleanPanelOptions = cleanPanelOptions; exports.OVERRIDE_MATCHERS = OVERRIDE_MATCHERS; exports.overrideProperties = overrideProperties; exports.panelOverrides = panelOverrides; exports.setOverrides = setOverrides; exports.MANIFEST_VERSION = MANIFEST_VERSION; exports.requiredManifestVersion = requiredManifestVersion; exports.validateManifest = validateManifest; exports.prepareDashboard = prepareDashboard; exports.validateDashboard = validateDashboard2; exports.validateBundle = validateBundle; exports.resolveUrl = resolveUrl; exports.httpFetchJson = httpFetchJson; exports.defaultFetchJson = defaultFetchJson; exports.BUNDLE_TYPE = BUNDLE_TYPE; exports.BUNDLE_ACCEPT = BUNDLE_ACCEPT; exports.isBundleResponse = isBundleResponse; exports.bundleRoot = bundleRoot; exports.assembleFromResponse = assembleFromResponse; exports.assembleBundle = assembleBundle; exports.fetchBundle = fetchBundle; exports.revalidateBundle = revalidateBundle; exports.ConfigLoader = ConfigLoader; exports.tabIdFor = tabIdFor; exports.screenOfType = screenOfType; exports.screenDocuments = screenDocuments; exports.documentUses = documentUses; exports.stringifyCompact = stringifyCompact; exports.applyJsonEdits = applyJsonEdits; exports.diffJson = diffJson; exports.documentIdFor = documentIdFor; exports.removeDocumentFromManifest = removeDocumentFromManifest; exports.renameDocumentInManifest = renameDocumentInManifest; exports.metricChanges = metricChanges; exports.REFRESH_CHOICES = REFRESH_CHOICES; exports.EDITABLE_VARIABLE_TYPES = EDITABLE_VARIABLE_TYPES; exports.isEditableVariableType = isEditableVariableType; exports.variableNameError = variableNameError; exports.newVariable = newVariable; exports.variableWithType = variableWithType; exports.variableWithQuery = variableWithQuery; exports.variableWithCurrent = variableWithCurrent; exports.variableWithFlags = variableWithFlags; exports.variableUses = variableUses; exports.renameVariableInPanels = renameVariableInPanels; exports.lineColumn = lineColumn; exports.parseJsonText = parseJsonText; exports.splitPath = splitPath; exports.locate = locate; exports.checkFiles = checkFiles; exports.bundleFromFiles = bundleFromFiles; exports.formatJsonText = formatJsonText; exports.setJsonValue = setJsonValue; exports.PANEL_TYPES = PANEL_TYPES; exports.newPanel = newPanel; exports.newDocument = newDocument; exports.SaveConflictError = SaveConflictError; exports.HttpConfigFiles = HttpConfigFiles; exports.fetchJsonWithToken = fetchJsonWithToken; exports.readConfigFiles = readConfigFiles; exports.readingOrder = readingOrder; exports.repack = repack; exports.CANVAS_GAP = CANVAS_GAP; exports.CANVAS_ROW_HEADER = CANVAS_ROW_HEADER; exports.panelSize = panelSize; exports.layoutCanvas = layoutCanvas; exports.dropTarget = dropTarget; exports.movePanel = movePanel; exports.resizePanel = resizePanel; exports.setHiddenOnPhones = setHiddenOnPhones; exports.nextPanelId = nextPanelId; exports.insertPanel = insertPanel; exports.duplicatePanel = duplicatePanel; exports.removePanel = removePanel; exports.expandRow = expandRow; exports.collapseRow = collapseRow; exports.settleLayout = settleLayout; exports.placePanel = placePanel; exports.snapToGrid = snapToGrid; exports.panelEdits = panelEdits; exports.sampleEntries = sampleEntries; exports.SNIPPET_VERSION = SNIPPET_VERSION; exports.panelMetrics = panelMetrics; exports.renameMetrics = renameMetrics; exports.copyPanels = copyPanels; exports.parseSnippet = parseSnippet; exports.previewPaste = previewPaste; exports.pasteSnippet = pasteSnippet; exports.TEMPLATE_VERSION = TEMPLATE_VERSION; exports.makeTemplate = makeTemplate; exports.parseTemplate = parseTemplate; exports.templateNeeds = templateNeeds; exports.applyTemplate = applyTemplate; exports.DOCUMENT_GUIDE = DOCUMENT_GUIDE; exports.AUTHORING_GUIDE = AUTHORING_GUIDE; exports.EXAMPLE_TEMPLATE = EXAMPLE_TEMPLATE; exports.templatePrompt = templatePrompt; exports.jsonFromAnswer = jsonFromAnswer; exports.readTemplateAnswer = readTemplateAnswer; exports.fixTemplatePrompt = fixTemplatePrompt; exports.documentPrompt = documentPrompt; exports.readDocumentAnswer = readDocumentAnswer; exports.fixDocumentPrompt = fixDocumentPrompt; exports.documentChanges = documentChanges;
|