@elaraai/e3-api-client 0.0.2-beta.1 → 0.0.2-beta.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.
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/platform.d.ts +1484 -0
- package/dist/src/platform.d.ts.map +1 -0
- package/dist/src/platform.js +1224 -0
- package/dist/src/platform.js.map +1 -0
- package/package.json +6 -3
|
@@ -0,0 +1,1224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { East, StringType, IntegerType, BlobType, NullType, ArrayType, StructType, } from '@elaraai/east';
|
|
6
|
+
import { EastError } from '@elaraai/east/internal';
|
|
7
|
+
import { TreePathType, WorkspaceStateType, PackageObjectType } from '@elaraai/e3-types';
|
|
8
|
+
import { RepositoryStatusType, GcRequestType, GcResultType, PackageListItemType, PackageImportResultType, WorkspaceInfoType, WorkspaceStatusResultType, TaskListItemType, TaskDetailsType, DataflowRequestType, DataflowGraphType, DataflowResultType, LogChunkType, } from './types.js';
|
|
9
|
+
import { repoStatus, repoGc, } from './repository.js';
|
|
10
|
+
import { packageList, packageGet, packageImport, packageExport, packageRemove, } from './packages.js';
|
|
11
|
+
import { workspaceList, workspaceCreate, workspaceGet, workspaceStatus, workspaceRemove, workspaceDeploy, workspaceExport, } from './workspaces.js';
|
|
12
|
+
import { datasetList, datasetListAt, datasetGet, datasetSet, } from './datasets.js';
|
|
13
|
+
import { taskList, taskGet, } from './tasks.js';
|
|
14
|
+
import { dataflowStart, dataflowExecute, dataflowGraph, taskLogs, } from './executions.js';
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// Repository Platform Functions
|
|
17
|
+
// =============================================================================
|
|
18
|
+
/**
|
|
19
|
+
* Gets repository status information.
|
|
20
|
+
*
|
|
21
|
+
* Returns statistics about the e3 repository including object count, package count,
|
|
22
|
+
* and workspace count. Use this to monitor repository health and size.
|
|
23
|
+
*
|
|
24
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
25
|
+
* in East programs running on Node.js.
|
|
26
|
+
*
|
|
27
|
+
* @param url - Base URL of the e3 API server
|
|
28
|
+
* @returns Repository status including object, package, and workspace counts
|
|
29
|
+
*
|
|
30
|
+
* @throws {EastError} When request fails:
|
|
31
|
+
* - Network error
|
|
32
|
+
* - Server unavailable
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const getStatus = East.function([StringType], RepositoryStatusType, ($, url) => {
|
|
37
|
+
* return Platform.repoStatus(url);
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export const platform_repo_status = East.asyncPlatform('e3_repo_status', [StringType], RepositoryStatusType);
|
|
42
|
+
/**
|
|
43
|
+
* Runs garbage collection on the repository.
|
|
44
|
+
*
|
|
45
|
+
* Removes unreferenced objects from the object store to free disk space.
|
|
46
|
+
* Use dryRun mode to preview what would be deleted without actually deleting.
|
|
47
|
+
*
|
|
48
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
49
|
+
* in East programs running on Node.js.
|
|
50
|
+
*
|
|
51
|
+
* @param url - Base URL of the e3 API server
|
|
52
|
+
* @param options - GC options (dryRun to preview, minAge for object age filter)
|
|
53
|
+
* @returns GC result with counts and freed bytes
|
|
54
|
+
*
|
|
55
|
+
* @throws {EastError} When request fails:
|
|
56
|
+
* - Network error
|
|
57
|
+
* - Server unavailable
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const runGc = East.function([StringType, GcRequestType], GcResultType, ($, url, options) => {
|
|
62
|
+
* return Platform.repoGc(url, options);
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export const platform_repo_gc = East.asyncPlatform('e3_repo_gc', [StringType, GcRequestType], GcResultType);
|
|
67
|
+
// =============================================================================
|
|
68
|
+
// Package Platform Functions
|
|
69
|
+
// =============================================================================
|
|
70
|
+
/**
|
|
71
|
+
* Lists all packages in the repository.
|
|
72
|
+
*
|
|
73
|
+
* Returns an array of package summaries including name and version.
|
|
74
|
+
*
|
|
75
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
76
|
+
* in East programs running on Node.js.
|
|
77
|
+
*
|
|
78
|
+
* @param url - Base URL of the e3 API server
|
|
79
|
+
* @returns Array of package info (name, version)
|
|
80
|
+
*
|
|
81
|
+
* @throws {EastError} When request fails:
|
|
82
|
+
* - Network error
|
|
83
|
+
* - Server unavailable
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const listPackages = East.function([StringType], ArrayType(PackageListItemType), ($, url) => {
|
|
88
|
+
* return Platform.packageList(url);
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export const platform_package_list = East.asyncPlatform('e3_package_list', [StringType], ArrayType(PackageListItemType));
|
|
93
|
+
/**
|
|
94
|
+
* Gets a package object by name and version.
|
|
95
|
+
*
|
|
96
|
+
* Returns the complete package object including tasks, data structure, and metadata.
|
|
97
|
+
*
|
|
98
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
99
|
+
* in East programs running on Node.js.
|
|
100
|
+
*
|
|
101
|
+
* @param url - Base URL of the e3 API server
|
|
102
|
+
* @param name - Package name
|
|
103
|
+
* @param version - Package version
|
|
104
|
+
* @returns Package object
|
|
105
|
+
*
|
|
106
|
+
* @throws {EastError} When request fails:
|
|
107
|
+
* - Package not found
|
|
108
|
+
* - Network error
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* const getPackage = East.function([StringType, StringType, StringType], PackageObjectType, ($, url, name, version) => {
|
|
113
|
+
* return Platform.packageGet(url, name, version);
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export const platform_package_get = East.asyncPlatform('e3_package_get', [StringType, StringType, StringType], PackageObjectType);
|
|
118
|
+
/**
|
|
119
|
+
* Imports a package from a zip archive.
|
|
120
|
+
*
|
|
121
|
+
* Takes a zip archive containing a package and imports it into the repository.
|
|
122
|
+
*
|
|
123
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
124
|
+
* in East programs running on Node.js.
|
|
125
|
+
*
|
|
126
|
+
* @param url - Base URL of the e3 API server
|
|
127
|
+
* @param archive - Zip archive as bytes
|
|
128
|
+
* @returns Import result with package info and object count
|
|
129
|
+
*
|
|
130
|
+
* @throws {EastError} When request fails:
|
|
131
|
+
* - Invalid package format
|
|
132
|
+
* - Package already exists
|
|
133
|
+
* - Network error
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const importPackage = East.function([StringType, BlobType], PackageImportResultType, ($, url, archive) => {
|
|
138
|
+
* return Platform.packageImport(url, archive);
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export const platform_package_import = East.asyncPlatform('e3_package_import', [StringType, BlobType], PackageImportResultType);
|
|
143
|
+
/**
|
|
144
|
+
* Exports a package as a zip archive.
|
|
145
|
+
*
|
|
146
|
+
* Returns a zip archive containing the package that can be transferred or stored.
|
|
147
|
+
*
|
|
148
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
149
|
+
* in East programs running on Node.js.
|
|
150
|
+
*
|
|
151
|
+
* @param url - Base URL of the e3 API server
|
|
152
|
+
* @param name - Package name
|
|
153
|
+
* @param version - Package version
|
|
154
|
+
* @returns Zip archive as bytes
|
|
155
|
+
*
|
|
156
|
+
* @throws {EastError} When request fails:
|
|
157
|
+
* - Package not found
|
|
158
|
+
* - Network error
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* const exportPackage = East.function([StringType, StringType, StringType], BlobType, ($, url, name, version) => {
|
|
163
|
+
* return Platform.packageExport(url, name, version);
|
|
164
|
+
* });
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
export const platform_package_export = East.asyncPlatform('e3_package_export', [StringType, StringType, StringType], BlobType);
|
|
168
|
+
/**
|
|
169
|
+
* Removes a package from the repository.
|
|
170
|
+
*
|
|
171
|
+
* Deletes a package by name and version. Does not affect objects referenced by other packages.
|
|
172
|
+
*
|
|
173
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
174
|
+
* in East programs running on Node.js.
|
|
175
|
+
*
|
|
176
|
+
* @param url - Base URL of the e3 API server
|
|
177
|
+
* @param name - Package name
|
|
178
|
+
* @param version - Package version
|
|
179
|
+
* @returns null on success
|
|
180
|
+
*
|
|
181
|
+
* @throws {EastError} When request fails:
|
|
182
|
+
* - Package not found
|
|
183
|
+
* - Network error
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* const removePackage = East.function([StringType, StringType, StringType], NullType, ($, url, name, version) => {
|
|
188
|
+
* return Platform.packageRemove(url, name, version);
|
|
189
|
+
* });
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
export const platform_package_remove = East.asyncPlatform('e3_package_remove', [StringType, StringType, StringType], NullType);
|
|
193
|
+
// =============================================================================
|
|
194
|
+
// Workspace Platform Functions
|
|
195
|
+
// =============================================================================
|
|
196
|
+
/**
|
|
197
|
+
* Lists all workspaces in the repository.
|
|
198
|
+
*
|
|
199
|
+
* Returns an array of workspace summaries including deployment status.
|
|
200
|
+
*
|
|
201
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
202
|
+
* in East programs running on Node.js.
|
|
203
|
+
*
|
|
204
|
+
* @param url - Base URL of the e3 API server
|
|
205
|
+
* @returns Array of workspace info
|
|
206
|
+
*
|
|
207
|
+
* @throws {EastError} When request fails:
|
|
208
|
+
* - Network error
|
|
209
|
+
* - Server unavailable
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```ts
|
|
213
|
+
* const listWorkspaces = East.function([StringType], ArrayType(WorkspaceInfoType), ($, url) => {
|
|
214
|
+
* return Platform.workspaceList(url);
|
|
215
|
+
* });
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
export const platform_workspace_list = East.asyncPlatform('e3_workspace_list', [StringType], ArrayType(WorkspaceInfoType));
|
|
219
|
+
/**
|
|
220
|
+
* Creates a new empty workspace.
|
|
221
|
+
*
|
|
222
|
+
* Creates a workspace with the given name that can be used to deploy packages.
|
|
223
|
+
*
|
|
224
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
225
|
+
* in East programs running on Node.js.
|
|
226
|
+
*
|
|
227
|
+
* @param url - Base URL of the e3 API server
|
|
228
|
+
* @param name - Workspace name
|
|
229
|
+
* @returns Created workspace info
|
|
230
|
+
*
|
|
231
|
+
* @throws {EastError} When request fails:
|
|
232
|
+
* - Workspace already exists
|
|
233
|
+
* - Network error
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* const createWorkspace = East.function([StringType, StringType], WorkspaceInfoType, ($, url, name) => {
|
|
238
|
+
* return Platform.workspaceCreate(url, name);
|
|
239
|
+
* });
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export const platform_workspace_create = East.asyncPlatform('e3_workspace_create', [StringType, StringType], WorkspaceInfoType);
|
|
243
|
+
/**
|
|
244
|
+
* Gets workspace state including deployed package info.
|
|
245
|
+
*
|
|
246
|
+
* Returns the full workspace state including the deployed package and current root hash.
|
|
247
|
+
*
|
|
248
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
249
|
+
* in East programs running on Node.js.
|
|
250
|
+
*
|
|
251
|
+
* @param url - Base URL of the e3 API server
|
|
252
|
+
* @param name - Workspace name
|
|
253
|
+
* @returns Workspace state
|
|
254
|
+
*
|
|
255
|
+
* @throws {EastError} When request fails:
|
|
256
|
+
* - Workspace not found
|
|
257
|
+
* - Network error
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* const getWorkspace = East.function([StringType, StringType], WorkspaceStateType, ($, url, name) => {
|
|
262
|
+
* return Platform.workspaceGet(url, name);
|
|
263
|
+
* });
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
export const platform_workspace_get = East.asyncPlatform('e3_workspace_get', [StringType, StringType], WorkspaceStateType);
|
|
267
|
+
/**
|
|
268
|
+
* Gets comprehensive workspace status.
|
|
269
|
+
*
|
|
270
|
+
* Returns detailed status including all datasets, tasks, lock info, and summary counts.
|
|
271
|
+
* Use this to monitor execution progress after calling dataflowStart.
|
|
272
|
+
*
|
|
273
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
274
|
+
* in East programs running on Node.js.
|
|
275
|
+
*
|
|
276
|
+
* @param url - Base URL of the e3 API server
|
|
277
|
+
* @param name - Workspace name
|
|
278
|
+
* @returns Workspace status with datasets, tasks, and summary
|
|
279
|
+
*
|
|
280
|
+
* @throws {EastError} When request fails:
|
|
281
|
+
* - Workspace not found
|
|
282
|
+
* - Network error
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* const getStatus = East.function([StringType, StringType], WorkspaceStatusResultType, ($, url, name) => {
|
|
287
|
+
* return Platform.workspaceStatus(url, name);
|
|
288
|
+
* });
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
export const platform_workspace_status = East.asyncPlatform('e3_workspace_status', [StringType, StringType], WorkspaceStatusResultType);
|
|
292
|
+
/**
|
|
293
|
+
* Removes a workspace.
|
|
294
|
+
*
|
|
295
|
+
* Deletes a workspace and all its data. Cannot be undone.
|
|
296
|
+
*
|
|
297
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
298
|
+
* in East programs running on Node.js.
|
|
299
|
+
*
|
|
300
|
+
* @param url - Base URL of the e3 API server
|
|
301
|
+
* @param name - Workspace name
|
|
302
|
+
* @returns null on success
|
|
303
|
+
*
|
|
304
|
+
* @throws {EastError} When request fails:
|
|
305
|
+
* - Workspace not found
|
|
306
|
+
* - Network error
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```ts
|
|
310
|
+
* const removeWorkspace = East.function([StringType, StringType], NullType, ($, url, name) => {
|
|
311
|
+
* return Platform.workspaceRemove(url, name);
|
|
312
|
+
* });
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
export const platform_workspace_remove = East.asyncPlatform('e3_workspace_remove', [StringType, StringType], NullType);
|
|
316
|
+
/**
|
|
317
|
+
* Deploys a package to a workspace.
|
|
318
|
+
*
|
|
319
|
+
* Sets up the workspace with the specified package's data structure and tasks.
|
|
320
|
+
*
|
|
321
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
322
|
+
* in East programs running on Node.js.
|
|
323
|
+
*
|
|
324
|
+
* @param url - Base URL of the e3 API server
|
|
325
|
+
* @param name - Workspace name
|
|
326
|
+
* @param packageRef - Package reference (name or name@version)
|
|
327
|
+
* @returns null on success
|
|
328
|
+
*
|
|
329
|
+
* @throws {EastError} When request fails:
|
|
330
|
+
* - Workspace not found
|
|
331
|
+
* - Package not found
|
|
332
|
+
* - Network error
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```ts
|
|
336
|
+
* const deploy = East.function([StringType, StringType, StringType], NullType, ($, url, workspace, packageRef) => {
|
|
337
|
+
* return Platform.workspaceDeploy(url, workspace, packageRef);
|
|
338
|
+
* });
|
|
339
|
+
* ```
|
|
340
|
+
*/
|
|
341
|
+
export const platform_workspace_deploy = East.asyncPlatform('e3_workspace_deploy', [StringType, StringType, StringType], NullType);
|
|
342
|
+
/**
|
|
343
|
+
* Exports workspace as a package zip archive.
|
|
344
|
+
*
|
|
345
|
+
* Creates a zip archive of the workspace that can be imported elsewhere.
|
|
346
|
+
*
|
|
347
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
348
|
+
* in East programs running on Node.js.
|
|
349
|
+
*
|
|
350
|
+
* @param url - Base URL of the e3 API server
|
|
351
|
+
* @param name - Workspace name
|
|
352
|
+
* @returns Zip archive as bytes
|
|
353
|
+
*
|
|
354
|
+
* @throws {EastError} When request fails:
|
|
355
|
+
* - Workspace not found
|
|
356
|
+
* - Network error
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```ts
|
|
360
|
+
* const exportWorkspace = East.function([StringType, StringType], BlobType, ($, url, name) => {
|
|
361
|
+
* return Platform.workspaceExport(url, name);
|
|
362
|
+
* });
|
|
363
|
+
* ```
|
|
364
|
+
*/
|
|
365
|
+
export const platform_workspace_export = East.asyncPlatform('e3_workspace_export', [StringType, StringType], BlobType);
|
|
366
|
+
// =============================================================================
|
|
367
|
+
// Dataset Platform Functions
|
|
368
|
+
// =============================================================================
|
|
369
|
+
/**
|
|
370
|
+
* Lists field names at root of workspace dataset tree.
|
|
371
|
+
*
|
|
372
|
+
* Returns the top-level field names in the workspace's data tree.
|
|
373
|
+
*
|
|
374
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
375
|
+
* in East programs running on Node.js.
|
|
376
|
+
*
|
|
377
|
+
* @param url - Base URL of the e3 API server
|
|
378
|
+
* @param workspace - Workspace name
|
|
379
|
+
* @returns Array of field names at root
|
|
380
|
+
*
|
|
381
|
+
* @throws {EastError} When request fails:
|
|
382
|
+
* - Workspace not found
|
|
383
|
+
* - Network error
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ```ts
|
|
387
|
+
* const listDatasets = East.function([StringType, StringType], ArrayType(StringType), ($, url, workspace) => {
|
|
388
|
+
* return Platform.datasetList(url, workspace);
|
|
389
|
+
* });
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
export const platform_dataset_list = East.asyncPlatform('e3_dataset_list', [StringType, StringType], ArrayType(StringType));
|
|
393
|
+
/**
|
|
394
|
+
* Lists field names at a path in workspace dataset tree.
|
|
395
|
+
*
|
|
396
|
+
* Returns field names at the specified path in the workspace's data tree.
|
|
397
|
+
*
|
|
398
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
399
|
+
* in East programs running on Node.js.
|
|
400
|
+
*
|
|
401
|
+
* @param url - Base URL of the e3 API server
|
|
402
|
+
* @param workspace - Workspace name
|
|
403
|
+
* @param path - Path to the dataset
|
|
404
|
+
* @returns Array of field names at path
|
|
405
|
+
*
|
|
406
|
+
* @throws {EastError} When request fails:
|
|
407
|
+
* - Workspace not found
|
|
408
|
+
* - Path not found
|
|
409
|
+
* - Network error
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* ```ts
|
|
413
|
+
* const listAt = East.function([StringType, StringType, TreePathType], ArrayType(StringType), ($, url, workspace, path) => {
|
|
414
|
+
* return Platform.datasetListAt(url, workspace, path);
|
|
415
|
+
* });
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
export const platform_dataset_list_at = East.asyncPlatform('e3_dataset_list_at', [StringType, StringType, TreePathType], ArrayType(StringType));
|
|
419
|
+
/**
|
|
420
|
+
* Gets a dataset value as raw BEAST2 bytes.
|
|
421
|
+
*
|
|
422
|
+
* Returns the raw BEAST2 encoded data for a dataset.
|
|
423
|
+
* Use decodeBeast2 or decodeBeast2For to decode with the appropriate type.
|
|
424
|
+
*
|
|
425
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
426
|
+
* in East programs running on Node.js.
|
|
427
|
+
*
|
|
428
|
+
* @param url - Base URL of the e3 API server
|
|
429
|
+
* @param workspace - Workspace name
|
|
430
|
+
* @param path - Path to the dataset
|
|
431
|
+
* @returns Raw BEAST2 bytes
|
|
432
|
+
*
|
|
433
|
+
* @throws {EastError} When request fails:
|
|
434
|
+
* - Workspace not found
|
|
435
|
+
* - Dataset not found
|
|
436
|
+
* - Network error
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```ts
|
|
440
|
+
* const getData = East.function([StringType, StringType, TreePathType], BlobType, ($, url, workspace, path) => {
|
|
441
|
+
* return Platform.datasetGet(url, workspace, path);
|
|
442
|
+
* });
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
export const platform_dataset_get = East.asyncPlatform('e3_dataset_get', [StringType, StringType, TreePathType], BlobType);
|
|
446
|
+
/**
|
|
447
|
+
* Sets a dataset value from raw BEAST2 bytes.
|
|
448
|
+
*
|
|
449
|
+
* Stores the BEAST2 encoded data at the specified dataset path.
|
|
450
|
+
*
|
|
451
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
452
|
+
* in East programs running on Node.js.
|
|
453
|
+
*
|
|
454
|
+
* @param url - Base URL of the e3 API server
|
|
455
|
+
* @param workspace - Workspace name
|
|
456
|
+
* @param path - Path to the dataset
|
|
457
|
+
* @param data - Raw BEAST2 encoded value
|
|
458
|
+
* @returns null on success
|
|
459
|
+
*
|
|
460
|
+
* @throws {EastError} When request fails:
|
|
461
|
+
* - Workspace not found
|
|
462
|
+
* - Invalid path
|
|
463
|
+
* - Network error
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* ```ts
|
|
467
|
+
* const setData = East.function([StringType, StringType, TreePathType, BlobType], NullType, ($, url, workspace, path, data) => {
|
|
468
|
+
* return Platform.datasetSet(url, workspace, path, data);
|
|
469
|
+
* });
|
|
470
|
+
* ```
|
|
471
|
+
*/
|
|
472
|
+
export const platform_dataset_set = East.asyncPlatform('e3_dataset_set', [StringType, StringType, TreePathType, BlobType], NullType);
|
|
473
|
+
// =============================================================================
|
|
474
|
+
// Task Platform Functions
|
|
475
|
+
// =============================================================================
|
|
476
|
+
/**
|
|
477
|
+
* Lists tasks in a workspace.
|
|
478
|
+
*
|
|
479
|
+
* Returns an array of task summaries including name and hash.
|
|
480
|
+
*
|
|
481
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
482
|
+
* in East programs running on Node.js.
|
|
483
|
+
*
|
|
484
|
+
* @param url - Base URL of the e3 API server
|
|
485
|
+
* @param workspace - Workspace name
|
|
486
|
+
* @returns Array of task info (name, hash)
|
|
487
|
+
*
|
|
488
|
+
* @throws {EastError} When request fails:
|
|
489
|
+
* - Workspace not found
|
|
490
|
+
* - Workspace not deployed
|
|
491
|
+
* - Network error
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* ```ts
|
|
495
|
+
* const listTasks = East.function([StringType, StringType], ArrayType(TaskListItemType), ($, url, workspace) => {
|
|
496
|
+
* return Platform.taskList(url, workspace);
|
|
497
|
+
* });
|
|
498
|
+
* ```
|
|
499
|
+
*/
|
|
500
|
+
export const platform_task_list = East.asyncPlatform('e3_task_list', [StringType, StringType], ArrayType(TaskListItemType));
|
|
501
|
+
/**
|
|
502
|
+
* Gets task details including runner and typed inputs/outputs.
|
|
503
|
+
*
|
|
504
|
+
* Returns the complete task definition including command IR and input/output paths.
|
|
505
|
+
*
|
|
506
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
507
|
+
* in East programs running on Node.js.
|
|
508
|
+
*
|
|
509
|
+
* @param url - Base URL of the e3 API server
|
|
510
|
+
* @param workspace - Workspace name
|
|
511
|
+
* @param name - Task name
|
|
512
|
+
* @returns Task details
|
|
513
|
+
*
|
|
514
|
+
* @throws {EastError} When request fails:
|
|
515
|
+
* - Workspace not found
|
|
516
|
+
* - Task not found
|
|
517
|
+
* - Network error
|
|
518
|
+
*
|
|
519
|
+
* @example
|
|
520
|
+
* ```ts
|
|
521
|
+
* const getTask = East.function([StringType, StringType, StringType], TaskDetailsType, ($, url, workspace, name) => {
|
|
522
|
+
* return Platform.taskGet(url, workspace, name);
|
|
523
|
+
* });
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
export const platform_task_get = East.asyncPlatform('e3_task_get', [StringType, StringType, StringType], TaskDetailsType);
|
|
527
|
+
// =============================================================================
|
|
528
|
+
// Execution Platform Functions
|
|
529
|
+
// =============================================================================
|
|
530
|
+
/**
|
|
531
|
+
* Starts dataflow execution on a workspace (non-blocking).
|
|
532
|
+
*
|
|
533
|
+
* Returns immediately after spawning execution in background.
|
|
534
|
+
* Use workspaceStatus to poll for progress.
|
|
535
|
+
*
|
|
536
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
537
|
+
* in East programs running on Node.js.
|
|
538
|
+
*
|
|
539
|
+
* @param url - Base URL of the e3 API server
|
|
540
|
+
* @param workspace - Workspace name
|
|
541
|
+
* @param options - Execution options (concurrency, force, filter)
|
|
542
|
+
* @returns null on success
|
|
543
|
+
*
|
|
544
|
+
* @throws {EastError} When request fails:
|
|
545
|
+
* - Workspace not found
|
|
546
|
+
* - Workspace locked
|
|
547
|
+
* - Network error
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* ```ts
|
|
551
|
+
* const start = East.function([StringType, StringType, DataflowRequestType], NullType, ($, url, workspace, options) => {
|
|
552
|
+
* return Platform.dataflowStart(url, workspace, options);
|
|
553
|
+
* });
|
|
554
|
+
* ```
|
|
555
|
+
*/
|
|
556
|
+
export const platform_dataflow_start = East.asyncPlatform('e3_dataflow_start', [StringType, StringType, DataflowRequestType], NullType);
|
|
557
|
+
/**
|
|
558
|
+
* Executes dataflow on a workspace (blocking).
|
|
559
|
+
*
|
|
560
|
+
* Waits for execution to complete and returns the result with per-task outcomes.
|
|
561
|
+
*
|
|
562
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
563
|
+
* in East programs running on Node.js.
|
|
564
|
+
*
|
|
565
|
+
* @param url - Base URL of the e3 API server
|
|
566
|
+
* @param workspace - Workspace name
|
|
567
|
+
* @param options - Execution options (concurrency, force, filter)
|
|
568
|
+
* @returns Dataflow execution result
|
|
569
|
+
*
|
|
570
|
+
* @throws {EastError} When request fails:
|
|
571
|
+
* - Workspace not found
|
|
572
|
+
* - Workspace locked
|
|
573
|
+
* - Network error
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* ```ts
|
|
577
|
+
* const execute = East.function([StringType, StringType, DataflowRequestType], DataflowResultType, ($, url, workspace, options) => {
|
|
578
|
+
* return Platform.dataflowExecute(url, workspace, options);
|
|
579
|
+
* });
|
|
580
|
+
* ```
|
|
581
|
+
*/
|
|
582
|
+
export const platform_dataflow_execute = East.asyncPlatform('e3_dataflow_execute', [StringType, StringType, DataflowRequestType], DataflowResultType);
|
|
583
|
+
/**
|
|
584
|
+
* Gets the dependency graph for a workspace.
|
|
585
|
+
*
|
|
586
|
+
* Returns the task dependency graph showing which tasks depend on which others.
|
|
587
|
+
*
|
|
588
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
589
|
+
* in East programs running on Node.js.
|
|
590
|
+
*
|
|
591
|
+
* @param url - Base URL of the e3 API server
|
|
592
|
+
* @param workspace - Workspace name
|
|
593
|
+
* @returns Dataflow graph with tasks and dependencies
|
|
594
|
+
*
|
|
595
|
+
* @throws {EastError} When request fails:
|
|
596
|
+
* - Workspace not found
|
|
597
|
+
* - Network error
|
|
598
|
+
*
|
|
599
|
+
* @example
|
|
600
|
+
* ```ts
|
|
601
|
+
* const getGraph = East.function([StringType, StringType], DataflowGraphType, ($, url, workspace) => {
|
|
602
|
+
* return Platform.dataflowGraph(url, workspace);
|
|
603
|
+
* });
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
export const platform_dataflow_graph = East.asyncPlatform('e3_dataflow_graph', [StringType, StringType], DataflowGraphType);
|
|
607
|
+
/**
|
|
608
|
+
* Log request options type.
|
|
609
|
+
*/
|
|
610
|
+
export const LogOptionsType = StructType({
|
|
611
|
+
stream: StringType,
|
|
612
|
+
offset: IntegerType,
|
|
613
|
+
limit: IntegerType,
|
|
614
|
+
});
|
|
615
|
+
/**
|
|
616
|
+
* Reads task logs from a workspace.
|
|
617
|
+
*
|
|
618
|
+
* Returns a chunk of log data from the specified task's stdout or stderr.
|
|
619
|
+
*
|
|
620
|
+
* This is a platform function for the East language, enabling e3 API operations
|
|
621
|
+
* in East programs running on Node.js.
|
|
622
|
+
*
|
|
623
|
+
* @param url - Base URL of the e3 API server
|
|
624
|
+
* @param workspace - Workspace name
|
|
625
|
+
* @param task - Task name
|
|
626
|
+
* @param options - Log options (stream, offset, limit)
|
|
627
|
+
* @returns Log chunk with data and metadata
|
|
628
|
+
*
|
|
629
|
+
* @throws {EastError} When request fails:
|
|
630
|
+
* - Workspace not found
|
|
631
|
+
* - Task not found
|
|
632
|
+
* - Network error
|
|
633
|
+
*
|
|
634
|
+
* @example
|
|
635
|
+
* ```ts
|
|
636
|
+
* const getLogs = East.function([StringType, StringType, StringType, LogOptionsType], LogChunkType, ($, url, workspace, task, options) => {
|
|
637
|
+
* return Platform.taskLogs(url, workspace, task, options);
|
|
638
|
+
* });
|
|
639
|
+
* ```
|
|
640
|
+
*/
|
|
641
|
+
export const platform_task_logs = East.asyncPlatform('e3_task_logs', [StringType, StringType, StringType, LogOptionsType], LogChunkType);
|
|
642
|
+
// =============================================================================
|
|
643
|
+
// Platform Implementation
|
|
644
|
+
// =============================================================================
|
|
645
|
+
/**
|
|
646
|
+
* Node.js implementation of e3 API platform functions.
|
|
647
|
+
*
|
|
648
|
+
* Pass this array to {@link East.compileAsync} to enable e3 API operations.
|
|
649
|
+
*/
|
|
650
|
+
const PlatformImpl = [
|
|
651
|
+
// Repository
|
|
652
|
+
platform_repo_status.implement(async (url) => {
|
|
653
|
+
try {
|
|
654
|
+
return await repoStatus(url);
|
|
655
|
+
}
|
|
656
|
+
catch (err) {
|
|
657
|
+
throw new EastError(`Failed to get repository status: ${err.message}`, {
|
|
658
|
+
location: { filename: 'e3_repo_status', line: 0n, column: 0n },
|
|
659
|
+
cause: err,
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
}),
|
|
663
|
+
platform_repo_gc.implement(async (url, options) => {
|
|
664
|
+
try {
|
|
665
|
+
return await repoGc(url, options);
|
|
666
|
+
}
|
|
667
|
+
catch (err) {
|
|
668
|
+
throw new EastError(`Failed to run garbage collection: ${err.message}`, {
|
|
669
|
+
location: { filename: 'e3_repo_gc', line: 0n, column: 0n },
|
|
670
|
+
cause: err,
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
}),
|
|
674
|
+
// Packages
|
|
675
|
+
platform_package_list.implement(async (url) => {
|
|
676
|
+
try {
|
|
677
|
+
return await packageList(url);
|
|
678
|
+
}
|
|
679
|
+
catch (err) {
|
|
680
|
+
throw new EastError(`Failed to list packages: ${err.message}`, {
|
|
681
|
+
location: { filename: 'e3_package_list', line: 0n, column: 0n },
|
|
682
|
+
cause: err,
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
}),
|
|
686
|
+
platform_package_get.implement(async (url, name, version) => {
|
|
687
|
+
try {
|
|
688
|
+
return await packageGet(url, name, version);
|
|
689
|
+
}
|
|
690
|
+
catch (err) {
|
|
691
|
+
throw new EastError(`Failed to get package ${name}@${version}: ${err.message}`, {
|
|
692
|
+
location: { filename: 'e3_package_get', line: 0n, column: 0n },
|
|
693
|
+
cause: err,
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
}),
|
|
697
|
+
platform_package_import.implement(async (url, archive) => {
|
|
698
|
+
try {
|
|
699
|
+
return await packageImport(url, archive);
|
|
700
|
+
}
|
|
701
|
+
catch (err) {
|
|
702
|
+
throw new EastError(`Failed to import package: ${err.message}`, {
|
|
703
|
+
location: { filename: 'e3_package_import', line: 0n, column: 0n },
|
|
704
|
+
cause: err,
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
}),
|
|
708
|
+
platform_package_export.implement(async (url, name, version) => {
|
|
709
|
+
try {
|
|
710
|
+
return await packageExport(url, name, version);
|
|
711
|
+
}
|
|
712
|
+
catch (err) {
|
|
713
|
+
throw new EastError(`Failed to export package ${name}@${version}: ${err.message}`, {
|
|
714
|
+
location: { filename: 'e3_package_export', line: 0n, column: 0n },
|
|
715
|
+
cause: err,
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
}),
|
|
719
|
+
platform_package_remove.implement(async (url, name, version) => {
|
|
720
|
+
try {
|
|
721
|
+
await packageRemove(url, name, version);
|
|
722
|
+
return null;
|
|
723
|
+
}
|
|
724
|
+
catch (err) {
|
|
725
|
+
throw new EastError(`Failed to remove package ${name}@${version}: ${err.message}`, {
|
|
726
|
+
location: { filename: 'e3_package_remove', line: 0n, column: 0n },
|
|
727
|
+
cause: err,
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
}),
|
|
731
|
+
// Workspaces
|
|
732
|
+
platform_workspace_list.implement(async (url) => {
|
|
733
|
+
try {
|
|
734
|
+
return await workspaceList(url);
|
|
735
|
+
}
|
|
736
|
+
catch (err) {
|
|
737
|
+
throw new EastError(`Failed to list workspaces: ${err.message}`, {
|
|
738
|
+
location: { filename: 'e3_workspace_list', line: 0n, column: 0n },
|
|
739
|
+
cause: err,
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
}),
|
|
743
|
+
platform_workspace_create.implement(async (url, name) => {
|
|
744
|
+
try {
|
|
745
|
+
return await workspaceCreate(url, name);
|
|
746
|
+
}
|
|
747
|
+
catch (err) {
|
|
748
|
+
throw new EastError(`Failed to create workspace ${name}: ${err.message}`, {
|
|
749
|
+
location: { filename: 'e3_workspace_create', line: 0n, column: 0n },
|
|
750
|
+
cause: err,
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
}),
|
|
754
|
+
platform_workspace_get.implement(async (url, name) => {
|
|
755
|
+
try {
|
|
756
|
+
return await workspaceGet(url, name);
|
|
757
|
+
}
|
|
758
|
+
catch (err) {
|
|
759
|
+
throw new EastError(`Failed to get workspace ${name}: ${err.message}`, {
|
|
760
|
+
location: { filename: 'e3_workspace_get', line: 0n, column: 0n },
|
|
761
|
+
cause: err,
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
}),
|
|
765
|
+
platform_workspace_status.implement(async (url, name) => {
|
|
766
|
+
try {
|
|
767
|
+
return await workspaceStatus(url, name);
|
|
768
|
+
}
|
|
769
|
+
catch (err) {
|
|
770
|
+
throw new EastError(`Failed to get workspace status ${name}: ${err.message}`, {
|
|
771
|
+
location: { filename: 'e3_workspace_status', line: 0n, column: 0n },
|
|
772
|
+
cause: err,
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
}),
|
|
776
|
+
platform_workspace_remove.implement(async (url, name) => {
|
|
777
|
+
try {
|
|
778
|
+
await workspaceRemove(url, name);
|
|
779
|
+
return null;
|
|
780
|
+
}
|
|
781
|
+
catch (err) {
|
|
782
|
+
throw new EastError(`Failed to remove workspace ${name}: ${err.message}`, {
|
|
783
|
+
location: { filename: 'e3_workspace_remove', line: 0n, column: 0n },
|
|
784
|
+
cause: err,
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
}),
|
|
788
|
+
platform_workspace_deploy.implement(async (url, name, packageRef) => {
|
|
789
|
+
try {
|
|
790
|
+
await workspaceDeploy(url, name, packageRef);
|
|
791
|
+
return null;
|
|
792
|
+
}
|
|
793
|
+
catch (err) {
|
|
794
|
+
throw new EastError(`Failed to deploy ${packageRef} to workspace ${name}: ${err.message}`, {
|
|
795
|
+
location: { filename: 'e3_workspace_deploy', line: 0n, column: 0n },
|
|
796
|
+
cause: err,
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
}),
|
|
800
|
+
platform_workspace_export.implement(async (url, name) => {
|
|
801
|
+
try {
|
|
802
|
+
return await workspaceExport(url, name);
|
|
803
|
+
}
|
|
804
|
+
catch (err) {
|
|
805
|
+
throw new EastError(`Failed to export workspace ${name}: ${err.message}`, {
|
|
806
|
+
location: { filename: 'e3_workspace_export', line: 0n, column: 0n },
|
|
807
|
+
cause: err,
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
}),
|
|
811
|
+
// Datasets
|
|
812
|
+
platform_dataset_list.implement(async (url, workspace) => {
|
|
813
|
+
try {
|
|
814
|
+
return await datasetList(url, workspace);
|
|
815
|
+
}
|
|
816
|
+
catch (err) {
|
|
817
|
+
throw new EastError(`Failed to list datasets in ${workspace}: ${err.message}`, {
|
|
818
|
+
location: { filename: 'e3_dataset_list', line: 0n, column: 0n },
|
|
819
|
+
cause: err,
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
}),
|
|
823
|
+
platform_dataset_list_at.implement(async (url, workspace, path) => {
|
|
824
|
+
try {
|
|
825
|
+
return await datasetListAt(url, workspace, path);
|
|
826
|
+
}
|
|
827
|
+
catch (err) {
|
|
828
|
+
throw new EastError(`Failed to list datasets at path in ${workspace}: ${err.message}`, {
|
|
829
|
+
location: { filename: 'e3_dataset_list_at', line: 0n, column: 0n },
|
|
830
|
+
cause: err,
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
}),
|
|
834
|
+
platform_dataset_get.implement(async (url, workspace, path) => {
|
|
835
|
+
try {
|
|
836
|
+
return await datasetGet(url, workspace, path);
|
|
837
|
+
}
|
|
838
|
+
catch (err) {
|
|
839
|
+
throw new EastError(`Failed to get dataset in ${workspace}: ${err.message}`, {
|
|
840
|
+
location: { filename: 'e3_dataset_get', line: 0n, column: 0n },
|
|
841
|
+
cause: err,
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
}),
|
|
845
|
+
platform_dataset_set.implement(async (url, workspace, path, data) => {
|
|
846
|
+
try {
|
|
847
|
+
await datasetSet(url, workspace, path, data);
|
|
848
|
+
return null;
|
|
849
|
+
}
|
|
850
|
+
catch (err) {
|
|
851
|
+
throw new EastError(`Failed to set dataset in ${workspace}: ${err.message}`, {
|
|
852
|
+
location: { filename: 'e3_dataset_set', line: 0n, column: 0n },
|
|
853
|
+
cause: err,
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
}),
|
|
857
|
+
// Tasks
|
|
858
|
+
platform_task_list.implement(async (url, workspace) => {
|
|
859
|
+
try {
|
|
860
|
+
return await taskList(url, workspace);
|
|
861
|
+
}
|
|
862
|
+
catch (err) {
|
|
863
|
+
throw new EastError(`Failed to list tasks in ${workspace}: ${err.message}`, {
|
|
864
|
+
location: { filename: 'e3_task_list', line: 0n, column: 0n },
|
|
865
|
+
cause: err,
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
}),
|
|
869
|
+
platform_task_get.implement(async (url, workspace, name) => {
|
|
870
|
+
try {
|
|
871
|
+
return await taskGet(url, workspace, name);
|
|
872
|
+
}
|
|
873
|
+
catch (err) {
|
|
874
|
+
throw new EastError(`Failed to get task ${name} in ${workspace}: ${err.message}`, {
|
|
875
|
+
location: { filename: 'e3_task_get', line: 0n, column: 0n },
|
|
876
|
+
cause: err,
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
}),
|
|
880
|
+
// Executions
|
|
881
|
+
platform_dataflow_start.implement(async (url, workspace, options) => {
|
|
882
|
+
try {
|
|
883
|
+
await dataflowStart(url, workspace, {
|
|
884
|
+
concurrency: options.concurrency.value != null ? Number(options.concurrency.value) : undefined,
|
|
885
|
+
force: options.force,
|
|
886
|
+
filter: options.filter.value ?? undefined,
|
|
887
|
+
});
|
|
888
|
+
return null;
|
|
889
|
+
}
|
|
890
|
+
catch (err) {
|
|
891
|
+
throw new EastError(`Failed to start dataflow in ${workspace}: ${err.message}`, {
|
|
892
|
+
location: { filename: 'e3_dataflow_start', line: 0n, column: 0n },
|
|
893
|
+
cause: err,
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
}),
|
|
897
|
+
platform_dataflow_execute.implement(async (url, workspace, options) => {
|
|
898
|
+
try {
|
|
899
|
+
return await dataflowExecute(url, workspace, {
|
|
900
|
+
concurrency: options.concurrency.value != null ? Number(options.concurrency.value) : undefined,
|
|
901
|
+
force: options.force,
|
|
902
|
+
filter: options.filter.value ?? undefined,
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
catch (err) {
|
|
906
|
+
throw new EastError(`Failed to execute dataflow in ${workspace}: ${err.message}`, {
|
|
907
|
+
location: { filename: 'e3_dataflow_execute', line: 0n, column: 0n },
|
|
908
|
+
cause: err,
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
}),
|
|
912
|
+
platform_dataflow_graph.implement(async (url, workspace) => {
|
|
913
|
+
try {
|
|
914
|
+
return await dataflowGraph(url, workspace);
|
|
915
|
+
}
|
|
916
|
+
catch (err) {
|
|
917
|
+
throw new EastError(`Failed to get dataflow graph for ${workspace}: ${err.message}`, {
|
|
918
|
+
location: { filename: 'e3_dataflow_graph', line: 0n, column: 0n },
|
|
919
|
+
cause: err,
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
}),
|
|
923
|
+
platform_task_logs.implement(async (url, workspace, task, options) => {
|
|
924
|
+
try {
|
|
925
|
+
return await taskLogs(url, workspace, task, {
|
|
926
|
+
stream: options.stream,
|
|
927
|
+
offset: Number(options.offset),
|
|
928
|
+
limit: Number(options.limit),
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
catch (err) {
|
|
932
|
+
throw new EastError(`Failed to get logs for task ${task} in ${workspace}: ${err.message}`, {
|
|
933
|
+
location: { filename: 'e3_task_logs', line: 0n, column: 0n },
|
|
934
|
+
cause: err,
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
}),
|
|
938
|
+
];
|
|
939
|
+
// =============================================================================
|
|
940
|
+
// Grouped Export
|
|
941
|
+
// =============================================================================
|
|
942
|
+
/**
|
|
943
|
+
* Grouped e3 API platform functions.
|
|
944
|
+
*
|
|
945
|
+
* Provides e3 repository, package, workspace, dataset, task, and execution operations
|
|
946
|
+
* for East programs running on Node.js.
|
|
947
|
+
*
|
|
948
|
+
* @example
|
|
949
|
+
* ```ts
|
|
950
|
+
* import { East, StringType } from "@elaraai/east";
|
|
951
|
+
* import { Platform, RepositoryStatusType } from "@elaraai/e3-api-client";
|
|
952
|
+
*
|
|
953
|
+
* const getStatus = East.function([StringType], RepositoryStatusType, ($, url) => {
|
|
954
|
+
* return Platform.repoStatus(url);
|
|
955
|
+
* });
|
|
956
|
+
*
|
|
957
|
+
* const compiled = await East.compileAsync(getStatus.toIR(), Platform.Implementation);
|
|
958
|
+
* const status = await compiled("http://localhost:3000");
|
|
959
|
+
* console.log(status.objectCount);
|
|
960
|
+
* ```
|
|
961
|
+
*/
|
|
962
|
+
export const Platform = {
|
|
963
|
+
// Repository
|
|
964
|
+
/**
|
|
965
|
+
* Gets repository status information.
|
|
966
|
+
*
|
|
967
|
+
* Returns statistics about the e3 repository including object count, package count,
|
|
968
|
+
* and workspace count.
|
|
969
|
+
*
|
|
970
|
+
* @param url - Base URL of the e3 API server
|
|
971
|
+
* @returns Repository status
|
|
972
|
+
*
|
|
973
|
+
* @example
|
|
974
|
+
* ```ts
|
|
975
|
+
* const getStatus = East.function([StringType], RepositoryStatusType, ($, url) => {
|
|
976
|
+
* return Platform.repoStatus(url);
|
|
977
|
+
* });
|
|
978
|
+
*
|
|
979
|
+
* const compiled = await East.compileAsync(getStatus.toIR(), Platform.Implementation);
|
|
980
|
+
* await compiled("http://localhost:3000");
|
|
981
|
+
* ```
|
|
982
|
+
*/
|
|
983
|
+
repoStatus: platform_repo_status,
|
|
984
|
+
/**
|
|
985
|
+
* Runs garbage collection on the repository.
|
|
986
|
+
*
|
|
987
|
+
* Removes unreferenced objects from the object store to free disk space.
|
|
988
|
+
*
|
|
989
|
+
* @param url - Base URL of the e3 API server
|
|
990
|
+
* @param options - GC options
|
|
991
|
+
* @returns GC result with counts and freed bytes
|
|
992
|
+
*
|
|
993
|
+
* @example
|
|
994
|
+
* ```ts
|
|
995
|
+
* const runGc = East.function([StringType, GcRequestType], GcResultType, ($, url, options) => {
|
|
996
|
+
* return Platform.repoGc(url, options);
|
|
997
|
+
* });
|
|
998
|
+
*
|
|
999
|
+
* const compiled = await East.compileAsync(runGc.toIR(), Platform.Implementation);
|
|
1000
|
+
* await compiled("http://localhost:3000", { dryRun: true, minAge: { type: "none", value: null } });
|
|
1001
|
+
* ```
|
|
1002
|
+
*/
|
|
1003
|
+
repoGc: platform_repo_gc,
|
|
1004
|
+
// Packages
|
|
1005
|
+
/**
|
|
1006
|
+
* Lists all packages in the repository.
|
|
1007
|
+
*
|
|
1008
|
+
* @param url - Base URL of the e3 API server
|
|
1009
|
+
* @returns Array of package info
|
|
1010
|
+
*/
|
|
1011
|
+
packageList: platform_package_list,
|
|
1012
|
+
/**
|
|
1013
|
+
* Gets a package object by name and version.
|
|
1014
|
+
*
|
|
1015
|
+
* @param url - Base URL of the e3 API server
|
|
1016
|
+
* @param name - Package name
|
|
1017
|
+
* @param version - Package version
|
|
1018
|
+
* @returns Package object
|
|
1019
|
+
*/
|
|
1020
|
+
packageGet: platform_package_get,
|
|
1021
|
+
/**
|
|
1022
|
+
* Imports a package from a zip archive.
|
|
1023
|
+
*
|
|
1024
|
+
* @param url - Base URL of the e3 API server
|
|
1025
|
+
* @param archive - Zip archive as bytes
|
|
1026
|
+
* @returns Import result
|
|
1027
|
+
*/
|
|
1028
|
+
packageImport: platform_package_import,
|
|
1029
|
+
/**
|
|
1030
|
+
* Exports a package as a zip archive.
|
|
1031
|
+
*
|
|
1032
|
+
* @param url - Base URL of the e3 API server
|
|
1033
|
+
* @param name - Package name
|
|
1034
|
+
* @param version - Package version
|
|
1035
|
+
* @returns Zip archive as bytes
|
|
1036
|
+
*/
|
|
1037
|
+
packageExport: platform_package_export,
|
|
1038
|
+
/**
|
|
1039
|
+
* Removes a package from the repository.
|
|
1040
|
+
*
|
|
1041
|
+
* @param url - Base URL of the e3 API server
|
|
1042
|
+
* @param name - Package name
|
|
1043
|
+
* @param version - Package version
|
|
1044
|
+
* @returns null on success
|
|
1045
|
+
*/
|
|
1046
|
+
packageRemove: platform_package_remove,
|
|
1047
|
+
// Workspaces
|
|
1048
|
+
/**
|
|
1049
|
+
* Lists all workspaces in the repository.
|
|
1050
|
+
*
|
|
1051
|
+
* @param url - Base URL of the e3 API server
|
|
1052
|
+
* @returns Array of workspace info
|
|
1053
|
+
*/
|
|
1054
|
+
workspaceList: platform_workspace_list,
|
|
1055
|
+
/**
|
|
1056
|
+
* Creates a new empty workspace.
|
|
1057
|
+
*
|
|
1058
|
+
* @param url - Base URL of the e3 API server
|
|
1059
|
+
* @param name - Workspace name
|
|
1060
|
+
* @returns Created workspace info
|
|
1061
|
+
*/
|
|
1062
|
+
workspaceCreate: platform_workspace_create,
|
|
1063
|
+
/**
|
|
1064
|
+
* Gets workspace state including deployed package info.
|
|
1065
|
+
*
|
|
1066
|
+
* @param url - Base URL of the e3 API server
|
|
1067
|
+
* @param name - Workspace name
|
|
1068
|
+
* @returns Workspace state
|
|
1069
|
+
*/
|
|
1070
|
+
workspaceGet: platform_workspace_get,
|
|
1071
|
+
/**
|
|
1072
|
+
* Gets comprehensive workspace status.
|
|
1073
|
+
*
|
|
1074
|
+
* @param url - Base URL of the e3 API server
|
|
1075
|
+
* @param name - Workspace name
|
|
1076
|
+
* @returns Workspace status with datasets, tasks, and summary
|
|
1077
|
+
*/
|
|
1078
|
+
workspaceStatus: platform_workspace_status,
|
|
1079
|
+
/**
|
|
1080
|
+
* Removes a workspace.
|
|
1081
|
+
*
|
|
1082
|
+
* @param url - Base URL of the e3 API server
|
|
1083
|
+
* @param name - Workspace name
|
|
1084
|
+
* @returns null on success
|
|
1085
|
+
*/
|
|
1086
|
+
workspaceRemove: platform_workspace_remove,
|
|
1087
|
+
/**
|
|
1088
|
+
* Deploys a package to a workspace.
|
|
1089
|
+
*
|
|
1090
|
+
* @param url - Base URL of the e3 API server
|
|
1091
|
+
* @param name - Workspace name
|
|
1092
|
+
* @param packageRef - Package reference
|
|
1093
|
+
* @returns null on success
|
|
1094
|
+
*/
|
|
1095
|
+
workspaceDeploy: platform_workspace_deploy,
|
|
1096
|
+
/**
|
|
1097
|
+
* Exports workspace as a package zip archive.
|
|
1098
|
+
*
|
|
1099
|
+
* @param url - Base URL of the e3 API server
|
|
1100
|
+
* @param name - Workspace name
|
|
1101
|
+
* @returns Zip archive as bytes
|
|
1102
|
+
*/
|
|
1103
|
+
workspaceExport: platform_workspace_export,
|
|
1104
|
+
// Datasets
|
|
1105
|
+
/**
|
|
1106
|
+
* Lists field names at root of workspace dataset tree.
|
|
1107
|
+
*
|
|
1108
|
+
* @param url - Base URL of the e3 API server
|
|
1109
|
+
* @param workspace - Workspace name
|
|
1110
|
+
* @returns Array of field names
|
|
1111
|
+
*/
|
|
1112
|
+
datasetList: platform_dataset_list,
|
|
1113
|
+
/**
|
|
1114
|
+
* Lists field names at a path in workspace dataset tree.
|
|
1115
|
+
*
|
|
1116
|
+
* @param url - Base URL of the e3 API server
|
|
1117
|
+
* @param workspace - Workspace name
|
|
1118
|
+
* @param path - Path to the dataset
|
|
1119
|
+
* @returns Array of field names
|
|
1120
|
+
*/
|
|
1121
|
+
datasetListAt: platform_dataset_list_at,
|
|
1122
|
+
/**
|
|
1123
|
+
* Gets a dataset value as raw BEAST2 bytes.
|
|
1124
|
+
*
|
|
1125
|
+
* @param url - Base URL of the e3 API server
|
|
1126
|
+
* @param workspace - Workspace name
|
|
1127
|
+
* @param path - Path to the dataset
|
|
1128
|
+
* @returns Raw BEAST2 bytes
|
|
1129
|
+
*/
|
|
1130
|
+
datasetGet: platform_dataset_get,
|
|
1131
|
+
/**
|
|
1132
|
+
* Sets a dataset value from raw BEAST2 bytes.
|
|
1133
|
+
*
|
|
1134
|
+
* @param url - Base URL of the e3 API server
|
|
1135
|
+
* @param workspace - Workspace name
|
|
1136
|
+
* @param path - Path to the dataset
|
|
1137
|
+
* @param data - Raw BEAST2 encoded value
|
|
1138
|
+
* @returns null on success
|
|
1139
|
+
*/
|
|
1140
|
+
datasetSet: platform_dataset_set,
|
|
1141
|
+
// Tasks
|
|
1142
|
+
/**
|
|
1143
|
+
* Lists tasks in a workspace.
|
|
1144
|
+
*
|
|
1145
|
+
* @param url - Base URL of the e3 API server
|
|
1146
|
+
* @param workspace - Workspace name
|
|
1147
|
+
* @returns Array of task info
|
|
1148
|
+
*/
|
|
1149
|
+
taskList: platform_task_list,
|
|
1150
|
+
/**
|
|
1151
|
+
* Gets task details.
|
|
1152
|
+
*
|
|
1153
|
+
* @param url - Base URL of the e3 API server
|
|
1154
|
+
* @param workspace - Workspace name
|
|
1155
|
+
* @param name - Task name
|
|
1156
|
+
* @returns Task details
|
|
1157
|
+
*/
|
|
1158
|
+
taskGet: platform_task_get,
|
|
1159
|
+
// Executions
|
|
1160
|
+
/**
|
|
1161
|
+
* Starts dataflow execution (non-blocking).
|
|
1162
|
+
*
|
|
1163
|
+
* @param url - Base URL of the e3 API server
|
|
1164
|
+
* @param workspace - Workspace name
|
|
1165
|
+
* @param options - Execution options
|
|
1166
|
+
* @returns null on success
|
|
1167
|
+
*/
|
|
1168
|
+
dataflowStart: platform_dataflow_start,
|
|
1169
|
+
/**
|
|
1170
|
+
* Executes dataflow (blocking).
|
|
1171
|
+
*
|
|
1172
|
+
* @param url - Base URL of the e3 API server
|
|
1173
|
+
* @param workspace - Workspace name
|
|
1174
|
+
* @param options - Execution options
|
|
1175
|
+
* @returns Dataflow execution result
|
|
1176
|
+
*/
|
|
1177
|
+
dataflowExecute: platform_dataflow_execute,
|
|
1178
|
+
/**
|
|
1179
|
+
* Gets the dependency graph for a workspace.
|
|
1180
|
+
*
|
|
1181
|
+
* @param url - Base URL of the e3 API server
|
|
1182
|
+
* @param workspace - Workspace name
|
|
1183
|
+
* @returns Dataflow graph
|
|
1184
|
+
*/
|
|
1185
|
+
dataflowGraph: platform_dataflow_graph,
|
|
1186
|
+
/**
|
|
1187
|
+
* Reads task logs from a workspace.
|
|
1188
|
+
*
|
|
1189
|
+
* @param url - Base URL of the e3 API server
|
|
1190
|
+
* @param workspace - Workspace name
|
|
1191
|
+
* @param task - Task name
|
|
1192
|
+
* @param options - Log options
|
|
1193
|
+
* @returns Log chunk
|
|
1194
|
+
*/
|
|
1195
|
+
taskLogs: platform_task_logs,
|
|
1196
|
+
/**
|
|
1197
|
+
* Node.js implementation of e3 API platform functions.
|
|
1198
|
+
*
|
|
1199
|
+
* Pass this to {@link East.compileAsync} to enable e3 API operations.
|
|
1200
|
+
*/
|
|
1201
|
+
Implementation: PlatformImpl,
|
|
1202
|
+
/**
|
|
1203
|
+
* Type definitions for platform operations.
|
|
1204
|
+
*/
|
|
1205
|
+
Types: {
|
|
1206
|
+
RepositoryStatus: RepositoryStatusType,
|
|
1207
|
+
GcRequest: GcRequestType,
|
|
1208
|
+
GcResult: GcResultType,
|
|
1209
|
+
PackageListItem: PackageListItemType,
|
|
1210
|
+
PackageImportResult: PackageImportResultType,
|
|
1211
|
+
WorkspaceInfo: WorkspaceInfoType,
|
|
1212
|
+
WorkspaceStatusResult: WorkspaceStatusResultType,
|
|
1213
|
+
TaskListItem: TaskListItemType,
|
|
1214
|
+
TaskDetails: TaskDetailsType,
|
|
1215
|
+
DataflowRequest: DataflowRequestType,
|
|
1216
|
+
DataflowGraph: DataflowGraphType,
|
|
1217
|
+
DataflowResult: DataflowResultType,
|
|
1218
|
+
LogChunk: LogChunkType,
|
|
1219
|
+
LogOptions: LogOptionsType,
|
|
1220
|
+
},
|
|
1221
|
+
};
|
|
1222
|
+
// Export for backwards compatibility
|
|
1223
|
+
export { PlatformImpl };
|
|
1224
|
+
//# sourceMappingURL=platform.js.map
|