@milaboratories/pl-model-common 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,8 @@ export interface ColumnFilter {
7
7
  /** Match any of the names listed here. If undefined, will be ignored during
8
8
  * matching. */
9
9
  readonly name?: string[];
10
+ /** Match requires all the domains listed here to have corresponding values. */
11
+ readonly domainValue?: Record<string, string>;
10
12
  /** Match requires all the annotations listed here to have corresponding values. */
11
13
  readonly annotationValue?: Record<string, string>;
12
14
  /** Match requires all the annotations listed here to match corresponding regex
@@ -1 +1 @@
1
- {"version":3,"file":"column_filter.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/column_filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B;mBACe;IACf,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IAE5B;mBACe;IACf,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEzB,mFAAmF;IACnF,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElD;kBACc;IACd,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrD"}
1
+ {"version":3,"file":"column_filter.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/column_filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B;mBACe;IACf,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IAE5B;mBACe;IACf,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEvB,+EAA+E;IACjF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9C,mFAAmF;IACnF,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElD;kBACc;IACd,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrD"}
@@ -169,24 +169,6 @@ export interface SingleValueStringIContainsFuzzyPredicate {
169
169
  */
170
170
  readonly wildcard?: string;
171
171
  }
172
- export interface SingleValueNotPredicate {
173
- /** Comparison operator */
174
- readonly operator: 'Not';
175
- /** Operand to negate */
176
- readonly operand: SingleValuePredicate;
177
- }
178
- export interface SingleValueAndPredicate {
179
- /** Comparison operator */
180
- readonly operator: 'And';
181
- /** Operands to combine */
182
- readonly operands: SingleValuePredicate[];
183
- }
184
- export interface SingleValueOrPredicate {
185
- /** Comparison operator */
186
- readonly operator: 'Or';
187
- /** Operands to combine */
188
- readonly operands: SingleValuePredicate[];
189
- }
190
172
  export interface SingleValueNotPredicateV2 {
191
173
  /** Comparison operator */
192
174
  readonly operator: 'Not';
@@ -206,22 +188,7 @@ export interface SingleValueOrPredicateV2 {
206
188
  readonly operands: SingleValuePredicateV2[];
207
189
  }
208
190
  /** Filtering predicate for a single axis or column value */
209
- export type SingleValuePredicate = SingleValueIsNAPredicate | SingleValueEqualPredicate | SingleValueLessPredicate | SingleValueLessOrEqualPredicate | SingleValueGreaterPredicate | SingleValueGreaterOrEqualPredicate | SingleValueStringContainsPredicate | SingleValueMatchesPredicate | SingleValueStringContainsFuzzyPredicate | SingleValueNotPredicate | SingleValueAndPredicate | SingleValueOrPredicate;
210
191
  export type SingleValuePredicateV2 = SingleValueIsNAPredicate | SingleValueEqualPredicate | SingleValueLessPredicate | SingleValueLessOrEqualPredicate | SingleValueGreaterPredicate | SingleValueGreaterOrEqualPredicate | SingleValueStringContainsPredicate | SingleValueMatchesPredicate | SingleValueStringContainsFuzzyPredicate | SingleValueNotPredicateV2 | SingleValueAndPredicateV2 | SingleValueOrPredicateV2 | SingleValueIEqualPredicate | SingleValueStringIContainsPredicate | SingleValueStringIContainsFuzzyPredicate;
211
- /**
212
- * Filter PTable records based on specific axis or column value. If this is an
213
- * axis value filter and the axis is part of a partitioning key in some of the
214
- * source PColumns, the filter will be pushed down to those columns, so only
215
- * specific partitions will be retrieved from the remote storage.
216
- * */
217
- export interface PTableRecordSingleValueFilter {
218
- /** Filter type discriminator */
219
- readonly type: 'bySingleColumn';
220
- /** Target axis selector to examine values from */
221
- readonly column: PTableColumnId;
222
- /** Value predicate */
223
- readonly predicate: SingleValuePredicate;
224
- }
225
192
  /**
226
193
  * Filter PTable records based on specific axis or column value. If this is an
227
194
  * axis value filter and the axis is part of a partitioning key in some of the
@@ -237,7 +204,7 @@ export interface PTableRecordSingleValueFilterV2 {
237
204
  readonly predicate: SingleValuePredicateV2;
238
205
  }
239
206
  /** Generic PTable records filter */
240
- export type PTableRecordFilter = PTableRecordSingleValueFilter | PTableRecordSingleValueFilterV2;
207
+ export type PTableRecordFilter = PTableRecordSingleValueFilterV2;
241
208
  /** Sorting parameters for a PTable. */
242
209
  export type PTableSorting = {
243
210
  /** Unified column identifier */
@@ -1 +1 @@
1
- {"version":3,"file":"table_calculate.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/table_calculate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,8DAA8D;AAC9D,MAAM,WAAW,eAAe,CAAC,GAAG;IAClC,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAExB,mBAAmB;IACnB,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC;CACtB;AAED;;;KAGK;AACL,MAAM,WAAW,SAAS,CAAC,GAAG;IAC5B,8BAA8B;I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oD;AACpD,MAAM,WAAW,SAAS,CAAC,GAAG;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;IAE7B,qBAAqB;IACrB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAEvC,oBAAoB;IACpB,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC;CACnC;AAED,iEAAiE;AACjE,MAAM,MAAM,yBAAyB,CAAC,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC;AAE5D,qDAAqD;AACrD,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,EAAE,CAAC;AAEhE,wBAAgB,YAAY,CAAC,EAAE,EAAE,EAAE,EACjC,GAAG,EAAE,SAAS,CAAC,EAAE,CAAC,EAClB,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,GAChB,SAAS,CAAC,EAAE,CAAC,CAEf;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,EAAE,EACjC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC,EACpB,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,GAChB,SAAS,CAAC,EAAE,CAAC,CAsBf"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/drivers/log.ts","../src/util.ts","../src/drivers/ls.ts","../src/drivers/pframe/data.ts","../src/drivers/pframe/spec.ts","../src/drivers/pframe/table_calculate.ts","../src/navigation.ts","../src/ref.ts","../src/pool/spec.ts","../src/pool/query.ts","../src/value_or_error.ts"],"sourcesContent":["/** Handle of logs. This handle should be passed\n * to the driver for retrieving logs. */\nexport type AnyLogHandle = LiveLogHandle | ReadyLogHandle;\n\n/** Handle of the live logs of a program.\n * The resource that represents a log can be deleted,\n * in this case the handle should be refreshed. */\nexport type LiveLogHandle = `log+live://log/${string}`;\n\n/** Handle of the ready logs of a program. */\nexport type ReadyLogHandle = `log+ready://log/${string}`;\n\n/** Type guard to check if log is live, and corresponding porcess is not finished. */\nexport function isLiveLog(handle: AnyLogHandle | undefined): handle is LiveLogHandle {\n return handle !== undefined && handle.startsWith('log+live://log/');\n}\n\n/** Driver to retrieve logs given log handle */\nexport interface LogsDriver {\n lastLines(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined, then starts from the end. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string\n ): Promise<StreamingApiResponse>;\n\n readText(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined of 0, then starts from the beginning. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string\n ): Promise<StreamingApiResponse>;\n}\n\n/** Response of the driver.\n * The caller should give a handle to retrieve it.\n * It can be OK or outdated, in which case the handle\n * should be issued again. */\nexport type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;\n\nexport type StreamingApiResponseOk = {\n /** The handle don't have to be updated,\n * the response is OK. */\n shouldUpdateHandle: false;\n\n /** Whether the log can still grow or it's in a final state. */\n live: boolean;\n\n /** Data of the response, in bytes. */\n data: Uint8Array;\n /** Current size of the file. It can grow if it's still live. */\n size: number;\n /** Offset in bytes from the beginning of a file. */\n newOffset: number;\n};\n\n/** The handle should be issued again, this one is done. */\nexport type StreamingApiResponseHandleOutdated = {\n shouldUpdateHandle: true;\n};\n","export function assertNever(x: never): never {\n throw new Error('Unexpected object: ' + x);\n}\n","import { assertNever } from '../util';\nimport { Branded } from '../branding';\nimport { TableRange } from './pframe';\nimport { FileLike } from './interfaces';\n\nconst uploadPrefix = 'upload://upload/';\nconst indexPrefix = 'index://index/';\n\nexport type ImportFileHandleUpload = `upload://upload/${string}`;\nexport type ImportFileHandleIndex = `index://index/${string}`;\n\nexport type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;\n\nexport type LocalImportFileHandle = Branded<ImportFileHandle, 'Local'>;\n\nexport function isImportFileHandleUpload(\n handle: ImportFileHandle\n): handle is ImportFileHandleUpload {\n return handle.startsWith(uploadPrefix);\n}\n\nexport function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex {\n return handle.startsWith(indexPrefix);\n}\n\n/** Results in upload */\nexport type StorageHandleLocal = `local://${string}`;\n\n/** Results in index */\nexport type StorageHandleRemote = `remote://${string}`;\n\nexport type StorageHandle = StorageHandleLocal | StorageHandleRemote;\n\nexport type StorageEntry = {\n name: string;\n handle: StorageHandle;\n initialFullPath: string;\n\n // TODO\n // pathStartsWithDisk\n};\n\nexport type ListFilesResult = {\n parent?: string;\n entries: LsEntry[];\n};\n\nexport type LsEntry =\n | {\n type: 'dir';\n name: string;\n fullPath: string;\n }\n | {\n type: 'file';\n name: string;\n fullPath: string;\n\n /** This handle should be set to args... */\n handle: ImportFileHandle;\n };\n\nexport type OpenDialogFilter = {\n /** Human-readable file type name */\n readonly name: string;\n /** File extensions */\n readonly extensions: string[];\n};\n\nexport type OpenDialogOps = {\n /** Open dialog window title */\n readonly title?: string;\n /** Custom label for the confirmation button, when left empty the default label will be used. */\n readonly buttonLabel?: string;\n /** Limits of file types user can select */\n readonly filters?: OpenDialogFilter[];\n};\n\nexport type OpenSingleFileResponse = {\n /** Contains local file handle, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly file?: LocalImportFileHandle;\n};\n\nexport type OpenMultipleFilesResponse = {\n /** Contains local file handles, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly files?: LocalImportFileHandle[];\n};\n\n/** Can be used to limit request for local file content to a certain bytes range */\nexport type FileRange = {\n /** From byte index (inclusive) */\n readonly from: number;\n /** To byte index (exclusive) */\n readonly to: number;\n};\n\nexport interface LsDriver {\n /** remote and local storages */\n getStorageList(): Promise<StorageEntry[]>;\n\n listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;\n\n /** Opens system file open dialog allowing to select single file and awaits user action */\n showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;\n\n /** Opens system file open dialog allowing to multiple files and awaits user action */\n showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;\n\n /** Given a handle to a local file, allows to get file size */\n getLocalFileSize(file: LocalImportFileHandle): Promise<number>;\n\n /** Given a handle to a local file, allows to get its content */\n getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;\n\n /**\n * Resolves browser's File object into platforma's import file handle.\n *\n * This method is useful among other things for implementation of UI\n * components, that handle file Drag&Drop.\n * */\n fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;\n}\n\n/** Gets a file path from an import handle. */\nexport function getFilePathFromHandle(handle: ImportFileHandle): string {\n if (isImportFileHandleIndex(handle)) {\n const trimmed = handle.slice(indexPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed));\n return data.path;\n } else if (isImportFileHandleUpload(handle)) {\n const trimmed = handle.slice(uploadPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed));\n return data.localPath;\n }\n\n assertNever(handle);\n}\n\nfunction extractFileName(filePath: string) {\n return filePath.replace(/^.*[\\\\/]/, '');\n}\n\n/** Gets a file name from an import handle. */\nexport function getFileNameFromHandle(handle: ImportFileHandle): string {\n return extractFileName(getFilePathFromHandle(handle));\n}\n","import { ValueType } from './spec';\n\nexport const PValueIntNA = -2147483648;\nexport const PValueLongNA = -9007199254740991n;\nexport const PValueFloatNA = NaN;\nexport const PValueDoubleNA = NaN;\nexport const PValueStringNA = null;\nexport const PValueBytesNA = null;\n\nexport type PValueInt = number;\nexport type PValueLong = number | bigint; // use bigint only if extra integer precision is needed\nexport type PValueFloat = number;\nexport type PValueDouble = number;\nexport type PValueString = string | null;\nexport type PValueBytes = Uint8Array | null;\n\nexport type PValue =\n | PValueInt\n | PValueLong\n | PValueFloat\n | PValueDouble\n | PValueString\n | PValueBytes;\n\nexport function isValueNA(value: unknown, valueType: ValueType): boolean {\n switch (valueType) {\n case 'Int':\n return value === PValueIntNA;\n case 'Long':\n return value === Number(PValueLongNA) || value === PValueLongNA;\n case 'Float':\n return value === PValueFloatNA;\n case 'Double':\n return value === PValueDoubleNA;\n case 'String':\n return value === PValueStringNA;\n case 'Bytes':\n return value === PValueBytesNA;\n default:\n throw Error(`unsupported data type: ${valueType satisfies never}`);\n }\n}\n\nexport type PVectorDataInt = Int32Array;\nexport type PVectorDataLong = BigInt64Array;\nexport type PVectorDataFloat = Float32Array;\nexport type PVectorDataDouble = Float64Array;\nexport type PVectorDataString = PValueString[];\nexport type PVectorDataBytes = PValueBytes[];\n\nexport type PVectorData =\n | PVectorDataInt\n | PVectorDataLong\n | PVectorDataFloat\n | PVectorDataDouble\n | PVectorDataString\n | PVectorDataBytes;\n\n/** Table column data in comparison to the data stored in a separate PColumn\n * may have some of the values \"absent\", i.e. as a result of missing record in\n * outer join operation. This information is encoded in {@link absent} field. */\nexport interface PTableVector {\n /** Stored data type */\n readonly type: ValueType;\n\n /** Values for present positions, absent positions have NA values */\n readonly data: PVectorData;\n\n /**\n * Encoded bit array marking some elements of this vector as absent,\n * call {@link isValueAbsent} to read the data.\n * */\n readonly absent: Uint8Array;\n}\n\n/** Used to read bit array with value absence information */\nexport function isValueAbsent(absent: Uint8Array, index: number): boolean {\n const chunkIndex = Math.floor(index / 8);\n const mask = 1 << (7 - (index % 8));\n return (absent[chunkIndex] & mask) > 0;\n}\n\n/** Used in requests to partially retrieve table's data */\nexport type TableRange = {\n /** Index of the first record to retrieve */\n readonly offset: number;\n\n /** Block length */\n readonly length: number;\n};\n\n/** Unified information about table shape */\nexport type PTableShape = {\n /** Number of unified table columns, including all axes and PColumn values */\n columns: number;\n\n /** Number of rows */\n rows: number;\n};\n","import { PObject, PObjectId, PObjectSpec } from '../../pool';\n\n/** PFrame columns and axes within them may store one of these types. */\nexport type ValueType = 'Int' | 'Long' | 'Float' | 'Double' | 'String' | 'Bytes';\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/** Common type representing spec for all the axes in a column */\nexport type AxesSpec = AxisSpec[];\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 PColumnSpec 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: 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 /** 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\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/** 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 return { type, name, ...(domain && { domain }) };\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/** 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","import { PTableColumnId, PTableColumnSpec } from './table_common';\nimport { PTableVector } from './data';\nimport { assertNever } from '../../util';\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'column';\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: 'inner';\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: 'full';\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: 'outer';\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: 'IsNA';\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: 'Equal';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'IEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: 'Less';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'LessOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: 'Greater';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'GreaterOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: 'StringContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: 'Matches';\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: 'StringContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicate {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicate;\n}\n\nexport interface SingleValueAndPredicate {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicate[];\n}\n\nexport interface SingleValueOrPredicate {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicate[];\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicate =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicate\n | SingleValueAndPredicate\n | SingleValueOrPredicate;\n\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilter {\n /** Filter type discriminator */\n readonly type: 'bySingleColumn';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicate;\n}\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: 'bySingleColumnV2';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilter | PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = PTableDef<Col>;\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(\n def: PTableDef<C1>,\n cb: (c: C1) => C2\n): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(\n entry: JoinEntry<C1>,\n cb: (c: C1) => C2\n): JoinEntry<C2> {\n switch (entry.type) {\n case 'column':\n return {\n type: 'column',\n column: cb(entry.column)\n };\n case 'inner':\n case 'full':\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb))\n };\n case 'outer':\n return {\n type: 'outer',\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb))\n };\n default:\n assertNever(entry);\n }\n}\n","/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: 'link';\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n};\n\n/** Create a horisontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: 'delimiter';\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n * */\nexport type NavigationState<Href extends `/${string}` = `/${string}`> = {\n readonly href: Href;\n};\n\nexport const DefaultNavigationState: NavigationState = { href: '/' };\n","import { z } from 'zod';\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe('Crucial marker for the block dependency tree reconstruction'),\n blockId: z.string().describe('Upstream block id'),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\")\n })\n .describe(\n 'Universal reference type, allowing to set block connections. It is crucial that ' +\n '{@link __isRef} is present and equal to true, internal logic relies on this marker ' +\n 'to build block dependency trees.'\n )\n .strict()\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef) {\n return ref1.blockId === ref2.blockId && ref1.name === ref2.name;\n}\n","import { Branded } from '../branding';\nimport { PColumn, PColumnSpec } from '../drivers';\nimport { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport interface PObjectSpec {\n /** PObject kind discriminator */\n readonly kind: 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","import { AxisId } from '../drivers';\nimport { PObjectSpec, isPColumnSpec } from './spec';\n\nexport type PSpecPredicate =\n | {\n type: 'and' | 'or';\n operands: PSpecPredicate[];\n }\n | {\n type: 'not';\n operand: PSpecPredicate;\n }\n | {\n type: 'name';\n name: string;\n }\n | {\n type: 'name_pattern';\n pattern: string;\n }\n | {\n type: 'annotation';\n annotation: string;\n value: string;\n }\n | {\n type: 'annotation_pattern';\n annotation: string;\n pattern: string;\n }\n | {\n type: 'has_axes';\n axes: Partial<AxisId>[];\n };\n\nfunction assertNever(x: never): never {\n throw new Error('Unexpected object: ' + x);\n}\n\nexport function executePSpecPredicate(\n predicate: PSpecPredicate,\n spec: PObjectSpec\n): boolean {\n switch (predicate.type) {\n case 'and':\n for (const operator of predicate.operands)\n if (!executePSpecPredicate(operator, spec)) return false;\n return true;\n case 'or':\n for (const operator of predicate.operands)\n if (executePSpecPredicate(operator, spec)) return true;\n return false;\n case 'not':\n return !executePSpecPredicate(predicate.operand, spec);\n case 'name':\n return isPColumnSpec(spec) && spec.name === predicate.name;\n case 'name_pattern':\n return isPColumnSpec(spec) && Boolean(spec.name.match(predicate.pattern));\n case 'annotation':\n return (\n isPColumnSpec(spec) &&\n spec.annotations !== undefined &&\n spec.annotations[predicate.annotation] === predicate.value\n );\n case 'annotation_pattern':\n return (\n isPColumnSpec(spec) &&\n spec.annotations !== undefined &&\n spec.annotations[predicate.annotation] !== undefined &&\n Boolean(spec.annotations[predicate.annotation].match(predicate.pattern))\n );\n case 'has_axes':\n return (\n isPColumnSpec(spec) &&\n predicate.axes.every((matcher) =>\n spec.axesSpec.some(\n (axisSpec) =>\n (matcher.type === undefined || matcher.type === axisSpec.type) &&\n (matcher.name === undefined || matcher.name === axisSpec.name) &&\n (matcher.domain === undefined ||\n Object.keys(matcher.domain).length === 0 ||\n (axisSpec.domain !== undefined &&\n Object.entries(matcher.domain).every(\n ([domain, domainValue]) =>\n axisSpec.domain![domain] === domainValue\n )))\n )\n )\n );\n default:\n assertNever(predicate);\n }\n}\n","export type ValueOrError<V, E> =\n | {\n ok: true;\n value: V;\n }\n | {\n ok: false;\n error: E;\n };\n\nexport function mapValueInVOE<V1, V2, E>(\n voe: ValueOrError<V1, E>,\n cb: (value: V1) => V2\n): ValueOrError<V2, E> {\n return voe.ok ? { ok: true, value: cb(voe.value) } : voe;\n}\n"],"names":["isLiveLog","handle","assertNever","x","uploadPrefix","indexPrefix","isImportFileHandleUpload","isImportFileHandleIndex","getFilePathFromHandle","trimmed","extractFileName","filePath","getFileNameFromHandle","PValueIntNA","PValueLongNA","PValueFloatNA","PValueDoubleNA","PValueStringNA","PValueBytesNA","isValueNA","value","valueType","isValueAbsent","absent","index","chunkIndex","mask","getAxisId","spec","type","name","domain","getAxesId","matchDomain","query","target","k","matchAxisId","mapPTableDef","def","cb","mapJoinEntry","entry","col","DefaultNavigationState","PlRef","z","plRefsEqual","ref1","ref2","isPColumnSpec","isPColumn","obj","isPColumnSpecResult","r","isPColumnResult","ensurePColumn","mapPObjectData","pObj","executePSpecPredicate","predicate","operator","matcher","axisSpec","domainValue","mapValueInVOE","voe"],"mappings":"uGAaO,SAASA,EAAUC,EAA2D,CACnF,OAAOA,IAAW,QAAaA,EAAO,WAAW,iBAAiB,CACpE,CCfO,SAASC,EAAYC,EAAiB,CACrC,MAAA,IAAI,MAAM,sBAAwBA,CAAC,CAC3C,CCGA,MAAMC,EAAe,mBACfC,EAAc,iBASb,SAASC,EACdL,EACkC,CAC3B,OAAAA,EAAO,WAAWG,CAAY,CACvC,CAEO,SAASG,EAAwBN,EAA2D,CAC1F,OAAAA,EAAO,WAAWI,CAAW,CACtC,CAuGO,SAASG,EAAsBP,EAAkC,CAClE,GAAAM,EAAwBN,CAAM,EAAG,CACnC,MAAMQ,EAAUR,EAAO,MAAMI,EAAY,MAAM,EAE/C,OADa,KAAK,MAAM,mBAAmBI,CAAO,CAAC,EACvC,IAAA,SACHH,EAAyBL,CAAM,EAAG,CAC3C,MAAMQ,EAAUR,EAAO,MAAMG,EAAa,MAAM,EAEhD,OADa,KAAK,MAAM,mBAAmBK,CAAO,CAAC,EACvC,SAAA,CAGdP,EAAYD,CAAM,CACpB,CAEA,SAASS,EAAgBC,EAAkB,CAClC,OAAAA,EAAS,QAAQ,WAAY,EAAE,CACxC,CAGO,SAAS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E,SAAW,GACtCC,EAAS,SAAW,QACnB,OAAO,QAAQD,EAAQ,MAAM,EAAE,MAC7B,CAAC,CAAC/B,EAAQiC,CAAW,IACnBD,EAAS,OAAQhC,CAAM,IAAMiC,CACjC,EAAA,CAEV,EAEJ,QACE9D,EAAY0D,CAAS,CAAA,CAE3B,CClFgB,SAAAK,EACdC,EACA1B,EACqB,CACd,OAAA0B,EAAI,GAAK,CAAE,GAAI,GAAM,MAAO1B,EAAG0B,EAAI,KAAK,CAAA,EAAMA,CACvD"}
1
+ {"version":3,"file":"index.js","sources":["../src/drivers/log.ts","../src/util.ts","../src/drivers/ls.ts","../src/drivers/pframe/data.ts","../src/drivers/pframe/spec.ts","../src/drivers/pframe/table_calculate.ts","../src/navigation.ts","../src/ref.ts","../src/pool/spec.ts","../src/pool/query.ts","../src/value_or_error.ts"],"sourcesContent":["/** Handle of logs. This handle should be passed\n * to the driver for retrieving logs. */\nexport type AnyLogHandle = LiveLogHandle | ReadyLogHandle;\n\n/** Handle of the live logs of a program.\n * The resource that represents a log can be deleted,\n * in this case the handle should be refreshed. */\nexport type LiveLogHandle = `log+live://log/${string}`;\n\n/** Handle of the ready logs of a program. */\nexport type ReadyLogHandle = `log+ready://log/${string}`;\n\n/** Type guard to check if log is live, and corresponding porcess is not finished. */\nexport function isLiveLog(handle: AnyLogHandle | undefined): handle is LiveLogHandle {\n return handle !== undefined && handle.startsWith('log+live://log/');\n}\n\n/** Driver to retrieve logs given log handle */\nexport interface LogsDriver {\n lastLines(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined, then starts from the end. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string\n ): Promise<StreamingApiResponse>;\n\n readText(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined of 0, then starts from the beginning. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string\n ): Promise<StreamingApiResponse>;\n}\n\n/** Response of the driver.\n * The caller should give a handle to retrieve it.\n * It can be OK or outdated, in which case the handle\n * should be issued again. */\nexport type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;\n\nexport type StreamingApiResponseOk = {\n /** The handle don't have to be updated,\n * the response is OK. */\n shouldUpdateHandle: false;\n\n /** Whether the log can still grow or it's in a final state. */\n live: boolean;\n\n /** Data of the response, in bytes. */\n data: Uint8Array;\n /** Current size of the file. It can grow if it's still live. */\n size: number;\n /** Offset in bytes from the beginning of a file. */\n newOffset: number;\n};\n\n/** The handle should be issued again, this one is done. */\nexport type StreamingApiResponseHandleOutdated = {\n shouldUpdateHandle: true;\n};\n","export function assertNever(x: never): never {\n throw new Error('Unexpected object: ' + x);\n}\n","import { assertNever } from '../util';\nimport { Branded } from '../branding';\nimport { TableRange } from './pframe';\nimport { FileLike } from './interfaces';\n\nconst uploadPrefix = 'upload://upload/';\nconst indexPrefix = 'index://index/';\n\nexport type ImportFileHandleUpload = `upload://upload/${string}`;\nexport type ImportFileHandleIndex = `index://index/${string}`;\n\nexport type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;\n\nexport type LocalImportFileHandle = Branded<ImportFileHandle, 'Local'>;\n\nexport function isImportFileHandleUpload(\n handle: ImportFileHandle\n): handle is ImportFileHandleUpload {\n return handle.startsWith(uploadPrefix);\n}\n\nexport function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex {\n return handle.startsWith(indexPrefix);\n}\n\n/** Results in upload */\nexport type StorageHandleLocal = `local://${string}`;\n\n/** Results in index */\nexport type StorageHandleRemote = `remote://${string}`;\n\nexport type StorageHandle = StorageHandleLocal | StorageHandleRemote;\n\nexport type StorageEntry = {\n name: string;\n handle: StorageHandle;\n initialFullPath: string;\n\n // TODO\n // pathStartsWithDisk\n};\n\nexport type ListFilesResult = {\n parent?: string;\n entries: LsEntry[];\n};\n\nexport type LsEntry =\n | {\n type: 'dir';\n name: string;\n fullPath: string;\n }\n | {\n type: 'file';\n name: string;\n fullPath: string;\n\n /** This handle should be set to args... */\n handle: ImportFileHandle;\n };\n\nexport type OpenDialogFilter = {\n /** Human-readable file type name */\n readonly name: string;\n /** File extensions */\n readonly extensions: string[];\n};\n\nexport type OpenDialogOps = {\n /** Open dialog window title */\n readonly title?: string;\n /** Custom label for the confirmation button, when left empty the default label will be used. */\n readonly buttonLabel?: string;\n /** Limits of file types user can select */\n readonly filters?: OpenDialogFilter[];\n};\n\nexport type OpenSingleFileResponse = {\n /** Contains local file handle, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly file?: LocalImportFileHandle;\n};\n\nexport type OpenMultipleFilesResponse = {\n /** Contains local file handles, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly files?: LocalImportFileHandle[];\n};\n\n/** Can be used to limit request for local file content to a certain bytes range */\nexport type FileRange = {\n /** From byte index (inclusive) */\n readonly from: number;\n /** To byte index (exclusive) */\n readonly to: number;\n};\n\nexport interface LsDriver {\n /** remote and local storages */\n getStorageList(): Promise<StorageEntry[]>;\n\n listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;\n\n /** Opens system file open dialog allowing to select single file and awaits user action */\n showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;\n\n /** Opens system file open dialog allowing to multiple files and awaits user action */\n showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;\n\n /** Given a handle to a local file, allows to get file size */\n getLocalFileSize(file: LocalImportFileHandle): Promise<number>;\n\n /** Given a handle to a local file, allows to get its content */\n getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;\n\n /**\n * Resolves browser's File object into platforma's import file handle.\n *\n * This method is useful among other things for implementation of UI\n * components, that handle file Drag&Drop.\n * */\n fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;\n}\n\n/** Gets a file path from an import handle. */\nexport function getFilePathFromHandle(handle: ImportFileHandle): string {\n if (isImportFileHandleIndex(handle)) {\n const trimmed = handle.slice(indexPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed));\n return data.path;\n } else if (isImportFileHandleUpload(handle)) {\n const trimmed = handle.slice(uploadPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed));\n return data.localPath;\n }\n\n assertNever(handle);\n}\n\nfunction extractFileName(filePath: string) {\n return filePath.replace(/^.*[\\\\/]/, '');\n}\n\n/** Gets a file name from an import handle. */\nexport function getFileNameFromHandle(handle: ImportFileHandle): string {\n return extractFileName(getFilePathFromHandle(handle));\n}\n","import { ValueType } from './spec';\n\nexport const PValueIntNA = -2147483648;\nexport const PValueLongNA = -9007199254740991n;\nexport const PValueFloatNA = NaN;\nexport const PValueDoubleNA = NaN;\nexport const PValueStringNA = null;\nexport const PValueBytesNA = null;\n\nexport type PValueInt = number;\nexport type PValueLong = number | bigint; // use bigint only if extra integer precision is needed\nexport type PValueFloat = number;\nexport type PValueDouble = number;\nexport type PValueString = string | null;\nexport type PValueBytes = Uint8Array | null;\n\nexport type PValue =\n | PValueInt\n | PValueLong\n | PValueFloat\n | PValueDouble\n | PValueString\n | PValueBytes;\n\nexport function isValueNA(value: unknown, valueType: ValueType): boolean {\n switch (valueType) {\n case 'Int':\n return value === PValueIntNA;\n case 'Long':\n return value === Number(PValueLongNA) || value === PValueLongNA;\n case 'Float':\n return value === PValueFloatNA;\n case 'Double':\n return value === PValueDoubleNA;\n case 'String':\n return value === PValueStringNA;\n case 'Bytes':\n return value === PValueBytesNA;\n default:\n throw Error(`unsupported data type: ${valueType satisfies never}`);\n }\n}\n\nexport type PVectorDataInt = Int32Array;\nexport type PVectorDataLong = BigInt64Array;\nexport type PVectorDataFloat = Float32Array;\nexport type PVectorDataDouble = Float64Array;\nexport type PVectorDataString = PValueString[];\nexport type PVectorDataBytes = PValueBytes[];\n\nexport type PVectorData =\n | PVectorDataInt\n | PVectorDataLong\n | PVectorDataFloat\n | PVectorDataDouble\n | PVectorDataString\n | PVectorDataBytes;\n\n/** Table column data in comparison to the data stored in a separate PColumn\n * may have some of the values \"absent\", i.e. as a result of missing record in\n * outer join operation. This information is encoded in {@link absent} field. */\nexport interface PTableVector {\n /** Stored data type */\n readonly type: ValueType;\n\n /** Values for present positions, absent positions have NA values */\n readonly data: PVectorData;\n\n /**\n * Encoded bit array marking some elements of this vector as absent,\n * call {@link isValueAbsent} to read the data.\n * */\n readonly absent: Uint8Array;\n}\n\n/** Used to read bit array with value absence information */\nexport function isValueAbsent(absent: Uint8Array, index: number): boolean {\n const chunkIndex = Math.floor(index / 8);\n const mask = 1 << (7 - (index % 8));\n return (absent[chunkIndex] & mask) > 0;\n}\n\n/** Used in requests to partially retrieve table's data */\nexport type TableRange = {\n /** Index of the first record to retrieve */\n readonly offset: number;\n\n /** Block length */\n readonly length: number;\n};\n\n/** Unified information about table shape */\nexport type PTableShape = {\n /** Number of unified table columns, including all axes and PColumn values */\n columns: number;\n\n /** Number of rows */\n rows: number;\n};\n","import { PObject, PObjectId, PObjectSpec } from '../../pool';\n\n/** PFrame columns and axes within them may store one of these types. */\nexport type ValueType = 'Int' | 'Long' | 'Float' | 'Double' | 'String' | 'Bytes';\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/** Common type representing spec for all the axes in a column */\nexport type AxesSpec = AxisSpec[];\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 PColumnSpec 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: 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 /** 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\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/** 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 return { type, name, ...(domain && { domain }) };\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/** 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","import { PTableColumnId, PTableColumnSpec } from './table_common';\nimport { PTableVector } from './data';\nimport { assertNever } from '../../util';\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'column';\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: 'inner';\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: 'full';\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: 'outer';\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: 'IsNA';\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: 'Equal';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'IEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: 'Less';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'LessOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: 'Greater';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'GreaterOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: 'StringContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: 'Matches';\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: 'StringContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: 'bySingleColumnV2';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = PTableDef<Col>;\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(\n def: PTableDef<C1>,\n cb: (c: C1) => C2\n): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(\n entry: JoinEntry<C1>,\n cb: (c: C1) => C2\n): JoinEntry<C2> {\n switch (entry.type) {\n case 'column':\n return {\n type: 'column',\n column: cb(entry.column)\n };\n case 'inner':\n case 'full':\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb))\n };\n case 'outer':\n return {\n type: 'outer',\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb))\n };\n default:\n assertNever(entry);\n }\n}\n","/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: 'link';\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n};\n\n/** Create a horisontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: 'delimiter';\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n * */\nexport type NavigationState<Href extends `/${string}` = `/${string}`> = {\n readonly href: Href;\n};\n\nexport const DefaultNavigationState: NavigationState = { href: '/' };\n","import { z } from 'zod';\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe('Crucial marker for the block dependency tree reconstruction'),\n blockId: z.string().describe('Upstream block id'),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\")\n })\n .describe(\n 'Universal reference type, allowing to set block connections. It is crucial that ' +\n '{@link __isRef} is present and equal to true, internal logic relies on this marker ' +\n 'to build block dependency trees.'\n )\n .strict()\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef) {\n return ref1.blockId === ref2.blockId && ref1.name === ref2.name;\n}\n","import { Branded } from '../branding';\nimport { PColumn, PColumnSpec } from '../drivers';\nimport { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport interface PObjectSpec {\n /** PObject kind discriminator */\n readonly kind: 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","import { AxisId } from '../drivers';\nimport { PObjectSpec, isPColumnSpec } from './spec';\n\nexport type PSpecPredicate =\n | {\n type: 'and' | 'or';\n operands: PSpecPredicate[];\n }\n | {\n type: 'not';\n operand: PSpecPredicate;\n }\n | {\n type: 'name';\n name: string;\n }\n | {\n type: 'name_pattern';\n pattern: string;\n }\n | {\n type: 'annotation';\n annotation: string;\n value: string;\n }\n | {\n type: 'annotation_pattern';\n annotation: string;\n pattern: string;\n }\n | {\n type: 'has_axes';\n axes: Partial<AxisId>[];\n };\n\nfunction assertNever(x: never): never {\n throw new Error('Unexpected object: ' + x);\n}\n\nexport function executePSpecPredicate(\n predicate: PSpecPredicate,\n spec: PObjectSpec\n): boolean {\n switch (predicate.type) {\n case 'and':\n for (const operator of predicate.operands)\n if (!executePSpecPredicate(operator, spec)) return false;\n return true;\n case 'or':\n for (const operator of predicate.operands)\n if (executePSpecPredicate(operator, spec)) return true;\n return false;\n case 'not':\n return !executePSpecPredicate(predicate.operand, spec);\n case 'name':\n return isPColumnSpec(spec) && spec.name === predicate.name;\n case 'name_pattern':\n return isPColumnSpec(spec) && Boolean(spec.name.match(predicate.pattern));\n case 'annotation':\n return (\n isPColumnSpec(spec) &&\n spec.annotations !== undefined &&\n spec.annotations[predicate.annotation] === predicate.value\n );\n case 'annotation_pattern':\n return (\n isPColumnSpec(spec) &&\n spec.annotations !== undefined &&\n spec.annotations[predicate.annotation] !== undefined &&\n Boolean(spec.annotations[predicate.annotation].match(predicate.pattern))\n );\n case 'has_axes':\n return (\n isPColumnSpec(spec) &&\n predicate.axes.every((matcher) =>\n spec.axesSpec.some(\n (axisSpec) =>\n (matcher.type === undefined || matcher.type === axisSpec.type) &&\n (matcher.name === undefined || matcher.name === axisSpec.name) &&\n (matcher.domain === undefined ||\n Object.keys(matcher.domain).length === 0 ||\n (axisSpec.domain !== undefined &&\n Object.entries(matcher.domain).every(\n ([domain, domainValue]) =>\n axisSpec.domain![domain] === domainValue\n )))\n )\n )\n );\n default:\n assertNever(predicate);\n }\n}\n","export type ValueOrError<V, E> =\n | {\n ok: true;\n value: V;\n }\n | {\n ok: false;\n error: E;\n };\n\nexport function mapValueInVOE<V1, V2, E>(\n voe: ValueOrError<V1, E>,\n cb: (value: V1) => V2\n): ValueOrError<V2, E> {\n return voe.ok ? { ok: true, value: cb(voe.value) } : voe;\n}\n"],"names":["isLiveLog","handle","assertNever","x","uploadPrefix","indexPrefix","isImportFileHandleUpload","isImportFileHandleIndex","getFilePathFromHandle","trimmed","extractFileName","filePath","getFileNameFromHandle","PValueIntNA","PValueLongNA","PValueFloatNA","PValueDoubleNA","PValueStringNA","PValueBytesNA","isValueNA","value","valueType","isValueAbsent","absent","index","chunkIndex","mask","getAxisId","spec","type","name","domain","getAxesId","matchDomain","query","target","k","matchAxisId","mapPTableDef","def","cb","mapJoinEntry","entry","col","DefaultNavigationState","PlRef","z","plRefsEqual","ref1","ref2","isPColumnSpec","isPColumn","obj","isPColumnSpecResult","r","isPColumnResult","ensurePColumn","mapPObjectData","pObj","executePSpecPredicate","predicate","operator","matcher","axisSpec","domainValue","mapValueInVOE","voe"],"mappings":"uGAaO,SAASA,EAAUC,EAA2D,CACnF,OAAOA,IAAW,QAAaA,EAAO,WAAW,iBAAiB,CACpE,CCfO,SAASC,EAAYC,EAAiB,CACrC,MAAA,IAAI,MAAM,sBAAwBA,CAAC,CAC3C,CCGA,MAAMC,EAAe,mBACfC,EAAc,iBASb,SAASC,EACdL,EACkC,CAC3B,OAAAA,EAAO,WAAWG,CAAY,CACvC,CAEO,SAASG,EAAwBN,EAA2D,CAC1F,OAAAA,EAAO,WAAWI,CAAW,CACtC,CAuGO,SAASG,EAAsBP,EAAkC,CAClE,GAAAM,EAAwBN,CAAM,EAAG,CACnC,MAAMQ,EAAUR,EAAO,MAAMI,EAAY,MAAM,EAE/C,OADa,KAAK,MAAM,mBAAmBI,CAAO,CAAC,EACvC,IAAA,SACHH,EAAyBL,CAAM,EAAG,CAC3C,MAAMQ,EAAUR,EAAO,MAAMG,EAAa,MAAM,EAEhD,OADa,KAAK,MAAM,mBAAmBK,CAAO,CAAC,EACvC,SAAA,CAGdP,EAAYD,CAAM,CACpB,CAEA,SAASS,EAAgBC,EAAkB,CAClC,OAAAA,EAAS,QAAQ,WAAY,EAAE,CACxC,CAGO,SAASC,EAAsBX,EAAkC,CAC/D,OAAAS,EAAgBF,EAAsBP,CAAM,CAAC,CACtD,CCjJ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CAAC,CAAC/B,EAAQiC,CAAW,IACnBD,EAAS,OAAQhC,CAAM,IAAMiC,CACjC,EAAA,CAEV,EAEJ,QACE9D,EAAY0D,CAAS,CAAA,CAE3B,CClFgB,SAAAK,EACdC,EACA1B,EACqB,CACd,OAAA0B,EAAI,GAAK,CAAE,GAAI,GAAM,MAAO1B,EAAG0B,EAAI,KAAK,CAAA,EAAMA,CACvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/drivers/log.ts","../src/util.ts","../src/drivers/ls.ts","../src/drivers/pframe/data.ts","../src/drivers/pframe/spec.ts","../src/drivers/pframe/table_calculate.ts","../src/navigation.ts","../src/ref.ts","../src/pool/spec.ts","../src/pool/query.ts","../src/value_or_error.ts"],"sourcesContent":["/** Handle of logs. This handle should be passed\n * to the driver for retrieving logs. */\nexport type AnyLogHandle = LiveLogHandle | ReadyLogHandle;\n\n/** Handle of the live logs of a program.\n * The resource that represents a log can be deleted,\n * in this case the handle should be refreshed. */\nexport type LiveLogHandle = `log+live://log/${string}`;\n\n/** Handle of the ready logs of a program. */\nexport type ReadyLogHandle = `log+ready://log/${string}`;\n\n/** Type guard to check if log is live, and corresponding porcess is not finished. */\nexport function isLiveLog(handle: AnyLogHandle | undefined): handle is LiveLogHandle {\n return handle !== undefined && handle.startsWith('log+live://log/');\n}\n\n/** Driver to retrieve logs given log handle */\nexport interface LogsDriver {\n lastLines(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined, then starts from the end. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string\n ): Promise<StreamingApiResponse>;\n\n readText(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined of 0, then starts from the beginning. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string\n ): Promise<StreamingApiResponse>;\n}\n\n/** Response of the driver.\n * The caller should give a handle to retrieve it.\n * It can be OK or outdated, in which case the handle\n * should be issued again. */\nexport type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;\n\nexport type StreamingApiResponseOk = {\n /** The handle don't have to be updated,\n * the response is OK. */\n shouldUpdateHandle: false;\n\n /** Whether the log can still grow or it's in a final state. */\n live: boolean;\n\n /** Data of the response, in bytes. */\n data: Uint8Array;\n /** Current size of the file. It can grow if it's still live. */\n size: number;\n /** Offset in bytes from the beginning of a file. */\n newOffset: number;\n};\n\n/** The handle should be issued again, this one is done. */\nexport type StreamingApiResponseHandleOutdated = {\n shouldUpdateHandle: true;\n};\n","export function assertNever(x: never): never {\n throw new Error('Unexpected object: ' + x);\n}\n","import { assertNever } from '../util';\nimport { Branded } from '../branding';\nimport { TableRange } from './pframe';\nimport { FileLike } from './interfaces';\n\nconst uploadPrefix = 'upload://upload/';\nconst indexPrefix = 'index://index/';\n\nexport type ImportFileHandleUpload = `upload://upload/${string}`;\nexport type ImportFileHandleIndex = `index://index/${string}`;\n\nexport type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;\n\nexport type LocalImportFileHandle = Branded<ImportFileHandle, 'Local'>;\n\nexport function isImportFileHandleUpload(\n handle: ImportFileHandle\n): handle is ImportFileHandleUpload {\n return handle.startsWith(uploadPrefix);\n}\n\nexport function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex {\n return handle.startsWith(indexPrefix);\n}\n\n/** Results in upload */\nexport type StorageHandleLocal = `local://${string}`;\n\n/** Results in index */\nexport type StorageHandleRemote = `remote://${string}`;\n\nexport type StorageHandle = StorageHandleLocal | StorageHandleRemote;\n\nexport type StorageEntry = {\n name: string;\n handle: StorageHandle;\n initialFullPath: string;\n\n // TODO\n // pathStartsWithDisk\n};\n\nexport type ListFilesResult = {\n parent?: string;\n entries: LsEntry[];\n};\n\nexport type LsEntry =\n | {\n type: 'dir';\n name: string;\n fullPath: string;\n }\n | {\n type: 'file';\n name: string;\n fullPath: string;\n\n /** This handle should be set to args... */\n handle: ImportFileHandle;\n };\n\nexport type OpenDialogFilter = {\n /** Human-readable file type name */\n readonly name: string;\n /** File extensions */\n readonly extensions: string[];\n};\n\nexport type OpenDialogOps = {\n /** Open dialog window title */\n readonly title?: string;\n /** Custom label for the confirmation button, when left empty the default label will be used. */\n readonly buttonLabel?: string;\n /** Limits of file types user can select */\n readonly filters?: OpenDialogFilter[];\n};\n\nexport type OpenSingleFileResponse = {\n /** Contains local file handle, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly file?: LocalImportFileHandle;\n};\n\nexport type OpenMultipleFilesResponse = {\n /** Contains local file handles, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly files?: LocalImportFileHandle[];\n};\n\n/** Can be used to limit request for local file content to a certain bytes range */\nexport type FileRange = {\n /** From byte index (inclusive) */\n readonly from: number;\n /** To byte index (exclusive) */\n readonly to: number;\n};\n\nexport interface LsDriver {\n /** remote and local storages */\n getStorageList(): Promise<StorageEntry[]>;\n\n listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;\n\n /** Opens system file open dialog allowing to select single file and awaits user action */\n showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;\n\n /** Opens system file open dialog allowing to multiple files and awaits user action */\n showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;\n\n /** Given a handle to a local file, allows to get file size */\n getLocalFileSize(file: LocalImportFileHandle): Promise<number>;\n\n /** Given a handle to a local file, allows to get its content */\n getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;\n\n /**\n * Resolves browser's File object into platforma's import file handle.\n *\n * This method is useful among other things for implementation of UI\n * components, that handle file Drag&Drop.\n * */\n fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;\n}\n\n/** Gets a file path from an import handle. */\nexport function getFilePathFromHandle(handle: ImportFileHandle): string {\n if (isImportFileHandleIndex(handle)) {\n const trimmed = handle.slice(indexPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed));\n return data.path;\n } else if (isImportFileHandleUpload(handle)) {\n const trimmed = handle.slice(uploadPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed));\n return data.localPath;\n }\n\n assertNever(handle);\n}\n\nfunction extractFileName(filePath: string) {\n return filePath.replace(/^.*[\\\\/]/, '');\n}\n\n/** Gets a file name from an import handle. */\nexport function getFileNameFromHandle(handle: ImportFileHandle): string {\n return extractFileName(getFilePathFromHandle(handle));\n}\n","import { ValueType } from './spec';\n\nexport const PValueIntNA = -2147483648;\nexport const PValueLongNA = -9007199254740991n;\nexport const PValueFloatNA = NaN;\nexport const PValueDoubleNA = NaN;\nexport const PValueStringNA = null;\nexport const PValueBytesNA = null;\n\nexport type PValueInt = number;\nexport type PValueLong = number | bigint; // use bigint only if extra integer precision is needed\nexport type PValueFloat = number;\nexport type PValueDouble = number;\nexport type PValueString = string | null;\nexport type PValueBytes = Uint8Array | null;\n\nexport type PValue =\n | PValueInt\n | PValueLong\n | PValueFloat\n | PValueDouble\n | PValueString\n | PValueBytes;\n\nexport function isValueNA(value: unknown, valueType: ValueType): boolean {\n switch (valueType) {\n case 'Int':\n return value === PValueIntNA;\n case 'Long':\n return value === Number(PValueLongNA) || value === PValueLongNA;\n case 'Float':\n return value === PValueFloatNA;\n case 'Double':\n return value === PValueDoubleNA;\n case 'String':\n return value === PValueStringNA;\n case 'Bytes':\n return value === PValueBytesNA;\n default:\n throw Error(`unsupported data type: ${valueType satisfies never}`);\n }\n}\n\nexport type PVectorDataInt = Int32Array;\nexport type PVectorDataLong = BigInt64Array;\nexport type PVectorDataFloat = Float32Array;\nexport type PVectorDataDouble = Float64Array;\nexport type PVectorDataString = PValueString[];\nexport type PVectorDataBytes = PValueBytes[];\n\nexport type PVectorData =\n | PVectorDataInt\n | PVectorDataLong\n | PVectorDataFloat\n | PVectorDataDouble\n | PVectorDataString\n | PVectorDataBytes;\n\n/** Table column data in comparison to the data stored in a separate PColumn\n * may have some of the values \"absent\", i.e. as a result of missing record in\n * outer join operation. This information is encoded in {@link absent} field. */\nexport interface PTableVector {\n /** Stored data type */\n readonly type: ValueType;\n\n /** Values for present positions, absent positions have NA values */\n readonly data: PVectorData;\n\n /**\n * Encoded bit array marking some elements of this vector as absent,\n * call {@link isValueAbsent} to read the data.\n * */\n readonly absent: Uint8Array;\n}\n\n/** Used to read bit array with value absence information */\nexport function isValueAbsent(absent: Uint8Array, index: number): boolean {\n const chunkIndex = Math.floor(index / 8);\n const mask = 1 << (7 - (index % 8));\n return (absent[chunkIndex] & mask) > 0;\n}\n\n/** Used in requests to partially retrieve table's data */\nexport type TableRange = {\n /** Index of the first record to retrieve */\n readonly offset: number;\n\n /** Block length */\n readonly length: number;\n};\n\n/** Unified information about table shape */\nexport type PTableShape = {\n /** Number of unified table columns, including all axes and PColumn values */\n columns: number;\n\n /** Number of rows */\n rows: number;\n};\n","import { PObject, PObjectId, PObjectSpec } from '../../pool';\n\n/** PFrame columns and axes within them may store one of these types. */\nexport type ValueType = 'Int' | 'Long' | 'Float' | 'Double' | 'String' | 'Bytes';\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/** Common type representing spec for all the axes in a column */\nexport type AxesSpec = AxisSpec[];\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 PColumnSpec 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: 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 /** 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\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/** 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 return { type, name, ...(domain && { domain }) };\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/** 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","import { PTableColumnId, PTableColumnSpec } from './table_common';\nimport { PTableVector } from './data';\nimport { assertNever } from '../../util';\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'column';\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: 'inner';\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: 'full';\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: 'outer';\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: 'IsNA';\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: 'Equal';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'IEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: 'Less';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'LessOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: 'Greater';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'GreaterOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: 'StringContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: 'Matches';\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: 'StringContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicate {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicate;\n}\n\nexport interface SingleValueAndPredicate {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicate[];\n}\n\nexport interface SingleValueOrPredicate {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicate[];\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicate =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicate\n | SingleValueAndPredicate\n | SingleValueOrPredicate;\n\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilter {\n /** Filter type discriminator */\n readonly type: 'bySingleColumn';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicate;\n}\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: 'bySingleColumnV2';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilter | PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = PTableDef<Col>;\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(\n def: PTableDef<C1>,\n cb: (c: C1) => C2\n): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(\n entry: JoinEntry<C1>,\n cb: (c: C1) => C2\n): JoinEntry<C2> {\n switch (entry.type) {\n case 'column':\n return {\n type: 'column',\n column: cb(entry.column)\n };\n case 'inner':\n case 'full':\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb))\n };\n case 'outer':\n return {\n type: 'outer',\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb))\n };\n default:\n assertNever(entry);\n }\n}\n","/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: 'link';\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n};\n\n/** Create a horisontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: 'delimiter';\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n * */\nexport type NavigationState<Href extends `/${string}` = `/${string}`> = {\n readonly href: Href;\n};\n\nexport const DefaultNavigationState: NavigationState = { href: '/' };\n","import { z } from 'zod';\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe('Crucial marker for the block dependency tree reconstruction'),\n blockId: z.string().describe('Upstream block id'),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\")\n })\n .describe(\n 'Universal reference type, allowing to set block connections. It is crucial that ' +\n '{@link __isRef} is present and equal to true, internal logic relies on this marker ' +\n 'to build block dependency trees.'\n )\n .strict()\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef) {\n return ref1.blockId === ref2.blockId && ref1.name === ref2.name;\n}\n","import { Branded } from '../branding';\nimport { PColumn, PColumnSpec } from '../drivers';\nimport { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport interface PObjectSpec {\n /** PObject kind discriminator */\n readonly kind: 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","import { AxisId } from '../drivers';\nimport { PObjectSpec, isPColumnSpec } from './spec';\n\nexport type PSpecPredicate =\n | {\n type: 'and' | 'or';\n operands: PSpecPredicate[];\n }\n | {\n type: 'not';\n operand: PSpecPredicate;\n }\n | {\n type: 'name';\n name: string;\n }\n | {\n type: 'name_pattern';\n pattern: string;\n }\n | {\n type: 'annotation';\n annotation: string;\n value: string;\n }\n | {\n type: 'annotation_pattern';\n annotation: string;\n pattern: string;\n }\n | {\n type: 'has_axes';\n axes: Partial<AxisId>[];\n };\n\nfunction assertNever(x: never): never {\n throw new Error('Unexpected object: ' + x);\n}\n\nexport function executePSpecPredicate(\n predicate: PSpecPredicate,\n spec: PObjectSpec\n): boolean {\n switch (predicate.type) {\n case 'and':\n for (const operator of predicate.operands)\n if (!executePSpecPredicate(operator, spec)) return false;\n return true;\n case 'or':\n for (const operator of predicate.operands)\n if (executePSpecPredicate(operator, spec)) return true;\n return false;\n case 'not':\n return !executePSpecPredicate(predicate.operand, spec);\n case 'name':\n return isPColumnSpec(spec) && spec.name === predicate.name;\n case 'name_pattern':\n return isPColumnSpec(spec) && Boolean(spec.name.match(predicate.pattern));\n case 'annotation':\n return (\n isPColumnSpec(spec) &&\n spec.annotations !== undefined &&\n spec.annotations[predicate.annotation] === predicate.value\n );\n case 'annotation_pattern':\n return (\n isPColumnSpec(spec) &&\n spec.annotations !== undefined &&\n spec.annotations[predicate.annotation] !== undefined &&\n Boolean(spec.annotations[predicate.annotation].match(predicate.pattern))\n );\n case 'has_axes':\n return (\n isPColumnSpec(spec) &&\n predicate.axes.every((matcher) =>\n spec.axesSpec.some(\n (axisSpec) =>\n (matcher.type === undefined || matcher.type === axisSpec.type) &&\n (matcher.name === undefined || matcher.name === axisSpec.name) &&\n (matcher.domain === undefined ||\n Object.keys(matcher.domain).length === 0 ||\n (axisSpec.domain !== undefined &&\n Object.entries(matcher.domain).every(\n ([domain, domainValue]) =>\n axisSpec.domain![domain] === domainValue\n )))\n )\n )\n );\n default:\n assertNever(predicate);\n }\n}\n","export type ValueOrError<V, E> =\n | {\n ok: true;\n value: V;\n }\n | {\n ok: false;\n error: E;\n };\n\nexport function mapValueInVOE<V1, V2, E>(\n voe: ValueOrError<V1, E>,\n cb: (value: V1) => V2\n): ValueOrError<V2, E> {\n return voe.ok ? { ok: true, value: cb(voe.value) } : voe;\n}\n"],"names":["isLiveLog","handle","assertNever","x","uploadPrefix","indexPrefix","isImportFileHandleUpload","isImportFileHandleIndex","getFilePathFromHandle","trimmed","extractFileName","filePath","getFileNameFromHandle","PValueIntNA","PValueLongNA","PValueFloatNA","PValueDoubleNA","PValueStringNA","PValueBytesNA","isValueNA","value","valueType","isValueAbsent","absent","index","chunkIndex","mask","getAxisId","spec","type","name","domain","getAxesId","matchDomain","query","target","k","matchAxisId","mapPTableDef","def","cb","mapJoinEntry","entry","col","DefaultNavigationState","PlRef","z","plRefsEqual","ref1","ref2","isPColumnSpec","isPColumn","obj","isPColumnSpecResult","r","isPColumnResult","ensurePColumn","mapPObjectData","pObj","executePSpecPredicate","predicate","operator","matcher","axisSpec","domainValue","mapValueInVOE","voe"],"mappings":";AAaO,SAASA,EAAUC,GAA2D;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C,GACA1B,GACqB;AACd,SAAA0B,EAAI,KAAK,EAAE,IAAI,IAAM,OAAO1B,EAAG0B,EAAI,KAAK,EAAA,IAAMA;AACvD;"}
1
+ {"version":3,"file":"index.mjs","sources":["../src/drivers/log.ts","../src/util.ts","../src/drivers/ls.ts","../src/drivers/pframe/data.ts","../src/drivers/pframe/spec.ts","../src/drivers/pframe/table_calculate.ts","../src/navigation.ts","../src/ref.ts","../src/pool/spec.ts","../src/pool/query.ts","../src/value_or_error.ts"],"sourcesContent":["/** Handle of logs. This handle should be passed\n * to the driver for retrieving logs. */\nexport type AnyLogHandle = LiveLogHandle | ReadyLogHandle;\n\n/** Handle of the live logs of a program.\n * The resource that represents a log can be deleted,\n * in this case the handle should be refreshed. */\nexport type LiveLogHandle = `log+live://log/${string}`;\n\n/** Handle of the ready logs of a program. */\nexport type ReadyLogHandle = `log+ready://log/${string}`;\n\n/** Type guard to check if log is live, and corresponding porcess is not finished. */\nexport function isLiveLog(handle: AnyLogHandle | undefined): handle is LiveLogHandle {\n return handle !== undefined && handle.startsWith('log+live://log/');\n}\n\n/** Driver to retrieve logs given log handle */\nexport interface LogsDriver {\n lastLines(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined, then starts from the end. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string\n ): Promise<StreamingApiResponse>;\n\n readText(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined of 0, then starts from the beginning. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string\n ): Promise<StreamingApiResponse>;\n}\n\n/** Response of the driver.\n * The caller should give a handle to retrieve it.\n * It can be OK or outdated, in which case the handle\n * should be issued again. */\nexport type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;\n\nexport type StreamingApiResponseOk = {\n /** The handle don't have to be updated,\n * the response is OK. */\n shouldUpdateHandle: false;\n\n /** Whether the log can still grow or it's in a final state. */\n live: boolean;\n\n /** Data of the response, in bytes. */\n data: Uint8Array;\n /** Current size of the file. It can grow if it's still live. */\n size: number;\n /** Offset in bytes from the beginning of a file. */\n newOffset: number;\n};\n\n/** The handle should be issued again, this one is done. */\nexport type StreamingApiResponseHandleOutdated = {\n shouldUpdateHandle: true;\n};\n","export function assertNever(x: never): never {\n throw new Error('Unexpected object: ' + x);\n}\n","import { assertNever } from '../util';\nimport { Branded } from '../branding';\nimport { TableRange } from './pframe';\nimport { FileLike } from './interfaces';\n\nconst uploadPrefix = 'upload://upload/';\nconst indexPrefix = 'index://index/';\n\nexport type ImportFileHandleUpload = `upload://upload/${string}`;\nexport type ImportFileHandleIndex = `index://index/${string}`;\n\nexport type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;\n\nexport type LocalImportFileHandle = Branded<ImportFileHandle, 'Local'>;\n\nexport function isImportFileHandleUpload(\n handle: ImportFileHandle\n): handle is ImportFileHandleUpload {\n return handle.startsWith(uploadPrefix);\n}\n\nexport function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex {\n return handle.startsWith(indexPrefix);\n}\n\n/** Results in upload */\nexport type StorageHandleLocal = `local://${string}`;\n\n/** Results in index */\nexport type StorageHandleRemote = `remote://${string}`;\n\nexport type StorageHandle = StorageHandleLocal | StorageHandleRemote;\n\nexport type StorageEntry = {\n name: string;\n handle: StorageHandle;\n initialFullPath: string;\n\n // TODO\n // pathStartsWithDisk\n};\n\nexport type ListFilesResult = {\n parent?: string;\n entries: LsEntry[];\n};\n\nexport type LsEntry =\n | {\n type: 'dir';\n name: string;\n fullPath: string;\n }\n | {\n type: 'file';\n name: string;\n fullPath: string;\n\n /** This handle should be set to args... */\n handle: ImportFileHandle;\n };\n\nexport type OpenDialogFilter = {\n /** Human-readable file type name */\n readonly name: string;\n /** File extensions */\n readonly extensions: string[];\n};\n\nexport type OpenDialogOps = {\n /** Open dialog window title */\n readonly title?: string;\n /** Custom label for the confirmation button, when left empty the default label will be used. */\n readonly buttonLabel?: string;\n /** Limits of file types user can select */\n readonly filters?: OpenDialogFilter[];\n};\n\nexport type OpenSingleFileResponse = {\n /** Contains local file handle, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly file?: LocalImportFileHandle;\n};\n\nexport type OpenMultipleFilesResponse = {\n /** Contains local file handles, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly files?: LocalImportFileHandle[];\n};\n\n/** Can be used to limit request for local file content to a certain bytes range */\nexport type FileRange = {\n /** From byte index (inclusive) */\n readonly from: number;\n /** To byte index (exclusive) */\n readonly to: number;\n};\n\nexport interface LsDriver {\n /** remote and local storages */\n getStorageList(): Promise<StorageEntry[]>;\n\n listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;\n\n /** Opens system file open dialog allowing to select single file and awaits user action */\n showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;\n\n /** Opens system file open dialog allowing to multiple files and awaits user action */\n showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;\n\n /** Given a handle to a local file, allows to get file size */\n getLocalFileSize(file: LocalImportFileHandle): Promise<number>;\n\n /** Given a handle to a local file, allows to get its content */\n getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;\n\n /**\n * Resolves browser's File object into platforma's import file handle.\n *\n * This method is useful among other things for implementation of UI\n * components, that handle file Drag&Drop.\n * */\n fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;\n}\n\n/** Gets a file path from an import handle. */\nexport function getFilePathFromHandle(handle: ImportFileHandle): string {\n if (isImportFileHandleIndex(handle)) {\n const trimmed = handle.slice(indexPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed));\n return data.path;\n } else if (isImportFileHandleUpload(handle)) {\n const trimmed = handle.slice(uploadPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed));\n return data.localPath;\n }\n\n assertNever(handle);\n}\n\nfunction extractFileName(filePath: string) {\n return filePath.replace(/^.*[\\\\/]/, '');\n}\n\n/** Gets a file name from an import handle. */\nexport function getFileNameFromHandle(handle: ImportFileHandle): string {\n return extractFileName(getFilePathFromHandle(handle));\n}\n","import { ValueType } from './spec';\n\nexport const PValueIntNA = -2147483648;\nexport const PValueLongNA = -9007199254740991n;\nexport const PValueFloatNA = NaN;\nexport const PValueDoubleNA = NaN;\nexport const PValueStringNA = null;\nexport const PValueBytesNA = null;\n\nexport type PValueInt = number;\nexport type PValueLong = number | bigint; // use bigint only if extra integer precision is needed\nexport type PValueFloat = number;\nexport type PValueDouble = number;\nexport type PValueString = string | null;\nexport type PValueBytes = Uint8Array | null;\n\nexport type PValue =\n | PValueInt\n | PValueLong\n | PValueFloat\n | PValueDouble\n | PValueString\n | PValueBytes;\n\nexport function isValueNA(value: unknown, valueType: ValueType): boolean {\n switch (valueType) {\n case 'Int':\n return value === PValueIntNA;\n case 'Long':\n return value === Number(PValueLongNA) || value === PValueLongNA;\n case 'Float':\n return value === PValueFloatNA;\n case 'Double':\n return value === PValueDoubleNA;\n case 'String':\n return value === PValueStringNA;\n case 'Bytes':\n return value === PValueBytesNA;\n default:\n throw Error(`unsupported data type: ${valueType satisfies never}`);\n }\n}\n\nexport type PVectorDataInt = Int32Array;\nexport type PVectorDataLong = BigInt64Array;\nexport type PVectorDataFloat = Float32Array;\nexport type PVectorDataDouble = Float64Array;\nexport type PVectorDataString = PValueString[];\nexport type PVectorDataBytes = PValueBytes[];\n\nexport type PVectorData =\n | PVectorDataInt\n | PVectorDataLong\n | PVectorDataFloat\n | PVectorDataDouble\n | PVectorDataString\n | PVectorDataBytes;\n\n/** Table column data in comparison to the data stored in a separate PColumn\n * may have some of the values \"absent\", i.e. as a result of missing record in\n * outer join operation. This information is encoded in {@link absent} field. */\nexport interface PTableVector {\n /** Stored data type */\n readonly type: ValueType;\n\n /** Values for present positions, absent positions have NA values */\n readonly data: PVectorData;\n\n /**\n * Encoded bit array marking some elements of this vector as absent,\n * call {@link isValueAbsent} to read the data.\n * */\n readonly absent: Uint8Array;\n}\n\n/** Used to read bit array with value absence information */\nexport function isValueAbsent(absent: Uint8Array, index: number): boolean {\n const chunkIndex = Math.floor(index / 8);\n const mask = 1 << (7 - (index % 8));\n return (absent[chunkIndex] & mask) > 0;\n}\n\n/** Used in requests to partially retrieve table's data */\nexport type TableRange = {\n /** Index of the first record to retrieve */\n readonly offset: number;\n\n /** Block length */\n readonly length: number;\n};\n\n/** Unified information about table shape */\nexport type PTableShape = {\n /** Number of unified table columns, including all axes and PColumn values */\n columns: number;\n\n /** Number of rows */\n rows: number;\n};\n","import { PObject, PObjectId, PObjectSpec } from '../../pool';\n\n/** PFrame columns and axes within them may store one of these types. */\nexport type ValueType = 'Int' | 'Long' | 'Float' | 'Double' | 'String' | 'Bytes';\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/** Common type representing spec for all the axes in a column */\nexport type AxesSpec = AxisSpec[];\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 PColumnSpec 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: 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 /** 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\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/** 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 return { type, name, ...(domain && { domain }) };\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/** 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","import { PTableColumnId, PTableColumnSpec } from './table_common';\nimport { PTableVector } from './data';\nimport { assertNever } from '../../util';\n\n/** Defines a terminal column node in the join request tree */\nexport interface ColumnJoinEntry<Col> {\n /** Node type discriminator */\n readonly type: 'column';\n\n /** Local column */\n readonly column: Col;\n}\n\n/**\n * Defines a join request tree node that will output only records present in\n * all child nodes ({@link entries}).\n * */\nexport interface InnerJoin<Col> {\n /** Node type discriminator */\n readonly type: 'inner';\n\n /** Child nodes to be inner joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present at\n * least in one of the child nodes ({@link entries}), values for those PColumns\n * that lacks corresponding combinations of axis values will be marked as absent,\n * see {@link PTableVector.absent}.\n * */\nexport interface FullJoin<Col> {\n /** Node type discriminator */\n readonly type: 'full';\n\n /** Child nodes to be fully outer joined */\n readonly entries: JoinEntry<Col>[];\n}\n\n/**\n * Defines a join request tree node that will output all records present in\n * {@link primary} child node, and records from the {@link secondary} nodes will\n * be added to the output only if present, values for those PColumns from the\n * {@link secondary} list, that lacks corresponding combinations of axis values\n * will be marked as absent, see {@link PTableVector.absent}.\n *\n * This node can be thought as a chain of SQL LEFT JOIN operations starting from\n * the {@link primary} node and adding {@link secondary} nodes one by one.\n * */\nexport interface OuterJoin<Col> {\n /** Node type discriminator */\n readonly type: 'outer';\n\n /** Primes the join operation. Left part of LEFT JOIN. */\n readonly primary: JoinEntry<Col>;\n\n /** Driven nodes, giving their values only if primary node have corresponding\n * nodes. Right parts of LEFT JOIN chain. */\n readonly secondary: JoinEntry<Col>[];\n}\n\n/**\n * Base type of all join request tree nodes. Join request tree allows to combine\n * information from multiple PColumns into a PTable. Correlation between records\n * is performed by looking for records with the same values in common axis between\n * the PColumns. Common axis are those axis which have equal {@link AxisId} derived\n * from the columns axes spec.\n * */\nexport type JoinEntry<Col> =\n | ColumnJoinEntry<Col>\n | InnerJoin<Col>\n | FullJoin<Col>\n | OuterJoin<Col>;\n\n/** Container representing whole data stored in specific PTable column. */\nexport interface FullPTableColumnData {\n /** Unified spec */\n readonly spec: PTableColumnSpec;\n\n /** Data */\n readonly data: PTableVector;\n}\n\nexport interface SingleValueIsNAPredicate {\n /** Comparison operator */\n readonly operator: 'IsNA';\n}\n\nexport interface SingleValueEqualPredicate {\n /** Comparison operator */\n readonly operator: 'Equal';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueIEqualPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'IEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string;\n}\n\nexport interface SingleValueLessPredicate {\n /** Comparison operator */\n readonly operator: 'Less';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueLessOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'LessOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterPredicate {\n /** Comparison operator */\n readonly operator: 'Greater';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueGreaterOrEqualPredicate {\n /** Comparison operator */\n readonly operator: 'GreaterOrEqual';\n\n /** Reference value, NA values will not match */\n readonly reference: string | number;\n}\n\nexport interface SingleValueStringContainsPredicate {\n /** Comparison operator */\n readonly operator: 'StringContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueStringIContainsPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContains';\n\n /** Reference substring, NA values are skipped */\n readonly substring: string;\n}\n\nexport interface SingleValueMatchesPredicate {\n /** Comparison operator */\n readonly operator: 'Matches';\n\n /** Regular expression, NA values are skipped */\n readonly regex: string;\n}\n\nexport interface SingleValueStringContainsFuzzyPredicate {\n /** Comparison operator */\n readonly operator: 'StringContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueStringIContainsFuzzyPredicate {\n /** Comparison operator (case insensitive) */\n readonly operator: 'StringIContainsFuzzy';\n\n /** Reference value, NA values are skipped */\n readonly reference: string;\n\n /**\n * Integer specifying the upper bound of edit distance between\n * reference and actual value.\n * When {@link substitutionsOnly} is not defined or set to false\n * Levenshtein distance is used (substitutions and indels)\n * @see https://en.wikipedia.org/wiki/Levenshtein_distance\n * When {@link substitutionsOnly} is set to true\n * Hamming distance is used (substitutions only)\n * @see https://en.wikipedia.org/wiki/Hamming_distance\n */\n readonly maxEdits: number;\n\n /** Changes the type of edit distance in {@link maxEdits} */\n readonly substitutionsOnly?: boolean;\n\n /**\n * Some character in {@link reference} that will match any\n * single character in searched text.\n */\n readonly wildcard?: string;\n}\n\nexport interface SingleValueNotPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Not';\n\n /** Operand to negate */\n readonly operand: SingleValuePredicateV2;\n}\n\nexport interface SingleValueAndPredicateV2 {\n /** Comparison operator */\n readonly operator: 'And';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\nexport interface SingleValueOrPredicateV2 {\n /** Comparison operator */\n readonly operator: 'Or';\n\n /** Operands to combine */\n readonly operands: SingleValuePredicateV2[];\n}\n\n/** Filtering predicate for a single axis or column value */\nexport type SingleValuePredicateV2 =\n | SingleValueIsNAPredicate\n | SingleValueEqualPredicate\n | SingleValueLessPredicate\n | SingleValueLessOrEqualPredicate\n | SingleValueGreaterPredicate\n | SingleValueGreaterOrEqualPredicate\n | SingleValueStringContainsPredicate\n | SingleValueMatchesPredicate\n | SingleValueStringContainsFuzzyPredicate\n | SingleValueNotPredicateV2\n | SingleValueAndPredicateV2\n | SingleValueOrPredicateV2\n | SingleValueIEqualPredicate\n | SingleValueStringIContainsPredicate\n | SingleValueStringIContainsFuzzyPredicate;\n\n/**\n * Filter PTable records based on specific axis or column value. If this is an\n * axis value filter and the axis is part of a partitioning key in some of the\n * source PColumns, the filter will be pushed down to those columns, so only\n * specific partitions will be retrieved from the remote storage.\n * */\nexport interface PTableRecordSingleValueFilterV2 {\n /** Filter type discriminator */\n readonly type: 'bySingleColumnV2';\n\n /** Target axis selector to examine values from */\n readonly column: PTableColumnId;\n\n /** Value predicate */\n readonly predicate: SingleValuePredicateV2;\n}\n\n/** Generic PTable records filter */\nexport type PTableRecordFilter = PTableRecordSingleValueFilterV2;\n\n/** Sorting parameters for a PTable. */\nexport type PTableSorting = {\n /** Unified column identifier */\n readonly column: PTableColumnId;\n\n /** Sorting order */\n readonly ascending: boolean;\n\n /** Sorting in respect to NA and absent values */\n readonly naAndAbsentAreLeastValues: boolean;\n};\n\n/** Information required to instantiate a PTable. */\nexport interface PTableDef<Col> {\n /** Join tree to populate the PTable */\n readonly src: JoinEntry<Col>;\n\n /** Record filters */\n readonly filters: PTableRecordFilter[];\n\n /** Table sorting */\n readonly sorting: PTableSorting[];\n}\n\n/** Request to create and retrieve entirety of data of PTable. */\nexport type CalculateTableDataRequest<Col> = PTableDef<Col>;\n\n/** Response for {@link CalculateTableDataRequest} */\nexport type CalculateTableDataResponse = FullPTableColumnData[];\n\nexport function mapPTableDef<C1, C2>(\n def: PTableDef<C1>,\n cb: (c: C1) => C2\n): PTableDef<C2> {\n return { ...def, src: mapJoinEntry(def.src, cb) };\n}\n\nexport function mapJoinEntry<C1, C2>(\n entry: JoinEntry<C1>,\n cb: (c: C1) => C2\n): JoinEntry<C2> {\n switch (entry.type) {\n case 'column':\n return {\n type: 'column',\n column: cb(entry.column)\n };\n case 'inner':\n case 'full':\n return {\n type: entry.type,\n entries: entry.entries.map((col) => mapJoinEntry(col, cb))\n };\n case 'outer':\n return {\n type: 'outer',\n primary: mapJoinEntry(entry.primary, cb),\n secondary: entry.secondary.map((col) => mapJoinEntry(col, cb))\n };\n default:\n assertNever(entry);\n }\n}\n","/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: 'link';\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n};\n\n/** Create a horisontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: 'delimiter';\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n * */\nexport type NavigationState<Href extends `/${string}` = `/${string}`> = {\n readonly href: Href;\n};\n\nexport const DefaultNavigationState: NavigationState = { href: '/' };\n","import { z } from 'zod';\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe('Crucial marker for the block dependency tree reconstruction'),\n blockId: z.string().describe('Upstream block id'),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\")\n })\n .describe(\n 'Universal reference type, allowing to set block connections. It is crucial that ' +\n '{@link __isRef} is present and equal to true, internal logic relies on this marker ' +\n 'to build block dependency trees.'\n )\n .strict()\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef) {\n return ref1.blockId === ref2.blockId && ref1.name === ref2.name;\n}\n","import { Branded } from '../branding';\nimport { PColumn, PColumnSpec } from '../drivers';\nimport { ResultPoolEntry } from './entry';\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport interface PObjectSpec {\n /** PObject kind discriminator */\n readonly kind: 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","import { AxisId } from '../drivers';\nimport { PObjectSpec, isPColumnSpec } from './spec';\n\nexport type PSpecPredicate =\n | {\n type: 'and' | 'or';\n operands: PSpecPredicate[];\n }\n | {\n type: 'not';\n operand: PSpecPredicate;\n }\n | {\n type: 'name';\n name: string;\n }\n | {\n type: 'name_pattern';\n pattern: string;\n }\n | {\n type: 'annotation';\n annotation: string;\n value: string;\n }\n | {\n type: 'annotation_pattern';\n annotation: string;\n pattern: string;\n }\n | {\n type: 'has_axes';\n axes: Partial<AxisId>[];\n };\n\nfunction assertNever(x: never): never {\n throw new Error('Unexpected object: ' + x);\n}\n\nexport function executePSpecPredicate(\n predicate: PSpecPredicate,\n spec: PObjectSpec\n): boolean {\n switch (predicate.type) {\n case 'and':\n for (const operator of predicate.operands)\n if (!executePSpecPredicate(operator, spec)) return false;\n return true;\n case 'or':\n for (const operator of predicate.operands)\n if (executePSpecPredicate(operator, spec)) return true;\n return false;\n case 'not':\n return !executePSpecPredicate(predicate.operand, spec);\n case 'name':\n return isPColumnSpec(spec) && spec.name === predicate.name;\n case 'name_pattern':\n return isPColumnSpec(spec) && Boolean(spec.name.match(predicate.pattern));\n case 'annotation':\n return (\n isPColumnSpec(spec) &&\n spec.annotations !== undefined &&\n spec.annotations[predicate.annotation] === predicate.value\n );\n case 'annotation_pattern':\n return (\n isPColumnSpec(spec) &&\n spec.annotations !== undefined &&\n spec.annotations[predicate.annotation] !== undefined &&\n Boolean(spec.annotations[predicate.annotation].match(predicate.pattern))\n );\n case 'has_axes':\n return (\n isPColumnSpec(spec) &&\n predicate.axes.every((matcher) =>\n spec.axesSpec.some(\n (axisSpec) =>\n (matcher.type === undefined || matcher.type === axisSpec.type) &&\n (matcher.name === undefined || matcher.name === axisSpec.name) &&\n (matcher.domain === undefined ||\n Object.keys(matcher.domain).length === 0 ||\n (axisSpec.domain !== undefined &&\n Object.entries(matcher.domain).every(\n ([domain, domainValue]) =>\n axisSpec.domain![domain] === domainValue\n )))\n )\n )\n );\n default:\n assertNever(predicate);\n }\n}\n","export type ValueOrError<V, E> =\n | {\n ok: true;\n value: V;\n }\n | {\n ok: false;\n error: E;\n };\n\nexport function mapValueInVOE<V1, V2, E>(\n voe: ValueOrError<V1, E>,\n cb: (value: V1) => V2\n): ValueOrError<V2, E> {\n return voe.ok ? { ok: true, value: cb(voe.value) } : voe;\n}\n"],"names":["isLiveLog","handle","assertNever","x","uploadPrefix","indexPrefix","isImportFileHandleUpload","isImportFileHandleIndex","getFilePathFromHandle","trimmed","extractFileName","filePath","getFileNameFromHandle","PValueIntNA","PValueLongNA","PValueFloatNA","PValueDoubleNA","PValueStringNA","PValueBytesNA","isValueNA","value","valueType","isValueAbsent","absent","index","chunkIndex","mask","getAxisId","spec","type","name","domain","getAxesId","matchDomain","query","target","k","matchAxisId","mapPTableDef","def","cb","mapJoinEntry","entry","col","DefaultNavigationState","PlRef","z","plRefsEqual","ref1","ref2","isPColumnSpec","isPColumn","obj","isPColumnSpecResult","r","isPColumnResult","ensurePColumn","mapPObjectData","pObj","executePSpecPredicate","predicate","operator","matcher","axisSpec","domainValue","mapValueInVOE","voe"],"mappings":";AAaO,SAASA,EAAUC,GAA2D;AACnF,SAAOA,MAAW,UAAaA,EAAO,WAAW,iBAAiB;AACpE;ACfO,SAASC,EAAYC,GAAiB;AACrC,QAAA,IAAI,MAAM,wBAAwBA,CAAC;AAC3C;ACGA,MAAMC,IAAe,oBACfC,IAAc;AASb,SAASC,EACdL,GACkC;AAC3B,SAAAA,EAAO,WAAWG,CAAY;AACvC;AAEO,SAASG,EAAwBN,GAA2D;AAC1F,SAAAA,EAAO,WAAWI,CAAW;AACtC;AAuGO,SAASG,EAAsBP,GAAkC;AAClE,MAAAM,EAAwBN,CAAM,GAAG;AACnC,UAAMQ,IAAUR,EAAO,MAAMI,EAAY,MAAM;AAE/C,WADa,KAAK,MAAM,mBAAmBI,CAAO,CAAC,EACvC;AAAA,EAAA,WACHH,EAAyBL,CAAM,GAAG;AAC3C,UAAMQ,IAAUR,EAAO,MAAMG,EAAa,MAAM;AAEhD,WADa,KAAK,MAAM,mBAAmBK,CAAO,CAAC,EACvC;AAAA,EAAA;AAGdP,EAAAA,EAAYD,CAAM;AACpB;AAEA,SAASS,EAAgBC,GAAkB;AAClC,SAAAA,EAAS,QAAQ,YAAY,EAAE;AACxC;AAGO,SAASC,EAAsBX,GAAkC;AAC/D,SAAAS,EAAgBF,EAAsBP,CAAM,CAAC;AACtD;ACjJO,MAAMY,IAAc,aACdC,IAAe,CAAC,mBAChBC,IAAgB,KAChBC,IAAiB,KACjBC,IAAiB,MACjBC,IAAgB;AAiBb,SAAAC,EAAUC,GAAgBC,GAA+B;AACvE,UAAQA,GAAW;AAAA,IACjB,KAAK;AACH,aAAOD,MAAUP;AAAA,IACn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CC,EAAS,WAAW,UACnB,OAAO,QAAQD,EAAQ,MAAM,EAAE;AAAA,YAC7B,CAAC,CAAC/B,GAAQiC,CAAW,MACnBD,EAAS,OAAQhC,CAAM,MAAMiC;AAAA,UACjC;AAAA,QAAA;AAAA,MAEV;AAAA,IAEJ;AACE,MAAA9D,EAAY0D,CAAS;AAAA,EAAA;AAE3B;AClFgB,SAAAK,EACdC,GACA1B,GACqB;AACd,SAAA0B,EAAI,KAAK,EAAE,IAAI,IAAM,OAAO1B,EAAG0B,EAAI,KAAK,EAAA,IAAMA;AACvD;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-common",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Platforma SDK Model",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "zod": "^3.23.8"
21
21
  },
22
22
  "devDependencies": {
23
- "typescript": "~5.6.3",
23
+ "typescript": "~5.5.4",
24
24
  "vite": "^5.4.11",
25
25
  "@milaboratories/platforma-build-configs": "1.0.2"
26
26
  },
@@ -10,6 +10,9 @@ export interface ColumnFilter {
10
10
  * matching. */
11
11
  readonly name?: string[];
12
12
 
13
+ /** Match requires all the domains listed here to have corresponding values. */
14
+ readonly domainValue?: Record<string, string>;
15
+
13
16
  /** Match requires all the annotations listed here to have corresponding values. */
14
17
  readonly annotationValue?: Record<string, string>;
15
18
 
@@ -216,30 +216,6 @@ export interface SingleValueStringIContainsFuzzyPredicate {
216
216
  readonly wildcard?: string;
217
217
  }
218
218
 
219
- export interface SingleValueNotPredicate {
220
- /** Comparison operator */
221
- readonly operator: 'Not';
222
-
223
- /** Operand to negate */
224
- readonly operand: SingleValuePredicate;
225
- }
226
-
227
- export interface SingleValueAndPredicate {
228
- /** Comparison operator */
229
- readonly operator: 'And';
230
-
231
- /** Operands to combine */
232
- readonly operands: SingleValuePredicate[];
233
- }
234
-
235
- export interface SingleValueOrPredicate {
236
- /** Comparison operator */
237
- readonly operator: 'Or';
238
-
239
- /** Operands to combine */
240
- readonly operands: SingleValuePredicate[];
241
- }
242
-
243
219
  export interface SingleValueNotPredicateV2 {
244
220
  /** Comparison operator */
245
221
  readonly operator: 'Not';
@@ -265,20 +241,6 @@ export interface SingleValueOrPredicateV2 {
265
241
  }
266
242
 
267
243
  /** Filtering predicate for a single axis or column value */
268
- export type SingleValuePredicate =
269
- | SingleValueIsNAPredicate
270
- | SingleValueEqualPredicate
271
- | SingleValueLessPredicate
272
- | SingleValueLessOrEqualPredicate
273
- | SingleValueGreaterPredicate
274
- | SingleValueGreaterOrEqualPredicate
275
- | SingleValueStringContainsPredicate
276
- | SingleValueMatchesPredicate
277
- | SingleValueStringContainsFuzzyPredicate
278
- | SingleValueNotPredicate
279
- | SingleValueAndPredicate
280
- | SingleValueOrPredicate;
281
-
282
244
  export type SingleValuePredicateV2 =
283
245
  | SingleValueIsNAPredicate
284
246
  | SingleValueEqualPredicate
@@ -296,23 +258,6 @@ export type SingleValuePredicateV2 =
296
258
  | SingleValueStringIContainsPredicate
297
259
  | SingleValueStringIContainsFuzzyPredicate;
298
260
 
299
- /**
300
- * Filter PTable records based on specific axis or column value. If this is an
301
- * axis value filter and the axis is part of a partitioning key in some of the
302
- * source PColumns, the filter will be pushed down to those columns, so only
303
- * specific partitions will be retrieved from the remote storage.
304
- * */
305
- export interface PTableRecordSingleValueFilter {
306
- /** Filter type discriminator */
307
- readonly type: 'bySingleColumn';
308
-
309
- /** Target axis selector to examine values from */
310
- readonly column: PTableColumnId;
311
-
312
- /** Value predicate */
313
- readonly predicate: SingleValuePredicate;
314
- }
315
-
316
261
  /**
317
262
  * Filter PTable records based on specific axis or column value. If this is an
318
263
  * axis value filter and the axis is part of a partitioning key in some of the
@@ -331,7 +276,7 @@ export interface PTableRecordSingleValueFilterV2 {
331
276
  }
332
277
 
333
278
  /** Generic PTable records filter */
334
- export type PTableRecordFilter = PTableRecordSingleValueFilter | PTableRecordSingleValueFilterV2;
279
+ export type PTableRecordFilter = PTableRecordSingleValueFilterV2;
335
280
 
336
281
  /** Sorting parameters for a PTable. */
337
282
  export type PTableSorting = {