@platforma-sdk/model 1.86.5 → 1.87.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/dist/columns/column_providers/providers.cjs +2 -10
- package/dist/columns/column_providers/providers.cjs.map +1 -1
- package/dist/columns/column_providers/providers.d.ts.map +1 -1
- package/dist/columns/column_providers/providers.js +3 -11
- package/dist/columns/column_providers/providers.js.map +1 -1
- package/dist/columns/column_recipes/index.cjs +2 -2
- package/dist/columns/column_recipes/index.cjs.map +1 -1
- package/dist/columns/column_recipes/index.d.ts +2 -3
- package/dist/columns/column_recipes/index.d.ts.map +1 -1
- package/dist/columns/column_recipes/index.js +2 -2
- package/dist/columns/column_recipes/index.js.map +1 -1
- package/dist/columns/data_column.cjs +12 -42
- package/dist/columns/data_column.cjs.map +1 -1
- package/dist/columns/data_column.d.ts +10 -26
- package/dist/columns/data_column.d.ts.map +1 -1
- package/dist/columns/data_column.js +13 -42
- package/dist/columns/data_column.js.map +1 -1
- package/dist/columns/index.cjs +0 -1
- package/dist/columns/index.d.ts +2 -2
- package/dist/columns/index.js +2 -2
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/package.json +1 -1
- package/src/columns/column_providers/providers.ts +3 -15
- package/src/columns/column_recipes/column_recipes.test.ts +11 -15
- package/src/columns/column_recipes/index.ts +2 -3
- package/src/columns/data_column.test.ts +13 -14
- package/src/columns/data_column.ts +12 -41
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
isPlRef,
|
|
7
7
|
PlRef,
|
|
8
8
|
PObjectId,
|
|
9
|
-
type ColumnUniversalId,
|
|
10
9
|
type LeafEntry,
|
|
11
10
|
type PColumn,
|
|
12
11
|
type PColumnSpec,
|
|
@@ -53,24 +52,6 @@ export interface DataColumnRecipe<
|
|
|
53
52
|
getData(): ColumnData;
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
/**
|
|
57
|
-
* Thrown by leaf-recipe factories when the requested column is provably
|
|
58
|
-
* absent in the active render ctx — i.e. every relevant accessor reports
|
|
59
|
-
* `inputsLocked` and the column did not appear. Distinct from the
|
|
60
|
-
* `undefined` return that the factories still use for the "resolving" case
|
|
61
|
-
* (the column may still appear later).
|
|
62
|
-
*
|
|
63
|
-
* Catch at the boundary (resolver / filter+sort wiring / data-table assembly)
|
|
64
|
-
* when partial absence should be surfaced to the user rather than silently
|
|
65
|
-
* producing an empty result.
|
|
66
|
-
*/
|
|
67
|
-
export class ColumnAbsentError extends Error {
|
|
68
|
-
constructor(public readonly id: ColumnUniversalId) {
|
|
69
|
-
super(`Column is absent in the active render ctx and will not appear: ${id}`);
|
|
70
|
-
this.name = "ColumnAbsentError";
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
55
|
/**
|
|
75
56
|
* The leaf-recipe building block: a {@link DataColumnRecipe} whose `id` is a bare
|
|
76
57
|
* {@link PObjectId} and whose readers are bound to a single tree-accessor
|
|
@@ -134,22 +115,17 @@ export class DataColumnImpl implements DataColumnRecipe<PObjectId> {
|
|
|
134
115
|
|
|
135
116
|
/**
|
|
136
117
|
* Resolve via the ambient {@link ColumnRegistry}. Spec is resolved eagerly:
|
|
137
|
-
* returns `undefined`
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* exist in this ctx. Data and dataStatus stay lazy.
|
|
118
|
+
* returns `undefined` unless the id names a column whose spec is readable in
|
|
119
|
+
* this ctx — while it is resolving, when it is absent, and when the id names
|
|
120
|
+
* an export that is not a column (a `kind: "File"` object, for example).
|
|
121
|
+
* Data and dataStatus stay lazy.
|
|
142
122
|
*/
|
|
143
123
|
static fromId(
|
|
144
124
|
id: PObjectId,
|
|
145
125
|
{ ctx }: { ctx?: GlobalCfgRenderCtx } = {},
|
|
146
126
|
): undefined | DataColumnRecipe<PObjectId> {
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
if (isNil(leaf)) {
|
|
150
|
-
if (registry.isFinal()) throw new ColumnAbsentError(id);
|
|
151
|
-
return undefined;
|
|
152
|
-
}
|
|
127
|
+
const leaf = new ColumnRegistry(getCtxProviders({ ctx })).resolve(id);
|
|
128
|
+
if (isNil(leaf)) return undefined;
|
|
153
129
|
return DataColumnImpl.fromAccessor(leaf);
|
|
154
130
|
}
|
|
155
131
|
|
|
@@ -160,18 +136,13 @@ export class DataColumnImpl implements DataColumnRecipe<PObjectId> {
|
|
|
160
136
|
|
|
161
137
|
/**
|
|
162
138
|
* Bind directly to an accessor-backed {@link LeafEntry} — no registry.
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
139
|
+
* Returns `undefined` unless the leaf's spec is readable and is a column
|
|
140
|
+
* spec: while the spec is resolving, when it is absent, and for an export
|
|
141
|
+
* that is not a column.
|
|
166
142
|
*/
|
|
167
143
|
static fromAccessor(entry: LeafEntry<TreeNodeAccessor>): undefined | DataColumnRecipe<PObjectId> {
|
|
168
|
-
if (isNil(readSpecAccessor(entry))) {
|
|
169
|
-
if (entry.accessor.getInputsLocked()) throw new ColumnAbsentError(entry.id);
|
|
170
|
-
return undefined;
|
|
171
|
-
}
|
|
172
144
|
const spec = readSpec(entry);
|
|
173
|
-
if (spec === undefined) return undefined;
|
|
174
|
-
if (!isPColumnSpec(spec)) throw new ColumnAbsentError(entry.id);
|
|
145
|
+
if (spec === undefined || !isPColumnSpec(spec)) return undefined;
|
|
175
146
|
return new DataColumnImpl(entry.id, {
|
|
176
147
|
getSpec: () => spec,
|
|
177
148
|
getData: () => readDataAccessor(entry),
|
|
@@ -204,8 +175,8 @@ export class DataColumnImpl implements DataColumnRecipe<PObjectId> {
|
|
|
204
175
|
* in the active render ctx. Falls back to the registry's `isFinal()`
|
|
205
176
|
* when the id has no entry — only then we can say `absent` instead of
|
|
206
177
|
* `resolving`. The status tells only whether the spec is readable: for an
|
|
207
|
-
* export that is not a column it is `present`, and the factories
|
|
208
|
-
*
|
|
178
|
+
* export that is not a column it is `present`, and the factories return
|
|
179
|
+
* `undefined`.
|
|
209
180
|
*/
|
|
210
181
|
static getStatusById(
|
|
211
182
|
id: PObjectId,
|