@milaboratories/pl-model-middle-layer 1.28.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,27 +99,27 @@ declare const RegistryEntry: z.ZodObject<{
99
99
  }, "strip", z.ZodTypeAny, {
100
100
  id: string;
101
101
  spec: {
102
+ type: "local-dev";
103
+ path: string;
104
+ } | {
102
105
  type: "remote-v1";
103
106
  url: string;
104
107
  } | {
105
108
  type: "remote-v2";
106
109
  url: string;
107
- } | {
108
- type: "local-dev";
109
- path: string;
110
110
  };
111
111
  title?: string | undefined;
112
112
  }, {
113
113
  id: string;
114
114
  spec: {
115
+ type: "local-dev";
116
+ path: string;
117
+ } | {
115
118
  type: "remote-v1";
116
119
  url: string;
117
120
  } | {
118
121
  type: "remote-v2";
119
122
  url: string;
120
- } | {
121
- type: "local-dev";
122
- path: string;
123
123
  };
124
124
  title?: string | undefined;
125
125
  }>;
@@ -158,27 +158,27 @@ declare const RegistryList: z.ZodArray<z.ZodObject<{
158
158
  }, "strip", z.ZodTypeAny, {
159
159
  id: string;
160
160
  spec: {
161
+ type: "local-dev";
162
+ path: string;
163
+ } | {
161
164
  type: "remote-v1";
162
165
  url: string;
163
166
  } | {
164
167
  type: "remote-v2";
165
168
  url: string;
166
- } | {
167
- type: "local-dev";
168
- path: string;
169
169
  };
170
170
  title?: string | undefined;
171
171
  }, {
172
172
  id: string;
173
173
  spec: {
174
+ type: "local-dev";
175
+ path: string;
176
+ } | {
174
177
  type: "remote-v1";
175
178
  url: string;
176
179
  } | {
177
180
  type: "remote-v2";
178
181
  url: string;
179
- } | {
180
- type: "local-dev";
181
- path: string;
182
182
  };
183
183
  title?: string | undefined;
184
184
  }>, "many">;
@@ -1,4 +1,4 @@
1
- import { PTableV10 } from "./table.js";
1
+ import { PTableV10, PTableV11 } from "./table.js";
2
2
  import { PTableId } from "./common.js";
3
3
  import { DataQuery, DataQueryBooleanExpression, PObjectId, UniqueValuesResponse } from "@milaboratories/pl-model-common";
4
4
 
@@ -41,6 +41,28 @@ interface PFrameReadAPIV13 {
41
41
  signal?: AbortSignal;
42
42
  }): Promise<UniqueValuesResponse>;
43
43
  }
44
+ /**
45
+ * Read interface exposed by PFrames library. Returns the {@link PTableV11}
46
+ * table view, whose `export` takes a column-index → header map.
47
+ *
48
+ * Identical to {@link PFrameReadAPIV13} apart from the table view returned by
49
+ * `createTable`.
50
+ *
51
+ * Spec-side operations (finding columns, listing columns, retrieving
52
+ * column specs, computing axis integrations) are not part of this
53
+ * surface — callers cache column specs themselves or route through
54
+ * WASM-spec. The data-side `createTable` accepts a pre-lowered
55
+ * `DataQuery`; `getUniqueValues` takes pre-resolved indices via
56
+ * {@link UniqueValuesRequestV2}.
57
+ */
58
+ interface PFrameReadAPIV14 {
59
+ /** Creates table from a pre-lowered data query. */
60
+ createTable(tableId: PTableId, dataQuery: DataQuery): PTableV11;
61
+ /** Calculate set of unique values for a specific axis for the filtered set of records. */
62
+ getUniqueValues(request: UniqueValuesRequestV2, ops?: {
63
+ signal?: AbortSignal;
64
+ }): Promise<UniqueValuesResponse>;
65
+ }
44
66
  //#endregion
