@milaboratories/pl-model-middle-layer 1.26.0 → 1.27.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.
@@ -5,11 +5,11 @@ declare const LocalDevFolder: z.ZodObject<{
5
5
  type: z.ZodLiteral<"local-dev">;
6
6
  path: z.ZodString;
7
7
  }, "strip", z.ZodTypeAny, {
8
- path: string;
9
8
  type: "local-dev";
10
- }, {
11
9
  path: string;
10
+ }, {
12
11
  type: "local-dev";
12
+ path: string;
13
13
  }>;
14
14
  type LocalDevFolder = z.infer<typeof LocalDevFolder>;
15
15
  /** @deprecated don't use */
@@ -17,11 +17,11 @@ declare const RemoteRegistryV1Spec: z.ZodObject<{
17
17
  type: z.ZodLiteral<"remote-v1">;
18
18
  url: z.ZodString;
19
19
  }, "strip", z.ZodTypeAny, {
20
- url: string;
21
20
  type: "remote-v1";
22
- }, {
23
21
  url: string;
22
+ }, {
24
23
  type: "remote-v1";
24
+ url: string;
25
25
  }>;
26
26
  /** @deprecated don't use */
27
27
  type RemoteRegistryV1Spec = z.infer<typeof RemoteRegistryV1Spec>;
@@ -29,40 +29,40 @@ declare const RemoteRegistryV2Spec: z.ZodObject<{
29
29
  type: z.ZodLiteral<"remote-v2">;
30
30
  url: z.ZodString;
31
31
  }, "strip", z.ZodTypeAny, {
32
- url: string;
33
32
  type: "remote-v2";
34
- }, {
35
33
  url: string;
34
+ }, {
36
35
  type: "remote-v2";
36
+ url: string;
37
37
  }>;
38
38
  type RemoteRegistryV2Spec = z.infer<typeof RemoteRegistryV2Spec>;
39
39
  declare const RegistrySpec: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
40
40
  type: z.ZodLiteral<"remote-v1">;
41
41
  url: z.ZodString;
42
42
  }, "strip", z.ZodTypeAny, {
43
- url: string;
44
43
  type: "remote-v1";
45
- }, {
46
44
  url: string;
45
+ }, {
47
46
  type: "remote-v1";
47
+ url: string;
48
48
  }>, z.ZodObject<{
49
49
  type: z.ZodLiteral<"remote-v2">;
50
50
  url: z.ZodString;
51
51
  }, "strip", z.ZodTypeAny, {
52
- url: string;
53
52
  type: "remote-v2";
54
- }, {
55
53
  url: string;
54
+ }, {
56
55
  type: "remote-v2";
56
+ url: string;
57
57
  }>, z.ZodObject<{
58
58
  type: z.ZodLiteral<"local-dev">;
59
59
  path: z.ZodString;
60
60
  }, "strip", z.ZodTypeAny, {
61
- path: string;
62
61
  type: "local-dev";
63
- }, {
64
62
  path: string;
63
+ }, {
65
64
  type: "local-dev";
65
+ path: string;
66
66
  }>]>;
67
67
  type RegistrySpec = z.infer<typeof RegistrySpec>;
68
68
  declare const RegistryEntry: z.ZodObject<{
@@ -72,54 +72,54 @@ declare const RegistryEntry: z.ZodObject<{
72
72
  type: z.ZodLiteral<"remote-v1">;
73
73
  url: z.ZodString;
74
74
  }, "strip", z.ZodTypeAny, {
75
- url: string;
76
75
  type: "remote-v1";
77
- }, {
78
76
  url: string;
77
+ }, {
79
78
  type: "remote-v1";
79
+ url: string;
80
80
  }>, z.ZodObject<{
81
81
  type: z.ZodLiteral<"remote-v2">;
82
82
  url: z.ZodString;
83
83
  }, "strip", z.ZodTypeAny, {
84
- url: string;
85
84
  type: "remote-v2";
86
- }, {
87
85
  url: string;
86
+ }, {
88
87
  type: "remote-v2";
88
+ url: string;
89
89
  }>, z.ZodObject<{
90
90
  type: z.ZodLiteral<"local-dev">;
91
91
  path: z.ZodString;
92
92
  }, "strip", z.ZodTypeAny, {
93
- path: string;
94
93
  type: "local-dev";
95
- }, {
96
94
  path: string;
95
+ }, {
97
96
  type: "local-dev";
97
+ path: string;
98
98
  }>]>;
