@milaboratories/pl-model-middle-layer 1.27.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, PTableV9 } 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
 
@@ -23,7 +23,8 @@ interface UniqueValuesRequestV2 {
23
23
  readonly limit: number;
24
24
  }
25
25
  /**
26
- * Read interface exposed by PFrames library.
26
+ * Read interface exposed by PFrames library. Returns the {@link PTableV10}
27
+ * table view, which provides the `export` method.
27
28
  *
28
29
  * Spec-side operations (finding columns, listing columns, retrieving
29
30
  * column specs, computing axis integrations) are not part of this
@@ -32,19 +33,20 @@ interface UniqueValuesRequestV2 {
32
33
  * `DataQuery`; `getUniqueValues` takes pre-resolved indices via
33
34
  * {@link UniqueValuesRequestV2}.
34
35
  */
35
- interface PFrameReadAPIV12 {
36
+ interface PFrameReadAPIV13 {
36
37
  /** Creates table from a pre-lowered data query. */
37
- createTable(tableId: PTableId, dataQuery: DataQuery): PTableV9;
38
+ createTable(tableId: PTableId, dataQuery: DataQuery): PTableV10;
38
39
  /** Calculate set of unique values for a specific axis for the filtered set of records. */
39
40
  getUniqueValues(request: UniqueValuesRequestV2, ops?: {
40
41
  signal?: AbortSignal;
41
42
  }): Promise<UniqueValuesResponse>;
42
43
  }
43
44
  /**
44
- * Read interface exposed by PFrames library.
45
+ * Read interface exposed by PFrames library. Returns the {@link PTableV11}
46
+ * table view, whose `export` takes a column-index → header map.
45
47
  *
46
- * Identical to {@link PFrameReadAPIV12} but returns the {@link PTableV10}
47
- * table view, which adds the `export` method.
48
+ * Identical to {@link PFrameReadAPIV13} apart from the table view returned by
49
+ * `createTable`.
48
50
  *
49
51
  * Spec-side operations (finding columns, listing columns, retrieving
50
52
  * column specs, computing axis integrations) are not part of this
@@ -53,14 +55,14 @@ interface PFrameReadAPIV12 {
53
55
  * `DataQuery`; `getUniqueValues` takes pre-resolved indices via
54
56
  * {@link UniqueValuesRequestV2}.
55
57
  */
56
- interface PFrameReadAPIV13 {
58
+ interface PFrameReadAPIV14 {
57
59
  /** Creates table from a pre-lowered data query. */
58
- createTable(tableId: PTableId, dataQuery: DataQuery): PTableV10;
60
+ createTable(tableId: PTableId, dataQuery: DataQuery): PTableV11;
59
61
  /** Calculate set of unique values for a specific axis for the filtered set of records. */
60
62
  getUniqueValues(request: UniqueValuesRequestV2, ops?: {
61
63
  signal?: AbortSignal;
62
64
  }): Promise<UniqueValuesResponse>;
63
65
  }
64
66
  //#endregion
65
- export { PFrameReadAPIV12, PFrameReadAPIV13, UniqueValuesRequestV2 };
67
+ export { PFrameReadAPIV13, PFrameReadAPIV14, UniqueValuesRequestV2 };
66
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;EAmBM;EAAA,SAhBN,OAAA,EAAS,0BAAA;;WAGT,KAAA;AAAA;;;;;;;;;;;UAaM,gBAAA;EAEgB;EAA/B,WAAA,CAAY,OAAA,EAAS,QAAA,EAAU,SAAA,EAAW,SAAA,GAAY,QAAA;EAGtD;EAAA,eAAA,CACE,OAAA,EAAS,qBAAA,EACT,GAAA;IACE,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA,CAAQ,oBAAA;AAAA;;;;;;AAgBb;;;;;;;;UAAiB,gBAAA;EAUZ;EARH,WAAA,CAAY,OAAA,EAAS,QAAA,EAAU,SAAA,EAAW,SAAA,GAAY,SAAA;EAQ5C;EALV,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, PTableV9 } from "./table.js";
1
+ import { PTableV10, PTableV11 } from "./table.js";
2
2
  import { AxisQualification, ColumnAxesWithQualifications, ConstantAxisFilter, Logger, PFrameId, PTableId } from "./common.js";
3
- import { PFrameReadAPIV12, 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 { PFrameFactoryV5, PFrameFactoryV6, PFrameOptionsV2, PFrameV14, 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, PFrameFactoryV5, PFrameFactoryV6, PFrameId, PFrameOptionsV2, PFrameReadAPIV12, PFrameReadAPIV13, PFrameV14, PFrameV15, PFrameWasmAPIV2, PFrameWasmAPIV3, PFrameWasmAPIV4, PFrameWasmV2, PFrameWasmV3, PTableId, PTableV10, PTableV9, 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,29 +1,35 @@
1
1
  import { Logger, PFrameId } from "./common.js";
2
- import { PFrameReadAPIV12, 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
6
- /** Full PFrame surface — factory operations plus data-side reads. */
7
- interface PFrameV14 extends PFrameFactoryAPIV5, PFrameReadAPIV12 {}
6
+ /**
7
+ * Full PFrame surface — factory operations plus data-side reads. Exposes
8
+ * {@link PFrameReadAPIV13}, whose tables provide the `export` method.
9
+ */
10
+ interface PFrameV15 extends PFrameFactoryAPIV5, PFrameReadAPIV13 {}
8
11
  /**
9
12
  * Full PFrame surface — factory operations plus data-side reads.
10
13
  *
11
- * Identical to {@link PFrameV14} but exposes {@link PFrameReadAPIV13}, whose
12
- * tables add the `export` method.
14
+ * Identical to {@link PFrameV15} but exposes {@link PFrameReadAPIV14}, whose
15
+ * tables' `export` takes a column-index → header map.
13
16
  */
14
- interface PFrameV15 extends PFrameFactoryAPIV5, PFrameReadAPIV13 {}
17
+ interface PFrameV16 extends PFrameFactoryAPIV5, PFrameReadAPIV14 {}
15
18
  type PFrameOptionsV2 = {
16
19
  /** PFrame ID for logging purposes */frameId: PFrameId; /** Path to directory where PFrame can create temporary files */
17
20
  spillPath: string; /** Logger instance, no logging is performed when not provided */
18
21
  logger?: Logger;
19
22
  };
20
- /** PFrame management functions exposed by the PFrame module. */
21
- interface PFrameFactoryV5 {
23
+ /**
24
+ * PFrame management functions exposed by the PFrame module. Creates
25
+ * {@link PFrameV15} instances, whose tables provide the `export` method.
26
+ */
27
+ interface PFrameFactoryV6 {
22
28
  /**
23
29
  * Create a new PFrame instance.
24
30
  * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
25
31
  */
26
- createPFrame(options: PFrameOptionsV2): PFrameV14;
32
+ createPFrame(options: PFrameOptionsV2): PFrameV15;
27
33
  /**
28
34
  * Dump active allocations from all PFrames instances in pprof format.
29
35
  * The result of this function should be saved as `profile.pb.gz`.
@@ -34,17 +40,18 @@ interface PFrameFactoryV5 {
34
40
  pprofDump: () => Promise<Uint8Array>;
35
41
  }
36
42
  /**
37
- * PFrame management functions exposed by the PFrame module.
43
+ * PFrame management functions exposed by the PFrame module. Creates
44
+ * {@link PFrameV16} instances, whose tables' `export` takes a
45
+ * column-index → header map.
38
46
  *
39
- * Identical to {@link PFrameFactoryV5} but creates {@link PFrameV15} instances,
40
- * whose tables add the `export` method.
47
+ * Identical to {@link PFrameFactoryV6} apart from the created PFrame surface.
41
48
  */
42
- interface PFrameFactoryV6 {
49
+ interface PFrameFactoryV7 {
43
50
  /**
44
51
  * Create a new PFrame instance.
45
52
  * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
46
53
  */
47
- createPFrame(options: PFrameOptionsV2): PFrameV15;
54
+ createPFrame(options: PFrameOptionsV2): PFrameV16;
48
55
  /**
49
56
  * Dump active allocations from all PFrames instances in pprof format.
50
57
  * The result of this function should be saved as `profile.pb.gz`.
@@ -55,5 +62,5 @@ interface PFrameFactoryV6 {
55
62
  pprofDump: () => Promise<Uint8Array>;
56
63
  }
57
64
  //#endregion
58
- export { PFrameFactoryV5, PFrameFactoryV6, PFrameOptionsV2, PFrameV14, PFrameV15 };
65
+ export { PFrameFactoryV6, PFrameFactoryV7, PFrameOptionsV2, PFrameV15, PFrameV16 };
59
66
  //# sourceMappingURL=pframe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pframe.d.ts","names":[],"sources":["../../../src/pframe/internal_api/pframe.ts"],"mappings":";;;;;;UAMiB,SAAA,SAAkB,kBAAA,EAAoB,gBAAA;;;;AAQvD;;;UAAiB,SAAA,SAAkB,kBAAA,EAAoB,gBAAA;AAAA,KAE3C,eAAA;EAAe,qCAEzB,OAAA,EAAS,QAAA,EAIM;EAFf,SAAA,UAFS;EAIT,MAAA,GAAS,MAAA;AAAA;;UAIM,eAAA;EAJA;AAIjB;;;EAKE,YAAA,CAAa,OAAA,EAAS,eAAA,GAAkB,SAAA;EAAA;;;;;;;EASxC,SAAA,QAAiB,OAAA,CAAQ,UAAA;AAAA;;;;;;AAS3B;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"}
@@ -9,7 +9,7 @@ import { PTableShape, PTableVector, TableRange } from "@milaboratories/pl-model-
9
9
  * The table's column spec is owned by the caller — selector → index
10
10
  * resolution runs on the caller side via WASM-spec.
11
11
  */
12
- interface PTableV9 extends Disposable {
12
+ interface PTableV10 extends Disposable {
13
13
  /**
14
14
  * Get PTable disk footprint in bytes.
15
15
  *
@@ -44,18 +44,39 @@ interface PTableV9 extends Disposable {
44
44
  range?: TableRange;
45
45
  signal?: AbortSignal;
46
46
  }): Promise<PTableVector[]>;
47
+ /**
48
+ * Stream the full, sorted table to a file at `path`. The output format is
49
+ * selected from the file extension: `csv`, `tsv`, `parquet`, or `xlsx`.
50
+ * Writing is bounded-memory.
51
+ * This call materializes the join.
52
+ *
53
+ * @param path destination file path; its extension selects the format
54
+ * @param headers column names in unified order (axes first, then data
55
+ * columns). Length must equal the number of table fields — the data layer
56
+ * is name-independent, so names are supplied by the caller.
57
+ *
58
+ * @remarks For `xlsx` the caller must ensure the row count is below Excel's
59
+ * 1,048,576-row per-sheet limit.
60
+ */
61
+ export(path: string, headers: string[], ops?: {
62
+ signal?: AbortSignal;
63
+ }): Promise<void>;
47
64
  /** Deallocates all underlying resources */
48
65
  dispose(): void;
49
66
  }
50
67
  /**
51
68
  * Table view returned by `createTable`.
52
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
+ *
53
74
  * PTable can be thought as having a composite primary key, consisting
54
75
  * of axes, and a set of data columns derived from PColumn values.
55
76
  * The table's column spec is owned by the caller — selector → index
56
77
  * resolution runs on the caller side via WASM-spec.
57
78
  */
58
- interface PTableV10 extends Disposable {
79
+ interface PTableV11 extends Disposable {
59
80
  /**
60
81
  * Get PTable disk footprint in bytes.
61
82
  *
@@ -91,25 +112,27 @@ interface PTableV10 extends Disposable {
91
112
  signal?: AbortSignal;
92
113
  }): Promise<PTableVector[]>;
93
114
  /**
94
- * Stream the full, sorted table to a file at `path`. The output format is
115
+ * Stream the sorted table to a file at `path`. The output format is
95
116
  * selected from the file extension: `csv`, `tsv`, `parquet`, or `xlsx`.
96
117
  * Writing is bounded-memory.
97
118
  * This call materializes the join.
98
119
  *
99
120
  * @param path destination file path; its extension selects the format
100
- * @param headers column names in unified order (axes first, then data
101
- * columns). Length must equal the number of table fields — the data layer
102
- * is name-independent, so names are supplied by the caller.
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).
103
126
  *
104
127
  * @remarks For `xlsx` the caller must ensure the row count is below Excel's
105
128
  * 1,048,576-row per-sheet limit.
106
129
  */
107
- export(path: string, headers: string[], ops?: {
130
+ export(path: string, headers: Record<number, string>, ops?: {
108
131
  signal?: AbortSignal;
109
132
  }): Promise<void>;
110
133
  /** Deallocates all underlying resources */
111
134
  dispose(): void;
112
135
  }
113
136
  //#endregion
114
- export { PTableV10, PTableV9 };
137
+ export { PTableV10, PTableV11 };
115
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,QAAA,SAAiB,UAAA;EAiBU;;;;;;;;;;EAN1C,YAAA,CAAa,GAAA;IAAQ,gBAAA;IAA4B,MAAA,GAAS,WAAA;EAAA,IAAgB,OAAA;EAAA;;;;EAM1E,QAAA,CAAS,GAAA;IAAQ,MAAA,GAAS,WAAA;EAAA,IAAgB,OAAA,CAAQ,WAAA;EAWlD;;;;;;;;;EAAA,OAAA,CACE,aAAA,YACA,GAAA;IACE,KAAA,GAAQ,UAAA;IACR,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA,CAAQ,YAAA;EAcc;EAXzB,OAAA;AAAA;;;;;;;;;UAWe,SAAA,SAAkB,UAAA;EAwD9B;;;;;;;;;;EA7CH,YAAA,CAAa,GAAA;IAAQ,gBAAA;IAA4B,MAAA,GAAS,WAAA;EAAA,IAAgB,OAAA;EAMjE;;;;EAAT,QAAA,CAAS,GAAA;IAAQ,MAAA,GAAS,WAAA;EAAA,IAAgB,OAAA,CAAQ,WAAA;EAe9C;;;;;;;;;EAJJ,OAAA,CACE,aAAA,YACA,GAAA;IACE,KAAA,GAAQ,UAAA;IACR,MAAA,GAAS,WAAA;EAAA,IAEV,OAAA,CAAQ,YAAA;EAyBJ;;;;;;;;;;;;;;EATP,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.27.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,7 +21,7 @@
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.43.0"
24
+ "@milaboratories/pl-model-common": "1.45.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "~24.5.2",
@@ -4,7 +4,7 @@ import type {
4
4
  DataQuery,
5
5
  DataQueryBooleanExpression,
6
6
  } from "@milaboratories/pl-model-common";
7
- import type { PTableV9, PTableV10 } from "./table";
7
+ import type { PTableV10, PTableV11 } from "./table";
8
8
  import type { PTableId } from "./common";
9
9
 
10
10
  /**
@@ -31,7 +31,8 @@ export interface UniqueValuesRequestV2 {
31
31
  }
32
32
 
33
33
  /**
34
- * Read interface exposed by PFrames library.
34
+ * Read interface exposed by PFrames library. Returns the {@link PTableV10}
35
+ * table view, which provides the `export` method.
35
36
  *
36
37
  * Spec-side operations (finding columns, listing columns, retrieving
37
38
  * column specs, computing axis integrations) are not part of this
@@ -40,9 +41,9 @@ export interface UniqueValuesRequestV2 {
40
41
  * `DataQuery`; `getUniqueValues` takes pre-resolved indices via
41
42
  * {@link UniqueValuesRequestV2}.
42
43
  */
43
- export interface PFrameReadAPIV12 {
44
+ export interface PFrameReadAPIV13 {
44
45
  /** Creates table from a pre-lowered data query. */
45
- createTable(tableId: PTableId, dataQuery: DataQuery): PTableV9;
46
+ createTable(tableId: PTableId, dataQuery: DataQuery): PTableV10;
46
47
 
47
48
  /** Calculate set of unique values for a specific axis for the filtered set of records. */
48
49
  getUniqueValues(
@@ -54,10 +55,11 @@ export interface PFrameReadAPIV12 {
54
55
  }
55
56
 
56
57
  /**
57
- * Read interface exposed by PFrames library.
58
+ * Read interface exposed by PFrames library. Returns the {@link PTableV11}
59
+ * table view, whose `export` takes a column-index → header map.
58
60
  *
59
- * Identical to {@link PFrameReadAPIV12} but returns the {@link PTableV10}
60
- * table view, which adds the `export` method.
61
+ * Identical to {@link PFrameReadAPIV13} apart from the table view returned by
62
+ * `createTable`.
61
63
  *
62
64
  * Spec-side operations (finding columns, listing columns, retrieving
63
65
  * column specs, computing axis integrations) are not part of this
@@ -66,9 +68,9 @@ export interface PFrameReadAPIV12 {
66
68
  * `DataQuery`; `getUniqueValues` takes pre-resolved indices via
67
69
  * {@link UniqueValuesRequestV2}.
68
70
  */
69
- export interface PFrameReadAPIV13 {
71
+ export interface PFrameReadAPIV14 {
70
72
  /** Creates table from a pre-lowered data query. */
71
- createTable(tableId: PTableId, dataQuery: DataQuery): PTableV10;
73
+ createTable(tableId: PTableId, dataQuery: DataQuery): PTableV11;
72
74
 
73
75
  /** Calculate set of unique values for a specific axis for the filtered set of records. */
74
76
  getUniqueValues(
@@ -1,18 +1,21 @@
1
1
  import type { PFrameFactoryAPIV5 } from "./api_factory";
2
- import type { PFrameReadAPIV12, 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
 
6
- /** Full PFrame surface — factory operations plus data-side reads. */
7
- export interface PFrameV14 extends PFrameFactoryAPIV5, PFrameReadAPIV12 {}
6
+ /**
7
+ * Full PFrame surface — factory operations plus data-side reads. Exposes
8
+ * {@link PFrameReadAPIV13}, whose tables provide the `export` method.
9
+ */
10
+ export interface PFrameV15 extends PFrameFactoryAPIV5, PFrameReadAPIV13 {}
8
11
 
9
12
  /**
10
13
  * Full PFrame surface — factory operations plus data-side reads.
11
14
  *
12
- * Identical to {@link PFrameV14} but exposes {@link PFrameReadAPIV13}, whose
13
- * tables add the `export` method.
15
+ * Identical to {@link PFrameV15} but exposes {@link PFrameReadAPIV14}, whose
16
+ * tables' `export` takes a column-index → header map.
14
17
  */
15
- export interface PFrameV15 extends PFrameFactoryAPIV5, PFrameReadAPIV13 {}
18
+ export interface PFrameV16 extends PFrameFactoryAPIV5, PFrameReadAPIV14 {}
16
19
 
17
20
  export type PFrameOptionsV2 = {
18
21
  /** PFrame ID for logging purposes */
@@ -23,13 +26,16 @@ export type PFrameOptionsV2 = {
23
26
  logger?: Logger;
24
27
  };
25
28
 
26
- /** PFrame management functions exposed by the PFrame module. */
27
- export interface PFrameFactoryV5 {
29
+ /**
30
+ * PFrame management functions exposed by the PFrame module. Creates
31
+ * {@link PFrameV15} instances, whose tables provide the `export` method.
32
+ */
33
+ export interface PFrameFactoryV6 {
28
34
  /**
29
35
  * Create a new PFrame instance.
30
36
  * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
31
37
  */
32
- createPFrame(options: PFrameOptionsV2): PFrameV14;
38
+ createPFrame(options: PFrameOptionsV2): PFrameV15;
33
39
 
34
40
  /**
35
41
  * Dump active allocations from all PFrames instances in pprof format.
@@ -42,17 +48,18 @@ export interface PFrameFactoryV5 {
42
48
  }
43
49
 
44
50
  /**
45
- * PFrame management functions exposed by the PFrame module.
51
+ * PFrame management functions exposed by the PFrame module. Creates
52
+ * {@link PFrameV16} instances, whose tables' `export` takes a
53
+ * column-index → header map.
46
54
  *
47
- * Identical to {@link PFrameFactoryV5} but creates {@link PFrameV15} instances,
48
- * whose tables add the `export` method.
55
+ * Identical to {@link PFrameFactoryV6} apart from the created PFrame surface.
49
56
  */
50
- export interface PFrameFactoryV6 {
57
+ export interface PFrameFactoryV7 {
51
58
  /**
52
59
  * Create a new PFrame instance.
53
60
  * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
54
61
  */
55
- createPFrame(options: PFrameOptionsV2): PFrameV15;
62
+ createPFrame(options: PFrameOptionsV2): PFrameV16;
56
63
 
57
64
  /**
58
65
  * Dump active allocations from all PFrames instances in pprof format.
@@ -8,7 +8,7 @@ import type { PTableShape, PTableVector, TableRange } from "@milaboratories/pl-m
8
8
  * The table's column spec is owned by the caller — selector → index
9
9
  * resolution runs on the caller side via WASM-spec.
10
10
  */
11
- export interface PTableV9 extends Disposable {
11
+ export interface PTableV10 extends Disposable {
12
12
  /**
13
13
  * Get PTable disk footprint in bytes.
14
14
  *
@@ -44,6 +44,28 @@ export interface PTableV9 extends Disposable {
44
44
  },
45
45
  ): Promise<PTableVector[]>;
46
46
 
47
+ /**
48
+ * Stream the full, sorted table to a file at `path`. The output format is
49
+ * selected from the file extension: `csv`, `tsv`, `parquet`, or `xlsx`.
50
+ * Writing is bounded-memory.
51
+ * This call materializes the join.
52
+ *
53
+ * @param path destination file path; its extension selects the format
54
+ * @param headers column names in unified order (axes first, then data
55
+ * columns). Length must equal the number of table fields — the data layer
56
+ * is name-independent, so names are supplied by the caller.
57
+ *
58
+ * @remarks For `xlsx` the caller must ensure the row count is below Excel's
59
+ * 1,048,576-row per-sheet limit.
60
+ */
61
+ export(
62
+ path: string,
63
+ headers: string[],
64
+ ops?: {
65
+ signal?: AbortSignal;
66
+ },
67
+ ): Promise<void>;
68
+
47
69
  /** Deallocates all underlying resources */
48
70
  dispose(): void;
49
71
  }
@@ -51,12 +73,16 @@ export interface PTableV9 extends Disposable {
51
73
  /**
52
74
  * Table view returned by `createTable`.
53
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
+ *
54
80
  * PTable can be thought as having a composite primary key, consisting
55
81
  * of axes, and a set of data columns derived from PColumn values.
56
82
  * The table's column spec is owned by the caller — selector → index
57
83
  * resolution runs on the caller side via WASM-spec.
58
84
  */
59
- export interface PTableV10 extends Disposable {
85
+ export interface PTableV11 extends Disposable {
60
86
  /**
61
87
  * Get PTable disk footprint in bytes.
62
88
  *
@@ -93,22 +119,24 @@ export interface PTableV10 extends Disposable {
93
119
  ): Promise<PTableVector[]>;
94
120
 
95
121
  /**
96
- * Stream the full, sorted table to a file at `path`. The output format is
122
+ * Stream the sorted table to a file at `path`. The output format is
97
123
  * selected from the file extension: `csv`, `tsv`, `parquet`, or `xlsx`.
98
124
  * Writing is bounded-memory.
99
125
  * This call materializes the join.
100
126
  *
101
127
  * @param path destination file path; its extension selects the format
102
- * @param headers column names in unified order (axes first, then data
103
- * columns). Length must equal the number of table fields — the data layer
104
- * is name-independent, so names are supplied by the caller.
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).
105
133
  *
106
134
  * @remarks For `xlsx` the caller must ensure the row count is below Excel's
107
135
  * 1,048,576-row per-sheet limit.
108
136
  */
109
137
  export(
110
138
  path: string,
111
- headers: string[],
139
+ headers: Record<number, string>,
112
140
  ops?: {
113
141
  signal?: AbortSignal;
114
142
  },