@platforma-sdk/model 1.76.4 → 1.77.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_collection_builder.cjs +6 -3
- package/dist/columns/column_collection_builder.cjs.map +1 -1
- package/dist/columns/column_collection_builder.js +6 -3
- package/dist/columns/column_collection_builder.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV2.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.d.ts +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/index.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/index.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.d.ts +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.js.map +1 -1
- package/dist/components/PlDataTable/index.d.ts +1 -1
- package/dist/components/PlDataTable/state-migration.cjs +32 -1
- package/dist/components/PlDataTable/state-migration.cjs.map +1 -1
- package/dist/components/PlDataTable/state-migration.d.ts +4 -3
- package/dist/components/PlDataTable/state-migration.d.ts.map +1 -1
- package/dist/components/PlDataTable/state-migration.js +33 -2
- package/dist/components/PlDataTable/state-migration.js.map +1 -1
- package/dist/components/PlDataTable/typesV6.d.ts +26 -84
- package/dist/components/PlDataTable/typesV6.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV7.d.ts +98 -0
- package/dist/components/PlDataTable/typesV7.d.ts.map +1 -0
- package/dist/components/PlDatasetSelector/build_dataset_options.cjs +5 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.d.ts +6 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.js +5 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.js.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.cjs +21 -30
- package/dist/components/PlDatasetSelector/filter_discovery.cjs.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.d.ts +20 -20
- package/dist/components/PlDatasetSelector/filter_discovery.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.js +21 -30
- package/dist/components/PlDatasetSelector/filter_discovery.js.map +1 -1
- package/dist/components/PlDatasetSelector/index.d.ts +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/package.json +5 -5
- package/src/columns/column_collection_builder.ts +12 -3
- package/src/components/PlDataTable/createPlDataTable/createPTableDefV2.ts +1 -1
- package/src/components/PlDataTable/createPlDataTable/createPTableDefV3.ts +1 -1
- package/src/components/PlDataTable/createPlDataTable/createPlDataTableV2.ts +1 -1
- package/src/components/PlDataTable/createPlDataTable/createPlDataTableV3.ts +1 -1
- package/src/components/PlDataTable/createPlDataTable/index.ts +1 -1
- package/src/components/PlDataTable/createPlDataTableSheet.ts +1 -1
- package/src/components/PlDataTable/index.ts +1 -1
- package/src/components/PlDataTable/state-migration.ts +71 -13
- package/src/components/PlDataTable/typesV6.ts +16 -138
- package/src/components/PlDataTable/typesV7.ts +151 -0
- package/src/components/PlDatasetSelector/build_dataset_options.ts +10 -2
- package/src/components/PlDatasetSelector/filter_discovery.test.ts +116 -19
- package/src/components/PlDatasetSelector/filter_discovery.ts +46 -39
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter_discovery.d.ts","names":[],"sources":["../../../src/components/PlDatasetSelector/filter_discovery.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"filter_discovery.d.ts","names":[],"sources":["../../../src/components/PlDatasetSelector/filter_discovery.ts"],"mappings":";;;;;;;AAiBA;;iBAAgB,iBAAA,CAAkB,UAAA,EAAY,wBAAA,GAA2B,WAAA;AAAA,KAS7D,kBAAA;EATkC,qFAW5C,cAAA,EAAgB,WAAA,CAAY,SAAA,EAAW,KAAA,GAXgC;EAavE,WAAA,EAAa,WAAA;EAbqE;AASpF;;;;;EAWE,YAAA,GAAe,mBAAA;AAAA;;;;;;iBAQD,sBAAA,CACd,OAAA,EAAS,WAAA,IACT,OAAA,EAAS,kBAAA,GACR,MAAA;;iBAkCa,WAAA,CAAY,OAAA;EAAA,SAA6B,GAAA,EAAK,KAAA;AAAA,MAAY,GAAA,CAAI,SAAA,EAAW,KAAA"}
|
|
@@ -3,12 +3,8 @@ import { Annotation } from "@milaboratories/pl-model-common";
|
|
|
3
3
|
import canonicalize from "canonicalize";
|
|
4
4
|
//#region src/components/PlDatasetSelector/filter_discovery.ts
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The axes-subset constraint is enforced by `mode: "enrichment"`, which sets
|
|
9
|
-
* `allowFloatingHitAxes: false` — every axis of the matched column must be
|
|
10
|
-
* present in the anchor's axes. See `matchingModeToConstraints()` in
|
|
11
|
-
* `column_collection_builder.ts`.
|
|
6
|
+
* Columns annotated `pl7.app/isSubset: "true"` whose axes ⊆ anchor axes.
|
|
7
|
+
* The axes-subset constraint comes from `mode: "enrichment"`.
|
|
12
8
|
*/
|
|
13
9
|
function findFilterColumns(collection) {
|
|
14
10
|
return collection.findColumns({
|
|
@@ -17,42 +13,37 @@ function findFilterColumns(collection) {
|
|
|
17
13
|
});
|
|
18
14
|
}
|
|
19
15
|
/**
|
|
20
|
-
* Derive
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* skipped — they cannot be exposed as user-selectable options.
|
|
24
|
-
*
|
|
25
|
-
* @param matches - from findFilterColumns()
|
|
26
|
-
* @param refsByObjectId - from {@link buildRefMap}
|
|
27
|
-
* @param labelOptions - forwarded to deriveDistinctLabels()
|
|
16
|
+
* Derive labels for filter column matches (for `DatasetOption.filters`).
|
|
17
|
+
* Matches whose column id is missing from `refsByObjectId` are silently
|
|
18
|
+
* dropped — they cannot be exposed as selectable options.
|
|
28
19
|
*/
|
|
29
|
-
function filterMatchesToOptions(matches,
|
|
20
|
+
function filterMatchesToOptions(matches, options) {
|
|
30
21
|
if (matches.length === 0) return [];
|
|
31
|
-
const
|
|
22
|
+
const { refsByObjectId, datasetSpec, labelOptions } = options;
|
|
23
|
+
const entries = matches.flatMap((match) => {
|
|
32
24
|
const ref = refsByObjectId.get(match.column.id);
|
|
33
25
|
if (ref === void 0) return [];
|
|
34
26
|
return match.variants.map((variant) => ({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
ref,
|
|
28
|
+
spec: match.column.spec,
|
|
29
|
+
linkerPath: variant.path.map((p) => ({ spec: p.linker.spec }))
|
|
38
30
|
}));
|
|
39
31
|
});
|
|
40
|
-
const labels = deriveDistinctLabels(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
const labels = deriveDistinctLabels([...entries, { spec: datasetSpec }], {
|
|
33
|
+
...labelOptions,
|
|
34
|
+
formatters: {
|
|
35
|
+
...labelOptions?.formatters,
|
|
36
|
+
native: () => void 0
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return entries.map(({ ref }, i) => ({
|
|
45
40
|
ref,
|
|
46
41
|
label: labels[i]
|
|
47
42
|
}));
|
|
48
43
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Usage: `buildRefMap(ctx.resultPool.getSpecs().entries)`
|
|
51
|
-
*/
|
|
44
|
+
/** Build the `refsByObjectId` map from `ctx.resultPool.getSpecs().entries`. */
|
|
52
45
|
function buildRefMap(entries) {
|
|
53
|
-
|
|
54
|
-
for (const entry of entries) map.set(canonicalize(entry.ref), entry.ref);
|
|
55
|
-
return map;
|
|
46
|
+
return new Map(entries.map((e) => [canonicalize(e.ref), e.ref]));
|
|
56
47
|
}
|
|
57
48
|
//#endregion
|
|
58
49
|
export { buildRefMap, filterMatchesToOptions, findFilterColumns };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter_discovery.js","names":[],"sources":["../../../src/components/PlDatasetSelector/filter_discovery.ts"],"sourcesContent":["import { Annotation } from \"@milaboratories/pl-model-common\";\nimport type { Option, PlRef, PObjectId } from \"@milaboratories/pl-model-common\";\nimport canonicalize from \"canonicalize\";\nimport type {\n AnchoredColumnCollection,\n ColumnMatch,\n} from \"../../columns/column_collection_builder\";\nimport {\n deriveDistinctLabels,\n type DeriveLabelsOptions,\n type Entry,\n} from \"../../labels/derive_distinct_labels\";\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"filter_discovery.js","names":[],"sources":["../../../src/components/PlDatasetSelector/filter_discovery.ts"],"sourcesContent":["import { Annotation } from \"@milaboratories/pl-model-common\";\nimport type { Option, PlRef, PObjectId, PObjectSpec } from \"@milaboratories/pl-model-common\";\nimport canonicalize from \"canonicalize\";\nimport type {\n AnchoredColumnCollection,\n ColumnMatch,\n} from \"../../columns/column_collection_builder\";\nimport {\n deriveDistinctLabels,\n type DeriveLabelsOptions,\n type Entry,\n} from \"../../labels/derive_distinct_labels\";\n\n/**\n * Columns annotated `pl7.app/isSubset: \"true\"` whose axes ⊆ anchor axes.\n * The axes-subset constraint comes from `mode: \"enrichment\"`.\n */\nexport function findFilterColumns(collection: AnchoredColumnCollection): ColumnMatch[] {\n return collection.findColumns({\n mode: \"enrichment\",\n include: {\n annotations: { [Annotation.IsSubset]: \"true\" },\n },\n });\n}\n\nexport type FilterMatchOptions = {\n /** Maps result-pool column id back to its source PlRef (see {@link buildRefMap}). */\n refsByObjectId: ReadonlyMap<PObjectId, PlRef>;\n /** Spec of the dataset the filters are subsets of. */\n datasetSpec: PObjectSpec;\n /**\n * Forwarded to `deriveDistinctLabels`. Any `formatters.native` caller\n * sets is silently overridden — the function relies on a no-op native\n * formatter to keep the algorithm from short-circuiting on filters'\n * inherited `pl7.app/label`.\n */\n labelOptions?: DeriveLabelsOptions;\n};\n\n/**\n * Derive labels for filter column matches (for `DatasetOption.filters`).\n * Matches whose column id is missing from `refsByObjectId` are silently\n * dropped — they cannot be exposed as selectable options.\n */\nexport function filterMatchesToOptions(\n matches: ColumnMatch[],\n options: FilterMatchOptions,\n): Option[] {\n if (matches.length === 0) return [];\n\n const { refsByObjectId, datasetSpec, labelOptions } = options;\n\n // One entry per match-variant (different paths to the same column are\n // exposed as separate Options). The `ref` field rides along on the\n // Entry-shaped objects via structural typing; `deriveDistinctLabels`\n // ignores extra fields.\n const entries = matches.flatMap((match): (Entry & { ref: PlRef })[] => {\n const ref = refsByObjectId.get(match.column.id);\n if (ref === undefined) return [];\n return match.variants.map((variant) => ({\n ref,\n spec: match.column.spec,\n linkerPath: variant.path.map((p) => ({ spec: p.linker.spec })),\n }));\n });\n\n // Appending the dataset forces a discriminating trace step into every\n // filter label (yielding e.g. \"Bulk / Top 10\"); the dataset's own label\n // is dropped because we only zip `entries`. Native label is force-\n // suppressed (the override sits after caller's spread) — filters\n // inherit the dataset's `pl7.app/label` and would otherwise satisfy\n // uniqueness before any trace step is consulted.\n const labels = deriveDistinctLabels([...entries, { spec: datasetSpec }], {\n ...labelOptions,\n formatters: { ...labelOptions?.formatters, native: () => undefined },\n });\n\n return entries.map(({ ref }, i) => ({ ref, label: labels[i] }));\n}\n\n/** Build the `refsByObjectId` map from `ctx.resultPool.getSpecs().entries`. */\nexport function buildRefMap(entries: readonly { readonly ref: PlRef }[]): Map<PObjectId, PlRef> {\n return new Map(entries.map((e) => [canonicalize(e.ref)! as PObjectId, e.ref]));\n}\n"],"mappings":";;;;;;;;AAiBA,SAAgB,kBAAkB,YAAqD;AACrF,QAAO,WAAW,YAAY;EAC5B,MAAM;EACN,SAAS,EACP,aAAa,GAAG,WAAW,WAAW,QAAQ,EAC/C;EACF,CAAC;;;;;;;AAsBJ,SAAgB,uBACd,SACA,SACU;AACV,KAAI,QAAQ,WAAW,EAAG,QAAO,EAAE;CAEnC,MAAM,EAAE,gBAAgB,aAAa,iBAAiB;CAMtD,MAAM,UAAU,QAAQ,SAAS,UAAsC;EACrE,MAAM,MAAM,eAAe,IAAI,MAAM,OAAO,GAAG;AAC/C,MAAI,QAAQ,KAAA,EAAW,QAAO,EAAE;AAChC,SAAO,MAAM,SAAS,KAAK,aAAa;GACtC;GACA,MAAM,MAAM,OAAO;GACnB,YAAY,QAAQ,KAAK,KAAK,OAAO,EAAE,MAAM,EAAE,OAAO,MAAM,EAAE;GAC/D,EAAE;GACH;CAQF,MAAM,SAAS,qBAAqB,CAAC,GAAG,SAAS,EAAE,MAAM,aAAa,CAAC,EAAE;EACvE,GAAG;EACH,YAAY;GAAE,GAAG,cAAc;GAAY,cAAc,KAAA;GAAW;EACrE,CAAC;AAEF,QAAO,QAAQ,KAAK,EAAE,OAAO,OAAO;EAAE;EAAK,OAAO,OAAO;EAAI,EAAE;;;AAIjE,SAAgB,YAAY,SAAoE;AAC9F,QAAO,IAAI,IAAI,QAAQ,KAAK,MAAM,CAAC,aAAa,EAAE,IAAI,EAAgB,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DatasetOption, DatasetSelection, createDatasetSelection, isDatasetSelection } from "./dataset_selection.js";
|
|
2
|
-
import { buildRefMap, filterMatchesToOptions, findFilterColumns } from "./filter_discovery.js";
|
|
2
|
+
import { FilterMatchOptions, buildRefMap, filterMatchesToOptions, findFilterColumns } from "./filter_discovery.js";
|
|
3
3
|
import { BuildDatasetOptions, buildDatasetOptions } from "./build_dataset_options.js";
|
|
@@ -3,9 +3,9 @@ import { createPFrameForGraphs, isHiddenFromGraphColumn, isHiddenFromUIColumn }
|
|
|
3
3
|
import { AndFilter, AnnotationFilter, AnnotationMode, AnnotationScript, AnnotationScript2, AnnotationStep, IsNA, Log10, NotFilter, NumericalComparisonFilter, OrFilter, PatternFilter, PatternPredicate, PatternPredicateContainSubsequence, PatternPredicateEquals, SortedCumulativeSum, TransformedColumn, ValueRank } from "./PlAnnotations/filter.js";
|
|
4
4
|
import { AnnotationScriptUi, AnnotationStepUi, AnyForm, FilterUi, FilterUiOfType, FilterUiType, FormField, TypeField, TypeFieldRecord, TypeForm, TypeToLiteral, compileAnnotationScript, compileFilter, compileFilters, unreachable } from "./PlAnnotations/filters_ui.js";
|
|
5
5
|
import { DatasetOption, DatasetSelection, createDatasetSelection, isDatasetSelection } from "./PlDatasetSelector/dataset_selection.js";
|
|
6
|
-
import { buildRefMap, filterMatchesToOptions, findFilterColumns } from "./PlDatasetSelector/filter_discovery.js";
|
|
6
|
+
import { FilterMatchOptions, buildRefMap, filterMatchesToOptions, findFilterColumns } from "./PlDatasetSelector/filter_discovery.js";
|
|
7
7
|
import { BuildDatasetOptions, buildDatasetOptions } from "./PlDatasetSelector/build_dataset_options.js";
|
|
8
|
-
import { PTableParamsV2, PlDataTableFilterMeta, PlDataTableFilterSpecLeaf, PlDataTableFilters, PlDataTableFiltersWithMeta, PlDataTableGridStateCore, PlDataTableModel, PlDataTableSheet, PlDataTableSheetState, PlDataTableStateV2CacheEntry, PlDataTableStateV2Normalized, PlTableColumnIdJson } from "./PlDataTable/
|
|
8
|
+
import { PTableParamsV2, PlDataTableFilterMeta, PlDataTableFilterSpecLeaf, PlDataTableFilters, PlDataTableFiltersWithMeta, PlDataTableGridStateCore, PlDataTableModel, PlDataTableSheet, PlDataTableSheetState, PlDataTableStateV2CacheEntry, PlDataTableStateV2Normalized, PlTableColumnIdJson } from "./PlDataTable/typesV7.js";
|
|
9
9
|
import { PlDataTableStateV2, createDefaultPTableParams, createPlDataTableStateV2, upgradePlDataTableStateV2 } from "./PlDataTable/state-migration.js";
|
|
10
10
|
import { createPlDataTableSheet } from "./PlDataTable/createPlDataTableSheet.js";
|
|
11
11
|
import { createPlDataTableV2 } from "./PlDataTable/createPlDataTable/createPlDataTableV2.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -49,9 +49,9 @@ import { AnnotationSpec, AnnotationSpecUi, ExpressionSpec, FilterSpecUi } from "
|
|
|
49
49
|
import { convertFilterSpecsToExpressionSpecs } from "./annotations/converter.js";
|
|
50
50
|
import { AnnotationScriptUi, AnnotationStepUi, AnyForm, FilterUi, FilterUiOfType, FilterUiType, FormField, TypeField, TypeFieldRecord, TypeForm, TypeToLiteral, compileAnnotationScript, compileFilter, compileFilters, unreachable } from "./components/PlAnnotations/filters_ui.js";
|
|
51
51
|
import { DatasetOption, DatasetSelection, createDatasetSelection, isDatasetSelection } from "./components/PlDatasetSelector/dataset_selection.js";
|
|
52
|
-
import { buildRefMap, filterMatchesToOptions, findFilterColumns } from "./components/PlDatasetSelector/filter_discovery.js";
|
|
52
|
+
import { FilterMatchOptions, buildRefMap, filterMatchesToOptions, findFilterColumns } from "./components/PlDatasetSelector/filter_discovery.js";
|
|
53
53
|
import { BuildDatasetOptions, buildDatasetOptions } from "./components/PlDatasetSelector/build_dataset_options.js";
|
|
54
|
-
import { PTableParamsV2, PlDataTableFilterMeta, PlDataTableFilterSpecLeaf, PlDataTableFilters, PlDataTableFiltersWithMeta, PlDataTableGridStateCore, PlDataTableModel, PlDataTableSheet, PlDataTableSheetState, PlDataTableStateV2CacheEntry, PlDataTableStateV2Normalized, PlTableColumnIdJson } from "./components/PlDataTable/
|
|
54
|
+
import { PTableParamsV2, PlDataTableFilterMeta, PlDataTableFilterSpecLeaf, PlDataTableFilters, PlDataTableFiltersWithMeta, PlDataTableGridStateCore, PlDataTableModel, PlDataTableSheet, PlDataTableSheetState, PlDataTableStateV2CacheEntry, PlDataTableStateV2Normalized, PlTableColumnIdJson } from "./components/PlDataTable/typesV7.js";
|
|
55
55
|
import { PlDataTableStateV2, createDefaultPTableParams, createPlDataTableStateV2, upgradePlDataTableStateV2 } from "./components/PlDataTable/state-migration.js";
|
|
56
56
|
import { createPlDataTableSheet } from "./components/PlDataTable/createPlDataTableSheet.js";
|
|
57
57
|
import { createPlDataTableV2 } from "./components/PlDataTable/createPlDataTable/createPlDataTableV2.js";
|
|
@@ -74,4 +74,4 @@ import { getService } from "./services/get_services.js";
|
|
|
74
74
|
import { getEnvironmentValue } from "./env_value.js";
|
|
75
75
|
export * from "@milaboratories/pl-model-common";
|
|
76
76
|
export * from "@milaboratories/pl-error-like";
|
|
77
|
-
export { ActAnd, ActExtractArchiveAndGetURL, ActFlatten, ActGetBlobContent, ActGetBlobContentAsJson, ActGetBlobContentAsString, ActGetDownloadedBlobContent, ActGetField, ActGetFromCtx, ActGetImmediate, ActGetLastLogs, ActGetLogHandle, ActGetOnDemandBlobContent, ActGetProgressLog, ActGetProgressLogWithInfo, ActGetResourceField, ActGetResourceValueAsJson, ActImportProgress, ActIsEmpty, ActIsolate, ActMakeArray, ActMakeObject, ActMapArrayValues, ActMapRecordValues, ActMapResourceFields, ActNot, ActOr, ActionResult, AnchorEntry, AnchoredBuildOptions, AnchoredColumnCollection, AnchoredFindColumnsOptions, AndFilter, AnnotationFilter, AnnotationMode, AnnotationScript, AnnotationScript2, AnnotationScriptUi, AnnotationSpec, AnnotationSpecUi, AnnotationStep, AnnotationStepUi, AnyForm, Args, ArrayColumnProvider, AxesVault, AxisLabelProvider, BLOCK_SERVICE_FLAGS, BLOCK_STORAGE_FACADE_VERSION, BlockApiV1, BlockApiV2, BlockConfig, BlockConfigV3, BlockConfigV4, BlockDefaultModelServices, BlockDefaultUiServices, BlockModel, BlockModelInfo, BlockModelV3, BlockRenderCtx, BlockServiceFlags, BlockStatePatch, type BlockStorage, BlockStorageFacade, BlockStorageFacadeCallbacks, BlockStorageFacadeHandles, type BlockStorageSchemaVersion, BuildDatasetOptions, BuildOptions, CancelSubscription, Cfg, CfgAnd, CfgBlobContent, CfgBlobContentAsJson, CfgBlobContentAsString, CfgDownloadedBlobContent, CfgExtractArchiveAndGetURL, CfgFlatten, CfgGetFromCtx, CfgGetJsonField, CfgGetResourceField, CfgImmediate, CfgImportProgress, CfgIsEmpty, CfgIsolate, CfgLastLogs, CfgLogHandle, CfgMakeArray, CfgMakeObject, CfgMapArrayValues, CfgMapRecordValues, CfgMapResourceFields, CfgNot, CfgOnDemandBlobContent, CfgOr, CfgProgressLog, CfgProgressLogWithInfo, CfgRenderingMode, CfgResourceValueAsJson, Checked, ColumnCollection, ColumnCollectionBuilder, ColumnData, ColumnDataStatus, ColumnMatch, ColumnMatcher, ColumnOrderRule, ColumnProvider, ColumnSelector, ColumnSnapshot, ColumnSnapshotProvider, ColumnSource, ColumnVariant, ColumnVisibilityRule, ColumnsDisplayOptions, ColumnsSelectorConfig, CommonFieldTraverseOps, CommonTraversalOps, ConfAction, ConfigRenderLambda, ConfigRenderLambdaFlags, ConfigResult, CurrentSdkInfo, DataModel, DataModelBuilder, DatasetOption, DatasetSelection, DeriveHref, DeriveLabelsFormatters, DeriveLabelsOptions, Entry, ExpandByPartitionOpts, ExpandByPartitionResult, ExpressionSpec, ExtractAction, ExtractFunctionHandleReturn, ExtractFutureRefType, FieldTraversalStep, FieldType, FilterSpec, FilterSpecLeaf, FilterSpecNode, FilterSpecOfType, FilterSpecType, FilterSpecUi, FilterUi, FilterUiOfType, FilterUiType, FindColumnsOptions, FormField, FutureRef, GetFieldStep, InferArgsType, InferBlockState, InferBlockStatePatch, InferDataType, InferFactoryData, InferFactoryModelServices, InferFactoryOutputs, InferFactoryParams, InferFactoryUiServices, InferHrefType, InferOutputType, InferOutputsFromConfigs, InferOutputsFromLambdas, InferOutputsType, InferPluginData, InferPluginHandle, InferPluginNames, InferPluginUiEntries, InferRenderFunctionReturn, InferUiState, InferVarTypeSafe, IsNA, It, internal_d_exports as JsRenderInternal, DeriveLabelsOptions as LabelDerivationOps, LinkerStep, Log10, MainOutputs, MatchQualifications, MatchVariant, MatchingMode, type MigrateBlockStorageConfig, type MigrationFailure, type MigrationResult, type MigrationSuccess, ModelServices, type MutateStoragePayload, NotFilter, NumericalComparisonFilter, OptionalPlResourceEntry, OrFilter, OutputColumnProvider, OutputColumnProviderOpts, OutputError, PColumnCollection, PColumnDataUniversal, PColumnEntryUniversal, PColumnEntryWithLabel, PColumnKeyList, PColumnLazyUniversal, PColumnLazyWithLabel, PColumnPredicate, PColumnResourceMapData, PColumnResourceMapEntry, PFrameImpl, POCExtractAction, PTableKey, PTableParamsV2, type ParamsInput, Patch, PatternFilter, PatternPredicate, PatternPredicateContainSubsequence, PatternPredicateEquals, PlDataTableFilterMeta, PlDataTableFilterSpecLeaf, PlDataTableFilters, PlDataTableFiltersWithMeta, PlDataTableGridStateCore, PlDataTableModel, PlDataTableSheet, PlDataTableSheetState, PlDataTableStateV2, PlDataTableStateV2CacheEntry, PlDataTableStateV2Normalized, PlMultiSequenceAlignmentColorSchemeOption, PlMultiSequenceAlignmentModel, PlMultiSequenceAlignmentSettings, PlMultiSequenceAlignmentWidget, PlResourceEntry, PlSelectionModel, PlTableColumnIdJson, Platforma, PlatformaApiVersion, PlatformaExtended, PlatformaFactory, PlatformaSDKVersion, PlatformaV1, PlatformaV2, PlatformaV3, type PluginConfig, type PluginData, PluginDataModel, PluginDataModelBuilder, type PluginDataModelVersions, type PluginFactory, PluginFactoryLike, PluginHandle, PluginInstance, PluginModel, type PluginName, type PluginOutputs, type PluginParams, type PluginPublicOutputs, type PluginRecord, type PluginRegistry, PluginRenderCtx, PrimitiveOrConfig, PrimitiveToCfg, type PublicOutputFieldDef, RT_BINARY_PARTITIONED, RT_BINARY_SUPER_PARTITIONED, RT_JSON_PARTITIONED, RT_JSON_SUPER_PARTITIONED, RT_PARQUET_PARTITIONED, RT_PARQUET_SUPER_PARTITIONED, RT_RESOURCE_MAP, RT_RESOURCE_MAP_PARTITIONED, RelaxedAxisSelector, RelaxedColumnSelector, RelaxedRecord, RelaxedStringMatchers, RenderCtx, RenderCtxBase, RenderCtxLegacy, RenderFunction, RenderFunctionLegacy, ResolveCfgType, ResolveModelServices, ResolveUiServices, ResourceTraversalOps, ResourceType, ResultPool, ResultPoolColumnSnapshotProvider, SdkInfo, ServiceProxy, SimplifiedPColumnSpec, SimplifiedUniversalPColumnEntry, SnapshotColumnProvider, SortedCumulativeSum, Entry as SpecExtractorResult, SplitAxis, StagingOutputs, StdCtx, StdCtxArgsOnly, StringMatcher, TooltipEntry, Trace, TraceEntry, TransformedColumn, TreeNodeAccessor, TypeField, TypeFieldRecord, TypeForm, TypeToLiteral, TypedConfig, TypedConfigOrConfigLambda, TypedConfigOrString, UiServices, UiState, Unionize, UniversalColumnOption, UnwrapFutureRef, ValueRank, type VersionedData, allPColumnsReady, and, blockServiceNames, buildDatasetOptions, buildRefMap, buildServices, collectCtxColumnSnapshotProviders, compileAnnotationScript, compileFilter, compileFilters, convertColumnSelectorToMultiColumnSelector, convertFilterSpecsToExpressionSpecs, convertFilterUiToExpressionImpl, convertFilterUiToExpressions, convertOrParsePColumnData, convertRelaxedAxisSelectorToMultiAxisSelector, convertRelaxedColumnSelectorToMultiColumnSelector, createBlockStorage, createColumnSnapshot, createDatasetSelection, createDefaultPTableParams, createPFrameForGraphs, createPlDataTable, createPlDataTableOptionsV3, createPlDataTableSheet, createPlDataTableStateV2, createPlDataTableV2, createPlDataTableV3, createPlSelectionModel, createReadyColumnData, createRowSelectionColumn, createServiceProxy, deriveDataFromStorage, deriveDistinctLabels, deriveDistinctTooltips, deriveLabels, discoverTableColumnSnaphots, distillFilterSpec, downgradeCfgOrLambda, enrichCompatible, expandByPartition, extractArchiveAndGetURL, extractConfig, filterDataInfoEntries, filterMatchesToOptions, filterSpecToSpecQueryExpr, findFilterColumns, flatten, fromPlOption, fromPlRef, getAllRelatedColumns, getAvailableWithLinkersAxes, getAxisUniqueValues, getBlobContent, getBlobContentAsJson, getBlobContentAsString, getColumnOrAxisValueLabelsId, getColumnSpecById, getColumnUniqueValues, getColumnsFull, getDownloadedBlobContent, getEffectiveVisibility, getEnvironmentValue, getFromCfg, getImmediate, getImportProgress, getJsonField, getLastLogs, getLogHandle, getOnDemandBlobContent, getOrderPriority, getPartitionKeysList, getPlatformaApiVersion, getPluginData, getProgressLog, getProgressLogWithInfo, getRawPlatformaInstance, getRelatedColumns, getRequestColumnsFromSelectedSources, getResourceField, getResourceValueAsJson, getService, getSingleColumnData, getStorageData, getUniquePartitionKeys, getUniqueSourceValuesWithLabels, ifDef, isBlockStorage, isColumnHidden, isColumnOptional, isColumnSnapshotProvider, isConfigLambda, isDatasetSelection, isEmpty, isHiddenFromGraphColumn, isHiddenFromUIColumn, isPColumnReady, isPluginOutputKey, isolate, makeArray, makeObject, mapArrayValues, mapRecordValues, mapResourceFields, migrateBlockStorage, normalizeBlockStorage, not, or, parsePColumnData, parseResourceMap, pluginOutputKey, pluginOutputPrefix, readOutput, registerFacadeCallbacks, toColumnSnapshotProvider, unreachable, updateStorageData, upgradePlDataTableStateV2, wrapOutputs };
|
|
77
|
+
export { ActAnd, ActExtractArchiveAndGetURL, ActFlatten, ActGetBlobContent, ActGetBlobContentAsJson, ActGetBlobContentAsString, ActGetDownloadedBlobContent, ActGetField, ActGetFromCtx, ActGetImmediate, ActGetLastLogs, ActGetLogHandle, ActGetOnDemandBlobContent, ActGetProgressLog, ActGetProgressLogWithInfo, ActGetResourceField, ActGetResourceValueAsJson, ActImportProgress, ActIsEmpty, ActIsolate, ActMakeArray, ActMakeObject, ActMapArrayValues, ActMapRecordValues, ActMapResourceFields, ActNot, ActOr, ActionResult, AnchorEntry, AnchoredBuildOptions, AnchoredColumnCollection, AnchoredFindColumnsOptions, AndFilter, AnnotationFilter, AnnotationMode, AnnotationScript, AnnotationScript2, AnnotationScriptUi, AnnotationSpec, AnnotationSpecUi, AnnotationStep, AnnotationStepUi, AnyForm, Args, ArrayColumnProvider, AxesVault, AxisLabelProvider, BLOCK_SERVICE_FLAGS, BLOCK_STORAGE_FACADE_VERSION, BlockApiV1, BlockApiV2, BlockConfig, BlockConfigV3, BlockConfigV4, BlockDefaultModelServices, BlockDefaultUiServices, BlockModel, BlockModelInfo, BlockModelV3, BlockRenderCtx, BlockServiceFlags, BlockStatePatch, type BlockStorage, BlockStorageFacade, BlockStorageFacadeCallbacks, BlockStorageFacadeHandles, type BlockStorageSchemaVersion, BuildDatasetOptions, BuildOptions, CancelSubscription, Cfg, CfgAnd, CfgBlobContent, CfgBlobContentAsJson, CfgBlobContentAsString, CfgDownloadedBlobContent, CfgExtractArchiveAndGetURL, CfgFlatten, CfgGetFromCtx, CfgGetJsonField, CfgGetResourceField, CfgImmediate, CfgImportProgress, CfgIsEmpty, CfgIsolate, CfgLastLogs, CfgLogHandle, CfgMakeArray, CfgMakeObject, CfgMapArrayValues, CfgMapRecordValues, CfgMapResourceFields, CfgNot, CfgOnDemandBlobContent, CfgOr, CfgProgressLog, CfgProgressLogWithInfo, CfgRenderingMode, CfgResourceValueAsJson, Checked, ColumnCollection, ColumnCollectionBuilder, ColumnData, ColumnDataStatus, ColumnMatch, ColumnMatcher, ColumnOrderRule, ColumnProvider, ColumnSelector, ColumnSnapshot, ColumnSnapshotProvider, ColumnSource, ColumnVariant, ColumnVisibilityRule, ColumnsDisplayOptions, ColumnsSelectorConfig, CommonFieldTraverseOps, CommonTraversalOps, ConfAction, ConfigRenderLambda, ConfigRenderLambdaFlags, ConfigResult, CurrentSdkInfo, DataModel, DataModelBuilder, DatasetOption, DatasetSelection, DeriveHref, DeriveLabelsFormatters, DeriveLabelsOptions, Entry, ExpandByPartitionOpts, ExpandByPartitionResult, ExpressionSpec, ExtractAction, ExtractFunctionHandleReturn, ExtractFutureRefType, FieldTraversalStep, FieldType, FilterMatchOptions, FilterSpec, FilterSpecLeaf, FilterSpecNode, FilterSpecOfType, FilterSpecType, FilterSpecUi, FilterUi, FilterUiOfType, FilterUiType, FindColumnsOptions, FormField, FutureRef, GetFieldStep, InferArgsType, InferBlockState, InferBlockStatePatch, InferDataType, InferFactoryData, InferFactoryModelServices, InferFactoryOutputs, InferFactoryParams, InferFactoryUiServices, InferHrefType, InferOutputType, InferOutputsFromConfigs, InferOutputsFromLambdas, InferOutputsType, InferPluginData, InferPluginHandle, InferPluginNames, InferPluginUiEntries, InferRenderFunctionReturn, InferUiState, InferVarTypeSafe, IsNA, It, internal_d_exports as JsRenderInternal, DeriveLabelsOptions as LabelDerivationOps, LinkerStep, Log10, MainOutputs, MatchQualifications, MatchVariant, MatchingMode, type MigrateBlockStorageConfig, type MigrationFailure, type MigrationResult, type MigrationSuccess, ModelServices, type MutateStoragePayload, NotFilter, NumericalComparisonFilter, OptionalPlResourceEntry, OrFilter, OutputColumnProvider, OutputColumnProviderOpts, OutputError, PColumnCollection, PColumnDataUniversal, PColumnEntryUniversal, PColumnEntryWithLabel, PColumnKeyList, PColumnLazyUniversal, PColumnLazyWithLabel, PColumnPredicate, PColumnResourceMapData, PColumnResourceMapEntry, PFrameImpl, POCExtractAction, PTableKey, PTableParamsV2, type ParamsInput, Patch, PatternFilter, PatternPredicate, PatternPredicateContainSubsequence, PatternPredicateEquals, PlDataTableFilterMeta, PlDataTableFilterSpecLeaf, PlDataTableFilters, PlDataTableFiltersWithMeta, PlDataTableGridStateCore, PlDataTableModel, PlDataTableSheet, PlDataTableSheetState, PlDataTableStateV2, PlDataTableStateV2CacheEntry, PlDataTableStateV2Normalized, PlMultiSequenceAlignmentColorSchemeOption, PlMultiSequenceAlignmentModel, PlMultiSequenceAlignmentSettings, PlMultiSequenceAlignmentWidget, PlResourceEntry, PlSelectionModel, PlTableColumnIdJson, Platforma, PlatformaApiVersion, PlatformaExtended, PlatformaFactory, PlatformaSDKVersion, PlatformaV1, PlatformaV2, PlatformaV3, type PluginConfig, type PluginData, PluginDataModel, PluginDataModelBuilder, type PluginDataModelVersions, type PluginFactory, PluginFactoryLike, PluginHandle, PluginInstance, PluginModel, type PluginName, type PluginOutputs, type PluginParams, type PluginPublicOutputs, type PluginRecord, type PluginRegistry, PluginRenderCtx, PrimitiveOrConfig, PrimitiveToCfg, type PublicOutputFieldDef, RT_BINARY_PARTITIONED, RT_BINARY_SUPER_PARTITIONED, RT_JSON_PARTITIONED, RT_JSON_SUPER_PARTITIONED, RT_PARQUET_PARTITIONED, RT_PARQUET_SUPER_PARTITIONED, RT_RESOURCE_MAP, RT_RESOURCE_MAP_PARTITIONED, RelaxedAxisSelector, RelaxedColumnSelector, RelaxedRecord, RelaxedStringMatchers, RenderCtx, RenderCtxBase, RenderCtxLegacy, RenderFunction, RenderFunctionLegacy, ResolveCfgType, ResolveModelServices, ResolveUiServices, ResourceTraversalOps, ResourceType, ResultPool, ResultPoolColumnSnapshotProvider, SdkInfo, ServiceProxy, SimplifiedPColumnSpec, SimplifiedUniversalPColumnEntry, SnapshotColumnProvider, SortedCumulativeSum, Entry as SpecExtractorResult, SplitAxis, StagingOutputs, StdCtx, StdCtxArgsOnly, StringMatcher, TooltipEntry, Trace, TraceEntry, TransformedColumn, TreeNodeAccessor, TypeField, TypeFieldRecord, TypeForm, TypeToLiteral, TypedConfig, TypedConfigOrConfigLambda, TypedConfigOrString, UiServices, UiState, Unionize, UniversalColumnOption, UnwrapFutureRef, ValueRank, type VersionedData, allPColumnsReady, and, blockServiceNames, buildDatasetOptions, buildRefMap, buildServices, collectCtxColumnSnapshotProviders, compileAnnotationScript, compileFilter, compileFilters, convertColumnSelectorToMultiColumnSelector, convertFilterSpecsToExpressionSpecs, convertFilterUiToExpressionImpl, convertFilterUiToExpressions, convertOrParsePColumnData, convertRelaxedAxisSelectorToMultiAxisSelector, convertRelaxedColumnSelectorToMultiColumnSelector, createBlockStorage, createColumnSnapshot, createDatasetSelection, createDefaultPTableParams, createPFrameForGraphs, createPlDataTable, createPlDataTableOptionsV3, createPlDataTableSheet, createPlDataTableStateV2, createPlDataTableV2, createPlDataTableV3, createPlSelectionModel, createReadyColumnData, createRowSelectionColumn, createServiceProxy, deriveDataFromStorage, deriveDistinctLabels, deriveDistinctTooltips, deriveLabels, discoverTableColumnSnaphots, distillFilterSpec, downgradeCfgOrLambda, enrichCompatible, expandByPartition, extractArchiveAndGetURL, extractConfig, filterDataInfoEntries, filterMatchesToOptions, filterSpecToSpecQueryExpr, findFilterColumns, flatten, fromPlOption, fromPlRef, getAllRelatedColumns, getAvailableWithLinkersAxes, getAxisUniqueValues, getBlobContent, getBlobContentAsJson, getBlobContentAsString, getColumnOrAxisValueLabelsId, getColumnSpecById, getColumnUniqueValues, getColumnsFull, getDownloadedBlobContent, getEffectiveVisibility, getEnvironmentValue, getFromCfg, getImmediate, getImportProgress, getJsonField, getLastLogs, getLogHandle, getOnDemandBlobContent, getOrderPriority, getPartitionKeysList, getPlatformaApiVersion, getPluginData, getProgressLog, getProgressLogWithInfo, getRawPlatformaInstance, getRelatedColumns, getRequestColumnsFromSelectedSources, getResourceField, getResourceValueAsJson, getService, getSingleColumnData, getStorageData, getUniquePartitionKeys, getUniqueSourceValuesWithLabels, ifDef, isBlockStorage, isColumnHidden, isColumnOptional, isColumnSnapshotProvider, isConfigLambda, isDatasetSelection, isEmpty, isHiddenFromGraphColumn, isHiddenFromUIColumn, isPColumnReady, isPluginOutputKey, isolate, makeArray, makeObject, mapArrayValues, mapRecordValues, mapResourceFields, migrateBlockStorage, normalizeBlockStorage, not, or, parsePColumnData, parseResourceMap, pluginOutputKey, pluginOutputPrefix, readOutput, registerFacadeCallbacks, toColumnSnapshotProvider, unreachable, updateStorageData, upgradePlDataTableStateV2, wrapOutputs };
|
package/dist/package.cjs
CHANGED
package/dist/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/model",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.77.0",
|
|
4
4
|
"description": "Platforma.bio SDK / Block Model",
|
|
5
5
|
"files": [
|
|
6
6
|
"./dist/**/*",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"zod": "~3.25.76",
|
|
33
33
|
"@milaboratories/helpers": "1.14.2",
|
|
34
34
|
"@milaboratories/pl-error-like": "1.12.10",
|
|
35
|
-
"@milaboratories/pl-model-common": "1.42.0",
|
|
36
35
|
"@milaboratories/pl-model-middle-layer": "1.19.4",
|
|
36
|
+
"@milaboratories/pl-model-common": "1.42.0",
|
|
37
37
|
"@milaboratories/ptabler-expression-js": "1.2.25"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"typescript": "~5.9.3",
|
|
43
43
|
"vitest": "^4.1.3",
|
|
44
44
|
"@milaboratories/build-configs": "2.0.0",
|
|
45
|
-
"@milaboratories/pf-spec-driver": "1.3.16",
|
|
46
45
|
"@milaboratories/ts-builder": "1.4.0",
|
|
47
|
-
"@milaboratories/pf-driver": "1.
|
|
48
|
-
"@milaboratories/ts-configs": "1.2.3"
|
|
46
|
+
"@milaboratories/pf-spec-driver": "1.3.16",
|
|
47
|
+
"@milaboratories/ts-configs": "1.2.3",
|
|
48
|
+
"@milaboratories/pf-driver": "1.4.11"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "ts-builder build --target node",
|
|
@@ -374,10 +374,17 @@ function resolveAnchorMap(
|
|
|
374
374
|
const getDuplicateError = (key: string) =>
|
|
375
375
|
`Anchor "${key}": selector matched a column that was already matched by another anchor; please refine the selector to match a different column`;
|
|
376
376
|
|
|
377
|
+
// O(1) lookup maps built lazily — only when an anchor of the matching kind is
|
|
378
|
+
// encountered. Avoids O(anchors × columns) `deriveNativeId` calls, which were
|
|
379
|
+
// tripping the QuickJS interrupt deadline on tables with many anchors.
|
|
380
|
+
let byId: Map<PObjectId, ColumnSnapshot<PObjectId>> | undefined;
|
|
381
|
+
let byNativeId: Map<NativePObjectId, ColumnSnapshot<PObjectId>> | undefined;
|
|
382
|
+
|
|
377
383
|
for (const [name, anchor] of Object.entries(anchors)) {
|
|
378
384
|
if (typeof anchor === "string") {
|
|
385
|
+
if (byId === undefined) byId = new Map(columns.map((col) => [col.id, col]));
|
|
379
386
|
const found =
|
|
380
|
-
|
|
387
|
+
byId.get(anchor) ??
|
|
381
388
|
throwError(`Anchor "${name}": column with id "${anchor}" not found in sources`);
|
|
382
389
|
if (resovedIds.has(found.id)) {
|
|
383
390
|
throwError(getDuplicateError(name));
|
|
@@ -386,9 +393,11 @@ function resolveAnchorMap(
|
|
|
386
393
|
resovedIds.add(found.id);
|
|
387
394
|
} else if ("kind" in anchor) {
|
|
388
395
|
if (!isPColumnSpec(anchor)) throwError(`Anchor "${name}": invalid PColumnSpec`);
|
|
389
|
-
|
|
396
|
+
if (byNativeId === undefined) {
|
|
397
|
+
byNativeId = new Map(columns.map((col) => [deriveNativeId(col.spec), col]));
|
|
398
|
+
}
|
|
390
399
|
const found =
|
|
391
|
-
|
|
400
|
+
byNativeId.get(deriveNativeId(anchor)) ??
|
|
392
401
|
throwError(`Anchor "${name}": no column matching spec found in sources`);
|
|
393
402
|
if (resovedIds.has(found.id)) {
|
|
394
403
|
throwError(getDuplicateError(name));
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
import { getColumnIdAndSpec } from "@milaboratories/pl-model-common";
|
|
10
10
|
import type { PColumnDataUniversal, TreeNodeAccessor } from "../../../render";
|
|
11
11
|
import { isFunction } from "es-toolkit";
|
|
12
|
-
import type { PlDataTableFilters } from "../
|
|
12
|
+
import type { PlDataTableFilters } from "../typesV7";
|
|
13
13
|
import { createPTableDefV3 } from "./createPTableDefV3";
|
|
14
14
|
|
|
15
15
|
export function createPTableDefV2(params: {
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
import { isBooleanExpression } from "@milaboratories/pl-model-common";
|
|
14
14
|
import type { PColumnDataUniversal } from "../../../render";
|
|
15
15
|
import { isNil } from "es-toolkit";
|
|
16
|
-
import type { PlDataTableFilters } from "../
|
|
16
|
+
import type { PlDataTableFilters } from "../typesV7";
|
|
17
17
|
import { distillFilterSpec, filterSpecToSpecQueryExpr } from "../../../filters";
|
|
18
18
|
import type { Nil } from "@milaboratories/helpers";
|
|
19
19
|
|
|
@@ -25,7 +25,7 @@ import type {
|
|
|
25
25
|
} from "../../../render";
|
|
26
26
|
import { allPColumnsReady, deriveLabels, PColumnCollection } from "../../../render";
|
|
27
27
|
import { identity } from "es-toolkit";
|
|
28
|
-
import type { CreatePlDataTableOps, PlDataTableModel } from "../
|
|
28
|
+
import type { CreatePlDataTableOps, PlDataTableModel } from "../typesV7";
|
|
29
29
|
import { upgradePlDataTableStateV2 } from "../state-migration";
|
|
30
30
|
import type { PlDataTableStateV2 } from "../state-migration";
|
|
31
31
|
import { getMatchingLabelColumns } from "../labels";
|
|
@@ -17,7 +17,7 @@ import { canonicalizeJson, getAxisId, parseJson, uniqueBy } from "@milaboratorie
|
|
|
17
17
|
import { collectFilterSpecColumns, traverseFilterSpec } from "../../../filters/traverse";
|
|
18
18
|
import type { RenderCtxBase, PColumnDataUniversal } from "../../../render";
|
|
19
19
|
import { isEmpty } from "es-toolkit/compat";
|
|
20
|
-
import type { PlDataTableFilters, PlDataTableFilterSpecLeaf, PlDataTableModel } from "../
|
|
20
|
+
import type { PlDataTableFilters, PlDataTableFilterSpecLeaf, PlDataTableModel } from "../typesV7";
|
|
21
21
|
import { upgradePlDataTableStateV2 } from "../state-migration";
|
|
22
22
|
import type { PlDataTableStateV2 } from "../state-migration";
|
|
23
23
|
import type { ColumnSelector, ColumnSnapshot, ColumnVariant, MatchingMode } from "../../../columns";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RenderCtxBase } from "../../../render";
|
|
2
|
-
import type { PlDataTableModel } from "../
|
|
2
|
+
import type { PlDataTableModel } from "../typesV7";
|
|
3
3
|
import { createPlDataTableOptionsV2, createPlDataTableV2 } from "./createPlDataTableV2";
|
|
4
4
|
import { createPlDataTableV3 } from "./createPlDataTableV3";
|
|
5
5
|
import type { createPlDataTableOptionsV3 } from "./createPlDataTableV3";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AxisSpec } from "@milaboratories/pl-model-common";
|
|
2
2
|
import type { RenderCtxBase } from "../../render";
|
|
3
|
-
import type { PlDataTableSheet } from "./
|
|
3
|
+
import type { PlDataTableSheet } from "./typesV7";
|
|
4
4
|
|
|
5
5
|
/** Create sheet entries for PlDataTable */
|
|
6
6
|
export function createPlDataTableSheet<A, U>(
|
|
@@ -7,7 +7,11 @@ import type {
|
|
|
7
7
|
PTableRecordFilter,
|
|
8
8
|
PTableSorting,
|
|
9
9
|
} from "@milaboratories/pl-model-common";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
canonicalizeJson,
|
|
12
|
+
getPTableColumnId,
|
|
13
|
+
parseJsonSafely,
|
|
14
|
+
} from "@milaboratories/pl-model-common";
|
|
11
15
|
import { distillFilterSpec } from "../../filters";
|
|
12
16
|
import type { PlDataTableFilterState, PlTableFilter } from "./typesV4";
|
|
13
17
|
import type {
|
|
@@ -16,7 +20,14 @@ import type {
|
|
|
16
20
|
PlDataTableSheetState,
|
|
17
21
|
PlDataTableStateV2CacheEntry,
|
|
18
22
|
PlDataTableStateV2Normalized,
|
|
23
|
+
PlTableColumnIdJson,
|
|
19
24
|
PTableParamsV2,
|
|
25
|
+
} from "./typesV7";
|
|
26
|
+
import type {
|
|
27
|
+
PlDataTableGridStateV6,
|
|
28
|
+
PlDataTableStateV2V6,
|
|
29
|
+
PlDataTableStateV2V6CacheEntry,
|
|
30
|
+
PlDataTableV6ColIdJson,
|
|
20
31
|
} from "./typesV6";
|
|
21
32
|
import type {
|
|
22
33
|
PlDataTableGridStateV5,
|
|
@@ -106,7 +117,7 @@ export type PlDataTableStateV2 =
|
|
|
106
117
|
version: 4;
|
|
107
118
|
stateCache: {
|
|
108
119
|
sourceId: string;
|
|
109
|
-
gridState:
|
|
120
|
+
gridState: PlDataTableGridStateV6;
|
|
110
121
|
sheetsState: PlDataTableSheetState[];
|
|
111
122
|
filtersState: PlDataTableFilterState[];
|
|
112
123
|
}[];
|
|
@@ -130,6 +141,9 @@ export type PlDataTableStateV2 =
|
|
|
130
141
|
}[];
|
|
131
142
|
pTableParams: PTableParamsV2;
|
|
132
143
|
}
|
|
144
|
+
// v6 stored colIds as canonicalized full `PTableColumnSpec` (including
|
|
145
|
+
// annotations + `pl7.app/trace`). v7 strips down to `PTableColumnId`.
|
|
146
|
+
| PlDataTableStateV2V6
|
|
133
147
|
// Normalized state
|
|
134
148
|
| PlDataTableStateV2Normalized;
|
|
135
149
|
|
|
@@ -172,13 +186,15 @@ export function upgradePlDataTableStateV2(
|
|
|
172
186
|
if (state.version === 5) {
|
|
173
187
|
state = migrateV5toV6(state);
|
|
174
188
|
}
|
|
189
|
+
// v6 -> v7: shrink colIds from full PTableColumnSpec to PTableColumnId.
|
|
190
|
+
if (state.version === 6) {
|
|
191
|
+
state = migrateV6toV7(state);
|
|
192
|
+
}
|
|
175
193
|
return state;
|
|
176
194
|
}
|
|
177
195
|
|
|
178
196
|
/** Migrate v5 to v6: unwrap `{source, labeled}` colIds in gridState. */
|
|
179
|
-
function migrateV5toV6(
|
|
180
|
-
state: Extract<PlDataTableStateV2, { version: 5 }>,
|
|
181
|
-
): PlDataTableStateV2Normalized {
|
|
197
|
+
function migrateV5toV6(state: Extract<PlDataTableStateV2, { version: 5 }>): PlDataTableStateV2V6 {
|
|
182
198
|
// pTableParams reset: v5 stored DiscoveredPColumnId-based hiddenColIds with
|
|
183
199
|
// empty-array fields (e.g. `{column, path: [], columnQualifications: [], ...}`).
|
|
184
200
|
// v6 distills empty fields, so the same logical column serialises differently
|
|
@@ -204,9 +220,8 @@ function unwrapV5ColId(json: string): string {
|
|
|
204
220
|
: json;
|
|
205
221
|
}
|
|
206
222
|
|
|
207
|
-
function unwrapV5GridState(gridState: PlDataTableGridStateV5):
|
|
208
|
-
const unwrapAs = (json: PlDataTableV5ColIdJson) =>
|
|
209
|
-
unwrapV5ColId(json) as CanonicalizedJson<PTableColumnSpec>;
|
|
223
|
+
function unwrapV5GridState(gridState: PlDataTableGridStateV5): PlDataTableGridStateV6 {
|
|
224
|
+
const unwrapAs = (json: PlDataTableV5ColIdJson) => unwrapV5ColId(json) as PlDataTableV6ColIdJson;
|
|
210
225
|
return {
|
|
211
226
|
columnOrder: gridState.columnOrder
|
|
212
227
|
? { orderedColIds: gridState.columnOrder.orderedColIds.map(unwrapAs) }
|
|
@@ -225,14 +240,57 @@ function unwrapV5GridState(gridState: PlDataTableGridStateV5): PlDataTableGridSt
|
|
|
225
240
|
};
|
|
226
241
|
}
|
|
227
242
|
|
|
243
|
+
/** Migrate v6 to v7: rewrite each colId from a full PTableColumnSpec to its
|
|
244
|
+
* compact PTableColumnId (drops annotations/spec body, ~16× smaller per column). */
|
|
245
|
+
function migrateV6toV7(state: PlDataTableStateV2V6): PlDataTableStateV2Normalized {
|
|
246
|
+
return {
|
|
247
|
+
version: 7,
|
|
248
|
+
stateCache: state.stateCache.map(
|
|
249
|
+
(entry): PlDataTableStateV2CacheEntry => ({
|
|
250
|
+
...entry,
|
|
251
|
+
gridState: shrinkV6GridState(entry.gridState),
|
|
252
|
+
}),
|
|
253
|
+
),
|
|
254
|
+
pTableParams: state.pTableParams,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/** Convert a v6 fat colId (canonicalized PTableColumnSpec) to a v7 compact colId
|
|
259
|
+
* (canonicalized PTableColumnId). The row-number sentinel is a string literal,
|
|
260
|
+
* not a spec — pass it through unchanged. */
|
|
261
|
+
function shrinkV6ColId(json: PlDataTableV6ColIdJson): PlTableColumnIdJson {
|
|
262
|
+
const parsed: unknown = parseJsonSafely(json);
|
|
263
|
+
if (!isNil(parsed) && typeof parsed === "object" && "type" in parsed && "id" in parsed) {
|
|
264
|
+
return canonicalizeJson(getPTableColumnId(parsed as PTableColumnSpec));
|
|
265
|
+
}
|
|
266
|
+
return json as unknown as PlTableColumnIdJson;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function shrinkV6GridState(gridState: PlDataTableGridStateV6): PlDataTableGridStateCore {
|
|
270
|
+
return {
|
|
271
|
+
columnOrder: gridState.columnOrder
|
|
272
|
+
? { orderedColIds: gridState.columnOrder.orderedColIds.map(shrinkV6ColId) }
|
|
273
|
+
: undefined,
|
|
274
|
+
sort: gridState.sort
|
|
275
|
+
? {
|
|
276
|
+
sortModel: gridState.sort.sortModel.map((s) => ({
|
|
277
|
+
colId: shrinkV6ColId(s.colId),
|
|
278
|
+
sort: s.sort,
|
|
279
|
+
})),
|
|
280
|
+
}
|
|
281
|
+
: undefined,
|
|
282
|
+
columnVisibility: gridState.columnVisibility
|
|
283
|
+
? { hiddenColIds: gridState.columnVisibility.hiddenColIds.map(shrinkV6ColId) }
|
|
284
|
+
: undefined,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
|
|
228
288
|
/** Migrate v4 state to v6: convert per-column filters to tree-based format (skips v5). */
|
|
229
|
-
function migrateV4toV6(
|
|
230
|
-
state: Extract<PlDataTableStateV2, { version: 4 }>,
|
|
231
|
-
): PlDataTableStateV2Normalized {
|
|
289
|
+
function migrateV4toV6(state: Extract<PlDataTableStateV2, { version: 4 }>): PlDataTableStateV2V6 {
|
|
232
290
|
let idCounter = 0;
|
|
233
291
|
const nextId = () => ++idCounter;
|
|
234
292
|
|
|
235
|
-
const migratedCache:
|
|
293
|
+
const migratedCache: PlDataTableStateV2V6CacheEntry[] = state.stateCache.map((entry) => {
|
|
236
294
|
const leaves: PlDataTableFiltersWithMeta["filters"] = [];
|
|
237
295
|
for (const f of entry.filtersState) {
|
|
238
296
|
if (f.filter !== null && !f.filter.disabled) {
|
|
@@ -358,7 +416,7 @@ export function createDefaultPTableParams(): PTableParamsV2 {
|
|
|
358
416
|
|
|
359
417
|
export function createPlDataTableStateV2(): PlDataTableStateV2Normalized {
|
|
360
418
|
return {
|
|
361
|
-
version:
|
|
419
|
+
version: 7,
|
|
362
420
|
stateCache: [],
|
|
363
421
|
pTableParams: createDefaultPTableParams(),
|
|
364
422
|
};
|