@milaboratories/pl-model-common 1.19.19 → 1.20.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"base64.cjs","sources":["../src/base64.ts"],"sourcesContent":["export type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {\n __base64_encoded: T;\n};\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString('base64') as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, 'base64').toString() as T;\n};\n"],"names":[],"mappings":";;AAMM,SAAU,YAAY,CAAI,KAA0B,EAAA;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAqB;AAClE;AAEM,SAAU,YAAY,CAAmB,KAAuB,EAAA;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAO;AACrD;;;;;"}
1
+ {"version":3,"file":"base64.cjs","sources":["../src/base64.ts"],"sourcesContent":["import type { WithImplicitCoercion } from 'node:buffer';\n\nexport type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {\n __base64_encoded: T;\n};\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString('base64') as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, 'base64').toString() as T;\n};\n"],"names":[],"mappings":";;AAQM,SAAU,YAAY,CAAI,KAA0B,EAAA;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAqB;AAClE;AAEM,SAAU,YAAY,CAAmB,KAAuB,EAAA;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAO;AACrD;;;;;"}
package/dist/base64.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { WithImplicitCoercion } from 'node:buffer';
1
2
  export type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;
2
3
  export type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {
3
4
  __base64_encoded: T;
@@ -1 +1 @@
1
- {"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../src/base64.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,oBAAoB,CAAC,UAAU,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEtH,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG;IAC5F,gBAAgB,EAAE,CAAC,CAAC;CACrB,CAAC;AAEF,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAE5E;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAEzE"}
1
+ {"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../src/base64.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,oBAAoB,CAAC,UAAU,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEtH,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG;IAC5F,gBAAgB,EAAE,CAAC,CAAC;CACrB,CAAC;AAEF,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAE5E;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAEzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"base64.js","sources":["../src/base64.ts"],"sourcesContent":["export type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {\n __base64_encoded: T;\n};\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString('base64') as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, 'base64').toString() as T;\n};\n"],"names":[],"mappings":"AAMM,SAAU,YAAY,CAAI,KAA0B,EAAA;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAqB;AAClE;AAEM,SAAU,YAAY,CAAmB,KAAuB,EAAA;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAO;AACrD;;;;"}
1
+ {"version":3,"file":"base64.js","sources":["../src/base64.ts"],"sourcesContent":["import type { WithImplicitCoercion } from 'node:buffer';\n\nexport type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {\n __base64_encoded: T;\n};\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString('base64') as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, 'base64').toString() as T;\n};\n"],"names":[],"mappings":"AAQM,SAAU,YAAY,CAAI,KAA0B,EAAA;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAqB;AAClE;AAEM,SAAU,YAAY,CAAmB,KAAuB,EAAA;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAO;AACrD;;;;"}
@@ -59,19 +59,33 @@ function readDomainJson(spec, key) {
59
59
  }
60
60
  /// Well-known annotations
