@peripheries/renderer 0.22.0 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -23
- package/dist/catalog.js +2 -6
- package/dist/chunks/forms-DxA9WzCt.js +336 -0
- package/dist/chunks/{load-CjPvISzH.js → load-b38vUiZM.js} +0 -4
- package/dist/chunks/{page-bundles-DLRIBP8g.js → page-bundles-CPj_vx-J.js} +1 -5
- package/dist/chunks/{persistence-DCMakM9H.js → persistence-hurkUUQ0.js} +0 -6
- package/dist/chunks/{projection-yvYKzMOS.js → projection-zhu32_KJ.js} +1 -15
- package/dist/chunks/{query-BPuCJC1C.js → query-D6xQbTFK.js} +166 -12
- package/dist/chunks/{refs-BLUokra5.js → refs-Csgh6rXq.js} +0 -4
- package/dist/chunks/{structure-o9pYoDjD.js → structure-CKBtQHJq.js} +1 -7
- package/dist/chunks/{validate-4LgH8QMJ.js → validate-BcB_PA1k.js} +20 -13
- package/dist/core.js +138 -47
- package/dist/forms.js +2 -0
- package/dist/print.js +0 -24
- package/dist/react.js +352 -22
- package/dist/runtime.js +2 -12
- package/dist/styles.css +9 -15
- package/dist/testing.js +214 -19
- package/dist/theme.js +0 -10
- package/dist/types/catalog/check.d.ts +0 -13
- package/dist/types/core/actions.d.ts +0 -24
- package/dist/types/core/bundles/load.d.ts +0 -23
- package/dist/types/core/bundles/page-bundles.d.ts +0 -9
- package/dist/types/core/bundles/refs.d.ts +1 -28
- package/dist/types/core/bundles/resolve.d.ts +0 -10
- package/dist/types/core/cell-props.d.ts +0 -20
- package/dist/types/core/cells.d.ts +0 -21
- package/dist/types/core/data-context.d.ts +4 -21
- package/dist/types/core/diagnostics.d.ts +20 -6
- package/dist/types/core/graph.d.ts +6 -44
- package/dist/types/core/index.d.ts +4 -3
- package/dist/types/core/layout.d.ts +0 -9
- package/dist/types/core/load-page.d.ts +30 -88
- package/dist/types/core/query.d.ts +6 -52
- package/dist/types/core/references.d.ts +0 -21
- package/dist/types/core/release.d.ts +11 -0
- package/dist/types/core/rules.d.ts +0 -1
- package/dist/types/core/selected.d.ts +0 -5
- package/dist/types/core/sources.d.ts +10 -63
- package/dist/types/core/store/create-store.d.ts +0 -6
- package/dist/types/core/store/persistence.d.ts +0 -1
- package/dist/types/core/store/projection.d.ts +0 -5
- package/dist/types/core/store/scope-keys.d.ts +0 -1
- package/dist/types/core/store/types.d.ts +0 -6
- package/dist/types/core/structure.d.ts +0 -33
- package/dist/types/core/types.d.ts +2 -13
- package/dist/types/core/validate.d.ts +0 -12
- package/dist/types/core/values.d.ts +0 -6
- package/dist/types/forms/conditions.d.ts +18 -0
- package/dist/types/forms/index.d.ts +3 -0
- package/dist/types/forms/model.d.ts +90 -0
- package/dist/types/forms/port.d.ts +47 -0
- package/dist/types/print/document-bindings.d.ts +0 -61
- package/dist/types/print/document-profile.d.ts +0 -137
- package/dist/types/print/map-staleness.d.ts +0 -66
- package/dist/types/print/page-map.d.ts +1 -334
- package/dist/types/print/paginate.d.ts +0 -190
- package/dist/types/print/print-layout.d.ts +0 -161
- package/dist/types/print/print-lint.d.ts +0 -109
- package/dist/types/print/print-policy.d.ts +0 -184
- package/dist/types/print/print-stylesheet.d.ts +0 -135
- package/dist/types/print/running-header.d.ts +0 -86
- package/dist/types/print/structure-print.d.ts +1 -243
- package/dist/types/react/cell-states.d.ts +0 -2
- package/dist/types/react/cell-view.d.ts +1 -15
- package/dist/types/react/index.d.ts +1 -0
- package/dist/types/react/page-renderer.d.ts +1 -33
- package/dist/types/react/structure-view.d.ts +0 -12
- package/dist/types/react/use-cell-store.d.ts +0 -5
- package/dist/types/react/use-container-size.d.ts +0 -5
- package/dist/types/react/use-forms-runtime.d.ts +147 -0
- package/dist/types/react/use-paging.d.ts +0 -9
- package/dist/types/runtime/boot.d.ts +0 -11
- package/dist/types/runtime/install.d.ts +0 -15
- package/dist/types/runtime/shims.d.ts +0 -8
- package/dist/types/runtime/store-export.d.ts +0 -7
- package/dist/types/testing/base-props.d.ts +0 -1
- package/dist/types/testing/components.d.ts +0 -8
- package/dist/types/testing/form-workbook.d.ts +103 -0
- package/dist/types/testing/golden.d.ts +0 -16
- package/dist/types/testing/ids.d.ts +0 -2
- package/dist/types/testing/index.d.ts +1 -0
- package/dist/types/testing/sources.d.ts +0 -7
- package/dist/types/theme/check.d.ts +0 -2
- package/dist/types/theme/color.d.ts +0 -12
- package/dist/types/theme/derive.d.ts +0 -12
- package/dist/types/theme/parse.d.ts +0 -7
- package/package.json +6 -2
- package/dist/catalog.js.map +0 -1
- package/dist/chunks/load-CjPvISzH.js.map +0 -1
- package/dist/chunks/page-bundles-DLRIBP8g.js.map +0 -1
- package/dist/chunks/persistence-DCMakM9H.js.map +0 -1
- package/dist/chunks/projection-yvYKzMOS.js.map +0 -1
- package/dist/chunks/query-BPuCJC1C.js.map +0 -1
- package/dist/chunks/refs-BLUokra5.js.map +0 -1
- package/dist/chunks/structure-o9pYoDjD.js.map +0 -1
- package/dist/chunks/validate-4LgH8QMJ.js.map +0 -1
- package/dist/core.js.map +0 -1
- package/dist/print.js.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/runtime.js.map +0 -1
- package/dist/testing.js.map +0 -1
- package/dist/theme.js.map +0 -1
|
@@ -2,43 +2,26 @@ import { type NodeBinding, type NodeRecord, type QueryDescriptor, type StateName
|
|
|
2
2
|
import { readField, type Diagnostic, type ProcessSystems } from './graph.js';
|
|
3
3
|
export { readField };
|
|
4
4
|
import type { DataContext, ProjectPage } from './types.js';
|
|
5
|
-
/** A system a declaration reads: by name from the page's process, or named outright by id. */
|
|
6
5
|
export type StateRead = {
|
|
7
6
|
name?: StateName;
|
|
8
7
|
systemId: string;
|
|
9
8
|
};
|
|
10
|
-
/** A declaration with the systems it reads, in merge order. */
|
|
11
9
|
export type ResolvedDeclaration = NodeBinding & {
|
|
12
10
|
reads: StateRead[];
|
|
13
11
|
};
|
|
14
|
-
/**
|
|
15
|
-
* Declarations (`data.queries`) with the systems each reads: `system_id`
|
|
16
|
-
* outright, else its `state` names (default `eng_data`) through the page's
|
|
17
|
-
* systems. Only node bindings: a retired registry binding is left to
|
|
18
|
-
* validation. A declaration none of whose systems exist
|
|
19
|
-
* is dropped, with a diagnostic.
|
|
20
|
-
*/
|
|
21
12
|
export declare function resolveDeclarations(queries: Record<string, unknown> | undefined, systems: ProcessSystems, diagnostics?: Diagnostic[], cellId?: string): Record<string, ResolvedDeclaration>;
|
|
22
|
-
/** The inline descriptors among declarations (`{ descriptor }`), by label (design/data.md §3). */
|
|
23
13
|
export declare function collectDescriptors(queries: Record<string, unknown> | undefined): Record<string, QueryDescriptor>;
|
|
24
|
-
/** The page's own declarations (`content.data.queries`), which every cell sees. */
|
|
25
14
|
export declare const collectDeclarations: (page: ProjectPage, systems: ProcessSystems, diagnostics?: Diagnostic[]) => Record<string, ResolvedDeclaration>;
|
|
26
|
-
/** The page's static values (`content.data.static`), which every cell sees. */
|
|
27
15
|
export declare function collectStatic(page: ProjectPage): Record<string, unknown>;
|
|
28
|
-
/**
|
|
29
|
-
* The page-wide DataContext: static, then declared on top. A declared label
|
|
30
|
-
* whose producer has no state resolves to null. `states` is keyed
|
|
31
|
-
* `<system_id>/<graph_node_id>`; `records` holds the NodeRecords for
|
|
32
|
-
* `as: 'record'` declarations, by graph node id. Traversal is per cell
|
|
33
|
-
* (the cell's walk; design/renderer.md §5.2), not part of this context.
|
|
34
|
-
*/
|
|
35
16
|
export declare function buildDataContext(input: {
|
|
36
17
|
static: Record<string, unknown>;
|
|
37
18
|
declared: Record<string, ResolvedDeclaration>;
|
|
38
19
|
states: Map<string, unknown>;
|
|
39
20
|
records?: Record<string, NodeRecord>;
|
|
40
|
-
/** The id of each newest state, keyed as `states`: where an edit of a declared value goes (INV-DOC-6). */
|
|
41
21
|
stateIds?: Map<string, string>;
|
|
42
|
-
|
|
22
|
+
stateVersions?: Map<string, {
|
|
23
|
+
versionId: string | null;
|
|
24
|
+
outOfScope: boolean;
|
|
25
|
+
}>;
|
|
43
26
|
staticScope?: 'page' | 'cell';
|
|
44
27
|
}): DataContext;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export type DiagnosticEntry = {
|
|
2
|
-
/** What the diagnostic means, in a sentence. */
|
|
3
2
|
meaning: string;
|
|
4
|
-
/** What to change. */
|
|
5
3
|
fix: string;
|
|
6
4
|
};
|
|
7
5
|
export declare const DIAGNOSTICS: {
|
|
@@ -111,14 +109,14 @@ export declare const DIAGNOSTICS: {
|
|
|
111
109
|
};
|
|
112
110
|
readonly UNSUPPORTED_REGISTRY_BINDING: {
|
|
113
111
|
readonly meaning: "A binding names a registry query (`{ registry: \"x.y\" }`) from the retired host contract.";
|
|
114
|
-
readonly fix: "Copy the matching recipe’s descriptor into `{ descriptor }` (the component’s pattern pack has it), or bind the graph node that produces the data.
|
|
112
|
+
readonly fix: "Copy the matching recipe’s descriptor into `{ descriptor }` (the component’s pattern pack has it), or bind the graph node that produces the data.";
|
|
115
113
|
};
|
|
116
114
|
readonly STATE_UNKNOWN_NAME: {
|
|
117
|
-
readonly meaning: "A state name is not
|
|
118
|
-
readonly fix: "Use `<tier>_<role>`: tier meta, eng or ops; role data, process, model or
|
|
115
|
+
readonly meaning: "A state name is not `<tier>_<role>`.";
|
|
116
|
+
readonly fix: "Use `<tier>_<role>`: tier meta, eng or ops; role a registered layer’s role (data, process, model, appraisal, or another such as answer); default `eng_data`.";
|
|
119
117
|
};
|
|
120
118
|
readonly STATE_UNKNOWN_SYSTEM: {
|
|
121
|
-
readonly meaning: "The page’s process has no system of that name.";
|
|
119
|
+
readonly meaning: "The page’s process has no main system of that name on its graphs.";
|
|
122
120
|
readonly fix: "Read a system the process has, usually `eng_data`.";
|
|
123
121
|
};
|
|
124
122
|
readonly LABEL_RESERVED: {
|
|
@@ -133,6 +131,14 @@ export declare const DIAGNOSTICS: {
|
|
|
133
131
|
readonly meaning: "The document isn’t one query operation that reads only tables, views and the render functions.";
|
|
134
132
|
readonly fix: "Write one `query`, whose root fields are `<table>Collection`, `<table>ByPk`, `node` or a render function such as `walk_graph`; no mutations, RPCs or introspection.";
|
|
135
133
|
};
|
|
134
|
+
readonly DESCRIPTOR_VERSION_FILTER: {
|
|
135
|
+
readonly meaning: "The document filters `systemCollection`, `graph_nodeCollection` or `graph_edgeCollection` on `version`, or passes their whole filter as a variable. A page reads main systems and placements only, and the host adds that filter itself.";
|
|
136
|
+
readonly fix: "Drop the `version` filter and write the filter in the document; a branch is read through a version context.";
|
|
137
|
+
};
|
|
138
|
+
readonly DESCRIPTOR_STATE_UNSCOPED: {
|
|
139
|
+
readonly meaning: "The document reads states, runs or a latest-state view by node or with no filter, so it would read every system’s rows, a branch’s included.";
|
|
140
|
+
readonly fix: "Read them under a `systemCollection`, or filter `system_id` (or the id, or the run) with `eq` or `in`; for the latest state across systems, use a render function.";
|
|
141
|
+
};
|
|
136
142
|
readonly DESCRIPTOR_VARIABLE_MISSING: {
|
|
137
143
|
readonly meaning: "The document requires a variable that `variables` doesn’t give.";
|
|
138
144
|
readonly fix: "Give it in `variables`, as a literal or a reference (`@params.clientId`, `@viewer.userId`, `@budget.graph_node_id`); `$orderBy` comes from `order_by`.";
|
|
@@ -149,6 +155,10 @@ export declare const DIAGNOSTICS: {
|
|
|
149
155
|
readonly meaning: "`order_by` is set, but the document declares no `$orderBy`, so it is ignored.";
|
|
150
156
|
readonly fix: "Declare `$orderBy: [<table>OrderBy!]` and pass `orderBy: $orderBy`, or remove `order_by`.";
|
|
151
157
|
};
|
|
158
|
+
readonly DESCRIPTOR_ALIAS_JSON_ROOT: {
|
|
159
|
+
readonly meaning: "A render function that returns JSON is aliased at the root; its JSON is decoded by the field’s name, so under an alias it stays a string.";
|
|
160
|
+
readonly fix: "Name the field without an alias (`form_answers(...)`, not `answers: form_answers(...)`) and point `result.path` at it.";
|
|
161
|
+
};
|
|
152
162
|
readonly DESCRIPTOR_RESULT_PATH: {
|
|
153
163
|
readonly meaning: "`result.path` names a part of the result the document doesn’t select.";
|
|
154
164
|
readonly fix: "Point it at a selected field (its alias, if it has one), e.g. `clientCollection`.";
|
|
@@ -205,6 +215,10 @@ export declare const DIAGNOSTICS: {
|
|
|
205
215
|
readonly meaning: "`nodeTypes: []` filters nothing.";
|
|
206
216
|
readonly fix: "Leave `nodeTypes` out, or name the types the walk may enter.";
|
|
207
217
|
};
|
|
218
|
+
readonly SYSTEM_NOT_MAIN: {
|
|
219
|
+
readonly meaning: "A ref, a declaration or a walk names a system that isn’t a main system (a branch’s, or one the viewer can’t read); a page reads main systems only, so its states read as absent.";
|
|
220
|
+
readonly fix: "Name the process’s main system (or none, for the page’s DSNS); a branch is read through a version context, not a system id.";
|
|
221
|
+
};
|
|
208
222
|
readonly WALK_NO_START: {
|
|
209
223
|
readonly meaning: "A cell has a traversal, but neither it nor the page has a graph node to start from.";
|
|
210
224
|
readonly fix: "Publish the page with its graph node, or give the cell a node.";
|
|
@@ -1,65 +1,37 @@
|
|
|
1
1
|
import { type EdgeRecord, type NodeRecord, type StateName, type StateRecord, type Traversal, type TraversalConfig } from '@peripheries/runtime';
|
|
2
2
|
import type { DiagnosticCode } from './diagnostics.js';
|
|
3
3
|
import type { PageCell } from './types.js';
|
|
4
|
-
/** The page's systems by name, from its process (and, for eng_data, the page's metadata fallbacks). */
|
|
5
4
|
export type ProcessSystems = Partial<Record<StateName, string>>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
export type GraphSystem = {
|
|
6
|
+
id: string;
|
|
7
|
+
graph_type: string | null;
|
|
8
|
+
role: string | null;
|
|
9
|
+
};
|
|
10
|
+
export declare function systemsFromGraphs(rows: readonly GraphSystem[] | null | undefined): ProcessSystems;
|
|
11
11
|
export type Diagnostic = {
|
|
12
12
|
severity: 'error' | 'warning' | 'legacy';
|
|
13
|
-
/** One of DIAGNOSTICS' keys, which says what it means and how to fix it. */
|
|
14
13
|
code: DiagnosticCode;
|
|
15
14
|
message: string;
|
|
16
|
-
/** Where in the page, e.g. `content.cells[3].traversal`. */
|
|
17
15
|
path?: string;
|
|
18
16
|
cellId?: string;
|
|
19
17
|
label?: string;
|
|
20
|
-
/** The nearest names in scope, for a name that isn't there (CELL_UNKNOWN_COMPONENT). */
|
|
21
18
|
suggestions?: string[];
|
|
22
19
|
};
|
|
23
|
-
/** A process row's system columns, `<tier>_<role>_system_id`, as names. */
|
|
24
20
|
export declare function systemsFromProcess(row: Record<string, unknown> | null | undefined): ProcessSystems;
|
|
25
|
-
/** The state names a read asks for, in order, duplicates dropped; the default when it names none. */
|
|
26
21
|
export declare function stateNames(state: unknown): {
|
|
27
22
|
names: StateName[];
|
|
28
23
|
unknown: string[];
|
|
29
24
|
};
|
|
30
|
-
/** A value at a dot-path: the whole value without one. */
|
|
31
25
|
export declare function readField(state: unknown, field?: string): unknown;
|
|
32
|
-
/**
|
|
33
|
-
* Several systems' data for one node, merged in order, later winning: plain
|
|
34
|
-
* objects key by key, anything else replaces. `undefined` when none had any,
|
|
35
|
-
* so "not loaded" and "empty" differ.
|
|
36
|
-
*/
|
|
37
26
|
export declare function mergeStates(values: readonly unknown[]): unknown;
|
|
38
|
-
/** The named states of a NodeRecord, merged, then `field`. */
|
|
39
27
|
export declare function stateValue(state: NodeRecord['state'], names: readonly StateName[], field?: string): unknown;
|
|
40
28
|
export type WalkStart = {
|
|
41
29
|
graphNodeId: string;
|
|
42
30
|
kind: 'cell' | 'page';
|
|
43
31
|
};
|
|
44
|
-
/** A cell's own node (a thin ref's, or an inline cell's `graph_node_id`), else the page node (agency doc 17). */
|
|
45
32
|
export declare function resolveWalkStart(cell: Pick<PageCell, 'graph_node_id' | 'metadata'>, pageGraphNodeId: string | null | undefined): WalkStart | null;
|
|
46
|
-
/**
|
|
47
|
-
* Labels no declaration or walk can take: the cell's walk, the route's
|
|
48
|
-
* parameters, the host's props, the viewer and the location (design/data.md
|
|
49
|
-
* §5); `input` (an action's argument) and `scope` (the apps release) are kept free.
|
|
50
|
-
*/
|
|
51
33
|
export declare const RESERVED_LABELS: readonly ["_traversal", "params", "baseProps", "viewer", "context", "input", "scope"];
|
|
52
|
-
/**
|
|
53
|
-
* Every data label a cell's props and conditions read with a whole-string
|
|
54
|
-
* `@label…` reference. Inside an `@each` projection's `map`, its element's
|
|
55
|
-
* label (`as`) is the projection's own, not the page's.
|
|
56
|
-
*/
|
|
57
34
|
export declare function referencedLabels(cell: Pick<PageCell, 'props' | 'conditions'>): Set<string>;
|
|
58
|
-
/**
|
|
59
|
-
* Whether a cell's walk has anything to give it (design/renderer.md §5.2): it
|
|
60
|
-
* reads `@_traversal`, or a label nothing explicit provides. Declarations win
|
|
61
|
-
* over what a walk finds, so a walk whose labels are all declared changes nothing.
|
|
62
|
-
*/
|
|
63
35
|
export declare function needsWalk(cell: PageCell, explicit: ReadonlySet<string>): boolean;
|
|
64
36
|
export type WalkRequest = {
|
|
65
37
|
start: WalkStart;
|
|
@@ -68,7 +40,6 @@ export type WalkRequest = {
|
|
|
68
40
|
nodeTypes: string[] | null;
|
|
69
41
|
maxDepth: number;
|
|
70
42
|
maxNodes: number;
|
|
71
|
-
/** The state names asked for, and the system each resolves to. */
|
|
72
43
|
states: Array<{
|
|
73
44
|
name: StateName;
|
|
74
45
|
systemId: string;
|
|
@@ -76,14 +47,11 @@ export type WalkRequest = {
|
|
|
76
47
|
excludeNodeTypes: string[] | null;
|
|
77
48
|
excludeEdgeTypes: string[] | null;
|
|
78
49
|
};
|
|
79
|
-
/** A cell's walk as a request, or why it can't run. */
|
|
80
50
|
export declare function walkRequest(config: TraversalConfig, start: WalkStart, systems: ProcessSystems): {
|
|
81
51
|
request?: WalkRequest;
|
|
82
52
|
diagnostics: Omit<Diagnostic, 'cellId'>[];
|
|
83
53
|
};
|
|
84
|
-
/** One walk per distinct question: cells asking the same one from the same start share it. */
|
|
85
54
|
export declare const walkKey: (r: WalkRequest) => string;
|
|
86
|
-
/** What walk_graph returns: nodes with their states keyed by system id. */
|
|
87
55
|
export type RawWalk = {
|
|
88
56
|
nodes: Array<Omit<NodeRecord, 'state'> & {
|
|
89
57
|
state: Record<string, StateRecord | null>;
|
|
@@ -96,12 +64,6 @@ export type WalkBinding = {
|
|
|
96
64
|
graph_node_id: string;
|
|
97
65
|
field?: string;
|
|
98
66
|
};
|
|
99
|
-
/**
|
|
100
|
-
* A walk's result for its cells: `@_traversal` (NodeRecords with states by
|
|
101
|
-
* name, noise stripped, edges only between what's left), and the labels its
|
|
102
|
-
* `binding_key` nodes provide. Two nodes with one key is a diagnostic, and
|
|
103
|
-
* neither binds.
|
|
104
|
-
*/
|
|
105
67
|
export declare function readWalk(raw: RawWalk, request: WalkRequest): {
|
|
106
68
|
traversal: Traversal;
|
|
107
69
|
bindings: WalkBinding[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { CONTENT_FIELDS, hasRef, HYDRATED_CELL_FIELDS, normalizeCell, resolveCell, rootCells, STORE_FIELDS, type CellSource, type ResolvedCell } from './cells.js';
|
|
2
2
|
export { buildDataContext, collectDeclarations, collectDescriptors, collectStatic, readField, resolveDeclarations, type ResolvedDeclaration, type StateRead } from './data-context.js';
|
|
3
|
-
export { mergeStates, needsWalk, readWalk, referencedLabels, RESERVED_LABELS, resolveWalkStart, stateNames, stateValue, systemsFromProcess, walkKey, walkRequest, type Diagnostic, type ProcessSystems, type RawWalk, type WalkBinding, type WalkRequest, type WalkStart, } from './graph.js';
|
|
4
|
-
export { loadPageData, resolveDataSystem, resolveSystems, type CellData, type CellWalk, type GraphSource, type NodeRecordRow, type PageRuntime, type PageScope, type QueryPage } from './load-page.js';
|
|
5
|
-
export { descriptorShape, orderByVariable, PAGING_VARIABLES, pageVariables, prepareDocument, queryKey, RENDER_FUNCTIONS, resolveDescriptorVariables, selectionShape, shapeAt, UnsafeDocumentError, validateDescriptor, VARIABLE_NAMESPACES, variableLabels, variableReferences, type PreparedDocument, type ResolvedVariables, type SelectionShape, } from './query.js';
|
|
3
|
+
export { mergeStates, needsWalk, readWalk, referencedLabels, RESERVED_LABELS, resolveWalkStart, stateNames, stateValue, systemsFromGraphs, systemsFromProcess, walkKey, walkRequest, type Diagnostic, type GraphSystem, type ProcessSystems, type RawWalk, type WalkBinding, type WalkRequest, type WalkStart, } from './graph.js';
|
|
4
|
+
export { loadPageData, resolveDataSystem, resolveSystems, type CellData, type CellWalk, type GraphSource, type NodeRecordRow, type PageRuntime, type PageScope, type QueryPage, type ReadContext, type StateRow } from './load-page.js';
|
|
5
|
+
export { descriptorShape, orderByVariable, PAGING_VARIABLES, pageVariables, prepareDocument, queryKey, RENDER_FUNCTIONS, RENDER_FUNCTIONS_AHEAD, resolveDescriptorVariables, selectionShape, shapeAt, UnsafeDocumentError, validateDescriptor, VARIABLE_NAMESPACES, variableLabels, variableReferences, type PreparedDocument, type ResolvedVariables, type SelectionShape, } from './query.js';
|
|
6
6
|
export { selectionIssues } from './selected.js';
|
|
7
7
|
export { cellPropSources, editTarget, patchAt, STRUCTURE_FIELDS, TOOL_OWNED_KEYS, type EditCell, type EditRefusal, type EditTarget, type OnSource, type PropSource, type PropSourceEntry } from './sources.js';
|
|
8
8
|
export { cellContext, cellResolutionContext, EACH, pageContext, EACH_DEFAULT_AS, isEach, passesConditions, resolveReferences, settled, type CellScope, type Each, type ResolutionContext } from './references.js';
|
|
@@ -25,3 +25,4 @@ export { clearScope, loadScope, saveScope, type StorageMode } from './store/pers
|
|
|
25
25
|
export { attachSelectionSetters, attachViewStateSetters, collectScopeIds, projectLive, projectSelections, projectViewState, shallowEqualBundle } from './store/projection.js';
|
|
26
26
|
export { pageScopeKey, projectScopeKey, resolveScopeId, type ScopeContext } from './store/scope-keys.js';
|
|
27
27
|
export type * from './store/types.js';
|
|
28
|
+
export { manifestPageFrom, validateManifest, type ManifestPage } from './release.js';
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
import type { CellLayout, PageCell } from './types.js';
|
|
3
|
-
/** The page container (the PWA's ProjectPageRenderer): stack by default; grid of `columns` (12); flex. */
|
|
4
3
|
export declare function pageContainerStyle(layout: Record<string, unknown> | null | undefined): CSSProperties;
|
|
5
|
-
/** A cell's placement in the page grid; a nested cell gets none. */
|
|
6
4
|
export declare function cellPlacementStyle(layout: CellLayout | undefined): CSSProperties;
|
|
7
|
-
/** Hooks for CSS: the renderer's responsive rules (styles.css) and bundles read these names (design/bundles.md §6). */
|
|
8
5
|
export declare function cellAttributes(cell: PageCell): Record<string, string>;
|
|
9
|
-
/**
|
|
10
|
-
* A document page's profile (`layout.profile`), set as `data-profile` on the
|
|
11
|
-
* page container so the document kit's `--doc-*` tokens resolve for it
|
|
12
|
-
* (design/core-and-tokens.md §6.5). Only a document page has one, and only a
|
|
13
|
-
* slug: the value becomes an attribute.
|
|
14
|
-
*/
|
|
15
6
|
export declare function documentProfile(layout: Record<string, unknown> | null | undefined): string | undefined;
|
|
@@ -1,82 +1,51 @@
|
|
|
1
|
-
import { type EmbedSelector, type NodeRecord, type QueryDescriptor, type StateRecord, type Traversal } from '@peripheries/runtime';
|
|
1
|
+
import { type EmbedSelector, type NodeRecord, type QueryDescriptor, type StateRecord, type RecordedEmbed, type Traversal, type VersionContext } from '@peripheries/runtime';
|
|
2
2
|
import { type ResolvedCell } from './cells.js';
|
|
3
|
-
import { type Diagnostic, type ProcessSystems, type RawWalk, type WalkRequest } from './graph.js';
|
|
3
|
+
import { type Diagnostic, type GraphSystem, type ProcessSystems, type RawWalk, type WalkRequest } from './graph.js';
|
|
4
4
|
import type { DataContext, DataEntry, ProjectPage } from './types.js';
|
|
5
|
-
|
|
5
|
+
export type ReadContext = {
|
|
6
|
+
versionId: string;
|
|
7
|
+
};
|
|
8
|
+
export type StateRow = {
|
|
9
|
+
id: string;
|
|
10
|
+
data: unknown;
|
|
11
|
+
versionId?: string | null;
|
|
12
|
+
unversioned?: boolean;
|
|
13
|
+
outOfScope?: boolean;
|
|
14
|
+
};
|
|
6
15
|
export type NodeRecordRow = Omit<NodeRecord, 'state'> & {
|
|
7
16
|
stateBySystem: Record<string, StateRecord | null>;
|
|
8
17
|
};
|
|
9
|
-
/**
|
|
10
|
-
* Where a page's graph data comes from (design/renderer.md §6). The host's
|
|
11
|
-
* reads GraphQL under the viewer's JWT; the harness's reads fixtures; the
|
|
12
|
-
* agency's reads its own client. Every method may cache.
|
|
13
|
-
*/
|
|
14
18
|
export interface GraphSource {
|
|
15
|
-
|
|
16
|
-
processSystems(processId: string): Promise<Record<string, unknown> | null>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* The same, with each state's id: what a content edit's version check names (INV-DOC-6).
|
|
23
|
-
* Optional: without it, declared values carry no state id, and can't be edited.
|
|
24
|
-
*/
|
|
25
|
-
latestStateRows?(systemId: string, graphNodeIds: string[]): Promise<Record<string, {
|
|
26
|
-
id: string;
|
|
27
|
-
data: unknown;
|
|
28
|
-
}>>;
|
|
29
|
-
walk(request: WalkRequest): Promise<RawWalk>;
|
|
30
|
-
nodeRecords(graphNodeIds: string[], systemIds: string[]): Promise<Record<string, NodeRecordRow>>;
|
|
31
|
-
/**
|
|
32
|
-
* A query, as the viewer, its result shaped by the descriptor's `result`
|
|
33
|
-
* (design/data.md §6). Variables are resolved, `$orderBy` included. The
|
|
34
|
-
* host runs it through prepareDocument; a harness answers from fixtures
|
|
35
|
-
* keyed by the operation's name.
|
|
36
|
-
*/
|
|
19
|
+
graphSystems?(processId: string): Promise<GraphSystem[]>;
|
|
20
|
+
processSystems?(processId: string): Promise<Record<string, unknown> | null>;
|
|
21
|
+
cellConfigs(systemId: string, graphNodeIds: string[], context?: ReadContext): Promise<Record<string, Record<string, unknown> | null>>;
|
|
22
|
+
latestStates(systemId: string, graphNodeIds: string[], context?: ReadContext): Promise<Record<string, unknown>>;
|
|
23
|
+
latestStateRows?(systemId: string, graphNodeIds: string[], context?: ReadContext): Promise<Record<string, StateRow>>;
|
|
24
|
+
walk(request: WalkRequest, context?: ReadContext): Promise<RawWalk>;
|
|
25
|
+
nodeRecords(graphNodeIds: string[], systemIds: string[], context?: ReadContext): Promise<Record<string, NodeRecordRow>>;
|
|
37
26
|
query(descriptor: QueryDescriptor, variables: Record<string, unknown>): Promise<unknown>;
|
|
38
|
-
/**
|
|
39
|
-
* One page of a paged descriptor (QueryDescriptor.paging): the connection at
|
|
40
|
-
* `result.path`, its nodes shaped as `query` shapes them, and its pageInfo.
|
|
41
|
-
* Optional: without it a paged label loads its first page through `query`,
|
|
42
|
-
* with no more to load.
|
|
43
|
-
*/
|
|
44
27
|
queryPage?(descriptor: QueryDescriptor, variables: Record<string, unknown>): Promise<QueryPage>;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
* by id, or the newest published of a type in a project. Null when none is
|
|
48
|
-
* readable. Optional: without it, embed cells report EMBED_NOT_FOUND.
|
|
49
|
-
*/
|
|
50
|
-
page?(selector: EmbedSelector): Promise<ProjectPage | null>;
|
|
28
|
+
mainSystems?(systemIds: string[]): Promise<ReadonlySet<string>>;
|
|
29
|
+
page?(selector: EmbedSelector, context?: ReadContext): Promise<ProjectPage | null>;
|
|
51
30
|
}
|
|
52
|
-
/** One page of a paged label. */
|
|
53
31
|
export type QueryPage = {
|
|
54
32
|
items: unknown[];
|
|
55
33
|
hasMore: boolean;
|
|
56
34
|
endCursor: string | null;
|
|
57
35
|
};
|
|
58
|
-
/** What a page's queries may read besides labels (design/data.md §5). */
|
|
59
36
|
export type PageScope = {
|
|
60
37
|
params?: Record<string, unknown>;
|
|
61
38
|
baseProps?: unknown;
|
|
62
|
-
/** The signed-in person: `userId`, `isAdvisor`, `isClient`… */
|
|
63
39
|
viewer?: unknown;
|
|
64
|
-
/** The host's location context (core.md §8); the page's own ids are added. */
|
|
65
40
|
context?: Record<string, unknown>;
|
|
66
|
-
/** Set when loading an embedded page: its own embeds don't load. */
|
|
67
41
|
embedded?: boolean;
|
|
42
|
+
version?: VersionContext;
|
|
43
|
+
recordedEmbeds?: RecordedEmbed[];
|
|
68
44
|
};
|
|
69
|
-
/** A cell's own walk: `@_traversal`, and the labels its `binding_key` nodes provide. */
|
|
70
45
|
export type CellWalk = {
|
|
71
46
|
traversal: Traversal;
|
|
72
47
|
labels: DataContext;
|
|
73
48
|
};
|
|
74
|
-
/**
|
|
75
|
-
* A cell's own data (design/renderer.md §5.2): its static values, its
|
|
76
|
-
* declarations (inline, or from its ref's config) and its walk. A cell
|
|
77
|
-
* resolves against, lowest first: static (the page's, then its own), its
|
|
78
|
-
* walk, the page's declarations, its own declarations.
|
|
79
|
-
*/
|
|
80
49
|
export type CellData = {
|
|
81
50
|
static: DataContext;
|
|
82
51
|
declared: DataContext;
|
|
@@ -84,50 +53,23 @@ export type CellData = {
|
|
|
84
53
|
};
|
|
85
54
|
export type PageRuntime = {
|
|
86
55
|
page: ProjectPage;
|
|
87
|
-
/** Every cell, its content resolved: inline as written, a ref's from its node (or its fallback). */
|
|
88
56
|
cells: ResolvedCell[];
|
|
89
|
-
/** Ref cells with neither a node config nor a component of their own: rendered as pending. */
|
|
90
57
|
unresolved: string[];
|
|
91
|
-
/** The page's static values, then its declarations on top: what every cell sees. */
|
|
92
58
|
data: DataContext;
|
|
93
|
-
/** Labels the page declares: a walk's label of the same name never replaces them. */
|
|
94
59
|
declared: string[];
|
|
95
|
-
/** Each cell's own data, by cell id (only cells that have some). */
|
|
96
60
|
cellData: Record<string, CellData>;
|
|
97
61
|
systems: ProcessSystems;
|
|
98
62
|
engDataSystemId: string | null;
|
|
99
|
-
/**
|
|
100
|
-
* Every graph node the page reads: its own, its cells', its producers', its
|
|
101
|
-
* walks' starts. Their graphs are the Realtime topics the page joins
|
|
102
|
-
* (design/data.md §10).
|
|
103
|
-
*/
|
|
104
63
|
graphNodeIds: string[];
|
|
105
|
-
|
|
64
|
+
version?: VersionContext;
|
|
65
|
+
readVersionIds?: string[];
|
|
66
|
+
embedVersion?: 'recorded' | 'context';
|
|
106
67
|
embeds?: Record<string, PageRuntime | null>;
|
|
107
68
|
diagnostics: Diagnostic[];
|
|
108
69
|
};
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
* eng-data-system-id.ts order: the process, pageProcess, systemGraph).
|
|
113
|
-
*/
|
|
114
|
-
export declare function resolveSystems(source: Pick<GraphSource, 'processSystems'>, page: ProjectPage): Promise<ProcessSystems>;
|
|
115
|
-
/** The page's DSNS: what thin refs hydrate from and what declarations read by default. */
|
|
116
|
-
export declare function resolveDataSystem(source: Pick<GraphSource, 'processSystems'>, page: ProjectPage): Promise<string | null>;
|
|
117
|
-
/**
|
|
118
|
-
* Everything a page needs before it renders (design/core.md §3, stages 1–3;
|
|
119
|
-
* design/renderer.md §3, §5; design/data.md §6): read every ref's node config
|
|
120
|
-
* (one read per system), then every declaration's producer (one read per
|
|
121
|
-
* system), every walk a cell needs, any NodeRecords, and the queries whose
|
|
122
|
-
* variables read no label, in parallel; then the queries whose variables read
|
|
123
|
-
* a label, and those found in live query nodes. Framework-free: the source
|
|
124
|
-
* decides how each read runs (the host's runs in its route loader, through
|
|
125
|
-
* TanStack Query, under the viewer's JWT).
|
|
126
|
-
*/
|
|
127
|
-
/**
|
|
128
|
-
* A query that didn't run because references resolved to nothing. It has nothing to show yet
|
|
129
|
-
* (`unresolved`) only when every reference is simply absent; one into a label whose read failed
|
|
130
|
-
* is that failure (shell audit S1), not an empty result.
|
|
131
|
-
*/
|
|
70
|
+
type SystemsSource = Pick<GraphSource, 'graphSystems' | 'processSystems'>;
|
|
71
|
+
export declare function resolveSystems(source: SystemsSource, page: ProjectPage): Promise<ProcessSystems>;
|
|
72
|
+
export declare function resolveDataSystem(source: SystemsSource, page: ProjectPage): Promise<string | null>;
|
|
132
73
|
export declare function unresolvedEntry(missing: string[], data: DataContext): DataEntry;
|
|
133
74
|
export declare function loadPageData(page: ProjectPage, source: GraphSource, scope?: PageScope): Promise<PageRuntime>;
|
|
75
|
+
export {};
|
|
@@ -1,41 +1,23 @@
|
|
|
1
1
|
import { type QueryDescriptor, type QueryOrderBy } from '@peripheries/runtime';
|
|
2
2
|
import type { Diagnostic } from './graph.js';
|
|
3
3
|
import { type ResolutionContext } from './references.js';
|
|
4
|
-
/**
|
|
5
|
-
* Functions a render-time document may read, with the tables each reads (for
|
|
6
|
-
* invalidation). pg_graphql reflects every stable function the role can run
|
|
7
|
-
* as a Query field, and many are SECURITY DEFINER, so a function is allowed
|
|
8
|
-
* only by name, once a database test has pinned it as stable, SECURITY
|
|
9
|
-
* INVOKER, closed to anon and with a fixed search_path
|
|
10
|
-
* (tests/integration/graph-reads.test.ts).
|
|
11
|
-
*/
|
|
12
4
|
export declare const RENDER_FUNCTIONS: Readonly<Record<string, readonly string[]>>;
|
|
5
|
+
export declare const RENDER_FUNCTIONS_AHEAD: Readonly<Record<string, string>>;
|
|
13
6
|
export type PreparedDocument = {
|
|
14
7
|
text: string;
|
|
15
8
|
operationName: string | undefined;
|
|
16
|
-
/** Root entity names, e.g. `project_page` for `project_pageCollection`; `*` for `node`; a render function's tables. */
|
|
17
9
|
entities: readonly string[];
|
|
18
|
-
/** Stable short hash of the prepared text; part of query keys. */
|
|
19
10
|
hash: string;
|
|
20
11
|
};
|
|
21
12
|
export declare class UnsafeDocumentError extends Error {
|
|
22
13
|
name: string;
|
|
14
|
+
readonly code?: 'DESCRIPTOR_VERSION_FILTER' | 'DESCRIPTOR_STATE_UNSCOPED';
|
|
15
|
+
constructor(message: string, options?: {
|
|
16
|
+
code: 'DESCRIPTOR_VERSION_FILTER' | 'DESCRIPTOR_STATE_UNSCOPED';
|
|
17
|
+
});
|
|
23
18
|
}
|
|
24
|
-
|
|
25
|
-
* A GraphQL document checked against the render-time rule (design/renderer.md
|
|
26
|
-
* §4.5) and ready to send: exactly one `query` operation whose root fields are
|
|
27
|
-
* table or view collections, `ByPk` reads, `node`, or a render function.
|
|
28
|
-
* `__typename` is added to every nested selection, so a host can find JSON
|
|
29
|
-
* columns in the result. Throws UnsafeDocumentError.
|
|
30
|
-
*/
|
|
19
|
+
export declare const MAIN_ONLY_COLLECTIONS: ReadonlySet<string>;
|
|
31
20
|
export declare function prepareDocument(source: string): PreparedDocument;
|
|
32
|
-
/**
|
|
33
|
-
* The shape of a query's result, from its selection alone (design/data.md
|
|
34
|
-
* §2.1): a field without a selection set is a `leaf` (a scalar, a JSON column
|
|
35
|
-
* or an array column, so any path below it may exist); `edges { node }` is a
|
|
36
|
-
* list. With `flatten_connections`, a connection that selects edges is the
|
|
37
|
-
* list of its nodes, as the host shapes it.
|
|
38
|
-
*/
|
|
39
21
|
export type SelectionShape = {
|
|
40
22
|
kind: 'leaf';
|
|
41
23
|
} | {
|
|
@@ -45,53 +27,25 @@ export type SelectionShape = {
|
|
|
45
27
|
kind: 'list';
|
|
46
28
|
of: SelectionShape;
|
|
47
29
|
};
|
|
48
|
-
/** The shape a document's selection yields, before `result.path`. */
|
|
49
30
|
export declare function selectionShape(document: string, flatten?: boolean): SelectionShape;
|
|
50
|
-
/**
|
|
51
|
-
* The shape at a dot path, or null when the selection doesn't select it. A
|
|
52
|
-
* numeric segment indexes a list; anything below a leaf is accepted.
|
|
53
|
-
*/
|
|
54
31
|
export declare function shapeAt(shape: SelectionShape, path: readonly string[]): SelectionShape | null;
|
|
55
|
-
/** What a descriptor's label holds: its selection, flattened, at `result.path`. Null when the path isn't selected. */
|
|
56
32
|
export declare function descriptorShape(descriptor: QueryDescriptor): SelectionShape | null;
|
|
57
|
-
/** Namespaces a variable may read, besides labels (design/data.md §5). */
|
|
58
33
|
export declare const VARIABLE_NAMESPACES: readonly ["params", "baseProps", "viewer", "context"];
|
|
59
|
-
/** Every whole-string reference in a descriptor's variables, by the label or namespace it reads. */
|
|
60
34
|
export declare function variableReferences(variables: unknown): Array<{
|
|
61
35
|
ref: string;
|
|
62
36
|
label: string;
|
|
63
37
|
}>;
|
|
64
|
-
/** The labels (not namespaces) a descriptor's variables read: what decides its round (design/data.md §5, §6). */
|
|
65
38
|
export declare const variableLabels: (descriptor: Pick<QueryDescriptor, "variables">) => string[];
|
|
66
|
-
/**
|
|
67
|
-
* A descriptor's static checks (design/data.md §4): the version-1 shape, one
|
|
68
|
-
* query operation under the render-time rule, every required variable given
|
|
69
|
-
* (`$orderBy` by `order_by`), references well formed, and `result.path`
|
|
70
|
-
* selected. It doesn't run anything; a dry run under a real viewer checks the
|
|
71
|
-
* rest against the database. `path` prefixes each diagnostic's path.
|
|
72
|
-
*/
|
|
73
39
|
export declare function validateDescriptor(descriptor: unknown, path?: string): Diagnostic[];
|
|
74
|
-
/** `order_by` as pg_graphql's `orderBy` argument: `[{ updated_at: DescNullsLast }]`. */
|
|
75
40
|
export declare const orderByVariable: (orderBy: readonly QueryOrderBy[]) => {
|
|
76
41
|
[x: string]: string;
|
|
77
42
|
}[];
|
|
78
43
|
export type ResolvedVariables = {
|
|
79
44
|
variables: Record<string, unknown>;
|
|
80
|
-
/** References that resolved to nothing (null or undefined): the query doesn't run (QUERY_UNRESOLVED). */
|
|
81
45
|
unresolved: string[];
|
|
82
|
-
/** References whose data is still loading: the query waits. */
|
|
83
46
|
pending: string[];
|
|
84
47
|
};
|
|
85
|
-
/**
|
|
86
|
-
* A descriptor's variables, resolved with the one reference grammar (the same
|
|
87
|
-
* resolver as props), plus `$orderBy` from `order_by` when the document
|
|
88
|
-
* declares it. A whole-string reference that resolves to null or nothing is
|
|
89
|
-
* unresolved; interpolation (`${x}`) works as in props.
|
|
90
|
-
*/
|
|
91
48
|
export declare function resolveDescriptorVariables(descriptor: QueryDescriptor, ctx: ResolutionContext): ResolvedVariables;
|
|
92
|
-
/** The variables a paged descriptor's document declares and the renderer sets. */
|
|
93
49
|
export declare const PAGING_VARIABLES: ReadonlySet<string>;
|
|
94
|
-
/** A paged descriptor's variables for one page: `$first` its size, `$after` the cursor (null for the first page). */
|
|
95
50
|
export declare const pageVariables: (descriptor: QueryDescriptor, variables: Record<string, unknown>, after?: string | null) => Record<string, unknown>;
|
|
96
|
-
/** One query per distinct question: the document and the resolved variables, and the result's shape. */
|
|
97
51
|
export declare const queryKey: (descriptor: QueryDescriptor, variables: Record<string, unknown>) => string;
|
|
@@ -3,16 +3,11 @@ import type { DataContext } from './types.js';
|
|
|
3
3
|
export type ResolutionContext = {
|
|
4
4
|
data: DataContext;
|
|
5
5
|
params: Record<string, unknown>;
|
|
6
|
-
/** Told of each whole-string `@ref` that resolves to nothing (a missing label, path or leaf), except while its data loads. */
|
|
7
6
|
onUnresolved?: (ref: string) => void;
|
|
8
|
-
/** Told of each whole-string `@ref` whose data is still loading. */
|
|
9
7
|
onLoading?: (ref: string) => void;
|
|
10
|
-
/** Told of each resolved leaf, by its prop path, with where its value came from (INV-DOC-6; sources.ts). */
|
|
11
8
|
onSource?: OnSource;
|
|
12
9
|
};
|
|
13
|
-
/** The key that marks a projection: `{ "@each": "@label.path", "as": "item", "map": … }`. */
|
|
14
10
|
export declare const EACH = "@each";
|
|
15
|
-
/** The element's label inside `map` when `as` is not given. */
|
|
16
11
|
export declare const EACH_DEFAULT_AS = "item";
|
|
17
12
|
export type Each = {
|
|
18
13
|
[EACH]: string;
|
|
@@ -20,17 +15,12 @@ export type Each = {
|
|
|
20
15
|
map: unknown;
|
|
21
16
|
};
|
|
22
17
|
export declare const isEach: (value: unknown) => value is Each;
|
|
23
|
-
/**
|
|
24
|
-
* Resolve every string in a value, recursively through arrays and plain objects. Keys aren't
|
|
25
|
-
* resolved. `at` is the value's path among the props, for `onSource`.
|
|
26
|
-
*/
|
|
27
18
|
export declare function resolveReferences<T = unknown>(value: T, ctx: ResolutionContext, at?: string[]): T;
|
|
28
19
|
export declare const settled: (data: unknown) => {
|
|
29
20
|
data: unknown;
|
|
30
21
|
isLoading: boolean;
|
|
31
22
|
error: null;
|
|
32
23
|
};
|
|
33
|
-
/** What a cell brings to its own resolution (loadPageData's CellData), and the labels the page declares. */
|
|
34
24
|
export type CellScope = {
|
|
35
25
|
static?: DataContext;
|
|
36
26
|
declared?: DataContext;
|
|
@@ -43,14 +33,6 @@ export type CellScope = {
|
|
|
43
33
|
};
|
|
44
34
|
pageDeclared?: ReadonlySet<string>;
|
|
45
35
|
};
|
|
46
|
-
/**
|
|
47
|
-
* The context one cell resolves against (design/renderer.md §5.2), lowest
|
|
48
|
-
* first: the page's static values, the cell's own static values, the labels
|
|
49
|
-
* the cell's walk found, the page's declarations, the cell's own
|
|
50
|
-
* declarations; then the reserved
|
|
51
|
-
* `_traversal`, `params`, `baseProps`, `viewer` and `context`, which nothing
|
|
52
|
-
* can shadow. Explicit beats discovered: no walk label replaces a declared one.
|
|
53
|
-
*/
|
|
54
36
|
export declare function cellResolutionContext(_cell: {
|
|
55
37
|
data?: {
|
|
56
38
|
queries?: Record<string, unknown>;
|
|
@@ -59,7 +41,6 @@ export declare function cellResolutionContext(_cell: {
|
|
|
59
41
|
viewer?: unknown;
|
|
60
42
|
context?: unknown;
|
|
61
43
|
}): ResolutionContext;
|
|
62
|
-
/** The location context every cell on a page shares (core.md §8): the host's, with the page's own ids. */
|
|
63
44
|
export declare const pageContext: (context: Record<string, unknown> | undefined, page: {
|
|
64
45
|
id: string;
|
|
65
46
|
project_id: string | null;
|
|
@@ -69,14 +50,12 @@ export declare const pageContext: (context: Record<string, unknown> | undefined,
|
|
|
69
50
|
projectId: string | null;
|
|
70
51
|
processId: string | null;
|
|
71
52
|
};
|
|
72
|
-
/** One cell's location context: the page's, with the cell's own node. */
|
|
73
53
|
export declare const cellContext: (context: Record<string, unknown>, cell: {
|
|
74
54
|
graph_node_id?: string;
|
|
75
55
|
metadata?: Record<string, unknown>;
|
|
76
56
|
}) => {
|
|
77
57
|
nodeId: string | undefined;
|
|
78
58
|
};
|
|
79
|
-
/** showIf / hideIf: values (usually strict refs) tested for truthiness. An empty string skips the check. */
|
|
80
59
|
export declare function passesConditions(conditions: {
|
|
81
60
|
showIf?: unknown;
|
|
82
61
|
hideIf?: unknown;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReleaseProblem } from '@peripheries/runtime';
|
|
2
|
+
import type { ProjectPage } from './types.js';
|
|
3
|
+
import { type Catalog } from './validate.js';
|
|
4
|
+
export type ManifestPage = {
|
|
5
|
+
graphNodeId: string;
|
|
6
|
+
page: Pick<ProjectPage, 'content' | 'layout'> & {
|
|
7
|
+
is_template?: boolean | null;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare function validateManifest(pages: ManifestPage[], catalog?: Catalog): ReleaseProblem[];
|
|
11
|
+
export declare function manifestPageFrom(graphNodeId: string, data: unknown): ManifestPage;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import type { QueryDescriptor } from '@peripheries/runtime';
|
|
2
2
|
import type { Diagnostic } from './graph.js';
|
|
3
3
|
import type { PageCell } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* The paths one cell's props and conditions read from the given query labels
|
|
6
|
-
* that the queries don't select. Inside an `@each` over a query's list, the
|
|
7
|
-
* element's paths are checked against the list's element. `at` prefixes paths.
|
|
8
|
-
*/
|
|
9
4
|
export declare function selectionIssues(cell: Pick<PageCell, 'id' | 'props' | 'conditions'>, queries: Record<string, QueryDescriptor>, at: string): Diagnostic[];
|