99
99
  }, "strip", z.ZodTypeAny, {
100
100
  id: string;
101
101
  spec: {
102
- path: string;
103
- type: "local-dev";
104
- } | {
105
- url: string;
106
102
  type: "remote-v1";
107
- } | {
108
103
  url: string;
104
+ } | {
109
105
  type: "remote-v2";
106
+ 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
- path: string;
116
- type: "local-dev";
117
- } | {
118
- url: string;
119
115
  type: "remote-v1";
120
- } | {
121
116
  url: string;
117
+ } | {
122
118
  type: "remote-v2";
119
+ url: string;
120
+ } | {
121
+ type: "local-dev";
122
+ path: string;
123
123
  };
124
124
  title?: string | undefined;
125
125
  }>;
@@ -131,54 +131,54 @@ declare const RegistryList: z.ZodArray<z.ZodObject<{
131
131
  type: z.ZodLiteral<"remote-v1">;
132
132
  url: z.ZodString;
133
133
  }, "strip", z.ZodTypeAny, {
134
- url: string;
135
134
  type: "remote-v1";
136
- }, {
137
135
  url: string;
136
+ }, {
138
137
  type: "remote-v1";
138
+ url: string;
139
139
  }>, z.ZodObject<{
140
140
  type: z.ZodLiteral<"remote-v2">;
141
141
  url: z.ZodString;
142
142
  }, "strip", z.ZodTypeAny, {
143
- url: string;
144
143
  type: "remote-v2";
145
- }, {
146
144
  url: string;
145
+ }, {
147
146
  type: "remote-v2";
147
+ url: string;
148
148
  }>, z.ZodObject<{
149
149
  type: z.ZodLiteral<"local-dev">;
150
150
  path: z.ZodString;
151
151
  }, "strip", z.ZodTypeAny, {
152
- path: string;
153
152
  type: "local-dev";
154
- }, {
155
153
  path: string;
154
+ }, {
156
155
  type: "local-dev";
156
+ path: string;
157
157
  }>]>;
158
158
  }, "strip", z.ZodTypeAny, {
159
159
  id: string;
160
160
  spec: {
161
- path: string;
162
- type: "local-dev";
163
- } | {
164
- url: string;
165
161
  type: "remote-v1";
166
- } | {
167
162
  url: string;
163
+ } | {
168
164
  type: "remote-v2";
165
+ 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
- path: string;
175
- type: "local-dev";
176
- } | {
177
- url: string;
178
174
  type: "remote-v1";
179
- } | {
180
175
  url: string;
176
+ } | {
181
177
  type: "remote-v2";
178
+ 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 { PTableV9 } from "./table.js";
1
+ import { PTableV10, PTableV9 } from "./table.js";
2
2
  import { PTableId } from "./common.js";
3
3
  import { DataQuery, DataQueryBooleanExpression, PObjectId, UniqueValuesResponse } from "@milaboratories/pl-model-common";
4
4
 
@@ -40,6 +40,27 @@ interface PFrameReadAPIV12 {
40
40
  signal?: AbortSignal;
41
41
  }): Promise<UniqueValuesResponse>;
42
42
  }
43
+ /**
44
+ * Read interface exposed by PFrames library.
45
+ *
46
+ * Identical to {@link PFrameReadAPIV12} but returns the {@link PTableV10}
47
+ * table view, which adds the `export` method.
48
+ *
49
+ * Spec-side operations (finding columns, listing columns, retrieving
50
+ * column specs, computing axis integrations) are not part of this
51
+ * surface — callers cache column specs themselves or route through
52
+ * WASM-spec. The data-side `createTable` accepts a pre-lowered
53
+ * `DataQuery`; `getUniqueValues` takes pre-resolved indices via
54
+ * {@link UniqueValuesRequestV2}.
55
+ */
56
+ interface PFrameReadAPIV13 {
57
+ /** Creates table from a pre-lowered data query. */
58
+ createTable(tableId: PTableId, dataQuery: DataQuery): PTableV10;
59
+ /** Calculate set of unique values for a specific axis for the filtered set of records. */
60
+ getUniqueValues(request: UniqueValuesRequestV2, ops?: {
61
+ signal?: AbortSignal;
62
+ }): Promise<UniqueValuesResponse>;
63
+ }
43
64
  //#endregion
