@milaboratories/pl-model-middle-layer 1.30.1 → 1.30.3

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.
@@ -1,5 +1,5 @@
1
1
  import type { PFrameFactoryAPIV6 } from "./api_factory";
2
- import type { PFrameReadAPIV14 } from "./api_read";
2
+ import type { PFrameReadAPIV14, PFrameReadAPIV15 } from "./api_read";
3
3
  import type { Logger } from "./common";
4
4
  import type { PFrameId } from "./common";
5
5
 
@@ -11,6 +11,18 @@ import type { PFrameId } from "./common";
11
11
  */
12
12
  export interface PFrameV17 extends PFrameFactoryAPIV6, PFrameReadAPIV14 {}
13
13
 
14
+ /**
15
+ * Full PFrame surface — factory operations plus data-side reads. Exposes
16
+ * the self-contained {@link PFrameFactoryAPIV6} (column `typeSpec` embedded in
17
+ * `data`) plus {@link PFrameReadAPIV15}, whose tables' `export` takes an
18
+ * `ops.headers` list of `[column index, header name]` pairs.
19
+ *
20
+ * Same surface as {@link PFrameV17}; the only change is that the read side is
21
+ * upgraded from {@link PFrameReadAPIV14} to {@link PFrameReadAPIV15}, so
22
+ * {@link PFrameReadAPIV15.createTable} returns {@link PTableV12}.
23
+ */
24
+ export interface PFrameV18 extends PFrameFactoryAPIV6, PFrameReadAPIV15 {}
25
+
14
26
  export type PFrameOptionsV2 = {
15
27
  /** PFrame ID for logging purposes */
16
28
  frameId: PFrameId;
@@ -40,3 +52,28 @@ export interface PFrameFactoryV8 {
40
52
  */
41
53
  pprofDump: () => Promise<Uint8Array>;
42
54
  }
55
+
56
+ /**
57
+ * PFrame management functions exposed by the PFrame module. Creates
58
+ * {@link PFrameV18} instances (self-contained column data info).
59
+ *
60
+ * Same surface as {@link PFrameFactoryV8}; the only change is that
61
+ * {@link PFrameFactoryV9.createPFrame} returns {@link PFrameV18}, whose tables'
62
+ * `export` takes an `ops.headers` list of `[column index, header name]` pairs.
63
+ */
64
+ export interface PFrameFactoryV9 {
65
+ /**
66
+ * Create a new PFrame instance.
67
+ * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
68
+ */
69
+ createPFrame(options: PFrameOptionsV2): PFrameV18;
70
+
71
+ /**
72
+ * Dump active allocations from all PFrames instances in pprof format.
73
+ * The result of this function should be saved as `profile.pb.gz`.
74
+ * Use {@link https://pprof.me/} or {@link https://www.speedscope.app/}
75
+ * to view the allocation flamechart.
76
+ * @warning This method will always reject on Windows!
77
+ */
78
+ pprofDump: () => Promise<Uint8Array>;
79
+ }
@@ -74,3 +74,85 @@ export interface PTableV11 extends Disposable {
74
74
  /** Deallocates all underlying resources */
75
75
  dispose(): void;
76
76
  }
77
+
78
+ /**
79
+ * Table view returned by `createTable`.
80
+ *
81
+ * Self-contained: does not extend any earlier per-table interface. Once this
82
+ * version is adopted, every earlier `PTableV*` interface is dropped, so this
83
+ * declaration repeats the full method surface rather than referencing the
84
+ * predecessors.
85
+ *
86
+ * Same surface as {@link PTableV11} except {@link PTableV12.export} moves
87
+ * `headers` into `ops` and passes them as an ordered list of
88
+ * `[unified column index, header name]` pairs instead of a
89
+ * `Record<number, string>` map.
90
+ *
91
+ * PTable can be thought as having a composite primary key, consisting
92
+ * of axes, and a set of data columns derived from PColumn values.
93
+ * The table's column spec is owned by the caller — selector → index
94
+ * resolution runs on the caller side via WASM-spec.
95
+ */
96
+ export interface PTableV12 extends Disposable {
97
+ /**
98
+ * Get PTable disk footprint in bytes.
99
+ *
100
+ * @param ops.withPredecessors When true, the footprint includes
101
+ * every registered predecessor table reachable through the
102
+ * query lineage. When false or omitted, only this table's own
103
+ * materialised data is counted.
104
+ *
105
+ * Warning: This call materializes the join.
106
+ */
107
+ getFootprint(ops?: { withPredecessors?: boolean; signal?: AbortSignal }): Promise<number>;
108
+
109
+ /**
110
+ * Unified table shape
111
+ * Warning: This call materializes the join.
112
+ */
113
+ getShape(ops?: { signal?: AbortSignal }): Promise<PTableShape>;
114
+
115
+ /**
116
+ * Retrieve the data from the table. To retrieve only data required, it can be
117
+ * sliced both horizontally ({@link columnIndices}) and vertically
118
+ * ({@link range}).
119
+ * This call materializes the join.
120
+ *
121
+ * @param columnIndices unified indices of columns to be retrieved
122
+ * @param range optionally limit the range of records to retrieve
123
+ * */
124
+ getData(
125
+ columnIndices: number[],
126
+ ops?: {
127
+ range?: TableRange;
128
+ signal?: AbortSignal;
129
+ },
130
+ ): Promise<PTableVector[]>;
131
+
132
+ /**
133
+ * Stream the sorted table to a file at `path`. The output format is
134
+ * selected from the file extension: `csv`, `tsv`, `parquet`, or `xlsx`.
135
+ * Writing is bounded-memory.
136
+ * This call materializes the join.
137
+ *
138
+ * @param path destination file path; its extension selects the format
139
+ * @param ops.headers list of `[unified column index, header name]` pairs
140
+ * (unified index: axes first, then data columns). Only the columns listed
141
+ * are exported, in ascending index order — the list both selects the
142
+ * columns and names them (the data layer is name-independent, so names
143
+ * are supplied by the caller).
144
+ *
145
+ * @remarks For `xlsx` the caller must ensure the row count is below Excel's
146
+ * 1,048,576-row per-sheet limit.
147
+ */
148
+ export(
149
+ path: string,
150
+ ops?: {
151
+ headers: [number, string][];
152
+ signal?: AbortSignal;
153
+ },
154
+ ): Promise<void>;
155
+
156
+ /** Deallocates all underlying resources */
157
+ dispose(): void;
158
+ }