@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 =
|
|
385
|
+
(match, plain2, braced, bracedFmt, old, oldFmt) => {
|
|
386
|
+
const name = plain2 ?? braced ?? old;
|
|
387
387
|
const format3 = bracedFmt ?? oldFmt;
|
|
388
388
|
const scoped = ctx.scoped?.[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 = 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, (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 = 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) => 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(tokens[j - 1]?.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) => tokens[j + n]?.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, (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 = named[i + 1]?.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(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 = 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";
|
|
@@ -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
|
}
|
|
@@ -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((validateDashboard.errors ?? []).filter((e) => !noise(e)));
|
|
8590
8911
|
const targets = /* @__PURE__ */ new Map();
|
|
8591
8912
|
for (const e of errors) {
|
|
@@ -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.
|
|
@@ -12479,15 +12802,16 @@ export {
|
|
|
12479
12802
|
DICTATION_TYPES,
|
|
12480
12803
|
takesDictation,
|
|
12481
12804
|
dictationHints,
|
|
12805
|
+
choicesOf,
|
|
12482
12806
|
fillForm,
|
|
12483
12807
|
fillSchema,
|
|
12484
12808
|
fillPrompt,
|
|
12485
12809
|
parseFillAnswer,
|
|
12486
12810
|
readFill,
|
|
12487
|
-
ruleFill,
|
|
12488
|
-
ruleFiller,
|
|
12489
12811
|
modelFiller,
|
|
12490
12812
|
fillHints,
|
|
12813
|
+
ruleFill,
|
|
12814
|
+
ruleFiller,
|
|
12491
12815
|
LOCAL_DATASOURCE_TYPE,
|
|
12492
12816
|
isLocalDatasource,
|
|
12493
12817
|
LocalDataSource,
|