44
- export { PFrameReadAPIV12, UniqueValuesRequestV2 };
65
+ export { PFrameReadAPIV12, PFrameReadAPIV13, UniqueValuesRequestV2 };
45
66
  //# 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"}
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,6 +1,6 @@
1
- import { PTableV9 } from "./table.js";
1
+ import { PTableV10, PTableV9 } from "./table.js";
2
2
  import { AxisQualification, ColumnAxesWithQualifications, ConstantAxisFilter, Logger, PFrameId, PTableId } from "./common.js";
3
- import { PFrameReadAPIV12, UniqueValuesRequestV2 } from "./api_read.js";
3
+ import { PFrameReadAPIV12, PFrameReadAPIV13, 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, PFrameOptionsV2, PFrameV14 } from "./pframe.js";
11
+ import { PFrameFactoryV5, PFrameFactoryV6, PFrameOptionsV2, PFrameV14, PFrameV15 } 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, PFrameId, PFrameOptionsV2, PFrameReadAPIV12, PFrameV14, PFrameWasmAPIV2, PFrameWasmAPIV3, PFrameWasmAPIV4, PFrameWasmV2, PFrameWasmV3, PTableId, 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, 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 };
17
17
  }
18
18
  //#endregion
19
19
  export { index_d_exports };
@@ -1,10 +1,17 @@
1
1
  import { Logger, PFrameId } from "./common.js";
2
- import { PFrameReadAPIV12 } from "./api_read.js";
2
+ import { PFrameReadAPIV12, PFrameReadAPIV13 } 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
6
  /** Full PFrame surface — factory operations plus data-side reads. */
7
7
  interface PFrameV14 extends PFrameFactoryAPIV5, PFrameReadAPIV12 {}
