@platforma-sdk/model 1.30.21 → 1.30.26
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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +600 -583
- package/dist/index.mjs.map +1 -1
- package/dist/render/api.d.ts +2 -1
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/util/column_collection.d.ts +3 -1
- package/dist/render/util/column_collection.d.ts.map +1 -1
- package/dist/render/util/label.d.ts +2 -0
- package/dist/render/util/label.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +5 -5
- package/src/render/api.ts +2 -0
- package/src/render/util/column_collection.ts +27 -2
- package/src/render/util/label.test.ts +78 -0
- package/src/render/util/label.ts +24 -14
package/dist/render/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyFunction, AxisId, DataInfo, Option, PColumn, PColumnSelector, PColumnSpec, PColumnValues, PFrameDef, PFrameHandle, PObject, PObjectSpec, PSpecPredicate, PTableDef, PTableHandle, PTableRecordFilter, PTableSorting, PlRef, ResolveAnchorsOptions, ResultCollection, SUniversalPColumnId, ValueOrError, AnchoredIdDeriver } from '@milaboratories/pl-model-common';
|
|
1
|
+
import { AnchoredPColumnSelector, AnyFunction, AxisId, DataInfo, Option, PColumn, PColumnSelector, PColumnSpec, PColumnValues, PFrameDef, PFrameHandle, PObject, PObjectSpec, PSpecPredicate, PTableDef, PTableHandle, PTableRecordFilter, PTableSorting, PlRef, ResolveAnchorsOptions, ResultCollection, SUniversalPColumnId, ValueOrError, AnchoredIdDeriver } from '@milaboratories/pl-model-common';
|
|
2
2
|
import { Optional } from 'utility-types';
|
|
3
3
|
import { TreeNodeAccessor } from './accessor';
|
|
4
4
|
import { FutureRef } from './future';
|
|
@@ -12,6 +12,7 @@ export type UniversalColumnOption = {
|
|
|
12
12
|
type UniversalPColumnOpts = {
|
|
13
13
|
labelOps?: LabelDerivationOps;
|
|
14
14
|
dontWaitAllData?: boolean;
|
|
15
|
+
exclude?: AnchoredPColumnSelector | AnchoredPColumnSelector[];
|
|
15
16
|
} & ResolveAnchorsOptions;
|
|
16
17
|
type GetOptionsOpts = {
|
|
17
18
|
/**
|
package/dist/render/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/render/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,QAAQ,EACR,MAAM,EACN,OAAO,EACP,eAAe,EACf,WAAW,EACX,aAAa,EACb,SAAS,EACT,YAAY,EACZ,OAAO,EAEP,WAAW,EACX,cAAc,EACd,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,KAAK,EACL,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,iBAAiB,EAalB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAS,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,OAAO,EAAqB,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAiBxE,MAAM,MAAM,qBAAqB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAoBlF,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":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CAAC,CAAC,CAAC,GAAG,YAAY;IAClH,YAAY,CAAC,GAAG,EAAE;QACvB,OAAO,EAAE,OAAO,CAAC,gBAAgB,GAAG,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC;QAClF,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;QAC/B,oBAAoB;QACpB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;KAC3B,GAAG,YAAY;IA8BhB,iDAAiD;IAC1C,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAItC,wBAAwB,IAAI,MAAM,GAAG,SAAS;CAGtD;AAED,MAAM,MAAM,cAAc,CAAC,IAAI,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,IAAI,CAC7E,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,KAC3B,GAAG,CAAC;AAET,MAAM,MAAM,eAAe,CAAC,CAAC,IAC3B,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GACxB,CAAC,GACD,CAAC,SAAS,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GACtE,CAAC,GACD;KAAG,GAAG,IAAI,MAAM,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,CAAC;AAEtD,MAAM,MAAM,yBAAyB,CAAC,EAAE,SAAS,WAAW,IAAI,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,GAChG,eAAe,CAAC,CAAC,CAAC,GAClB,KAAK,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnchoredIdDeriver, AxisId, DataInfo, PColumn, PColumnSelector, PColumnSpec, PObjectId, SUniversalPColumnId, ResolveAnchorsOptions } from '@milaboratories/pl-model-common';
|
|
1
|
+
import { AnchoredIdDeriver, AxisId, DataInfo, PColumn, PColumnSelector, PColumnSpec, PObjectId, SUniversalPColumnId, AnchoredPColumnSelector, ResolveAnchorsOptions } from '@milaboratories/pl-model-common';
|
|
2
2
|
import { TreeNodeAccessor } from '../accessor';
|
|
3
3
|
import { LabelDerivationOps } from './label';
|
|
4
4
|
import { APColumnSelectorWithSplit, PColumnSelectorWithSplit } from './split_selectors';
|
|
@@ -20,6 +20,8 @@ export type PColumnEntryUniversal = PColumnEntryWithLabel & {
|
|
|
20
20
|
id: SUniversalPColumnId;
|
|
21
21
|
};
|
|
22
22
|
type UniversalPColumnOptsNoDeriver = {
|
|
23
|
+
/** If provided, columns matching the provided selectors will be excluded from the result. */
|
|
24
|
+
exclude?: AnchoredPColumnSelector | AnchoredPColumnSelector[];
|
|
23
25
|
labelOps?: LabelDerivationOps;
|
|
24
26
|
/** If true, incomplete data will cause the column to be skipped instead of returning undefined for the whole request. */
|
|
25
27
|
dontWaitAllData?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column_collection.d.ts","sourceRoot":"","sources":["../../../src/render/util/column_collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,OAAO,EACP,eAAe,EACf,WAAW,EACX,SAAS,EACT,mBAAmB,
|
|
1
|
+
{"version":3,"file":"column_collection.d.ts","sourceRoot":"","sources":["../../../src/render/util/column_collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,OAAO,EACP,eAAe,EACf,WAAW,EACX,SAAS,EACT,mBAAmB,EAGnB,uBAAuB,EAEvB,qBAAqB,EAEtB,MAAM,iCAAiC,CAAC;AAWzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,SAAS,CAAC;AAG9D,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAA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"}
|
|
@@ -13,6 +13,8 @@ export type LabelDerivationOps = {
|
|
|
13
13
|
separator?: string;
|
|
14
14
|
/** If true, label will be added as suffix (at the end of the generated label). By default label added as a prefix. */
|
|
15
15
|
addLabelAsSuffix?: boolean;
|
|
16
|
+
/** Trace elements list that will be forced to be included in the label. */
|
|
17
|
+
forceTraceElements?: string[];
|
|
16
18
|
};
|
|
17
19
|
export declare const TraceEntry: z.ZodObject<{
|
|
18
20
|
type: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/render/util/label.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAChD,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,6CAA6C;IAC7C,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sHAAsH;IACtH,gBAAgB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/render/util/label.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAChD,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,6CAA6C;IAC7C,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sHAAsH;IACtH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;EAKrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAGpD,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;WAAsB,CAAC;AACzC,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAI1C,KAAK,mBAAmB,GAAG,WAAW,GAAG;IACvC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;CAC5B,CAAC;AAOF,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,CAAC,EAAE,EACX,aAAa,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,mBAAmB,EAC9C,GAAG,GAAE,kBAAuB,GAC3B,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAoJvB"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PlatformaSDKVersion = "1.30.
|
|
1
|
+
export declare const PlatformaSDKVersion = "1.30.26";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/model",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.26",
|
|
4
4
|
"description": "Platforma.bio SDK / Block Model",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"utility-types": "^3.11.0",
|
|
22
22
|
"canonicalize": "~2.1.0",
|
|
23
23
|
"zod": "~3.23.8",
|
|
24
|
-
"@milaboratories/pl-
|
|
25
|
-
"@milaboratories/pl-
|
|
24
|
+
"@milaboratories/pl-error-like": "^1.12.1",
|
|
25
|
+
"@milaboratories/pl-model-common": "^1.15.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"typescript": "~5.5.4",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"jest": "^29.7.0",
|
|
32
32
|
"@jest/globals": "^29.7.0",
|
|
33
33
|
"ts-jest": "^29.2.6",
|
|
34
|
-
"@
|
|
35
|
-
"@platforma-
|
|
34
|
+
"@platforma-sdk/eslint-config": "1.0.3",
|
|
35
|
+
"@milaboratories/platforma-build-configs": "1.0.3"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"type-check": "node ./scripts/save-package-version.cjs && tsc --noEmit --composite false",
|
package/src/render/api.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
AnchoredPColumnSelector,
|
|
2
3
|
AnyFunction,
|
|
3
4
|
AxisId,
|
|
4
5
|
DataInfo,
|
|
@@ -88,6 +89,7 @@ PColumn<PColumnValues | AccessorHandle | DataInfo<AccessorHandle>> {
|
|
|
88
89
|
type UniversalPColumnOpts = {
|
|
89
90
|
labelOps?: LabelDerivationOps;
|
|
90
91
|
dontWaitAllData?: boolean;
|
|
92
|
+
exclude?: AnchoredPColumnSelector | AnchoredPColumnSelector[];
|
|
91
93
|
} & ResolveAnchorsOptions;
|
|
92
94
|
|
|
93
95
|
type GetOptionsOpts = {
|
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
AnchoredPColumnSelector,
|
|
13
13
|
PartitionedDataInfoEntries,
|
|
14
14
|
ResolveAnchorsOptions,
|
|
15
|
+
NativePObjectId,
|
|
15
16
|
} from '@milaboratories/pl-model-common';
|
|
16
17
|
import {
|
|
17
18
|
selectorsToPredicate,
|
|
@@ -21,6 +22,7 @@ import {
|
|
|
21
22
|
canonicalizeAxisId,
|
|
22
23
|
isPartitionedDataInfoEntries,
|
|
23
24
|
entriesToDataInfo,
|
|
25
|
+
deriveNativeId,
|
|
24
26
|
} from '@milaboratories/pl-model-common';
|
|
25
27
|
import type { TreeNodeAccessor } from '../accessor';
|
|
26
28
|
import type { LabelDerivationOps, TraceEntry } from './label';
|
|
@@ -148,6 +150,8 @@ function getSplitAxisIndices(selector: APColumnSelectorWithSplit | ((spec: PColu
|
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
type UniversalPColumnOptsNoDeriver = {
|
|
153
|
+
/** If provided, columns matching the provided selectors will be excluded from the result. */
|
|
154
|
+
exclude?: AnchoredPColumnSelector | AnchoredPColumnSelector[];
|
|
151
155
|
labelOps?: LabelDerivationOps;
|
|
152
156
|
/** If true, incomplete data will cause the column to be skipped instead of returning undefined for the whole request. */
|
|
153
157
|
dontWaitAllData?: boolean;
|
|
@@ -210,13 +214,27 @@ export class PColumnCollection {
|
|
|
210
214
|
public getUniversalEntries(
|
|
211
215
|
predicateOrSelectors: ((spec: PColumnSpec) => boolean) | APColumnSelectorWithSplit | APColumnSelectorWithSplit[],
|
|
212
216
|
opts?: Optional<UniversalPColumnOpts, 'anchorCtx'>): (PColumnEntryWithLabel | PColumnEntryUniversal)[] | undefined {
|
|
213
|
-
const { anchorCtx, labelOps: rawLabelOps, dontWaitAllData = false, overrideLabelAnnotation = false } = opts ?? {};
|
|
217
|
+
const { anchorCtx, labelOps: rawLabelOps, dontWaitAllData = false, overrideLabelAnnotation = false, exclude } = opts ?? {};
|
|
214
218
|
|
|
215
219
|
const labelOps: LabelDerivationOps = {
|
|
216
220
|
...(overrideLabelAnnotation && rawLabelOps?.includeNativeLabel !== false ? { includeNativeLabel: true } : {}),
|
|
217
221
|
...(rawLabelOps ?? {}),
|
|
218
222
|
};
|
|
219
223
|
|
|
224
|
+
let excludePredicate: ((spec: PColumnSpec) => boolean) = () => false;
|
|
225
|
+
if (exclude) {
|
|
226
|
+
const excludePredicartes = (Array.isArray(exclude) ? exclude : [exclude])
|
|
227
|
+
.map((selector) => {
|
|
228
|
+
if (hasAnchors(selector)) {
|
|
229
|
+
if (!anchorCtx)
|
|
230
|
+
throw new Error('Anchored selectors in exclude require an AnchoredIdDeriver to be provided in options.');
|
|
231
|
+
return selectorsToPredicate(resolveAnchors(anchorCtx.anchors, selector, opts));
|
|
232
|
+
} else
|
|
233
|
+
return selectorsToPredicate(selector);
|
|
234
|
+
});
|
|
235
|
+
excludePredicate = (spec) => excludePredicartes.some((predicate) => predicate(spec));
|
|
236
|
+
}
|
|
237
|
+
|
|
220
238
|
const selectorsArray = typeof predicateOrSelectors === 'function'
|
|
221
239
|
? [predicateOrSelectors]
|
|
222
240
|
: Array.isArray(predicateOrSelectors)
|
|
@@ -224,6 +242,7 @@ export class PColumnCollection {
|
|
|
224
242
|
: [predicateOrSelectors];
|
|
225
243
|
|
|
226
244
|
const intermediateResults: IntermediateColumnEntry[] = [];
|
|
245
|
+
const selectedNativeIds = new Set<NativePObjectId>();
|
|
227
246
|
|
|
228
247
|
for (const rawSelector of selectorsArray) {
|
|
229
248
|
const usesAnchors = hasAnchors(rawSelector);
|
|
@@ -241,8 +260,14 @@ export class PColumnCollection {
|
|
|
241
260
|
for (const provider of this.providers) {
|
|
242
261
|
const providerColumns = provider.selectColumns(currentSelector);
|
|
243
262
|
for (const col of providerColumns) {
|
|
244
|
-
if (
|
|
263
|
+
if (excludePredicate(col.spec)) continue;
|
|
264
|
+
if (selectedIds.has(col.id))
|
|
265
|
+
throw new Error(`Duplicate column id ${col.id} in provider ${provider.constructor.name}`);
|
|
266
|
+
const nativeId = deriveNativeId(col.spec);
|
|
267
|
+
if (selectedNativeIds.has(nativeId))
|
|
268
|
+
continue;
|
|
245
269
|
selectedIds.add(col.id);
|
|
270
|
+
selectedNativeIds.add(nativeId);
|
|
246
271
|
selectedColumns.push(col);
|
|
247
272
|
}
|
|
248
273
|
}
|
|
@@ -118,3 +118,81 @@ test('test fallback to native labels in label derivation', () => {
|
|
|
118
118
|
'Label'
|
|
119
119
|
]);
|
|
120
120
|
});
|
|
121
|
+
|
|
122
|
+
test.each<{ name: string; traces: Trace[]; labels: string[]; forceTraceElements: string[] }>([
|
|
123
|
+
{
|
|
124
|
+
name: 'force one element',
|
|
125
|
+
traces: [
|
|
126
|
+
[
|
|
127
|
+
{ type: 't1', label: 'T1L1' },
|
|
128
|
+
{ type: 't2', label: 'T2L1' }
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
{ type: 't1', label: 'T1L2' },
|
|
132
|
+
{ type: 't2', label: 'T2L2' }
|
|
133
|
+
]
|
|
134
|
+
],
|
|
135
|
+
labels: ['T1L1', 'T1L2'],
|
|
136
|
+
forceTraceElements: ['t1']
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'force multiple elements',
|
|
140
|
+
traces: [
|
|
141
|
+
[
|
|
142
|
+
{ type: 't1', label: 'T1L1' },
|
|
143
|
+
{ type: 't2', label: 'T2L1' },
|
|
144
|
+
{ type: 't3', label: 'T3L1' }
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
{ type: 't1', label: 'T1L2' },
|
|
148
|
+
{ type: 't2', label: 'T2L2' },
|
|
149
|
+
{ type: 't3', label: 'T3L2' }
|
|
150
|
+
]
|
|
151
|
+
],
|
|
152
|
+
labels: ['T1L1 / T3L1', 'T1L2 / T3L2'],
|
|
153
|
+
forceTraceElements: ['t1', 't3']
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'force element not in all traces',
|
|
157
|
+
traces: [
|
|
158
|
+
[
|
|
159
|
+
{ type: 't1', label: 'T1L1' },
|
|
160
|
+
{ type: 't2', label: 'T2L1' }
|
|
161
|
+
],
|
|
162
|
+
[{ type: 't2', label: 'T2L2' }]
|
|
163
|
+
],
|
|
164
|
+
labels: ['T1L1 / T2L1', 'T2L2'],
|
|
165
|
+
forceTraceElements: ['t1']
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'force element with includeNativeLabel',
|
|
169
|
+
traces: [
|
|
170
|
+
[
|
|
171
|
+
{ type: 't1', label: 'T1L1' },
|
|
172
|
+
{ type: 't2', label: 'T2L1' }
|
|
173
|
+
],
|
|
174
|
+
[
|
|
175
|
+
{ type: 't1', label: 'T1L2' },
|
|
176
|
+
{ type: 't2', label: 'T2L2' }
|
|
177
|
+
]
|
|
178
|
+
],
|
|
179
|
+
labels: ['T1L1', 'T1L2'],
|
|
180
|
+
forceTraceElements: ['t1']
|
|
181
|
+
}
|
|
182
|
+
])(
|
|
183
|
+
'test label derivation with forceTraceElements: $name',
|
|
184
|
+
({ name, traces, labels, forceTraceElements }) => {
|
|
185
|
+
expect(
|
|
186
|
+
deriveLabels(tracesToSpecs(traces), (s) => s, { forceTraceElements }).map((r) => r.label)
|
|
187
|
+
).toEqual(labels);
|
|
188
|
+
|
|
189
|
+
if (name === 'force element with includeNativeLabel') {
|
|
190
|
+
expect(
|
|
191
|
+
deriveLabels(tracesToSpecs(traces), (s) => s, {
|
|
192
|
+
forceTraceElements,
|
|
193
|
+
includeNativeLabel: true
|
|
194
|
+
}).map((r) => r.label)
|
|
195
|
+
).toEqual(labels.map(l => 'Label / ' + l));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
);
|
package/src/render/util/label.ts
CHANGED
|
@@ -16,6 +16,8 @@ export type LabelDerivationOps = {
|
|
|
16
16
|
separator?: string;
|
|
17
17
|
/** If true, label will be added as suffix (at the end of the generated label). By default label added as a prefix. */
|
|
18
18
|
addLabelAsSuffix?: boolean;
|
|
19
|
+
/** Trace elements list that will be forced to be included in the label. */
|
|
20
|
+
forceTraceElements?: string[];
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
export const TraceEntry = z.object({
|
|
@@ -50,6 +52,10 @@ export function deriveLabels<T>(
|
|
|
50
52
|
): RecordsWithLabel<T>[] {
|
|
51
53
|
const importances = new Map<string, number>();
|
|
52
54
|
|
|
55
|
+
const forceTraceElements = (ops.forceTraceElements !== undefined && ops.forceTraceElements.length > 0)
|
|
56
|
+
? new Set(ops.forceTraceElements)
|
|
57
|
+
: undefined;
|
|
58
|
+
|
|
53
59
|
// number of times certain type occurred among all of the
|
|
54
60
|
const numberOfRecordsWithType = new Map<string, number>();
|
|
55
61
|
|
|
@@ -80,7 +86,7 @@ export function deriveLabels<T>(
|
|
|
80
86
|
...(suffixTrace ?? []),
|
|
81
87
|
];
|
|
82
88
|
|
|
83
|
-
if (label) {
|
|
89
|
+
if (label !== undefined) {
|
|
84
90
|
const labelEntry = { label, type: LabelType, importance: -2 };
|
|
85
91
|
if (ops.addLabelAsSuffix) trace.push(labelEntry);
|
|
86
92
|
else trace.splice(0, 0, labelEntry);
|
|
@@ -129,14 +135,21 @@ export function deriveLabels<T>(
|
|
|
129
135
|
else secondaryTypes.push(typeName);
|
|
130
136
|
}
|
|
131
137
|
|
|
132
|
-
const calculate = (includedTypes: Set<string
|
|
138
|
+
const calculate = (includedTypes: Set<string>, force: boolean = false) => {
|
|
133
139
|
const result: RecordsWithLabel<T>[] = [];
|
|
134
140
|
for (let i = 0; i < enrichedRecords.length; i++) {
|
|
135
141
|
const r = enrichedRecords[i];
|
|
136
142
|
const includedTrace = r.fullTrace
|
|
137
|
-
.filter((fm) => includedTypes.has(fm.fullType)
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
.filter((fm) => includedTypes.has(fm.fullType)
|
|
144
|
+
|| (forceTraceElements && forceTraceElements.has(fm.type)));
|
|
145
|
+
if (includedTrace.length === 0) {
|
|
146
|
+
if (force)
|
|
147
|
+
result.push({
|
|
148
|
+
label: 'Unlabeled',
|
|
149
|
+
value: r.value,
|
|
150
|
+
} satisfies RecordsWithLabel<T>);
|
|
151
|
+
else return undefined;
|
|
152
|
+
}
|
|
140
153
|
const labelSet = includedTrace
|
|
141
154
|
.map((fm) => fm.label);
|
|
142
155
|
const sep = ops.separator ?? ' / ';
|
|
@@ -149,10 +162,8 @@ export function deriveLabels<T>(
|
|
|
149
162
|
};
|
|
150
163
|
|
|
151
164
|
if (mainTypes.length === 0) {
|
|
152
|
-
if (secondaryTypes.length !== 0) throw new Error('
|
|
153
|
-
|
|
154
|
-
if (result === undefined) throw new Error('Assertion error.');
|
|
155
|
-
return result;
|
|
165
|
+
if (secondaryTypes.length !== 0) throw new Error('Non-empty secondary types list while main types list is empty.');
|
|
166
|
+
return calculate(new Set(LabelTypeFull), true)!;
|
|
156
167
|
}
|
|
157
168
|
|
|
158
169
|
//
|
|
@@ -165,12 +176,13 @@ export function deriveLabels<T>(
|
|
|
165
176
|
// Resulting set: T0, T1, T3
|
|
166
177
|
//
|
|
167
178
|
let includedTypes = 0;
|
|
168
|
-
let additionalType =
|
|
179
|
+
let additionalType = -1;
|
|
169
180
|
while (includedTypes < mainTypes.length) {
|
|
170
181
|
const currentSet = new Set<string>();
|
|
171
182
|
if (ops.includeNativeLabel) currentSet.add(LabelTypeFull);
|
|
172
183
|
for (let i = 0; i < includedTypes; ++i) currentSet.add(mainTypes[i]);
|
|
173
|
-
|
|
184
|
+
if (additionalType >= 0)
|
|
185
|
+
currentSet.add(mainTypes[additionalType]);
|
|
174
186
|
|
|
175
187
|
const candidateResult = calculate(currentSet);
|
|
176
188
|
|
|
@@ -184,7 +196,5 @@ export function deriveLabels<T>(
|
|
|
184
196
|
}
|
|
185
197
|
}
|
|
186
198
|
|
|
187
|
-
|
|
188
|
-
if (result === undefined) throw new Error('Assertion error.');
|
|
189
|
-
return result;
|
|
199
|
+
return calculate(new Set([...mainTypes, ...secondaryTypes]), true)!;
|
|
190
200
|
}
|