@modelform/react-native 0.9.0 → 0.11.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 +3 -0
- package/dist/{chunk-KOCUG6GH.mjs → chunk-AJEPW5KG.mjs} +323 -4
- package/dist/{chunk-FBZDJWT2.js → chunk-KJR3ZKG4.js} +323 -4
- package/dist/core/authoring.d.ts +66 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +24 -2
- package/dist/core/index.mjs +23 -1
- package/dist/index.js +177 -155
- package/dist/index.mjs +23 -1
- package/package.json +1 -1
|
@@ -11377,10 +11377,10 @@ function mergeVariables(existing, incoming) {
|
|
|
11377
11377
|
const renamed = {};
|
|
11378
11378
|
const out = [...existing];
|
|
11379
11379
|
for (const v of incoming) {
|
|
11380
|
-
const
|
|
11381
|
-
if (
|
|
11380
|
+
const same2 = existing.find((e) => e.name === v.name);
|
|
11381
|
+
if (same2 && sameVariable(same2, v)) continue;
|
|
11382
11382
|
let name = v.name;
|
|
11383
|
-
if (
|
|
11383
|
+
if (same2) {
|
|
11384
11384
|
let n = 2;
|
|
11385
11385
|
while (taken.has(`${v.name}_${n}`)) n++;
|
|
11386
11386
|
name = `${v.name}_${n}`;
|
|
@@ -11567,6 +11567,325 @@ function applyTemplate(manifestText, paths, template, options = {}) {
|
|
|
11567
11567
|
return { manifest: applyJsonEdits(manifestText, edits), files: out, ids, tabs: added };
|
|
11568
11568
|
}
|
|
11569
11569
|
|
|
11570
|
+
// src/core/authoring.ts
|
|
11571
|
+
var DOCUMENT_GUIDE = `## Documents
|
|
11572
|
+
|
|
11573
|
+
A document is a subset of Grafana's dashboard JSON: \`{ "kind": "form" | "dashboard", "title": "\u2026", "panels": [ \u2026 ] }\`, and dashboards add \`"time": { "from": "now-30d", "to": "now" }\`.
|
|
11574
|
+
|
|
11575
|
+
Every panel has an \`id\` (a number, unique in its document), a \`type\`, a \`title\`, and a \`gridPos\` \`{ "x", "y", "w", "h" }\` on a 24-column grid: \`w: 24\` is full width, \`w: 12\` half. Stack panels top to bottom with no gaps or overlaps (each \`y\` is the previous \`y + h\` unless they sit side by side). On phones panels show full width in that order.
|
|
11576
|
+
|
|
11577
|
+
A \`"row"\` panel (\`h: 1\`, no options) is a section heading for the panels under it, in forms and dashboards.
|
|
11578
|
+
|
|
11579
|
+
## Forms
|
|
11580
|
+
|
|
11581
|
+
Forms hold input panels. Each records to a \`metric\` (lowercase words joined with dashes, e.g. \`"body-weight"\`), and charts read entries by that metric. Two inputs never share a metric. Use \`h: 3\` for inputs.
|
|
11582
|
+
|
|
11583
|
+
| type | what | options besides metric |
|
|
11584
|
+
|---|---|---|
|
|
11585
|
+
| input-number | a number typed or stepped with + and \u2212 | unit, step, min, max |
|
|
11586
|
+
| input-slider | a value dragged along a range | min, max, step, unit, labels (text spread along the track) |
|
|
11587
|
+
| input-select | one of a set of choices | choices: [{ "label", "value" }], multi (allow several) |
|
|
11588
|
+
| input-toggle | yes or no (records 1 or 0) | |
|
|
11589
|
+
| input-rating | a score, e.g. 1 to 5 | min, max |
|
|
11590
|
+
| input-text | free text | placeholder, suggest (offer earlier values) |
|
|
11591
|
+
| input-counter | taps that add up, e.g. glasses of water | increment, unit |
|
|
11592
|
+
| input-duration | a length of time, recorded in seconds | placeholder |
|
|
11593
|
+
|
|
11594
|
+
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.
|
|
11595
|
+
|
|
11596
|
+
\`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.
|
|
11597
|
+
|
|
11598
|
+
## Dashboards
|
|
11599
|
+
|
|
11600
|
+
Chart panels read the app's entries with \`"datasource": { "type": "modelform-local" }\` and \`"targets": [ { "refId": "A", "metric": "\u2026" } ]\` (refIds A, B, C\u2026 for more series). A target can also have:
|
|
11601
|
+
|
|
11602
|
+
- \`aggregate\`: "sum", "avg", "min", "max", "count" or "last", with \`bucket\`: "1h", "1d", "1w" or "1M". Without them each entry is a point.
|
|
11603
|
+
- \`groupBy\`: "text" for one series per text or choice value; \`{ "field": "<metric>" }\` for one series per value of another input saved at the same time (in an input-group, of the same item, e.g. weight per exercise).
|
|
11604
|
+
- \`alias\`: the series name. \`fillZero: false\` leaves empty buckets out.
|
|
11605
|
+
|
|
11606
|
+
| type | use for | h |
|
|
11607
|
+
|---|---|---|
|
|
11608
|
+
| timeseries | values over time | 7\u20138 |
|
|
11609
|
+
| barchart | totals per day, week or category | 7\u20138 |
|
|
11610
|
+
| stat | one big number; \`"options": { "reduceOptions": { "calcs": ["lastNotNull" or "mean" or "sum"] } }\` | 4 |
|
|
11611
|
+
| gauge, bargauge | a value against a range (set min and max) | 5\u20136 |
|
|
11612
|
+
| piechart | how a total splits, e.g. by choice with groupBy "text" and aggregate "count" | 8 |
|
|
11613
|
+
| table | rows of values | 8 |
|
|
11614
|
+
| text | markdown notes: \`"options": { "content": "\u2026" }\`, no targets | 3\u20134 |
|
|
11615
|
+
|
|
11616
|
+
Units and ranges go in \`"fieldConfig": { "defaults": { "unit": "\u2026", "min", "max", "decimals" } }\`. Units are Grafana's, e.g. "percent", "masskg", "lengthkm", "s", or "suffix: <text>" for anything else (\`"suffix: glasses"\`). Don't use trend, xychart or geomap panels.
|
|
11617
|
+
|
|
11618
|
+
Charts can't do arithmetic across metrics (weight \xD7 reps, a ratio of two inputs). Chart what's recorded instead, or add an input for the combined value, and say which you did in the sentence before the JSON.
|
|
11619
|
+
|
|
11620
|
+
`;
|
|
11621
|
+
var AUTHORING_GUIDE = `# modelform templates
|
|
11622
|
+
|
|
11623
|
+
A template is JSON that adds forms (for recording entries) and dashboards (for charting them) to an app, plus tabs to show them.
|
|
11624
|
+
|
|
11625
|
+
\`\`\`
|
|
11626
|
+
{
|
|
11627
|
+
"$modelform": "template",
|
|
11628
|
+
"version": 1,
|
|
11629
|
+
"title": "Short name",
|
|
11630
|
+
"description": "One sentence on what it's for.",
|
|
11631
|
+
"documents": [ { "kind": "form" | "dashboard", "id": "letters-digits-dashes", "dashboard": { ...document } } ],
|
|
11632
|
+
"tabs": [ ...tabs ]
|
|
11633
|
+
}
|
|
11634
|
+
\`\`\`
|
|
11635
|
+
|
|
11636
|
+
Each document's \`kind\` matches its entry in \`documents\`.
|
|
11637
|
+
|
|
11638
|
+
${DOCUMENT_GUIDE}## Tabs
|
|
11639
|
+
|
|
11640
|
+
\`{ "id": "\u2026", "title": "\u2026", "icon": "\u2026", "screen": \u2026 }\`, where the screen is one of:
|
|
11641
|
+
|
|
11642
|
+
- \`{ "type": "forms", "forms": ["<form id>", \u2026] }\`
|
|
11643
|
+
- \`{ "type": "dashboard", "dashboard": "<dashboard id>" }\`
|
|
11644
|
+
- \`{ "type": "menu", "items": [ { "form": "<id>" } or { "dashboard": "<id>", "description": "\u2026" } ] }\`
|
|
11645
|
+
|
|
11646
|
+
Usually one tab for the forms and one per dashboard.
|
|
11647
|
+
`;
|
|
11648
|
+
var EXAMPLE = {
|
|
11649
|
+
$modelform: "template",
|
|
11650
|
+
version: 1,
|
|
11651
|
+
title: "Water and sleep",
|
|
11652
|
+
description: "Count glasses of water and log sleep, and see both by day.",
|
|
11653
|
+
documents: [
|
|
11654
|
+
{
|
|
11655
|
+
kind: "form",
|
|
11656
|
+
id: "today",
|
|
11657
|
+
dashboard: {
|
|
11658
|
+
kind: "form",
|
|
11659
|
+
title: "Today",
|
|
11660
|
+
panels: [
|
|
11661
|
+
{ id: 1, type: "input-counter", title: "Water", gridPos: { x: 0, y: 0, w: 24, h: 3 }, options: { metric: "water", unit: "glasses" } },
|
|
11662
|
+
{ id: 2, type: "input-duration", title: "Sleep", gridPos: { x: 0, y: 3, w: 12, h: 3 }, options: { metric: "sleep" } },
|
|
11663
|
+
{ id: 3, type: "input-rating", title: "Sleep quality", gridPos: { x: 12, y: 3, w: 12, h: 3 }, options: { metric: "sleep-quality", min: 1, max: 5 } }
|
|
11664
|
+
]
|
|
11665
|
+
}
|
|
11666
|
+
},
|
|
11667
|
+
{
|
|
11668
|
+
kind: "dashboard",
|
|
11669
|
+
id: "by-day",
|
|
11670
|
+
dashboard: {
|
|
11671
|
+
kind: "dashboard",
|
|
11672
|
+
title: "By day",
|
|
11673
|
+
time: { from: "now-30d", to: "now" },
|
|
11674
|
+
panels: [
|
|
11675
|
+
{
|
|
11676
|
+
id: 1,
|
|
11677
|
+
type: "stat",
|
|
11678
|
+
title: "Average sleep",
|
|
11679
|
+
gridPos: { x: 0, y: 0, w: 12, h: 4 },
|
|
11680
|
+
datasource: { type: "modelform-local" },
|
|
11681
|
+
targets: [{ refId: "A", metric: "sleep" }],
|
|
11682
|
+
fieldConfig: { defaults: { unit: "s" } },
|
|
11683
|
+
options: { reduceOptions: { calcs: ["mean"] } }
|
|
11684
|
+
},
|
|
11685
|
+
{
|
|
11686
|
+
id: 2,
|
|
11687
|
+
type: "stat",
|
|
11688
|
+
title: "Water today",
|
|
11689
|
+
gridPos: { x: 12, y: 0, w: 12, h: 4 },
|
|
11690
|
+
datasource: { type: "modelform-local" },
|
|
11691
|
+
targets: [{ refId: "A", metric: "water", aggregate: "sum", bucket: "1d" }],
|
|
11692
|
+
fieldConfig: { defaults: { unit: "suffix: glasses", decimals: 0 } },
|
|
11693
|
+
options: { reduceOptions: { calcs: ["lastNotNull"] } }
|
|
11694
|
+
},
|
|
11695
|
+
{
|
|
11696
|
+
id: 3,
|
|
11697
|
+
type: "barchart",
|
|
11698
|
+
title: "Water per day",
|
|
11699
|
+
gridPos: { x: 0, y: 4, w: 24, h: 7 },
|
|
11700
|
+
datasource: { type: "modelform-local" },
|
|
11701
|
+
targets: [{ refId: "A", metric: "water", alias: "Glasses", aggregate: "sum", bucket: "1d" }],
|
|
11702
|
+
fieldConfig: { defaults: { min: 0, decimals: 0 } }
|
|
11703
|
+
},
|
|
11704
|
+
{
|
|
11705
|
+
id: 4,
|
|
11706
|
+
type: "timeseries",
|
|
11707
|
+
title: "Sleep quality",
|
|
11708
|
+
gridPos: { x: 0, y: 11, w: 24, h: 7 },
|
|
11709
|
+
datasource: { type: "modelform-local" },
|
|
11710
|
+
targets: [{ refId: "A", metric: "sleep-quality", alias: "Quality", aggregate: "avg", bucket: "1d", fillZero: false }],
|
|
11711
|
+
fieldConfig: { defaults: { min: 1, max: 5 } }
|
|
11712
|
+
}
|
|
11713
|
+
]
|
|
11714
|
+
}
|
|
11715
|
+
}
|
|
11716
|
+
],
|
|
11717
|
+
tabs: [
|
|
11718
|
+
{ id: "today", title: "Today", icon: "edit", screen: { type: "forms", forms: ["today"] } },
|
|
11719
|
+
{ id: "by-day", title: "By day", icon: "chart", screen: { type: "dashboard", dashboard: "by-day" } }
|
|
11720
|
+
],
|
|
11721
|
+
metrics: ["water", "sleep", "sleep-quality"]
|
|
11722
|
+
};
|
|
11723
|
+
var EXAMPLE_TEMPLATE = EXAMPLE;
|
|
11724
|
+
function templatePrompt(request, { recorded = [], icons = [] } = {}) {
|
|
11725
|
+
const context = [
|
|
11726
|
+
recorded.length ? `The app already records these metrics: ${recorded.map((m) => `\`${m}\``).join(", ")}. Charts can read them. A new form should only record one of them if it's for the same thing; otherwise pick new names.` : "The app doesn\u2019t record anything yet.",
|
|
11727
|
+
icons.length ? `Tab icons can be: ${icons.map((i) => `\`${i}\``).join(", ")}.` : ""
|
|
11728
|
+
].filter(Boolean);
|
|
11729
|
+
return [
|
|
11730
|
+
"I\u2019m building an app with modelform studio. Make me a modelform template for this:",
|
|
11731
|
+
"",
|
|
11732
|
+
request.trim().replace(/^/gm, "> "),
|
|
11733
|
+
"",
|
|
11734
|
+
...context,
|
|
11735
|
+
"",
|
|
11736
|
+
"Reply with the template as one ```json code block. A sentence before it is fine; nothing after it.",
|
|
11737
|
+
"",
|
|
11738
|
+
AUTHORING_GUIDE,
|
|
11739
|
+
"## Example",
|
|
11740
|
+
"",
|
|
11741
|
+
"```json",
|
|
11742
|
+
JSON.stringify(EXAMPLE),
|
|
11743
|
+
"```"
|
|
11744
|
+
].join("\n");
|
|
11745
|
+
}
|
|
11746
|
+
function jsonFromAnswer(text) {
|
|
11747
|
+
const blocks = [...text.matchAll(/```(?:json|JSON)?[ \t]*\r?\n([\s\S]*?)```/g)].map((m) => m[1]);
|
|
11748
|
+
const start = text.indexOf("{");
|
|
11749
|
+
const end = text.lastIndexOf("}");
|
|
11750
|
+
if (start >= 0 && end > start) blocks.push(text.slice(start, end + 1));
|
|
11751
|
+
for (const block of blocks.reverse()) {
|
|
11752
|
+
try {
|
|
11753
|
+
return JSON.parse(block);
|
|
11754
|
+
} catch (e22) {
|
|
11755
|
+
}
|
|
11756
|
+
}
|
|
11757
|
+
throw new Error("There\u2019s no JSON in that answer");
|
|
11758
|
+
}
|
|
11759
|
+
function readTemplateAnswer(text) {
|
|
11760
|
+
let json;
|
|
11761
|
+
try {
|
|
11762
|
+
json = jsonFromAnswer(text);
|
|
11763
|
+
} catch (e) {
|
|
11764
|
+
return { error: e.message };
|
|
11765
|
+
}
|
|
11766
|
+
const parsed = parseTemplate(JSON.stringify(json));
|
|
11767
|
+
if ("error" in parsed) return parsed;
|
|
11768
|
+
const { template } = parsed;
|
|
11769
|
+
const raw = json;
|
|
11770
|
+
const warnings = raw.documents.flatMap(
|
|
11771
|
+
(d) => prepareDashboard(d.dashboard, d.id).issues.filter((i) => i.severity === "warning").map((i) => `${i.path}: ${i.message}`)
|
|
11772
|
+
);
|
|
11773
|
+
const kept = new Set(template.tabs.map((t) => t.id));
|
|
11774
|
+
for (const [i, tab] of (Array.isArray(raw.tabs) ? raw.tabs : []).entries()) {
|
|
11775
|
+
const id = _optionalChain([tab, 'optionalAccess', _332 => _332.id]);
|
|
11776
|
+
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`);
|
|
11777
|
+
}
|
|
11778
|
+
const kinds = new Map(template.documents.map((d) => [d.id, d.kind]));
|
|
11779
|
+
for (const tab of template.tabs)
|
|
11780
|
+
for (const ref of screenDocuments(tab.screen)) {
|
|
11781
|
+
const kind = kinds.get(ref.id);
|
|
11782
|
+
if (kind && kind !== ref.kind) warnings.push(`tab "${tab.id}" shows "${ref.id}" as a ${ref.kind}, but it\u2019s a ${kind}`);
|
|
11783
|
+
}
|
|
11784
|
+
return { template, warnings };
|
|
11785
|
+
}
|
|
11786
|
+
function fixTemplatePrompt(problems) {
|
|
11787
|
+
return [
|
|
11788
|
+
"modelform couldn\u2019t use that template as it was:",
|
|
11789
|
+
"",
|
|
11790
|
+
...problems.map((p) => `- ${p}`),
|
|
11791
|
+
"",
|
|
11792
|
+
"Fix these and reply with the whole corrected template as one ```json code block."
|
|
11793
|
+
].join("\n");
|
|
11794
|
+
}
|
|
11795
|
+
function documentPrompt(request, document, { recorded = [] } = {}) {
|
|
11796
|
+
const kind = _nullishCoalesce(document.kind, () => ( "dashboard"));
|
|
11797
|
+
return [
|
|
11798
|
+
`I\u2019m building an app with modelform studio. Change this ${kind} for me:`,
|
|
11799
|
+
"",
|
|
11800
|
+
request.trim().replace(/^/gm, "> "),
|
|
11801
|
+
"",
|
|
11802
|
+
recorded.length ? `The app records these metrics: ${recorded.map((m) => `\`${m}\``).join(", ")}. Charts can read any of them.` : "",
|
|
11803
|
+
"Keep the ids of panels you keep and give new panels ids not used yet. Don\u2019t change an existing input\u2019s metric unless I asked: entries saved under the old name would stop showing up.",
|
|
11804
|
+
`Keep \`"kind": "${kind}"\`. Reply with the whole changed ${kind} as one \`\`\`json code block, not just the parts that changed. A sentence before it is fine; nothing after it.`,
|
|
11805
|
+
"",
|
|
11806
|
+
`## The ${kind} now`,
|
|
11807
|
+
"",
|
|
11808
|
+
"```json",
|
|
11809
|
+
JSON.stringify(document, null, 2),
|
|
11810
|
+
"```",
|
|
11811
|
+
"",
|
|
11812
|
+
DOCUMENT_GUIDE
|
|
11813
|
+
].filter((line, i, all) => line !== "" || all[i - 1] !== "").join("\n");
|
|
11814
|
+
}
|
|
11815
|
+
function readDocumentAnswer(text, kind) {
|
|
11816
|
+
let json;
|
|
11817
|
+
try {
|
|
11818
|
+
json = jsonFromAnswer(text);
|
|
11819
|
+
} catch (e) {
|
|
11820
|
+
return { error: e.message };
|
|
11821
|
+
}
|
|
11822
|
+
const wrapper = json;
|
|
11823
|
+
if (_optionalChain([wrapper, 'optionalAccess', _333 => _333.$modelform]) === "template") {
|
|
11824
|
+
if (!Array.isArray(wrapper.documents) || wrapper.documents.length !== 1) return { error: `That\u2019s a template, not one ${kind}` };
|
|
11825
|
+
json = _optionalChain([wrapper, 'access', _334 => _334.documents, 'access', _335 => _335[0], 'optionalAccess', _336 => _336.dashboard]);
|
|
11826
|
+
}
|
|
11827
|
+
if (!json || typeof json !== "object" || Array.isArray(json)) return { error: `That isn\u2019t a ${kind}` };
|
|
11828
|
+
const raw = json;
|
|
11829
|
+
const stated = _nullishCoalesce(raw.kind, () => ( (Array.isArray(raw.panels) ? documentKind(raw) : void 0)));
|
|
11830
|
+
if (stated !== void 0 && stated !== kind)
|
|
11831
|
+
return { error: raw.kind === void 0 ? kind === "form" ? "That has no inputs, so it isn\u2019t a form" : "That has inputs, so it\u2019s a form, not a dashboard" : `That\u2019s a ${String(raw.kind)}, not a ${kind}` };
|
|
11832
|
+
const { dashboard, issues } = prepareDashboard(raw, kind);
|
|
11833
|
+
if (!dashboard) return { error: issues.filter((i) => i.severity === "error").map((i) => `${i.path}: ${i.message}`).join("; ") || `That isn\u2019t a ${kind}` };
|
|
11834
|
+
const document = { kind, ...raw };
|
|
11835
|
+
return { document, warnings: issues.filter((i) => i.severity === "warning").map((i) => `${i.path}: ${i.message}`) };
|
|
11836
|
+
}
|
|
11837
|
+
function fixDocumentPrompt(problems, kind) {
|
|
11838
|
+
return [
|
|
11839
|
+
`modelform couldn\u2019t use that ${kind} as it was:`,
|
|
11840
|
+
"",
|
|
11841
|
+
...problems.map((p) => `- ${p}`),
|
|
11842
|
+
"",
|
|
11843
|
+
`Fix these and reply with the whole corrected ${kind} as one \`\`\`json code block.`
|
|
11844
|
+
].join("\n");
|
|
11845
|
+
}
|
|
11846
|
+
var same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
11847
|
+
var flat = (d) => (_nullishCoalesce(d.panels, () => ( []))).flatMap((p) => p.type === "row" && p.panels ? [p, ...p.panels] : [p]);
|
|
11848
|
+
function documentChanges(before, after) {
|
|
11849
|
+
const labels = [["kind", "kind"], ["title", "title"], ["description", "description"], ["time", "time range"], ["templating", "variables"], ["timezone", "time zone"], ["refresh", "refresh"]];
|
|
11850
|
+
const document = labels.filter(([key]) => !same(before[key], after[key])).map(([, label]) => label);
|
|
11851
|
+
const old = new Map(flat(before).map((p) => [p.id, p]));
|
|
11852
|
+
const now = new Map(flat(after).map((p) => [p.id, p]));
|
|
11853
|
+
const info = (p) => ({ id: p.id, title: p.title || p.type, type: p.type });
|
|
11854
|
+
const panels = [];
|
|
11855
|
+
for (const p of flat(after)) {
|
|
11856
|
+
const was = old.get(p.id);
|
|
11857
|
+
if (!was) {
|
|
11858
|
+
panels.push({ change: "added", ...info(p), what: [] });
|
|
11859
|
+
continue;
|
|
11860
|
+
}
|
|
11861
|
+
const what = [];
|
|
11862
|
+
if (was.title !== p.title) what.push("title");
|
|
11863
|
+
if (was.type !== p.type) what.push("type");
|
|
11864
|
+
if (_optionalChain([was, 'access', _337 => _337.gridPos, 'optionalAccess', _338 => _338.x]) !== _optionalChain([p, 'access', _339 => _339.gridPos, 'optionalAccess', _340 => _340.x]) || _optionalChain([was, 'access', _341 => _341.gridPos, 'optionalAccess', _342 => _342.y]) !== _optionalChain([p, 'access', _343 => _343.gridPos, 'optionalAccess', _344 => _344.y])) what.push("position");
|
|
11865
|
+
if (_optionalChain([was, 'access', _345 => _345.gridPos, 'optionalAccess', _346 => _346.w]) !== _optionalChain([p, 'access', _347 => _347.gridPos, 'optionalAccess', _348 => _348.w]) || _optionalChain([was, 'access', _349 => _349.gridPos, 'optionalAccess', _350 => _350.h]) !== _optionalChain([p, 'access', _351 => _351.gridPos, 'optionalAccess', _352 => _352.h])) what.push("size");
|
|
11866
|
+
if (!same(was.options, p.options)) what.push("options");
|
|
11867
|
+
if (!same(was.targets, p.targets) || !same(was.datasource, p.datasource) || !same(was.transformations, p.transformations)) what.push("queries");
|
|
11868
|
+
if (!same(was.fieldConfig, p.fieldConfig)) what.push("field config");
|
|
11869
|
+
const known = /* @__PURE__ */ new Set(["id", "title", "type", "gridPos", "options", "targets", "datasource", "transformations", "fieldConfig", "panels"]);
|
|
11870
|
+
const rest = (q) => Object.fromEntries(Object.entries(q).filter(([k]) => !known.has(k)).sort(([a], [b]) => a.localeCompare(b)));
|
|
11871
|
+
if (!same(rest(was), rest(p))) what.push("other");
|
|
11872
|
+
if (what.length) panels.push({ change: "changed", ...info(p), what });
|
|
11873
|
+
}
|
|
11874
|
+
for (const p of flat(before)) if (!now.has(p.id)) panels.push({ change: "removed", ...info(p), what: [] });
|
|
11875
|
+
return { document, panels };
|
|
11876
|
+
}
|
|
11877
|
+
|
|
11878
|
+
|
|
11879
|
+
|
|
11880
|
+
|
|
11881
|
+
|
|
11882
|
+
|
|
11883
|
+
|
|
11884
|
+
|
|
11885
|
+
|
|
11886
|
+
|
|
11887
|
+
|
|
11888
|
+
|
|
11570
11889
|
|
|
11571
11890
|
|
|
11572
11891
|
|
|
@@ -11791,4 +12110,4 @@ function applyTemplate(manifestText, paths, template, options = {}) {
|
|
|
11791
12110
|
|
|
11792
12111
|
|
|
11793
12112
|
|
|
11794
|
-
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.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.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;
|
|
12113
|
+
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.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.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;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Dashboard, DocumentKind } from './schema';
|
|
2
|
+
import { type AppTemplate } from './templates';
|
|
3
|
+
/** How to write forms and dashboards, for an assistant: the part of the guide that applies to one document. */
|
|
4
|
+
export declare const DOCUMENT_GUIDE = "## Documents\n\nA document is a subset of Grafana's dashboard JSON: `{ \"kind\": \"form\" | \"dashboard\", \"title\": \"\u2026\", \"panels\": [ \u2026 ] }`, and dashboards add `\"time\": { \"from\": \"now-30d\", \"to\": \"now\" }`.\n\nEvery panel has an `id` (a number, unique in its document), a `type`, a `title`, and a `gridPos` `{ \"x\", \"y\", \"w\", \"h\" }` on a 24-column grid: `w: 24` is full width, `w: 12` half. Stack panels top to bottom with no gaps or overlaps (each `y` is the previous `y + h` unless they sit side by side). On phones panels show full width in that order.\n\nA `\"row\"` panel (`h: 1`, no options) is a section heading for the panels under it, in forms and dashboards.\n\n## Forms\n\nForms hold input panels. Each records to a `metric` (lowercase words joined with dashes, e.g. `\"body-weight\"`), and charts read entries by that metric. Two inputs never share a metric. Use `h: 3` for inputs.\n\n| type | what | options besides metric |\n|---|---|---|\n| input-number | a number typed or stepped with + and \u2212 | unit, step, min, max |\n| input-slider | a value dragged along a range | min, max, step, unit, labels (text spread along the track) |\n| input-select | one of a set of choices | choices: [{ \"label\", \"value\" }], multi (allow several) |\n| input-toggle | yes or no (records 1 or 0) | |\n| input-rating | a score, e.g. 1 to 5 | min, max |\n| input-text | free text | placeholder, suggest (offer earlier values) |\n| input-counter | taps that add up, e.g. glasses of water | increment, unit |\n| input-duration | a length of time, recorded in seconds | placeholder |\n\nAny 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.\n\n`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.\n\n## Dashboards\n\nChart panels read the app's entries with `\"datasource\": { \"type\": \"modelform-local\" }` and `\"targets\": [ { \"refId\": \"A\", \"metric\": \"\u2026\" } ]` (refIds A, B, C\u2026 for more series). A target can also have:\n\n- `aggregate`: \"sum\", \"avg\", \"min\", \"max\", \"count\" or \"last\", with `bucket`: \"1h\", \"1d\", \"1w\" or \"1M\". Without them each entry is a point.\n- `groupBy`: \"text\" for one series per text or choice value; `{ \"field\": \"<metric>\" }` for one series per value of another input saved at the same time (in an input-group, of the same item, e.g. weight per exercise).\n- `alias`: the series name. `fillZero: false` leaves empty buckets out.\n\n| type | use for | h |\n|---|---|---|\n| timeseries | values over time | 7\u20138 |\n| barchart | totals per day, week or category | 7\u20138 |\n| stat | one big number; `\"options\": { \"reduceOptions\": { \"calcs\": [\"lastNotNull\" or \"mean\" or \"sum\"] } }` | 4 |\n| gauge, bargauge | a value against a range (set min and max) | 5\u20136 |\n| piechart | how a total splits, e.g. by choice with groupBy \"text\" and aggregate \"count\" | 8 |\n| table | rows of values | 8 |\n| text | markdown notes: `\"options\": { \"content\": \"\u2026\" }`, no targets | 3\u20134 |\n\nUnits and ranges go in `\"fieldConfig\": { \"defaults\": { \"unit\": \"\u2026\", \"min\", \"max\", \"decimals\" } }`. Units are Grafana's, e.g. \"percent\", \"masskg\", \"lengthkm\", \"s\", or \"suffix: <text>\" for anything else (`\"suffix: glasses\"`). Don't use trend, xychart or geomap panels.\n\nCharts can't do arithmetic across metrics (weight \u00D7 reps, a ratio of two inputs). Chart what's recorded instead, or add an input for the combined value, and say which you did in the sentence before the JSON.\n\n";
|
|
5
|
+
/** How to write a modelform template, for an assistant. Kept next to the format so they change together. */
|
|
6
|
+
export declare const AUTHORING_GUIDE = "# modelform templates\n\nA template is JSON that adds forms (for recording entries) and dashboards (for charting them) to an app, plus tabs to show them.\n\n```\n{\n \"$modelform\": \"template\",\n \"version\": 1,\n \"title\": \"Short name\",\n \"description\": \"One sentence on what it's for.\",\n \"documents\": [ { \"kind\": \"form\" | \"dashboard\", \"id\": \"letters-digits-dashes\", \"dashboard\": { ...document } } ],\n \"tabs\": [ ...tabs ]\n}\n```\n\nEach document's `kind` matches its entry in `documents`.\n\n## Documents\n\nA document is a subset of Grafana's dashboard JSON: `{ \"kind\": \"form\" | \"dashboard\", \"title\": \"\u2026\", \"panels\": [ \u2026 ] }`, and dashboards add `\"time\": { \"from\": \"now-30d\", \"to\": \"now\" }`.\n\nEvery panel has an `id` (a number, unique in its document), a `type`, a `title`, and a `gridPos` `{ \"x\", \"y\", \"w\", \"h\" }` on a 24-column grid: `w: 24` is full width, `w: 12` half. Stack panels top to bottom with no gaps or overlaps (each `y` is the previous `y + h` unless they sit side by side). On phones panels show full width in that order.\n\nA `\"row\"` panel (`h: 1`, no options) is a section heading for the panels under it, in forms and dashboards.\n\n## Forms\n\nForms hold input panels. Each records to a `metric` (lowercase words joined with dashes, e.g. `\"body-weight\"`), and charts read entries by that metric. Two inputs never share a metric. Use `h: 3` for inputs.\n\n| type | what | options besides metric |\n|---|---|---|\n| input-number | a number typed or stepped with + and \u2212 | unit, step, min, max |\n| input-slider | a value dragged along a range | min, max, step, unit, labels (text spread along the track) |\n| input-select | one of a set of choices | choices: [{ \"label\", \"value\" }], multi (allow several) |\n| input-toggle | yes or no (records 1 or 0) | |\n| input-rating | a score, e.g. 1 to 5 | min, max |\n| input-text | free text | placeholder, suggest (offer earlier values) |\n| input-counter | taps that add up, e.g. glasses of water | increment, unit |\n| input-duration | a length of time, recorded in seconds | placeholder |\n\nAny 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.\n\n`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.\n\n## Dashboards\n\nChart panels read the app's entries with `\"datasource\": { \"type\": \"modelform-local\" }` and `\"targets\": [ { \"refId\": \"A\", \"metric\": \"\u2026\" } ]` (refIds A, B, C\u2026 for more series). A target can also have:\n\n- `aggregate`: \"sum\", \"avg\", \"min\", \"max\", \"count\" or \"last\", with `bucket`: \"1h\", \"1d\", \"1w\" or \"1M\". Without them each entry is a point.\n- `groupBy`: \"text\" for one series per text or choice value; `{ \"field\": \"<metric>\" }` for one series per value of another input saved at the same time (in an input-group, of the same item, e.g. weight per exercise).\n- `alias`: the series name. `fillZero: false` leaves empty buckets out.\n\n| type | use for | h |\n|---|---|---|\n| timeseries | values over time | 7\u20138 |\n| barchart | totals per day, week or category | 7\u20138 |\n| stat | one big number; `\"options\": { \"reduceOptions\": { \"calcs\": [\"lastNotNull\" or \"mean\" or \"sum\"] } }` | 4 |\n| gauge, bargauge | a value against a range (set min and max) | 5\u20136 |\n| piechart | how a total splits, e.g. by choice with groupBy \"text\" and aggregate \"count\" | 8 |\n| table | rows of values | 8 |\n| text | markdown notes: `\"options\": { \"content\": \"\u2026\" }`, no targets | 3\u20134 |\n\nUnits and ranges go in `\"fieldConfig\": { \"defaults\": { \"unit\": \"\u2026\", \"min\", \"max\", \"decimals\" } }`. Units are Grafana's, e.g. \"percent\", \"masskg\", \"lengthkm\", \"s\", or \"suffix: <text>\" for anything else (`\"suffix: glasses\"`). Don't use trend, xychart or geomap panels.\n\nCharts can't do arithmetic across metrics (weight \u00D7 reps, a ratio of two inputs). Chart what's recorded instead, or add an input for the combined value, and say which you did in the sentence before the JSON.\n\n## Tabs\n\n`{ \"id\": \"\u2026\", \"title\": \"\u2026\", \"icon\": \"\u2026\", \"screen\": \u2026 }`, where the screen is one of:\n\n- `{ \"type\": \"forms\", \"forms\": [\"<form id>\", \u2026] }`\n- `{ \"type\": \"dashboard\", \"dashboard\": \"<dashboard id>\" }`\n- `{ \"type\": \"menu\", \"items\": [ { \"form\": \"<id>\" } or { \"dashboard\": \"<id>\", \"description\": \"\u2026\" } ] }`\n\nUsually one tab for the forms and one per dashboard.\n";
|
|
7
|
+
/** The example the guide ends with, for tests and editors. */
|
|
8
|
+
export declare const EXAMPLE_TEMPLATE: AppTemplate;
|
|
9
|
+
export interface PromptContext {
|
|
10
|
+
/** Metrics the app already records, so new charts can read them and new forms don't clash with them. */
|
|
11
|
+
recorded?: string[];
|
|
12
|
+
/** Icon names tabs can use. */
|
|
13
|
+
icons?: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A prompt asking an assistant for a template that does what `request` describes, with the
|
|
17
|
+
* guide, an example, and what the app already has.
|
|
18
|
+
*/
|
|
19
|
+
export declare function templatePrompt(request: string, { recorded, icons }?: PromptContext): string;
|
|
20
|
+
/** The JSON in an assistant's reply: its last ```json block that parses, else the outermost braces. */
|
|
21
|
+
export declare function jsonFromAnswer(text: string): unknown;
|
|
22
|
+
/**
|
|
23
|
+
* Reads a template out of an assistant's reply. Warnings are things that were dropped or look
|
|
24
|
+
* wrong but don't stop it being used, worth sending back with fixTemplatePrompt.
|
|
25
|
+
*/
|
|
26
|
+
export declare function readTemplateAnswer(text: string): {
|
|
27
|
+
template: AppTemplate;
|
|
28
|
+
warnings: string[];
|
|
29
|
+
} | {
|
|
30
|
+
error: string;
|
|
31
|
+
};
|
|
32
|
+
/** A follow-up asking the assistant to fix what was wrong with its template. */
|
|
33
|
+
export declare function fixTemplatePrompt(problems: string[]): string;
|
|
34
|
+
export interface DocumentPromptContext {
|
|
35
|
+
/** Metrics the app records, so charts can read them and new inputs don't clash with them. */
|
|
36
|
+
recorded?: string[];
|
|
37
|
+
}
|
|
38
|
+
/** A prompt asking an assistant to change `document` as `request` says and send the whole document back. */
|
|
39
|
+
export declare function documentPrompt(request: string, document: Dashboard, { recorded }?: DocumentPromptContext): string;
|
|
40
|
+
/**
|
|
41
|
+
* Reads a changed document out of an assistant's reply: a document, or a template holding just
|
|
42
|
+
* one. It must be the same kind as the one asked about. Warnings are values that will be ignored.
|
|
43
|
+
*/
|
|
44
|
+
export declare function readDocumentAnswer(text: string, kind: DocumentKind): {
|
|
45
|
+
document: Dashboard;
|
|
46
|
+
warnings: string[];
|
|
47
|
+
} | {
|
|
48
|
+
error: string;
|
|
49
|
+
};
|
|
50
|
+
/** A follow-up asking the assistant to fix what was wrong with the form or dashboard it sent. */
|
|
51
|
+
export declare function fixDocumentPrompt(problems: string[], kind: DocumentKind): string;
|
|
52
|
+
export interface PanelChange {
|
|
53
|
+
change: 'added' | 'removed' | 'changed';
|
|
54
|
+
id: number;
|
|
55
|
+
title: string;
|
|
56
|
+
type: string;
|
|
57
|
+
/** For a changed panel, what changed: "title", "type", "position", "size", "options", "queries", "field config", "other". */
|
|
58
|
+
what: string[];
|
|
59
|
+
}
|
|
60
|
+
export interface DocumentChanges {
|
|
61
|
+
/** Settings of the document itself that changed, e.g. "title", "time range". */
|
|
62
|
+
document: string[];
|
|
63
|
+
panels: PanelChange[];
|
|
64
|
+
}
|
|
65
|
+
/** What changing `before` into `after` does, panel by panel (matched by id), for a person to check. */
|
|
66
|
+
export declare function documentChanges(before: Dashboard, after: Dashboard): DocumentChanges;
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.js
CHANGED
|
@@ -222,7 +222,6 @@
|
|
|
222
222
|
|
|
223
223
|
|
|
224
224
|
|
|
225
|
-
var _chunkFBZDJWT2js = require('../chunk-FBZDJWT2.js');
|
|
226
225
|
|
|
227
226
|
|
|
228
227
|
|
|
@@ -234,6 +233,7 @@ var _chunkFBZDJWT2js = require('../chunk-FBZDJWT2.js');
|
|
|
234
233
|
|
|
235
234
|
|
|
236
235
|
|
|
236
|
+
var _chunkKJR3ZKG4js = require('../chunk-KJR3ZKG4.js');
|
|
237
237
|
|
|
238
238
|
|
|
239
239
|
|
|
@@ -447,4 +447,26 @@ var _chunkFBZDJWT2js = require('../chunk-FBZDJWT2.js');
|
|
|
447
447
|
|
|
448
448
|
|
|
449
449
|
|
|
450
|
-
exports.ALL = _chunkFBZDJWT2js.ALL; exports.BUNDLE_ACCEPT = _chunkFBZDJWT2js.BUNDLE_ACCEPT; exports.BUNDLE_TYPE = _chunkFBZDJWT2js.BUNDLE_TYPE; exports.CANVAS_GAP = _chunkFBZDJWT2js.CANVAS_GAP; exports.CANVAS_ROW_HEADER = _chunkFBZDJWT2js.CANVAS_ROW_HEADER; exports.ConfigLoader = _chunkFBZDJWT2js.ConfigLoader; exports.DASHBOARD_DS = _chunkFBZDJWT2js.DASHBOARD_DS; exports.DEFAULT_GAZETTEER = _chunkFBZDJWT2js.DEFAULT_GAZETTEER; exports.EDITABLE_VARIABLE_TYPES = _chunkFBZDJWT2js.EDITABLE_VARIABLE_TYPES; exports.GRID_COLUMNS = _chunkFBZDJWT2js.GRID_COLUMNS; exports.GROUP_FIELD_TYPES = _chunkFBZDJWT2js.GROUP_FIELD_TYPES; exports.GrafanaClient = _chunkFBZDJWT2js.GrafanaClient; exports.GrafanaDataSource = _chunkFBZDJWT2js.GrafanaDataSource; exports.GrafanaError = _chunkFBZDJWT2js.GrafanaError; exports.HttpConfigFiles = _chunkFBZDJWT2js.HttpConfigFiles; exports.INPUT_GROUP = _chunkFBZDJWT2js.INPUT_GROUP; exports.INPUT_OPTION_KEYS = _chunkFBZDJWT2js.INPUT_OPTION_KEYS; exports.INPUT_TYPES = _chunkFBZDJWT2js.INPUT_TYPES; exports.LOCAL_DATASOURCE_TYPE = _chunkFBZDJWT2js.LOCAL_DATASOURCE_TYPE; exports.LocalDataSource = _chunkFBZDJWT2js.LocalDataSource; exports.MANIFEST_VERSION = _chunkFBZDJWT2js.MANIFEST_VERSION; exports.MAPPING_TYPES = _chunkFBZDJWT2js.MAPPING_TYPES; exports.MemoryEntryStore = _chunkFBZDJWT2js.MemoryEntryStore; exports.NAMED_COLORS = _chunkFBZDJWT2js.NAMED_COLORS; exports.OPTION_CATEGORIES = _chunkFBZDJWT2js.OPTION_CATEGORIES; exports.OVERRIDE_MATCHERS = _chunkFBZDJWT2js.OVERRIDE_MATCHERS; exports.PANEL_TYPES = _chunkFBZDJWT2js.PANEL_TYPES; exports.REDUCER_LABELS = _chunkFBZDJWT2js.REDUCER_LABELS; exports.REFRESH_CHOICES = _chunkFBZDJWT2js.REFRESH_CHOICES; exports.RELATIVE_RANGES = _chunkFBZDJWT2js.RELATIVE_RANGES; exports.SERIES_PALETTE = _chunkFBZDJWT2js.SERIES_PALETTE; exports.SNIPPET_VERSION = _chunkFBZDJWT2js.SNIPPET_VERSION; exports.SPECIAL_MATCHES = _chunkFBZDJWT2js.SPECIAL_MATCHES; exports.SaveConflictError = _chunkFBZDJWT2js.SaveConflictError; exports.TEMPLATE_VERSION = _chunkFBZDJWT2js.TEMPLATE_VERSION; exports.TIME_PRESETS = _chunkFBZDJWT2js.TIME_PRESETS; exports.UNIT_CHOICES = _chunkFBZDJWT2js.UNIT_CHOICES; exports.addTime = _chunkFBZDJWT2js.addTime; exports.appSchema = _chunkFBZDJWT2js.appSchema; exports.applyDashboardLink = _chunkFBZDJWT2js.applyDashboardLink; exports.applyJsonEdits = _chunkFBZDJWT2js.applyJsonEdits; exports.applyTemplate = _chunkFBZDJWT2js.applyTemplate; exports.applyTransformations = _chunkFBZDJWT2js.applyTransformations; exports.assembleBundle = _chunkFBZDJWT2js.assembleBundle; exports.assembleFromResponse = _chunkFBZDJWT2js.assembleFromResponse; exports.buildFrames = _chunkFBZDJWT2js.buildFrames; exports.bundleFromFiles = _chunkFBZDJWT2js.bundleFromFiles; exports.bundleRoot = _chunkFBZDJWT2js.bundleRoot; exports.calculateInterval = _chunkFBZDJWT2js.calculateInterval; exports.checkFiles = _chunkFBZDJWT2js.checkFiles; exports.cleanDashboard = _chunkFBZDJWT2js.cleanDashboard; exports.cleanPanelOptions = _chunkFBZDJWT2js.cleanPanelOptions; exports.collapseRow = _chunkFBZDJWT2js.collapseRow; exports.compactGrid = _chunkFBZDJWT2js.compactGrid; exports.copyPanels = _chunkFBZDJWT2js.copyPanels; exports.dashboardSchema = _chunkFBZDJWT2js.dashboardSchema; exports.dashboardSchemaIssues = _chunkFBZDJWT2js.dashboardSchemaIssues; exports.dashboardSourceIds = _chunkFBZDJWT2js.dashboardSourceIds; exports.defaultFetchJson = _chunkFBZDJWT2js.defaultFetchJson; exports.describeRange = _chunkFBZDJWT2js.describeRange; exports.diffJson = _chunkFBZDJWT2js.diffJson; exports.documentIdFor = _chunkFBZDJWT2js.documentIdFor; exports.documentKind = _chunkFBZDJWT2js.documentKind; exports.documentUses = _chunkFBZDJWT2js.documentUses; exports.dropTarget = _chunkFBZDJWT2js.dropTarget; exports.duplicatePanel = _chunkFBZDJWT2js.duplicatePanel; exports.entriesSavedWith = _chunkFBZDJWT2js.entriesSavedWith; exports.entriesToItems = _chunkFBZDJWT2js.entriesToItems; exports.entryToInputValue = _chunkFBZDJWT2js.entryToInputValue; exports.expandRow = _chunkFBZDJWT2js.expandRow; exports.fetchBundle = _chunkFBZDJWT2js.fetchBundle; exports.fetchJsonWithToken = _chunkFBZDJWT2js.fetchJsonWithToken; exports.fieldDisplayName = _chunkFBZDJWT2js.fieldDisplayName; exports.fieldMatches = _chunkFBZDJWT2js.fieldMatches; exports.formatClock = _chunkFBZDJWT2js.formatClock; exports.formatDisplay = _chunkFBZDJWT2js.formatDisplay; exports.formatDuration = _chunkFBZDJWT2js.formatDuration; exports.formatJsonText = _chunkFBZDJWT2js.formatJsonText; exports.formatLocalDateTime = _chunkFBZDJWT2js.formatLocalDateTime; exports.formatValue = _chunkFBZDJWT2js.formatValue; exports.frameLength = _chunkFBZDJWT2js.frameLength; exports.framesToOptions = _chunkFBZDJWT2js.framesToOptions; exports.fromWire = _chunkFBZDJWT2js.fromWire; exports.getPath = _chunkFBZDJWT2js.getPath; exports.gridOffsetPx = _chunkFBZDJWT2js.gridOffsetPx; exports.gridUnitsToPx = _chunkFBZDJWT2js.gridUnitsToPx; exports.groupField = _chunkFBZDJWT2js.groupField; exports.groupFields = _chunkFBZDJWT2js.groupFields; exports.groupProblems = _chunkFBZDJWT2js.groupProblems; exports.groupToEntries = _chunkFBZDJWT2js.groupToEntries; exports.httpFetchJson = _chunkFBZDJWT2js.httpFetchJson; exports.initialVariableValues = _chunkFBZDJWT2js.initialVariableValues; exports.inputGroups = _chunkFBZDJWT2js.inputGroups; exports.inputPanels = _chunkFBZDJWT2js.inputPanels; exports.inputProblem = _chunkFBZDJWT2js.inputProblem; exports.insertPanel = _chunkFBZDJWT2js.insertPanel; exports.interpolate = _chunkFBZDJWT2js.interpolate; exports.interpolateDeep = _chunkFBZDJWT2js.interpolateDeep; exports.isBundleResponse = _chunkFBZDJWT2js.isBundleResponse; exports.isEditableVariableType = _chunkFBZDJWT2js.isEditableVariableType; exports.isEmptyItem = _chunkFBZDJWT2js.isEmptyItem; exports.isFormPanelType = _chunkFBZDJWT2js.isFormPanelType; exports.isInputGroup = _chunkFBZDJWT2js.isInputGroup; exports.isInputPanel = _chunkFBZDJWT2js.isInputPanel; exports.isInputType = _chunkFBZDJWT2js.isInputType; exports.isLocalDatasource = _chunkFBZDJWT2js.isLocalDatasource; exports.isReducer = _chunkFBZDJWT2js.isReducer; exports.isRow = _chunkFBZDJWT2js.isRow; exports.isSqlDatasource = _chunkFBZDJWT2js.isSqlDatasource; exports.layoutCanvas = _chunkFBZDJWT2js.layoutCanvas; exports.layoutDashboard = _chunkFBZDJWT2js.layoutDashboard; exports.lineColumn = _chunkFBZDJWT2js.lineColumn; exports.loadGazetteer = _chunkFBZDJWT2js.loadGazetteer; exports.locate = _chunkFBZDJWT2js.locate; exports.makeTemplate = _chunkFBZDJWT2js.makeTemplate; exports.manifestSchemaIssues = _chunkFBZDJWT2js.manifestSchemaIssues; exports.mappedResult = _chunkFBZDJWT2js.mappedResult; exports.mappingProblem = _chunkFBZDJWT2js.mappingProblem; exports.mappingRow = _chunkFBZDJWT2js.mappingRow; exports.mappingRows = _chunkFBZDJWT2js.mappingRows; exports.metricChanges = _chunkFBZDJWT2js.metricChanges; exports.movePanel = _chunkFBZDJWT2js.movePanel; exports.newDocument = _chunkFBZDJWT2js.newDocument; exports.newPanel = _chunkFBZDJWT2js.newPanel; exports.newSaveId = _chunkFBZDJWT2js.newSaveId; exports.newVariable = _chunkFBZDJWT2js.newVariable; exports.nextPanelId = _chunkFBZDJWT2js.nextPanelId; exports.normalizeRef = _chunkFBZDJWT2js.normalizeRef; exports.numberFields = _chunkFBZDJWT2js.numberFields; exports.optionValue = _chunkFBZDJWT2js.optionValue; exports.overrideProperties = _chunkFBZDJWT2js.overrideProperties; exports.panelEdits = _chunkFBZDJWT2js.panelEdits; exports.panelHasQueries = _chunkFBZDJWT2js.panelHasQueries; exports.panelKey = _chunkFBZDJWT2js.panelKey; exports.panelMetrics = _chunkFBZDJWT2js.panelMetrics; exports.panelOptions = _chunkFBZDJWT2js.panelOptions; exports.panelOverrides = _chunkFBZDJWT2js.panelOverrides; exports.panelSize = _chunkFBZDJWT2js.panelSize; exports.panelSpan = _chunkFBZDJWT2js.panelSpan; exports.parseClockDigits = _chunkFBZDJWT2js.parseClockDigits; exports.parseDashboardLink = _chunkFBZDJWT2js.parseDashboardLink; exports.parseDuration = _chunkFBZDJWT2js.parseDuration; exports.parseGazetteer = _chunkFBZDJWT2js.parseGazetteer; exports.parseJsonText = _chunkFBZDJWT2js.parseJsonText; exports.parseLocalDateTime = _chunkFBZDJWT2js.parseLocalDateTime; exports.parseRange = _chunkFBZDJWT2js.parseRange; exports.parseSnippet = _chunkFBZDJWT2js.parseSnippet; exports.parseTemplate = _chunkFBZDJWT2js.parseTemplate; exports.parseTime = _chunkFBZDJWT2js.parseTime; exports.pasteSnippet = _chunkFBZDJWT2js.pasteSnippet; exports.placePanel = _chunkFBZDJWT2js.placePanel; exports.plainInputPanels = _chunkFBZDJWT2js.plainInputPanels; exports.pointerToPath = _chunkFBZDJWT2js.pointerToPath; exports.prepareDashboard = _chunkFBZDJWT2js.prepareDashboard; exports.previewPaste = _chunkFBZDJWT2js.previewPaste; exports.queryPanel = _chunkFBZDJWT2js.queryPanel; exports.queryParam = _chunkFBZDJWT2js.queryParam; exports.readConfigFiles = _chunkFBZDJWT2js.readConfigFiles; exports.readingOrder = _chunkFBZDJWT2js.readingOrder; exports.reduce = _chunkFBZDJWT2js.reduce; exports.refineOptions = _chunkFBZDJWT2js.refineOptions; exports.refreshedVariables = _chunkFBZDJWT2js.refreshedVariables; exports.removeDocumentFromManifest = _chunkFBZDJWT2js.removeDocumentFromManifest; exports.removePanel = _chunkFBZDJWT2js.removePanel; exports.renameDocumentInManifest = _chunkFBZDJWT2js.renameDocumentInManifest; exports.renameMetrics = _chunkFBZDJWT2js.renameMetrics; exports.renameVariableInPanels = _chunkFBZDJWT2js.renameVariableInPanels; exports.repack = _chunkFBZDJWT2js.repack; exports.repeatOptions = _chunkFBZDJWT2js.repeatOptions; exports.resizePanel = _chunkFBZDJWT2js.resizePanel; exports.resolveColor = _chunkFBZDJWT2js.resolveColor; exports.resolveFieldConfig = _chunkFBZDJWT2js.resolveFieldConfig; exports.resolveLinks = _chunkFBZDJWT2js.resolveLinks; exports.resolveTimezone = _chunkFBZDJWT2js.resolveTimezone; exports.resolveUrl = _chunkFBZDJWT2js.resolveUrl; exports.resolveVariables = _chunkFBZDJWT2js.resolveVariables; exports.revalidateBundle = _chunkFBZDJWT2js.revalidateBundle; exports.rowsToMappings = _chunkFBZDJWT2js.rowsToMappings; exports.sameSave = _chunkFBZDJWT2js.sameSave; exports.sampleEntries = _chunkFBZDJWT2js.sampleEntries; exports.screenDocuments = _chunkFBZDJWT2js.screenDocuments; exports.screenOfType = _chunkFBZDJWT2js.screenOfType; exports.selectValue = _chunkFBZDJWT2js.selectValue; exports.seriesColor = _chunkFBZDJWT2js.seriesColor; exports.setHiddenOnPhones = _chunkFBZDJWT2js.setHiddenOnPhones; exports.setJsonValue = _chunkFBZDJWT2js.setJsonValue; exports.setOption = _chunkFBZDJWT2js.setOption; exports.setOptionValue = _chunkFBZDJWT2js.setOptionValue; exports.setOverrides = _chunkFBZDJWT2js.setOverrides; exports.settleLayout = _chunkFBZDJWT2js.settleLayout; exports.snapToGrid = _chunkFBZDJWT2js.snapToGrid; exports.splitPath = _chunkFBZDJWT2js.splitPath; exports.startOf = _chunkFBZDJWT2js.startOf; exports.stringifyCompact = _chunkFBZDJWT2js.stringifyCompact; exports.tabIdFor = _chunkFBZDJWT2js.tabIdFor; exports.templateNeeds = _chunkFBZDJWT2js.templateNeeds; exports.textSuggestions = _chunkFBZDJWT2js.textSuggestions; exports.thresholdStep = _chunkFBZDJWT2js.thresholdStep; exports.timeExprError = _chunkFBZDJWT2js.timeExprError; exports.timeField = _chunkFBZDJWT2js.timeField; exports.toEntries = _chunkFBZDJWT2js.toEntries; exports.toMillis = _chunkFBZDJWT2js.toMillis; exports.toSeries = _chunkFBZDJWT2js.toSeries; exports.toXYSeries = _chunkFBZDJWT2js.toXYSeries; exports.uniqueNames = _chunkFBZDJWT2js.uniqueNames; exports.validateBundle = _chunkFBZDJWT2js.validateBundle; exports.validateDashboard = _chunkFBZDJWT2js.validateDashboard; exports.validateManifest = _chunkFBZDJWT2js.validateManifest; exports.valueColor = _chunkFBZDJWT2js.valueColor; exports.valueText = _chunkFBZDJWT2js.valueText; exports.variableDependents = _chunkFBZDJWT2js.variableDependents; exports.variableInfo = _chunkFBZDJWT2js.variableInfo; exports.variableNameError = _chunkFBZDJWT2js.variableNameError; exports.variableOptions = _chunkFBZDJWT2js.variableOptions; exports.variableOrder = _chunkFBZDJWT2js.variableOrder; exports.variableReferences = _chunkFBZDJWT2js.variableReferences; exports.variableUses = _chunkFBZDJWT2js.variableUses; exports.variableWithCurrent = _chunkFBZDJWT2js.variableWithCurrent; exports.variableWithFlags = _chunkFBZDJWT2js.variableWithFlags; exports.variableWithQuery = _chunkFBZDJWT2js.variableWithQuery; exports.variableWithType = _chunkFBZDJWT2js.variableWithType; exports.visibleVariables = _chunkFBZDJWT2js.visibleVariables; exports.zoomRange = _chunkFBZDJWT2js.zoomRange;
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
exports.ALL = _chunkKJR3ZKG4js.ALL; exports.AUTHORING_GUIDE = _chunkKJR3ZKG4js.AUTHORING_GUIDE; exports.BUNDLE_ACCEPT = _chunkKJR3ZKG4js.BUNDLE_ACCEPT; exports.BUNDLE_TYPE = _chunkKJR3ZKG4js.BUNDLE_TYPE; exports.CANVAS_GAP = _chunkKJR3ZKG4js.CANVAS_GAP; exports.CANVAS_ROW_HEADER = _chunkKJR3ZKG4js.CANVAS_ROW_HEADER; exports.ConfigLoader = _chunkKJR3ZKG4js.ConfigLoader; exports.DASHBOARD_DS = _chunkKJR3ZKG4js.DASHBOARD_DS; exports.DEFAULT_GAZETTEER = _chunkKJR3ZKG4js.DEFAULT_GAZETTEER; exports.DOCUMENT_GUIDE = _chunkKJR3ZKG4js.DOCUMENT_GUIDE; exports.EDITABLE_VARIABLE_TYPES = _chunkKJR3ZKG4js.EDITABLE_VARIABLE_TYPES; exports.EXAMPLE_TEMPLATE = _chunkKJR3ZKG4js.EXAMPLE_TEMPLATE; exports.GRID_COLUMNS = _chunkKJR3ZKG4js.GRID_COLUMNS; exports.GROUP_FIELD_TYPES = _chunkKJR3ZKG4js.GROUP_FIELD_TYPES; exports.GrafanaClient = _chunkKJR3ZKG4js.GrafanaClient; exports.GrafanaDataSource = _chunkKJR3ZKG4js.GrafanaDataSource; exports.GrafanaError = _chunkKJR3ZKG4js.GrafanaError; exports.HttpConfigFiles = _chunkKJR3ZKG4js.HttpConfigFiles; exports.INPUT_GROUP = _chunkKJR3ZKG4js.INPUT_GROUP; exports.INPUT_OPTION_KEYS = _chunkKJR3ZKG4js.INPUT_OPTION_KEYS; exports.INPUT_TYPES = _chunkKJR3ZKG4js.INPUT_TYPES; exports.LOCAL_DATASOURCE_TYPE = _chunkKJR3ZKG4js.LOCAL_DATASOURCE_TYPE; exports.LocalDataSource = _chunkKJR3ZKG4js.LocalDataSource; exports.MANIFEST_VERSION = _chunkKJR3ZKG4js.MANIFEST_VERSION; exports.MAPPING_TYPES = _chunkKJR3ZKG4js.MAPPING_TYPES; exports.MemoryEntryStore = _chunkKJR3ZKG4js.MemoryEntryStore; exports.NAMED_COLORS = _chunkKJR3ZKG4js.NAMED_COLORS; exports.OPTION_CATEGORIES = _chunkKJR3ZKG4js.OPTION_CATEGORIES; exports.OVERRIDE_MATCHERS = _chunkKJR3ZKG4js.OVERRIDE_MATCHERS; exports.PANEL_TYPES = _chunkKJR3ZKG4js.PANEL_TYPES; exports.REDUCER_LABELS = _chunkKJR3ZKG4js.REDUCER_LABELS; exports.REFRESH_CHOICES = _chunkKJR3ZKG4js.REFRESH_CHOICES; exports.RELATIVE_RANGES = _chunkKJR3ZKG4js.RELATIVE_RANGES; exports.SERIES_PALETTE = _chunkKJR3ZKG4js.SERIES_PALETTE; exports.SNIPPET_VERSION = _chunkKJR3ZKG4js.SNIPPET_VERSION; exports.SPECIAL_MATCHES = _chunkKJR3ZKG4js.SPECIAL_MATCHES; exports.SaveConflictError = _chunkKJR3ZKG4js.SaveConflictError; exports.TEMPLATE_VERSION = _chunkKJR3ZKG4js.TEMPLATE_VERSION; exports.TIME_PRESETS = _chunkKJR3ZKG4js.TIME_PRESETS; exports.UNIT_CHOICES = _chunkKJR3ZKG4js.UNIT_CHOICES; exports.addTime = _chunkKJR3ZKG4js.addTime; exports.appSchema = _chunkKJR3ZKG4js.appSchema; exports.applyDashboardLink = _chunkKJR3ZKG4js.applyDashboardLink; exports.applyJsonEdits = _chunkKJR3ZKG4js.applyJsonEdits; exports.applyTemplate = _chunkKJR3ZKG4js.applyTemplate; exports.applyTransformations = _chunkKJR3ZKG4js.applyTransformations; exports.assembleBundle = _chunkKJR3ZKG4js.assembleBundle; exports.assembleFromResponse = _chunkKJR3ZKG4js.assembleFromResponse; exports.buildFrames = _chunkKJR3ZKG4js.buildFrames; exports.bundleFromFiles = _chunkKJR3ZKG4js.bundleFromFiles; exports.bundleRoot = _chunkKJR3ZKG4js.bundleRoot; exports.calculateInterval = _chunkKJR3ZKG4js.calculateInterval; exports.checkFiles = _chunkKJR3ZKG4js.checkFiles; exports.cleanDashboard = _chunkKJR3ZKG4js.cleanDashboard; exports.cleanPanelOptions = _chunkKJR3ZKG4js.cleanPanelOptions; exports.collapseRow = _chunkKJR3ZKG4js.collapseRow; exports.compactGrid = _chunkKJR3ZKG4js.compactGrid; exports.copyPanels = _chunkKJR3ZKG4js.copyPanels; exports.dashboardSchema = _chunkKJR3ZKG4js.dashboardSchema; exports.dashboardSchemaIssues = _chunkKJR3ZKG4js.dashboardSchemaIssues; exports.dashboardSourceIds = _chunkKJR3ZKG4js.dashboardSourceIds; exports.defaultFetchJson = _chunkKJR3ZKG4js.defaultFetchJson; exports.describeRange = _chunkKJR3ZKG4js.describeRange; exports.diffJson = _chunkKJR3ZKG4js.diffJson; exports.documentChanges = _chunkKJR3ZKG4js.documentChanges; exports.documentIdFor = _chunkKJR3ZKG4js.documentIdFor; exports.documentKind = _chunkKJR3ZKG4js.documentKind; exports.documentPrompt = _chunkKJR3ZKG4js.documentPrompt; exports.documentUses = _chunkKJR3ZKG4js.documentUses; exports.dropTarget = _chunkKJR3ZKG4js.dropTarget; exports.duplicatePanel = _chunkKJR3ZKG4js.duplicatePanel; exports.entriesSavedWith = _chunkKJR3ZKG4js.entriesSavedWith; exports.entriesToItems = _chunkKJR3ZKG4js.entriesToItems; exports.entryToInputValue = _chunkKJR3ZKG4js.entryToInputValue; exports.expandRow = _chunkKJR3ZKG4js.expandRow; exports.fetchBundle = _chunkKJR3ZKG4js.fetchBundle; exports.fetchJsonWithToken = _chunkKJR3ZKG4js.fetchJsonWithToken; exports.fieldDisplayName = _chunkKJR3ZKG4js.fieldDisplayName; exports.fieldMatches = _chunkKJR3ZKG4js.fieldMatches; exports.fixDocumentPrompt = _chunkKJR3ZKG4js.fixDocumentPrompt; exports.fixTemplatePrompt = _chunkKJR3ZKG4js.fixTemplatePrompt; exports.formatClock = _chunkKJR3ZKG4js.formatClock; exports.formatDisplay = _chunkKJR3ZKG4js.formatDisplay; exports.formatDuration = _chunkKJR3ZKG4js.formatDuration; exports.formatJsonText = _chunkKJR3ZKG4js.formatJsonText; exports.formatLocalDateTime = _chunkKJR3ZKG4js.formatLocalDateTime; exports.formatValue = _chunkKJR3ZKG4js.formatValue; exports.frameLength = _chunkKJR3ZKG4js.frameLength; exports.framesToOptions = _chunkKJR3ZKG4js.framesToOptions; exports.fromWire = _chunkKJR3ZKG4js.fromWire; exports.getPath = _chunkKJR3ZKG4js.getPath; exports.gridOffsetPx = _chunkKJR3ZKG4js.gridOffsetPx; exports.gridUnitsToPx = _chunkKJR3ZKG4js.gridUnitsToPx; exports.groupField = _chunkKJR3ZKG4js.groupField; exports.groupFields = _chunkKJR3ZKG4js.groupFields; exports.groupProblems = _chunkKJR3ZKG4js.groupProblems; exports.groupToEntries = _chunkKJR3ZKG4js.groupToEntries; exports.httpFetchJson = _chunkKJR3ZKG4js.httpFetchJson; exports.initialVariableValues = _chunkKJR3ZKG4js.initialVariableValues; exports.inputGroups = _chunkKJR3ZKG4js.inputGroups; exports.inputPanels = _chunkKJR3ZKG4js.inputPanels; exports.inputProblem = _chunkKJR3ZKG4js.inputProblem; exports.insertPanel = _chunkKJR3ZKG4js.insertPanel; exports.interpolate = _chunkKJR3ZKG4js.interpolate; exports.interpolateDeep = _chunkKJR3ZKG4js.interpolateDeep; exports.isBundleResponse = _chunkKJR3ZKG4js.isBundleResponse; exports.isEditableVariableType = _chunkKJR3ZKG4js.isEditableVariableType; exports.isEmptyItem = _chunkKJR3ZKG4js.isEmptyItem; exports.isFormPanelType = _chunkKJR3ZKG4js.isFormPanelType; exports.isInputGroup = _chunkKJR3ZKG4js.isInputGroup; exports.isInputPanel = _chunkKJR3ZKG4js.isInputPanel; exports.isInputType = _chunkKJR3ZKG4js.isInputType; exports.isLocalDatasource = _chunkKJR3ZKG4js.isLocalDatasource; exports.isReducer = _chunkKJR3ZKG4js.isReducer; exports.isRow = _chunkKJR3ZKG4js.isRow; exports.isSqlDatasource = _chunkKJR3ZKG4js.isSqlDatasource; exports.jsonFromAnswer = _chunkKJR3ZKG4js.jsonFromAnswer; exports.layoutCanvas = _chunkKJR3ZKG4js.layoutCanvas; exports.layoutDashboard = _chunkKJR3ZKG4js.layoutDashboard; exports.lineColumn = _chunkKJR3ZKG4js.lineColumn; exports.loadGazetteer = _chunkKJR3ZKG4js.loadGazetteer; exports.locate = _chunkKJR3ZKG4js.locate; exports.makeTemplate = _chunkKJR3ZKG4js.makeTemplate; exports.manifestSchemaIssues = _chunkKJR3ZKG4js.manifestSchemaIssues; exports.mappedResult = _chunkKJR3ZKG4js.mappedResult; exports.mappingProblem = _chunkKJR3ZKG4js.mappingProblem; exports.mappingRow = _chunkKJR3ZKG4js.mappingRow; exports.mappingRows = _chunkKJR3ZKG4js.mappingRows; exports.metricChanges = _chunkKJR3ZKG4js.metricChanges; exports.movePanel = _chunkKJR3ZKG4js.movePanel; exports.newDocument = _chunkKJR3ZKG4js.newDocument; exports.newPanel = _chunkKJR3ZKG4js.newPanel; exports.newSaveId = _chunkKJR3ZKG4js.newSaveId; exports.newVariable = _chunkKJR3ZKG4js.newVariable; exports.nextPanelId = _chunkKJR3ZKG4js.nextPanelId; exports.normalizeRef = _chunkKJR3ZKG4js.normalizeRef; exports.numberFields = _chunkKJR3ZKG4js.numberFields; exports.optionValue = _chunkKJR3ZKG4js.optionValue; exports.overrideProperties = _chunkKJR3ZKG4js.overrideProperties; exports.panelEdits = _chunkKJR3ZKG4js.panelEdits; exports.panelHasQueries = _chunkKJR3ZKG4js.panelHasQueries; exports.panelKey = _chunkKJR3ZKG4js.panelKey; exports.panelMetrics = _chunkKJR3ZKG4js.panelMetrics; exports.panelOptions = _chunkKJR3ZKG4js.panelOptions; exports.panelOverrides = _chunkKJR3ZKG4js.panelOverrides; exports.panelSize = _chunkKJR3ZKG4js.panelSize; exports.panelSpan = _chunkKJR3ZKG4js.panelSpan; exports.parseClockDigits = _chunkKJR3ZKG4js.parseClockDigits; exports.parseDashboardLink = _chunkKJR3ZKG4js.parseDashboardLink; exports.parseDuration = _chunkKJR3ZKG4js.parseDuration; exports.parseGazetteer = _chunkKJR3ZKG4js.parseGazetteer; exports.parseJsonText = _chunkKJR3ZKG4js.parseJsonText; exports.parseLocalDateTime = _chunkKJR3ZKG4js.parseLocalDateTime; exports.parseRange = _chunkKJR3ZKG4js.parseRange; exports.parseSnippet = _chunkKJR3ZKG4js.parseSnippet; exports.parseTemplate = _chunkKJR3ZKG4js.parseTemplate; exports.parseTime = _chunkKJR3ZKG4js.parseTime; exports.pasteSnippet = _chunkKJR3ZKG4js.pasteSnippet; exports.placePanel = _chunkKJR3ZKG4js.placePanel; exports.plainInputPanels = _chunkKJR3ZKG4js.plainInputPanels; exports.pointerToPath = _chunkKJR3ZKG4js.pointerToPath; exports.prepareDashboard = _chunkKJR3ZKG4js.prepareDashboard; exports.previewPaste = _chunkKJR3ZKG4js.previewPaste; exports.queryPanel = _chunkKJR3ZKG4js.queryPanel; exports.queryParam = _chunkKJR3ZKG4js.queryParam; exports.readConfigFiles = _chunkKJR3ZKG4js.readConfigFiles; exports.readDocumentAnswer = _chunkKJR3ZKG4js.readDocumentAnswer; exports.readTemplateAnswer = _chunkKJR3ZKG4js.readTemplateAnswer; exports.readingOrder = _chunkKJR3ZKG4js.readingOrder; exports.reduce = _chunkKJR3ZKG4js.reduce; exports.refineOptions = _chunkKJR3ZKG4js.refineOptions; exports.refreshedVariables = _chunkKJR3ZKG4js.refreshedVariables; exports.removeDocumentFromManifest = _chunkKJR3ZKG4js.removeDocumentFromManifest; exports.removePanel = _chunkKJR3ZKG4js.removePanel; exports.renameDocumentInManifest = _chunkKJR3ZKG4js.renameDocumentInManifest; exports.renameMetrics = _chunkKJR3ZKG4js.renameMetrics; exports.renameVariableInPanels = _chunkKJR3ZKG4js.renameVariableInPanels; exports.repack = _chunkKJR3ZKG4js.repack; exports.repeatOptions = _chunkKJR3ZKG4js.repeatOptions; exports.resizePanel = _chunkKJR3ZKG4js.resizePanel; exports.resolveColor = _chunkKJR3ZKG4js.resolveColor; exports.resolveFieldConfig = _chunkKJR3ZKG4js.resolveFieldConfig; exports.resolveLinks = _chunkKJR3ZKG4js.resolveLinks; exports.resolveTimezone = _chunkKJR3ZKG4js.resolveTimezone; exports.resolveUrl = _chunkKJR3ZKG4js.resolveUrl; exports.resolveVariables = _chunkKJR3ZKG4js.resolveVariables; exports.revalidateBundle = _chunkKJR3ZKG4js.revalidateBundle; exports.rowsToMappings = _chunkKJR3ZKG4js.rowsToMappings; exports.sameSave = _chunkKJR3ZKG4js.sameSave; exports.sampleEntries = _chunkKJR3ZKG4js.sampleEntries; exports.screenDocuments = _chunkKJR3ZKG4js.screenDocuments; exports.screenOfType = _chunkKJR3ZKG4js.screenOfType; exports.selectValue = _chunkKJR3ZKG4js.selectValue; exports.seriesColor = _chunkKJR3ZKG4js.seriesColor; exports.setHiddenOnPhones = _chunkKJR3ZKG4js.setHiddenOnPhones; exports.setJsonValue = _chunkKJR3ZKG4js.setJsonValue; exports.setOption = _chunkKJR3ZKG4js.setOption; exports.setOptionValue = _chunkKJR3ZKG4js.setOptionValue; exports.setOverrides = _chunkKJR3ZKG4js.setOverrides; exports.settleLayout = _chunkKJR3ZKG4js.settleLayout; exports.snapToGrid = _chunkKJR3ZKG4js.snapToGrid; exports.splitPath = _chunkKJR3ZKG4js.splitPath; exports.startOf = _chunkKJR3ZKG4js.startOf; exports.stringifyCompact = _chunkKJR3ZKG4js.stringifyCompact; exports.tabIdFor = _chunkKJR3ZKG4js.tabIdFor; exports.templateNeeds = _chunkKJR3ZKG4js.templateNeeds; exports.templatePrompt = _chunkKJR3ZKG4js.templatePrompt; exports.textSuggestions = _chunkKJR3ZKG4js.textSuggestions; exports.thresholdStep = _chunkKJR3ZKG4js.thresholdStep; exports.timeExprError = _chunkKJR3ZKG4js.timeExprError; exports.timeField = _chunkKJR3ZKG4js.timeField; exports.toEntries = _chunkKJR3ZKG4js.toEntries; exports.toMillis = _chunkKJR3ZKG4js.toMillis; exports.toSeries = _chunkKJR3ZKG4js.toSeries; exports.toXYSeries = _chunkKJR3ZKG4js.toXYSeries; exports.uniqueNames = _chunkKJR3ZKG4js.uniqueNames; exports.validateBundle = _chunkKJR3ZKG4js.validateBundle; exports.validateDashboard = _chunkKJR3ZKG4js.validateDashboard; exports.validateManifest = _chunkKJR3ZKG4js.validateManifest; exports.valueColor = _chunkKJR3ZKG4js.valueColor; exports.valueText = _chunkKJR3ZKG4js.valueText; exports.variableDependents = _chunkKJR3ZKG4js.variableDependents; exports.variableInfo = _chunkKJR3ZKG4js.variableInfo; exports.variableNameError = _chunkKJR3ZKG4js.variableNameError; exports.variableOptions = _chunkKJR3ZKG4js.variableOptions; exports.variableOrder = _chunkKJR3ZKG4js.variableOrder; exports.variableReferences = _chunkKJR3ZKG4js.variableReferences; exports.variableUses = _chunkKJR3ZKG4js.variableUses; exports.variableWithCurrent = _chunkKJR3ZKG4js.variableWithCurrent; exports.variableWithFlags = _chunkKJR3ZKG4js.variableWithFlags; exports.variableWithQuery = _chunkKJR3ZKG4js.variableWithQuery; exports.variableWithType = _chunkKJR3ZKG4js.variableWithType; exports.visibleVariables = _chunkKJR3ZKG4js.visibleVariables; exports.zoomRange = _chunkKJR3ZKG4js.zoomRange;
|