derive-dashboards 0.2.0 → 0.4.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 +4 -0
- package/dist/cache.mjs +2 -1
- package/dist/cli/add.mjs +1 -1
- package/dist/cli/doctor.mjs +39 -24
- package/dist/core/document/display.d.mts +63 -0
- package/dist/core/document/display.mjs +139 -0
- package/dist/core/engine/version.d.mts +5 -4
- package/dist/core/engine/version.mjs +5 -4
- package/dist/core/error/codes.d.mts +2 -0
- package/dist/core/error/codes.mjs +2 -0
- package/dist/core/index.d.mts +9 -7
- package/dist/core/index.mjs +7 -5
- package/dist/core/model/validate/drill.mjs +6 -15
- package/dist/core/model/validate/fields.mjs +130 -0
- package/dist/core/model/validate/index.mjs +11 -3
- package/dist/core/model/validate/known-members.mjs +133 -0
- package/dist/core/model/validate/known-nested.mjs +85 -0
- package/dist/core/model/validate/known.mjs +94 -0
- package/dist/core/model/validate/source.mjs +8 -1
- package/dist/core/query/alias.mjs +11 -1
- package/dist/core/query/drill/selection.d.mts +7 -2
- package/dist/core/query/drill/selection.mjs +18 -15
- package/dist/core/result/columns.d.mts +10 -1
- package/dist/core/result/columns.mjs +21 -2
- package/dist/core/result/time-axis.d.mts +23 -0
- package/dist/core/result/time-axis.mjs +72 -0
- package/dist/core/result/types.d.mts +36 -1
- package/dist/core/schema/answer-parts.mjs +23 -1
- package/dist/core/schema/answers.d.mts +203 -0
- package/dist/core/schema/answers.mjs +1 -0
- package/dist/core/schema/tools.d.mts +2 -0
- package/dist/core/schema/tools.mjs +27 -1
- package/dist/core/time/bucket.mjs +8 -2
- package/dist/core/types/api.d.mts +1 -1
- package/dist/core/types/api.mjs +1 -1
- package/dist/drill-change.mjs +1 -1
- package/dist/drill-seal.mjs +1 -0
- package/dist/endpoints/index.d.mts +3 -0
- package/dist/execute.mjs +13 -7
- package/dist/index.mjs +6 -1
- package/dist/react/Dashboard.d.mts +4 -0
- package/dist/react/Dashboard.mjs +12 -1
- package/dist/react/Tile.mjs +11 -4
- package/dist/react/context.d.mts +2 -1
- package/dist/react/drill/Bars.mjs +2 -2
- package/dist/react/drill/props.mjs +2 -1
- package/dist/react/format.d.mts +6 -0
- package/dist/react/format.mjs +24 -18
- package/dist/react/index.d.mts +8 -4
- package/dist/react/index.mjs +8 -5
- package/dist/react/renderers/index.d.mts +9 -21
- package/dist/react/renderers/index.mjs +10 -7
- package/dist/react/renderers/list.d.mts +2 -1
- package/dist/react/renderers/list.mjs +8 -11
- package/dist/react/renderers/props.d.mts +26 -0
- package/dist/react/scope.d.mts +4 -0
- package/dist/react/scope.mjs +19 -2
- package/dist/react/series-points.d.mts +18 -0
- package/dist/react/series-points.mjs +19 -0
- package/dist/react/series-slots.d.mts +37 -0
- package/dist/react/series-slots.mjs +71 -0
- package/dist/react/series.d.mts +22 -12
- package/dist/react/series.mjs +80 -82
- package/dist/recharts/bar.mjs +5 -4
- package/dist/recharts/line.mjs +5 -4
- package/dist/recharts/parts.mjs +29 -14
- package/dist/recharts/table.mjs +10 -8
- package/dist/skills/derive-dashboards/SKILL.md +1 -1
- package/dist/store/apply.mjs +3 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -72,6 +72,10 @@ Strongest first. [AGENTS.md](https://github.com/derive-to/dashboards/blob/main/A
|
|
|
72
72
|
tile at p95.
|
|
73
73
|
6. **Example tests**: one case per validation rule, endpoint and adapter.
|
|
74
74
|
|
|
75
|
+
On top of the checks, six audits (engineering, developer experience, UX, performance and
|
|
76
|
+
build against spec, twice) grade every PR against a fixed bar of the best open-source projects.
|
|
77
|
+
To run one, ask your coding agent for `/full-audit pr <n>`; see [how to run an audit](https://github.com/derive-to/dashboards/blob/main/docs/audits/README.md).
|
|
78
|
+
|
|
75
79
|
Dates and time zones use TC39 Temporal with the IANA zone database: buckets, ranges and
|
|
76
80
|
comparisons are checked in nine zones chosen for their daylight-saving and offset quirks, and
|
|
77
81
|
on hand-worked New York clock-change days.
|
package/dist/cache.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { entriesIn, memoryStorage } from "./storage.mjs";
|
|
2
|
-
import { bindPolicy, canonical, namedPolicy, policyBinding, principalTenant, queryClosure, viaJoins } from "derive-dashboards/core";
|
|
2
|
+
import { CONTRACT_VERSION, bindPolicy, canonical, namedPolicy, policyBinding, principalTenant, queryClosure, viaJoins } from "derive-dashboards/core";
|
|
3
3
|
import { ENGINE_VERSION } from "derive-dashboards/core/engine";
|
|
4
4
|
// src/cache.ts
|
|
5
5
|
async function sha256(text) {
|
|
@@ -73,6 +73,7 @@ var ResultCache = class {
|
|
|
73
73
|
const relative = k.query.time !== void 0 && "last" in k.query.time.range;
|
|
74
74
|
const parts = {
|
|
75
75
|
v: ENGINE_VERSION,
|
|
76
|
+
contract: CONTRACT_VERSION,
|
|
76
77
|
model: await this.#modelHash,
|
|
77
78
|
tenant,
|
|
78
79
|
policy: boundPolicies(this.#options.model, k.principal, k.sources),
|
package/dist/cli/add.mjs
CHANGED
|
@@ -36,7 +36,7 @@ function notAnApp(cwd) {
|
|
|
36
36
|
const react = installedReact(cwd) ?? deps["react"];
|
|
37
37
|
if (react === void 0) return `${file} does not list react. The filter bar is a React component.`;
|
|
38
38
|
const major = /(\d+)/u.exec(react)?.[1];
|
|
39
|
-
if (major !== void 0 && Number(major) < 19) return `The filter bar needs React 19; ${file} has react ${react}. Upgrade React, or keep the built-in bar.`;
|
|
39
|
+
if (major !== void 0 && Number(major) < 19) return `The copied filter bar needs React 19 (its components take ref as a prop); ${file} has react ${react}. Upgrade React, or keep the built-in bar, which runs on React 18.3 too.`;
|
|
40
40
|
}
|
|
41
41
|
/** The shadcn bases the copied bar is written for: its triggers render as plain buttons on both. */
|
|
42
42
|
const BASES = /* @__PURE__ */ new Set(["radix", "base"]);
|
package/dist/cli/doctor.mjs
CHANGED
|
@@ -27,7 +27,40 @@ function versionOf(cwd, name, listed) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
const plural = (n, word) => `${String(n)} ${word}${n === 1 ? "" : "s"}`;
|
|
30
|
-
|
|
30
|
+
/** A version's major and minor, as numbers: "^18.3.1" is [18, 3]. */
|
|
31
|
+
function majorMinor(version) {
|
|
32
|
+
const found = /(\d+)(?:\.(\d+))?/u.exec(version);
|
|
33
|
+
return [Number(found?.[1] ?? "0"), Number(found?.[2] ?? "0")];
|
|
34
|
+
}
|
|
35
|
+
const PEERS = [
|
|
36
|
+
{
|
|
37
|
+
name: "react",
|
|
38
|
+
from: [18, 3],
|
|
39
|
+
to: 19,
|
|
40
|
+
by: "derive-dashboards/react"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "react-dom",
|
|
44
|
+
from: [18, 3],
|
|
45
|
+
to: 19,
|
|
46
|
+
by: "derive-dashboards/react"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "recharts",
|
|
50
|
+
from: [3, 0],
|
|
51
|
+
to: 3,
|
|
52
|
+
by: "derive-dashboards/recharts (the built-in charts)"
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
/** A peer's installed version against what the library runs on. */
|
|
56
|
+
function peerFinding(peer, version) {
|
|
57
|
+
const [major, minor] = majorMinor(version);
|
|
58
|
+
const [fromMajor, fromMinor] = peer.from;
|
|
59
|
+
const older = major < fromMajor || major === fromMajor && minor < fromMinor;
|
|
60
|
+
if (!older && major <= peer.to) return ok(`${peer.name} ${version}`);
|
|
61
|
+
const what = older ? `older than ${peer.by} needs` : `newer than the major ${peer.by} is built for`;
|
|
62
|
+
return bad(`${peer.name} ${version} is ${what}`, `npm install ${peer.name}@^${String(peer.to)}`);
|
|
63
|
+
}
|
|
31
64
|
/** The app's own dependencies, as its package.json lists them; undefined with no package.json. */
|
|
32
65
|
function dependenciesOf(cwd) {
|
|
33
66
|
const file = join(cwd, "package.json");
|
|
@@ -38,33 +71,15 @@ function dependenciesOf(cwd) {
|
|
|
38
71
|
...manifest.dependencies
|
|
39
72
|
};
|
|
40
73
|
}
|
|
41
|
-
/** The peers the React parts need, at the
|
|
74
|
+
/** The peers the React parts need, at the versions they run on, each when it is used. */
|
|
42
75
|
function peers(cwd) {
|
|
43
76
|
const deps = dependenciesOf(cwd);
|
|
44
77
|
if (deps === void 0) return [bad("No package.json here", "Run this in your app's folder.")];
|
|
45
78
|
if (deps["derive-dashboards"] === void 0) return [bad("derive-dashboards is not installed", "npm install derive-dashboards")];
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"derive-dashboards/react"
|
|
51
|
-
],
|
|
52
|
-
[
|
|
53
|
-
"react-dom",
|
|
54
|
-
19,
|
|
55
|
-
"derive-dashboards/react"
|
|
56
|
-
],
|
|
57
|
-
[
|
|
58
|
-
"recharts",
|
|
59
|
-
3,
|
|
60
|
-
"derive-dashboards/recharts (the built-in charts)"
|
|
61
|
-
]
|
|
62
|
-
].flatMap(([name, want, by]) => {
|
|
63
|
-
const version = versionOf(cwd, name, deps);
|
|
64
|
-
if (version === void 0) return name === "react" ? [ok("No React: server only")] : [];
|
|
65
|
-
if (major(version) === want) return [ok(`${name} ${version}`)];
|
|
66
|
-
const what = major(version) < want ? `older than ${by} needs` : `newer than the major ${by} is built for`;
|
|
67
|
-
return [bad(`${name} ${version} is ${what}`, `npm install ${name}@^${String(want)}`)];
|
|
79
|
+
return PEERS.flatMap((peer) => {
|
|
80
|
+
const version = versionOf(cwd, peer.name, deps);
|
|
81
|
+
if (version === void 0) return peer.name === "react" ? [ok("No React: server only")] : [];
|
|
82
|
+
return [peerFinding(peer, version)];
|
|
68
83
|
});
|
|
69
84
|
}
|
|
70
85
|
/** The shadcn base, when the app has components.json: one the copied filter bar is written for. */
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Issue } from "../types/primitives.mjs";
|
|
2
|
+
import { Doc } from "./types.mjs";
|
|
3
|
+
type ValueOf<T> = T extends "boolean" ? boolean : T extends "text" ? string : T extends "texts" ? readonly string[] : Readonly<Record<string, string>>;
|
|
4
|
+
/** The options of each kind of widget the library draws, and each option's type. */
|
|
5
|
+
export declare const DISPLAY_OPTIONS: {
|
|
6
|
+
readonly number: {
|
|
7
|
+
readonly keepDateRange: "boolean";
|
|
8
|
+
readonly empty: "text";
|
|
9
|
+
};
|
|
10
|
+
readonly table: {
|
|
11
|
+
readonly keepDateRange: "boolean";
|
|
12
|
+
readonly empty: "text";
|
|
13
|
+
};
|
|
14
|
+
readonly list: {
|
|
15
|
+
readonly title: "text";
|
|
16
|
+
readonly subtitle: "texts";
|
|
17
|
+
readonly avatar: "text";
|
|
18
|
+
readonly meta: "text";
|
|
19
|
+
readonly href: "text";
|
|
20
|
+
readonly keepDateRange: "boolean";
|
|
21
|
+
readonly empty: "text";
|
|
22
|
+
};
|
|
23
|
+
readonly line: {
|
|
24
|
+
readonly colors: "colors";
|
|
25
|
+
readonly keepDateRange: "boolean";
|
|
26
|
+
readonly empty: "text";
|
|
27
|
+
};
|
|
28
|
+
readonly bar: {
|
|
29
|
+
readonly colors: "colors";
|
|
30
|
+
readonly keepDateRange: "boolean";
|
|
31
|
+
readonly empty: "text";
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/** What each option does, for the builder and for an agent reading a tool definition. */
|
|
35
|
+
export declare const DISPLAY_HELP: Readonly<Record<string, string>>;
|
|
36
|
+
/** A kind of widget the library draws. A host's own kind is not here: its options are its own. */
|
|
37
|
+
export type DisplayKind = keyof typeof DISPLAY_OPTIONS;
|
|
38
|
+
/** The options a kind of widget reads, each of its type. */
|
|
39
|
+
export type DisplayOf<K extends DisplayKind> = { readonly [P in keyof (typeof DISPLAY_OPTIONS)[K]]?: ValueOf<(typeof DISPLAY_OPTIONS)[K][P]>; };
|
|
40
|
+
/**
|
|
41
|
+
* What is wrong with a widget's display for its kind: each option of the wrong type, at its
|
|
42
|
+
* path. None for a kind the library does not draw, and none for an option it does not know.
|
|
43
|
+
*/
|
|
44
|
+
export declare function displayIssues(kind: string, display: unknown, path?: Issue["path"]): Issue[];
|
|
45
|
+
/** Every widget of a document whose display does not fit its kind, at `widgets.<id>.display`. */
|
|
46
|
+
export declare function documentDisplayIssues(doc: Doc): Issue[];
|
|
47
|
+
/**
|
|
48
|
+
* A widget's options as its kind reads them: each option it knows, when it is of its type. A
|
|
49
|
+
* stored option of the wrong type (written before options were checked, or by hand) is left
|
|
50
|
+
* out, never guessed at, so a renderer needs no check of its own; of a map of colours, the
|
|
51
|
+
* colours that are text are kept.
|
|
52
|
+
*/
|
|
53
|
+
export declare function displayOf<K extends DisplayKind>(kind: K, display: unknown): DisplayOf<K>;
|
|
54
|
+
/**
|
|
55
|
+
* What an edit did wrong to a display: each option of the wrong type that the edit set or
|
|
56
|
+
* changed, at `widgets.<id>.display.<option>`. Only what the edit touched is checked: an option
|
|
57
|
+
* stored before options were typed stays as it is, so it never blocks an edit of something
|
|
58
|
+
* else, and replaying a draft's own commands never refuses one that was accepted.
|
|
59
|
+
*/
|
|
60
|
+
export declare function editedDisplayIssues(before: Doc, after: Doc): Issue[];
|
|
61
|
+
/** The options every widget takes, whatever draws it: `keepDateRange` and `empty`. */
|
|
62
|
+
export declare const sharedDisplay: (display: unknown) => DisplayOf<"table">;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { canonical } from "../value/canonical.mjs";
|
|
2
|
+
// src/document/display.ts
|
|
3
|
+
/** Options every widget takes. */
|
|
4
|
+
const SHARED = {
|
|
5
|
+
keepDateRange: "boolean",
|
|
6
|
+
empty: "text"
|
|
7
|
+
};
|
|
8
|
+
const CHART = {
|
|
9
|
+
...SHARED,
|
|
10
|
+
colors: "colors"
|
|
11
|
+
};
|
|
12
|
+
/** The options of each kind of widget the library draws, and each option's type. */
|
|
13
|
+
const DISPLAY_OPTIONS = {
|
|
14
|
+
number: SHARED,
|
|
15
|
+
table: SHARED,
|
|
16
|
+
list: {
|
|
17
|
+
...SHARED,
|
|
18
|
+
title: "text",
|
|
19
|
+
subtitle: "texts",
|
|
20
|
+
avatar: "text",
|
|
21
|
+
meta: "text",
|
|
22
|
+
href: "text"
|
|
23
|
+
},
|
|
24
|
+
line: CHART,
|
|
25
|
+
bar: CHART
|
|
26
|
+
};
|
|
27
|
+
/** What each option does, for the builder and for an agent reading a tool definition. */
|
|
28
|
+
const DISPLAY_HELP = {
|
|
29
|
+
keepDateRange: "Keep the widget's own date range over the viewer's and the dashboard's.",
|
|
30
|
+
empty: "What the tile says when its answer has no rows.",
|
|
31
|
+
colors: "A colour per series, by the series' label: any CSS colour.",
|
|
32
|
+
title: "The query entry shown as the row's title.",
|
|
33
|
+
subtitle: "Query entries shown under the title, joined with a dot.",
|
|
34
|
+
avatar: "The query entry whose initials make the row's avatar.",
|
|
35
|
+
meta: "The query entry shown as the number at the end of the row.",
|
|
36
|
+
href: "A link per row, with {entry} replaced by that entry's value: \"/tasks/{id}\"."
|
|
37
|
+
};
|
|
38
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
39
|
+
const isText = (value) => typeof value === "string";
|
|
40
|
+
const TYPES = {
|
|
41
|
+
boolean: {
|
|
42
|
+
fits: (v) => typeof v === "boolean",
|
|
43
|
+
takes: "true or false"
|
|
44
|
+
},
|
|
45
|
+
text: {
|
|
46
|
+
fits: isText,
|
|
47
|
+
takes: "text"
|
|
48
|
+
},
|
|
49
|
+
texts: {
|
|
50
|
+
fits: (v) => Array.isArray(v) && v.every((entry) => isText(entry)),
|
|
51
|
+
takes: "a list of texts"
|
|
52
|
+
},
|
|
53
|
+
colors: {
|
|
54
|
+
fits: (v) => isRecord(v) && Object.values(v).every((color) => isText(color)),
|
|
55
|
+
takes: "a colour for each series label, as text",
|
|
56
|
+
read: (v) => isRecord(v) ? Object.fromEntries(Object.entries(v).filter(([, color]) => isText(color))) : void 0
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
/** The part of a stored option a renderer can use: all of it when it is of its type, else what `read` keeps. */
|
|
60
|
+
function usable(type, value) {
|
|
61
|
+
const rule = TYPES[type];
|
|
62
|
+
return rule.fits(value) ? value : rule.read?.(value);
|
|
63
|
+
}
|
|
64
|
+
/** A kind's options by name; none for a kind the library does not draw. */
|
|
65
|
+
function optionsOf(kind) {
|
|
66
|
+
return Object.hasOwn(DISPLAY_OPTIONS, kind) ? DISPLAY_OPTIONS[kind] : void 0;
|
|
67
|
+
}
|
|
68
|
+
/** The options a display sets that are not of their type, by name. */
|
|
69
|
+
function misfits(options, display) {
|
|
70
|
+
return Object.entries(options).filter(([name, type]) => display[name] !== void 0 && !TYPES[type].fits(display[name]));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* What is wrong with a widget's display for its kind: each option of the wrong type, at its
|
|
74
|
+
* path. None for a kind the library does not draw, and none for an option it does not know.
|
|
75
|
+
*/
|
|
76
|
+
function displayIssues(kind, display, path = []) {
|
|
77
|
+
const options = optionsOf(kind);
|
|
78
|
+
if (display === void 0 || options === void 0) return [];
|
|
79
|
+
if (!isRecord(display)) return [{
|
|
80
|
+
code: "DISPLAY_INVALID",
|
|
81
|
+
message: "display is an object of options.",
|
|
82
|
+
path
|
|
83
|
+
}];
|
|
84
|
+
return misfits(options, display).map(([name, type]) => ({
|
|
85
|
+
code: "DISPLAY_INVALID",
|
|
86
|
+
message: `A ${kind}'s ${name} is ${TYPES[type].takes}.`,
|
|
87
|
+
path: [...path, name]
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
/** Every widget of a document whose display does not fit its kind, at `widgets.<id>.display`. */
|
|
91
|
+
function documentDisplayIssues(doc) {
|
|
92
|
+
return Object.entries(doc.widgets).flatMap(([id, widget]) => displayIssues(widget.kind, widget.display, [
|
|
93
|
+
"widgets",
|
|
94
|
+
id,
|
|
95
|
+
"display"
|
|
96
|
+
]));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* A widget's options as its kind reads them: each option it knows, when it is of its type. A
|
|
100
|
+
* stored option of the wrong type (written before options were checked, or by hand) is left
|
|
101
|
+
* out, never guessed at, so a renderer needs no check of its own; of a map of colours, the
|
|
102
|
+
* colours that are text are kept.
|
|
103
|
+
*/
|
|
104
|
+
function displayOf(kind, display) {
|
|
105
|
+
const options = DISPLAY_OPTIONS[kind];
|
|
106
|
+
const given = isRecord(display) ? display : {};
|
|
107
|
+
const read = Object.entries(options).flatMap(([name, type]) => {
|
|
108
|
+
const value = usable(type, given[name]);
|
|
109
|
+
return value === void 0 ? [] : [[name, value]];
|
|
110
|
+
});
|
|
111
|
+
return Object.fromEntries(read);
|
|
112
|
+
}
|
|
113
|
+
/** An option as an object holds it: none when it has no such option, which is not the same as holding null. */
|
|
114
|
+
const held = (display, option) => Object.hasOwn(display, option) ? { is: display[option] ?? null } : null;
|
|
115
|
+
/**
|
|
116
|
+
* What an edit did wrong to a display: each option of the wrong type that the edit set or
|
|
117
|
+
* changed, at `widgets.<id>.display.<option>`. Only what the edit touched is checked: an option
|
|
118
|
+
* stored before options were typed stays as it is, so it never blocks an edit of something
|
|
119
|
+
* else, and replaying a draft's own commands never refuses one that was accepted.
|
|
120
|
+
*/
|
|
121
|
+
function editedDisplayIssues(before, after) {
|
|
122
|
+
return Object.entries(after.widgets).flatMap(([id, widget]) => {
|
|
123
|
+
const was = before.widgets[id]?.display;
|
|
124
|
+
const old = isRecord(was) ? was : {};
|
|
125
|
+
const now = widget.display;
|
|
126
|
+
return displayIssues(widget.kind, now, [
|
|
127
|
+
"widgets",
|
|
128
|
+
id,
|
|
129
|
+
"display"
|
|
130
|
+
]).filter((found) => {
|
|
131
|
+
const option = String(found.path.at(-1));
|
|
132
|
+
const [set, had] = isRecord(now) ? [held(now, option), held(old, option)] : [now, was];
|
|
133
|
+
return canonical(set ?? null) !== canonical(had ?? null);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/** The options every widget takes, whatever draws it: `keepDateRange` and `empty`. */
|
|
138
|
+
const sharedDisplay = (display) => displayOf("table", display);
|
|
139
|
+
export { DISPLAY_HELP, DISPLAY_OPTIONS, displayIssues, displayOf, documentDisplayIssues, editedDisplayIssues, sharedDisplay };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The fingerprint of every source file that can change an answer: everything the engine
|
|
3
|
-
* tile composition import, at any depth. A cache keys its
|
|
4
|
-
*
|
|
2
|
+
* The fingerprint of every core source file that can change an answer: everything the engine,
|
|
3
|
+
* tile composition and the answer's shaping (`result/`) import, at any depth. A cache keys its
|
|
4
|
+
* entries by it, and by the contract version (the answer's schema), so an answer cached by
|
|
5
|
+
* older code, or in an older shape, is never read. `test/engine-version.test.ts` checks it
|
|
5
6
|
* against the files and prints the new value when they change.
|
|
6
7
|
*/
|
|
7
|
-
export declare const ENGINE_VERSION = "
|
|
8
|
+
export declare const ENGINE_VERSION = "39e23974f1075615";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// src/engine/version.ts
|
|
2
2
|
/**
|
|
3
|
-
* The fingerprint of every source file that can change an answer: everything the engine
|
|
4
|
-
* tile composition import, at any depth. A cache keys its
|
|
5
|
-
*
|
|
3
|
+
* The fingerprint of every core source file that can change an answer: everything the engine,
|
|
4
|
+
* tile composition and the answer's shaping (`result/`) import, at any depth. A cache keys its
|
|
5
|
+
* entries by it, and by the contract version (the answer's schema), so an answer cached by
|
|
6
|
+
* older code, or in an older shape, is never read. `test/engine-version.test.ts` checks it
|
|
6
7
|
* against the files and prints the new value when they change.
|
|
7
8
|
*/
|
|
8
|
-
const ENGINE_VERSION = "
|
|
9
|
+
const ENGINE_VERSION = "39e23974f1075615";
|
|
9
10
|
export { ENGINE_VERSION };
|
|
@@ -30,6 +30,7 @@ export declare const MODEL_ISSUES: {
|
|
|
30
30
|
readonly JOIN_TARGET_UNKNOWN: "A join targets a source that does not exist.";
|
|
31
31
|
readonly KEY_MISSING: "A source has no unique key.";
|
|
32
32
|
readonly MEMBER_NAME_CLASH: "Two members of a source share a name.";
|
|
33
|
+
readonly MODEL_FIELD_UNKNOWN: "The model holds a field the library does not know: a misspelling, or a field of another kind.";
|
|
33
34
|
readonly MODEL_FILTER_NOT_BOUND: "A filter in the model uses a viewer value or a variable.";
|
|
34
35
|
readonly MODEL_SHAPE: "A member of the model has a kind, merge or storage that does not exist, or lacks a field its kind needs.";
|
|
35
36
|
readonly MODEL_VERSION: "The model version is not 1.";
|
|
@@ -135,6 +136,7 @@ export declare const DOCUMENT_REFUSALS: {
|
|
|
135
136
|
readonly DOCUMENT_INVALID: "A stored or code-defined dashboard document does not match the document schema.";
|
|
136
137
|
readonly DOCUMENT_TOO_NEW: "A dashboard document was written by a newer version of the library than this one.";
|
|
137
138
|
readonly CONTROL_UNKNOWN: "The edit names a control that does not exist.";
|
|
139
|
+
readonly DISPLAY_INVALID: "An edit sets a widget's display option to the wrong type for its kind (a line's colors that is not a map of colours). Named in the issues of EDIT_REFUSED; the reducer itself applies any display, so a draft's stored commands replay.";
|
|
138
140
|
readonly LOCK_UNKNOWN: "The edit names a lock that does not exist.";
|
|
139
141
|
readonly TAB_UNKNOWN: "The edit names a tab that does not exist.";
|
|
140
142
|
readonly TAB_EXISTS: "A tab with that id already exists.";
|
|
@@ -33,6 +33,7 @@ const MODEL_ISSUES = {
|
|
|
33
33
|
JOIN_TARGET_UNKNOWN: "A join targets a source that does not exist.",
|
|
34
34
|
KEY_MISSING: "A source has no unique key.",
|
|
35
35
|
MEMBER_NAME_CLASH: "Two members of a source share a name.",
|
|
36
|
+
MODEL_FIELD_UNKNOWN: "The model holds a field the library does not know: a misspelling, or a field of another kind.",
|
|
36
37
|
MODEL_FILTER_NOT_BOUND: "A filter in the model uses a viewer value or a variable.",
|
|
37
38
|
MODEL_SHAPE: "A member of the model has a kind, merge or storage that does not exist, or lacks a field its kind needs.",
|
|
38
39
|
MODEL_VERSION: "The model version is not 1.",
|
|
@@ -113,6 +114,7 @@ const DOCUMENT_REFUSALS = {
|
|
|
113
114
|
DOCUMENT_INVALID: "A stored or code-defined dashboard document does not match the document schema.",
|
|
114
115
|
DOCUMENT_TOO_NEW: "A dashboard document was written by a newer version of the library than this one.",
|
|
115
116
|
CONTROL_UNKNOWN: "The edit names a control that does not exist.",
|
|
117
|
+
DISPLAY_INVALID: "An edit sets a widget's display option to the wrong type for its kind (a line's colors that is not a map of colours). Named in the issues of EDIT_REFUSED; the reducer itself applies any display, so a draft's stored commands replay.",
|
|
116
118
|
LOCK_UNKNOWN: "The edit names a lock that does not exist.",
|
|
117
119
|
TAB_UNKNOWN: "The edit names a tab that does not exist.",
|
|
118
120
|
TAB_EXISTS: "A tab with that id already exists.",
|
package/dist/core/index.d.mts
CHANGED
|
@@ -13,13 +13,14 @@ import { DatePart, DimensionDef, EXPR_FUNCTIONS, Expr, ExprCondition, ExprFuncti
|
|
|
13
13
|
import { LinearTerm, linearTerms } from "./model/validate/expr.mjs";
|
|
14
14
|
import { validateModel } from "./model/validate/index.mjs";
|
|
15
15
|
import { Cuts, Drill, DrillCan, DrillField, DrillOrigin, DrillSemantics, DrillState, DrillStep, DrillView, MAX_DRILL_STEPS, PinnedExecution, Selection } from "./query/drill/types.mjs";
|
|
16
|
-
import {
|
|
16
|
+
import { ColumnRole, Mark, Receipt, RecordColumn, Result, ResultCell, ResultColumn, ResultRows, TimeAxis, TimeBucket } from "./result/types.mjs";
|
|
17
17
|
import { Span, inSpan, resolveRange } from "./time/range.mjs";
|
|
18
18
|
import { NaiveRule, OffsetSegment, offsetSegments, resolveNaive, startOfDate } from "./time/zone.mjs";
|
|
19
|
+
import { viaJoins } from "./model/validate/via.mjs";
|
|
19
20
|
import { BoundRule, bindFilter, bindPolicy, namedPolicy, viewerValues } from "./policy/bind.mjs";
|
|
20
|
-
import { bindQueryViewer, bindViewer } from "./policy/bind-query.mjs";
|
|
21
21
|
import { Command, CommandBody, CommandId, Display, Doc, LayoutItem, Scope, Tab, TabId, Widget, WidgetId, emptyDoc } from "./document/types.mjs";
|
|
22
22
|
import { Change, Placement, WidgetPart, changedWidget, diffDocs, markShifted, placementOf, widgetDiff } from "./document/diff.mjs";
|
|
23
|
+
import { DISPLAY_HELP, DISPLAY_OPTIONS, DisplayKind, DisplayOf, displayIssues, displayOf, documentDisplayIssues, editedDisplayIssues, sharedDisplay } from "./document/display.mjs";
|
|
23
24
|
import { GRID_COLUMNS, Gap, closeGaps, closeGapsCommands, freeSpot, layoutGaps, placeItem, repairLayout } from "./document/layout.mjs";
|
|
24
25
|
import { Outcome } from "./document/outcome.mjs";
|
|
25
26
|
import { lockChanged, reduce, reduceAll } from "./document/reduce.mjs";
|
|
@@ -29,6 +30,7 @@ import { EncodeOptions, VIEW_PREFIX, ViewState, encodeView, viewFor, withView }
|
|
|
29
30
|
import { smallestFor, viewLayout } from "./document/view-layout.mjs";
|
|
30
31
|
import { EXACT_LIMIT, Exact, divideExact, formatExact, parseExact, storedExact } from "./exact/decimal.mjs";
|
|
31
32
|
import { ExactSum, Operands, rowValue, sumLinear } from "./exact/sum.mjs";
|
|
33
|
+
import { bindQueryViewer, bindViewer } from "./policy/bind-query.mjs";
|
|
32
34
|
import { ruleMatches, selectRule } from "./policy/match.mjs";
|
|
33
35
|
import { Closure, queryClosure } from "./query/closure.mjs";
|
|
34
36
|
import { AssertionContext, BoundPolicy, BoundPolicyFilter, ComposeCtx, ComposeDelta, ComposedQuery, CompositionPolicy, DEFAULT_COMPOSITION_POLICY, LockEntry, RequiredEntry, StoredLockEntry } from "./query/compose.mjs";
|
|
@@ -39,15 +41,15 @@ import { FormulaRef, changeOf, formulaRefs, shareOf } from "./query/formulas.mjs
|
|
|
39
41
|
import { isDateRange, isValuePick, pickProblem } from "./query/picks.mjs";
|
|
40
42
|
import { Alias, QueryReferenceError, toWire } from "./query/to-wire.mjs";
|
|
41
43
|
import { CalcAlias, Calendar, Cell, Control, ControlId, DateRange, DimensionAlias, DimensionCut, EntryId, ExplicitRange, Format, Formula, FormulaNode, Grain, MeasureAlias, Picks, RefOf, RelativeRange, ResolvedRange, ScopeCoverage, StoredFormulaNode, StoredQuery, TileRef, TypedFilter, TypedQuery, WireQuery } from "./query/types.mjs";
|
|
42
|
-
import { memberLabel, recordColumns, resultColumns } from "./result/columns.mjs";
|
|
43
|
-
import { isMark, markedRows } from "./result/marks.mjs";
|
|
44
|
-
import { ItemLinks, ItemLinksFor, LINK_PART, itemLink, linkTemplateIssues } from "./query/drill/links.mjs";
|
|
45
|
-
import { Mark, Receipt, RecordColumn, Result, ResultCell, ResultColumn, ResultRows } from "./result/types.mjs";
|
|
46
44
|
import "./time/index.mjs";
|
|
45
|
+
import { ItemLinks, ItemLinksFor, LINK_PART, itemLink, linkTemplateIssues } from "./query/drill/links.mjs";
|
|
47
46
|
import { ApiError, CONTRACT_VERSION, CoreContract, DashboardListResponse, DashboardResponse, DraftResponse, MetaJoin, MetaMember, MetaResponse, PublishResponse, QueryAnswer, QueryLine, RecordsResponse, TileAnswer, TileLine, TileRequest, TileResult, TilesRequest, ValidateResponse, ValuesResponse } from "./types/api.mjs";
|
|
48
47
|
import { AnswerDrill, ClosedRow, DrillAbilities, DrillAnswer, DrillBody, DrillCrumb, DrillExplanationView, DrillGroupedView, DrillItem, DrillItemsView, DrillOperand, DrillSummary, ItemColumn, SealedAnswer } from "./types/drill-api.mjs";
|
|
49
48
|
import { CoreApi, CreateDash, Dash, EndpointsByPath, HeadersLike, PluginEndpoints, PluginErrorCodes, ServerCall, ServerCallInput, ServerCalls, UniqueIds } from "./types/infer.mjs";
|
|
50
49
|
import { CodeDashboard, DashOptions, SecondaryStorage } from "./types/options.mjs";
|
|
50
|
+
import { memberLabel, recordColumns, resultColumns, roleOf } from "./result/columns.mjs";
|
|
51
|
+
import { isMark, markedRows } from "./result/marks.mjs";
|
|
52
|
+
import { timeAxis, withTime } from "./result/time-axis.mjs";
|
|
51
53
|
import { Field, FieldType, TABLES, TableDef, TableName } from "./store/schema.mjs";
|
|
52
54
|
import { CATALOG, StoreDialect, TableCheck, createTable, schemaChecks, schemaStatements } from "./store/ddl.mjs";
|
|
53
55
|
import { comparisonQuery, comparisonSpan, shiftInstant } from "./time/compare.mjs";
|
|
@@ -59,4 +61,4 @@ import { Author, DashAdapter, DashboardHead, DashboardReader, DashboardStore, Da
|
|
|
59
61
|
import { CanFn, Channel, Principal, Resource, TenantKeysOf, Verb, Viewer, ViewerFor, principalTenant } from "./types/viewer.mjs";
|
|
60
62
|
import { canonical } from "./value/canonical.mjs";
|
|
61
63
|
import { fold, foldingPairs } from "./value/casefold.mjs";
|
|
62
|
-
export { type AccessParts, type Alias, type AnswerDrill, type ApiError, type AssertionContext, type Author, type Awaitable, BASE_ERROR_CODES, type BoundFilter, type BoundPolicy, type BoundPolicyFilter, type BoundRule, CATALOG, CONTRACT_VERSION, type CalcAlias, type Calendar, type CanFn, type Catalog, type CatalogIssueCode, type Cell, type Change, type Channel, type ClosedRow, type Closure, type CodeDashboard, type Column, type ColumnType, type Command, type CommandBody, type CommandId, type ComposeCtx, type ComposeDelta, type ComposedQuery, type ComposedTile, type CompositionPolicy, type ConnectionId, type Control, type ControlId, type CoreApi, type CoreContract, type CreateDash, type CustomSource, type Cuts, DEFAULT_COMPOSITION_POLICY, DRILL_REASONS, type Dash, type DashAdapter, type DashEndpoint, type DashHook, type DashOptions, type DashPlugin, type DashboardHead, type DashboardListResponse, type DashboardReader, type DashboardResponse, type DashboardStore, type DashboardSummary, type DatePart, type DateRange, type DbSchema, type DimensionAlias, type DimensionCut, type DimensionDef, type DimensionHints, type DimensionId, type DimensionName, type Display, type Doc, type DocumentRefusalCode, type DocumentSlice, type Draft, type DraftResponse, type DraftTarget, type Drill, type DrillAbilities, type DrillAnswer, type DrillBody, type DrillCan, type DrillCrumb, type DrillExplanationView, type DrillField, type DrillGroupedView, type DrillItem, type DrillItemsView, type DrillOperand, type DrillOrigin, type DrillReason, type DrillSemantics, type DrillState, type DrillStep, type DrillSummary, type DrillView, EXACT_LIMIT, EXPR_FUNCTIONS, type EncodeOptions, type EndpointAccess, type EndpointContext, type EndpointsByPath, type EntryId, type Exact, type ExactSum, type Explanation, type ExplicitRange, type Expr, type ExprCondition, type ExprFunction, type Field, type FieldType, type Format, type Formula, type FormulaNode, type FormulaRef, GRID_COLUMNS, type Gap, type Grain, type GroupedRead, type HeadersLike, type HookContext, type HostCell, type HostRows, type IanaZone, type IntrospectingConnection, type IsoInstant, type Issue, type IssueCode, type ItemColumn, type ItemLinks, type ItemLinksFor, type JoinDef, type JoinName, type JoinedDimensionId, LINK_PART, type LayoutItem, type Leaf, type LinearTerm, type LockEntry, MAX_DRILL_STEPS, MICROS_PER_DAY, MICROS_PER_HOUR, MICROS_PER_SECOND, type Mark, type MeasureAlias, type MeasureDef, type MeasureId, type MeasureName, type MemberId, type MemberMeta, type MemberRef, type MetaJoin, type MetaMember, type MetaResponse, type Micros, type Model, ModelError, type ModelIssueCode, type Moment, NEGATION_OF, NEGATIVE_OPS, NULL_OPS, type NaiveRule, type NegativeOp, type NodeId, type Noun, type NullOp, type NumberFormat, type Numeric, type OffsetSegment, type Op, type Operands, type Outcome, type OverlapPart, type OwnDimensionId, POSITIVE_OPS, type PageRequest, type Param, type Picks, type PinnedExecution, type Placement, type PluginEndpoints, type PluginErrorCodes, type PolicyBinding, type PolicyFilter, type PolicyName, type PolicyRule, type PositiveOp, type Preview, type Primitive, type Principal, type PublishResponse, type Published, type QueryAnswer, type QueryConnection, type QueryCtx, type QueryLine, QueryReferenceError, type QueryRefusalCode, type RawError, type RawLevels, type RawResult, type ReadContext, type ReadField, type ReadFilter, type ReadMeasure, type ReadSession, type Receipt, type RecordColumn, type RecordPage, type Recorded, type RecordsHint, type RecordsRead, type RecordsResponse, type RefOf, type Refusal, type Relationship, type RelativeRange, type Replayed, type RequiredEntry, type ResolvedDimension, type ResolvedRange, type Resource, type Result, type ResultCell, type ResultColumn, type ResultRows, type ResultWarningCode, type Row, type RowPolicy, type RunOptions, type RuntimeErrorCode, type SchemaDriver, type Scope, type ScopeCoverage, type SealedAnswer, type SecondaryStorage, type Selection, type SemanticProvider, type ServerCall, type ServerCallInput, type ServerCalls, type SourceDef, type SourceName, type SourceNameOf, type Span, type Sql, type StoreDialect, type StoredFilter, type StoredFormulaNode, type StoredLockEntry, type StoredQuery, type StoredVersion, TABLES, type Tab, type TabId, type TableCheck, type TableDef, type TableName, type Tenant, type TenantBinding, type TenantKey, type TenantKeysOf, type TileAnswer, type TileInput, type TileLine, type TileRef, type TileRequest, type TileResult, type TilesRequest, type TimeStorage, type Token, type Tone, type TypedFilter, type TypedQuery, type UniqueIds, type Unit, type UnpublishedDraft, VIEW_PREFIX, type ValidateResponse, type ValueLeaf, type ValuesResponse, type VariableLeaf, type Verb, type VersionEntry, type ViewState, type Viewer, type ViewerFor, type ViewerLeaf, type ViewerMatch, type ViewerRef, type WeekStart, type Where, type Widget, type WidgetId, type WidgetPart, type WireFilter, type WireQuery, bindFilter, bindPolicy, bindQueryViewer, bindViewer, bucketLabel, bucketLabels, bucketStart, canonical, changeOf, changedWidget, checkCatalog, closeGaps, closeGapsCommands, commandWidget, comparisonQuery, comparisonSpan, composeTile, createDashEndpoint, createTable, defineErrorCodes, defineModel, describeQueries, diffDocs, divideExact, documentLock, effectiveFilter, emptyDoc, encodeView, fold, foldingPairs, formatExact, formatTextTime, formulaRefs, freeSpot, inSpan, isBound, isDateRange, isLeaf, isMark, isValuePick, isZone, itemLink, layoutGaps, linearTerms, linkTemplateIssues, lockChanged, markShifted, markedRows, memberLabel, momentMicros, namedPolicy, nextBucketStart, offsetSegments, parseDate, parseExact, parseMemberId, parseNaiveTime, parseTextTime, pickProblem, placeItem, placementOf, policyBinding, principalTenant, queryClosure, readingOrder, recordColumns, recordDimensions, reduce, reduceAll, repairLayout, replay, resolveDimension, resolveMeasure, resolveNaive, resolveRange, resultColumns, rowValue, ruleMatches, schemaChecks, schemaStatements, selectRule, shareOf, shiftBucket, shiftInstant, smallestFor, startOfDate, stepCommands, stepMoves, storedExact, stripIds, sumLinear, tileInputs, toWire, validateModel, viaJoins, viewFor, viewLayout, viewerValues, widgetDiff, withView };
|
|
64
|
+
export { type AccessParts, type Alias, type AnswerDrill, type ApiError, type AssertionContext, type Author, type Awaitable, BASE_ERROR_CODES, type BoundFilter, type BoundPolicy, type BoundPolicyFilter, type BoundRule, CATALOG, CONTRACT_VERSION, type CalcAlias, type Calendar, type CanFn, type Catalog, type CatalogIssueCode, type Cell, type Change, type Channel, type ClosedRow, type Closure, type CodeDashboard, type Column, type ColumnRole, type ColumnType, type Command, type CommandBody, type CommandId, type ComposeCtx, type ComposeDelta, type ComposedQuery, type ComposedTile, type CompositionPolicy, type ConnectionId, type Control, type ControlId, type CoreApi, type CoreContract, type CreateDash, type CustomSource, type Cuts, DEFAULT_COMPOSITION_POLICY, DISPLAY_HELP, DISPLAY_OPTIONS, DRILL_REASONS, type Dash, type DashAdapter, type DashEndpoint, type DashHook, type DashOptions, type DashPlugin, type DashboardHead, type DashboardListResponse, type DashboardReader, type DashboardResponse, type DashboardStore, type DashboardSummary, type DatePart, type DateRange, type DbSchema, type DimensionAlias, type DimensionCut, type DimensionDef, type DimensionHints, type DimensionId, type DimensionName, type Display, type DisplayKind, type DisplayOf, type Doc, type DocumentRefusalCode, type DocumentSlice, type Draft, type DraftResponse, type DraftTarget, type Drill, type DrillAbilities, type DrillAnswer, type DrillBody, type DrillCan, type DrillCrumb, type DrillExplanationView, type DrillField, type DrillGroupedView, type DrillItem, type DrillItemsView, type DrillOperand, type DrillOrigin, type DrillReason, type DrillSemantics, type DrillState, type DrillStep, type DrillSummary, type DrillView, EXACT_LIMIT, EXPR_FUNCTIONS, type EncodeOptions, type EndpointAccess, type EndpointContext, type EndpointsByPath, type EntryId, type Exact, type ExactSum, type Explanation, type ExplicitRange, type Expr, type ExprCondition, type ExprFunction, type Field, type FieldType, type Format, type Formula, type FormulaNode, type FormulaRef, GRID_COLUMNS, type Gap, type Grain, type GroupedRead, type HeadersLike, type HookContext, type HostCell, type HostRows, type IanaZone, type IntrospectingConnection, type IsoInstant, type Issue, type IssueCode, type ItemColumn, type ItemLinks, type ItemLinksFor, type JoinDef, type JoinName, type JoinedDimensionId, LINK_PART, type LayoutItem, type Leaf, type LinearTerm, type LockEntry, MAX_DRILL_STEPS, MICROS_PER_DAY, MICROS_PER_HOUR, MICROS_PER_SECOND, type Mark, type MeasureAlias, type MeasureDef, type MeasureId, type MeasureName, type MemberId, type MemberMeta, type MemberRef, type MetaJoin, type MetaMember, type MetaResponse, type Micros, type Model, ModelError, type ModelIssueCode, type Moment, NEGATION_OF, NEGATIVE_OPS, NULL_OPS, type NaiveRule, type NegativeOp, type NodeId, type Noun, type NullOp, type NumberFormat, type Numeric, type OffsetSegment, type Op, type Operands, type Outcome, type OverlapPart, type OwnDimensionId, POSITIVE_OPS, type PageRequest, type Param, type Picks, type PinnedExecution, type Placement, type PluginEndpoints, type PluginErrorCodes, type PolicyBinding, type PolicyFilter, type PolicyName, type PolicyRule, type PositiveOp, type Preview, type Primitive, type Principal, type PublishResponse, type Published, type QueryAnswer, type QueryConnection, type QueryCtx, type QueryLine, QueryReferenceError, type QueryRefusalCode, type RawError, type RawLevels, type RawResult, type ReadContext, type ReadField, type ReadFilter, type ReadMeasure, type ReadSession, type Receipt, type RecordColumn, type RecordPage, type Recorded, type RecordsHint, type RecordsRead, type RecordsResponse, type RefOf, type Refusal, type Relationship, type RelativeRange, type Replayed, type RequiredEntry, type ResolvedDimension, type ResolvedRange, type Resource, type Result, type ResultCell, type ResultColumn, type ResultRows, type ResultWarningCode, type Row, type RowPolicy, type RunOptions, type RuntimeErrorCode, type SchemaDriver, type Scope, type ScopeCoverage, type SealedAnswer, type SecondaryStorage, type Selection, type SemanticProvider, type ServerCall, type ServerCallInput, type ServerCalls, type SourceDef, type SourceName, type SourceNameOf, type Span, type Sql, type StoreDialect, type StoredFilter, type StoredFormulaNode, type StoredLockEntry, type StoredQuery, type StoredVersion, TABLES, type Tab, type TabId, type TableCheck, type TableDef, type TableName, type Tenant, type TenantBinding, type TenantKey, type TenantKeysOf, type TileAnswer, type TileInput, type TileLine, type TileRef, type TileRequest, type TileResult, type TilesRequest, type TimeAxis, type TimeBucket, type TimeStorage, type Token, type Tone, type TypedFilter, type TypedQuery, type UniqueIds, type Unit, type UnpublishedDraft, VIEW_PREFIX, type ValidateResponse, type ValueLeaf, type ValuesResponse, type VariableLeaf, type Verb, type VersionEntry, type ViewState, type Viewer, type ViewerFor, type ViewerLeaf, type ViewerMatch, type ViewerRef, type WeekStart, type Where, type Widget, type WidgetId, type WidgetPart, type WireFilter, type WireQuery, bindFilter, bindPolicy, bindQueryViewer, bindViewer, bucketLabel, bucketLabels, bucketStart, canonical, changeOf, changedWidget, checkCatalog, closeGaps, closeGapsCommands, commandWidget, comparisonQuery, comparisonSpan, composeTile, createDashEndpoint, createTable, defineErrorCodes, defineModel, describeQueries, diffDocs, displayIssues, displayOf, divideExact, documentDisplayIssues, documentLock, editedDisplayIssues, effectiveFilter, emptyDoc, encodeView, fold, foldingPairs, formatExact, formatTextTime, formulaRefs, freeSpot, inSpan, isBound, isDateRange, isLeaf, isMark, isValuePick, isZone, itemLink, layoutGaps, linearTerms, linkTemplateIssues, lockChanged, markShifted, markedRows, memberLabel, momentMicros, namedPolicy, nextBucketStart, offsetSegments, parseDate, parseExact, parseMemberId, parseNaiveTime, parseTextTime, pickProblem, placeItem, placementOf, policyBinding, principalTenant, queryClosure, readingOrder, recordColumns, recordDimensions, reduce, reduceAll, repairLayout, replay, resolveDimension, resolveMeasure, resolveNaive, resolveRange, resultColumns, roleOf, rowValue, ruleMatches, schemaChecks, schemaStatements, selectRule, shareOf, sharedDisplay, shiftBucket, shiftInstant, smallestFor, startOfDate, stepCommands, stepMoves, storedExact, stripIds, sumLinear, tileInputs, timeAxis, toWire, validateModel, viaJoins, viewFor, viewLayout, viewerValues, widgetDiff, withTime, withView };
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BASE_ERROR_CODES, DRILL_REASONS, defineErrorCodes } from "./error/codes.mjs";
|
|
2
2
|
import { changedWidget, diffDocs, markShifted, placementOf, widgetDiff } from "./document/diff.mjs";
|
|
3
|
+
import { DISPLAY_HELP, DISPLAY_OPTIONS, displayIssues, displayOf, documentDisplayIssues, editedDisplayIssues, sharedDisplay } from "./document/display.mjs";
|
|
3
4
|
import { GRID_COLUMNS, closeGaps, closeGapsCommands, freeSpot, layoutGaps, placeItem, repairLayout } from "./document/layout.mjs";
|
|
4
5
|
import { lockChanged, reduce, reduceAll } from "./document/reduce.mjs";
|
|
5
6
|
import { commandWidget, replay } from "./document/replay.mjs";
|
|
@@ -32,18 +33,19 @@ import { isDateRange, isValuePick, pickProblem } from "./query/picks.mjs";
|
|
|
32
33
|
import { QueryReferenceError, toWire } from "./query/to-wire.mjs";
|
|
33
34
|
import { LINK_PART, itemLink, linkTemplateIssues } from "./query/drill/links.mjs";
|
|
34
35
|
import { MAX_DRILL_STEPS } from "./query/drill/types.mjs";
|
|
35
|
-
import { memberLabel, recordColumns, resultColumns } from "./result/columns.mjs";
|
|
36
|
-
import { isMark, markedRows } from "./result/marks.mjs";
|
|
37
36
|
import { CONTRACT_VERSION } from "./types/api.mjs";
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
37
|
+
import { memberLabel, recordColumns, resultColumns, roleOf } from "./result/columns.mjs";
|
|
38
|
+
import { isMark, markedRows } from "./result/marks.mjs";
|
|
40
39
|
import { MICROS_PER_DAY, MICROS_PER_HOUR, MICROS_PER_SECOND, formatTextTime, parseDate, parseNaiveTime, parseTextTime } from "./time/instant.mjs";
|
|
41
40
|
import { offsetSegments, resolveNaive, startOfDate } from "./time/zone.mjs";
|
|
42
41
|
import { bucketLabel, bucketLabels, bucketStart, nextBucketStart, shiftBucket } from "./time/bucket.mjs";
|
|
42
|
+
import { timeAxis, withTime } from "./result/time-axis.mjs";
|
|
43
|
+
import { TABLES } from "./store/schema.mjs";
|
|
44
|
+
import { CATALOG, createTable, schemaChecks, schemaStatements } from "./store/ddl.mjs";
|
|
43
45
|
import { comparisonQuery, comparisonSpan, shiftInstant } from "./time/compare.mjs";
|
|
44
46
|
import { inSpan, resolveRange } from "./time/range.mjs";
|
|
45
47
|
import { createDashEndpoint } from "./types/plugin.mjs";
|
|
46
48
|
import { principalTenant } from "./types/viewer.mjs";
|
|
47
49
|
import { canonical } from "./value/canonical.mjs";
|
|
48
50
|
import { fold, foldingPairs } from "./value/casefold.mjs";
|
|
49
|
-
export { BASE_ERROR_CODES, CATALOG, CONTRACT_VERSION, DEFAULT_COMPOSITION_POLICY, DRILL_REASONS, EXACT_LIMIT, EXPR_FUNCTIONS, GRID_COLUMNS, LINK_PART, MAX_DRILL_STEPS, MICROS_PER_DAY, MICROS_PER_HOUR, MICROS_PER_SECOND, ModelError, NEGATION_OF, NEGATIVE_OPS, NULL_OPS, POSITIVE_OPS, QueryReferenceError, TABLES, VIEW_PREFIX, bindFilter, bindPolicy, bindQueryViewer, bindViewer, bucketLabel, bucketLabels, bucketStart, canonical, changeOf, changedWidget, checkCatalog, closeGaps, closeGapsCommands, commandWidget, comparisonQuery, comparisonSpan, composeTile, createDashEndpoint, createTable, defineErrorCodes, defineModel, describeQueries, diffDocs, divideExact, documentLock, effectiveFilter, emptyDoc, encodeView, fold, foldingPairs, formatExact, formatTextTime, formulaRefs, freeSpot, inSpan, isBound, isDateRange, isLeaf, isMark, isValuePick, isZone, itemLink, layoutGaps, linearTerms, linkTemplateIssues, lockChanged, markShifted, markedRows, memberLabel, momentMicros, namedPolicy, nextBucketStart, offsetSegments, parseDate, parseExact, parseMemberId, parseNaiveTime, parseTextTime, pickProblem, placeItem, placementOf, policyBinding, principalTenant, queryClosure, readingOrder, recordColumns, recordDimensions, reduce, reduceAll, repairLayout, replay, resolveDimension, resolveMeasure, resolveNaive, resolveRange, resultColumns, rowValue, ruleMatches, schemaChecks, schemaStatements, selectRule, shareOf, shiftBucket, shiftInstant, smallestFor, startOfDate, stepCommands, stepMoves, storedExact, stripIds, sumLinear, tileInputs, toWire, validateModel, viaJoins, viewFor, viewLayout, viewerValues, widgetDiff, withView };
|
|
51
|
+
export { BASE_ERROR_CODES, CATALOG, CONTRACT_VERSION, DEFAULT_COMPOSITION_POLICY, DISPLAY_HELP, DISPLAY_OPTIONS, DRILL_REASONS, EXACT_LIMIT, EXPR_FUNCTIONS, GRID_COLUMNS, LINK_PART, MAX_DRILL_STEPS, MICROS_PER_DAY, MICROS_PER_HOUR, MICROS_PER_SECOND, ModelError, NEGATION_OF, NEGATIVE_OPS, NULL_OPS, POSITIVE_OPS, QueryReferenceError, TABLES, VIEW_PREFIX, bindFilter, bindPolicy, bindQueryViewer, bindViewer, bucketLabel, bucketLabels, bucketStart, canonical, changeOf, changedWidget, checkCatalog, closeGaps, closeGapsCommands, commandWidget, comparisonQuery, comparisonSpan, composeTile, createDashEndpoint, createTable, defineErrorCodes, defineModel, describeQueries, diffDocs, displayIssues, displayOf, divideExact, documentDisplayIssues, documentLock, editedDisplayIssues, effectiveFilter, emptyDoc, encodeView, fold, foldingPairs, formatExact, formatTextTime, formulaRefs, freeSpot, inSpan, isBound, isDateRange, isLeaf, isMark, isValuePick, isZone, itemLink, layoutGaps, linearTerms, linkTemplateIssues, lockChanged, markShifted, markedRows, memberLabel, momentMicros, namedPolicy, nextBucketStart, offsetSegments, parseDate, parseExact, parseMemberId, parseNaiveTime, parseTextTime, pickProblem, placeItem, placementOf, policyBinding, principalTenant, queryClosure, readingOrder, recordColumns, recordDimensions, reduce, reduceAll, repairLayout, replay, resolveDimension, resolveMeasure, resolveNaive, resolveRange, resultColumns, roleOf, rowValue, ruleMatches, schemaChecks, schemaStatements, selectRule, shareOf, sharedDisplay, shiftBucket, shiftInstant, smallestFor, startOfDate, stepCommands, stepMoves, storedExact, stripIds, sumLinear, tileInputs, timeAxis, toWire, validateModel, viaJoins, viewFor, viewLayout, viewerValues, widgetDiff, withTime, withView };
|
|
@@ -22,26 +22,17 @@ function dimensionHintIssues(def, path) {
|
|
|
22
22
|
], `"${value}" is not one of the dimension's declared values.`))
|
|
23
23
|
];
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
title: true,
|
|
30
|
-
key: true
|
|
31
|
-
});
|
|
32
|
-
/** A `records` hint has only its own keys, a `key` of "expose" or "hide", and a title a list may show. */
|
|
25
|
+
/**
|
|
26
|
+
* A `records` hint has a `key` of "expose" or "hide", and a title a list may show. A field it
|
|
27
|
+
* does not have is named by the field check (`known.ts`).
|
|
28
|
+
*/
|
|
33
29
|
function recordsIssues(source, path) {
|
|
34
|
-
|
|
35
|
-
if (records === void 0) return [];
|
|
30
|
+
if (source.records === void 0) return [];
|
|
36
31
|
const at = [...path, "records"];
|
|
37
32
|
const title = source.records?.title;
|
|
38
33
|
const titled = title === void 0 ? void 0 : source.dimensions[title];
|
|
39
34
|
const key = source.records?.key;
|
|
40
|
-
return [
|
|
41
|
-
...Object.keys(records).flatMap((k) => when(!Object.hasOwn(RECORDS_KEYS, k), "MODEL_SHAPE", [...at, k], k === "link" ? "records.link was removed: pass itemLinks to deriveDashboards and the React UI instead." : `records has no "${k}": it takes order, columns, title and key.`)),
|
|
42
|
-
...when(key !== void 0 && key !== "expose" && key !== "hide", "HINT_INVALID", [...at, "key"], `records.key is "expose" or "hide", not ${JSON.stringify(key)}.`),
|
|
43
|
-
...when(titled !== void 0 && (titled.sensitive === true || titled.hidden === true), "HINT_INVALID", [...at, "title"], "A records title is never a sensitive or hidden field: it shows on every item.")
|
|
44
|
-
];
|
|
35
|
+
return [...when(key !== void 0 && key !== "expose" && key !== "hide", "HINT_INVALID", [...at, "key"], `records.key is "expose" or "hide", not ${JSON.stringify(key)}.`), ...when(titled !== void 0 && (titled.sensitive === true || titled.hidden === true), "HINT_INVALID", [...at, "title"], "A records title is never a sensitive or hidden field: it shows on every item.")];
|
|
45
36
|
}
|
|
46
37
|
/** Each drill and records hint resolves: preferred fields, the records title, tones and formats. */
|
|
47
38
|
function drillIssues(source, path) {
|