@milaboratories/pl-model-middle-layer 1.2.16

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.
@@ -0,0 +1,49 @@
1
+ import {
2
+ PTableColumnId,
3
+ PTableColumnSpec,
4
+ PTableShape,
5
+ PTableSorting,
6
+ PTableVector,
7
+ TableRange
8
+ } from '@milaboratories/pl-model-common';
9
+
10
+ /**
11
+ * Table view returned as a result of create table operation.
12
+ *
13
+ * PTable can be thought as having a composite primary key, consisting of axes,
14
+ * and a set of data columns derived from PColumn values.
15
+ * */
16
+ export interface PTable {
17
+ /** Unified table shape */
18
+ getShape(): PTableShape;
19
+
20
+ /**
21
+ * Returns ordered array of table axes specs (primary key "columns" in SQL
22
+ * terms) and data column specs (regular "columns" in SQL terms).
23
+ *
24
+ * Data for a specific table column can be retrieved using unified indexing
25
+ * corresponding to elements in this array.
26
+ *
27
+ * Axes are always listed first.
28
+ * */
29
+ getSpec(): PTableColumnSpec[];
30
+
31
+ /** Transforms unified column identifiers into unified indices of columns. */
32
+ getColumnIndices(columnIds: PTableColumnId[]): number[];
33
+
34
+ /**
35
+ * Retrieve the data from the table. To retrieve only data required, it can be
36
+ * sliced both horizontally ({@link columnIndices}) and vertically
37
+ * ({@link range}).
38
+ *
39
+ * @param columnIndices unified indices of columns to be retrieved
40
+ * @param range optionally limit the range of records to retrieve
41
+ * */
42
+ getData(columnIndices: number[], range?: TableRange): Promise<PTableVector[]>;
43
+
44
+ /** Sorts the table and returns new PTable instance. */
45
+ sort(request: PTableSorting[]): Promise<PTable>;
46
+
47
+ /** Deallocates all underlying resources */
48
+ dispose(): void;
49
+ }
package/src/project.ts ADDED
@@ -0,0 +1,4 @@
1
+ export interface ProjectMeta {
2
+ /** Project name */
3
+ readonly label: string;
4
+ }
@@ -0,0 +1,19 @@
1
+ import { ProjectMeta } from './project';
2
+
3
+ /** Represents single entry in the list of projects owned by current user */
4
+ export interface ProjectListEntry {
5
+ /** Project resource ID. */
6
+ rid: bigint;
7
+ /** Internal (user-specific) project id */
8
+ id: string;
9
+ /** Creation timestamp. */
10
+ created: Date;
11
+ /** Last modification timestamp. */
12
+ lastModified: Date;
13
+ /** True if project is opened */
14
+ opened: boolean;
15
+ /** Project meta, namely label */
16
+ meta: ProjectMeta;
17
+ }
18
+
19
+ // export type ProjectList = ProjectListEntry[];
@@ -0,0 +1,126 @@
1
+ import { ProjectMeta } from './project';
2
+ import { BlockPackSpec } from './block_pack';
3
+ import { BlockRenderingMode, BlockSection, NavigationState } from '@milaboratories/pl-model-common';
4
+ import { AuthorMarker } from './author_marker';
5
+
6
+ /** Generalized block status, to be used in block item "styling". */
7
+ export type BlockCalculationStatus = 'NotCalculated' | 'Running' | 'Done' | 'Limbo';
8
+
9
+ /** Overview of the whole project state, required to render a left panel. */
10
+ export type ProjectOverview = {
11
+ /** Metadata, like project label associated with the project */
12
+ meta: ProjectMeta;
13
+
14
+ /** Creation timestamp. */
15
+ created: Date;
16
+
17
+ /** Last modification timestamp. */
18
+ lastModified: Date;
19
+
20
+ /**
21
+ * Marker of the party last doing modification of the project structure
22
+ * - whole project renamed
23
+ * - blocks reordering
24
+ * - block renaming
25
+ * - block-pack update
26
+ * */
27
+ authorMarker?: AuthorMarker;
28
+
29
+ /** Overview information for each block */
30
+ blocks: BlockStateOverview[];
31
+ };
32
+
33
+ /** Overview of the block state, required for visualization in the left panel */
34
+ export type BlockStateOverview = {
35
+ /** Block id */
36
+ id: string;
37
+
38
+ /** Blocks label visible to the user */
39
+ label: string;
40
+
41
+ /** Block rendering mode */
42
+ renderingMode: BlockRenderingMode;
43
+
44
+ /**
45
+ * True if block have missing references, e.g. referenced block was deleted
46
+ * or moved downstream.
47
+ * */
48
+ missingReference: boolean;
49
+
50
+ /**
51
+ * Means that current heavy results (or results being calculated at the
52
+ * moment) are not in sync with current arguments. This takes into account
53
+ * stale state of all upstream blocks as well. Initial state also considered
54
+ * stale.
55
+ * */
56
+ stale: boolean;
57
+
58
+ /**
59
+ * True if any of the outputs have errors. Errors may appear even before
60
+ * calculations are finished.
61
+ * */
62
+ outputErrors: boolean;
63
+
64
+ /**
65
+ * If outputs have errors, this field will contain the error message extracted
66
+ * from the outputs map.
67
+ * */
68
+ outputsError?: string;
69
+
70
+ /**
71
+ * If exports context have errors, this field will contain the error message
72
+ * extracted from the exports context resource.
73
+ * */
74
+ exportsError?: string;
75
+
76
+ /** Generalized block calculation status */
77
+ calculationStatus: BlockCalculationStatus;
78
+
79
+ /**
80
+ * All upstream blocks of this block. In other words all dependencies of this
81
+ * block, including transitive dependencies.
82
+ * */
83
+ upstreams: string[];
84
+
85
+ /**
86
+ * All downstream blocks of this block. In other words all blocks that depends
87
+ * on outputs of this block, accounting for transitive dependencies.
88
+ * */
89
+ downstreams: string[];
90
+
91
+ /**
92
+ * Block sections. May be unavailable, if block-pack for this block is not
93
+ * yet materialized.
94
+ * */
95
+ sections: BlockSection[] | undefined;
96
+
97
+ /**
98
+ * True if inputs of current block are suitable for block execution.
99
+ * May be unavailable, if block-pack for this block is not yet materialized.
100
+ * */
101
+ inputsValid: boolean | undefined;
102
+
103
+ /**
104
+ * True if current block can be executed. This takes into account can run of
105
+ * all upstream blocks as well.
106
+ * */
107
+ canRun: boolean;
108
+
109
+ /**
110
+ * SDK version the block was compiled with.
111
+ * Udefined when block-pack for this block is not yet materialized.
112
+ * */
113
+ sdkVersion: string | undefined;
114
+
115
+ /** Information on where the block pack for this block came from */
116
+ currentBlockPack: BlockPackSpec | undefined;
117
+
118
+ /**
119
+ * If block pack update is available this field will contain latest specs to
120
+ * perform the update
121
+ * */
122
+ updatedBlockPack: BlockPackSpec | undefined;
123
+
124
+ /** Current navigation state of the block */
125
+ navigationState: NavigationState;
126
+ };