@milaboratories/pl-model-middle-layer 1.19.4 → 1.21.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.
Files changed (35) hide show
  1. package/dist/block_meta/block_components.d.ts +55 -55
  2. package/dist/block_meta/block_description.d.ts +2308 -834
  3. package/dist/block_meta/block_description.d.ts.map +1 -1
  4. package/dist/block_meta/block_id.d.ts +4 -4
  5. package/dist/block_meta/block_manifest.d.ts +5127 -2488
  6. package/dist/block_meta/block_manifest.d.ts.map +1 -1
  7. package/dist/block_meta/block_meta.cjs +3 -2
  8. package/dist/block_meta/block_meta.cjs.map +1 -1
  9. package/dist/block_meta/block_meta.d.ts +1065 -277
  10. package/dist/block_meta/block_meta.d.ts.map +1 -1
  11. package/dist/block_meta/block_meta.js +3 -2
  12. package/dist/block_meta/block_meta.js.map +1 -1
  13. package/dist/block_meta/content_types.d.ts +49 -49
  14. package/dist/block_registry/block_pack_spec.d.ts +16 -16
  15. package/dist/block_registry/overview.d.ts +9794 -5614
  16. package/dist/block_registry/overview.d.ts.map +1 -1
  17. package/dist/block_registry/registry_spec.d.ts +12 -12
  18. package/dist/pframe/internal_api/api_factory.cjs.map +1 -1
  19. package/dist/pframe/internal_api/api_factory.d.ts +36 -2
  20. package/dist/pframe/internal_api/api_factory.d.ts.map +1 -1
  21. package/dist/pframe/internal_api/api_factory.js.map +1 -1
  22. package/dist/pframe/internal_api/api_read.d.ts +40 -3
  23. package/dist/pframe/internal_api/api_read.d.ts.map +1 -1
  24. package/dist/pframe/internal_api/index.d.ts +5 -5
  25. package/dist/pframe/internal_api/pframe.d.ts +21 -3
  26. package/dist/pframe/internal_api/pframe.d.ts.map +1 -1
  27. package/dist/pframe/internal_api/table.d.ts +51 -1
  28. package/dist/pframe/internal_api/table.d.ts.map +1 -1
  29. package/package.json +2 -2
  30. package/src/block_meta/block_meta.test.ts +44 -0
  31. package/src/block_meta/block_meta.ts +57 -36
  32. package/src/pframe/internal_api/api_factory.ts +44 -0
  33. package/src/pframe/internal_api/api_read.ts +48 -1
  34. package/src/pframe/internal_api/pframe.ts +23 -2
  35. package/src/pframe/internal_api/table.ts +54 -0
