@milaboratories/pl-model-common 1.10.1 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base32-encode.d.ts +8 -0
- package/dist/base32-encode.d.ts.map +1 -0
- package/dist/drivers/pframe/data.d.ts +11 -3
- package/dist/drivers/pframe/data.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +203 -143
- package/dist/index.mjs.map +1 -1
- package/dist/plid.d.ts +11 -0
- package/dist/plid.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/base32-encode.ts +74 -0
- package/src/drivers/pframe/data.ts +22 -8
- package/src/index.ts +1 -0
- package/src/plid.ts +31 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Data = Int8Array | Uint8Array | Uint8ClampedArray | ArrayBuffer;
|
|
2
|
+
interface Options {
|
|
3
|
+
/** If set, forcefully enable or disable padding. The default behavior is to follow the default of the selected variant. */
|
|
4
|
+
padding?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function base32Encode(data: Data, variant: 'RFC3548' | 'RFC4648' | 'RFC4648-HEX' | 'Crockford', options?: Options): string;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=base32-encode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base32-encode.d.ts","sourceRoot":"","sources":["../src/base32-encode.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,WAAW,CAAC;AAarE,UAAU,OAAO;IACf,2HAA2H;IAC3H,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD,wBAAgB,YAAY,CAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,EAC5D,OAAO,CAAC,EAAE,OAAO,UAgDlB"}
|
|
@@ -87,14 +87,22 @@ export type PColumnValuesEntry = {
|
|
|
87
87
|
val: PColumnValue;
|
|
88
88
|
};
|
|
89
89
|
export type PColumnValues = PColumnValuesEntry[];
|
|
90
|
-
export declare const
|
|
90
|
+
export declare const PTableAbsent: {
|
|
91
91
|
type: string;
|
|
92
92
|
};
|
|
93
|
+
export type PTableAbsent = typeof PTableAbsent;
|
|
93
94
|
export declare const PTableNA: null;
|
|
95
|
+
export type PTableNA = typeof PTableNA;
|
|
94
96
|
/** Decoded PTable value */
|
|
95
|
-
export type PTableValue =
|
|
97
|
+
export type PTableValue = PTableAbsent | PTableNA | number | string;
|
|
98
|
+
/** Type guard for absent PValue */
|
|
99
|
+
export declare function isPTableAbsent(value: PTableValue): value is PTableAbsent;
|
|
100
|
+
export type AbsentAndNAFill = {
|
|
101
|
+
na?: PTableValue;
|
|
102
|
+
absent?: PTableValue;
|
|
103
|
+
};
|
|
96
104
|
/** Read PTableValue from PTable column at specified row */
|
|
97
|
-
export declare function pTableValue(column: PTableVector, row: number): PTableValue;
|
|
105
|
+
export declare function pTableValue(column: PTableVector, row: number, fill?: AbsentAndNAFill): PTableValue;
|
|
98
106
|
/** Used in requests to partially retrieve table's data */
|
|
99
107
|
export type TableRange = {
|
|
100
108
|
/** Index of the first record to retrieve */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,eAAO,MAAM,WAAW,cAAc,CAAC;AACvC,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,aAAa,QAAM,CAAC;AACjC,eAAO,MAAM,cAAc,QAAM,CAAC;AAClC,eAAO,MAAM,cAAc,MAAO,CAAC;AACnC,eAAO,MAAM,aAAa,MAAO,CAAC;AAElC,MAAM,MAAM,SAAS,G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,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("zod");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("zod");function _(t){return t!==void 0&&t.startsWith("log+live://log/")}function g(t){throw new Error("Unexpected object: "+t)}const N="upload://upload/",A="index://index/";function h(t){return t.startsWith(N)}function V(t){return t.startsWith(A)}function I(t){if(V(t)){const n=t.slice(A.length);return JSON.parse(decodeURIComponent(n)).path}else if(h(t)){const n=t.slice(N.length);return JSON.parse(decodeURIComponent(n)).localPath}g(t)}function z(t){return t.replace(/^.*[\\/]/,"")}function M(t){return z(I(t))}const E=-2147483648,b=-9007199254740991n,C=NaN,F=NaN,x=null,S=null;function l(t,n){switch(n){case"Int":return t===E;case"Long":return t===Number(b)||t===b;case"Float":return t===C;case"Double":return t===F;case"String":return t===x;case"Bytes":return t===S;default:throw Error(`unsupported data type: ${n}`)}}function W(t){if(!R(t))throw new Error(`Expected not-NA PValue, got ${t}`);return t}function R(t,n){if(!n)return typeof t=="string"||typeof t=="number"&&isFinite(t)||typeof t=="bigint";if(l(t,n))return!1;switch(n){case"Int":return typeof t=="number";case"Long":return typeof t=="number"||typeof t=="bigint";case"Float":return typeof t=="number";case"Double":return typeof t=="number";case"String":return typeof t=="string";case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${n}`)}}function U(t,n){if(!n)return t===null||typeof t=="string"||typeof t=="number"||typeof t=="bigint";if(l(t,n))return!0;switch(n){case"Int":return typeof t=="number";case"Long":return typeof t=="number"||typeof t=="bigint";case"Float":return typeof t=="number";case"Double":return typeof t=="number";case"String":return typeof t=="string";case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${n}`)}}function K(t){if(t===null||typeof t=="string"||typeof t=="number")return t;if(typeof t=="bigint")return{bigint:t.toString()};throw new Error(`Type ${typeof t} (value ${t}) not yet supported.`)}function B(t,n){if(t===null||typeof t=="string"||typeof t=="number"||typeof t=="bigint"){if(n&&!l(t,n)&&!U(t,n))throw new Error(`Unexpected value type, got ${typeof t}, expected ${n}`);return t}if(typeof t=="object"&&t!==null&&"bigint"in t&&typeof t.bigint=="string"){if(n&&n!=="Long")throw new Error(`Unexpected value type, got serialized bigint, expected ${n}`);return BigInt(t.bigint)}throw new Error(`Unsupported type ${typeof t} (value ${t}).`)}function X(t){if(t=D(t),t===null)throw new Error("Value is null");return t}function D(t){if(t=B(t),t===null)return null;if(typeof t=="string")return t;if(typeof t=="number"){if(!isFinite(t))throw new Error(`Value is not finite (${t})`);return t}if(typeof t=="bigint")return Number(t);throw new Error(`Unexpected value type: ${typeof t}`)}function k(t,n){const e=Math.floor(n/8),r=1<<7-n%8;return(t[e]&r)>0}const O={type:"absent"},L=null;function q(t){return typeof t=="object"&&t!==null&&t.type==="absent"}function G(t,n,e={}){if(k(t.absent,n))return e.absent===void 0?O:e.absent;const r=t.data[n],o=t.type;if(l(r,o))return e.na===void 0?L:e.na;switch(o){case"Int":return r;case"Long":return Number(r);case"Float":return r;case"Double":return r;case"String":return r;case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${o}`)}}function $(t){const{type:n,name:e,domain:r}=t;return{type:n,name:e,...r&&{domain:r}}}function Q(t){return t.map($)}function Y(t,n){if(t===void 0)return n===void 0;if(n===void 0)return!0;for(const e in n)if(t[e]!==n[e])return!1;return!0}function Z(t,n){return t.name===n.name&&Y(t.domain,n.domain)}function v(t,n){return{...t,src:c(t.src,n)}}function c(t,n){switch(t.type){case"column":return{type:"column",column:n(t.column)};case"inner":case"full":return{type:t.type,entries:t.entries.map(e=>c(e,n))};case"outer":return{type:"outer",primary:c(t.primary,n),secondary:t.secondary.map(e=>c(e,n))};default:g(t)}}const tt={href:"/"},nt=a.z.object({__isRef:a.z.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),blockId:a.z.string().describe("Upstream block id"),name:a.z.string().describe("Name of the output provided to the upstream block's output context")}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").strict().readonly();function et(t,n){return t.blockId===n.blockId&&t.name===n.name}function i(t){return t.kind==="PColumn"}function H(t){return i(t.spec)}function rt(t){return i(t.obj)}function ot(t){return i(t.obj.spec)}function it(t){if(!H(t))throw new Error(`not a PColumn (kind = ${t.spec.kind})`);return t}function st(t,n){return t===void 0?void 0:{...t,data:n(t.data)}}function ut(t){const n=new Map,e=r=>{switch(r.type){case"column":n.set(r.column.id,r.column);return;case"full":case"inner":for(const o of r.entries)e(o);return;case"outer":e(r.primary);for(const o of r.secondary)e(o);return;default:g(r)}};return e(t),[...n.values()]}function at(t){throw new Error("Unexpected object: "+t)}function d(t,n){switch(t.type){case"and":for(const e of t.operands)if(!d(e,n))return!1;return!0;case"or":for(const e of t.operands)if(d(e,n))return!0;return!1;case"not":return!d(t.operand,n);case"name":return i(n)&&n.name===t.name;case"name_pattern":return i(n)&&!!n.name.match(t.pattern);case"annotation":return i(n)&&n.annotations!==void 0&&n.annotations[t.annotation]===t.value;case"annotation_pattern":return i(n)&&n.annotations!==void 0&&n.annotations[t.annotation]!==void 0&&!!n.annotations[t.annotation].match(t.pattern);case"has_axes":return i(n)&&t.axes.every(e=>n.axesSpec.some(r=>(e.type===void 0||e.type===r.type)&&(e.name===void 0||e.name===r.name)&&(e.domain===void 0||Object.keys(e.domain).length===0||r.domain!==void 0&&Object.entries(e.domain).every(([o,p])=>r.domain[o]===p))));default:at(t)}}function ct(t,n){return t.ok?{ok:!0,value:n(t.value)}:t}function lt(t){if(t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray)return new DataView(t.buffer,t.byteOffset,t.byteLength);if(t instanceof ArrayBuffer)return new DataView(t);throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray")}const ft="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",dt="0123456789ABCDEFGHIJKLMNOPQRSTUV",pt="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function T(t,n,e){e=e||{};let r,o;switch(n){case"RFC3548":case"RFC4648":r=ft,o=!0;break;case"RFC4648-HEX":r=dt,o=!0;break;case"Crockford":r=pt,o=!1;break;default:throw new Error("Unknown base32 variant: "+n)}const p=e.padding!==void 0?e.padding:o,w=lt(t);let s=0,f=0,u="";for(let m=0;m<w.byteLength;m++)for(f=f<<8|w.getUint8(m),s+=8;s>=5;)u+=r[f>>>s-5&31],s-=5;if(s>0&&(u+=r[f<<5-s&31]),p)for(;u.length%8!==0;)u+="=";return u}const y=15,J=24,P=a.z.string().length(J).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");function mt(){const t=new Uint8Array(y);return crypto.getRandomValues(t),P.parse(T(t,"RFC4648"))}function j(t){if(t.length!==y)throw new Error(`Wrong number of bytes: ${t.length}`);return P.parse(T(t,"RFC4648"))}async function bt(t){const n=new TextEncoder,e=await crypto.subtle.digest("SHA-256",n.encode(t));return j(new Uint8Array(e.slice(0,15)))}exports.DefaultNavigationState=tt;exports.PTableAbsent=O;exports.PTableNA=L;exports.PValueBytesNA=S;exports.PValueDoubleNA=F;exports.PValueFloatNA=C;exports.PValueIntNA=E;exports.PValueLongNA=b;exports.PValueStringNA=x;exports.PlId=P;exports.PlIdBytes=y;exports.PlIdLength=J;exports.PlRef=nt;exports.digestPlId=bt;exports.ensureNotNAPValue=W;exports.ensurePColumn=it;exports.executePSpecPredicate=d;exports.extractAllColumns=ut;exports.getAxesId=Q;exports.getAxisId=$;exports.getFileNameFromHandle=M;exports.getFilePathFromHandle=I;exports.isImportFileHandleIndex=V;exports.isImportFileHandleUpload=h;exports.isLiveLog=_;exports.isNotNAPValue=R;exports.isPColumn=H;exports.isPColumnResult=ot;exports.isPColumnSpec=i;exports.isPColumnSpecResult=rt;exports.isPTableAbsent=q;exports.isPValue=U;exports.isValueAbsent=k;exports.isValueNA=l;exports.mapJoinEntry=c;exports.mapPObjectData=st;exports.mapPTableDef=v;exports.mapValueInVOE=ct;exports.matchAxisId=Z;exports.pTableValue=G;exports.pValueToStringOrNumber=X;exports.pValueToStringOrNumberOrNull=D;exports.plId=j;exports.plRefsEqual=et;exports.safeConvertToPValue=B;exports.toJsonSafePValue=K;exports.uniquePlId=mt;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
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 { number } from 'zod';\nimport { 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 NotNAPValueInt = number;\nexport type NotNAPValueLong = number | bigint; // use bigint only if extra integer precision is needed\nexport type NotNAPValueFloat = number;\nexport type NotNAPValueDouble = number;\nexport type NotNAPValueString = string;\n\nexport type NotNAPValue = number | bigint | string;\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 function ensureNotNAPValue(value: string): string;\nexport function ensureNotNAPValue(value: number): number;\nexport function ensureNotNAPValue(value: bigint): bigint;\nexport function ensureNotNAPValue(value: unknown): NotNAPValue;\nexport function ensureNotNAPValue(value: unknown): NotNAPValue {\n if (!isNotNAPValue(value)) throw new Error(`Expected not-NA PValue, got ${value}`);\n return value;\n}\n\nexport function isNotNAPValue(value: unknown, valueType: 'Int'): value is number;\nexport function isNotNAPValue(value: unknown, valueType: 'Long'): value is number | bigint;\nexport function isNotNAPValue(value: unknown, valueType: 'Float'): value is number;\nexport function isNotNAPValue(value: unknown, valueType: 'Double'): value is number;\nexport function isNotNAPValue(value: unknown, valueType: 'String'): value is string;\nexport function isNotNAPValue(value: unknown, valueType: ValueType): value is NotNAPValue;\nexport function isNotNAPValue(value: unknown): value is NotNAPValue;\nexport function isNotNAPValue(value: unknown, valueType?: ValueType): boolean {\n if (!valueType)\n return (\n typeof value === 'string' ||\n (typeof value === 'number' && isFinite(value)) ||\n typeof value === 'bigint'\n );\n if (isValueNA(value, valueType)) return false;\n switch (valueType) {\n case 'Int':\n return typeof value === 'number';\n case 'Long':\n return typeof value === 'number' || typeof value === 'bigint';\n case 'Float':\n return typeof value === 'number';\n case 'Double':\n return typeof value === 'number';\n case 'String':\n return typeof value === 'string';\n case 'Bytes':\n throw Error(`Bytes not yet supported`);\n default:\n throw Error(`unsupported data type: ${valueType satisfies never}`);\n }\n}\n\nexport function isPValue(value: unknown, valueType: 'Int'): value is PValueInt;\nexport function isPValue(value: unknown, valueType: 'Long'): value is PValueLong;\nexport function isPValue(value: unknown, valueType: 'Float'): value is PValueFloat;\nexport function isPValue(value: unknown, valueType: 'Double'): value is PValueDouble;\nexport function isPValue(value: unknown, valueType: 'String'): value is PValueString;\nexport function isPValue(value: unknown, valueType: ValueType): value is PValue;\nexport function isPValue(value: unknown): value is PValue;\nexport function isPValue(value: unknown, valueType?: ValueType): boolean {\n if (!valueType)\n return (\n value === null ||\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'bigint'\n );\n if (isValueNA(value, valueType)) return true;\n switch (valueType) {\n case 'Int':\n return typeof value === 'number';\n case 'Long':\n return typeof value === 'number' || typeof value === 'bigint';\n case 'Float':\n return typeof value === 'number';\n case 'Double':\n return typeof value === 'number';\n case 'String':\n return typeof value === 'string';\n case 'Bytes':\n throw Error(`Bytes not yet supported`);\n default:\n throw Error(`unsupported data type: ${valueType satisfies never}`);\n }\n}\n\nexport type PValueLongJsonSafe = { bigint: string };\nexport type PValueJsonSafe = number | string | null | PValueLongJsonSafe;\n\n/**\n * Converts PValue to value that can be safely serialized by standard JSON.stringify\n * method. Use {@link safeConvertToPValue} to \"deserialize\" the value back to runtime\n * PValue representation.\n */\nexport function toJsonSafePValue(value: PValue): PValueJsonSafe {\n if (value === null || typeof value === 'string' || typeof value === 'number') return value;\n if (typeof value === 'bigint') return { bigint: value.toString() };\n throw new Error(`Type ${typeof value} (value ${value}) not yet supported.`);\n}\n\n/**\n * Can be used to \"deserialize\" result of {@link toJsonSafePValue} or to\n * safely cast any unknown value to actual runtime PValue representation.\n */\nexport function safeConvertToPValue(value: unknown, checkType?: ValueType): PValue {\n if (\n value === null ||\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'bigint'\n ) {\n if (checkType && !isValueNA(value, checkType) && !isPValue(value, checkType))\n throw new Error(`Unexpected value type, got ${typeof value}, expected ${checkType}`);\n return value;\n }\n\n if (\n typeof value === 'object' &&\n value !== null &&\n 'bigint' in value &&\n typeof value.bigint === 'string'\n ) {\n if (checkType && checkType !== 'Long')\n throw new Error(`Unexpected value type, got serialized bigint, expected ${checkType}`);\n\n return BigInt(value.bigint);\n }\n\n throw new Error(`Unsupported type ${typeof value} (value ${value}).`);\n}\n\nexport function pValueToStringOrNumber(value: string): string;\nexport function pValueToStringOrNumber(value: number | bigint): number;\nexport function pValueToStringOrNumber(value: PValue | PValueJsonSafe): string | number;\nexport function pValueToStringOrNumber(value: PValue | PValueJsonSafe): string | number {\n value = pValueToStringOrNumberOrNull(value);\n if (value === null) throw new Error('Value is null');\n return value;\n}\n\nexport function pValueToStringOrNumberOrNull(value: string | null): string;\nexport function pValueToStringOrNumberOrNull(value: number | bigint | null): number;\nexport function pValueToStringOrNumberOrNull(\n value: PValue | PValueJsonSafe\n): string | number | null;\nexport function pValueToStringOrNumberOrNull(\n value: PValue | PValueJsonSafe\n): string | number | null {\n value = safeConvertToPValue(value);\n if (value === null) return null;\n if (typeof value === 'string') return value;\n if (typeof value === 'number') {\n if (!isFinite(value)) throw new Error(`Value is not finite (${value})`);\n return value;\n }\n if (typeof value === 'bigint') {\n // @TODO add range check\n return Number(value);\n }\n throw new Error(`Unexpected value type: ${typeof value}`);\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\nexport type PColumnValue = null | number | string;\nexport type PColumnValuesEntry = {\n key: PColumnValue[];\n val: PColumnValue;\n};\nexport type PColumnValues = PColumnValuesEntry[];\n\nexport const PTableNull = { type: 'absent' };\nexport const PTableNA = null;\n\n/** Decoded PTable value */\nexport type PTableValue =\n | typeof PTableNull\n | typeof PTableNA\n | number | string;\n\n/** Read PTableValue from PTable column at specified row */\nexport function pTableValue(column: PTableVector, row: number): PTableValue {\n if (isValueAbsent(column.absent, row)) return PTableNull;\n\n const value = column.data[row];\n const valueType = column.type;\n if (isValueNA(value, valueType)) return PTableNA;\n\n switch (valueType) {\n case 'Int':\n return value as PVectorDataInt[number];\n case 'Long':\n return Number(value as PVectorDataLong[number]);\n case 'Float':\n return value as PVectorDataFloat[number];\n case 'Double':\n return value as PVectorDataDouble[number];\n case 'String':\n return value as PVectorDataString[number];\n case 'Bytes':\n throw Error(`Bytes not yet supported`);\n default:\n throw Error(`unsupported data type: ${valueType satisfies never}`);\n }\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 { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\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\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case 'column':\n columns.set(entry.column.id, entry.column);\n return;\n case 'full':\n case 'inner':\n for (const e of entry.entries) addAllColumns(e);\n return;\n case 'outer':\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(e);\n return;\n default:\n assertNever(entry);\n }\n };\n addAllColumns(entry);\n return [...columns.values()];\n}\n","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","ensureNotNAPValue","isNotNAPValue","isPValue","toJsonSafePValue","safeConvertToPValue","checkType","pValueToStringOrNumber","pValueToStringOrNumberOrNull","isValueAbsent","absent","index","chunkIndex","mask","PTableNull","PTableNA","pTableValue","column","row","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","extractAllColumns","columns","addAllColumns","e","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,CChJO,MAAMY,EAAc,YACdC,EAAe,CAAC,kBAChBC,EAAgB,IAChBC,EAAiB,IACjBC,EAAiB,KACjBC,EAAgB,KAyBb,SAAAC,EAAUC,EAAgBC,EAA+B,CACvE,OAAQA,EAAW,CACjB,IAAK,MACH,OAA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B,CAAI,GAAKA,EAAK,OAASoC,EAAU,KACxD,IAAK,eACI,OAAAd,EAActB,CAAI,GAAK,EAAQA,EAAK,KAAK,MAAMoC,EAAU,OAAO,EACzE,IAAK,aAED,OAAAd,EAActB,CAAI,GAClBA,EAAK,cAAgB,QACrBA,EAAK,YAAYoC,EAAU,UAAU,IAAMA,EAAU,MAEzD,IAAK,qBAED,OAAAd,EAActB,CAAI,GAClBA,EAAK,cAAgB,QACrBA,EAAK,YAAYoC,EAAU,UAAU,IAAM,QAC3C,EAAQpC,EAAK,YAAYoC,EAAU,UAAU,EAAE,MAAMA,EAAU,OAAO,EAE1E,IAAK,WACH,OACEd,EAActB,CAAI,GAClBoC,EAAU,KAAK,MAAOE,GACpBtC,EAAK,SAAS,KACXuC,IACED,EAAQ,OAAS,QAAaA,EAAQ,OAASC,EAAS,QACxDD,EAAQ,OAAS,QAAaA,EAAQ,OAASC,EAAS,QACxDD,EAAQ,SAAW,QAClB,OAAO,KAAKA,EAAQ,MAAM,EAAE,SAAW,GACtCC,EAAS,SAAW,QACnB,OAAO,QAAQD,EAAQ,MAAM,EAAE,MAC7B,CAAC,CAACnC,EAAQqC,CAAW,IACnBD,EAAS,OAAQpC,CAAM,IAAMqC,CACjC,EAAA,CAEV,EAEJ,QACE/E,EAAY2E,CAAS,CAAA,CAE3B,CClFgB,SAAAK,EACdC,EACA9B,EACqB,CACd,OAAA8B,EAAI,GAAK,CAAE,GAAI,GAAM,MAAO9B,EAAG8B,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","../src/base32-encode.ts","../src/plid.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 { number } from 'zod';\nimport { 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 NotNAPValueInt = number;\nexport type NotNAPValueLong = number | bigint; // use bigint only if extra integer precision is needed\nexport type NotNAPValueFloat = number;\nexport type NotNAPValueDouble = number;\nexport type NotNAPValueString = string;\n\nexport type NotNAPValue = number | bigint | string;\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 function ensureNotNAPValue(value: string): string;\nexport function ensureNotNAPValue(value: number): number;\nexport function ensureNotNAPValue(value: bigint): bigint;\nexport function ensureNotNAPValue(value: unknown): NotNAPValue;\nexport function ensureNotNAPValue(value: unknown): NotNAPValue {\n if (!isNotNAPValue(value)) throw new Error(`Expected not-NA PValue, got ${value}`);\n return value;\n}\n\nexport function isNotNAPValue(value: unknown, valueType: 'Int'): value is number;\nexport function isNotNAPValue(value: unknown, valueType: 'Long'): value is number | bigint;\nexport function isNotNAPValue(value: unknown, valueType: 'Float'): value is number;\nexport function isNotNAPValue(value: unknown, valueType: 'Double'): value is number;\nexport function isNotNAPValue(value: unknown, valueType: 'String'): value is string;\nexport function isNotNAPValue(value: unknown, valueType: ValueType): value is NotNAPValue;\nexport function isNotNAPValue(value: unknown): value is NotNAPValue;\nexport function isNotNAPValue(value: unknown, valueType?: ValueType): boolean {\n if (!valueType)\n return (\n typeof value === 'string' ||\n (typeof value === 'number' && isFinite(value)) ||\n typeof value === 'bigint'\n );\n if (isValueNA(value, valueType)) return false;\n switch (valueType) {\n case 'Int':\n return typeof value === 'number';\n case 'Long':\n return typeof value === 'number' || typeof value === 'bigint';\n case 'Float':\n return typeof value === 'number';\n case 'Double':\n return typeof value === 'number';\n case 'String':\n return typeof value === 'string';\n case 'Bytes':\n throw Error(`Bytes not yet supported`);\n default:\n throw Error(`unsupported data type: ${valueType satisfies never}`);\n }\n}\n\nexport function isPValue(value: unknown, valueType: 'Int'): value is PValueInt;\nexport function isPValue(value: unknown, valueType: 'Long'): value is PValueLong;\nexport function isPValue(value: unknown, valueType: 'Float'): value is PValueFloat;\nexport function isPValue(value: unknown, valueType: 'Double'): value is PValueDouble;\nexport function isPValue(value: unknown, valueType: 'String'): value is PValueString;\nexport function isPValue(value: unknown, valueType: ValueType): value is PValue;\nexport function isPValue(value: unknown): value is PValue;\nexport function isPValue(value: unknown, valueType?: ValueType): boolean {\n if (!valueType)\n return (\n value === null ||\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'bigint'\n );\n if (isValueNA(value, valueType)) return true;\n switch (valueType) {\n case 'Int':\n return typeof value === 'number';\n case 'Long':\n return typeof value === 'number' || typeof value === 'bigint';\n case 'Float':\n return typeof value === 'number';\n case 'Double':\n return typeof value === 'number';\n case 'String':\n return typeof value === 'string';\n case 'Bytes':\n throw Error(`Bytes not yet supported`);\n default:\n throw Error(`unsupported data type: ${valueType satisfies never}`);\n }\n}\n\nexport type PValueLongJsonSafe = { bigint: string };\nexport type PValueJsonSafe = number | string | null | PValueLongJsonSafe;\n\n/**\n * Converts PValue to value that can be safely serialized by standard JSON.stringify\n * method. Use {@link safeConvertToPValue} to \"deserialize\" the value back to runtime\n * PValue representation.\n */\nexport function toJsonSafePValue(value: PValue): PValueJsonSafe {\n if (value === null || typeof value === 'string' || typeof value === 'number') return value;\n if (typeof value === 'bigint') return { bigint: value.toString() };\n throw new Error(`Type ${typeof value} (value ${value}) not yet supported.`);\n}\n\n/**\n * Can be used to \"deserialize\" result of {@link toJsonSafePValue} or to\n * safely cast any unknown value to actual runtime PValue representation.\n */\nexport function safeConvertToPValue(value: unknown, checkType?: ValueType): PValue {\n if (\n value === null ||\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'bigint'\n ) {\n if (checkType && !isValueNA(value, checkType) && !isPValue(value, checkType))\n throw new Error(`Unexpected value type, got ${typeof value}, expected ${checkType}`);\n return value;\n }\n\n if (\n typeof value === 'object' &&\n value !== null &&\n 'bigint' in value &&\n typeof value.bigint === 'string'\n ) {\n if (checkType && checkType !== 'Long')\n throw new Error(`Unexpected value type, got serialized bigint, expected ${checkType}`);\n\n return BigInt(value.bigint);\n }\n\n throw new Error(`Unsupported type ${typeof value} (value ${value}).`);\n}\n\nexport function pValueToStringOrNumber(value: string): string;\nexport function pValueToStringOrNumber(value: number | bigint): number;\nexport function pValueToStringOrNumber(value: PValue | PValueJsonSafe): string | number;\nexport function pValueToStringOrNumber(value: PValue | PValueJsonSafe): string | number {\n value = pValueToStringOrNumberOrNull(value);\n if (value === null) throw new Error('Value is null');\n return value;\n}\n\nexport function pValueToStringOrNumberOrNull(value: string | null): string;\nexport function pValueToStringOrNumberOrNull(value: number | bigint | null): number;\nexport function pValueToStringOrNumberOrNull(\n value: PValue | PValueJsonSafe\n): string | number | null;\nexport function pValueToStringOrNumberOrNull(\n value: PValue | PValueJsonSafe\n): string | number | null {\n value = safeConvertToPValue(value);\n if (value === null) return null;\n if (typeof value === 'string') return value;\n if (typeof value === 'number') {\n if (!isFinite(value)) throw new Error(`Value is not finite (${value})`);\n return value;\n }\n if (typeof value === 'bigint') {\n // @TODO add range check\n return Number(value);\n }\n throw new Error(`Unexpected value type: ${typeof value}`);\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\nexport type PColumnValue = null | number | string;\nexport type PColumnValuesEntry = {\n key: PColumnValue[];\n val: PColumnValue;\n};\nexport type PColumnValues = PColumnValuesEntry[];\n\nexport const PTableAbsent = { type: 'absent' };\nexport type PTableAbsent = typeof PTableAbsent;\nexport const PTableNA = null;\nexport type PTableNA = typeof PTableNA;\n\n/** Decoded PTable value */\nexport type PTableValue = PTableAbsent | PTableNA | number | string;\n\n/** Type guard for absent PValue */\nexport function isPTableAbsent(value: PTableValue): value is PTableAbsent {\n return typeof value === 'object' && value !== null && value.type === 'absent';\n}\n\nexport type AbsentAndNAFill = {\n na?: PTableValue;\n absent?: PTableValue;\n};\n\n/** Read PTableValue from PTable column at specified row */\nexport function pTableValue(\n column: PTableVector,\n row: number,\n fill: AbsentAndNAFill = {}\n): PTableValue {\n if (isValueAbsent(column.absent, row))\n return fill.absent === undefined ? PTableAbsent : fill.absent;\n\n const value = column.data[row];\n const valueType = column.type;\n if (isValueNA(value, valueType)) return fill.na === undefined ? PTableNA : fill.na;\n\n switch (valueType) {\n case 'Int':\n return value as PVectorDataInt[number];\n case 'Long':\n return Number(value as PVectorDataLong[number]);\n case 'Float':\n return value as PVectorDataFloat[number];\n case 'Double':\n return value as PVectorDataDouble[number];\n case 'String':\n return value as PVectorDataString[number];\n case 'Bytes':\n throw Error(`Bytes not yet supported`);\n default:\n throw Error(`unsupported data type: ${valueType satisfies never}`);\n }\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 { JoinEntry, PColumn, PColumnSpec } from '../drivers';\nimport { assertNever } from '../util';\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\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case 'column':\n columns.set(entry.column.id, entry.column);\n return;\n case 'full':\n case 'inner':\n for (const e of entry.entries) addAllColumns(e);\n return;\n case 'outer':\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(e);\n return;\n default:\n assertNever(entry);\n }\n };\n addAllColumns(entry);\n return [...columns.values()];\n}\n","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","type Data = Int8Array | Uint8Array | Uint8ClampedArray | ArrayBuffer;\n\nfunction toDataView(data: Data) {\n if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray)\n return new DataView(data.buffer, data.byteOffset, data.byteLength);\n\n if (data instanceof ArrayBuffer) return new DataView(data);\n\n throw new TypeError(\n 'Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray'\n );\n}\n\ninterface Options {\n /** If set, forcefully enable or disable padding. The default behavior is to follow the default of the selected variant. */\n padding?: boolean;\n}\n\nconst RFC4648 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';\nconst RFC4648_HEX = '0123456789ABCDEFGHIJKLMNOPQRSTUV';\nconst CROCKFORD = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';\n\nexport function base32Encode(\n data: Data,\n variant: 'RFC3548' | 'RFC4648' | 'RFC4648-HEX' | 'Crockford',\n options?: Options\n) {\n options = options || {};\n let alphabet, defaultPadding;\n\n switch (variant) {\n case 'RFC3548':\n case 'RFC4648':\n alphabet = RFC4648;\n defaultPadding = true;\n break;\n case 'RFC4648-HEX':\n alphabet = RFC4648_HEX;\n defaultPadding = true;\n break;\n case 'Crockford':\n alphabet = CROCKFORD;\n defaultPadding = false;\n break;\n default:\n throw new Error('Unknown base32 variant: ' + variant);\n }\n\n const padding = options.padding !== undefined ? options.padding : defaultPadding;\n const view = toDataView(data);\n\n let bits = 0;\n let value = 0;\n let output = '';\n\n for (let i = 0; i < view.byteLength; i++) {\n value = (value << 8) | view.getUint8(i);\n bits += 8;\n\n while (bits >= 5) {\n output += alphabet[(value >>> (bits - 5)) & 31];\n bits -= 5;\n }\n }\n\n if (bits > 0) output += alphabet[(value << (5 - bits)) & 31];\n\n if (padding)\n while (output.length % 8 !== 0) {\n output += '=';\n }\n\n return output;\n}\n","import { z } from 'zod';\nimport { base32Encode } from './base32-encode';\n\n/** Number of raw bytes in the PlId. */\nexport const PlIdBytes = 15;\n/** Characters in string representation */\nexport const PlIdLength = 24; // = 15 bytes * 8 bits / 5 bits per char in base32\n\nexport const PlId = z\n .string()\n .length(PlIdLength)\n .regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/) // RFC4648\n .brand('PlId');\nexport type PlId = z.infer<typeof PlId>;\n\nexport function uniquePlId(): PlId {\n const data = new Uint8Array(PlIdBytes);\n crypto.getRandomValues(data);\n return PlId.parse(base32Encode(data, 'RFC4648'));\n}\n\nexport function plId(bytes: Uint8Array): PlId {\n if (bytes.length !== PlIdBytes) throw new Error(`Wrong number of bytes: ${bytes.length}`);\n return PlId.parse(base32Encode(bytes, 'RFC4648'));\n}\n\nexport async function digestPlId(data: string): Promise<PlId> {\n const encoder = new TextEncoder();\n const bytes = await crypto.subtle.digest('SHA-256', encoder.encode(data));\n return plId(new Uint8Array(bytes.slice(0, 15)));\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","ensureNotNAPValue","isNotNAPValue","isPValue","toJsonSafePValue","safeConvertToPValue","checkType","pValueToStringOrNumber","pValueToStringOrNumberOrNull","isValueAbsent","absent","index","chunkIndex","mask","PTableAbsent","PTableNA","isPTableAbsent","pTableValue","column","row","fill","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","extractAllColumns","columns","addAllColumns","e","executePSpecPredicate","predicate","operator","matcher","axisSpec","domainValue","mapValueInVOE","voe","toDataView","data","RFC4648","RFC4648_HEX","CROCKFORD","base32Encode","variant","options","alphabet","defaultPadding","padding","view","bits","output","i","PlIdBytes","PlIdLength","PlId","uniquePlId","plId","bytes","digestPlId","encoder"],"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,CChJO,MAAMY,EAAc,YACdC,EAAe,CAAC,kBAChBC,EAAgB,IAChBC,EAAiB,IACjBC,EAAiB,KACjBC,EAAgB,KAyBb,SAAAC,EAAUC,EAAgBC,EAA+B,CACvE,OAAQA,EAAW,CACjB,IAAK,MACH,OAAOD,IAAUP,EACnB,IAAK,OACH,OAAOO,IAAU,OAAON,CAAY,GAAKM,IAAUN,EACrD,IAAK,QACH,OAAOM,IAAUL,EACnB,IAAK,SACH,OAAOK,IAAUJ,EACnB,IAAK,SACH,OAAOI,IAAUH,EACnB,IAAK,QACH,O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