@milaboratories/pl-model-common 1.48.0 → 1.49.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/author_marker.d.ts +1 -2
- package/dist/author_marker.d.ts.map +1 -1
- package/dist/base64.d.ts +4 -6
- package/dist/base64.d.ts.map +1 -1
- package/dist/block_state.d.ts +13 -9
- package/dist/block_state.d.ts.map +1 -1
- package/dist/bmodel/block_config.d.ts +51 -29
- package/dist/bmodel/block_config.d.ts.map +1 -1
- package/dist/bmodel/block_kind_ref.d.ts +4 -6
- package/dist/bmodel/block_kind_ref.d.ts.map +1 -1
- package/dist/bmodel/code.d.ts +4 -5
- package/dist/bmodel/code.d.ts.map +1 -1
- package/dist/bmodel/container.d.ts +5 -5
- package/dist/bmodel/container.d.ts.map +1 -1
- package/dist/bmodel/normalization.d.ts +1 -3
- package/dist/bmodel/normalization.d.ts.map +1 -1
- package/dist/bmodel/types.d.ts +1 -2
- package/dist/bmodel/types.d.ts.map +1 -1
- package/dist/branding.d.ts +2 -3
- package/dist/branding.d.ts.map +1 -1
- package/dist/columns/accessor_traversal.d.ts +6 -8
- package/dist/columns/accessor_traversal.d.ts.map +1 -1
- package/dist/columns/column_registry.d.ts +2 -3
- package/dist/columns/column_registry.d.ts.map +1 -1
- package/dist/columns/column_selector.d.ts +9 -9
- package/dist/columns/column_selector.d.ts.map +1 -1
- package/dist/columns/dedup.d.ts +1 -3
- package/dist/columns/dedup.d.ts.map +1 -1
- package/dist/columns/providers.d.ts +3 -4
- package/dist/columns/providers.d.ts.map +1 -1
- package/dist/columns/types.d.ts +12 -9
- package/dist/columns/types.d.ts.map +1 -1
- package/dist/common_types.d.ts +4 -6
- package/dist/common_types.d.ts.map +1 -1
- package/dist/dialog/index.d.ts +4 -5
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/driver_kit.d.ts +2 -2
- package/dist/driver_kit.d.ts.map +1 -1
- package/dist/drivers/ChunkedStreamReader.d.ts +3 -5
- package/dist/drivers/ChunkedStreamReader.d.ts.map +1 -1
- package/dist/drivers/blob.d.ts +36 -25
- package/dist/drivers/blob.d.ts.map +1 -1
- package/dist/drivers/columns/columns_collection_driver.d.ts +6 -7
- package/dist/drivers/columns/columns_collection_driver.d.ts.map +1 -1
- package/dist/drivers/columns/discover_columns_options.d.ts +9 -8
- package/dist/drivers/columns/discover_columns_options.d.ts.map +1 -1
- package/dist/drivers/index.cjs +1 -0
- package/dist/drivers/index.d.ts +4 -2
- package/dist/drivers/index.js +2 -2
- package/dist/drivers/interfaces.d.ts +2 -3
- package/dist/drivers/interfaces.d.ts.map +1 -1
- package/dist/drivers/log.d.ts +26 -28
- package/dist/drivers/log.d.ts.map +1 -1
- package/dist/drivers/ls.d.ts +37 -27
- package/dist/drivers/ls.d.ts.map +1 -1
- package/dist/drivers/pframe/column_filter.d.ts +1 -3
- package/dist/drivers/pframe/column_filter.d.ts.map +1 -1
- package/dist/drivers/pframe/data_info.d.ts +77 -50
- package/dist/drivers/pframe/data_info.d.ts.map +1 -1
- package/dist/drivers/pframe/data_types.d.ts +50 -45
- package/dist/drivers/pframe/data_types.d.ts.map +1 -1
- package/dist/drivers/pframe/driver.d.ts +5 -5
- package/dist/drivers/pframe/driver.d.ts.map +1 -1
- package/dist/drivers/pframe/filter_spec.d.ts +10 -12
- package/dist/drivers/pframe/filter_spec.d.ts.map +1 -1
- package/dist/drivers/pframe/find_columns.d.ts +2 -4
- package/dist/drivers/pframe/find_columns.d.ts.map +1 -1
- package/dist/drivers/pframe/index.cjs +1 -0
- package/dist/drivers/pframe/index.d.ts +4 -2
- package/dist/drivers/pframe/index.js +2 -2
- package/dist/drivers/pframe/linker_columns.d.ts +4 -10
- package/dist/drivers/pframe/linker_columns.d.ts.map +1 -1
- package/dist/drivers/pframe/pframe.d.ts +3 -3
- package/dist/drivers/pframe/pframe.d.ts.map +1 -1
- package/dist/drivers/pframe/query/query_common.d.ts +52 -46
- package/dist/drivers/pframe/query/query_common.d.ts.map +1 -1
- package/dist/drivers/pframe/query/query_data.d.ts +26 -21
- package/dist/drivers/pframe/query/query_data.d.ts.map +1 -1
- package/dist/drivers/pframe/query/query_spec.d.ts +22 -19
- package/dist/drivers/pframe/query/query_spec.d.ts.map +1 -1
- package/dist/drivers/pframe/query/utils.d.ts +15 -11
- package/dist/drivers/pframe/query/utils.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/anchored.d.ts +3 -5
- package/dist/drivers/pframe/spec/anchored.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/discovered_column.d.ts +10 -11
- package/dist/drivers/pframe/spec/discovered_column.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.d.ts +17 -18
- package/dist/drivers/pframe/spec/filtered_column.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/ids.d.ts +16 -16
- package/dist/drivers/pframe/spec/ids.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/index.cjs +1 -0
- package/dist/drivers/pframe/spec/index.d.ts +2 -2
- package/dist/drivers/pframe/spec/index.js +2 -2
- package/dist/drivers/pframe/spec/native_id.d.ts +3 -3
- package/dist/drivers/pframe/spec/native_id.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/overridden.d.ts +14 -16
- package/dist/drivers/pframe/spec/overridden.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/selectors.d.ts +22 -22
- package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/spec.cjs +31 -0
- package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
- package/dist/drivers/pframe/spec/spec.d.ts +94 -70
- package/dist/drivers/pframe/spec/spec.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/spec.js +31 -1
- package/dist/drivers/pframe/spec/spec.js.map +1 -1
- package/dist/drivers/pframe/spec_driver.d.ts +30 -25
- package/dist/drivers/pframe/spec_driver.d.ts.map +1 -1
- package/dist/drivers/pframe/table.d.ts +1 -3
- package/dist/drivers/pframe/table.d.ts.map +1 -1
- package/dist/drivers/pframe/table_calculate.d.ts +55 -46
- package/dist/drivers/pframe/table_calculate.d.ts.map +1 -1
- package/dist/drivers/pframe/table_common.d.ts +9 -10
- package/dist/drivers/pframe/table_common.d.ts.map +1 -1
- package/dist/drivers/pframe/unique_values.d.ts +3 -3
- package/dist/drivers/pframe/unique_values.d.ts.map +1 -1
- package/dist/drivers/upload.d.ts +2 -3
- package/dist/drivers/upload.d.ts.map +1 -1
- package/dist/drivers/urls.d.ts +7 -8
- package/dist/drivers/urls.d.ts.map +1 -1
- package/dist/errors.d.ts +35 -36
- package/dist/errors.d.ts.map +1 -1
- package/dist/flags/block_flags.cjs.map +1 -1
- package/dist/flags/block_flags.d.ts +7 -7
- package/dist/flags/block_flags.d.ts.map +1 -1
- package/dist/flags/block_flags.js.map +1 -1
- package/dist/flags/flag_utils.d.ts +6 -8
- package/dist/flags/flag_utils.d.ts.map +1 -1
- package/dist/flags/type_utils.d.ts +6 -7
- package/dist/flags/type_utils.d.ts.map +1 -1
- package/dist/httpAuth.d.ts +4 -5
- package/dist/httpAuth.d.ts.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.js +2 -2
- package/dist/json.d.ts +11 -12
- package/dist/json.d.ts.map +1 -1
- package/dist/navigation.d.ts +16 -11
- package/dist/navigation.d.ts.map +1 -1
- package/dist/plid.d.ts +7 -9
- package/dist/plid.d.ts.map +1 -1
- package/dist/pool/entry.d.ts +8 -6
- package/dist/pool/entry.d.ts.map +1 -1
- package/dist/pool/query.d.ts +3 -4
- package/dist/pool/query.d.ts.map +1 -1
- package/dist/pool/spec.d.ts +33 -30
- package/dist/pool/spec.d.ts.map +1 -1
- package/dist/pool_entry.d.ts +2 -3
- package/dist/pool_entry.d.ts.map +1 -1
- package/dist/project_id.d.ts +1 -3
- package/dist/project_id.d.ts.map +1 -1
- package/dist/ref.d.ts +22 -23
- package/dist/ref.d.ts.map +1 -1
- package/dist/resource_types.d.ts +2 -3
- package/dist/resource_types.d.ts.map +1 -1
- package/dist/services/node_service_handlers.d.ts +1 -3
- package/dist/services/node_service_handlers.d.ts.map +1 -1
- package/dist/services/service_capabilities.d.ts +7 -9
- package/dist/services/service_capabilities.d.ts.map +1 -1
- package/dist/services/service_declarations.d.ts +2 -2
- package/dist/services/service_declarations.d.ts.map +1 -1
- package/dist/services/service_injectors.d.ts +7 -8
- package/dist/services/service_injectors.d.ts.map +1 -1
- package/dist/services/service_registry.d.ts +2 -4
- package/dist/services/service_registry.d.ts.map +1 -1
- package/dist/services/service_types.d.ts +24 -26
- package/dist/services/service_types.d.ts.map +1 -1
- package/dist/template/kind_selector.d.ts +9 -11
- package/dist/template/kind_selector.d.ts.map +1 -1
- package/dist/template/project_template_v1.d.ts +22 -20
- package/dist/template/project_template_v1.d.ts.map +1 -1
- package/dist/template/template_ref_form.d.ts +6 -5
- package/dist/template/template_ref_form.d.ts.map +1 -1
- package/dist/template/template_relocate.cjs +24 -3
- package/dist/template/template_relocate.cjs.map +1 -1
- package/dist/template/template_relocate.d.ts +8 -4
- package/dist/template/template_relocate.d.ts.map +1 -1
- package/dist/template/template_relocate.js +24 -3
- package/dist/template/template_relocate.js.map +1 -1
- package/dist/utag.d.ts +2 -4
- package/dist/utag.d.ts.map +1 -1
- package/dist/util.d.ts +2 -3
- package/dist/util.d.ts.map +1 -1
- package/dist/value_or_error.d.ts +2 -3
- package/dist/value_or_error.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/drivers/pframe/spec/spec.ts +31 -0
- package/src/flags/block_flags.ts +1 -1
- package/src/template/template_relocate.test.ts +57 -0
- package/src/template/template_relocate.ts +32 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CanonicalizedJson, StringifiedJson } from "../../../json.js";
|
|
2
2
|
import { PObject, PObjectId, PObjectSpec } from "../../../pool/spec.js";
|
|
3
|
+
import "../../../pool/index.js";
|
|
3
4
|
import { z } from "zod";
|
|
4
|
-
|
|
5
5
|
//#region src/drivers/pframe/spec/spec.d.ts
|
|
6
|
-
declare const ValueType: {
|
|
6
|
+
export declare const ValueType: {
|
|
7
7
|
readonly Int: "Int";
|
|
8
8
|
readonly Long: "Long";
|
|
9
9
|
readonly Float: "Float";
|
|
@@ -11,17 +11,17 @@ declare const ValueType: {
|
|
|
11
11
|
readonly String: "String";
|
|
12
12
|
readonly Bytes: "Bytes";
|
|
13
13
|
};
|
|
14
|
-
type AxisValueType = Extract<ValueType, "Int" | "Long" | "String">;
|
|
15
|
-
type ColumnValueType = ValueType;
|
|
14
|
+
export type AxisValueType = Extract<ValueType, "Int" | "Long" | "String">;
|
|
15
|
+
export type ColumnValueType = ValueType;
|
|
16
16
|
/** PFrame columns and axes within them may store one of these types. */
|
|
17
|
-
type ValueType = (typeof ValueType)[keyof typeof ValueType];
|
|
18
|
-
type Metadata = Record<string, string>;
|
|
19
|
-
declare function readMetadata<U extends Metadata, T extends keyof U = keyof U>(metadata: Metadata | undefined, key: T): U[T] | undefined;
|
|
20
|
-
type MetadataJsonImpl<M> = { [P in keyof M as M[P] extends StringifiedJson ? P : never]: M[P] extends StringifiedJson<infer U> ? z.ZodType<U> : never };
|
|
21
|
-
type MetadataJson<M> = MetadataJsonImpl<Required<M>>;
|
|
22
|
-
declare function readMetadataJsonOrThrow<M extends Metadata, T extends keyof MetadataJson<M>>(metadata: Metadata | undefined, metadataJson: MetadataJson<M>, key: T, methodNameInError?: string): z.infer<MetadataJson<M>[T]> | undefined;
|
|
23
|
-
declare function readMetadataJson<M extends Metadata, T extends keyof MetadataJson<M>>(metadata: Metadata | undefined, metadataJson: MetadataJson<M>, key: T): z.infer<MetadataJson<M>[T]> | undefined;
|
|
24
|
-
declare const Domain: {
|
|
17
|
+
export type ValueType = (typeof ValueType)[keyof typeof ValueType];
|
|
18
|
+
export type Metadata = Record<string, string>;
|
|
19
|
+
export declare function readMetadata<U extends Metadata, T extends keyof U = keyof U>(metadata: Metadata | undefined, key: T): U[T] | undefined;
|
|
20
|
+
type MetadataJsonImpl<M> = { [P in keyof M as M[P] extends StringifiedJson ? P : never]: M[P] extends StringifiedJson<infer U> ? z.ZodType<U> : never; };
|
|
21
|
+
export type MetadataJson<M> = MetadataJsonImpl<Required<M>>;
|
|
22
|
+
export declare function readMetadataJsonOrThrow<M extends Metadata, T extends keyof MetadataJson<M>>(metadata: Metadata | undefined, metadataJson: MetadataJson<M>, key: T, methodNameInError?: string): z.infer<MetadataJson<M>[T]> | undefined;
|
|
23
|
+
export declare function readMetadataJson<M extends Metadata, T extends keyof MetadataJson<M>>(metadata: Metadata | undefined, metadataJson: MetadataJson<M>, key: T): z.infer<MetadataJson<M>[T]> | undefined;
|
|
24
|
+
export declare const Domain: {
|
|
25
25
|
readonly Alphabet: "pl7.app/alphabet";
|
|
26
26
|
readonly BlockId: "pl7.app/blockId";
|
|
27
27
|
readonly VDJ: {
|
|
@@ -33,23 +33,37 @@ declare const Domain: {
|
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Domain keys whose value is the id of a block, rather than a qualifier of the data.
|
|
38
|
+
*
|
|
39
|
+
* Applying a template repoints these at the blocks of the project being built: an axis a block
|
|
40
|
+
* produced names that block in its domain, so an axis left naming the exported-from project
|
|
41
|
+
* resolves to nothing. Listing the keys is what makes that safe — a template's entry ids are
|
|
42
|
+
* arbitrary non-empty strings, so a hand-written template may name an entry `closest`, and a
|
|
43
|
+
* qualifier that happens to read `closest` must not be mistaken for a reference to it.
|
|
44
|
+
*
|
|
45
|
+
* A key absent from here is simply left alone, which is the behaviour from before relocation
|
|
46
|
+
* reached domains at all. Adding one is therefore safe; omitting one costs only that a template
|
|
47
|
+
* carrying it applies still pointing at the project it came from.
|
|
48
|
+
*/
|
|
49
|
+
export declare const BlockScopedDomain: ReadonlySet<string>;
|
|
50
|
+
export type Domain = Metadata & Partial<{
|
|
37
51
|
[Domain.Alphabet]: "nucleotide" | "aminoacid" | (string & {});
|
|
38
52
|
[Domain.BlockId]: string;
|
|
39
53
|
[Domain.VDJ.ScClonotypeChain.Index]: "primary" | "secondary" | (string & {});
|
|
40
54
|
}>;
|
|
41
|
-
type DomainJson = MetadataJson<Domain>;
|
|
42
|
-
declare const DomainJson: DomainJson;
|
|
43
|
-
declare function readDomain<T extends keyof Domain>(spec: {
|
|
55
|
+
export type DomainJson = MetadataJson<Domain>;
|
|
56
|
+
export declare const DomainJson: DomainJson;
|
|
57
|
+
export declare function readDomain<T extends keyof Domain>(spec: {
|
|
44
58
|
domain?: Metadata | undefined;
|
|
45
59
|
} | undefined, key: T): Domain[T] | undefined;
|
|
46
|
-
declare function readDomainJsonOrThrow<T extends keyof DomainJson>(spec: {
|
|
60
|
+
export declare function readDomainJsonOrThrow<T extends keyof DomainJson>(spec: {
|
|
47
61
|
domain?: Metadata | undefined;
|
|
48
62
|
} | undefined, key: T): z.infer<DomainJson[T]> | undefined;
|
|
49
|
-
declare function readDomainJson<T extends keyof DomainJson>(spec: {
|
|
63
|
+
export declare function readDomainJson<T extends keyof DomainJson>(spec: {
|
|
50
64
|
domain?: Metadata | undefined;
|
|
51
65
|
} | undefined, key: T): z.infer<DomainJson[T]> | undefined;
|
|
52
|
-
declare const Annotation: {
|
|
66
|
+
export declare const Annotation: {
|
|
53
67
|
readonly AxisNature: "pl7.app/axisNature";
|
|
54
68
|
readonly Alphabet: "pl7.app/alphabet";
|
|
55
69
|
readonly Description: "pl7.app/description";
|
|
@@ -104,8 +118,8 @@ declare const Annotation: {
|
|
|
104
118
|
readonly IsMainSequence: "pl7.app/vdj/isMainSequence";
|
|
105
119
|
};
|
|
106
120
|
};
|
|
107
|
-
type AnnotationDataStatus = "missing" | "resolving" | "absent" | "computing" | "ready" | "error";
|
|
108
|
-
type Annotation = Metadata & Partial<{
|
|
121
|
+
export type AnnotationDataStatus = "missing" | "resolving" | "absent" | "computing" | "ready" | "error";
|
|
122
|
+
export type Annotation = Metadata & Partial<{
|
|
109
123
|
[Annotation.Alphabet]: "nucleotide" | "aminoacid" | (string & {});
|
|
110
124
|
[Annotation.AxisNature]: "homogeneous" | "heterogeneous" | "scaleCompatible" | (string & {});
|
|
111
125
|
[Annotation.Description]: string;
|
|
@@ -159,20 +173,20 @@ declare const TraceEntrySchema: z.ZodObject<{
|
|
|
159
173
|
type: z.ZodString;
|
|
160
174
|
label: z.ZodString;
|
|
161
175
|
}, z.ZodUnknown, "strip">>;
|
|
162
|
-
type TraceEntry = z.infer<typeof TraceEntrySchema>;
|
|
163
|
-
type Trace = TraceEntry[];
|
|
164
|
-
type AnnotationJson = MetadataJson<Annotation>;
|
|
165
|
-
declare const AnnotationJson: AnnotationJson;
|
|
166
|
-
declare function readAnnotation<T extends keyof Annotation>(spec: {
|
|
176
|
+
export type TraceEntry = z.infer<typeof TraceEntrySchema>;
|
|
177
|
+
export type Trace = TraceEntry[];
|
|
178
|
+
export type AnnotationJson = MetadataJson<Annotation>;
|
|
179
|
+
export declare const AnnotationJson: AnnotationJson;
|
|
180
|
+
export declare function readAnnotation<T extends keyof Annotation>(spec: {
|
|
167
181
|
annotations?: Metadata | undefined;
|
|
168
182
|
} | undefined, key: T): Annotation[T] | undefined;
|
|
169
|
-
declare function readAnnotationJsonOrThrow<T extends keyof AnnotationJson>(spec: {
|
|
183
|
+
export declare function readAnnotationJsonOrThrow<T extends keyof AnnotationJson>(spec: {
|
|
170
184
|
annotations?: Metadata | undefined;
|
|
171
185
|
} | undefined, key: T): z.infer<AnnotationJson[T]> | undefined;
|
|
172
|
-
declare function readAnnotationJson<T extends keyof AnnotationJson>(spec: {
|
|
186
|
+
export declare function readAnnotationJson<T extends keyof AnnotationJson>(spec: {
|
|
173
187
|
annotations?: Metadata | undefined;
|
|
174
188
|
} | undefined, key: T): z.infer<AnnotationJson[T]> | undefined;
|
|
175
|
-
declare function isLinkerColumn(column: PColumnSpec): boolean;
|
|
189
|
+
export declare function isLinkerColumn(column: PColumnSpec): boolean;
|
|
176
190
|
/**
|
|
177
191
|
* Specification of an individual axis.
|
|
178
192
|
*
|
|
@@ -181,8 +195,10 @@ declare function isLinkerColumn(column: PColumnSpec): boolean;
|
|
|
181
195
|
* Each record inside a PColumn is addressed by a unique tuple of values set for
|
|
182
196
|
* all the axes specified in the column spec.
|
|
183
197
|
*/
|
|
184
|
-
type AxisSpec = {
|
|
185
|
-
/** Type of the axis value. Should not use non-key types like float or double. */
|
|
198
|
+
export type AxisSpec = {
|
|
199
|
+
/** Type of the axis value. Should not use non-key types like float or double. */
|
|
200
|
+
readonly type: AxisValueType;
|
|
201
|
+
/** Name of the axis */
|
|
186
202
|
readonly name: string;
|
|
187
203
|
/** Adds auxiliary information to the axis name, type and parents to form a
|
|
188
204
|
* unique identifier */
|
|
@@ -214,36 +230,36 @@ type AxisSpec = {
|
|
|
214
230
|
readonly parentAxes?: number[];
|
|
215
231
|
};
|
|
216
232
|
/** Parents are specs, not indexes; normalized axis can be used considering its parents independently from column */
|
|
217
|
-
interface AxisSpecNormalized extends Omit<AxisSpec, "parentAxes"> {
|
|
233
|
+
export interface AxisSpecNormalized extends Omit<AxisSpec, "parentAxes"> {
|
|
218
234
|
parentAxesSpec: AxisSpecNormalized[];
|
|
219
235
|
}
|
|
220
236
|
/** Tree: axis is a root, its parents are children */
|
|
221
|
-
type AxisTree = {
|
|
237
|
+
export type AxisTree = {
|
|
222
238
|
axis: AxisSpecNormalized;
|
|
223
239
|
children: AxisTree[];
|
|
224
240
|
};
|
|
225
241
|
/** Build tree by axis parents annotations */
|
|
226
|
-
declare function getAxesTree(rootAxis: AxisSpecNormalized): AxisTree;
|
|
242
|
+
export declare function getAxesTree(rootAxis: AxisSpecNormalized): AxisTree;
|
|
227
243
|
/** Get set of canonicalized axisIds from axisTree */
|
|
228
|
-
declare function getSetFromAxisTree(tree: AxisTree): Set<CanonicalizedJson<AxisId>>;
|
|
244
|
+
export declare function getSetFromAxisTree(tree: AxisTree): Set<CanonicalizedJson<AxisId>>;
|
|
229
245
|
/** Get array of axisSpecs from axisTree */
|
|
230
|
-
declare function getArrayFromAxisTree(tree: AxisTree): AxisSpecNormalized[];
|
|
231
|
-
declare function canonicalizeAxisWithParents(axis: AxisSpecNormalized): string & {
|
|
246
|
+
export declare function getArrayFromAxisTree(tree: AxisTree): AxisSpecNormalized[];
|
|
247
|
+
export declare function canonicalizeAxisWithParents(axis: AxisSpecNormalized): string & {
|
|
232
248
|
__json_canonicalized: AxisId[];
|
|
233
249
|
};
|
|
234
250
|
/** Create list of normalized axisSpec (parents are in array of specs, not indexes) */
|
|
235
|
-
declare function getNormalizedAxesList(axes: AxisSpec[]): AxisSpecNormalized[];
|
|
251
|
+
export declare function getNormalizedAxesList(axes: AxisSpec[]): AxisSpecNormalized[];
|
|
236
252
|
/** Create list of regular axisSpec from normalized (parents are indexes, inside of current axes list) */
|
|
237
|
-
declare function getDenormalizedAxesList(axesSpec: AxisSpecNormalized[]): AxisSpec[];
|
|
253
|
+
export declare function getDenormalizedAxesList(axesSpec: AxisSpecNormalized[]): AxisSpec[];
|
|
238
254
|
/**
|
|
239
255
|
* Resolve annotation-based parents (`pl7.app/parents`) to numeric `parentAxes`
|
|
240
256
|
* on a column spec. Returns the spec unchanged if all axes already use numeric
|
|
241
257
|
* indices or have no parent annotations.
|
|
242
258
|
*/
|
|
243
|
-
declare function resolveAnnotationParents(spec: PColumnSpec): PColumnSpec;
|
|
259
|
+
export declare function resolveAnnotationParents(spec: PColumnSpec): PColumnSpec;
|
|
244
260
|
/** Common type representing spec for all the axes in a column */
|
|
245
|
-
type AxesSpec = AxisSpec[];
|
|
246
|
-
declare const PColumnName: {
|
|
261
|
+
export type AxesSpec = AxisSpec[];
|
|
262
|
+
export declare const PColumnName: {
|
|
247
263
|
readonly Label: "pl7.app/label";
|
|
248
264
|
readonly Table: {
|
|
249
265
|
readonly RowSelection: "pl7.app/table/row-selection";
|
|
@@ -254,7 +270,7 @@ declare const PColumnName: {
|
|
|
254
270
|
readonly Sequence: "pl7.app/vdj/sequence";
|
|
255
271
|
};
|
|
256
272
|
};
|
|
257
|
-
declare const PAxisName: {
|
|
273
|
+
export declare const PAxisName: {
|
|
258
274
|
readonly SampleId: "pl7.app/sampleId";
|
|
259
275
|
readonly VDJ: {
|
|
260
276
|
readonly Assay: {
|
|
@@ -265,7 +281,7 @@ declare const PAxisName: {
|
|
|
265
281
|
readonly ScClonotypeKey: "pl7.app/vdj/scClonotypeKey";
|
|
266
282
|
};
|
|
267
283
|
};
|
|
268
|
-
declare function isLabelColumn(column: PColumnSpec): boolean;
|
|
284
|
+
export declare function isLabelColumn(column: PColumnSpec): boolean;
|
|
269
285
|
/**
|
|
270
286
|
* Full column specification including all axes specs and specs of the column
|
|
271
287
|
* itself.
|
|
@@ -277,11 +293,13 @@ declare function isLabelColumn(column: PColumnSpec): boolean;
|
|
|
277
293
|
*
|
|
278
294
|
* Each element in tuple correspond to the axis having the same index in axesSpec.
|
|
279
295
|
*/
|
|
280
|
-
type PUniversalColumnSpec = PObjectSpec & {
|
|
296
|
+
export type PUniversalColumnSpec = PObjectSpec & {
|
|
281
297
|
/** Defines specific type of BObject, the most generic type of unit of
|
|
282
298
|
* information in Platforma Project. */
|
|
283
|
-
readonly kind: "PColumn";
|
|
284
|
-
|
|
299
|
+
readonly kind: "PColumn";
|
|
300
|
+
/** Type of column values */
|
|
301
|
+
readonly valueType: string;
|
|
302
|
+
/** Column name */
|
|
285
303
|
readonly name: string;
|
|
286
304
|
/** Adds auxiliary information to the axis name, type and parents to form a
|
|
287
305
|
* unique identifier */
|
|
@@ -291,8 +309,10 @@ type PUniversalColumnSpec = PObjectSpec & {
|
|
|
291
309
|
readonly contextDomain?: Record<string, string>;
|
|
292
310
|
/** Any additional information attached to the column that does not affect its
|
|
293
311
|
* identifier */
|
|
294
|
-
readonly annotations?: Record<string, string>;
|
|
295
|
-
|
|
312
|
+
readonly annotations?: Record<string, string>;
|
|
313
|
+
/** A list of zero-based indices of parent axes from the {@link axesSpec} array. */
|
|
314
|
+
readonly parentAxes?: number[];
|
|
315
|
+
/** Axes specifications */
|
|
296
316
|
readonly axesSpec: AxesSpec;
|
|
297
317
|
};
|
|
298
318
|
/**
|
|
@@ -303,42 +323,47 @@ type PUniversalColumnSpec = PObjectSpec & {
|
|
|
303
323
|
* values like files or other abstract data types. Data columns are optimized for storing and processing
|
|
304
324
|
* basic tabular data.
|
|
305
325
|
*/
|
|
306
|
-
type PDataColumnSpec = PUniversalColumnSpec & {
|
|
307
|
-
/** Type of column values */
|
|
326
|
+
export type PDataColumnSpec = PUniversalColumnSpec & {
|
|
327
|
+
/** Type of column values */
|
|
328
|
+
readonly valueType: ValueType;
|
|
308
329
|
};
|
|
309
|
-
type PColumnSpec = PDataColumnSpec;
|
|
330
|
+
export type PColumnSpec = PDataColumnSpec;
|
|
310
331
|
/** Unique PColumnSpec identifier */
|
|
311
|
-
type PColumnSpecId = {
|
|
332
|
+
export type PColumnSpecId = {
|
|
312
333
|
/** Defines specific type of BObject, the most generic type of unit of
|
|
313
334
|
* information in Platforma Project. */
|
|
314
|
-
readonly kind: "PColumn";
|
|
315
|
-
|
|
335
|
+
readonly kind: "PColumn";
|
|
336
|
+
/** Type of column values */
|
|
337
|
+
readonly valueType: ValueType;
|
|
338
|
+
/** Column name */
|
|
316
339
|
readonly name: string;
|
|
317
340
|
/** Adds auxiliary information to the axis name, type and parents to form a
|
|
318
341
|
* unique identifier */
|
|
319
342
|
readonly domain?: Record<string, string>;
|
|
320
343
|
/** Context domain provides additional column identity that is matched
|
|
321
344
|
* by kinship rules (subset/superset/overlap) rather than exact equality */
|
|
322
|
-
readonly contextDomain?: Record<string, string>;
|
|
323
|
-
|
|
345
|
+
readonly contextDomain?: Record<string, string>;
|
|
346
|
+
/** A list of zero-based indices of parent axes from the {@link axesSpec} array. */
|
|
347
|
+
readonly parentAxes?: number[];
|
|
348
|
+
/** Axes id */
|
|
324
349
|
readonly axesId: AxesId;
|
|
325
350
|
};
|
|
326
|
-
declare function getPColumnSpecId(spec: PColumnSpec): PColumnSpecId;
|
|
327
|
-
interface PColumn<Data> extends PObject<Data> {
|
|
351
|
+
export declare function getPColumnSpecId(spec: PColumnSpec): PColumnSpecId;
|
|
352
|
+
export interface PColumn<Data> extends PObject<Data> {
|
|
328
353
|
/** PColumn spec, allowing it to be found among other PObjects */
|
|
329
354
|
readonly spec: PColumnSpec;
|
|
330
355
|
}
|
|
331
356
|
/** Columns in a PFrame also have internal identifier, this object represents
|
|
332
357
|
* combination of specs and such id */
|
|
333
|
-
interface PColumnIdAndSpec {
|
|
358
|
+
export interface PColumnIdAndSpec {
|
|
334
359
|
/** Internal column id within the PFrame */
|
|
335
360
|
readonly columnId: PObjectId;
|
|
336
361
|
/** Column spec */
|
|
337
362
|
readonly spec: PColumnSpec;
|
|
338
363
|
}
|
|
339
364
|
/** Get column id and spec from a column */
|
|
340
|
-
declare function getColumnIdAndSpec<Data>(column: PColumn<Data>): PColumnIdAndSpec;
|
|
341
|
-
interface AxisId {
|
|
365
|
+
export declare function getColumnIdAndSpec<Data>(column: PColumn<Data>): PColumnIdAndSpec;
|
|
366
|
+
export interface AxisId {
|
|
342
367
|
/** Type of the axis or column value. For an axis should not use non-key
|
|
343
368
|
* types like float or double. */
|
|
344
369
|
readonly type: AxisValueType;
|
|
@@ -352,17 +377,16 @@ interface AxisId {
|
|
|
352
377
|
readonly contextDomain?: Record<string, string>;
|
|
353
378
|
}
|
|
354
379
|
/** Array of axis ids */
|
|
355
|
-
type AxesId = AxisId[];
|
|
380
|
+
export type AxesId = AxisId[];
|
|
356
381
|
/** Extracts axis ids from axis spec */
|
|
357
|
-
declare function getAxisId(spec: AxisSpec): AxisId;
|
|
382
|
+
export declare function getAxisId(spec: AxisSpec): AxisId;
|
|
358
383
|
/** Extracts axes ids from axes spec array from column spec */
|
|
359
|
-
declare function getAxesId(spec: AxesSpec): AxesId;
|
|
384
|
+
export declare function getAxesId(spec: AxesSpec): AxesId;
|
|
360
385
|
/** Canonicalizes axis id */
|
|
361
|
-
declare function canonicalizeAxisId(id: AxisId): CanonicalizedJson<AxisId>;
|
|
386
|
+
export declare function canonicalizeAxisId(id: AxisId): CanonicalizedJson<AxisId>;
|
|
362
387
|
/** Returns whether "match" axis id is compatible with the "query" */
|
|
363
|
-
declare function matchAxisId(query: AxisId, target: AxisId): boolean;
|
|
364
|
-
declare function getTypeFromPColumnOrAxisSpec(spec: PColumnSpec | AxisSpec): ValueType;
|
|
365
|
-
declare function isAxisId(id: unknown): id is AxisId;
|
|
388
|
+
export declare function matchAxisId(query: AxisId, target: AxisId): boolean;
|
|
389
|
+
export declare function getTypeFromPColumnOrAxisSpec(spec: PColumnSpec | AxisSpec): ValueType;
|
|
390
|
+
export declare function isAxisId(id: unknown): id is AxisId;
|
|
366
391
|
//#endregion
|
|
367
|
-
export { Annotation, AnnotationDataStatus, AnnotationJson, AxesId, AxesSpec, AxisId, AxisSpec, AxisSpecNormalized, AxisTree, AxisValueType, ColumnValueType, Domain, DomainJson, Metadata, MetadataJson, PAxisName, PColumn, PColumnIdAndSpec, PColumnName, PColumnSpec, PColumnSpecId, PDataColumnSpec, PUniversalColumnSpec, Trace, TraceEntry, ValueType, canonicalizeAxisId, canonicalizeAxisWithParents, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getNormalizedAxesList, getPColumnSpecId, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, isAxisId, isLabelColumn, isLinkerColumn, matchAxisId, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow, resolveAnnotationParents };
|
|
368
392
|
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../../../src/drivers/pframe/spec/spec.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../../../src/drivers/pframe/spec/spec.ts"],"mappings":";;;;;qBAKa;WACX;WACA;WAC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
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Domain keys whose value is the id of a block, rather than a qualifier of the data.
|
|
44
|
+
*
|
|
45
|
+
* Applying a template repoints these at the blocks of the project being built: an axis a block
|
|
46
|
+
* produced names that block in its domain, so an axis left naming the exported-from project
|
|
47
|
+
* resolves to nothing. Listing the keys is what makes that safe — a template's entry ids are
|
|
48
|
+
* arbitrary non-empty strings, so a hand-written template may name an entry `closest`, and a
|
|
49
|
+
* qualifier that happens to read `closest` must not be mistaken for a reference to it.
|
|
50
|
+
*
|
|
51
|
+
* A key absent from here is simply left alone, which is the behaviour from before relocation
|
|
52
|
+
* reached domains at all. Adding one is therefore safe; omitting one costs only that a template
|
|
53
|
+
* carrying it applies still pointing at the project it came from.
|
|
54
|
+
*/
|
|
55
|
+
const BlockScopedDomain = /* @__PURE__ */ new Set([
|
|
56
|
+
"pl7.app/blockId",
|
|
57
|
+
"pl7.app/block",
|
|
58
|
+
"pl7.app/redefined-by",
|
|
59
|
+
"pl7.app/annotationRunId",
|
|
60
|
+
"pl7.app/clonotypeAnnotationRunId",
|
|
61
|
+
"pl7.app/clustering/blockId",
|
|
62
|
+
"pl7.app/umap/blockId",
|
|
63
|
+
"pl7.app/peptide/extractionRunId",
|
|
64
|
+
"pl7.app/repertoire/extractionRunId",
|
|
65
|
+
"pl7.app/antibodyVariantDesigner/designRunId",
|
|
66
|
+
"pl7.app/vdj/clonotypingRunId",
|
|
67
|
+
"pl7.app/vdj/clustering/blockId",
|
|
68
|
+
"pl7.app/vdj/integration/blockId",
|
|
69
|
+
"pl7.app/vdj/spatiotemporalAnalysis/blockId",
|
|
70
|
+
"pl7.app/vdj/libraryId"
|
|
71
|
+
]);
|
|
42
72
|
const DomainJson = {};
|
|
43
73
|
function readDomain(spec, key) {
|
|
44
74
|
return readMetadata(spec?.domain, key);
|
|
@@ -388,6 +418,6 @@ function isAxisId(id) {
|
|
|
388
418
|
return typeof id === "object" && id !== null && "name" in id && "type" in id;
|
|
389
419
|
}
|
|
390
420
|
//#endregion
|
|
391
|
-
export { Annotation, AnnotationJson, Domain, DomainJson, PAxisName, PColumnName, ValueType, canonicalizeAxisId, canonicalizeAxisWithParents, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getNormalizedAxesList, getPColumnSpecId, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, isAxisId, isLabelColumn, isLinkerColumn, matchAxisId, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow, resolveAnnotationParents };
|
|
421
|
+
export { Annotation, AnnotationJson, BlockScopedDomain, Domain, DomainJson, PAxisName, PColumnName, ValueType, canonicalizeAxisId, canonicalizeAxisWithParents, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getNormalizedAxesList, getPColumnSpecId, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, isAxisId, isLabelColumn, isLinkerColumn, matchAxisId, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow, resolveAnnotationParents };
|
|
392
422
|
|
|
393
423
|
//# sourceMappingURL=spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.js","names":[],"sources":["../../../../src/drivers/pframe/spec/spec.ts"],"sourcesContent":["import { ensureError } from \"../../../errors\";\nimport { canonicalizeJson, type CanonicalizedJson, type StringifiedJson } from \"../../../json\";\nimport type { PObject, PObjectId, PObjectSpec } from \"../../../pool\";\nimport { z } from \"zod\";\n\nexport const ValueType = {\n Int: \"Int\",\n Long: \"Long\",\n Float: \"Float\",\n Double: \"Double\",\n String: \"String\",\n Bytes: \"Bytes\",\n} as const;\n\nexport type AxisValueType = Extract<ValueType, \"Int\" | \"Long\" | \"String\">;\nexport type ColumnValueType = ValueType;\n\n/** PFrame columns and axes within them may store one of these types. */\nexport type ValueType = (typeof ValueType)[keyof typeof ValueType];\n\nexport type Metadata = Record<string, string>;\n\nexport function readMetadata<U extends Metadata, T extends keyof U = keyof U>(\n metadata: Metadata | undefined,\n key: T,\n): U[T] | undefined {\n return (metadata as U | undefined)?.[key];\n}\n\ntype MetadataJsonImpl<M> = {\n [P in keyof M as M[P] extends StringifiedJson ? P : never]: M[P] extends StringifiedJson<infer U>\n ? z.ZodType<U>\n : never;\n};\nexport type MetadataJson<M> = MetadataJsonImpl<Required<M>>;\n\nexport function readMetadataJsonOrThrow<M extends Metadata, T extends keyof MetadataJson<M>>(\n metadata: Metadata | undefined,\n metadataJson: MetadataJson<M>,\n key: T,\n methodNameInError: string = \"readMetadataJsonOrThrow\",\n): z.infer<MetadataJson<M>[T]> | undefined {\n const json = readMetadata<M, T>(metadata, key);\n if (json === undefined) return undefined;\n\n const schema = metadataJson[key];\n try {\n const value = JSON.parse(json);\n return schema.parse(value);\n } catch (error: unknown) {\n throw new Error(\n `${methodNameInError} failed, ` +\n `key: ${String(key)}, ` +\n `value: ${json}, ` +\n `error: ${ensureError(error)}`,\n );\n }\n}\n\nexport function readMetadataJson<M extends Metadata, T extends keyof MetadataJson<M>>(\n metadata: Metadata | undefined,\n metadataJson: MetadataJson<M>,\n key: T,\n): z.infer<MetadataJson<M>[T]> | undefined {\n try {\n return readMetadataJsonOrThrow(metadata, metadataJson, key);\n } catch {\n return undefined; // treat invalid values as unset\n }\n}\n\n/// Well-known domains\nexport const Domain = {\n Alphabet: \"pl7.app/alphabet\",\n BlockId: \"pl7.app/blockId\",\n VDJ: {\n Clustering: {\n BlockId: \"pl7.app/vdj/clustering/blockId\",\n },\n ScClonotypeChain: {\n Index: \"pl7.app/vdj/scClonotypeChain/index\",\n },\n },\n} as const;\n\nexport type Domain = Metadata &\n Partial<{\n [Domain.Alphabet]: \"nucleotide\" | \"aminoacid\" | (string & {});\n [Domain.BlockId]: string;\n [Domain.VDJ.ScClonotypeChain.Index]: \"primary\" | \"secondary\" | (string & {});\n }>;\n\nexport type DomainJson = MetadataJson<Domain>;\nexport const DomainJson: DomainJson = {};\n\n/// Helper function for reading plain domain values\nexport function readDomain<T extends keyof Domain>(\n spec: { domain?: Metadata | undefined } | undefined,\n key: T,\n): Domain[T] | undefined {\n return readMetadata<Domain, T>(spec?.domain, key);\n}\n\n/// Helper function for reading json-encoded domain values, throws on JSON parsing error\nexport function readDomainJsonOrThrow<T extends keyof DomainJson>(\n spec: { domain?: Metadata | undefined } | undefined,\n key: T,\n): z.infer<DomainJson[T]> | undefined {\n return readMetadataJsonOrThrow<Domain, T>(spec?.domain, DomainJson, key, \"readDomainJsonOrThrow\");\n}\n\n/// Helper function for reading json-encoded domain values, returns undefined on JSON parsing error\nexport function readDomainJson<T extends keyof DomainJson>(\n spec: { domain?: Metadata | undefined } | undefined,\n key: T,\n): z.infer<DomainJson[T]> | undefined {\n return readMetadataJson<Domain, T>(spec?.domain, DomainJson, key);\n}\n\n/// Well-known annotations\nexport const Annotation = {\n AxisNature: \"pl7.app/axisNature\",\n Alphabet: \"pl7.app/alphabet\",\n Description: \"pl7.app/description\",\n DataStatus: \"pl7.app/dataStatus\",\n DiscreteValues: \"pl7.app/discreteValues\",\n Format: \"pl7.app/format\",\n Graph: {\n Axis: {\n HighCardinality: \"pl7.app/graph/axis/highCardinality\",\n LowerLimit: \"pl7.app/graph/axis/lowerLimit\",\n SymmetricRange: \"pl7.app/graph/axis/symmetricRange\",\n UpperLimit: \"pl7.app/graph/axis/upperLimit\",\n },\n IsDenseAxis: \"pl7.app/graph/isDenseAxis\",\n IsVirtual: \"pl7.app/graph/isVirtual\",\n Palette: \"pl7.app/graph/palette\",\n Thresholds: \"pl7.app/graph/thresholds\",\n TreatAbsentValuesAs: \"pl7.app/graph/treatAbsentValuesAs\",\n },\n HideDataFromUi: \"pl7.app/hideDataFromUi\",\n HideDataFromGraphs: \"pl7.app/hideDataFromGraphs\",\n IsDiscreteFilter: \"pl7.app/isDiscreteFilter\",\n IsAnchor: \"pl7.app/isAnchor\",\n IsLinkerColumn: \"pl7.app/isLinkerColumn\",\n IsScore: \"pl7.app/isScore\",\n IsSubset: \"pl7.app/isSubset\",\n Label: \"pl7.app/label\",\n LinkLabel: \"pl7.app/linkLabel\",\n Max: \"pl7.app/max\",\n Min: \"pl7.app/min\",\n MultipliesBy: \"pl7.app/multipliesBy\",\n Parents: \"pl7.app/parents\",\n Score: {\n DefaultCutoff: \"pl7.app/score/defaultCutoff\",\n RankingOrder: \"pl7.app/score/rankingOrder\",\n },\n Sequence: {\n Annotation: {\n Mapping: \"pl7.app/sequence/annotation/mapping\",\n },\n IsAnnotation: \"pl7.app/sequence/isAnnotation\",\n },\n Table: {\n FontFamily: \"pl7.app/table/fontFamily\",\n OrderPriority: \"pl7.app/table/orderPriority\",\n Visibility: \"pl7.app/table/visibility\",\n Info: \"pl7.app/table/info\",\n },\n Trace: \"pl7.app/trace\",\n VDJ: {\n IsAssemblingFeature: \"pl7.app/vdj/isAssemblingFeature\",\n IsMainSequence: \"pl7.app/vdj/isMainSequence\",\n },\n} as const;\n\nexport type AnnotationDataStatus =\n | \"missing\"\n | \"resolving\"\n | \"absent\"\n | \"computing\"\n | \"ready\"\n | \"error\";\n\nexport type Annotation = Metadata &\n Partial<{\n [Annotation.Alphabet]: \"nucleotide\" | \"aminoacid\" | (string & {});\n [Annotation.AxisNature]: \"homogeneous\" | \"heterogeneous\" | \"scaleCompatible\" | (string & {});\n [Annotation.Description]: string;\n [Annotation.DataStatus]: AnnotationDataStatus;\n [Annotation.DiscreteValues]: StringifiedJson<number[]> | StringifiedJson<string[]>;\n [Annotation.Format]: string;\n [Annotation.Graph.Axis.HighCardinality]: StringifiedJson<boolean>;\n [Annotation.Graph.Axis.LowerLimit]: StringifiedJson<number>;\n [Annotation.Graph.Axis.SymmetricRange]: StringifiedJson<boolean>;\n [Annotation.Graph.Axis.UpperLimit]: StringifiedJson<number>;\n [Annotation.Graph.IsDenseAxis]: StringifiedJson<boolean>;\n [Annotation.Graph.IsVirtual]: StringifiedJson<boolean>;\n [Annotation.Graph.Palette]: StringifiedJson<{ mapping: Record<string, number>; name: string }>;\n [Annotation.Graph.Thresholds]: StringifiedJson<\n { columnId: { valueType: ValueType; name: string }; value: number }[]\n >;\n [Annotation.Graph.TreatAbsentValuesAs]: StringifiedJson<number>;\n [Annotation.HideDataFromGraphs]: StringifiedJson<boolean>;\n [Annotation.HideDataFromUi]: StringifiedJson<boolean>;\n [Annotation.IsDiscreteFilter]: StringifiedJson<boolean>;\n [Annotation.IsLinkerColumn]: StringifiedJson<boolean>;\n [Annotation.IsSubset]: StringifiedJson<boolean>;\n [Annotation.Label]: string;\n [Annotation.Max]: StringifiedJson<number>;\n [Annotation.Min]: StringifiedJson<number>;\n [Annotation.MultipliesBy]: StringifiedJson<AxisSpec[\"name\"][]>;\n [Annotation.Parents]: StringifiedJson<AxisSpec[\"name\"][]>;\n [Annotation.Sequence.Annotation.Mapping]: StringifiedJson<Record<string, string>>;\n [Annotation.Sequence.IsAnnotation]: StringifiedJson<boolean>;\n [Annotation.Table.FontFamily]: string;\n [Annotation.Table.OrderPriority]: StringifiedJson<number>;\n [Annotation.Table.Visibility]: \"hidden\" | \"optional\" | (string & {});\n [Annotation.Table.Info]: string;\n [Annotation.Trace]: StringifiedJson<Trace>;\n [Annotation.VDJ.IsAssemblingFeature]: StringifiedJson<boolean>;\n }>;\n\n/// One step in a column's derivation lineage. Only `type` and `label` are part\n/// of the typed public surface; writers may add fields (e.g. `id`, `importance`)\n/// passed through opaquely as `unknown`, accessed via explicit narrowing.\nconst TraceEntrySchema = z\n .object({\n type: z.string(),\n label: z.string(),\n })\n .catchall(z.unknown());\n\nexport type TraceEntry = z.infer<typeof TraceEntrySchema>;\n\nexport type Trace = TraceEntry[];\n\n// export const AxisSpec = z.object({\n// type: z.nativeEnum(ValueType),\n// name: z.string(),\n// domain: z.record(z.string(), z.string()).optional(),\n// annotations: z.record(z.string(), z.string()).optional(),\n// parentAxes: z.array(z.number()).optional(),\n// }).passthrough();\n//\n// type Expect<T extends true> = T;\n// type Equal<X, Y> =\n// (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;\n//\n// type _test = Expect<Equal<\n// Readonly<z.infer<typeof AxisSpec>>,\n// Readonly<AxisSpec & Record<string, unknown>>\n// >>;\n\nexport type AnnotationJson = MetadataJson<Annotation>;\n\nconst ValueTypeSchema = z.enum([\"Int\", \"Long\", \"Float\", \"Double\", \"String\"] as const);\nexport const AnnotationJson: AnnotationJson = {\n [Annotation.DiscreteValues]: z.array(z.string()).or(z.array(z.number())),\n [Annotation.Graph.Axis.HighCardinality]: z.boolean(),\n [Annotation.Graph.Axis.LowerLimit]: z.number(),\n [Annotation.Graph.Axis.UpperLimit]: z.number(),\n [Annotation.Graph.Axis.SymmetricRange]: z.boolean(),\n [Annotation.Graph.IsDenseAxis]: z.boolean(),\n [Annotation.Graph.Palette]: z.object({ mapping: z.record(z.number()), name: z.string() }),\n [Annotation.Graph.Thresholds]: z.array(\n z.object({\n columnId: z.object({ valueType: ValueTypeSchema, name: z.string() }),\n value: z.number(),\n }),\n ),\n [Annotation.Graph.TreatAbsentValuesAs]: z.number(),\n [Annotation.Graph.IsVirtual]: z.boolean(),\n [Annotation.HideDataFromUi]: z.boolean(),\n [Annotation.HideDataFromGraphs]: z.boolean(),\n [Annotation.IsDiscreteFilter]: z.boolean(),\n [Annotation.IsLinkerColumn]: z.boolean(),\n [Annotation.IsSubset]: z.boolean(),\n [Annotation.Max]: z.number(),\n [Annotation.Min]: z.number(),\n [Annotation.MultipliesBy]: z.array(z.string()),\n [Annotation.Parents]: z.array(z.string()),\n [Annotation.Sequence.Annotation.Mapping]: z.record(z.string(), z.string()),\n [Annotation.Sequence.IsAnnotation]: z.boolean(),\n [Annotation.Table.OrderPriority]: z.number(),\n [Annotation.Trace]: z.array(TraceEntrySchema),\n [Annotation.VDJ.IsAssemblingFeature]: z.boolean(),\n};\n\n/// Helper function for reading plain annotation values\nexport function readAnnotation<T extends keyof Annotation>(\n spec: { annotations?: Metadata | undefined } | undefined,\n key: T,\n): Annotation[T] | undefined {\n return readMetadata<Annotation, T>(spec?.annotations, key);\n}\n\n/// Helper function for reading json-encoded annotation values, throws on JSON parsing error\nexport function readAnnotationJsonOrThrow<T extends keyof AnnotationJson>(\n spec: { annotations?: Metadata | undefined } | undefined,\n key: T,\n): z.infer<AnnotationJson[T]> | undefined {\n return readMetadataJsonOrThrow<Annotation, T>(\n spec?.annotations,\n AnnotationJson,\n key,\n \"readAnnotationJsonOrThrow\",\n );\n}\n\n/// Helper function for reading json-encoded annotation values, returns undefined on JSON parsing error\nexport function readAnnotationJson<T extends keyof AnnotationJson>(\n spec: { annotations?: Metadata | undefined } | undefined,\n key: T,\n): z.infer<AnnotationJson[T]> | undefined {\n return readMetadataJson<Annotation, T>(spec?.annotations, AnnotationJson, key);\n}\n\nexport function isLinkerColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.IsLinkerColumn);\n}\n\n/**\n * Specification of an individual axis.\n *\n * Each axis is a part of a composite key that addresses data inside the PColumn.\n *\n * Each record inside a PColumn is addressed by a unique tuple of values set for\n * all the axes specified in the column spec.\n */\nexport type AxisSpec = {\n /** Type of the axis value. Should not use non-key types like float or double. */\n readonly type: AxisValueType;\n\n /** Name of the axis */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Context domain provides additional axis identity that is matched\n * by kinship rules (subset/superset/overlap) rather than exact equality */\n readonly contextDomain?: Record<string, string>;\n\n /** Any additional information attached to the axis that does not affect its\n * identifier */\n readonly annotations?: Record<string, string>;\n\n /**\n * Parent axes provide contextual grouping for the axis in question, establishing\n * a hierarchy where the current axis is dependent on one or more axes for its\n * full definition and meaning. For instance, in a data structure where each\n * \"container\" axis may contain multiple \"item\" axes, the `item` axis would\n * list the index of the `container` axis in this field to denote its dependency.\n *\n * This means that the identity or significance of the `item` axis is only\n * interpretable when combined with its parent `container` axis. An `item` axis\n * index by itself may be non-unique and only gains uniqueness within the context\n * of its parent `container`. Therefore, the `parentAxes` field is essential for\n * mapping these relationships and ensuring data coherence across nested or\n * multi-level data models.\n *\n * A list of zero-based indices of parent axes in the overall axes specification\n * from the column spec. Each index corresponds to the position of a parent axis\n * in the list that defines the structure of the data model.\n */\n readonly parentAxes?: number[];\n};\n\n/** Parents are specs, not indexes; normalized axis can be used considering its parents independently from column */\nexport interface AxisSpecNormalized extends Omit<AxisSpec, \"parentAxes\"> {\n parentAxesSpec: AxisSpecNormalized[];\n}\n\n/** Tree: axis is a root, its parents are children */\nexport type AxisTree = {\n axis: AxisSpecNormalized;\n children: AxisTree[]; // parents\n};\n\nfunction makeAxisTree(axis: AxisSpecNormalized): AxisTree {\n return { axis, children: [] };\n}\n\n/** Build tree by axis parents annotations */\nexport function getAxesTree(rootAxis: AxisSpecNormalized): AxisTree {\n const root = makeAxisTree(rootAxis);\n let nodesQ = [root];\n while (nodesQ.length) {\n const nextNodes: AxisTree[] = [];\n for (const node of nodesQ) {\n node.children = node.axis.parentAxesSpec.map(makeAxisTree);\n nextNodes.push(...node.children);\n }\n nodesQ = nextNodes;\n }\n return root;\n}\n\n/** Get set of canonicalized axisIds from axisTree */\nexport function getSetFromAxisTree(tree: AxisTree): Set<CanonicalizedJson<AxisId>> {\n const set = new Set([canonicalizeJson(getAxisId(tree.axis))]);\n let nodesQ = [tree];\n while (nodesQ.length) {\n const nextNodes = [];\n for (const node of nodesQ) {\n for (const parent of node.children) {\n set.add(canonicalizeJson(getAxisId(parent.axis)));\n nextNodes.push(parent);\n }\n }\n nodesQ = nextNodes;\n }\n return set;\n}\n\n/** Get array of axisSpecs from axisTree */\nexport function getArrayFromAxisTree(tree: AxisTree): AxisSpecNormalized[] {\n const res = [tree.axis];\n let nodesQ = [tree];\n while (nodesQ.length) {\n const nextNodes = [];\n for (const node of nodesQ) {\n for (const parent of node.children) {\n res.push(parent.axis);\n nextNodes.push(parent);\n }\n }\n nodesQ = nextNodes;\n }\n return res;\n}\n\nexport function canonicalizeAxisWithParents(axis: AxisSpecNormalized) {\n return canonicalizeJson(getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));\n}\n\nfunction normalizingAxesComparator(\n axis1: AxisSpecNormalized,\n axis2: AxisSpecNormalized,\n): 1 | -1 | 0 {\n if (axis1.name !== axis2.name) {\n return axis1.name < axis2.name ? 1 : -1;\n }\n if (axis1.type !== axis2.type) {\n return axis1.type < axis2.type ? 1 : -1;\n }\n const domain1 = canonicalizeJson(axis1.domain ?? {});\n const domain2 = canonicalizeJson(axis2.domain ?? {});\n if (domain1 !== domain2) {\n return domain1 < domain2 ? 1 : -1;\n }\n\n const contextDomain1 = canonicalizeJson(axis1.contextDomain ?? {});\n const contextDomain2 = canonicalizeJson(axis2.contextDomain ?? {});\n if (contextDomain1 !== contextDomain2) {\n return contextDomain1 < contextDomain2 ? 1 : -1;\n }\n\n const parents1 = canonicalizeAxisWithParents(axis1);\n const parents2 = canonicalizeAxisWithParents(axis2);\n\n if (parents1 !== parents2) {\n return parents1 < parents2 ? 1 : -1;\n }\n\n const annotation1 = canonicalizeJson(axis1.annotations ?? {});\n const annotation2 = canonicalizeJson(axis2.annotations ?? {});\n if (annotation1 !== annotation2) {\n return annotation1 < annotation2 ? 1 : -1;\n }\n return 0;\n}\n\nfunction parseParentsFromAnnotations(axis: AxisSpec) {\n const parentsList = readAnnotationJson(axis, Annotation.Parents);\n if (parentsList === undefined) {\n return [];\n }\n return parentsList;\n}\n\nfunction sortParentsDeep(axisSpec: AxisSpecNormalized) {\n axisSpec.parentAxesSpec.forEach(sortParentsDeep);\n axisSpec.parentAxesSpec.sort(normalizingAxesComparator);\n}\n\nfunction hasCycleOfParents(axisSpec: AxisSpecNormalized) {\n const root = makeAxisTree(axisSpec);\n let nodesQ = [root];\n const ancestors = new Set(canonicalizeJson(getAxisId(axisSpec)));\n while (nodesQ.length) {\n const nextNodes: AxisTree[] = [];\n const levelIds = new Set<CanonicalizedJson<AxisId>>();\n for (const node of nodesQ) {\n node.children = node.axis.parentAxesSpec.map(makeAxisTree);\n for (const child of node.children) {\n const childId = canonicalizeJson(getAxisId(child.axis));\n if (!levelIds.has(childId)) {\n nextNodes.push(child);\n levelIds.add(childId);\n if (ancestors.has(childId)) {\n return true;\n }\n ancestors.add(childId);\n }\n }\n }\n nodesQ = nextNodes;\n }\n return false;\n}\n\n/** Create list of normalized axisSpec (parents are in array of specs, not indexes) */\nexport function getNormalizedAxesList(axes: AxisSpec[]): AxisSpecNormalized[] {\n if (axes.length === 0) {\n return [];\n }\n const modifiedAxes: AxisSpecNormalized[] = axes.map((axis) => {\n const { parentAxes: _, ...copiedRest } = axis;\n return { ...copiedRest, annotations: { ...copiedRest.annotations }, parentAxesSpec: [] };\n });\n\n axes.forEach((axis, idx) => {\n const modifiedAxis = modifiedAxes[idx];\n if (axis.parentAxes) {\n // if we have parents by indexes then take from the list\n modifiedAxis.parentAxesSpec = axis.parentAxes.map((idx) => modifiedAxes[idx]);\n } else {\n // else try to parse from annotation name\n const parents = parseParentsFromAnnotations(axis).map((name) =>\n modifiedAxes.find((axis) => axis.name === name),\n );\n modifiedAxis.parentAxesSpec = parents.some((p) => p === undefined)\n ? []\n : (parents as AxisSpecNormalized[]);\n }\n });\n\n if (modifiedAxes.some(hasCycleOfParents)) {\n // Axes list is broken\n modifiedAxes.forEach((axis) => {\n axis.parentAxesSpec = [];\n });\n } else {\n modifiedAxes.forEach((axis) => {\n sortParentsDeep(axis);\n });\n }\n\n return modifiedAxes;\n}\n\n/** Create list of regular axisSpec from normalized (parents are indexes, inside of current axes list) */\nexport function getDenormalizedAxesList(axesSpec: AxisSpecNormalized[]): AxisSpec[] {\n const idsList = axesSpec.map(canonicalizeAxisId);\n return axesSpec.map((axisSpec) => {\n const parentsIds = axisSpec.parentAxesSpec.map(canonicalizeAxisId);\n const parentIdxs = parentsIds.map((id) => idsList.indexOf(id));\n const { parentAxesSpec: _, ...copiedRest } = axisSpec;\n if (parentIdxs.length) {\n return { ...copiedRest, parentAxes: parentIdxs } as AxisSpec;\n }\n return copiedRest;\n });\n}\n\n/**\n * Resolve annotation-based parents (`pl7.app/parents`) to numeric `parentAxes`\n * on a column spec. Returns the spec unchanged if all axes already use numeric\n * indices or have no parent annotations.\n */\nexport function resolveAnnotationParents(spec: PColumnSpec): PColumnSpec {\n const hasAnnotationParents = spec.axesSpec.some(\n (axis) => !!readAnnotationJson(axis, Annotation.Parents),\n );\n if (!hasAnnotationParents) return spec;\n\n const normalized = getNormalizedAxesList(spec.axesSpec);\n const denormalized = getDenormalizedAxesList(normalized);\n return { ...spec, axesSpec: denormalized };\n}\n\n/** Common type representing spec for all the axes in a column */\nexport type AxesSpec = AxisSpec[];\n\n/// Well-known column names\nexport const PColumnName = {\n Label: \"pl7.app/label\",\n Table: {\n RowSelection: \"pl7.app/table/row-selection\",\n },\n VDJ: {\n LeadSelection: \"pl7.app/vdj/lead-selection\",\n RankingOrder: \"pl7.app/vdj/ranking-order\",\n Sequence: \"pl7.app/vdj/sequence\",\n },\n} as const;\n\n/// Well-known axis names\nexport const PAxisName = {\n SampleId: \"pl7.app/sampleId\",\n VDJ: {\n Assay: {\n SequenceId: \"pl7.app/vdj/assay/sequenceId\",\n },\n ClusterId: \"pl7.app/vdj/clusterId\",\n ClonotypeKey: \"pl7.app/vdj/clonotypeKey\",\n ScClonotypeKey: \"pl7.app/vdj/scClonotypeKey\",\n },\n} as const;\n\nexport function isLabelColumn(column: PColumnSpec) {\n return column.axesSpec.length === 1 && column.name === PColumnName.Label;\n}\n\n/**\n * Full column specification including all axes specs and specs of the column\n * itself.\n *\n * A PColumn in its essence represents a mapping from a fixed size, explicitly\n * typed tuple to an explicitly typed value.\n *\n * (axis1Value1, axis2Value1, ...) -> columnValue\n *\n * Each element in tuple correspond to the axis having the same index in axesSpec.\n */\nexport type PUniversalColumnSpec = PObjectSpec & {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: \"PColumn\";\n\n /** Type of column values */\n readonly valueType: string;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Context domain provides additional column identity that is matched\n * by kinship rules (subset/superset/overlap) rather than exact equality */\n readonly contextDomain?: Record<string, string>;\n\n /** Any additional information attached to the column that does not affect its\n * identifier */\n readonly annotations?: Record<string, string>;\n\n /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */\n readonly parentAxes?: number[];\n\n /** Axes specifications */\n readonly axesSpec: AxesSpec;\n};\n\n/**\n * Specification of a data column.\n *\n * Data column is a specialized type of PColumn that stores only simple values (strings and numbers)\n * addressed by multiple keys. This is in contrast to other PColumn variants that can store more complex\n * values like files or other abstract data types. Data columns are optimized for storing and processing\n * basic tabular data.\n */\nexport type PDataColumnSpec = PUniversalColumnSpec & {\n /** Type of column values */\n readonly valueType: ValueType;\n};\n\n// @todo: change this to PUniversalColumnSpec\nexport type PColumnSpec = PDataColumnSpec;\n\n/** Unique PColumnSpec identifier */\nexport type PColumnSpecId = {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: \"PColumn\";\n\n /** Type of column values */\n readonly valueType: ValueType;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Context domain provides additional column identity that is matched\n * by kinship rules (subset/superset/overlap) rather than exact equality */\n readonly contextDomain?: Record<string, string>;\n\n /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */\n readonly parentAxes?: number[];\n\n /** Axes id */\n readonly axesId: AxesId;\n};\n\nexport function getPColumnSpecId(spec: PColumnSpec): PColumnSpecId {\n return {\n kind: spec.kind,\n valueType: spec.valueType,\n name: spec.name,\n domain: spec.domain,\n contextDomain: spec.contextDomain,\n parentAxes: spec.parentAxes,\n axesId: getAxesId(spec.axesSpec),\n };\n}\n\nexport interface PColumn<Data> extends PObject<Data> {\n /** PColumn spec, allowing it to be found among other PObjects */\n readonly spec: PColumnSpec;\n}\n\n/** Columns in a PFrame also have internal identifier, this object represents\n * combination of specs and such id */\nexport interface PColumnIdAndSpec {\n /** Internal column id within the PFrame */\n readonly columnId: PObjectId;\n\n /** Column spec */\n readonly spec: PColumnSpec;\n}\n\n/** Get column id and spec from a column */\nexport function getColumnIdAndSpec<Data>(column: PColumn<Data>): PColumnIdAndSpec {\n return {\n columnId: column.id,\n spec: column.spec,\n };\n}\n\nexport interface AxisId {\n /** Type of the axis or column value. For an axis should not use non-key\n * types like float or double. */\n readonly type: AxisValueType;\n\n /** Name of the axis or column */\n readonly name: string;\n\n /** Adds auxiliary information to the axis or column name and type to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Context domain provides additional axis identity that is matched\n * by kinship rules (subset/superset/overlap) rather than exact equality */\n readonly contextDomain?: Record<string, string>;\n}\n\n/** Array of axis ids */\nexport type AxesId = AxisId[];\n\n/** Extracts axis ids from axis spec */\nexport function getAxisId(spec: AxisSpec): AxisId {\n const { type, name, domain, contextDomain } = spec;\n const result: AxisId = { type, name };\n if (domain && Object.entries(domain).length > 0) {\n Object.assign(result, { domain });\n }\n if (contextDomain && Object.entries(contextDomain).length > 0) {\n Object.assign(result, { contextDomain });\n }\n return result;\n}\n\n/** Extracts axes ids from axes spec array from column spec */\nexport function getAxesId(spec: AxesSpec): AxesId {\n return spec.map(getAxisId);\n}\n\n/** Canonicalizes axis id */\nexport function canonicalizeAxisId(id: AxisId): CanonicalizedJson<AxisId> {\n return canonicalizeJson(getAxisId(id));\n}\n\n/** Returns true if all domains from query are found in target */\nfunction matchDomain(query?: Record<string, string>, target?: Record<string, string>) {\n if (query === undefined) return target === undefined;\n if (target === undefined) return true;\n for (const k in target) {\n if (query[k] !== target[k]) return false;\n }\n return true;\n}\n\n/** Returns whether \"match\" axis id is compatible with the \"query\" */\nexport function matchAxisId(query: AxisId, target: AxisId): boolean {\n return (\n query.name === target.name &&\n matchDomain(query.domain, target.domain) &&\n matchDomain(query.contextDomain, target.contextDomain)\n );\n}\n\nexport function getTypeFromPColumnOrAxisSpec(spec: PColumnSpec | AxisSpec): ValueType {\n return \"valueType\" in spec ? spec.valueType : spec.type;\n}\n\nexport function isAxisId(id: unknown): id is AxisId {\n return typeof id === \"object\" && id !== null && \"name\" in id && \"type\" in id;\n}\n"],"mappings":";;;;AAKA,MAAa,YAAY;CACvB,KAAK;CACL,MAAM;CACN,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,OAAO;AACT;AAUA,SAAgB,aACd,UACA,KACkB;CAClB,OAAQ,WAA6B;AACvC;AASA,SAAgB,wBACd,UACA,cACA,KACA,oBAA4B,2BACa;CACzC,MAAM,OAAO,aAAmB,UAAU,GAAG;CAC7C,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;CAE/B,MAAM,SAAS,aAAa;CAC5B,IAAI;EACF,MAAM,QAAQ,KAAK,MAAM,IAAI;EAC7B,OAAO,OAAO,MAAM,KAAK;CAC3B,SAAS,OAAgB;EACvB,MAAM,IAAI,MACR,GAAG,kBAAkB,gBACX,OAAO,GAAG,EAAE,WACV,KAAK,WACL,YAAY,KAAK,GAC/B;CACF;AACF;AAEA,SAAgB,iBACd,UACA,cACA,KACyC;CACzC,IAAI;EACF,OAAO,wBAAwB,UAAU,cAAc,GAAG;CAC5D,QAAQ;EACN;CACF;AACF;AAGA,MAAa,SAAS;CACpB,UAAU;CACV,SAAS;CACT,KAAK;EACH,YAAY,EACV,SAAS,iCACX;EACA,kBAAkB,EAChB,OAAO,qCACT;CACF;AACF;AAUA,MAAa,aAAyB,CAAC;AAGvC,SAAgB,WACd,MACA,KACuB;CACvB,OAAO,aAAwB,MAAM,QAAQ,GAAG;AAClD;AAGA,SAAgB,sBACd,MACA,KACoC;CACpC,OAAO,wBAAmC,MAAM,QAAQ,YAAY,KAAK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,OAAO,QAAQ,aAAa,CAAC,CAAC,SAAS,GAC1D,OAAO,OAAO,QAAQ,EAAE,cAAc,CAAC;CAEzC,OAAO;AACT;;AAGA,SAAgB,UAAU,MAAwB;CAChD,OAAO,KAAK,IAAI,SAAS;AAC3B;;AAGA,SAAgB,mBAAmB,IAAuC;CACxE,OAAO,iBAAiB,UAAU,EAAE,CAAC;AACvC;;AAGA,SAAS,YAAY,OAAgC,QAAiC;CACpF,IAAI,UAAU,KAAA,GAAW,OAAO,WAAW,KAAA;CAC3C,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,KAAK,MAAM,KAAK,QACd,IAAI,MAAM,OAAO,OAAO,IAAI,OAAO;CAErC,OAAO;AACT;;AAGA,SAAgB,YAAY,OAAe,QAAyB;CAClE,OACE,MAAM,SAAS,OAAO,QACtB,YAAY,MAAM,QAAQ,OAAO,MAAM,KACvC,YAAY,MAAM,eAAe,OAAO,aAAa;AAEzD;AAEA,SAAgB,6BAA6B,MAAyC;CACpF,OAAO,eAAe,OAAO,KAAK,YAAY,KAAK;AACrD;AAEA,SAAgB,SAAS,IAA2B;CAClD,OAAO,OAAO,OAAO,YAAY,OAAO,QAAQ,UAAU,MAAM,UAAU;AAC5E"}
|
|
1
|
+
{"version":3,"file":"spec.js","names":[],"sources":["../../../../src/drivers/pframe/spec/spec.ts"],"sourcesContent":["import { ensureError } from \"../../../errors\";\nimport { canonicalizeJson, type CanonicalizedJson, type StringifiedJson } from \"../../../json\";\nimport type { PObject, PObjectId, PObjectSpec } from \"../../../pool\";\nimport { z } from \"zod\";\n\nexport const ValueType = {\n Int: \"Int\",\n Long: \"Long\",\n Float: \"Float\",\n Double: \"Double\",\n String: \"String\",\n Bytes: \"Bytes\",\n} as const;\n\nexport type AxisValueType = Extract<ValueType, \"Int\" | \"Long\" | \"String\">;\nexport type ColumnValueType = ValueType;\n\n/** PFrame columns and axes within them may store one of these types. */\nexport type ValueType = (typeof ValueType)[keyof typeof ValueType];\n\nexport type Metadata = Record<string, string>;\n\nexport function readMetadata<U extends Metadata, T extends keyof U = keyof U>(\n metadata: Metadata | undefined,\n key: T,\n): U[T] | undefined {\n return (metadata as U | undefined)?.[key];\n}\n\ntype MetadataJsonImpl<M> = {\n [P in keyof M as M[P] extends StringifiedJson ? P : never]: M[P] extends StringifiedJson<infer U>\n ? z.ZodType<U>\n : never;\n};\nexport type MetadataJson<M> = MetadataJsonImpl<Required<M>>;\n\nexport function readMetadataJsonOrThrow<M extends Metadata, T extends keyof MetadataJson<M>>(\n metadata: Metadata | undefined,\n metadataJson: MetadataJson<M>,\n key: T,\n methodNameInError: string = \"readMetadataJsonOrThrow\",\n): z.infer<MetadataJson<M>[T]> | undefined {\n const json = readMetadata<M, T>(metadata, key);\n if (json === undefined) return undefined;\n\n const schema = metadataJson[key];\n try {\n const value = JSON.parse(json);\n return schema.parse(value);\n } catch (error: unknown) {\n throw new Error(\n `${methodNameInError} failed, ` +\n `key: ${String(key)}, ` +\n `value: ${json}, ` +\n `error: ${ensureError(error)}`,\n );\n }\n}\n\nexport function readMetadataJson<M extends Metadata, T extends keyof MetadataJson<M>>(\n metadata: Metadata | undefined,\n metadataJson: MetadataJson<M>,\n key: T,\n): z.infer<MetadataJson<M>[T]> | undefined {\n try {\n return readMetadataJsonOrThrow(metadata, metadataJson, key);\n } catch {\n return undefined; // treat invalid values as unset\n }\n}\n\n/// Well-known domains\nexport const Domain = {\n Alphabet: \"pl7.app/alphabet\",\n BlockId: \"pl7.app/blockId\",\n VDJ: {\n Clustering: {\n BlockId: \"pl7.app/vdj/clustering/blockId\",\n },\n ScClonotypeChain: {\n Index: \"pl7.app/vdj/scClonotypeChain/index\",\n },\n },\n} as const;\n\n/**\n * Domain keys whose value is the id of a block, rather than a qualifier of the data.\n *\n * Applying a template repoints these at the blocks of the project being built: an axis a block\n * produced names that block in its domain, so an axis left naming the exported-from project\n * resolves to nothing. Listing the keys is what makes that safe — a template's entry ids are\n * arbitrary non-empty strings, so a hand-written template may name an entry `closest`, and a\n * qualifier that happens to read `closest` must not be mistaken for a reference to it.\n *\n * A key absent from here is simply left alone, which is the behaviour from before relocation\n * reached domains at all. Adding one is therefore safe; omitting one costs only that a template\n * carrying it applies still pointing at the project it came from.\n */\nexport const BlockScopedDomain: ReadonlySet<string> = new Set<string>([\n \"pl7.app/blockId\",\n \"pl7.app/block\",\n \"pl7.app/redefined-by\",\n \"pl7.app/annotationRunId\",\n \"pl7.app/clonotypeAnnotationRunId\",\n \"pl7.app/clustering/blockId\",\n \"pl7.app/umap/blockId\",\n \"pl7.app/peptide/extractionRunId\",\n \"pl7.app/repertoire/extractionRunId\",\n \"pl7.app/antibodyVariantDesigner/designRunId\",\n \"pl7.app/vdj/clonotypingRunId\",\n \"pl7.app/vdj/clustering/blockId\",\n \"pl7.app/vdj/integration/blockId\",\n \"pl7.app/vdj/spatiotemporalAnalysis/blockId\",\n \"pl7.app/vdj/libraryId\",\n]);\n\nexport type Domain = Metadata &\n Partial<{\n [Domain.Alphabet]: \"nucleotide\" | \"aminoacid\" | (string & {});\n [Domain.BlockId]: string;\n [Domain.VDJ.ScClonotypeChain.Index]: \"primary\" | \"secondary\" | (string & {});\n }>;\n\nexport type DomainJson = MetadataJson<Domain>;\nexport const DomainJson: DomainJson = {};\n\n/// Helper function for reading plain domain values\nexport function readDomain<T extends keyof Domain>(\n spec: { domain?: Metadata | undefined } | undefined,\n key: T,\n): Domain[T] | undefined {\n return readMetadata<Domain, T>(spec?.domain, key);\n}\n\n/// Helper function for reading json-encoded domain values, throws on JSON parsing error\nexport function readDomainJsonOrThrow<T extends keyof DomainJson>(\n spec: { domain?: Metadata | undefined } | undefined,\n key: T,\n): z.infer<DomainJson[T]> | undefined {\n return readMetadataJsonOrThrow<Domain, T>(spec?.domain, DomainJson, key, \"readDomainJsonOrThrow\");\n}\n\n/// Helper function for reading json-encoded domain values, returns undefined on JSON parsing error\nexport function readDomainJson<T extends keyof DomainJson>(\n spec: { domain?: Metadata | undefined } | undefined,\n key: T,\n): z.infer<DomainJson[T]> | undefined {\n return readMetadataJson<Domain, T>(spec?.domain, DomainJson, key);\n}\n\n/// Well-known annotations\nexport const Annotation = {\n AxisNature: \"pl7.app/axisNature\",\n Alphabet: \"pl7.app/alphabet\",\n Description: \"pl7.app/description\",\n DataStatus: \"pl7.app/dataStatus\",\n DiscreteValues: \"pl7.app/discreteValues\",\n Format: \"pl7.app/format\",\n Graph: {\n Axis: {\n HighCardinality: \"pl7.app/graph/axis/highCardinality\",\n LowerLimit: \"pl7.app/graph/axis/lowerLimit\",\n SymmetricRange: \"pl7.app/graph/axis/symmetricRange\",\n UpperLimit: \"pl7.app/graph/axis/upperLimit\",\n },\n IsDenseAxis: \"pl7.app/graph/isDenseAxis\",\n IsVirtual: \"pl7.app/graph/isVirtual\",\n Palette: \"pl7.app/graph/palette\",\n Thresholds: \"pl7.app/graph/thresholds\",\n TreatAbsentValuesAs: \"pl7.app/graph/treatAbsentValuesAs\",\n },\n HideDataFromUi: \"pl7.app/hideDataFromUi\",\n HideDataFromGraphs: \"pl7.app/hideDataFromGraphs\",\n IsDiscreteFilter: \"pl7.app/isDiscreteFilter\",\n IsAnchor: \"pl7.app/isAnchor\",\n IsLinkerColumn: \"pl7.app/isLinkerColumn\",\n IsScore: \"pl7.app/isScore\",\n IsSubset: \"pl7.app/isSubset\",\n Label: \"pl7.app/label\",\n LinkLabel: \"pl7.app/linkLabel\",\n Max: \"pl7.app/max\",\n Min: \"pl7.app/min\",\n MultipliesBy: \"pl7.app/multipliesBy\",\n Parents: \"pl7.app/parents\",\n Score: {\n DefaultCutoff: \"pl7.app/score/defaultCutoff\",\n RankingOrder: \"pl7.app/score/rankingOrder\",\n },\n Sequence: {\n Annotation: {\n Mapping: \"pl7.app/sequence/annotation/mapping\",\n },\n IsAnnotation: \"pl7.app/sequence/isAnnotation\",\n },\n Table: {\n FontFamily: \"pl7.app/table/fontFamily\",\n OrderPriority: \"pl7.app/table/orderPriority\",\n Visibility: \"pl7.app/table/visibility\",\n Info: \"pl7.app/table/info\",\n },\n Trace: \"pl7.app/trace\",\n VDJ: {\n IsAssemblingFeature: \"pl7.app/vdj/isAssemblingFeature\",\n IsMainSequence: \"pl7.app/vdj/isMainSequence\",\n },\n} as const;\n\nexport type AnnotationDataStatus =\n | \"missing\"\n | \"resolving\"\n | \"absent\"\n | \"computing\"\n | \"ready\"\n | \"error\";\n\nexport type Annotation = Metadata &\n Partial<{\n [Annotation.Alphabet]: \"nucleotide\" | \"aminoacid\" | (string & {});\n [Annotation.AxisNature]: \"homogeneous\" | \"heterogeneous\" | \"scaleCompatible\" | (string & {});\n [Annotation.Description]: string;\n [Annotation.DataStatus]: AnnotationDataStatus;\n [Annotation.DiscreteValues]: StringifiedJson<number[]> | StringifiedJson<string[]>;\n [Annotation.Format]: string;\n [Annotation.Graph.Axis.HighCardinality]: StringifiedJson<boolean>;\n [Annotation.Graph.Axis.LowerLimit]: StringifiedJson<number>;\n [Annotation.Graph.Axis.SymmetricRange]: StringifiedJson<boolean>;\n [Annotation.Graph.Axis.UpperLimit]: StringifiedJson<number>;\n [Annotation.Graph.IsDenseAxis]: StringifiedJson<boolean>;\n [Annotation.Graph.IsVirtual]: StringifiedJson<boolean>;\n [Annotation.Graph.Palette]: StringifiedJson<{ mapping: Record<string, number>; name: string }>;\n [Annotation.Graph.Thresholds]: StringifiedJson<\n { columnId: { valueType: ValueType; name: string }; value: number }[]\n >;\n [Annotation.Graph.TreatAbsentValuesAs]: StringifiedJson<number>;\n [Annotation.HideDataFromGraphs]: StringifiedJson<boolean>;\n [Annotation.HideDataFromUi]: StringifiedJson<boolean>;\n [Annotation.IsDiscreteFilter]: StringifiedJson<boolean>;\n [Annotation.IsLinkerColumn]: StringifiedJson<boolean>;\n [Annotation.IsSubset]: StringifiedJson<boolean>;\n [Annotation.Label]: string;\n [Annotation.Max]: StringifiedJson<number>;\n [Annotation.Min]: StringifiedJson<number>;\n [Annotation.MultipliesBy]: StringifiedJson<AxisSpec[\"name\"][]>;\n [Annotation.Parents]: StringifiedJson<AxisSpec[\"name\"][]>;\n [Annotation.Sequence.Annotation.Mapping]: StringifiedJson<Record<string, string>>;\n [Annotation.Sequence.IsAnnotation]: StringifiedJson<boolean>;\n [Annotation.Table.FontFamily]: string;\n [Annotation.Table.OrderPriority]: StringifiedJson<number>;\n [Annotation.Table.Visibility]: \"hidden\" | \"optional\" | (string & {});\n [Annotation.Table.Info]: string;\n [Annotation.Trace]: StringifiedJson<Trace>;\n [Annotation.VDJ.IsAssemblingFeature]: StringifiedJson<boolean>;\n }>;\n\n/// One step in a column's derivation lineage. Only `type` and `label` are part\n/// of the typed public surface; writers may add fields (e.g. `id`, `importance`)\n/// passed through opaquely as `unknown`, accessed via explicit narrowing.\nconst TraceEntrySchema = z\n .object({\n type: z.string(),\n label: z.string(),\n })\n .catchall(z.unknown());\n\nexport type TraceEntry = z.infer<typeof TraceEntrySchema>;\n\nexport type Trace = TraceEntry[];\n\n// export const AxisSpec = z.object({\n// type: z.nativeEnum(ValueType),\n// name: z.string(),\n// domain: z.record(z.string(), z.string()).optional(),\n// annotations: z.record(z.string(), z.string()).optional(),\n// parentAxes: z.array(z.number()).optional(),\n// }).passthrough();\n//\n// type Expect<T extends true> = T;\n// type Equal<X, Y> =\n// (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;\n//\n// type _test = Expect<Equal<\n// Readonly<z.infer<typeof AxisSpec>>,\n// Readonly<AxisSpec & Record<string, unknown>>\n// >>;\n\nexport type AnnotationJson = MetadataJson<Annotation>;\n\nconst ValueTypeSchema = z.enum([\"Int\", \"Long\", \"Float\", \"Double\", \"String\"] as const);\nexport const AnnotationJson: AnnotationJson = {\n [Annotation.DiscreteValues]: z.array(z.string()).or(z.array(z.number())),\n [Annotation.Graph.Axis.HighCardinality]: z.boolean(),\n [Annotation.Graph.Axis.LowerLimit]: z.number(),\n [Annotation.Graph.Axis.UpperLimit]: z.number(),\n [Annotation.Graph.Axis.SymmetricRange]: z.boolean(),\n [Annotation.Graph.IsDenseAxis]: z.boolean(),\n [Annotation.Graph.Palette]: z.object({ mapping: z.record(z.number()), name: z.string() }),\n [Annotation.Graph.Thresholds]: z.array(\n z.object({\n columnId: z.object({ valueType: ValueTypeSchema, name: z.string() }),\n value: z.number(),\n }),\n ),\n [Annotation.Graph.TreatAbsentValuesAs]: z.number(),\n [Annotation.Graph.IsVirtual]: z.boolean(),\n [Annotation.HideDataFromUi]: z.boolean(),\n [Annotation.HideDataFromGraphs]: z.boolean(),\n [Annotation.IsDiscreteFilter]: z.boolean(),\n [Annotation.IsLinkerColumn]: z.boolean(),\n [Annotation.IsSubset]: z.boolean(),\n [Annotation.Max]: z.number(),\n [Annotation.Min]: z.number(),\n [Annotation.MultipliesBy]: z.array(z.string()),\n [Annotation.Parents]: z.array(z.string()),\n [Annotation.Sequence.Annotation.Mapping]: z.record(z.string(), z.string()),\n [Annotation.Sequence.IsAnnotation]: z.boolean(),\n [Annotation.Table.OrderPriority]: z.number(),\n [Annotation.Trace]: z.array(TraceEntrySchema),\n [Annotation.VDJ.IsAssemblingFeature]: z.boolean(),\n};\n\n/// Helper function for reading plain annotation values\nexport function readAnnotation<T extends keyof Annotation>(\n spec: { annotations?: Metadata | undefined } | undefined,\n key: T,\n): Annotation[T] | undefined {\n return readMetadata<Annotation, T>(spec?.annotations, key);\n}\n\n/// Helper function for reading json-encoded annotation values, throws on JSON parsing error\nexport function readAnnotationJsonOrThrow<T extends keyof AnnotationJson>(\n spec: { annotations?: Metadata | undefined } | undefined,\n key: T,\n): z.infer<AnnotationJson[T]> | undefined {\n return readMetadataJsonOrThrow<Annotation, T>(\n spec?.annotations,\n AnnotationJson,\n key,\n \"readAnnotationJsonOrThrow\",\n );\n}\n\n/// Helper function for reading json-encoded annotation values, returns undefined on JSON parsing error\nexport function readAnnotationJson<T extends keyof AnnotationJson>(\n spec: { annotations?: Metadata | undefined } | undefined,\n key: T,\n): z.infer<AnnotationJson[T]> | undefined {\n return readMetadataJson<Annotation, T>(spec?.annotations, AnnotationJson, key);\n}\n\nexport function isLinkerColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.IsLinkerColumn);\n}\n\n/**\n * Specification of an individual axis.\n *\n * Each axis is a part of a composite key that addresses data inside the PColumn.\n *\n * Each record inside a PColumn is addressed by a unique tuple of values set for\n * all the axes specified in the column spec.\n */\nexport type AxisSpec = {\n /** Type of the axis value. Should not use non-key types like float or double. */\n readonly type: AxisValueType;\n\n /** Name of the axis */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Context domain provides additional axis identity that is matched\n * by kinship rules (subset/superset/overlap) rather than exact equality */\n readonly contextDomain?: Record<string, string>;\n\n /** Any additional information attached to the axis that does not affect its\n * identifier */\n readonly annotations?: Record<string, string>;\n\n /**\n * Parent axes provide contextual grouping for the axis in question, establishing\n * a hierarchy where the current axis is dependent on one or more axes for its\n * full definition and meaning. For instance, in a data structure where each\n * \"container\" axis may contain multiple \"item\" axes, the `item` axis would\n * list the index of the `container` axis in this field to denote its dependency.\n *\n * This means that the identity or significance of the `item` axis is only\n * interpretable when combined with its parent `container` axis. An `item` axis\n * index by itself may be non-unique and only gains uniqueness within the context\n * of its parent `container`. Therefore, the `parentAxes` field is essential for\n * mapping these relationships and ensuring data coherence across nested or\n * multi-level data models.\n *\n * A list of zero-based indices of parent axes in the overall axes specification\n * from the column spec. Each index corresponds to the position of a parent axis\n * in the list that defines the structure of the data model.\n */\n readonly parentAxes?: number[];\n};\n\n/** Parents are specs, not indexes; normalized axis can be used considering its parents independently from column */\nexport interface AxisSpecNormalized extends Omit<AxisSpec, \"parentAxes\"> {\n parentAxesSpec: AxisSpecNormalized[];\n}\n\n/** Tree: axis is a root, its parents are children */\nexport type AxisTree = {\n axis: AxisSpecNormalized;\n children: AxisTree[]; // parents\n};\n\nfunction makeAxisTree(axis: AxisSpecNormalized): AxisTree {\n return { axis, children: [] };\n}\n\n/** Build tree by axis parents annotations */\nexport function getAxesTree(rootAxis: AxisSpecNormalized): AxisTree {\n const root = makeAxisTree(rootAxis);\n let nodesQ = [root];\n while (nodesQ.length) {\n const nextNodes: AxisTree[] = [];\n for (const node of nodesQ) {\n node.children = node.axis.parentAxesSpec.map(makeAxisTree);\n nextNodes.push(...node.children);\n }\n nodesQ = nextNodes;\n }\n return root;\n}\n\n/** Get set of canonicalized axisIds from axisTree */\nexport function getSetFromAxisTree(tree: AxisTree): Set<CanonicalizedJson<AxisId>> {\n const set = new Set([canonicalizeJson(getAxisId(tree.axis))]);\n let nodesQ = [tree];\n while (nodesQ.length) {\n const nextNodes = [];\n for (const node of nodesQ) {\n for (const parent of node.children) {\n set.add(canonicalizeJson(getAxisId(parent.axis)));\n nextNodes.push(parent);\n }\n }\n nodesQ = nextNodes;\n }\n return set;\n}\n\n/** Get array of axisSpecs from axisTree */\nexport function getArrayFromAxisTree(tree: AxisTree): AxisSpecNormalized[] {\n const res = [tree.axis];\n let nodesQ = [tree];\n while (nodesQ.length) {\n const nextNodes = [];\n for (const node of nodesQ) {\n for (const parent of node.children) {\n res.push(parent.axis);\n nextNodes.push(parent);\n }\n }\n nodesQ = nextNodes;\n }\n return res;\n}\n\nexport function canonicalizeAxisWithParents(axis: AxisSpecNormalized) {\n return canonicalizeJson(getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));\n}\n\nfunction normalizingAxesComparator(\n axis1: AxisSpecNormalized,\n axis2: AxisSpecNormalized,\n): 1 | -1 | 0 {\n if (axis1.name !== axis2.name) {\n return axis1.name < axis2.name ? 1 : -1;\n }\n if (axis1.type !== axis2.type) {\n return axis1.type < axis2.type ? 1 : -1;\n }\n const domain1 = canonicalizeJson(axis1.domain ?? {});\n const domain2 = canonicalizeJson(axis2.domain ?? {});\n if (domain1 !== domain2) {\n return domain1 < domain2 ? 1 : -1;\n }\n\n const contextDomain1 = canonicalizeJson(axis1.contextDomain ?? {});\n const contextDomain2 = canonicalizeJson(axis2.contextDomain ?? {});\n if (contextDomain1 !== contextDomain2) {\n return contextDomain1 < contextDomain2 ? 1 : -1;\n }\n\n const parents1 = canonicalizeAxisWithParents(axis1);\n const parents2 = canonicalizeAxisWithParents(axis2);\n\n if (parents1 !== parents2) {\n return parents1 < parents2 ? 1 : -1;\n }\n\n const annotation1 = canonicalizeJson(axis1.annotations ?? {});\n const annotation2 = canonicalizeJson(axis2.annotations ?? {});\n if (annotation1 !== annotation2) {\n return annotation1 < annotation2 ? 1 : -1;\n }\n return 0;\n}\n\nfunction parseParentsFromAnnotations(axis: AxisSpec) {\n const parentsList = readAnnotationJson(axis, Annotation.Parents);\n if (parentsList === undefined) {\n return [];\n }\n return parentsList;\n}\n\nfunction sortParentsDeep(axisSpec: AxisSpecNormalized) {\n axisSpec.parentAxesSpec.forEach(sortParentsDeep);\n axisSpec.parentAxesSpec.sort(normalizingAxesComparator);\n}\n\nfunction hasCycleOfParents(axisSpec: AxisSpecNormalized) {\n const root = makeAxisTree(axisSpec);\n let nodesQ = [root];\n const ancestors = new Set(canonicalizeJson(getAxisId(axisSpec)));\n while (nodesQ.length) {\n const nextNodes: AxisTree[] = [];\n const levelIds = new Set<CanonicalizedJson<AxisId>>();\n for (const node of nodesQ) {\n node.children = node.axis.parentAxesSpec.map(makeAxisTree);\n for (const child of node.children) {\n const childId = canonicalizeJson(getAxisId(child.axis));\n if (!levelIds.has(childId)) {\n nextNodes.push(child);\n levelIds.add(childId);\n if (ancestors.has(childId)) {\n return true;\n }\n ancestors.add(childId);\n }\n }\n }\n nodesQ = nextNodes;\n }\n return false;\n}\n\n/** Create list of normalized axisSpec (parents are in array of specs, not indexes) */\nexport function getNormalizedAxesList(axes: AxisSpec[]): AxisSpecNormalized[] {\n if (axes.length === 0) {\n return [];\n }\n const modifiedAxes: AxisSpecNormalized[] = axes.map((axis) => {\n const { parentAxes: _, ...copiedRest } = axis;\n return { ...copiedRest, annotations: { ...copiedRest.annotations }, parentAxesSpec: [] };\n });\n\n axes.forEach((axis, idx) => {\n const modifiedAxis = modifiedAxes[idx];\n if (axis.parentAxes) {\n // if we have parents by indexes then take from the list\n modifiedAxis.parentAxesSpec = axis.parentAxes.map((idx) => modifiedAxes[idx]);\n } else {\n // else try to parse from annotation name\n const parents = parseParentsFromAnnotations(axis).map((name) =>\n modifiedAxes.find((axis) => axis.name === name),\n );\n modifiedAxis.parentAxesSpec = parents.some((p) => p === undefined)\n ? []\n : (parents as AxisSpecNormalized[]);\n }\n });\n\n if (modifiedAxes.some(hasCycleOfParents)) {\n // Axes list is broken\n modifiedAxes.forEach((axis) => {\n axis.parentAxesSpec = [];\n });\n } else {\n modifiedAxes.forEach((axis) => {\n sortParentsDeep(axis);\n });\n }\n\n return modifiedAxes;\n}\n\n/** Create list of regular axisSpec from normalized (parents are indexes, inside of current axes list) */\nexport function getDenormalizedAxesList(axesSpec: AxisSpecNormalized[]): AxisSpec[] {\n const idsList = axesSpec.map(canonicalizeAxisId);\n return axesSpec.map((axisSpec) => {\n const parentsIds = axisSpec.parentAxesSpec.map(canonicalizeAxisId);\n const parentIdxs = parentsIds.map((id) => idsList.indexOf(id));\n const { parentAxesSpec: _, ...copiedRest } = axisSpec;\n if (parentIdxs.length) {\n return { ...copiedRest, parentAxes: parentIdxs } as AxisSpec;\n }\n return copiedRest;\n });\n}\n\n/**\n * Resolve annotation-based parents (`pl7.app/parents`) to numeric `parentAxes`\n * on a column spec. Returns the spec unchanged if all axes already use numeric\n * indices or have no parent annotations.\n */\nexport function resolveAnnotationParents(spec: PColumnSpec): PColumnSpec {\n const hasAnnotationParents = spec.axesSpec.some(\n (axis) => !!readAnnotationJson(axis, Annotation.Parents),\n );\n if (!hasAnnotationParents) return spec;\n\n const normalized = getNormalizedAxesList(spec.axesSpec);\n const denormalized = getDenormalizedAxesList(normalized);\n return { ...spec, axesSpec: denormalized };\n}\n\n/** Common type representing spec for all the axes in a column */\nexport type AxesSpec = AxisSpec[];\n\n/// Well-known column names\nexport const PColumnName = {\n Label: \"pl7.app/label\",\n Table: {\n RowSelection: \"pl7.app/table/row-selection\",\n },\n VDJ: {\n LeadSelection: \"pl7.app/vdj/lead-selection\",\n RankingOrder: \"pl7.app/vdj/ranking-order\",\n Sequence: \"pl7.app/vdj/sequence\",\n },\n} as const;\n\n/// Well-known axis names\nexport const PAxisName = {\n SampleId: \"pl7.app/sampleId\",\n VDJ: {\n Assay: {\n SequenceId: \"pl7.app/vdj/assay/sequenceId\",\n },\n ClusterId: \"pl7.app/vdj/clusterId\",\n ClonotypeKey: \"pl7.app/vdj/clonotypeKey\",\n ScClonotypeKey: \"pl7.app/vdj/scClonotypeKey\",\n },\n} as const;\n\nexport function isLabelColumn(column: PColumnSpec) {\n return column.axesSpec.length === 1 && column.name === PColumnName.Label;\n}\n\n/**\n * Full column specification including all axes specs and specs of the column\n * itself.\n *\n * A PColumn in its essence represents a mapping from a fixed size, explicitly\n * typed tuple to an explicitly typed value.\n *\n * (axis1Value1, axis2Value1, ...) -> columnValue\n *\n * Each element in tuple correspond to the axis having the same index in axesSpec.\n */\nexport type PUniversalColumnSpec = PObjectSpec & {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: \"PColumn\";\n\n /** Type of column values */\n readonly valueType: string;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Context domain provides additional column identity that is matched\n * by kinship rules (subset/superset/overlap) rather than exact equality */\n readonly contextDomain?: Record<string, string>;\n\n /** Any additional information attached to the column that does not affect its\n * identifier */\n readonly annotations?: Record<string, string>;\n\n /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */\n readonly parentAxes?: number[];\n\n /** Axes specifications */\n readonly axesSpec: AxesSpec;\n};\n\n/**\n * Specification of a data column.\n *\n * Data column is a specialized type of PColumn that stores only simple values (strings and numbers)\n * addressed by multiple keys. This is in contrast to other PColumn variants that can store more complex\n * values like files or other abstract data types. Data columns are optimized for storing and processing\n * basic tabular data.\n */\nexport type PDataColumnSpec = PUniversalColumnSpec & {\n /** Type of column values */\n readonly valueType: ValueType;\n};\n\n// @todo: change this to PUniversalColumnSpec\nexport type PColumnSpec = PDataColumnSpec;\n\n/** Unique PColumnSpec identifier */\nexport type PColumnSpecId = {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: \"PColumn\";\n\n /** Type of column values */\n readonly valueType: ValueType;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Context domain provides additional column identity that is matched\n * by kinship rules (subset/superset/overlap) rather than exact equality */\n readonly contextDomain?: Record<string, string>;\n\n /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */\n readonly parentAxes?: number[];\n\n /** Axes id */\n readonly axesId: AxesId;\n};\n\nexport function getPColumnSpecId(spec: PColumnSpec): PColumnSpecId {\n return {\n kind: spec.kind,\n valueType: spec.valueType,\n name: spec.name,\n domain: spec.domain,\n contextDomain: spec.contextDomain,\n parentAxes: spec.parentAxes,\n axesId: getAxesId(spec.axesSpec),\n };\n}\n\nexport interface PColumn<Data> extends PObject<Data> {\n /** PColumn spec, allowing it to be found among other PObjects */\n readonly spec: PColumnSpec;\n}\n\n/** Columns in a PFrame also have internal identifier, this object represents\n * combination of specs and such id */\nexport interface PColumnIdAndSpec {\n /** Internal column id within the PFrame */\n readonly columnId: PObjectId;\n\n /** Column spec */\n readonly spec: PColumnSpec;\n}\n\n/** Get column id and spec from a column */\nexport function getColumnIdAndSpec<Data>(column: PColumn<Data>): PColumnIdAndSpec {\n return {\n columnId: column.id,\n spec: column.spec,\n };\n}\n\nexport interface AxisId {\n /** Type of the axis or column value. For an axis should not use non-key\n * types like float or double. */\n readonly type: AxisValueType;\n\n /** Name of the axis or column */\n readonly name: string;\n\n /** Adds auxiliary information to the axis or column name and type to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Context domain provides additional axis identity that is matched\n * by kinship rules (subset/superset/overlap) rather than exact equality */\n readonly contextDomain?: Record<string, string>;\n}\n\n/** Array of axis ids */\nexport type AxesId = AxisId[];\n\n/** Extracts axis ids from axis spec */\nexport function getAxisId(spec: AxisSpec): AxisId {\n const { type, name, domain, contextDomain } = spec;\n const result: AxisId = { type, name };\n if (domain && Object.entries(domain).length > 0) {\n Object.assign(result, { domain });\n }\n if (contextDomain && Object.entries(contextDomain).length > 0) {\n Object.assign(result, { contextDomain });\n }\n return result;\n}\n\n/** Extracts axes ids from axes spec array from column spec */\nexport function getAxesId(spec: AxesSpec): AxesId {\n return spec.map(getAxisId);\n}\n\n/** Canonicalizes axis id */\nexport function canonicalizeAxisId(id: AxisId): CanonicalizedJson<AxisId> {\n return canonicalizeJson(getAxisId(id));\n}\n\n/** Returns true if all domains from query are found in target */\nfunction matchDomain(query?: Record<string, string>, target?: Record<string, string>) {\n if (query === undefined) return target === undefined;\n if (target === undefined) return true;\n for (const k in target) {\n if (query[k] !== target[k]) return false;\n }\n return true;\n}\n\n/** Returns whether \"match\" axis id is compatible with the \"query\" */\nexport function matchAxisId(query: AxisId, target: AxisId): boolean {\n return (\n query.name === target.name &&\n matchDomain(query.domain, target.domain) &&\n matchDomain(query.contextDomain, target.contextDomain)\n );\n}\n\nexport function getTypeFromPColumnOrAxisSpec(spec: PColumnSpec | AxisSpec): ValueType {\n return \"valueType\" in spec ? spec.valueType : spec.type;\n}\n\nexport function isAxisId(id: unknown): id is AxisId {\n return typeof id === \"object\" && id !== null && \"name\" in id && \"type\" in id;\n}\n"],"mappings":";;;;AAKA,MAAa,YAAY;CACvB,KAAK;CACL,MAAM;CACN,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,OAAO;AACT;AAUA,SAAgB,aACd,UACA,KACkB;CAClB,OAAQ,WAA6B;AACvC;AASA,SAAgB,wBACd,UACA,cACA,KACA,oBAA4B,2BACa;CACzC,MAAM,OAAO,aAAmB,UAAU,GAAG;CAC7C,IAAI,SAAS,KAAA,GA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