8
+ /**
9
+ * Full PFrame surface — factory operations plus data-side reads.
10
+ *
11
+ * Identical to {@link PFrameV14} but exposes {@link PFrameReadAPIV13}, whose
12
+ * tables add the `export` method.
13
+ */
14
+ interface PFrameV15 extends PFrameFactoryAPIV5, PFrameReadAPIV13 {}
8
15
  type PFrameOptionsV2 = {
9
16
  /** PFrame ID for logging purposes */frameId: PFrameId; /** Path to directory where PFrame can create temporary files */
10
17
  spillPath: string; /** Logger instance, no logging is performed when not provided */
@@ -26,6 +33,27 @@ interface PFrameFactoryV5 {
26
33
  */
27
34
  pprofDump: () => Promise<Uint8Array>;
28
35
  }
36
+ /**
37
+ * PFrame management functions exposed by the PFrame module.
38
+ *
39
+ * Identical to {@link PFrameFactoryV5} but creates {@link PFrameV15} instances,
40
+ * whose tables add the `export` method.
41
+ */
42
+ interface PFrameFactoryV6 {
43
+ /**
44
+ * Create a new PFrame instance.
45
+ * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
46
+ */
47
+ createPFrame(options: PFrameOptionsV2): PFrameV15;
48
+ /**
49
+ * Dump active allocations from all PFrames instances in pprof format.
50
+ * The result of this function should be saved as `profile.pb.gz`.
51
+ * Use {@link https://pprof.me/} or {@link https://www.speedscope.app/}
52
+ * to view the allocation flamechart.
53
+ * @warning This method will always reject on Windows!
54
+ */
55
+ pprofDump: () => Promise<Uint8Array>;
56
+ }
29
57
  //#endregion
30
- export { PFrameFactoryV5, PFrameOptionsV2, PFrameV14 };
58
+ export { PFrameFactoryV5, PFrameFactoryV6, PFrameOptionsV2, PFrameV14, PFrameV15 };
31
59
  //# 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;AAAA,KAE3C,eAAA;EAFuB,qCAIjC,OAAA,EAAS,QAAA,EAFC;EAIV,SAAA;EAEA,MAAA,GAAS,MAAA;AAAA;;UAIM,eAAA;EAJf;;;;EASA,YAAA,CAAa,OAAA,EAAS,eAAA,GAAkB,SAAA;EALV;;;;;;;EAc9B,SAAA,QAAiB,OAAA,CAAQ,UAAA;AAAA"}
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"}
@@ -47,6 +47,69 @@ interface PTableV9 extends Disposable {
47
47
  /** Deallocates all underlying resources */
48
48
  dispose(): void;
49
49
  }
50
+ /**
51
+ * Table view returned by `createTable`.
52
+ *
53
+ * PTable can be thought as having a composite primary key, consisting
54
+ * of axes, and a set of data columns derived from PColumn values.
55
+ * The table's column spec is owned by the caller — selector → index
56
+ * resolution runs on the caller side via WASM-spec.
57
+ */
58
+ interface PTableV10 extends Disposable {
59
+ /**
60
+ * Get PTable disk footprint in bytes.
61
+ *
62
+ * @param ops.withPredecessors When true, the footprint includes
63
+ * every registered predecessor table reachable through the
64
+ * query lineage. When false or omitted, only this table's own
65
+ * materialised data is counted.
66
+ *
67
+ * Warning: This call materializes the join.
68
+ */
69
+ getFootprint(ops?: {
70
+ withPredecessors?: boolean;
71
+ signal?: AbortSignal;
72
+ }): Promise<number>;
73
+ /**
74
+ * Unified table shape
75
+ * Warning: This call materializes the join.
76
+ */
77
+ getShape(ops?: {
78
+ signal?: AbortSignal;
79
+ }): Promise<PTableShape>;
80
+ /**
81
+ * Retrieve the data from the table. To retrieve only data required, it can be
82
+ * sliced both horizontally ({@link columnIndices}) and vertically
83
+ * ({@link range}).
84
+ * This call materializes the join.
85
+ *
86
+ * @param columnIndices unified indices of columns to be retrieved
87
+ * @param range optionally limit the range of records to retrieve
88
+ * */
89
+ getData(columnIndices: number[], ops?: {
90
+ range?: TableRange;
91
+ signal?: AbortSignal;
92
+ }): Promise<PTableVector[]>;
93
+ /**
94
+ * Stream the full, sorted table to a file at `path`. The output format is
95
+ * selected from the file extension: `csv`, `tsv`, `parquet`, or `xlsx`.
96
+ * Writing is bounded-memory.
97
+ * This call materializes the join.
98
+ *
99
+ * @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.
103
+ *
104
+ * @remarks For `xlsx` the caller must ensure the row count is below Excel's
105
+ * 1,048,576-row per-sheet limit.
106
+ */
107
+ export(path: string, headers: string[], ops?: {
108
+ signal?: AbortSignal;
109
+ }): Promise<void>;
110
+ /** Deallocates all underlying resources */
111
+ dispose(): void;
112
+ }
50
113
  //#endregion
51
- export { PTableV9 };
114
+ export { PTableV10, PTableV9 };
52
115
  //# 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;;EAGX,OAAA;AAAA"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-middle-layer",
3
- "version": "1.26.0",
3
+ "version": "1.27.0",
4
4
  "description": "Common model between middle layer and non-block UI code",
5
5
  "files": [
6
6
  "./dist/**/*",
@@ -26,9 +26,9 @@
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 { PTableV9 } from "./table";
7
+ import type { PTableV9, PTableV10 } from "./table";
8
8
  import type { PTableId } from "./common";
9
9
 
10
10
  /**
@@ -52,3 +52,29 @@ export interface PFrameReadAPIV12 {
52
52
  },
53
53
  ): Promise<UniqueValuesResponse>;
54
54
  }
55
+
56
+ /**
57
+ * Read interface exposed by PFrames library.
58
+ *
59
+ * Identical to {@link PFrameReadAPIV12} but returns the {@link PTableV10}
60
+ * table view, which adds the `export` method.
61
+ *
62
+ * Spec-side operations (finding columns, listing columns, retrieving
63
+ * column specs, computing axis integrations) are not part of this
64
+ * surface — callers cache column specs themselves or route through
65
+ * WASM-spec. The data-side `createTable` accepts a pre-lowered
66
+ * `DataQuery`; `getUniqueValues` takes pre-resolved indices via
67
+ * {@link UniqueValuesRequestV2}.
68
+ */
69
+ export interface PFrameReadAPIV13 {
70
+ /** Creates table from a pre-lowered data query. */
71
+ createTable(tableId: PTableId, dataQuery: DataQuery): PTableV10;
72
+
73
+ /** Calculate set of unique values for a specific axis for the filtered set of records. */
74
+ getUniqueValues(
75
+ request: UniqueValuesRequestV2,
76
+ ops?: {
77
+ signal?: AbortSignal;
78
+ },
79
+ ): Promise<UniqueValuesResponse>;
80
+ }
@@ -1,11 +1,19 @@
1
1
  import type { PFrameFactoryAPIV5 } from "./api_factory";
2
- import type { PFrameReadAPIV12 } from "./api_read";
2
+ import type { PFrameReadAPIV12, PFrameReadAPIV13 } from "./api_read";
3
3
  import type { Logger } from "./common";
4
4
  import type { PFrameId } from "./common";
5
5
 
6
6
  /** Full PFrame surface — factory operations plus data-side reads. */
7
7
  export interface PFrameV14 extends PFrameFactoryAPIV5, PFrameReadAPIV12 {}
8
8
 
9
+ /**
10
+ * Full PFrame surface — factory operations plus data-side reads.
11
+ *
12
+ * Identical to {@link PFrameV14} but exposes {@link PFrameReadAPIV13}, whose
13
+ * tables add the `export` method.
14
+ */
15
+ export interface PFrameV15 extends PFrameFactoryAPIV5, PFrameReadAPIV13 {}
16
+
9
17
  export type PFrameOptionsV2 = {
10
18
  /** PFrame ID for logging purposes */
11
19
  frameId: PFrameId;
@@ -32,3 +40,26 @@ export interface PFrameFactoryV5 {
32
40
  */
33
41
  pprofDump: () => Promise<Uint8Array>;
34
42
  }
43
+
44
+ /**
45
+ * PFrame management functions exposed by the PFrame module.
46
+ *
47
+ * Identical to {@link PFrameFactoryV5} but creates {@link PFrameV15} instances,
48
+ * whose tables add the `export` method.
49
+ */
50
+ export interface PFrameFactoryV6 {
51
+ /**
52
+ * Create a new PFrame instance.
53
+ * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
54
+ */
55
+ createPFrame(options: PFrameOptionsV2): PFrameV15;
56
+
57
+ /**
58
+ * Dump active allocations from all PFrames instances in pprof format.
59
+ * The result of this function should be saved as `profile.pb.gz`.
60
+ * Use {@link https://pprof.me/} or {@link https://www.speedscope.app/}
61
+ * to view the allocation flamechart.
62
+ * @warning This method will always reject on Windows!
63
+ */
64
+ pprofDump: () => Promise<Uint8Array>;
65
+ }
@@ -47,3 +47,73 @@ export interface PTableV9 extends Disposable {
47
47
  /** Deallocates all underlying resources */
48
48
  dispose(): void;
49
49
  }
50
+
51
+ /**
52
+ * Table view returned by `createTable`.
53
+ *
54
+ * PTable can be thought as having a composite primary key, consisting
55
+ * of axes, and a set of data columns derived from PColumn values.
56
+ * The table's column spec is owned by the caller — selector → index
57
+ * resolution runs on the caller side via WASM-spec.
58
+ */
59
+ export interface PTableV10 extends Disposable {
60
+ /**
61
+ * Get PTable disk footprint in bytes.
62
+ *
63
+ * @param ops.withPredecessors When true, the footprint includes
64
+ * every registered predecessor table reachable through the
65
+ * query lineage. When false or omitted, only this table's own
66
+ * materialised data is counted.
67
+ *
68
+ * Warning: This call materializes the join.
69
+ */
70
+ getFootprint(ops?: { withPredecessors?: boolean; signal?: AbortSignal }): Promise<number>;
71
+
72
+ /**
73
+ * Unified table shape
74
+ * Warning: This call materializes the join.
75
+ */
76
+ getShape(ops?: { signal?: AbortSignal }): Promise<PTableShape>;
77
+
78
+ /**
79
+ * Retrieve the data from the table. To retrieve only data required, it can be
80
+ * sliced both horizontally ({@link columnIndices}) and vertically
81
+ * ({@link range}).
82
+ * This call materializes the join.
83
+ *
84
+ * @param columnIndices unified indices of columns to be retrieved
85
+ * @param range optionally limit the range of records to retrieve
86
+ * */
87
+ getData(
88
+ columnIndices: number[],
89
+ ops?: {
90
+ range?: TableRange;
91
+ signal?: AbortSignal;
92
+ },
93
+ ): Promise<PTableVector[]>;
94
+
95
+ /**
96
+ * Stream the full, sorted table to a file at `path`. The output format is
97
+ * selected from the file extension: `csv`, `tsv`, `parquet`, or `xlsx`.
98
+ * Writing is bounded-memory.
99
+ * This call materializes the join.
100
+ *
101
+ * @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.
105
+ *
106
+ * @remarks For `xlsx` the caller must ensure the row count is below Excel's
107
+ * 1,048,576-row per-sheet limit.
108
+ */
109
+ export(
110
+ path: string,
111
+ headers: string[],
112
+ ops?: {
113
+ signal?: AbortSignal;
114
+ },
115
+ ): Promise<void>;
116
+
117
+ /** Deallocates all underlying resources */
118
+ dispose(): void;
119
+ }