61
61
  const Annotation = {
62
+ AxisNature: 'pl7.app/axisNature',
62
63
  Alphabet: 'pl7.app/alphabet',
63
64
  Description: 'pl7.app/description',
64
65
  DiscreteValues: 'pl7.app/discreteValues',
65
66
  Format: 'pl7.app/format',
66
67
  Graph: {
68
+ Axis: {
69
+ HighCardinality: 'pl7.app/graph/axis/highCardinality',
70
+ LowerLimit: 'pl7.app/graph/axis/lowerLimit',
71
+ SymmetricRange: 'pl7.app/graph/axis/symmetricRange',
72
+ UpperLimit: 'pl7.app/graph/axis/upperLimit',
73
+ },
74
+ IsDenseAxis: 'pl7.app/graph/isDenseAxis',
67
75
  IsVirtual: 'pl7.app/graph/isVirtual',
76
+ Palette: 'pl7.app/graph/palette',
77
+ Thresholds: 'pl7.app/graph/thresholds',
78
+ TreatAbsentValuesAs: 'pl7.app/graph/treatAbsentValuesAs',
68
79
  },
69
80
  HideDataFromUi: 'pl7.app/hideDataFromUi',
70
81
  HideDataFromGraphs: 'pl7.app/hideDataFromGraphs',
82
+ IsDiscreteFilter: 'pl7.app/isDiscreteFilter',
71
83
  IsLinkerColumn: 'pl7.app/isLinkerColumn',
84
+ IsSubset: 'pl7.app/isSubset',
72
85
  Label: 'pl7.app/label',
73
86
  Max: 'pl7.app/max',
74
87
  Min: 'pl7.app/min',
88
+ MultipliesBy: 'pl7.app/multipliesBy',
75
89
  Parents: 'pl7.app/parents',
76
90
  Sequence: {
77
91
  Annotation: {
@@ -86,14 +100,29 @@ const Annotation = {
86
100
  },
87
101
  Trace: 'pl7.app/trace',
88
102
  };
103
+ const ValueTypeSchema = zod.z.enum(['Int', 'Long', 'Float', 'Double', 'String']);
89
104
  const AnnotationJson = {
90
105
  [Annotation.DiscreteValues]: zod.z.array(zod.z.string()).or(zod.z.array(zod.z.number())),
106
+ [Annotation.Graph.Axis.HighCardinality]: zod.z.boolean(),
107
+ [Annotation.Graph.Axis.LowerLimit]: zod.z.number(),
108
+ [Annotation.Graph.Axis.UpperLimit]: zod.z.number(),
109
+ [Annotation.Graph.Axis.SymmetricRange]: zod.z.boolean(),
110
+ [Annotation.Graph.IsDenseAxis]: zod.z.boolean(),
111
+ [Annotation.Graph.Palette]: zod.z.object({ mapping: zod.z.record(zod.z.number()), name: zod.z.string() }),
112
+ [Annotation.Graph.Thresholds]: zod.z.array(zod.z.object({
113
+ columnId: zod.z.object({ valueType: ValueTypeSchema, name: zod.z.string() }),
114
+ value: zod.z.number(),
115
+ })),
116
+ [Annotation.Graph.TreatAbsentValuesAs]: zod.z.number(),
91
117
  [Annotation.Graph.IsVirtual]: zod.z.boolean(),
92
118
  [Annotation.HideDataFromUi]: zod.z.boolean(),
93
119
  [Annotation.HideDataFromGraphs]: zod.z.boolean(),
120
+ [Annotation.IsDiscreteFilter]: zod.z.boolean(),
94
121
  [Annotation.IsLinkerColumn]: zod.z.boolean(),
122
+ [Annotation.IsSubset]: zod.z.boolean(),
95
123
  [Annotation.Max]: zod.z.number(),
96
124
  [Annotation.Min]: zod.z.number(),
125
+ [Annotation.MultipliesBy]: zod.z.array(zod.z.string()),
97
126
  [Annotation.Parents]: zod.z.array(zod.z.string()),
98
127
  [Annotation.Sequence.Annotation.Mapping]: zod.z.record(zod.z.string(), zod.z.string()),
99
128
  [Annotation.Sequence.IsAnnotation]: zod.z.boolean(),
@@ -1 +1 @@
1
- {"version":3,"file":"spec.cjs","sources":["../../../../src/drivers/pframe/spec/spec.ts"],"sourcesContent":["import { ensureError } from '../../../errors';\nimport {\n canonicalizeJson,\n type CanonicalizedJson,\n type StringifiedJson,\n} from '../../../json';\nimport type {\n PObject,\n PObjectId,\n PObjectSpec,\n} 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\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> ? z.ZodType<U> : 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} as const;\n\nexport type Domain = Metadata & Partial<{\n [Domain.Alphabet]: 'nucleotide' | 'aminoacid' | string;\n [Domain.BlockId]: 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 Alphabet: 'pl7.app/alphabet',\n Description: 'pl7.app/description',\n DiscreteValues: 'pl7.app/discreteValues',\n Format: 'pl7.app/format',\n Graph: {\n IsVirtual: 'pl7.app/graph/isVirtual',\n },\n HideDataFromUi: 'pl7.app/hideDataFromUi',\n HideDataFromGraphs: 'pl7.app/hideDataFromGraphs',\n IsLinkerColumn: 'pl7.app/isLinkerColumn',\n Label: 'pl7.app/label',\n Max: 'pl7.app/max',\n Min: 'pl7.app/min',\n Parents: 'pl7.app/parents',\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 },\n Trace: 'pl7.app/trace',\n} as const;\n\nexport type Annotation = Metadata & Partial<{\n [Annotation.Alphabet]: 'nucleotide' | 'aminoacid' | string;\n [Annotation.Description]: string;\n [Annotation.DiscreteValues]: StringifiedJson<number[]> | StringifiedJson<string[]>;\n [Annotation.Format]: string;\n [Annotation.Graph.IsVirtual]: StringifiedJson<boolean>;\n [Annotation.HideDataFromUi]: StringifiedJson<boolean>;\n [Annotation.HideDataFromGraphs]: StringifiedJson<boolean>;\n [Annotation.IsLinkerColumn]: StringifiedJson<boolean>;\n [Annotation.Label]: string;\n [Annotation.Max]: StringifiedJson<number>;\n [Annotation.Min]: StringifiedJson<number>;\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.Trace]: StringifiedJson<Record<string, unknown>>;\n}>;\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>;\nexport const AnnotationJson: AnnotationJson = {\n [Annotation.DiscreteValues]: z.array(z.string()).or(z.array(z.number())),\n [Annotation.Graph.IsVirtual]: z.boolean(),\n [Annotation.HideDataFromUi]: z.boolean(),\n [Annotation.HideDataFromGraphs]: z.boolean(),\n [Annotation.IsLinkerColumn]: z.boolean(),\n [Annotation.Max]: z.number(),\n [Annotation.Min]: z.number(),\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.record(z.string(), z.unknown()),\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>(spec?.annotations, AnnotationJson, key, 'readAnnotationJsonOrThrow');\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\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 interface AxisSpec {\n /** Type of the axis value. Should not use non-key types like float or double. */\n readonly type: ValueType;\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 /** 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(axis1: AxisSpecNormalized, axis2: AxisSpecNormalized): 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 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) {\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) { // if we have parents by indexes then take from the list\n modifiedAxis.parentAxesSpec = axis.parentAxes.map((idx) => modifiedAxes[idx]);\n } else { // else try to parse from annotation name\n const parents = parseParentsFromAnnotations(axis).map((name) => modifiedAxes.find((axis) => axis.name === name));\n modifiedAxis.parentAxesSpec = parents.some((p) => p === undefined) ? [] : parents as AxisSpecNormalized[];\n\n delete modifiedAxis.annotations?.[Annotation.Parents];\n }\n });\n\n if (modifiedAxes.some(hasCycleOfParents)) { // 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((axisSpec) => canonicalizeJson(getAxisId(axisSpec)));\n return axesSpec.map((axisSpec) => {\n const parentsIds = axisSpec.parentAxesSpec.map((axisSpec) => canonicalizeJson(getAxisId(axisSpec)));\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/** 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} as const;\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 interface PUniversalColumnSpec extends 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 /** 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 interface PDataColumnSpec extends 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 /** 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 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\n/** Information returned by {@link PFrame.listColumns} method */\nexport interface PColumnInfo extends PColumnIdAndSpec {\n /** True if data was associated with this PColumn */\n readonly hasData: boolean;\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: ValueType;\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\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 } = spec;\n const result = { type, name };\n if (domain && Object.entries(domain).length > 0) {\n Object.assign(result, { domain });\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 query.name === target.name && matchDomain(query.domain, target.domain);\n}\n"],"names":["ensureError","z","canonicalizeJson"],"mappings":";;;;;;AAaO,MAAM,SAAS,GAAG;AACvB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,KAAK,EAAE,OAAO;;AAQV,SAAU,YAAY,CAC1B,QAA8B,EAC9B,GAAM,EAAA;AAEN,IAAA,OAAQ,QAA0B,GAAG,GAAG,CAAC;AAC3C;AAOM,SAAU,uBAAuB,CACrC,QAA8B,EAC9B,YAA6B,EAC7B,GAAM,EACN,iBAAA,GAA4B,yBAAyB,EAAA;IAErD,MAAM,IAAI,GAAG,YAAY,CAAO,QAAQ,EAAE,GAAG,CAAC;IAC9C,IAAI,IAAI,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;AAExC,IAAA,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC;AAChC,IAAA,IAAI;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;AAC9B,QAAA,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;IAC5B;IAAE,OAAO,KAAc,EAAE;AACvB,QAAA,MAAM,IAAI,KA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SAAS;QAAE,OAAO,MAAM,KAAK,SAAS;IACpD,IAAI,MAAM,KAAK,SAAS;AAAE,QAAA,OAAO,IAAI;AACrC,IAAA,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE;QACtB,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;AAAE,YAAA,OAAO,KAAK;IAC1C;AACA,IAAA,OAAO,IAAI;AACb;AAEA;AACM,SAAU,WAAW,CAAC,KAAa,EAAE,MAAc,EAAA;AACvD,IAAA,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;AAC/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"spec.cjs","sources":["../../../../src/drivers/pframe/spec/spec.ts"],"sourcesContent":["import { ensureError } from '../../../errors';\nimport {\n canonicalizeJson,\n type CanonicalizedJson,\n type StringifiedJson,\n} from '../../../json';\nimport type {\n PObject,\n PObjectId,\n PObjectSpec,\n} 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\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> ? z.ZodType<U> : 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} as const;\n\nexport type Domain = Metadata & Partial<{\n [Domain.Alphabet]: 'nucleotide' | 'aminoacid' | string;\n [Domain.BlockId]: 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 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 IsLinkerColumn: 'pl7.app/isLinkerColumn',\n IsSubset: 'pl7.app/isSubset',\n Label: 'pl7.app/label',\n Max: 'pl7.app/max',\n Min: 'pl7.app/min',\n MultipliesBy: 'pl7.app/multipliesBy',\n Parents: 'pl7.app/parents',\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 },\n Trace: 'pl7.app/trace',\n} as const;\n\nexport type Annotation = Metadata & Partial<{\n [Annotation.Alphabet]: 'nucleotide' | 'aminoacid' | string;\n [Annotation.AxisNature]: 'homogeneous' | 'heterogeneous' | 'scaleCompatible' | string;\n [Annotation.Description]: string;\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<{ columnId: { valueType: ValueType; name: string }; value: number }[]>;\n [Annotation.Graph.TreatAbsentValuesAs]: StringifiedJson<number>;\n [Annotation.HideDataFromUi]: StringifiedJson<boolean>;\n [Annotation.HideDataFromGraphs]: 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.Trace]: StringifiedJson<Record<string, unknown>>;\n}>;\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.record(z.string(), z.unknown()),\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>(spec?.annotations, AnnotationJson, key, 'readAnnotationJsonOrThrow');\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\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 interface AxisSpec {\n /** Type of the axis value. Should not use non-key types like float or double. */\n readonly type: ValueType;\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 /** 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(axis1: AxisSpecNormalized, axis2: AxisSpecNormalized): 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 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) {\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) { // if we have parents by indexes then take from the list\n modifiedAxis.parentAxesSpec = axis.parentAxes.map((idx) => modifiedAxes[idx]);\n } else { // else try to parse from annotation name\n const parents = parseParentsFromAnnotations(axis).map((name) => modifiedAxes.find((axis) => axis.name === name));\n modifiedAxis.parentAxesSpec = parents.some((p) => p === undefined) ? [] : parents as AxisSpecNormalized[];\n\n delete modifiedAxis.annotations?.[Annotation.Parents];\n }\n });\n\n if (modifiedAxes.some(hasCycleOfParents)) { // 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((axisSpec) => canonicalizeJson(getAxisId(axisSpec)));\n return axesSpec.map((axisSpec) => {\n const parentsIds = axisSpec.parentAxesSpec.map((axisSpec) => canonicalizeJson(getAxisId(axisSpec)));\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/** 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} as const;\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 interface PUniversalColumnSpec extends 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 /** 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 interface PDataColumnSpec extends 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 /** 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 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\n/** Information returned by {@link PFrame.listColumns} method */\nexport interface PColumnInfo extends PColumnIdAndSpec {\n /** True if data was associated with this PColumn */\n readonly hasData: boolean;\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: ValueType;\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\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 } = spec;\n const result = { type, name };\n if (domain && Object.entries(domain).length > 0) {\n Object.assign(result, { domain });\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 query.name === target.name && matchDomain(query.domain, target.domain);\n}\n"],"names":["ensureError","z","canonicalizeJson"],"mappings":";;;;;;AAaO,MAAM,SAAS,GAAG;AACvB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,MAAM,EAAE,QAAQ;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KAAK,SAAS;IACpD,IAAI,MAAM,KAAK,SAAS;AAAE,QAAA,OAAO,IAAI;AACrC,IAAA,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE;QACtB,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;AAAE,YAAA,OAAO,KAAK;IAC1C;AACA,IAAA,OAAO,IAAI;AACb;AAEA;AACM,SAAU,WAAW,CAAC,KAAa,EAAE,MAAc,EAAA;AACvD,IAAA,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;AAC/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -39,19 +39,33 @@ export declare function readDomainJson<T extends keyof DomainJson>(spec: {
39
39
  domain?: Metadata | undefined;
40
40
  } | undefined, key: T): z.infer<DomainJson[T]> | undefined;
41
41
  export declare const Annotation: {
42
+ readonly AxisNature: "pl7.app/axisNature";
42
43
  readonly Alphabet: "pl7.app/alphabet";
43
44
  readonly Description: "pl7.app/description";
44
45
  readonly DiscreteValues: "pl7.app/discreteValues";
45
46
  readonly Format: "pl7.app/format";
46
47
  readonly Graph: {
48
+ readonly Axis: {
49
+ readonly HighCardinality: "pl7.app/graph/axis/highCardinality";
50
+ readonly LowerLimit: "pl7.app/graph/axis/lowerLimit";
51
+ readonly SymmetricRange: "pl7.app/graph/axis/symmetricRange";
52
+ readonly UpperLimit: "pl7.app/graph/axis/upperLimit";
53
+ };
54
+ readonly IsDenseAxis: "pl7.app/graph/isDenseAxis";
47
55
  readonly IsVirtual: "pl7.app/graph/isVirtual";
56
+ readonly Palette: "pl7.app/graph/palette";
57
+ readonly Thresholds: "pl7.app/graph/thresholds";
58
+ readonly TreatAbsentValuesAs: "pl7.app/graph/treatAbsentValuesAs";
48
59
  };
49
60
  readonly HideDataFromUi: "pl7.app/hideDataFromUi";
50
61
  readonly HideDataFromGraphs: "pl7.app/hideDataFromGraphs";
62
+ readonly IsDiscreteFilter: "pl7.app/isDiscreteFilter";
51
63
  readonly IsLinkerColumn: "pl7.app/isLinkerColumn";
64
+ readonly IsSubset: "pl7.app/isSubset";
52
65
  readonly Label: "pl7.app/label";
53
66
  readonly Max: "pl7.app/max";
54
67
  readonly Min: "pl7.app/min";
68
+ readonly MultipliesBy: "pl7.app/multipliesBy";
55
69
  readonly Parents: "pl7.app/parents";
56
70
  readonly Sequence: {
57
71
  readonly Annotation: {
@@ -68,16 +82,37 @@ export declare const Annotation: {
68
82
  };
69
83
  export type Annotation = Metadata & Partial<{
70
84
  [Annotation.Alphabet]: 'nucleotide' | 'aminoacid' | string;
85
+ [Annotation.AxisNature]: 'homogeneous' | 'heterogeneous' | 'scaleCompatible' | string;
71
86
  [Annotation.Description]: string;
72
87
  [Annotation.DiscreteValues]: StringifiedJson<number[]> | StringifiedJson<string[]>;
73
88
  [Annotation.Format]: string;
89
+ [Annotation.Graph.Axis.HighCardinality]: StringifiedJson<boolean>;
90
+ [Annotation.Graph.Axis.LowerLimit]: StringifiedJson<number>;
91
+ [Annotation.Graph.Axis.SymmetricRange]: StringifiedJson<boolean>;
92
+ [Annotation.Graph.Axis.UpperLimit]: StringifiedJson<number>;
93
+ [Annotation.Graph.IsDenseAxis]: StringifiedJson<boolean>;
74
94
  [Annotation.Graph.IsVirtual]: StringifiedJson<boolean>;
95
+ [Annotation.Graph.Palette]: StringifiedJson<{
96
+ mapping: Record<string, number>;
97
+ name: string;
98
+ }>;
99
+ [Annotation.Graph.Thresholds]: StringifiedJson<{
100
+ columnId: {
101
+ valueType: ValueType;
102
+ name: string;
103
+ };
104
+ value: number;
105
+ }[]>;
106
+ [Annotation.Graph.TreatAbsentValuesAs]: StringifiedJson<number>;
75
107
  [Annotation.HideDataFromUi]: StringifiedJson<boolean>;
76
108
  [Annotation.HideDataFromGraphs]: StringifiedJson<boolean>;
109
+ [Annotation.IsDiscreteFilter]: StringifiedJson<boolean>;
77
110
  [Annotation.IsLinkerColumn]: StringifiedJson<boolean>;
111
+ [Annotation.IsSubset]: StringifiedJson<boolean>;
78
112
  [Annotation.Label]: string;
79
113
  [Annotation.Max]: StringifiedJson<number>;
80
114
  [Annotation.Min]: StringifiedJson<number>;
115
+ [Annotation.MultipliesBy]: StringifiedJson<AxisSpec['name'][]>;
81
116
  [Annotation.Parents]: StringifiedJson<AxisSpec['name'][]>;
82
117
  [Annotation.Sequence.Annotation.Mapping]: StringifiedJson<Record<string, string>>;
83
118
  [Annotation.Sequence.IsAnnotation]: StringifiedJson<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/spec/spec.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,SAAS;;;;;;;CAOZ,CAAC;AAEX,wEAAwE;AACxE,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,EAC1E,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,GAAG,EAAE,CAAC,GACL,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAElB;AAED,KAAK,gBAAgB,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,eAAe,GAAG,CAAC,GAAG,KAAK,CAAC,GA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pl7.app/alphabet',
61
62
  Description: 'pl7.app/description',
62
63
  DiscreteValues: 'pl7.app/discreteValues',
63
64
  Format: 'pl7.app/format',
64
65
  Graph: {
66
+ Axis: {
67
+ HighCardinality: 'pl7.app/graph/axis/highCardinality',
68
+ LowerLimit: 'pl7.app/graph/axis/lowerLimit',
69
+ SymmetricRange: 'pl7.app/graph/axis/symmetricRange',
70
+ UpperLimit: 'pl7.app/graph/axis/upperLimit',
71
+ },
72
+ IsDenseAxis: 'pl7.app/graph/isDenseAxis',
65
73
  IsVirtual: 'pl7.app/graph/isVirtual',
74
+ Palette: 'pl7.app/graph/palette',
75
+ Thresholds: 'pl7.app/graph/thresholds',
76
+ TreatAbsentValuesAs: 'pl7.app/graph/treatAbsentValuesAs',
66
77
  },
67
78
  HideDataFromUi: 'pl7.app/hideDataFromUi',
68
79
  HideDataFromGraphs: 'pl7.app/hideDataFromGraphs',
80
+ IsDiscreteFilter: 'pl7.app/isDiscreteFilter',
69
81
  IsLinkerColumn: 'pl7.app/isLinkerColumn',
82
+ IsSubset: 'pl7.app/isSubset',
70
83
  Label: 'pl7.app/label',
71
84
  Max: 'pl7.app/max',
72
85
  Min: 'pl7.app/min',
86
+ MultipliesBy: 'pl7.app/multipliesBy',
73
87
  Parents: 'pl7.app/parents',
74
88
  Sequence: {
75
89
  Annotation: {
@@ -84,14 +98,29 @@ const Annotation = {
84
98
  },
85
99
  Trace: 'pl7.app/trace',
86
100
  };
101
+ const ValueTypeSchema = z.enum(['Int', 'Long', 'Float', 'Double', 'String']);
87
102
  const AnnotationJson = {
88
103
  [Annotation.DiscreteValues]: z.array(z.string()).or(z.array(z.number())),
104
+ [Annotation.Graph.Axis.HighCardinality]: z.boolean(),
105
+ [Annotation.Graph.Axis.LowerLimit]: z.number(),
106
+ [Annotation.Graph.Axis.UpperLimit]: z.number(),
107
+ [Annotation.Graph.Axis.SymmetricRange]: z.boolean(),
108
+ [Annotation.Graph.IsDenseAxis]: z.boolean(),
109
+ [Annotation.Graph.Palette]: z.object({ mapping: z.record(z.number()), name: z.string() }),
110
+ [Annotation.Graph.Thresholds]: z.array(z.object({
111
+ columnId: z.object({ valueType: ValueTypeSchema, name: z.string() }),
112
+ value: z.number(),
113
+ })),
114
+ [Annotation.Graph.TreatAbsentValuesAs]: z.number(),
89
115
  [Annotation.Graph.IsVirtual]: z.boolean(),
90
116
  [Annotation.HideDataFromUi]: z.boolean(),
91
117
  [Annotation.HideDataFromGraphs]: z.boolean(),
118
+ [Annotation.IsDiscreteFilter]: z.boolean(),
92
119
  [Annotation.IsLinkerColumn]: z.boolean(),
120
+ [Annotation.IsSubset]: z.boolean(),
93
121
  [Annotation.Max]: z.number(),
94
122
  [Annotation.Min]: z.number(),
123
+ [Annotation.MultipliesBy]: z.array(z.string()),
95
124
  [Annotation.Parents]: z.array(z.string()),
96
125
  [Annotation.Sequence.Annotation.Mapping]: z.record(z.string(), z.string()),
97
126
  [Annotation.Sequence.IsAnnotation]: z.boolean(),
@@ -1 +1 @@
1
- {"version":3,"file":"spec.js","sources":["../../../../src/drivers/pframe/spec/spec.ts"],"sourcesContent":["import { ensureError } from '../../../errors';\nimport {\n canonicalizeJson,\n type CanonicalizedJson,\n type StringifiedJson,\n} from '../../../json';\nimport type {\n PObject,\n PObjectId,\n PObjectSpec,\n} 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\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> ? z.ZodType<U> : 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} as const;\n\nexport type Domain = Metadata & Partial<{\n [Domain.Alphabet]: 'nucleotide' | 'aminoacid' | string;\n [Domain.BlockId]: 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 Alphabet: 'pl7.app/alphabet',\n Description: 'pl7.app/description',\n DiscreteValues: 'pl7.app/discreteValues',\n Format: 'pl7.app/format',\n Graph: {\n IsVirtual: 'pl7.app/graph/isVirtual',\n },\n HideDataFromUi: 'pl7.app/hideDataFromUi',\n HideDataFromGraphs: 'pl7.app/hideDataFromGraphs',\n IsLinkerColumn: 'pl7.app/isLinkerColumn',\n Label: 'pl7.app/label',\n Max: 'pl7.app/max',\n Min: 'pl7.app/min',\n Parents: 'pl7.app/parents',\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 },\n Trace: 'pl7.app/trace',\n} as const;\n\nexport type Annotation = Metadata & Partial<{\n [Annotation.Alphabet]: 'nucleotide' | 'aminoacid' | string;\n [Annotation.Description]: string;\n [Annotation.DiscreteValues]: StringifiedJson<number[]> | StringifiedJson<string[]>;\n [Annotation.Format]: string;\n [Annotation.Graph.IsVirtual]: StringifiedJson<boolean>;\n [Annotation.HideDataFromUi]: StringifiedJson<boolean>;\n [Annotation.HideDataFromGraphs]: StringifiedJson<boolean>;\n [Annotation.IsLinkerColumn]: StringifiedJson<boolean>;\n [Annotation.Label]: string;\n [Annotation.Max]: StringifiedJson<number>;\n [Annotation.Min]: StringifiedJson<number>;\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.Trace]: StringifiedJson<Record<string, unknown>>;\n}>;\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>;\nexport const AnnotationJson: AnnotationJson = {\n [Annotation.DiscreteValues]: z.array(z.string()).or(z.array(z.number())),\n [Annotation.Graph.IsVirtual]: z.boolean(),\n [Annotation.HideDataFromUi]: z.boolean(),\n [Annotation.HideDataFromGraphs]: z.boolean(),\n [Annotation.IsLinkerColumn]: z.boolean(),\n [Annotation.Max]: z.number(),\n [Annotation.Min]: z.number(),\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.record(z.string(), z.unknown()),\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>(spec?.annotations, AnnotationJson, key, 'readAnnotationJsonOrThrow');\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\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 interface AxisSpec {\n /** Type of the axis value. Should not use non-key types like float or double. */\n readonly type: ValueType;\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 /** 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(axis1: AxisSpecNormalized, axis2: AxisSpecNormalized): 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 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) {\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) { // if we have parents by indexes then take from the list\n modifiedAxis.parentAxesSpec = axis.parentAxes.map((idx) => modifiedAxes[idx]);\n } else { // else try to parse from annotation name\n const parents = parseParentsFromAnnotations(axis).map((name) => modifiedAxes.find((axis) => axis.name === name));\n modifiedAxis.parentAxesSpec = parents.some((p) => p === undefined) ? [] : parents as AxisSpecNormalized[];\n\n delete modifiedAxis.annotations?.[Annotation.Parents];\n }\n });\n\n if (modifiedAxes.some(hasCycleOfParents)) { // 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((axisSpec) => canonicalizeJson(getAxisId(axisSpec)));\n return axesSpec.map((axisSpec) => {\n const parentsIds = axisSpec.parentAxesSpec.map((axisSpec) => canonicalizeJson(getAxisId(axisSpec)));\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/** 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} as const;\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 interface PUniversalColumnSpec extends 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 /** 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 interface PDataColumnSpec extends 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 /** 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 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\n/** Information returned by {@link PFrame.listColumns} method */\nexport interface PColumnInfo extends PColumnIdAndSpec {\n /** True if data was associated with this PColumn */\n readonly hasData: boolean;\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: ValueType;\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\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 } = spec;\n const result = { type, name };\n if (domain && Object.entries(domain).length > 0) {\n Object.assign(result, { domain });\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 query.name === target.name && matchDomain(query.domain, target.domain);\n}\n"],"names":[],"mappings":";;;;AAaO,MAAM,SAAS,GAAG;AACvB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,KAAK,EAAE,OAAO;;AAQV,SAAU,YAAY,CAC1B,QAA8B,EAC9B,GAAM,EAAA;AAEN,IAAA,OAAQ,QAA0B,GA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AAO,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/C,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC;IACnC;AACA,IAAA,OAAO,MAAM;AACf;AAEA;AACM,SAAU,SAAS,CAAC,IAAc,EAAA;AACtC,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;AAC5B;AAEA;AACM,SAAU,kBAAkB,CAAC,EAAU,EAAA;AAC3C,IAAA,OAAO,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AACxC;AAEA;AACA,SAAS,WAAW,CAAC,KAA8B,EAAE,MAA+B,EAAA;IAClF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,MAAM,KAAK,SAAS;IACpD,IAAI,MAAM,KAAK,SAAS;AAAE,QAAA,OAAO,IAAI;AACrC,IAAA,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE;QACtB,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;AAAE,YAAA,OAAO,KAAK;IAC1C;AACA,IAAA,OAAO,IAAI;AACb;AAEA;AACM,SAAU,WAAW,CAAC,KAAa,EAAE,MAAc,EAAA;AACvD,IAAA,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;AAC/E;;;;"}
1
+ {"version":3,"file":"spec.js","sources":["../../../../src/drivers/pframe/spec/spec.ts"],"sourcesContent":["import { ensureError } from '../../../errors';\nimport {\n canonicalizeJson,\n type CanonicalizedJson,\n type StringifiedJson,\n} from '../../../json';\nimport type {\n PObject,\n PObjectId,\n PObjectSpec,\n} 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\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> ? z.ZodType<U> : 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} as const;\n\nexport type Domain = Metadata & Partial<{\n [Domain.Alphabet]: 'nucleotide' | 'aminoacid' | string;\n [Domain.BlockId]: 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 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 IsLinkerColumn: 'pl7.app/isLinkerColumn',\n IsSubset: 'pl7.app/isSubset',\n Label: 'pl7.app/label',\n Max: 'pl7.app/max',\n Min: 'pl7.app/min',\n MultipliesBy: 'pl7.app/multipliesBy',\n Parents: 'pl7.app/parents',\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 },\n Trace: 'pl7.app/trace',\n} as const;\n\nexport type Annotation = Metadata & Partial<{\n [Annotation.Alphabet]: 'nucleotide' | 'aminoacid' | string;\n [Annotation.AxisNature]: 'homogeneous' | 'heterogeneous' | 'scaleCompatible' | string;\n [Annotation.Description]: string;\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<{ columnId: { valueType: ValueType; name: string }; value: number }[]>;\n [Annotation.Graph.TreatAbsentValuesAs]: StringifiedJson<number>;\n [Annotation.HideDataFromUi]: StringifiedJson<boolean>;\n [Annotation.HideDataFromGraphs]: 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.Trace]: StringifiedJson<Record<string, unknown>>;\n}>;\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.record(z.string(), z.unknown()),\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>(spec?.annotations, AnnotationJson, key, 'readAnnotationJsonOrThrow');\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\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 interface AxisSpec {\n /** Type of the axis value. Should not use non-key types like float or double. */\n readonly type: ValueType;\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 /** 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(axis1: AxisSpecNormalized, axis2: AxisSpecNormalized): 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 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) {\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) { // if we have parents by indexes then take from the list\n modifiedAxis.parentAxesSpec = axis.parentAxes.map((idx) => modifiedAxes[idx]);\n } else { // else try to parse from annotation name\n const parents = parseParentsFromAnnotations(axis).map((name) => modifiedAxes.find((axis) => axis.name === name));\n modifiedAxis.parentAxesSpec = parents.some((p) => p === undefined) ? [] : parents as AxisSpecNormalized[];\n\n delete modifiedAxis.annotations?.[Annotation.Parents];\n }\n });\n\n if (modifiedAxes.some(hasCycleOfParents)) { // 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((axisSpec) => canonicalizeJson(getAxisId(axisSpec)));\n return axesSpec.map((axisSpec) => {\n const parentsIds = axisSpec.parentAxesSpec.map((axisSpec) => canonicalizeJson(getAxisId(axisSpec)));\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/** 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} as const;\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 interface PUniversalColumnSpec extends 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 /** 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 interface PDataColumnSpec extends 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 /** 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 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\n/** Information returned by {@link PFrame.listColumns} method */\nexport interface PColumnInfo extends PColumnIdAndSpec {\n /** True if data was associated with this PColumn */\n readonly hasData: boolean;\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: ValueType;\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\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 } = spec;\n const result = { type, name };\n if (domain && Object.entries(domain).length > 0) {\n Object.assign(result, { domain });\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 query.name === target.name && matchDomain(query.domain, target.domain);\n}\n"],"names":[],"mappings":";;;;AAaO,MAAM,SAAS,GAAG;AACvB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,KAAK,EAAE,OAAO;;AAQV,SAAU,YAAY,CAC1B,QAA8B,EAC9B,GAAM,EAAA;AAEN,IAAA,OAAQ,QAA0B,GAAG,GAAG,CAAC;AAC3C;AAOM,SAAU,uBAAuB,CACrC,QAA8B,EAC9B,YAA6B,EAC7B,GAAM,EACN,iBAAA,GAA4B,yBAAyB,EAAA;IAErD,MAAM,IAAI,GAAG,YAAY,CAAO,QAAQ,EAAE,GAAG,CAAC;IAC9C,IAAI,IAAI,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;AAExC,IAAA,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC;AAChC,IAAA,IAAI;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;AAC9B,QAAA,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;IAC5B;IAAE,OAAO,KAAc,EAAE;AACvB,QAAA,MAAM,IAAI,KAAK,CACb,CAAA,EAAG,iBAAiB,CAAA,SAAA;AAClB,cAAA,CAAA,KAAA,EAAQ,MAAM,CAAC,GAAG,CAAC,CAAA,EAAA;AACnB,cAAA,CAAA,OAAA,EAAU,IAAI,CAAA,EAAA;AACd,cAAA,CAAA,OAAA,EAAU,WAAW,CAAC,KAAK,CAAC,CAAA,C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IAAA,OAAO,MAAM;AACf;AAEA;AACM,SAAU,SAAS,CAAC,IAAc,EAAA;AACtC,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;AAC5B;AAEA;AACM,SAAU,kBAAkB,CAAC,EAAU,EAAA;AAC3C,IAAA,OAAO,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AACxC;AAEA;AACA,SAAS,WAAW,CAAC,KAA8B,EAAE,MAA+B,EAAA;IAClF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,MAAM,KAAK,SAAS;IACpD,IAAI,MAAM,KAAK,SAAS;AAAE,QAAA,OAAO,IAAI;AACrC,IAAA,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE;QACtB,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;AAAE,YAAA,OAAO,KAAK;IAC1C;AACA,IAAA,OAAO,IAAI;AACb;AAEA;AACM,SAAU,WAAW,CAAC,KAAa,EAAE,MAAc,EAAA;AACvD,IAAA,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;AAC/E;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-common",
3
- "version": "1.19.19",
3
+ "version": "1.20.1",
4
4
  "description": "Platforma SDK Model",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -25,10 +25,10 @@
25
25
  "eslint": "^9.25.1",
26
26
  "typescript": "~5.6.3",
27
27
  "vitest": "^2.1.9",
28
- "@milaboratories/ts-builder": "1.0.5",
29
- "@platforma-sdk/eslint-config": "1.1.0",
30
28
  "@milaboratories/build-configs": "1.0.8",
31
- "@milaboratories/ts-configs": "1.0.6"
29
+ "@milaboratories/ts-builder": "1.0.5",
30
+ "@milaboratories/ts-configs": "1.0.6",
31
+ "@platforma-sdk/eslint-config": "1.1.0"
32
32
  },
33
33
  "scripts": {
34
34
  "type-check": "ts-builder types --target node",
package/src/base64.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { WithImplicitCoercion } from 'node:buffer';
2
+
1
3
  export type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;
2
4
 
3
5
  export type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {
@@ -112,19 +112,33 @@ export function readDomainJson<T extends keyof DomainJson>(
112
112
 
113
113
  /// Well-known annotations
114
114
  export const Annotation = {
115
+ AxisNature: 'pl7.app/axisNature',
115
116
  Alphabet: 'pl7.app/alphabet',
116
117
  Description: 'pl7.app/description',
117
118
  DiscreteValues: 'pl7.app/discreteValues',
118
119
  Format: 'pl7.app/format',
119
120
  Graph: {
121
+ Axis: {
122
+ HighCardinality: 'pl7.app/graph/axis/highCardinality',
123
+ LowerLimit: 'pl7.app/graph/axis/lowerLimit',
124
+ SymmetricRange: 'pl7.app/graph/axis/symmetricRange',
125
+ UpperLimit: 'pl7.app/graph/axis/upperLimit',
126
+ },
127
+ IsDenseAxis: 'pl7.app/graph/isDenseAxis',
120
128
  IsVirtual: 'pl7.app/graph/isVirtual',
129
+ Palette: 'pl7.app/graph/palette',
130
+ Thresholds: 'pl7.app/graph/thresholds',
131
+ TreatAbsentValuesAs: 'pl7.app/graph/treatAbsentValuesAs',
121
132
  },
122
133
  HideDataFromUi: 'pl7.app/hideDataFromUi',
123
134
  HideDataFromGraphs: 'pl7.app/hideDataFromGraphs',
135
+ IsDiscreteFilter: 'pl7.app/isDiscreteFilter',
124
136
  IsLinkerColumn: 'pl7.app/isLinkerColumn',
137
+ IsSubset: 'pl7.app/isSubset',
125
138
  Label: 'pl7.app/label',
126
139
  Max: 'pl7.app/max',
127
140
  Min: 'pl7.app/min',
141
+ MultipliesBy: 'pl7.app/multipliesBy',
128
142
  Parents: 'pl7.app/parents',
129
143
  Sequence: {
130
144
  Annotation: {
@@ -142,16 +156,28 @@ export const Annotation = {
142
156
 
143
157
  export type Annotation = Metadata & Partial<{
144
158
  [Annotation.Alphabet]: 'nucleotide' | 'aminoacid' | string;
159
+ [Annotation.AxisNature]: 'homogeneous' | 'heterogeneous' | 'scaleCompatible' | string;
145
160
  [Annotation.Description]: string;
146
161
  [Annotation.DiscreteValues]: StringifiedJson<number[]> | StringifiedJson<string[]>;
147
162
  [Annotation.Format]: string;
163
+ [Annotation.Graph.Axis.HighCardinality]: StringifiedJson<boolean>;
164
+ [Annotation.Graph.Axis.LowerLimit]: StringifiedJson<number>;
165
+ [Annotation.Graph.Axis.SymmetricRange]: StringifiedJson<boolean>;
166
+ [Annotation.Graph.Axis.UpperLimit]: StringifiedJson<number>;
167
+ [Annotation.Graph.IsDenseAxis]: StringifiedJson<boolean>;
148
168
  [Annotation.Graph.IsVirtual]: StringifiedJson<boolean>;
169
+ [Annotation.Graph.Palette]: StringifiedJson<{ mapping: Record<string, number>; name: string }>;
170
+ [Annotation.Graph.Thresholds]: StringifiedJson<{ columnId: { valueType: ValueType; name: string }; value: number }[]>;
171
+ [Annotation.Graph.TreatAbsentValuesAs]: StringifiedJson<number>;
149
172
  [Annotation.HideDataFromUi]: StringifiedJson<boolean>;
150
173
  [Annotation.HideDataFromGraphs]: StringifiedJson<boolean>;
174
+ [Annotation.IsDiscreteFilter]: StringifiedJson<boolean>;
151
175
  [Annotation.IsLinkerColumn]: StringifiedJson<boolean>;
176
+ [Annotation.IsSubset]: StringifiedJson<boolean>;
152
177
  [Annotation.Label]: string;
153
178
  [Annotation.Max]: StringifiedJson<number>;
154
179
  [Annotation.Min]: StringifiedJson<number>;
180
+ [Annotation.MultipliesBy]: StringifiedJson<AxisSpec['name'][]>;
155
181
  [Annotation.Parents]: StringifiedJson<AxisSpec['name'][]>;
156
182
  [Annotation.Sequence.Annotation.Mapping]: StringifiedJson<Record<string, string>>;
157
183
  [Annotation.Sequence.IsAnnotation]: StringifiedJson<boolean>;
@@ -179,14 +205,32 @@ export type Annotation = Metadata & Partial<{
179
205
  // >>;
180
206
 
181
207
  export type AnnotationJson = MetadataJson<Annotation>;
208
+
209
+ const ValueTypeSchema = z.enum(['Int', 'Long', 'Float', 'Double', 'String'] as const);
182
210
  export const AnnotationJson: AnnotationJson = {
183
211
  [Annotation.DiscreteValues]: z.array(z.string()).or(z.array(z.number())),
212
+ [Annotation.Graph.Axis.HighCardinality]: z.boolean(),
213
+ [Annotation.Graph.Axis.LowerLimit]: z.number(),
214
+ [Annotation.Graph.Axis.UpperLimit]: z.number(),
215
+ [Annotation.Graph.Axis.SymmetricRange]: z.boolean(),
216
+ [Annotation.Graph.IsDenseAxis]: z.boolean(),
217
+ [Annotation.Graph.Palette]: z.object({ mapping: z.record(z.number()), name: z.string() }),
218
+ [Annotation.Graph.Thresholds]: z.array(
219
+ z.object({
220
+ columnId: z.object({ valueType: ValueTypeSchema, name: z.string() }),
221
+ value: z.number(),
222
+ }),
223
+ ),
224
+ [Annotation.Graph.TreatAbsentValuesAs]: z.number(),
184
225
  [Annotation.Graph.IsVirtual]: z.boolean(),
185
226
  [Annotation.HideDataFromUi]: z.boolean(),
186
227
  [Annotation.HideDataFromGraphs]: z.boolean(),
228
+ [Annotation.IsDiscreteFilter]: z.boolean(),
187
229
  [Annotation.IsLinkerColumn]: z.boolean(),
230
+ [Annotation.IsSubset]: z.boolean(),
188
231
  [Annotation.Max]: z.number(),
189
232
  [Annotation.Min]: z.number(),
233
+ [Annotation.MultipliesBy]: z.array(z.string()),
190
234
  [Annotation.Parents]: z.array(z.string()),
191
235
  [Annotation.Sequence.Annotation.Mapping]: z.record(z.string(), z.string()),
192
236
  [Annotation.Sequence.IsAnnotation]: z.boolean(),