@elaraai/e3-types 0.0.2-beta.8 → 1.0.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.
- package/.turbo/turbo-build.log +4 -0
- package/CLA.md +26 -0
- package/CLAUDE.md +11 -0
- package/CONTRIBUTING.md +28 -0
- package/LICENSE.md +1 -1
- package/README.md +56 -17
- package/dist/src/api.d.ts +1131 -0
- package/dist/src/api.d.ts.map +1 -0
- package/dist/src/api.js +652 -0
- package/dist/src/api.js.map +1 -0
- package/dist/src/constants.d.ts +12 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +12 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/dataflow.d.ts +574 -0
- package/dist/src/dataflow.d.ts.map +1 -0
- package/dist/src/dataflow.js +366 -0
- package/dist/src/dataflow.js.map +1 -0
- package/dist/src/dataset-ref.d.ts +86 -0
- package/dist/src/dataset-ref.d.ts.map +1 -0
- package/dist/src/dataset-ref.js +82 -0
- package/dist/src/dataset-ref.js.map +1 -0
- package/dist/src/dataset.d.ts +4 -4
- package/dist/src/execution.d.ts +29 -21
- package/dist/src/execution.d.ts.map +1 -1
- package/dist/src/execution.js +8 -0
- package/dist/src/execution.js.map +1 -1
- package/dist/src/index.d.ts +7 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +39 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/lock.d.ts +85 -0
- package/dist/src/lock.d.ts.map +1 -0
- package/dist/src/lock.js +71 -0
- package/dist/src/lock.js.map +1 -0
- package/dist/src/package.d.ts +253 -134
- package/dist/src/package.d.ts.map +1 -1
- package/dist/src/package.js +53 -23
- package/dist/src/package.js.map +1 -1
- package/dist/src/structure.d.ts +99 -73
- package/dist/src/structure.d.ts.map +1 -1
- package/dist/src/structure.js +8 -3
- package/dist/src/structure.js.map +1 -1
- package/dist/src/task.d.ts +10 -6
- package/dist/src/task.d.ts.map +1 -1
- package/dist/src/task.js +5 -1
- package/dist/src/task.js.map +1 -1
- package/dist/src/transfer.d.ts +52 -0
- package/dist/src/transfer.d.ts.map +1 -0
- package/dist/src/transfer.js +49 -0
- package/dist/src/transfer.js.map +1 -0
- package/dist/src/workspace.d.ts +7 -9
- package/dist/src/workspace.d.ts.map +1 -1
- package/dist/src/workspace.js +3 -5
- package/dist/src/workspace.js.map +1 -1
- package/package.json +11 -11
- package/src/api.ts +763 -0
- package/src/constants.ts +12 -0
- package/src/dataflow.ts +427 -0
- package/src/dataset-ref.ts +91 -0
- package/src/execution.ts +8 -0
- package/src/index.ts +183 -0
- package/src/lock.ts +90 -0
- package/src/package.ts +72 -23
- package/src/structure.ts +8 -3
- package/src/task.ts +5 -1
- package/src/transfer.ts +56 -0
- package/src/workspace.ts +3 -5
- package/tsconfig.json +1 -2
package/src/index.ts
CHANGED
|
@@ -31,6 +31,14 @@ export {
|
|
|
31
31
|
DataTreeType,
|
|
32
32
|
} from './dataset.js';
|
|
33
33
|
|
|
34
|
+
// Per-dataset refs and version vectors (reactive dataflow)
|
|
35
|
+
export {
|
|
36
|
+
VersionVectorType,
|
|
37
|
+
type VersionVector,
|
|
38
|
+
DatasetRefType,
|
|
39
|
+
type DatasetRef,
|
|
40
|
+
} from './dataset-ref.js';
|
|
41
|
+
|
|
34
42
|
// Task definitions
|
|
35
43
|
export {
|
|
36
44
|
TaskObjectType,
|
|
@@ -68,6 +76,25 @@ export {
|
|
|
68
76
|
// Backwards compatibility
|
|
69
77
|
PackageDatasetsType,
|
|
70
78
|
type PackageDatasets,
|
|
79
|
+
// Package transfer types
|
|
80
|
+
PackageTransferInitRequestType,
|
|
81
|
+
type PackageTransferInitRequest,
|
|
82
|
+
PackageTransferInitResponseType,
|
|
83
|
+
type PackageTransferInitResponse,
|
|
84
|
+
PackageJobResponseType,
|
|
85
|
+
type PackageJobResponse,
|
|
86
|
+
PackageImportResultType,
|
|
87
|
+
type PackageImportResult,
|
|
88
|
+
PackageExportResultType,
|
|
89
|
+
type PackageExportResult,
|
|
90
|
+
PackageImportProgressType,
|
|
91
|
+
type PackageImportProgress,
|
|
92
|
+
PackageImportStatusType,
|
|
93
|
+
type PackageImportStatus,
|
|
94
|
+
PackageExportProgressType,
|
|
95
|
+
type PackageExportProgress,
|
|
96
|
+
PackageExportStatusType,
|
|
97
|
+
type PackageExportStatus,
|
|
71
98
|
} from './package.js';
|
|
72
99
|
|
|
73
100
|
// Workspace state
|
|
@@ -81,3 +108,159 @@ export {
|
|
|
81
108
|
ExecutionStatusType,
|
|
82
109
|
type ExecutionStatus,
|
|
83
110
|
} from './execution.js';
|
|
111
|
+
|
|
112
|
+
// Lock state
|
|
113
|
+
export {
|
|
114
|
+
LockOperationType,
|
|
115
|
+
type LockOperation,
|
|
116
|
+
ProcessHolderType,
|
|
117
|
+
type ProcessHolder,
|
|
118
|
+
LockStateType,
|
|
119
|
+
type LockState,
|
|
120
|
+
} from './lock.js';
|
|
121
|
+
|
|
122
|
+
// Dataset transfer types
|
|
123
|
+
export {
|
|
124
|
+
TransferUploadRequestType,
|
|
125
|
+
type TransferUploadRequest,
|
|
126
|
+
TransferUploadResponseType,
|
|
127
|
+
type TransferUploadResponse,
|
|
128
|
+
TransferDoneResponseType,
|
|
129
|
+
type TransferDoneResponse,
|
|
130
|
+
} from './transfer.js';
|
|
131
|
+
|
|
132
|
+
// Wire format constants
|
|
133
|
+
export { BEAST2_CONTENT_TYPE } from './constants.js';
|
|
134
|
+
|
|
135
|
+
// API wire types (shared between e3-api-client and e3-api-server)
|
|
136
|
+
export {
|
|
137
|
+
// Error types
|
|
138
|
+
WorkspaceNotFoundErrorType,
|
|
139
|
+
WorkspaceNotDeployedErrorType,
|
|
140
|
+
WorkspaceExistsErrorType,
|
|
141
|
+
LockHolderType,
|
|
142
|
+
WorkspaceLockedErrorType,
|
|
143
|
+
PackageNotFoundErrorType,
|
|
144
|
+
PackageExistsErrorType,
|
|
145
|
+
PackageInvalidErrorType,
|
|
146
|
+
DatasetNotFoundErrorType,
|
|
147
|
+
TaskNotFoundErrorType,
|
|
148
|
+
ExecutionNotFoundErrorType,
|
|
149
|
+
ObjectNotFoundErrorType,
|
|
150
|
+
DataflowErrorType,
|
|
151
|
+
PermissionDeniedErrorType,
|
|
152
|
+
InternalErrorType,
|
|
153
|
+
RepositoryNotFoundErrorType,
|
|
154
|
+
ErrorType,
|
|
155
|
+
ResponseType,
|
|
156
|
+
// Repository
|
|
157
|
+
RepositoryStatusType,
|
|
158
|
+
GcRequestType,
|
|
159
|
+
GcResultType,
|
|
160
|
+
AsyncOperationStatusType,
|
|
161
|
+
GcStartResultType,
|
|
162
|
+
GcStatusResultType,
|
|
163
|
+
// Packages
|
|
164
|
+
PackageListItemType,
|
|
165
|
+
PackageInfoType,
|
|
166
|
+
PackageDetailsType,
|
|
167
|
+
// Workspaces
|
|
168
|
+
WorkspaceCreateRequestType,
|
|
169
|
+
WorkspaceInfoType,
|
|
170
|
+
WorkspaceDeployRequestType,
|
|
171
|
+
WorkspaceExportRequestType,
|
|
172
|
+
// Workspace Status
|
|
173
|
+
DatasetStatusType,
|
|
174
|
+
TaskStatusUpToDateType,
|
|
175
|
+
TaskStatusWaitingType,
|
|
176
|
+
TaskStatusInProgressType,
|
|
177
|
+
TaskStatusFailedType,
|
|
178
|
+
TaskStatusErrorType,
|
|
179
|
+
TaskStatusStaleRunningType,
|
|
180
|
+
TaskStatusType,
|
|
181
|
+
DatasetStatusInfoType,
|
|
182
|
+
TaskStatusInfoType,
|
|
183
|
+
WorkspaceStatusSummaryType,
|
|
184
|
+
WorkspaceStatusResultType,
|
|
185
|
+
// Tasks
|
|
186
|
+
TaskListItemType,
|
|
187
|
+
TaskDetailsType,
|
|
188
|
+
// Execution
|
|
189
|
+
DataflowRequestType,
|
|
190
|
+
LogChunkType,
|
|
191
|
+
TaskExecutionResultType,
|
|
192
|
+
DataflowResultType,
|
|
193
|
+
// Dataflow API polling
|
|
194
|
+
DataflowEventType,
|
|
195
|
+
ApiExecutionStatusType,
|
|
196
|
+
DataflowExecutionSummaryType,
|
|
197
|
+
ApiDataflowExecutionStateType,
|
|
198
|
+
// Task Execution History
|
|
199
|
+
ExecutionHistoryStatusType,
|
|
200
|
+
ExecutionListItemType,
|
|
201
|
+
// Dataset List
|
|
202
|
+
TreeKindType,
|
|
203
|
+
ListEntryType,
|
|
204
|
+
// Dataset Status Detail
|
|
205
|
+
DatasetStatusDetailType,
|
|
206
|
+
// Type aliases
|
|
207
|
+
type Error,
|
|
208
|
+
type RepositoryStatus,
|
|
209
|
+
type GcRequest,
|
|
210
|
+
type GcResult,
|
|
211
|
+
type AsyncOperationStatus,
|
|
212
|
+
type GcStartResult,
|
|
213
|
+
type GcStatusResult,
|
|
214
|
+
type PackageListItem,
|
|
215
|
+
type PackageInfo,
|
|
216
|
+
type PackageDetails,
|
|
217
|
+
type WorkspaceInfo,
|
|
218
|
+
type WorkspaceCreateRequest,
|
|
219
|
+
type WorkspaceDeployRequest,
|
|
220
|
+
type DatasetStatus,
|
|
221
|
+
type TaskStatus as ApiTaskStatus,
|
|
222
|
+
type DatasetStatusInfo,
|
|
223
|
+
type TaskStatusInfo,
|
|
224
|
+
type WorkspaceStatusSummary,
|
|
225
|
+
type WorkspaceStatusResult,
|
|
226
|
+
type TaskListItem,
|
|
227
|
+
type TaskDetails,
|
|
228
|
+
type DataflowRequest,
|
|
229
|
+
type LogChunk,
|
|
230
|
+
type TaskExecutionResult,
|
|
231
|
+
type DataflowResult,
|
|
232
|
+
type DataflowEvent,
|
|
233
|
+
type ApiExecutionStatus,
|
|
234
|
+
type DataflowExecutionSummary,
|
|
235
|
+
type ApiDataflowExecutionState,
|
|
236
|
+
type ExecutionHistoryStatus,
|
|
237
|
+
type ExecutionListItem,
|
|
238
|
+
type TreeKind,
|
|
239
|
+
type ListEntry,
|
|
240
|
+
type DatasetStatusDetail,
|
|
241
|
+
} from './api.js';
|
|
242
|
+
|
|
243
|
+
// Dataflow execution state
|
|
244
|
+
export {
|
|
245
|
+
type DataflowExecutionStatus,
|
|
246
|
+
type TaskStatus,
|
|
247
|
+
TaskStateType,
|
|
248
|
+
type TaskState,
|
|
249
|
+
DataflowGraphTaskType,
|
|
250
|
+
type DataflowGraphTask,
|
|
251
|
+
DataflowGraphType,
|
|
252
|
+
type DataflowGraph,
|
|
253
|
+
ExecutionEventType,
|
|
254
|
+
type ExecutionEvent,
|
|
255
|
+
DataflowExecutionStateType,
|
|
256
|
+
type DataflowExecutionState,
|
|
257
|
+
// Dataflow run history
|
|
258
|
+
DataflowRunStatusType,
|
|
259
|
+
type DataflowRunStatus,
|
|
260
|
+
TaskExecutionRecordType,
|
|
261
|
+
type TaskExecutionRecord,
|
|
262
|
+
DataflowRunSummaryType,
|
|
263
|
+
type DataflowRunSummary,
|
|
264
|
+
DataflowRunType,
|
|
265
|
+
type DataflowRun,
|
|
266
|
+
} from './dataflow.js';
|
package/src/lock.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Lock state type definitions.
|
|
8
|
+
*
|
|
9
|
+
* A lock provides exclusive access to a workspace. The state tracks:
|
|
10
|
+
* - What operation acquired the lock (dataflow, deployment, etc.)
|
|
11
|
+
* - Who holds the lock (East text-encoded string)
|
|
12
|
+
* - When it was acquired
|
|
13
|
+
* - Optional expiry (for cloud TTL-based locks)
|
|
14
|
+
*
|
|
15
|
+
* Lock file location: workspaces/<name>.lock
|
|
16
|
+
*
|
|
17
|
+
* The holder field is an East text-encoded string, allowing different backends
|
|
18
|
+
* to encode their own holder identification. Common patterns:
|
|
19
|
+
* - Local: `.process (pid=1234, bootId="abc-123", startTime=98765, command="e3 start")`
|
|
20
|
+
* - Cloud: `.lambda (requestId="req-123", functionName="e3-api")`
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import {
|
|
24
|
+
VariantType,
|
|
25
|
+
StructType,
|
|
26
|
+
StringType,
|
|
27
|
+
IntegerType,
|
|
28
|
+
DateTimeType,
|
|
29
|
+
OptionType,
|
|
30
|
+
NullType,
|
|
31
|
+
ValueTypeOf,
|
|
32
|
+
} from '@elaraai/east';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Lock operation - what acquired the lock.
|
|
36
|
+
*/
|
|
37
|
+
export const LockOperationType = VariantType({
|
|
38
|
+
/** Running a dataflow */
|
|
39
|
+
dataflow: NullType,
|
|
40
|
+
/** Deploying a package to the workspace */
|
|
41
|
+
deployment: NullType,
|
|
42
|
+
/** Removing the workspace */
|
|
43
|
+
removal: NullType,
|
|
44
|
+
/** Writing to a dataset */
|
|
45
|
+
dataset_write: NullType,
|
|
46
|
+
/** Exporting a workspace */
|
|
47
|
+
export: NullType,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export type LockOperation = ValueTypeOf<typeof LockOperationType>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Process holder schema - for local filesystem backends.
|
|
54
|
+
* Used to encode/decode the holder string.
|
|
55
|
+
*/
|
|
56
|
+
export const ProcessHolderType = StructType({
|
|
57
|
+
/** Process ID */
|
|
58
|
+
pid: IntegerType,
|
|
59
|
+
/** System boot ID (from /proc/sys/kernel/random/boot_id) */
|
|
60
|
+
bootId: StringType,
|
|
61
|
+
/** Process start time in jiffies since boot */
|
|
62
|
+
startTime: IntegerType,
|
|
63
|
+
/** Command that acquired the lock (for debugging) */
|
|
64
|
+
command: StringType,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export type ProcessHolder = ValueTypeOf<typeof ProcessHolderType>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Lock state stored in workspaces/<name>.lock
|
|
71
|
+
*
|
|
72
|
+
* Represents an advisory lock on a workspace. The actual locking mechanism
|
|
73
|
+
* is platform-specific (flock on Linux, DynamoDB conditional writes in cloud),
|
|
74
|
+
* but the lock content follows this schema.
|
|
75
|
+
*
|
|
76
|
+
* The holder field is an East text-encoded string representing a variant value.
|
|
77
|
+
* Use `printFor`/`parseInferred` from @elaraai/east to encode/decode.
|
|
78
|
+
*/
|
|
79
|
+
export const LockStateType = StructType({
|
|
80
|
+
/** What operation acquired the lock */
|
|
81
|
+
operation: LockOperationType,
|
|
82
|
+
/** Who holds the lock - East text-encoded variant (e.g., `.process (...)`) */
|
|
83
|
+
holder: StringType,
|
|
84
|
+
/** When the lock was acquired */
|
|
85
|
+
acquiredAt: DateTimeType,
|
|
86
|
+
/** When the lock expires (for cloud TTL-based locks) */
|
|
87
|
+
expiresAt: OptionType(DateTimeType),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export type LockState = ValueTypeOf<typeof LockStateType>;
|
package/src/package.ts
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* - **Task**: A computation with input/output paths (stored separately)
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import { StructType, StringType, DictType, ValueTypeOf } from '@elaraai/east';
|
|
18
|
+
import { StructType, StringType, IntegerType, VariantType, NullType, DictType, ValueTypeOf } from '@elaraai/east';
|
|
19
|
+
import { DatasetRefType } from './dataset-ref.js';
|
|
19
20
|
import { StructureType } from './structure.js';
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -26,31 +27,13 @@ import { StructureType } from './structure.js';
|
|
|
26
27
|
*
|
|
27
28
|
* @remarks
|
|
28
29
|
* - `structure`: Defines which paths are datasets vs trees (recursive)
|
|
29
|
-
* - `
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* const data: PackageData = {
|
|
34
|
-
* structure: variant('struct', new Map([
|
|
35
|
-
* ['inputs', variant('struct', new Map([
|
|
36
|
-
* ['sales', variant('value', variant('Array', variant('Integer', null)))],
|
|
37
|
-
* ]))],
|
|
38
|
-
* ['tasks', variant('struct', new Map([
|
|
39
|
-
* ['process', variant('struct', new Map([
|
|
40
|
-
* ['function_ir', variant('value', ...)],
|
|
41
|
-
* ['output', variant('value', variant('Integer', null))],
|
|
42
|
-
* ]))],
|
|
43
|
-
* ]))],
|
|
44
|
-
* ])),
|
|
45
|
-
* value: 'abc123...', // Hash of initial tree
|
|
46
|
-
* };
|
|
47
|
-
* ```
|
|
30
|
+
* - `refs`: Per-dataset refs mapping refPath to DatasetRef (replaces old root tree hash)
|
|
48
31
|
*/
|
|
49
32
|
export const PackageDataType = StructType({
|
|
50
33
|
/** Structure defining tree shape (what's a group vs dataset) */
|
|
51
34
|
structure: StructureType,
|
|
52
|
-
/**
|
|
53
|
-
|
|
35
|
+
/** Per-dataset refs: refPath (e.g. "inputs/greeting") -> DatasetRef */
|
|
36
|
+
refs: DictType(StringType, DatasetRefType),
|
|
54
37
|
});
|
|
55
38
|
export type PackageDataType = typeof PackageDataType;
|
|
56
39
|
|
|
@@ -84,7 +67,7 @@ export type PackageDatasets = PackageData;
|
|
|
84
67
|
* tasks: new Map([['process', 'abc123...']]), // hash of TaskObject
|
|
85
68
|
* data: {
|
|
86
69
|
* structure: variant('struct', new Map([...])),
|
|
87
|
-
* value: 'def456...',
|
|
70
|
+
* refs: new Map([['inputs/sales', variant('value', { hash: 'def456...', versions: new Map() })]]),
|
|
88
71
|
* },
|
|
89
72
|
* };
|
|
90
73
|
* ```
|
|
@@ -98,3 +81,69 @@ export const PackageObjectType = StructType({
|
|
|
98
81
|
export type PackageObjectType = typeof PackageObjectType;
|
|
99
82
|
|
|
100
83
|
export type PackageObject = ValueTypeOf<typeof PackageObjectType>;
|
|
84
|
+
|
|
85
|
+
// =============================================================================
|
|
86
|
+
// Package Transfer Types
|
|
87
|
+
// =============================================================================
|
|
88
|
+
|
|
89
|
+
export const PackageTransferInitRequestType = StructType({
|
|
90
|
+
size: IntegerType,
|
|
91
|
+
});
|
|
92
|
+
export type PackageTransferInitRequest = ValueTypeOf<typeof PackageTransferInitRequestType>;
|
|
93
|
+
|
|
94
|
+
export const PackageTransferInitResponseType = StructType({
|
|
95
|
+
id: StringType,
|
|
96
|
+
uploadUrl: StringType,
|
|
97
|
+
});
|
|
98
|
+
export type PackageTransferInitResponse = ValueTypeOf<typeof PackageTransferInitResponseType>;
|
|
99
|
+
|
|
100
|
+
export const PackageJobResponseType = StructType({
|
|
101
|
+
id: StringType,
|
|
102
|
+
});
|
|
103
|
+
export type PackageJobResponse = ValueTypeOf<typeof PackageJobResponseType>;
|
|
104
|
+
|
|
105
|
+
export const PackageImportResultType = StructType({
|
|
106
|
+
name: StringType,
|
|
107
|
+
version: StringType,
|
|
108
|
+
packageHash: StringType,
|
|
109
|
+
objectCount: IntegerType,
|
|
110
|
+
});
|
|
111
|
+
export type PackageImportResult = ValueTypeOf<typeof PackageImportResultType>;
|
|
112
|
+
|
|
113
|
+
export const PackageExportResultType = StructType({
|
|
114
|
+
downloadUrl: StringType,
|
|
115
|
+
size: IntegerType,
|
|
116
|
+
});
|
|
117
|
+
export type PackageExportResult = ValueTypeOf<typeof PackageExportResultType>;
|
|
118
|
+
|
|
119
|
+
export const PackageImportProgressType = VariantType({
|
|
120
|
+
pending: NullType,
|
|
121
|
+
downloading: NullType,
|
|
122
|
+
importing: StructType({ objectsProcessed: IntegerType }),
|
|
123
|
+
});
|
|
124
|
+
export type PackageImportProgress = ValueTypeOf<typeof PackageImportProgressType>;
|
|
125
|
+
|
|
126
|
+
export const PackageImportStatusType = VariantType({
|
|
127
|
+
processing: PackageImportProgressType,
|
|
128
|
+
completed: PackageImportResultType,
|
|
129
|
+
failed: StructType({
|
|
130
|
+
message: StringType,
|
|
131
|
+
}),
|
|
132
|
+
});
|
|
133
|
+
export type PackageImportStatus = ValueTypeOf<typeof PackageImportStatusType>;
|
|
134
|
+
|
|
135
|
+
export const PackageExportProgressType = VariantType({
|
|
136
|
+
pending: NullType,
|
|
137
|
+
exporting: StructType({ objectsProcessed: IntegerType }),
|
|
138
|
+
uploading: NullType,
|
|
139
|
+
});
|
|
140
|
+
export type PackageExportProgress = ValueTypeOf<typeof PackageExportProgressType>;
|
|
141
|
+
|
|
142
|
+
export const PackageExportStatusType = VariantType({
|
|
143
|
+
processing: PackageExportProgressType,
|
|
144
|
+
completed: PackageExportResultType,
|
|
145
|
+
failed: StructType({
|
|
146
|
+
message: StringType,
|
|
147
|
+
}),
|
|
148
|
+
});
|
|
149
|
+
export type PackageExportStatus = ValueTypeOf<typeof PackageExportStatusType>;
|
package/src/structure.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* @see East serialization docs for keypath syntax details
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
import { VariantType, StringType, ArrayType, DictType, RecursiveType, ValueTypeOf, printIdentifier, variant, EastTypeType } from '@elaraai/east';
|
|
23
|
+
import { VariantType, StringType, ArrayType, DictType, RecursiveType, ValueTypeOf, printIdentifier, variant, EastTypeType, StructType, BooleanType } from '@elaraai/east';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Structure definition for a data tree node.
|
|
@@ -47,8 +47,13 @@ import { VariantType, StringType, ArrayType, DictType, RecursiveType, ValueTypeO
|
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
49
|
export const StructureType = RecursiveType(self => VariantType({
|
|
50
|
-
/** Dataset: East type
|
|
51
|
-
value:
|
|
50
|
+
/** Dataset: East type and writable flag */
|
|
51
|
+
value: StructType({
|
|
52
|
+
/** The East type of the dataset value (homoiconic EastTypeValue) */
|
|
53
|
+
type: EastTypeType,
|
|
54
|
+
/** Whether the dataset can be written to by users (e.g., inputs are writable, task outputs are not) */
|
|
55
|
+
writable: BooleanType,
|
|
56
|
+
}),
|
|
52
57
|
/** Struct tree: named children mapping to child structures */
|
|
53
58
|
struct: DictType(StringType, self),
|
|
54
59
|
}));
|
package/src/task.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* specified paths - the task just references locations, not types.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { StructType, StringType, ArrayType, ValueTypeOf } from '@elaraai/east';
|
|
19
|
+
import { StructType, StringType, ArrayType, BlobType, OptionType, ValueTypeOf } from '@elaraai/east';
|
|
20
20
|
import { TreePathType } from './structure.js';
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -60,6 +60,10 @@ export const TaskObjectType = StructType({
|
|
|
60
60
|
inputs: ArrayType(TreePathType),
|
|
61
61
|
/** Output path: where to write the output dataset in the data tree */
|
|
62
62
|
output: TreePathType,
|
|
63
|
+
/** Task kind: "data" (default), "ui", or future extensions. None for old packages. */
|
|
64
|
+
kind: OptionType(StringType),
|
|
65
|
+
/** Opaque extension metadata (beast2-encoded). Interpreted by the kind-specific consumer. */
|
|
66
|
+
metadata: OptionType(BlobType),
|
|
63
67
|
});
|
|
64
68
|
export type TaskObjectType = typeof TaskObjectType;
|
|
65
69
|
|
package/src/transfer.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Dataset transfer types for the staged upload protocol.
|
|
8
|
+
*
|
|
9
|
+
* Used by both the API server and client for large dataset uploads
|
|
10
|
+
* that exceed inline body size limits.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { VariantType, StructType, StringType, IntegerType, NullType, type ValueTypeOf } from '@elaraai/east';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Transfer upload init request.
|
|
17
|
+
*
|
|
18
|
+
* Workspace and dataset path are now encoded in the URL.
|
|
19
|
+
*
|
|
20
|
+
* @property hash - SHA-256 hex hash of the data (computed by client)
|
|
21
|
+
* @property size - Size of the data in bytes
|
|
22
|
+
*/
|
|
23
|
+
export const TransferUploadRequestType = StructType({
|
|
24
|
+
hash: StringType,
|
|
25
|
+
size: IntegerType,
|
|
26
|
+
});
|
|
27
|
+
export type TransferUploadRequest = ValueTypeOf<typeof TransferUploadRequestType>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Transfer upload init response.
|
|
31
|
+
*
|
|
32
|
+
* - `completed`: Object already exists (dedup), dataset ref updated
|
|
33
|
+
* - `upload`: Staging slot created, client should upload then call done
|
|
34
|
+
*/
|
|
35
|
+
export const TransferUploadResponseType = VariantType({
|
|
36
|
+
completed: NullType,
|
|
37
|
+
upload: StructType({
|
|
38
|
+
id: StringType,
|
|
39
|
+
uploadUrl: StringType,
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
export type TransferUploadResponse = ValueTypeOf<typeof TransferUploadResponseType>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Transfer done response.
|
|
46
|
+
*
|
|
47
|
+
* - `completed`: Hash verified, object stored, dataset ref updated
|
|
48
|
+
* - `error`: Hash mismatch or other failure
|
|
49
|
+
*/
|
|
50
|
+
export const TransferDoneResponseType = VariantType({
|
|
51
|
+
completed: NullType,
|
|
52
|
+
error: StructType({
|
|
53
|
+
message: StringType,
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
export type TransferDoneResponse = ValueTypeOf<typeof TransferDoneResponseType>;
|
package/src/workspace.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* No state file = workspace exists but not yet deployed.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { StructType, StringType, DateTimeType, ValueTypeOf } from '@elaraai/east';
|
|
19
|
+
import { StructType, StringType, DateTimeType, OptionType, ValueTypeOf } from '@elaraai/east';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Workspace state stored in workspaces/<name>/state.beast2
|
|
@@ -43,10 +43,8 @@ export const WorkspaceStateType = StructType({
|
|
|
43
43
|
packageHash: StringType,
|
|
44
44
|
/** UTC datetime when the package was deployed */
|
|
45
45
|
deployedAt: DateTimeType,
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
/** UTC datetime when root was last updated */
|
|
49
|
-
rootUpdatedAt: DateTimeType,
|
|
46
|
+
/** Run ID of the latest completed dataflow run (null if never run) */
|
|
47
|
+
currentRunId: OptionType(StringType),
|
|
50
48
|
});
|
|
51
49
|
|
|
52
50
|
export type WorkspaceState = ValueTypeOf<typeof WorkspaceStateType>;
|
package/tsconfig.json
CHANGED