@@ -1,6 +1,8 @@
1
1
  import type {
2
+ AxisValueType,
2
3
  BinaryPartitionedDataInfo,
3
4
  Branded,
5
+ ColumnValueType,
4
6
  JsonDataInfo,
5
7
  JsonPartitionedDataInfo,
6
8
  ParquetChunk,
@@ -79,3 +81,45 @@ export interface PFrameFactoryAPIV4 extends Disposable {
79
81
  * any interactions with disposed PFrame will result in exception */
80
82
  dispose(): void;
81
83
  }
84
+
85
+ /**
86
+ * Structural type information needed by the data side: axis value
87
+ * types and column value types, in their canonical order. Mirrors
88
+ * the bridge-side `TypeSpec`.
89
+ */
90
+ export interface PColumnValueTypeSpec {
91
+ readonly axes: AxisValueType[];
92
+ readonly columns: ColumnValueType[];
93
+ }
94
+
95
+ /** Single column entry for {@link PFrameFactoryAPIV5.addColumns}. */
96
+ export interface AddColumnEntry {
97
+ /** Unique column identifier within the PFrame. */
98
+ readonly id: PObjectId;
99
+ /** Structural type info (axes / column value types). */
100
+ readonly typeSpec: PColumnValueTypeSpec;
101
+ /** Data info for the column. */
102
+ readonly data: DataInfo<PFrameBlobId>;
103
+ }
104
+
105
+ /** API for populating a PFrame with columns and a data source. */
106
+ export interface PFrameFactoryAPIV5 extends Disposable {
107
+ /** Associates data source with this PFrame. */
108
+ setDataSource(dataSource: PFrameDataSourceV2): void;
109
+
110
+ /**
111
+ * Registers all PColumns at once: specs are recorded and data info
112
+ * is attached atomically. For parquet data info, schema resolution
113
+ * via network is performed during this call.
114
+ */
115
+ addColumns(
116
+ columns: AddColumnEntry[],
117
+ options?: {
118
+ signal?: AbortSignal;
119
+ },
120
+ ): Promise<void>;
121
+
122
+ /** Releases all the data previously added to PFrame using methods above,
123
+ * any interactions with disposed PFrame will result in exception */
124
+ dispose(): void;
125
+ }
@@ -10,10 +10,11 @@ import type {
10
10
  UniqueValuesRequest,
11
11
  UniqueValuesResponse,
12
12
  DataQuery,
13
+ DataQueryBooleanExpression,
13
14
  PTableColumnSpec,
14
15
  } from "@milaboratories/pl-model-common";
15
16
  import type { CreateTableRequestV4 } from "./create_table";
16
- import type { PTableV8 } from "./table";
17
+ import type { PTableV8, PTableV9 } from "./table";
17
18
  import type { PTableId } from "./common";
18
19
 
19
20
  /** Read interface exposed by PFrames library */
@@ -60,3 +61,49 @@ export interface PFrameReadAPIV11 {
60
61
  },
61
62
  ): Promise<UniqueValuesResponse>;
62
63
  }
64
+
65
+ /**
66
+ * V2 unique-values request. Axis and filter references are
67
+ * pre-resolved to numeric indices; no selector ids cross the API
68
+ * boundary. Each filter is a boolean predicate that must evaluate to
69
+ * true for the row to be included.
70
+ */
71
+ export interface UniqueValuesRequestV2 {
72
+ /** Target column. */
73
+ readonly columnId: PObjectId;
74
+
75
+ /**
76
+ * Target axis (pre-resolved index into the column's axes).
77
+ * When omitted, unique values are collected from the column itself.
78
+ */
79
+ readonly axisIndex?: number;
80
+
81
+ /** Pre-resolved boolean predicates applied before collecting values. */
82
+ readonly filters: DataQueryBooleanExpression[];
83
+
84
+ /** Max number of values to return. Overflow is reported in the response. */
85
+ readonly limit: number;
86
+ }
87
+
88
+ /**
89
+ * Read interface exposed by PFrames library.
90
+ *
91
+ * Spec-side operations (finding columns, listing columns, retrieving
92
+ * column specs, computing axis integrations) are not part of this
93
+ * surface — callers cache column specs themselves or route through
94
+ * WASM-spec. The data-side `createTableV2` accepts a pre-lowered
95
+ * `DataQuery`; `getUniqueValues` takes pre-resolved indices via
96
+ * {@link UniqueValuesRequestV2}.
97
+ */
98
+ export interface PFrameReadAPIV12 {
99
+ /** Creates table from a pre-lowered data query. */
100
+ createTableV2(tableId: PTableId, dataQuery: DataQuery): PTableV9;
101
+
102
+ /** Calculate set of unique values for a specific axis for the filtered set of records. */
103
+ getUniqueValues(
104
+ request: UniqueValuesRequestV2,
105
+ ops?: {
106
+ signal?: AbortSignal;
107
+ },
108
+ ): Promise<UniqueValuesResponse>;
109
+ }
@@ -1,10 +1,13 @@
1
- import type { PFrameFactoryAPIV4 } from "./api_factory";
2
- import type { PFrameReadAPIV11 } from "./api_read";
1
+ import type { PFrameFactoryAPIV4, PFrameFactoryAPIV5 } from "./api_factory";
2
+ import type { PFrameReadAPIV11, PFrameReadAPIV12 } from "./api_read";
3
3
  import type { Logger } from "./common";