45
- export { PFrameReadAPIV13, UniqueValuesRequestV2 };
67
+ export { PFrameReadAPIV13, PFrameReadAPIV14, UniqueValuesRequestV2 };
46
68
  //# sourceMappingURL=api_read.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api_read.d.ts","names":[],"sources":["../../../src/pframe/internal_api/api_read.ts"],"mappings":";;;;;;;AAeA;;;;UAAiB,qBAAA;EAEI;EAAA,SAAV,QAAA,EAAU,SAAA;EASV;;;;EAAA,SAHA,SAAA;EAoBM;EAAA,SAjBN,OAAA,EAAS,0BAAA;;WAGT,KAAA;AAAA;;;;;;;;;;;;UAcM,gBAAA;EAEuC;EAAtD,WAAA,CAAY,OAAA,EAAS,QAAA,EAAU,SAAA,EAAW,SAAA,GAAY,SAAA;EAI3C;EADX,eAAA,CACE,OAAA,EAAS,qBAAA,EACT,GAAA;IACE,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA,CAAQ,oBAAA;AAAA"}
1
+ {"version":3,"file":"api_read.d.ts","names":[],"sources":["../../../src/pframe/internal_api/api_read.ts"],"mappings":";;;;;;;AAeA;;;;UAAiB,qBAAA;EAEI;EAAA,SAAV,QAAA,EAAU,SAAA;EASV;;;;EAAA,SAHA,SAAA;EAoBM;EAAA,SAjBN,OAAA,EAAS,0BAAA;;WAGT,KAAA;AAAA;;;;;;;;;;;;UAcM,gBAAA;EAEuC;EAAtD,WAAA,CAAY,OAAA,EAAS,QAAA,EAAU,SAAA,EAAW,SAAA,GAAY,SAAA;EAI3C;EADX,eAAA,CACE,OAAA,EAAS,qBAAA,EACT,GAAA;IACE,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA,CAAQ,oBAAA;AAAA;;;;;AAiBb;;;;;;;;;;UAAiB,gBAAA;EAUL;EARV,WAAA,CAAY,OAAA,EAAS,QAAA,EAAU,SAAA,EAAW,SAAA,GAAY,SAAA;EAAjC;EAGrB,eAAA,CACE,OAAA,EAAS,qBAAA,EACT,GAAA;IACE,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA,CAAQ,oBAAA;AAAA"}
@@ -1,6 +1,6 @@
1
- import { PTableV10 } from "./table.js";
1
+ import { PTableV10, PTableV11 } from "./table.js";
2
2
  import { AxisQualification, ColumnAxesWithQualifications, ConstantAxisFilter, Logger, PFrameId, PTableId } from "./common.js";
3
- import { PFrameReadAPIV13, UniqueValuesRequestV2 } from "./api_read.js";
3
+ import { PFrameReadAPIV13, PFrameReadAPIV14, UniqueValuesRequestV2 } from "./api_read.js";
4
4
  import { BaseObjectStore, FileRange, FsStoreOptions, HttpAuthorizationToken, HttpHelpers, HttpMethod, HttpRange, HttpServer, HttpServerInfo, HttpServerOptions, ObjectStore, ObjectStoreOptions, ObjectStoreResponse, ObjectStoreUrl, ParquetExtension, ParquetFileName, PemCertificate, RequestHandlerOptions } from "./http_helpers.js";
5
5
  import { AddColumnEntry, DataInfo, DataInfoExtension, FilePath, PColumnValueTypeSpec, PFrameBlobId, PFrameDataSourceV2, PFrameFactoryAPIV5, SpecExtension } from "./api_factory.js";
6
6
  import { DeleteColumnFromColumnsRequest, DeleteColumnFromColumnsResponse } from "./delete_column.js";
