@milaboratories/pl-model-common 1.21.4 → 1.21.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/drivers/pframe/pframe.d.ts +2 -2
- package/dist/drivers/pframe/pframe.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
- package/dist/drivers/pframe/spec/spec.d.ts +6 -6
- package/dist/drivers/pframe/spec/spec.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/spec.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/json.cjs +4 -0
- package/dist/json.cjs.map +1 -1
- package/dist/json.d.ts +11 -3
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +4 -1
- package/dist/json.js.map +1 -1
- package/dist/pool/spec.cjs.map +1 -1
- package/dist/pool/spec.d.ts +2 -2
- package/dist/pool/spec.d.ts.map +1 -1
- package/dist/pool/spec.js.map +1 -1
- package/package.json +6 -6
- package/src/drivers/pframe/pframe.ts +2 -2
- package/src/drivers/pframe/spec/spec.ts +6 -6
- package/src/json.ts +28 -14
- package/src/pool/spec.ts +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PObjectId } from '../../pool';
|
|
2
2
|
import type { TableRange } from './data_types';
|
|
3
3
|
import type { FindColumnsRequest, FindColumnsResponse } from './find_columns';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PColumnIdAndSpec, PColumnSpec } from './spec/spec';
|
|
5
5
|
import type { CalculateTableDataRequest, CalculateTableDataResponse } from './table_calculate';
|
|
6
6
|
import type { UniqueValuesRequest, UniqueValuesResponse } from './unique_values';
|
|
7
7
|
/** Read interface exposed by PFrames library */
|
|
@@ -21,5 +21,5 @@ export interface PFrame {
|
|
|
21
21
|
getUniqueValues(request: UniqueValuesRequest): Promise<UniqueValuesResponse>;
|
|
22
22
|
}
|
|
23
23
|
/** Information required to instantiate a PFrame. */
|
|
24
|
-
export type PFrameDef<
|
|
24
|
+
export type PFrameDef<Col> = Col[];
|
|
25
25
|
//# sourceMappingURL=pframe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pframe.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/pframe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"pframe.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/pframe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEjF,gDAAgD;AAChD,MAAM,WAAW,MAAM;IACrB;;;SAGK;IACL,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEvE,kCAAkC;IAClC,aAAa,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEzD,2EAA2E;IAC3E,WAAW,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAE3C,mFAAmF;IACnF,kBAAkB,CAChB,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC,EAC7C,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAEvC,yFAAyF;IACzF,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAC9E;AAED,oDAAoD;AACpD,MAAM,MAAM,SAAS,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -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 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;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;AA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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 type 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 type PUniversalColumnSpec = PObjectSpec & {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: 'PColumn';\n\n /** Type of column values */\n readonly valueType: string;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Any additional information attached to the column that does not affect its\n * identifier */\n readonly annotations?: Record<string, string>;\n\n /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */\n readonly parentAxes?: number[];\n\n /** Axes specifications */\n readonly axesSpec: AxesSpec;\n};\n\n/**\n * Specification of a data column.\n *\n * Data column is a specialized type of PColumn that stores only simple values (strings and numbers)\n * addressed by multiple keys. This is in contrast to other PColumn variants that can store more complex\n * values like files or other abstract data types. Data columns are optimized for storing and processing\n * basic tabular data.\n */\nexport type PDataColumnSpec = PUniversalColumnSpec & {\n /** Type of column values */\n readonly valueType: ValueType;\n};\n\n// @todo: change this to PUniversalColumnSpec\nexport type PColumnSpec = PDataColumnSpec;\n\n/** Unique PColumnSpec identifier */\nexport type PColumnSpecId = {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: 'PColumn';\n\n /** Type of column values */\n readonly valueType: ValueType;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** 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,C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AAA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -140,7 +140,7 @@ export declare function readAnnotationJson<T extends keyof AnnotationJson>(spec:
|
|
|
140
140
|
* Each record inside a PColumn is addressed by a unique tuple of values set for
|
|
141
141
|
* all the axes specified in the column spec.
|
|
142
142
|
*/
|
|
143
|
-
export
|
|
143
|
+
export type AxisSpec = {
|
|
144
144
|
/** Type of the axis value. Should not use non-key types like float or double. */
|
|
145
145
|
readonly type: ValueType;
|
|
146
146
|
/** Name of the axis */
|
|
@@ -170,7 +170,7 @@ export interface AxisSpec {
|
|
|
170
170
|
* in the list that defines the structure of the data model.
|
|
171
171
|
*/
|
|
172
172
|
readonly parentAxes?: number[];
|
|
173
|
-
}
|
|
173
|
+
};
|
|
174
174
|
/** Parents are specs, not indexes; normalized axis can be used considering its parents independently from column */
|
|
175
175
|
export interface AxisSpecNormalized extends Omit<AxisSpec, 'parentAxes'> {
|
|
176
176
|
parentAxesSpec: AxisSpecNormalized[];
|
|
@@ -212,7 +212,7 @@ export declare const PColumnName: {
|
|
|
212
212
|
*
|
|
213
213
|
* Each element in tuple correspond to the axis having the same index in axesSpec.
|
|
214
214
|
*/
|
|
215
|
-
export
|
|
215
|
+
export type PUniversalColumnSpec = PObjectSpec & {
|
|
216
216
|
/** Defines specific type of BObject, the most generic type of unit of
|
|
217
217
|
* information in Platforma Project. */
|
|
218
218
|
readonly kind: 'PColumn';
|
|
@@ -230,7 +230,7 @@ export interface PUniversalColumnSpec extends PObjectSpec {
|
|
|
230
230
|
readonly parentAxes?: number[];
|
|
231
231
|
/** Axes specifications */
|
|
232
232
|
readonly axesSpec: AxesSpec;
|
|
233
|
-
}
|
|
233
|
+
};
|
|
234
234
|
/**
|
|
235
235
|
* Specification of a data column.
|
|
236
236
|
*
|
|
@@ -239,10 +239,10 @@ export interface PUniversalColumnSpec extends PObjectSpec {
|
|
|
239
239
|
* values like files or other abstract data types. Data columns are optimized for storing and processing
|
|
240
240
|
* basic tabular data.
|
|
241
241
|
*/
|
|
242
|
-
export
|
|
242
|
+
export type PDataColumnSpec = PUniversalColumnSpec & {
|
|
243
243
|
/** Type of column values */
|
|
244
244
|
readonly valueType: ValueType;
|
|
245
|
-
}
|
|
245
|
+
};
|
|
246
246
|
export type PColumnSpec = PDataColumnSpec;
|
|
247
247
|
/** Unique PColumnSpec identifier */
|
|
248
248
|
export type PColumnSpecId = {
|
|
@@ -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,K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AAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAElE"}
|
|
@@ -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 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,GA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/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 type 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 type PUniversalColumnSpec = PObjectSpec & {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: 'PColumn';\n\n /** Type of column values */\n readonly valueType: string;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** Any additional information attached to the column that does not affect its\n * identifier */\n readonly annotations?: Record<string, string>;\n\n /** A list of zero-based indices of parent axes from the {@link axesSpec} array. */\n readonly parentAxes?: number[];\n\n /** Axes specifications */\n readonly axesSpec: AxesSpec;\n};\n\n/**\n * Specification of a data column.\n *\n * Data column is a specialized type of PColumn that stores only simple values (strings and numbers)\n * addressed by multiple keys. This is in contrast to other PColumn variants that can store more complex\n * values like files or other abstract data types. Data columns are optimized for storing and processing\n * basic tabular data.\n */\nexport type PDataColumnSpec = PUniversalColumnSpec & {\n /** Type of column values */\n readonly valueType: ValueType;\n};\n\n// @todo: change this to PUniversalColumnSpec\nexport type PColumnSpec = PDataColumnSpec;\n\n/** Unique PColumnSpec identifier */\nexport type PColumnSpecId = {\n /** Defines specific type of BObject, the most generic type of unit of\n * information in Platforma Project. */\n readonly kind: 'PColumn';\n\n /** Type of column values */\n readonly valueType: ValueType;\n\n /** Column name */\n readonly name: string;\n\n /** Adds auxiliary information to the axis name, type and parents to form a\n * unique identifier */\n readonly domain?: Record<string, string>;\n\n /** 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,CA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EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;AACnC,IAAA,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE;AAC7B,IAAA,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,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;;;;"}
|
package/dist/index.cjs
CHANGED
|
@@ -130,6 +130,7 @@ exports.RuntimeCapabilities = flag_utils.RuntimeCapabilities;
|
|
|
130
130
|
exports.checkBlockFlag = flag_utils.checkBlockFlag;
|
|
131
131
|
exports.extractAllRequirements = flag_utils.extractAllRequirements;
|
|
132
132
|
exports.extractAllSupports = flag_utils.extractAllSupports;
|
|
133
|
+
exports.bigintReplacer = json.bigintReplacer;
|
|
133
134
|
exports.canonicalizeJson = json.canonicalizeJson;
|
|
134
135
|
exports.parseJson = json.parseJson;
|
|
135
136
|
exports.stringifyJson = json.stringifyJson;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export { ChunkedStreamReader } from './drivers/ChunkedStreamReader.js';
|
|
|
20
20
|
export { AbortError, PFrameDriverError, PFrameError, UiError, deserializeError, deserializeResult, ensureError, hasAbortError, isAbortError, isAggregateError, isPFrameDriverError, isPFrameError, serializeError, serializeResult, unwrapResult, wrapAndSerialize, wrapAndSerializeAsync, wrapAsyncCallback, wrapCallback } from './errors.js';
|
|
21
21
|
export { AllRequiresFeatureFlags, AllSupportsFeatureFlags } from './flags/block_flags.js';
|
|
22
22
|
export { IncompatibleFlagsError, RuntimeCapabilities, checkBlockFlag, extractAllRequirements, extractAllSupports } from './flags/flag_utils.js';
|
|
23
|
-
export { canonicalizeJson, parseJson, stringifyJson } from './json.js';
|
|
23
|
+
export { bigintReplacer, canonicalizeJson, parseJson, stringifyJson } from './json.js';
|
|
24
24
|
export { DefaultNavigationState } from './navigation.js';
|
|
25
25
|
export { PlId, PlIdBytes, PlIdLength, digestPlId, plId, uniquePlId } from './plid.js';
|
|
26
26
|
export { ensurePColumn, extractAllColumns, isPColumn, isPColumnResult, isPColumnSpec, isPColumnSpecResult, mapPObjectData } from './pool/spec.js';
|
package/dist/json.cjs
CHANGED
|
@@ -11,7 +11,11 @@ function canonicalizeJson(value) {
|
|
|
11
11
|
function parseJson(value) {
|
|
12
12
|
return JSON.parse(value);
|
|
13
13
|
}
|
|
14
|
+
function bigintReplacer(_key, value) {
|
|
15
|
+
return typeof value === 'bigint' ? value.toString() : value;
|
|
16
|
+
}
|
|
14
17
|
|
|
18
|
+
exports.bigintReplacer = bigintReplacer;
|
|
15
19
|
exports.canonicalizeJson = canonicalizeJson;
|
|
16
20
|
exports.parseJson = parseJson;
|
|
17
21
|
exports.stringifyJson = stringifyJson;
|
package/dist/json.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.cjs","sources":["../src/json.ts"],"sourcesContent":["import canonicalize from 'canonicalize';\n\ntype JsonPrimitive = string | number | boolean | null
|
|
1
|
+
{"version":3,"file":"json.cjs","sources":["../src/json.ts"],"sourcesContent":["import canonicalize from 'canonicalize';\n\ntype JsonPrimitive = string | number | boolean | null;\n\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nexport type JsonSerializable =\n | JsonPrimitive\n | JsonSerializable[]\n | { [key: string]: JsonSerializable }\n | { toJSON(): JsonValue };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype NotAssignableToJson = bigint | symbol | Function;\n\nexport type JsonCompatible<T> = unknown extends T ? unknown\n : [T] extends [JsonValue] ? T\n : [T] extends [NotAssignableToJson] ? never\n : {\n [P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue] ? T[P]\n : [Exclude<T[P], undefined>] extends [NotAssignableToJson] ? never\n : JsonCompatible<T[P]>;\n };\n\nexport type StringifiedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {\n __json_stringified: T;\n};\n\nexport function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T>;\nexport function stringifyJson<T extends JsonSerializable>(value: T): string;\nexport function stringifyJson(value: unknown): string {\n return JSON.stringify(value);\n}\n\nexport type CanonicalizedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {\n __json_canonicalized: T;\n};\n\nexport function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;\nexport function canonicalizeJson<T extends JsonSerializable>(value: T): string;\nexport function canonicalizeJson(value: unknown): string {\n return canonicalize(value)!;\n}\n\nexport function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>): T {\n return JSON.parse(value) as T;\n}\n\nexport function bigintReplacer(_key: string, value: unknown): unknown {\n return typeof value === 'bigint' ? value.toString() : value;\n}\n"],"names":[],"mappings":";;;;AA8BM,SAAU,aAAa,CAAC,KAAc,EAAA;AAC1C,IAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAC9B;AAQM,SAAU,gBAAgB,CAAC,KAAc,EAAA;AAC7C,IAAA,OAAO,YAAY,CAAC,KAAK,CAAE;AAC7B;AAEM,SAAU,SAAS,CAAI,KAAgD,EAAA;AAC3E,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAM;AAC/B;AAEM,SAAU,cAAc,CAAC,IAAY,EAAE,KAAc,EAAA;AACzD,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,KAAK;AAC7D;;;;;;;"}
|
package/dist/json.d.ts
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
type JsonPrimitive = string | number | boolean | null
|
|
1
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
2
2
|
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
3
3
|
[key: string]: JsonValue;
|
|
4
4
|
};
|
|
5
|
+
export type JsonSerializable = JsonPrimitive | JsonSerializable[] | {
|
|
6
|
+
[key: string]: JsonSerializable;
|
|
7
|
+
} | {
|
|
8
|
+
toJSON(): JsonValue;
|
|
9
|
+
};
|
|
5
10
|
type NotAssignableToJson = bigint | symbol | Function;
|
|
6
|
-
export type JsonCompatible<T> = unknown extends T ? unknown : {
|
|
7
|
-
[P in keyof T]: T[P] extends JsonValue ? T[P] : T[P] extends NotAssignableToJson ? never : JsonCompatible<T[P]>;
|
|
11
|
+
export type JsonCompatible<T> = unknown extends T ? unknown : [T] extends [JsonValue] ? T : [T] extends [NotAssignableToJson] ? never : {
|
|
12
|
+
[P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue] ? T[P] : [Exclude<T[P], undefined>] extends [NotAssignableToJson] ? never : JsonCompatible<T[P]>;
|
|
8
13
|
};
|
|
9
14
|
export type StringifiedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {
|
|
10
15
|
__json_stringified: T;
|
|
11
16
|
};
|
|
12
17
|
export declare function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T>;
|
|
18
|
+
export declare function stringifyJson<T extends JsonSerializable>(value: T): string;
|
|
13
19
|
export type CanonicalizedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {
|
|
14
20
|
__json_canonicalized: T;
|
|
15
21
|
};
|
|
16
22
|
export declare function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;
|
|
23
|
+
export declare function canonicalizeJson<T extends JsonSerializable>(value: T): string;
|
|
17
24
|
export declare function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>): T;
|
|
25
|
+
export declare function bigintReplacer(_key: string, value: unknown): unknown;
|
|
18
26
|
export {};
|
|
19
27
|
//# sourceMappingURL=json.d.ts.map
|
package/dist/json.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAEA,KAAK,aA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AAa,CAAC,CAAC,SAAS,gBAAgB,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;AAK5E,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,OAAO,IAAI,cAAc,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG;IAC9F,oBAAoB,EAAE,CAAC,CAAC;CACzB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;AACpF,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;AAK/E,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAEhF;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAEpE"}
|
package/dist/json.js
CHANGED
|
@@ -9,6 +9,9 @@ function canonicalizeJson(value) {
|
|
|
9
9
|
function parseJson(value) {
|
|
10
10
|
return JSON.parse(value);
|
|
11
11
|
}
|
|
12
|
+
function bigintReplacer(_key, value) {
|
|
13
|
+
return typeof value === 'bigint' ? value.toString() : value;
|
|
14
|
+
}
|
|
12
15
|
|
|
13
|
-
export { canonicalizeJson, parseJson, stringifyJson };
|
|
16
|
+
export { bigintReplacer, canonicalizeJson, parseJson, stringifyJson };
|
|
14
17
|
//# sourceMappingURL=json.js.map
|
package/dist/json.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sources":["../src/json.ts"],"sourcesContent":["import canonicalize from 'canonicalize';\n\ntype JsonPrimitive = string | number | boolean | null
|
|
1
|
+
{"version":3,"file":"json.js","sources":["../src/json.ts"],"sourcesContent":["import canonicalize from 'canonicalize';\n\ntype JsonPrimitive = string | number | boolean | null;\n\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nexport type JsonSerializable =\n | JsonPrimitive\n | JsonSerializable[]\n | { [key: string]: JsonSerializable }\n | { toJSON(): JsonValue };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype NotAssignableToJson = bigint | symbol | Function;\n\nexport type JsonCompatible<T> = unknown extends T ? unknown\n : [T] extends [JsonValue] ? T\n : [T] extends [NotAssignableToJson] ? never\n : {\n [P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue] ? T[P]\n : [Exclude<T[P], undefined>] extends [NotAssignableToJson] ? never\n : JsonCompatible<T[P]>;\n };\n\nexport type StringifiedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {\n __json_stringified: T;\n};\n\nexport function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T>;\nexport function stringifyJson<T extends JsonSerializable>(value: T): string;\nexport function stringifyJson(value: unknown): string {\n return JSON.stringify(value);\n}\n\nexport type CanonicalizedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {\n __json_canonicalized: T;\n};\n\nexport function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;\nexport function canonicalizeJson<T extends JsonSerializable>(value: T): string;\nexport function canonicalizeJson(value: unknown): string {\n return canonicalize(value)!;\n}\n\nexport function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>): T {\n return JSON.parse(value) as T;\n}\n\nexport function bigintReplacer(_key: string, value: unknown): unknown {\n return typeof value === 'bigint' ? value.toString() : value;\n}\n"],"names":[],"mappings":";;AA8BM,SAAU,aAAa,CAAC,KAAc,EAAA;AAC1C,IAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAC9B;AAQM,SAAU,gBAAgB,CAAC,KAAc,EAAA;AAC7C,IAAA,OAAO,YAAY,CAAC,KAAK,CAAE;AAC7B;AAEM,SAAU,SAAS,CAAI,KAAgD,EAAA;AAC3E,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAM;AAC/B;AAEM,SAAU,cAAc,CAAC,IAAY,EAAE,KAAc,EAAA;AACzD,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,KAAK;AAC7D;;;;"}
|
package/dist/pool/spec.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.cjs","sources":["../../src/pool/spec.ts"],"sourcesContent":["import type { Branded } from '../branding';\nimport type { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\nimport type { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport
|
|
1
|
+
{"version":3,"file":"spec.cjs","sources":["../../src/pool/spec.ts"],"sourcesContent":["import type { Branded } from '../branding';\nimport type { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\nimport type { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport type PObjectSpec = {\n /** PObject kind discriminator */\n readonly kind: string;\n\n /** Name is common part of PObject identity */\n readonly name: string;\n\n /** Domain is a set of key-value pairs that can be used to identify the object */\n readonly domain?: Record<string, string>;\n\n /** Additional information attached to the object */\n readonly annotations?: Record<string, string>;\n};\n\n/** Stable PObject id */\nexport type PObjectId = Branded<string, 'PColumnId'>;\n\n/**\n * Full PObject representation.\n *\n * @template Data type of the object referencing or describing the \"data\" part of the PObject\n * */\nexport interface PObject<Data> {\n /** Fully rendered PObjects are assigned a stable identifier. */\n readonly id: PObjectId;\n\n /** PObject spec, allowing it to be found among other PObjects */\n readonly spec: PObjectSpec;\n\n /** A handle to data object */\n readonly data: Data;\n}\n\nexport function isPColumnSpec(spec: PObjectSpec): spec is PColumnSpec {\n return spec.kind === 'PColumn';\n}\n\nexport function isPColumn<T>(obj: PObject<T>): obj is PColumn<T> {\n return isPColumnSpec(obj.spec);\n}\n\nexport function isPColumnSpecResult(\n r: ResultPoolEntry<PObjectSpec>,\n): r is ResultPoolEntry<PColumnSpec> {\n return isPColumnSpec(r.obj);\n}\n\nexport function isPColumnResult<T>(\n r: ResultPoolEntry<PObject<T>>,\n): r is ResultPoolEntry<PColumn<T>> {\n return isPColumnSpec(r.obj.spec);\n}\n\nexport function ensurePColumn<T>(obj: PObject<T>): PColumn<T> {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n}\n\nexport function mapPObjectData<D1, D2>(pObj: PColumn<D1>, cb: (d: D1) => D2): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | undefined,\n cb: (d: D1) => D2\n): PColumn<D2> | undefined;\nexport function mapPObjectData<D1, D2>(pObj: PObject<D1>, cb: (d: D1) => D2): PObject<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2\n): PObject<D2> | undefined;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined {\n return pObj === undefined\n ? undefined\n : {\n ...pObj,\n data: cb(pObj.data),\n };\n}\n\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case 'column':\n columns.set(entry.column.id, entry.column);\n return;\n case 'slicedColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'artificialColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'inlineColumn':\n return;\n case 'full':\n case 'inner':\n for (const e of entry.entries) addAllColumns(e);\n return;\n case 'outer':\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(e);\n return;\n default:\n assertNever(entry);\n }\n };\n addAllColumns(entry);\n return [...columns.values()];\n}\n"],"names":["assertNever"],"mappings":";;;;AAu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AAC;gBAC1C;AACF,YAAA,KAAK,kBAAkB;AACrB,gBAAA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC;gBAC1C;AACF,YAAA,KAAK,cAAc;gBACjB;AACF,YAAA,KAAK,MAAM;AACX,YAAA,KAAK,OAAO;AACV,gBAAA,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO;oBAAE,aAAa,CAAC,CAAC,CAAC;gBAC/C;AACF,YAAA,KAAK,OAAO;AACV,gBAAA,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC;AAC5B,gBAAA,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS;oBAAE,aAAa,CAAC,CAAC,CAAC;gBACjD;AACF,YAAA;gBACEA,gBAAW,CAAC,KAAK,CAAC;;AAExB,IAAA,CAAC;IACD,aAAa,CAAC,KAAK,CAAC;AACpB,IAAA,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAC9B;;;;;;;;;;"}
|
package/dist/pool/spec.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Branded } from '../branding';
|
|
|
2
2
|
import type { JoinEntry, PColumn, PColumnSpec } from '../drivers';
|
|
3
3
|
import type { ResultPoolEntry } from './entry';
|
|
4
4
|
/** Any object exported into the result pool by the block always have spec attached to it */
|
|
5
|
-
export
|
|
5
|
+
export type PObjectSpec = {
|
|
6
6
|
/** PObject kind discriminator */
|
|
7
7
|
readonly kind: string;
|
|
8
8
|
/** Name is common part of PObject identity */
|
|
@@ -11,7 +11,7 @@ export interface PObjectSpec {
|
|
|
11
11
|
readonly domain?: Record<string, string>;
|
|
12
12
|
/** Additional information attached to the object */
|
|
13
13
|
readonly annotations?: Record<string, string>;
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
15
|
/** Stable PObject id */
|
|
16
16
|
export type PObjectId = Branded<string, 'PColumnId'>;
|
|
17
17
|
/**
|
package/dist/pool/spec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/pool/spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,4FAA4F;AAC5F,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/pool/spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,4FAA4F;AAC5F,MAAM,MAAM,WAAW,GAAG;IACxB,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEzC,oDAAoD;IACpD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/C,CAAC;AAEF,wBAAwB;AACxB,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAErD;;;;KAIK;AACL,MAAM,WAAW,OAAO,CAAC,IAAI;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IAEvB,iEAAiE;IACjE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3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E,EAAE,EAAE,EACnC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,SAAS,EAC7B,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,GAChB,OAAO,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;AAa3B,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CA6B/E"}
|
package/dist/pool/spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.js","sources":["../../src/pool/spec.ts"],"sourcesContent":["import type { Branded } from '../branding';\nimport type { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\nimport type { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport
|
|
1
|
+
{"version":3,"file":"spec.js","sources":["../../src/pool/spec.ts"],"sourcesContent":["import type { Branded } from '../branding';\nimport type { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\nimport type { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport type PObjectSpec = {\n /** PObject kind discriminator */\n readonly kind: string;\n\n /** Name is common part of PObject identity */\n readonly name: string;\n\n /** Domain is a set of key-value pairs that can be used to identify the object */\n readonly domain?: Record<string, string>;\n\n /** Additional information attached to the object */\n readonly annotations?: Record<string, string>;\n};\n\n/** Stable PObject id */\nexport type PObjectId = Branded<string, 'PColumnId'>;\n\n/**\n * Full PObject representation.\n *\n * @template Data type of the object referencing or describing the \"data\" part of the PObject\n * */\nexport interface PObject<Data> {\n /** Fully rendered PObjects are assigned a stable identifier. */\n readonly id: PObjectId;\n\n /** PObject spec, allowing it to be found among other PObjects */\n readonly spec: PObjectSpec;\n\n /** A handle to data object */\n readonly data: Data;\n}\n\nexport function isPColumnSpec(spec: PObjectSpec): spec is PColumnSpec {\n return spec.kind === 'PColumn';\n}\n\nexport function isPColumn<T>(obj: PObject<T>): obj is PColumn<T> {\n return isPColumnSpec(obj.spec);\n}\n\nexport function isPColumnSpecResult(\n r: ResultPoolEntry<PObjectSpec>,\n): r is ResultPoolEntry<PColumnSpec> {\n return isPColumnSpec(r.obj);\n}\n\nexport function isPColumnResult<T>(\n r: ResultPoolEntry<PObject<T>>,\n): r is ResultPoolEntry<PColumn<T>> {\n return isPColumnSpec(r.obj.spec);\n}\n\nexport function ensurePColumn<T>(obj: PObject<T>): PColumn<T> {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n}\n\nexport function mapPObjectData<D1, D2>(pObj: PColumn<D1>, cb: (d: D1) => D2): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | undefined,\n cb: (d: D1) => D2\n): PColumn<D2> | undefined;\nexport function mapPObjectData<D1, D2>(pObj: PObject<D1>, cb: (d: D1) => D2): PObject<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2\n): PObject<D2> | undefined;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined {\n return pObj === undefined\n ? undefined\n : {\n ...pObj,\n data: cb(pObj.data),\n };\n}\n\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case 'column':\n columns.set(entry.column.id, entry.column);\n return;\n case 'slicedColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'artificialColumn':\n columns.set(entry.column.id, entry.column);\n return;\n case 'inlineColumn':\n return;\n case 'full':\n case 'inner':\n for (const e of entry.entries) addAllColumns(e);\n return;\n case 'outer':\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(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BAAA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC;gBAC1C;AACF,YAAA,KAAK,kBAAkB;AACrB,gBAAA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC;gBAC1C;AACF,YAAA,KAAK,cAAc;gBACjB;AACF,YAAA,KAAK,MAAM;AACX,YAAA,KAAK,OAAO;AACV,gBAAA,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO;oBAAE,aAAa,CAAC,CAAC,CAAC;gBAC/C;AACF,YAAA,KAAK,OAAO;AACV,gBAAA,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC;AAC5B,gBAAA,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS;oBAAE,aAAa,CAAC,CAAC,CAAC;gBACjD;AACF,YAAA;gBACE,WAAW,CAAC,KAAK,CAAC;;AAExB,IAAA,CAAC;IACD,aAAa,CAAC,KAAK,CAAC;AACpB,IAAA,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAC9B;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-model-common",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.5",
|
|
4
4
|
"description": "Platforma SDK Model",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"eslint": "^9.25.1",
|
|
26
26
|
"typescript": "~5.6.3",
|
|
27
|
-
"vitest": "^
|
|
28
|
-
"@milaboratories/build-configs": "1.0.8",
|
|
29
|
-
"@milaboratories/ts-builder": "1.0.5",
|
|
27
|
+
"vitest": "^4.0.7",
|
|
30
28
|
"@platforma-sdk/eslint-config": "1.1.0",
|
|
31
|
-
"@milaboratories/ts-configs": "1.0.6"
|
|
29
|
+
"@milaboratories/ts-configs": "1.0.6",
|
|
30
|
+
"@milaboratories/build-configs": "1.0.8",
|
|
31
|
+
"@milaboratories/ts-builder": "1.0.5"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"type-check": "ts-builder types --target node",
|
|
35
35
|
"build": "ts-builder build --target node",
|
|
36
36
|
"watch": "ts-builder build --target node --watch",
|
|
37
37
|
"lint": "eslint .",
|
|
38
|
-
"test": "vitest",
|
|
38
|
+
"test": "vitest run",
|
|
39
39
|
"do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PObjectId } from '../../pool';
|
|
2
2
|
import type { TableRange } from './data_types';
|
|
3
3
|
import type { FindColumnsRequest, FindColumnsResponse } from './find_columns';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PColumnIdAndSpec, PColumnSpec } from './spec/spec';
|
|
5
5
|
import type {
|
|
6
6
|
CalculateTableDataRequest,
|
|
7
7
|
CalculateTableDataResponse,
|
|
@@ -33,4 +33,4 @@ export interface PFrame {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/** Information required to instantiate a PFrame. */
|
|
36
|
-
export type PFrameDef<
|
|
36
|
+
export type PFrameDef<Col> = Col[];
|
|
@@ -270,7 +270,7 @@ export function readAnnotationJson<T extends keyof AnnotationJson>(
|
|
|
270
270
|
* Each record inside a PColumn is addressed by a unique tuple of values set for
|
|
271
271
|
* all the axes specified in the column spec.
|
|
272
272
|
*/
|
|
273
|
-
export
|
|
273
|
+
export type AxisSpec = {
|
|
274
274
|
/** Type of the axis value. Should not use non-key types like float or double. */
|
|
275
275
|
readonly type: ValueType;
|
|
276
276
|
|
|
@@ -304,7 +304,7 @@ export interface AxisSpec {
|
|
|
304
304
|
* in the list that defines the structure of the data model.
|
|
305
305
|
*/
|
|
306
306
|
readonly parentAxes?: number[];
|
|
307
|
-
}
|
|
307
|
+
};
|
|
308
308
|
|
|
309
309
|
/** Parents are specs, not indexes; normalized axis can be used considering its parents independently from column */
|
|
310
310
|
export interface AxisSpecNormalized extends Omit<AxisSpec, 'parentAxes'> {
|
|
@@ -512,7 +512,7 @@ export const PColumnName = {
|
|
|
512
512
|
*
|
|
513
513
|
* Each element in tuple correspond to the axis having the same index in axesSpec.
|
|
514
514
|
*/
|
|
515
|
-
export
|
|
515
|
+
export type PUniversalColumnSpec = PObjectSpec & {
|
|
516
516
|
/** Defines specific type of BObject, the most generic type of unit of
|
|
517
517
|
* information in Platforma Project. */
|
|
518
518
|
readonly kind: 'PColumn';
|
|
@@ -536,7 +536,7 @@ export interface PUniversalColumnSpec extends PObjectSpec {
|
|
|
536
536
|
|
|
537
537
|
/** Axes specifications */
|
|
538
538
|
readonly axesSpec: AxesSpec;
|
|
539
|
-
}
|
|
539
|
+
};
|
|
540
540
|
|
|
541
541
|
/**
|
|
542
542
|
* Specification of a data column.
|
|
@@ -546,10 +546,10 @@ export interface PUniversalColumnSpec extends PObjectSpec {
|
|
|
546
546
|
* values like files or other abstract data types. Data columns are optimized for storing and processing
|
|
547
547
|
* basic tabular data.
|
|
548
548
|
*/
|
|
549
|
-
export
|
|
549
|
+
export type PDataColumnSpec = PUniversalColumnSpec & {
|
|
550
550
|
/** Type of column values */
|
|
551
551
|
readonly valueType: ValueType;
|
|
552
|
-
}
|
|
552
|
+
};
|
|
553
553
|
|
|
554
554
|
// @todo: change this to PUniversalColumnSpec
|
|
555
555
|
export type PColumnSpec = PDataColumnSpec;
|
package/src/json.ts
CHANGED
|
@@ -1,37 +1,51 @@
|
|
|
1
1
|
import canonicalize from 'canonicalize';
|
|
2
2
|
|
|
3
|
-
type JsonPrimitive = string | number | boolean | null
|
|
3
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
4
4
|
|
|
5
|
-
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };
|
|
6
|
+
|
|
7
|
+
export type JsonSerializable =
|
|
8
|
+
| JsonPrimitive
|
|
9
|
+
| JsonSerializable[]
|
|
10
|
+
| { [key: string]: JsonSerializable }
|
|
11
|
+
| { toJSON(): JsonValue };
|
|
8
12
|
|
|
9
13
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
10
14
|
type NotAssignableToJson = bigint | symbol | Function;
|
|
11
15
|
|
|
12
|
-
export type JsonCompatible<T> = unknown extends T ? unknown
|
|
13
|
-
[
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
export type JsonCompatible<T> = unknown extends T ? unknown
|
|
17
|
+
: [T] extends [JsonValue] ? T
|
|
18
|
+
: [T] extends [NotAssignableToJson] ? never
|
|
19
|
+
: {
|
|
20
|
+
[P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue] ? T[P]
|
|
21
|
+
: [Exclude<T[P], undefined>] extends [NotAssignableToJson] ? never
|
|
22
|
+
: JsonCompatible<T[P]>;
|
|
23
|
+
};
|
|
18
24
|
|
|
19
25
|
export type StringifiedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {
|
|
20
26
|
__json_stringified: T;
|
|
21
27
|
};
|
|
22
28
|
|
|
23
|
-
export function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T
|
|
24
|
-
|
|
29
|
+
export function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T>;
|
|
30
|
+
export function stringifyJson<T extends JsonSerializable>(value: T): string;
|
|
31
|
+
export function stringifyJson(value: unknown): string {
|
|
32
|
+
return JSON.stringify(value);
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
export type CanonicalizedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {
|
|
28
36
|
__json_canonicalized: T;
|
|
29
37
|
};
|
|
30
38
|
|
|
31
|
-
export function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T
|
|
32
|
-
|
|
39
|
+
export function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;
|
|
40
|
+
export function canonicalizeJson<T extends JsonSerializable>(value: T): string;
|
|
41
|
+
export function canonicalizeJson(value: unknown): string {
|
|
42
|
+
return canonicalize(value)!;
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
export function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>): T {
|
|
36
46
|
return JSON.parse(value) as T;
|
|
37
47
|
}
|
|
48
|
+
|
|
49
|
+
export function bigintReplacer(_key: string, value: unknown): unknown {
|
|
50
|
+
return typeof value === 'bigint' ? value.toString() : value;
|
|
51
|
+
}
|
package/src/pool/spec.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { assertNever } from '../util';
|
|
|
4
4
|
import type { ResultPoolEntry } from './entry';
|
|
5
5
|
|
|
6
6
|
/** Any object exported into the result pool by the block always have spec attached to it */
|
|
7
|
-
export
|
|
7
|
+
export type PObjectSpec = {
|
|
8
8
|
/** PObject kind discriminator */
|
|
9
9
|
readonly kind: string;
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ export interface PObjectSpec {
|
|
|
16
16
|
|
|
17
17
|
/** Additional information attached to the object */
|
|
18
18
|
readonly annotations?: Record<string, string>;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
|
|
21
21
|
/** Stable PObject id */
|
|
22
22
|
export type PObjectId = Branded<string, 'PColumnId'>;
|