@platforma-sdk/model 1.30.11 → 1.30.24
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/components/PFrameForGraphs.d.ts +4 -4
- package/dist/components/PFrameForGraphs.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +498 -503
- package/dist/index.mjs.map +1 -1
- package/dist/render/util/column_collection.d.ts.map +1 -1
- package/dist/render/util/label.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +5 -5
- package/src/components/PFrameForGraphs.ts +27 -33
- package/src/render/util/column_collection.ts +9 -1
- package/src/render/util/label.ts +27 -24
- package/src/version.ts +0 -1
|
@@ -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,EAKnB,qBAAqB,
|
|
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,EAKnB,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,MAAM,mBAAmB,CAAC;AAK7F,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,GA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AAM,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;CAC5B,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,CA+IvB"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PlatformaSDKVersion = "1.30.
|
|
1
|
+
export declare const PlatformaSDKVersion = "1.30.24";
|
|
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.24",
|
|
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",
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
AxisId,
|
|
3
3
|
CanonicalizedJson,
|
|
4
|
+
DataInfo,
|
|
4
5
|
PColumn,
|
|
6
|
+
PColumnSpec,
|
|
5
7
|
PColumnSpecId,
|
|
6
8
|
PColumnValues,
|
|
7
9
|
PFrameHandle,
|
|
8
10
|
PObjectId,
|
|
9
|
-
|
|
11
|
+
} from '@milaboratories/pl-model-common';
|
|
10
12
|
import {
|
|
11
13
|
canonicalizeJson,
|
|
12
14
|
getAxisId,
|
|
@@ -49,21 +51,21 @@ function getKeysCombinations(idsLists: AxisId[][]) {
|
|
|
49
51
|
|
|
50
52
|
/** Check if axes of secondary column are exactly in axes of main column */
|
|
51
53
|
function checkFullCompatibility(
|
|
52
|
-
mainColumn:
|
|
53
|
-
secondaryColumn:
|
|
54
|
+
mainColumn: PColumnSpec,
|
|
55
|
+
secondaryColumn: PColumnSpec,
|
|
54
56
|
): boolean {
|
|
55
|
-
const mainAxesIds = mainColumn.
|
|
56
|
-
const secondaryAxesIds = secondaryColumn.
|
|
57
|
+
const mainAxesIds = mainColumn.axesSpec.map(getAxisId);
|
|
58
|
+
const secondaryAxesIds = secondaryColumn.axesSpec.map(getAxisId);
|
|
57
59
|
return secondaryAxesIds.every((id) => mainAxesIds.some((mainId) => matchAxisId(mainId, id) && matchAxisId(id, mainId)));
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
/** Check if axes of secondary column are in axes of main column, but they can have compatible difference in domains */
|
|
61
63
|
function checkCompatibility(
|
|
62
|
-
mainColumn:
|
|
63
|
-
secondaryColumn:
|
|
64
|
+
mainColumn: PColumnSpec,
|
|
65
|
+
secondaryColumn: PColumnSpec,
|
|
64
66
|
): boolean {
|
|
65
|
-
const mainAxesIds = mainColumn.
|
|
66
|
-
const secondaryAxesIds = secondaryColumn.
|
|
67
|
+
const mainAxesIds = mainColumn.axesSpec.map(getAxisId);
|
|
68
|
+
const secondaryAxesIds = secondaryColumn.axesSpec.map(getAxisId);
|
|
67
69
|
return secondaryAxesIds.every((id) => mainAxesIds.some((mainId) => matchAxisId(mainId, id)));
|
|
68
70
|
}
|
|
69
71
|
|
|
@@ -73,17 +75,17 @@ export const LABEL_ANNOTATION = 'pl7.app/label';
|
|
|
73
75
|
/** Main column can have additional domains, if secondary column (meta-column) has all axes match main column axes
|
|
74
76
|
we can add its copy with missed domain fields for compatibility */
|
|
75
77
|
function getAdditionalColumnsForPair(
|
|
76
|
-
mainColumn: PColumn<TreeNodeAccessor | PColumnValues>,
|
|
77
|
-
secondaryColumn: PColumn<TreeNodeAccessor | PColumnValues>,
|
|
78
|
-
): PColumn<TreeNodeAccessor | PColumnValues>[] {
|
|
78
|
+
mainColumn: PColumn<TreeNodeAccessor | DataInfo<TreeNodeAccessor> | PColumnValues>,
|
|
79
|
+
secondaryColumn: PColumn<TreeNodeAccessor | DataInfo<TreeNodeAccessor> | PColumnValues>,
|
|
80
|
+
): PColumn<TreeNodeAccessor | DataInfo<TreeNodeAccessor> | PColumnValues>[] {
|
|
79
81
|
const mainAxesIds = mainColumn.spec.axesSpec.map(getAxisId);
|
|
80
82
|
const secondaryAxesIds = secondaryColumn.spec.axesSpec.map(getAxisId);
|
|
81
83
|
|
|
82
|
-
const isFullCompatible = checkFullCompatibility(mainColumn, secondaryColumn);
|
|
84
|
+
const isFullCompatible = checkFullCompatibility(mainColumn.spec, secondaryColumn.spec);
|
|
83
85
|
if (isFullCompatible) { // in this case it isn't necessary to add more columns
|
|
84
86
|
return [];
|
|
85
87
|
}
|
|
86
|
-
const isCompatible = checkCompatibility(mainColumn, secondaryColumn);
|
|
88
|
+
const isCompatible = checkCompatibility(mainColumn.spec, secondaryColumn.spec);
|
|
87
89
|
if (!isCompatible) { // in this case it is impossible to add some compatible column
|
|
88
90
|
return [];
|
|
89
91
|
}
|
|
@@ -155,8 +157,10 @@ function getAdditionalColumnsForPair(
|
|
|
155
157
|
});
|
|
156
158
|
}
|
|
157
159
|
|
|
158
|
-
export function getAdditionalColumns(
|
|
159
|
-
|
|
160
|
+
export function getAdditionalColumns(
|
|
161
|
+
columns: PColumn<TreeNodeAccessor | DataInfo<TreeNodeAccessor> | PColumnValues>[],
|
|
162
|
+
): PColumn<TreeNodeAccessor | DataInfo<TreeNodeAccessor> | PColumnValues>[] {
|
|
163
|
+
const additionalColumns: PColumn<TreeNodeAccessor | DataInfo<TreeNodeAccessor> | PColumnValues>[] = [];
|
|
160
164
|
for (let i = 0; i < columns.length; i++) {
|
|
161
165
|
for (let j = i + 1; j < columns.length; j++) {
|
|
162
166
|
const column1 = columns[i];
|
|
@@ -173,9 +177,9 @@ export function getAdditionalColumns(columns: PColumn<TreeNodeAccessor | PColumn
|
|
|
173
177
|
}
|
|
174
178
|
|
|
175
179
|
export function enrichColumnsWithCompatible(
|
|
176
|
-
mainColumns: PColumn<TreeNodeAccessor | PColumnValues>[],
|
|
177
|
-
secondaryColumns: PColumn<TreeNodeAccessor | PColumnValues>[],
|
|
178
|
-
): PColumn<TreeNodeAccessor | PColumnValues>[] {
|
|
180
|
+
mainColumns: PColumn<TreeNodeAccessor | DataInfo<TreeNodeAccessor> | PColumnValues>[],
|
|
181
|
+
secondaryColumns: PColumn<TreeNodeAccessor | DataInfo<TreeNodeAccessor> | PColumnValues>[],
|
|
182
|
+
): PColumn<TreeNodeAccessor | DataInfo<TreeNodeAccessor> | PColumnValues>[] {
|
|
179
183
|
const mainColumnsIds = new Set<PObjectId>();
|
|
180
184
|
const mainColumnsBySpec = new Map<CanonicalizedJson<PColumnSpecId>, typeof mainColumns[number]>();
|
|
181
185
|
mainColumns.forEach((column) => {
|
|
@@ -191,7 +195,7 @@ export function enrichColumnsWithCompatible(
|
|
|
191
195
|
if (mainColumnsBySpec.has(spec)) continue;
|
|
192
196
|
|
|
193
197
|
for (const mainColumn of mainColumnsBySpec.values()) {
|
|
194
|
-
if (checkCompatibility(mainColumn, secondaryColumn)) {
|
|
198
|
+
if (checkCompatibility(mainColumn.spec, secondaryColumn.spec)) {
|
|
195
199
|
secondaryColumnsBySpec.set(spec, secondaryColumn);
|
|
196
200
|
break;
|
|
197
201
|
}
|
|
@@ -201,26 +205,16 @@ export function enrichColumnsWithCompatible(
|
|
|
201
205
|
return [...mainColumnsBySpec.values(), ...secondaryColumnsBySpec.values()];
|
|
202
206
|
}
|
|
203
207
|
|
|
204
|
-
const VALUE_TYPES: ValueType[] = [
|
|
205
|
-
'Int',
|
|
206
|
-
'Long',
|
|
207
|
-
'Float',
|
|
208
|
-
'Double',
|
|
209
|
-
'String',
|
|
210
|
-
'Bytes',
|
|
211
|
-
];
|
|
212
|
-
|
|
213
208
|
export function createPFrameForGraphs<A, U>(
|
|
214
209
|
ctx: RenderCtx<A, U>,
|
|
215
|
-
blockColumns
|
|
210
|
+
blockColumns: PColumn<TreeNodeAccessor | DataInfo<TreeNodeAccessor> | PColumnValues>[] | undefined,
|
|
216
211
|
): PFrameHandle | undefined {
|
|
217
|
-
if (blockColumns
|
|
212
|
+
if (!blockColumns) return undefined;
|
|
218
213
|
|
|
219
214
|
const upstreamColumns = ctx.resultPool
|
|
220
215
|
.getData()
|
|
221
216
|
.entries.map((v) => v.obj)
|
|
222
|
-
.filter(isPColumn)
|
|
223
|
-
.filter((column) => VALUE_TYPES.includes(column.spec.valueType));
|
|
217
|
+
.filter(isPColumn);
|
|
224
218
|
|
|
225
219
|
const columnsWithCompatibleFromUpstream = enrichColumnsWithCompatible(blockColumns, upstreamColumns);
|
|
226
220
|
|
|
@@ -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';
|
|
@@ -224,6 +226,7 @@ export class PColumnCollection {
|
|
|
224
226
|
: [predicateOrSelectors];
|
|
225
227
|
|
|
226
228
|
const intermediateResults: IntermediateColumnEntry[] = [];
|
|
229
|
+
const selectedNativeIds = new Set<NativePObjectId>();
|
|
227
230
|
|
|
228
231
|
for (const rawSelector of selectorsArray) {
|
|
229
232
|
const usesAnchors = hasAnchors(rawSelector);
|
|
@@ -241,8 +244,13 @@ export class PColumnCollection {
|
|
|
241
244
|
for (const provider of this.providers) {
|
|
242
245
|
const providerColumns = provider.selectColumns(currentSelector);
|
|
243
246
|
for (const col of providerColumns) {
|
|
244
|
-
if (selectedIds.has(col.id))
|
|
247
|
+
if (selectedIds.has(col.id))
|
|
248
|
+
throw new Error(`Duplicate column id ${col.id} in provider ${provider.constructor.name}`);
|
|
249
|
+
const nativeId = deriveNativeId(col.spec);
|
|
250
|
+
if (selectedNativeIds.has(nativeId))
|
|
251
|
+
continue;
|
|
245
252
|
selectedIds.add(col.id);
|
|
253
|
+
selectedNativeIds.add(nativeId);
|
|
246
254
|
selectedColumns.push(col);
|
|
247
255
|
}
|
|
248
256
|
}
|
package/src/render/util/label.ts
CHANGED
|
@@ -25,7 +25,7 @@ export const TraceEntry = z.object({
|
|
|
25
25
|
label: z.string(),
|
|
26
26
|
});
|
|
27
27
|
export type TraceEntry = z.infer<typeof TraceEntry>;
|
|
28
|
-
type FullTraceEntry = TraceEntry & { fullType: string;
|
|
28
|
+
type FullTraceEntry = TraceEntry & { fullType: string; occurrenceIndex: number };
|
|
29
29
|
|
|
30
30
|
export const Trace = z.array(TraceEntry);
|
|
31
31
|
export type Trace = z.infer<typeof Trace>;
|
|
@@ -50,7 +50,7 @@ export function deriveLabels<T>(
|
|
|
50
50
|
): RecordsWithLabel<T>[] {
|
|
51
51
|
const importances = new Map<string, number>();
|
|
52
52
|
|
|
53
|
-
// number of times certain type
|
|
53
|
+
// number of times certain type occurred among all of the
|
|
54
54
|
const numberOfRecordsWithType = new Map<string, number>();
|
|
55
55
|
|
|
56
56
|
const enrichedRecords = values.map((value) => {
|
|
@@ -80,7 +80,7 @@ export function deriveLabels<T>(
|
|
|
80
80
|
...(suffixTrace ?? []),
|
|
81
81
|
];
|
|
82
82
|
|
|
83
|
-
if (label) {
|
|
83
|
+
if (label !== undefined) {
|
|
84
84
|
const labelEntry = { label, type: LabelType, importance: -2 };
|
|
85
85
|
if (ops.addLabelAsSuffix) trace.push(labelEntry);
|
|
86
86
|
else trace.splice(0, 0, labelEntry);
|
|
@@ -88,13 +88,13 @@ export function deriveLabels<T>(
|
|
|
88
88
|
|
|
89
89
|
const fullTrace: FullTrace = [];
|
|
90
90
|
|
|
91
|
-
const
|
|
91
|
+
const occurrences = new Map<string, number>();
|
|
92
92
|
for (let i = trace.length - 1; i >= 0; --i) {
|
|
93
93
|
const { type: typeName } = trace[i];
|
|
94
94
|
const importance = trace[i].importance ?? 0;
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
const fullType = `${typeName}@${
|
|
95
|
+
const occurrenceIndex = (occurrences.get(typeName) ?? 0) + 1;
|
|
96
|
+
occurrences.set(typeName, occurrenceIndex);
|
|
97
|
+
const fullType = `${typeName}@${occurrenceIndex}`;
|
|
98
98
|
numberOfRecordsWithType.set(fullType, (numberOfRecordsWithType.get(fullType) ?? 0) + 1);
|
|
99
99
|
importances.set(
|
|
100
100
|
fullType,
|
|
@@ -103,7 +103,7 @@ export function deriveLabels<T>(
|
|
|
103
103
|
importance - (trace.length - i) * DistancePenalty,
|
|
104
104
|
),
|
|
105
105
|
);
|
|
106
|
-
fullTrace.push({ ...trace[i], fullType,
|
|
106
|
+
fullTrace.push({ ...trace[i], fullType, occurrenceIndex: occurrenceIndex });
|
|
107
107
|
}
|
|
108
108
|
fullTrace.reverse();
|
|
109
109
|
return {
|
|
@@ -129,14 +129,20 @@ export function deriveLabels<T>(
|
|
|
129
129
|
else secondaryTypes.push(typeName);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
const calculate = (includedTypes: Set<string
|
|
132
|
+
const calculate = (includedTypes: Set<string>, force: boolean = false) => {
|
|
133
133
|
const result: RecordsWithLabel<T>[] = [];
|
|
134
134
|
for (let i = 0; i < enrichedRecords.length; i++) {
|
|
135
135
|
const r = enrichedRecords[i];
|
|
136
136
|
const includedTrace = r.fullTrace
|
|
137
137
|
.filter((fm) => includedTypes.has(fm.fullType));
|
|
138
|
-
if (includedTrace.length === 0)
|
|
139
|
-
|
|
138
|
+
if (includedTrace.length === 0) {
|
|
139
|
+
if (force)
|
|
140
|
+
result.push({
|
|
141
|
+
label: 'Unlabeled',
|
|
142
|
+
value: r.value,
|
|
143
|
+
} satisfies RecordsWithLabel<T>);
|
|
144
|
+
else return undefined;
|
|
145
|
+
}
|
|
140
146
|
const labelSet = includedTrace
|
|
141
147
|
.map((fm) => fm.label);
|
|
142
148
|
const sep = ops.separator ?? ' / ';
|
|
@@ -149,10 +155,8 @@ export function deriveLabels<T>(
|
|
|
149
155
|
};
|
|
150
156
|
|
|
151
157
|
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;
|
|
158
|
+
if (secondaryTypes.length !== 0) throw new Error('Non-empty secondary types list while main types list is empty.');
|
|
159
|
+
return calculate(new Set(LabelTypeFull), true)!;
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
//
|
|
@@ -160,31 +164,30 @@ export function deriveLabels<T>(
|
|
|
160
164
|
// * *
|
|
161
165
|
// T0 T1 T2 T3 T4 T5
|
|
162
166
|
// *
|
|
163
|
-
//
|
|
167
|
+
// additionalType = 3
|
|
164
168
|
//
|
|
165
169
|
// Resulting set: T0, T1, T3
|
|
166
170
|
//
|
|
167
171
|
let includedTypes = 0;
|
|
168
|
-
let
|
|
172
|
+
let additionalType = -1;
|
|
169
173
|
while (includedTypes < mainTypes.length) {
|
|
170
174
|
const currentSet = new Set<string>();
|
|
171
175
|
if (ops.includeNativeLabel) currentSet.add(LabelTypeFull);
|
|
172
176
|
for (let i = 0; i < includedTypes; ++i) currentSet.add(mainTypes[i]);
|
|
173
|
-
|
|
177
|
+
if (additionalType >= 0)
|
|
178
|
+
currentSet.add(mainTypes[additionalType]);
|
|
174
179
|
|
|
175
180
|
const candidateResult = calculate(currentSet);
|
|
176
181
|
|
|
177
182
|
// checking if labels uniquely separate our records
|
|
178
183
|
if (candidateResult !== undefined && new Set(candidateResult.map((c) => c.label)).size === values.length) return candidateResult;
|
|
179
184
|
|
|
180
|
-
|
|
181
|
-
if (
|
|
185
|
+
additionalType++;
|
|
186
|
+
if (additionalType >= mainTypes.length) {
|
|
182
187
|
includedTypes++;
|
|
183
|
-
|
|
188
|
+
additionalType = includedTypes;
|
|
184
189
|
}
|
|
185
190
|
}
|
|
186
191
|
|
|
187
|
-
|
|
188
|
-
if (result === undefined) throw new Error('Assertion error.');
|
|
189
|
-
return result;
|
|
192
|
+
return calculate(new Set([...mainTypes, ...secondaryTypes]), true)!;
|
|
190
193
|
}
|
package/src/version.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const PlatformaSDKVersion = '1.30.11';
|