@@ -8,12 +8,12 @@ import { DiscoverColumnsConstraints, DiscoverColumnsMappingVariant, DiscoverColu
8
8
  import { FindColumnResponseQualifications, FindColumnsMappingVariant, FindColumnsRequest, FindColumnsResponse, FindColumnsResponseHit } from "./find_columns.js";
9
9
  import { EvaluateQueryResponse, LegacyQuery, PFrameWasmAPIV2, PFrameWasmAPIV3, PFrameWasmAPIV4, PFrameWasmV2, PFrameWasmV3 } from "./api_wasm.js";
10
10
  import { ArtificialColumnJoinEntry, ColumnJoinEntry, CreateTableRequestV4, FullJoinV4, InlineColumnJoinEntry, InnerJoinV4, JoinEntryV4, OuterJoinV4, SlicedColumnJoinEntry } from "./create_table.js";
11
- import { PFrameFactoryV6, PFrameOptionsV2, PFrameV15 } from "./pframe.js";
11
+ import { PFrameFactoryV6, PFrameFactoryV7, PFrameOptionsV2, PFrameV15, PFrameV16 } from "./pframe.js";
12
12
  import { SingleAxisSelector as SingleAxisSelector$1 } from "@milaboratories/pl-model-common";
13
13
 
14
14
  //#region src/pframe/internal_api/index.d.ts
15
15
  declare namespace index_d_exports {
16
- export { AddColumnEntry, ArtificialColumnJoinEntry, AxisQualification, BaseObjectStore, ColumnAxesWithQualifications, ColumnJoinEntry, ConstantAxisFilter, CreateTableRequestV4, DataInfo, DataInfoExtension, DeleteColumnFromColumnsRequest, DeleteColumnFromColumnsResponse, DiscoverColumnsConstraints, DiscoverColumnsMappingVariant, DiscoverColumnsRequestV2, DiscoverColumnsResponse, DiscoverColumnsResponseHit, DiscoverColumnsResponseQualifications, DiscoverColumnsStepInfo, EvaluateQueryResponse, FilePath, FileRange, FindColumnResponseQualifications, FindColumnsMappingVariant, FindColumnsRequest, FindColumnsResponse, FindColumnsResponseHit, FsStoreOptions, FullJoinV4, HttpAuthorizationToken, HttpHelpers, HttpMethod, HttpRange, HttpServer, HttpServerInfo, HttpServerOptions, InlineColumnJoinEntry, InnerJoinV4, JoinEntryV4, LegacyQuery, Logger, MatcherMap, MultiAxisSelector, MultiColumnSelector, ObjectStore, ObjectStoreOptions, ObjectStoreResponse, ObjectStoreUrl, OuterJoinV4, PColumnValueTypeSpec, PFrameBlobId, PFrameDataSourceV2, PFrameFactoryAPIV5, PFrameFactoryV6, PFrameId, PFrameOptionsV2, PFrameReadAPIV13, PFrameV15, PFrameWasmAPIV2, PFrameWasmAPIV3, PFrameWasmAPIV4, PFrameWasmV2, PFrameWasmV3, PTableId, PTableV10, ParquetExtension, ParquetFileName, PemCertificate, RequestHandlerOptions, SingleAxisSelector$1 as SingleAxisSelector, SlicedColumnJoinEntry, SpecExtension, StringMatcher, UniqueValuesRequestV2 };
16
+ export { AddColumnEntry, ArtificialColumnJoinEntry, AxisQualification, BaseObjectStore, ColumnAxesWithQualifications, ColumnJoinEntry, ConstantAxisFilter, CreateTableRequestV4, DataInfo, DataInfoExtension, DeleteColumnFromColumnsRequest, DeleteColumnFromColumnsResponse, DiscoverColumnsConstraints, DiscoverColumnsMappingVariant, DiscoverColumnsRequestV2, DiscoverColumnsResponse, DiscoverColumnsResponseHit, DiscoverColumnsResponseQualifications, DiscoverColumnsStepInfo, EvaluateQueryResponse, FilePath, FileRange, FindColumnResponseQualifications, FindColumnsMappingVariant, FindColumnsRequest, FindColumnsResponse, FindColumnsResponseHit, FsStoreOptions, FullJoinV4, HttpAuthorizationToken, HttpHelpers, HttpMethod, HttpRange, HttpServer, HttpServerInfo, HttpServerOptions, InlineColumnJoinEntry, InnerJoinV4, JoinEntryV4, LegacyQuery, Logger, MatcherMap, MultiAxisSelector, MultiColumnSelector, ObjectStore, ObjectStoreOptions, ObjectStoreResponse, ObjectStoreUrl, OuterJoinV4, PColumnValueTypeSpec, PFrameBlobId, PFrameDataSourceV2, PFrameFactoryAPIV5, PFrameFactoryV6, PFrameFactoryV7, PFrameId, PFrameOptionsV2, PFrameReadAPIV13, PFrameReadAPIV14, PFrameV15, PFrameV16, PFrameWasmAPIV2, PFrameWasmAPIV3, PFrameWasmAPIV4, PFrameWasmV2, PFrameWasmV3, PTableId, PTableV10, PTableV11, ParquetExtension, ParquetFileName, PemCertificate, RequestHandlerOptions, SingleAxisSelector$1 as SingleAxisSelector, SlicedColumnJoinEntry, SpecExtension, StringMatcher, UniqueValuesRequestV2 };
17
17
  }
18
18
  //#endregion
19
19
  export { index_d_exports };
@@ -1,5 +1,5 @@
1
1
  import { Logger, PFrameId } from "./common.js";
2
- import { PFrameReadAPIV13 } from "./api_read.js";
2
+ import { PFrameReadAPIV13, PFrameReadAPIV14 } from "./api_read.js";
3
3
  import { PFrameFactoryAPIV5 } from "./api_factory.js";
4
4
 
5
5
  //#region src/pframe/internal_api/pframe.d.ts
@@ -8,6 +8,13 @@ import { PFrameFactoryAPIV5 } from "./api_factory.js";
8
8
  * {@link PFrameReadAPIV13}, whose tables provide the `export` method.
9
9
  */
10
10
  interface PFrameV15 extends PFrameFactoryAPIV5, PFrameReadAPIV13 {}
11
+ /**
12
+ * Full PFrame surface — factory operations plus data-side reads.
13
+ *
14
+ * Identical to {@link PFrameV15} but exposes {@link PFrameReadAPIV14}, whose
15
+ * tables' `export` takes a column-index → header map.
16
+ */
17
+ interface PFrameV16 extends PFrameFactoryAPIV5, PFrameReadAPIV14 {}
11
18
  type PFrameOptionsV2 = {
12
19
  /** PFrame ID for logging purposes */frameId: PFrameId; /** Path to directory where PFrame can create temporary files */
13
20
  spillPath: string; /** Logger instance, no logging is performed when not provided */
@@ -32,6 +39,28 @@ interface PFrameFactoryV6 {
32
39
  */
33
40
  pprofDump: () => Promise<Uint8Array>;
34
41
  }
42
+ /**
43
+ * PFrame management functions exposed by the PFrame module. Creates
44
+ * {@link PFrameV16} instances, whose tables' `export` takes a
45
+ * column-index → header map.
46
+ *
47
+ * Identical to {@link PFrameFactoryV6} apart from the created PFrame surface.
48
+ */
49
+ interface PFrameFactoryV7 {
50
+ /**
51
+ * Create a new PFrame instance.
52
+ * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
53
+ */
54
+ createPFrame(options: PFrameOptionsV2): PFrameV16;
55
+ /**
56
+ * Dump active allocations from all PFrames instances in pprof format.
57
+ * The result of this function should be saved as `profile.pb.gz`.
58
+ * Use {@link https://pprof.me/} or {@link https://www.speedscope.app/}
59
+ * to view the allocation flamechart.
60
+ * @warning This method will always reject on Windows!
61
+ */
62
+ pprofDump: () => Promise<Uint8Array>;
63
+ }
35
64
  //#endregion
36
- export { PFrameFactoryV6, PFrameOptionsV2, PFrameV15 };
65
+ export { PFrameFactoryV6, PFrameFactoryV7, PFrameOptionsV2, PFrameV15, PFrameV16 };
37
66
  //# sourceMappingURL=pframe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pframe.d.ts","names":[],"sources":["../../../src/pframe/internal_api/pframe.ts"],"mappings":";;;;;;AASA;;;UAAiB,SAAA,SAAkB,kBAAA,EAAoB,gBAAA;AAAA,KAE3C,eAAA;EAAe,qCAEzB,OAAA,EAAS,QAAA,EAIM;EAFf,SAAA,UAFS;EAIT,MAAA,GAAS,MAAA;AAAA;;;;AAOX;UAAiB,eAAA;;;;;EAKf,YAAA,CAAa,OAAA,EAAS,eAAA,GAAkB,SAAA;EAShB;;;;;;;EAAxB,SAAA,QAAiB,OAAA,CAAQ,UAAA;AAAA"}
1
+ {"version":3,"file":"pframe.d.ts","names":[],"sources":["../../../src/pframe/internal_api/pframe.ts"],"mappings":";;;;;;AASA;;;UAAiB,SAAA,SAAkB,kBAAA,EAAoB,gBAAA;AAQvD;;;;;AAEA;AAFA,UAAiB,SAAA,SAAkB,kBAAA,EAAoB,gBAAA;AAAA,KAE3C,eAAA;EAEV,qCAAA,OAAA,EAAS,QAAA,EAET;EAAA,SAAA,UAES;EAAT,MAAA,GAAS,MAAA;AAAA;AAOX;;;;AAAA,UAAiB,eAAA;EAcU;;;;EATzB,YAAA,CAAa,OAAA,EAAS,eAAA,GAAkB,SAAA;EAAlB;;;;;;;EAStB,SAAA,QAAiB,OAAA,CAAQ,UAAA;AAAA;;;;;;;;UAUV,eAAA;EAKf;;;;EAAA,YAAA,CAAa,OAAA,EAAS,eAAA,GAAkB,SAAA;EASvB;;;;;;;EAAjB,SAAA,QAAiB,OAAA,CAAQ,UAAA;AAAA"}
@@ -64,6 +64,75 @@ interface PTableV10 extends Disposable {
64
64
  /** Deallocates all underlying resources */
65
65
  dispose(): void;
66
66
  }
67
+ /**
68
+ * Table view returned by `createTable`.
69
+ *
70
+ * Identical to {@link PTableV10} but {@link PTableV11.export} takes a
71
+ * `headers` map (unified column index → header name) that both selects the
72
+ * columns to export and names them, instead of a positional `string[]`.
73
+ *
74
+ * PTable can be thought as having a composite primary key, consisting
75
+ * of axes, and a set of data columns derived from PColumn values.
76
+ * The table's column spec is owned by the caller — selector → index
77
+ * resolution runs on the caller side via WASM-spec.
78
+ */
79
+ interface PTableV11 extends Disposable {
80
+ /**
81
+ * Get PTable disk footprint in bytes.
82
+ *
83
+ * @param ops.withPredecessors When true, the footprint includes
84
+ * every registered predecessor table reachable through the
85
+ * query lineage. When false or omitted, only this table's own
86
+ * materialised data is counted.
87
+ *
88
+ * Warning: This call materializes the join.
89
+ */
90
+ getFootprint(ops?: {
91
+ withPredecessors?: boolean;
92
+ signal?: AbortSignal;
93
+ }): Promise<number>;
94
+ /**
95
+ * Unified table shape
96
+ * Warning: This call materializes the join.
97
+ */
98
+ getShape(ops?: {
99
+ signal?: AbortSignal;
100
+ }): Promise<PTableShape>;
101
+ /**
102
+ * Retrieve the data from the table. To retrieve only data required, it can be
103
+ * sliced both horizontally ({@link columnIndices}) and vertically
104
+ * ({@link range}).
105
+ * This call materializes the join.
106
+ *
107
+ * @param columnIndices unified indices of columns to be retrieved
108
+ * @param range optionally limit the range of records to retrieve
109
+ * */
110
+ getData(columnIndices: number[], ops?: {
111
+ range?: TableRange;
112
+ signal?: AbortSignal;
113
+ }): Promise<PTableVector[]>;
114
+ /**
115
+ * Stream the sorted table to a file at `path`. The output format is
116
+ * selected from the file extension: `csv`, `tsv`, `parquet`, or `xlsx`.
117
+ * Writing is bounded-memory.
118
+ * This call materializes the join.
119
+ *
120
+ * @param path destination file path; its extension selects the format
121
+ * @param headers map from unified column index (axes first, then data
122
+ * columns) to the header name to use for that column. Only the columns
123
+ * present as keys are exported, in ascending index order — the map both
124
+ * selects the columns and names them (the data layer is name-independent,
125
+ * so names are supplied by the caller).
126
+ *
127
+ * @remarks For `xlsx` the caller must ensure the row count is below Excel's
128
+ * 1,048,576-row per-sheet limit.
129
+ */
130
+ export(path: string, headers: Record<number, string>, ops?: {
131
+ signal?: AbortSignal;
132
+ }): Promise<void>;
133
+ /** Deallocates all underlying resources */
134
+ dispose(): void;
135
+ }
67
136
  //#endregion
68
- export { PTableV10 };
137
+ export { PTableV10, PTableV11 };
69
138
  //# sourceMappingURL=table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","names":[],"sources":["../../../src/pframe/internal_api/table.ts"],"mappings":";;;;;AAUA;;;;;;UAAiB,SAAA,SAAkB,UAAA;EAiBS;;;;;;;;;;EAN1C,YAAA,CAAa,GAAA;IAAQ,gBAAA;IAA4B,MAAA,GAAS,WAAA;EAAA,IAAgB,OAAA;EAAhB;;;;EAM1D,QAAA,CAAS,GAAA;IAAQ,MAAA,GAAS,WAAA;EAAA,IAAgB,OAAA,CAAQ,WAAA;EAAR;;;;;;;;;EAW1C,OAAA,CACE,aAAA,YACA,GAAA;IACE,KAAA,GAAQ,UAAA;IACR,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA,CAAQ,YAAA;EAkBT;;;;;;;;;;;;;;EAFF,MAAA,CACE,IAAA,UACA,OAAA,YACA,GAAA;IACE,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA;;EAGH,OAAA;AAAA"}
1
+ {"version":3,"file":"table.d.ts","names":[],"sources":["../../../src/pframe/internal_api/table.ts"],"mappings":";;;;;AAUA;;;;;;UAAiB,SAAA,SAAkB,UAAA;EAiBS;;;;;;;;;;EAN1C,YAAA,CAAa,GAAA;IAAQ,gBAAA;IAA4B,MAAA,GAAS,WAAA;EAAA,IAAgB,OAAA;EAAhB;;;;EAM1D,QAAA,CAAS,GAAA;IAAQ,MAAA,GAAS,WAAA;EAAA,IAAgB,OAAA,CAAQ,WAAA;EAAR;;;;;;;;;EAW1C,OAAA,CACE,aAAA,YACA,GAAA;IACE,KAAA,GAAQ,UAAA;IACR,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA,CAAQ,YAAA;EAkBT;;;;;;;;AAsBJ;;;;;;EAxBE,MAAA,CACE,IAAA,UACA,OAAA,YACA,GAAA;IACE,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA;EAkDU;EA/Cb,OAAA;AAAA;;;;;;;;;;;;;UAee,SAAA,SAAkB,UAAA;EAiBjC;;;;;;;;;;EANA,YAAA,CAAa,GAAA;IAAQ,gBAAA;IAA4B,MAAA,GAAS,WAAA;EAAA,IAAgB,OAAA;EAuB/D;;;;EAjBX,QAAA,CAAS,GAAA;IAAQ,MAAA,GAAS,WAAA;EAAA,IAAgB,OAAA,CAAQ,WAAA;EAsChD;;;;;;;;;EA3BF,OAAA,CACE,aAAA,YACA,GAAA;IACE,KAAA,GAAQ,UAAA;IACR,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA,CAAQ,YAAA;;;;;;;;;;;;;;;;;EAkBX,MAAA,CACE,IAAA,UACA,OAAA,EAAS,MAAA,kBACT,GAAA;IACE,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA;;EAGH,OAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-middle-layer",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "description": "Common model between middle layer and non-block UI code",
5
5
  "files": [
6
6
  "./dist/**/*",
@@ -21,14 +21,14 @@
21
21
  "utility-types": "^3.11.0",
22
22
  "zod": "~3.25.76",
23
23
  "@milaboratories/helpers": "1.14.2",
24
- "@milaboratories/pl-model-common": "1.44.0"
24
+ "@milaboratories/pl-model-common": "1.45.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "~24.5.2",
28
28
  "typescript": "~5.9.3",
29
- "@milaboratories/build-configs": "2.0.0",
30
29
  "@milaboratories/ts-builder": "1.5.0",
31
- "@milaboratories/ts-configs": "1.2.3"
30
+ "@milaboratories/ts-configs": "1.2.3",
31
+ "@milaboratories/build-configs": "2.0.0"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "ts-builder build --target node",
@@ -4,7 +4,7 @@ import type {
4
4
  DataQuery,
5
5
  DataQueryBooleanExpression,
6
6
  } from "@milaboratories/pl-model-common";
7
- import type { PTableV10 } from "./table";
7
+ import type { PTableV10, PTableV11 } from "./table";
8
8
  import type { PTableId } from "./common";
9
9
 
10
10
  /**
@@ -53,3 +53,30 @@ export interface PFrameReadAPIV13 {
53
53
  },
54
54
  ): Promise<UniqueValuesResponse>;
55
55
  }
56
+
57
+ /**
58
+ * Read interface exposed by PFrames library. Returns the {@link PTableV11}
59
+ * table view, whose `export` takes a column-index → header map.
60
+ *
61
+ * Identical to {@link PFrameReadAPIV13} apart from the table view returned by
62
+ * `createTable`.
63
+ *
64
+ * Spec-side operations (finding columns, listing columns, retrieving
65
+ * column specs, computing axis integrations) are not part of this
66
+ * surface — callers cache column specs themselves or route through
67
+ * WASM-spec. The data-side `createTable` accepts a pre-lowered
68
+ * `DataQuery`; `getUniqueValues` takes pre-resolved indices via
69
+ * {@link UniqueValuesRequestV2}.
70
+ */
71
+ export interface PFrameReadAPIV14 {
72
+ /** Creates table from a pre-lowered data query. */
73
+ createTable(tableId: PTableId, dataQuery: DataQuery): PTableV11;
74
+
75
+ /** Calculate set of unique values for a specific axis for the filtered set of records. */
76
+ getUniqueValues(
77
+ request: UniqueValuesRequestV2,
78
+ ops?: {
79
+ signal?: AbortSignal;
80
+ },
81
+ ): Promise<UniqueValuesResponse>;
82
+ }
@@ -1,5 +1,5 @@
1
1
  import type { PFrameFactoryAPIV5 } from "./api_factory";
2
- import type { PFrameReadAPIV13 } from "./api_read";
2
+ import type { PFrameReadAPIV13, PFrameReadAPIV14 } from "./api_read";
3
3
  import type { Logger } from "./common";
4
4
  import type { PFrameId } from "./common";
5
5
 
@@ -9,6 +9,14 @@ import type { PFrameId } from "./common";
9
9
  */
10
10
  export interface PFrameV15 extends PFrameFactoryAPIV5, PFrameReadAPIV13 {}
11
11
 
12
+ /**
13
+ * Full PFrame surface — factory operations plus data-side reads.
14
+ *
15
+ * Identical to {@link PFrameV15} but exposes {@link PFrameReadAPIV14}, whose
16
+ * tables' `export` takes a column-index → header map.
17
+ */
18
+ export interface PFrameV16 extends PFrameFactoryAPIV5, PFrameReadAPIV14 {}
19
+
12
20
  export type PFrameOptionsV2 = {
13
21
  /** PFrame ID for logging purposes */
14
22
  frameId: PFrameId;
@@ -38,3 +46,27 @@ export interface PFrameFactoryV6 {
38
46
  */
39
47
  pprofDump: () => Promise<Uint8Array>;
40
48
  }
49
+
50
+ /**
51
+ * PFrame management functions exposed by the PFrame module. Creates
52
+ * {@link PFrameV16} instances, whose tables' `export` takes a
53
+ * column-index → header map.
54
+ *
55
+ * Identical to {@link PFrameFactoryV6} apart from the created PFrame surface.
56
+ */
57
+ export interface PFrameFactoryV7 {
58
+ /**
59
+ * Create a new PFrame instance.
60
+ * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
61
+ */
62
+ createPFrame(options: PFrameOptionsV2): PFrameV16;
63
+
64
+ /**
65
+ * Dump active allocations from all PFrames instances in pprof format.
66
+ * The result of this function should be saved as `profile.pb.gz`.
67
+ * Use {@link https://pprof.me/} or {@link https://www.speedscope.app/}
68
+ * to view the allocation flamechart.
69
+ * @warning This method will always reject on Windows!
70
+ */
71
+ pprofDump: () => Promise<Uint8Array>;
72
+ }
@@ -69,3 +69,79 @@ export interface PTableV10 extends Disposable {
69
69
  /** Deallocates all underlying resources */
70
70
  dispose(): void;
71
71
  }
72
+
73
+ /**
74
+ * Table view returned by `createTable`.
75
+ *
76
+ * Identical to {@link PTableV10} but {@link PTableV11.export} takes a
77
+ * `headers` map (unified column index → header name) that both selects the
78
+ * columns to export and names them, instead of a positional `string[]`.
79
+ *
80
+ * PTable can be thought as having a composite primary key, consisting
81
+ * of axes, and a set of data columns derived from PColumn values.
82
+ * The table's column spec is owned by the caller — selector → index
83
+ * resolution runs on the caller side via WASM-spec.
84
+ */
85
+ export interface PTableV11 extends Disposable {
86
+ /**
87
+ * Get PTable disk footprint in bytes.
88
+ *
89
+ * @param ops.withPredecessors When true, the footprint includes
90
+ * every registered predecessor table reachable through the
91
+ * query lineage. When false or omitted, only this table's own
92
+ * materialised data is counted.
93
+ *
94
+ * Warning: This call materializes the join.
95
+ */
96
+ getFootprint(ops?: { withPredecessors?: boolean; signal?: AbortSignal }): Promise<number>;
97
+
98
+ /**
99
+ * Unified table shape
100
+ * Warning: This call materializes the join.
101
+ */
102
+ getShape(ops?: { signal?: AbortSignal }): Promise<PTableShape>;
103
+
104
+ /**
105
+ * Retrieve the data from the table. To retrieve only data required, it can be
106
+ * sliced both horizontally ({@link columnIndices}) and vertically
107
+ * ({@link range}).
108
+ * This call materializes the join.
109
+ *
110
+ * @param columnIndices unified indices of columns to be retrieved
111
+ * @param range optionally limit the range of records to retrieve
112
+ * */
113
+ getData(
114
+ columnIndices: number[],
115
+ ops?: {
116
+ range?: TableRange;
117
+ signal?: AbortSignal;
118
+ },
119
+ ): Promise<PTableVector[]>;
120
+
121
+ /**
122
+ * Stream the sorted table to a file at `path`. The output format is
123
+ * selected from the file extension: `csv`, `tsv`, `parquet`, or `xlsx`.
124
+ * Writing is bounded-memory.
125
+ * This call materializes the join.
126
+ *
127
+ * @param path destination file path; its extension selects the format
128
+ * @param headers map from unified column index (axes first, then data
129
+ * columns) to the header name to use for that column. Only the columns
130
+ * present as keys are exported, in ascending index order — the map both
131
+ * selects the columns and names them (the data layer is name-independent,
132
+ * so names are supplied by the caller).
133
+ *
134
+ * @remarks For `xlsx` the caller must ensure the row count is below Excel's
135
+ * 1,048,576-row per-sheet limit.
136
+ */
137
+ export(
138
+ path: string,
139
+ headers: Record<number, string>,
140
+ ops?: {
141
+ signal?: AbortSignal;
142
+ },
143
+ ): Promise<void>;
144
+
145
+ /** Deallocates all underlying resources */
146
+ dispose(): void;
147
+ }