4
4
  import type { PFrameId } from "./common";
5
5
 
6
6
  export interface PFrameV13 extends PFrameFactoryAPIV4, PFrameReadAPIV11 {}
7
7
 
8
+ /** Full PFrame surface — factory operations plus data-side reads. */
9
+ export interface PFrameV14 extends PFrameFactoryAPIV5, PFrameReadAPIV12 {}
10
+
8
11
  export type PFrameOptionsV2 = {
9
12
  /** PFrame ID for logging purposes */
10
13
  frameId: PFrameId;
@@ -31,3 +34,21 @@ export interface PFrameFactoryV4 {
31
34
  */
32
35
  pprofDump: () => Promise<Uint8Array>;
33
36
  }
37
+
38
+ /** PFrame management functions exposed by the PFrame module. */
39
+ export interface PFrameFactoryV5 {
40
+ /**
41
+ * Create a new PFrame instance.
42
+ * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
43
+ */
44
+ createPFrame(options: PFrameOptionsV2): PFrameV14;
45
+
46
+ /**
47
+ * Dump active allocations from all PFrames instances in pprof format.
48
+ * The result of this function should be saved as `profile.pb.gz`.
49
+ * Use {@link https://pprof.me/} or {@link https://www.speedscope.app/}
50
+ * to view the allocation flamechart.
51
+ * @warning This method will always reject on Windows!
52
+ */
53
+ pprofDump: () => Promise<Uint8Array>;
54
+ }
@@ -68,3 +68,57 @@ export interface PTableV8 extends Disposable {
68
68
  /** Deallocates all underlying resources */
69
69
  dispose(): void;
70
70
  }
71
+
72
+ /**
73
+ * Table view returned by `createTableV2`, `filter`, and `sort`.
74
+ *
75
+ * PTable can be thought as having a composite primary key, consisting
76
+ * of axes, and a set of data columns derived from PColumn values.
77
+ * The table's column spec is owned by the caller — selector → index
78
+ * resolution runs on the caller side via WASM-spec.
79
+ */
80
+ export interface PTableV9 extends Disposable {
81
+ /**
82
+ * Get PTable disk footprint in bytes.
83
+ *
84
+ * @param ops.withPredecessors When true, the footprint includes
85
+ * every registered predecessor table reachable through the
86
+ * query lineage. When false or omitted, only this table's own
87
+ * materialised data is counted.
88
+ *
89
+ * Warning: This call materializes the join.
90
+ */
91
+ getFootprint(ops?: { withPredecessors?: boolean; signal?: AbortSignal }): Promise<number>;
92
+
93
+ /**
94
+ * Unified table shape
95
+ * Warning: This call materializes the join.
96
+ */
97
+ getShape(ops?: { signal?: AbortSignal }): Promise<PTableShape>;
98
+
99
+ /**
100
+ * Retrieve the data from the table. To retrieve only data required, it can be
101
+ * sliced both horizontally ({@link columnIndices}) and vertically
102
+ * ({@link range}).
103
+ * This call materializes the join.
104
+ *
105
+ * @param columnIndices unified indices of columns to be retrieved
106
+ * @param range optionally limit the range of records to retrieve
107
+ * */
108
+ getData(
109
+ columnIndices: number[],
110
+ ops?: {
111
+ range?: TableRange;
112
+ signal?: AbortSignal;
113
+ },
114
+ ): Promise<PTableVector[]>;
115
+
116
+ /** Filters the table and returns new PTable instance */
117
+ filter(tableId: PTableId, request: PTableRecordFilter[]): PTableV9;
118
+
119
+ /** Sorts the table and returns new PTable instance. */
120
+ sort(tableId: PTableId, request: PTableSorting[]): PTableV9;
121
+
122
+ /** Deallocates all underlying resources */
123
+ dispose(): void;
124
+ }