@elaraai/e3-api-client 1.0.84 → 1.0.86

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 (65) hide show
  1. package/README.md +25 -3
  2. package/dist/src/datasets-transfer.spec.js +40 -5
  3. package/dist/src/datasets-transfer.spec.js.map +1 -1
  4. package/dist/src/datasets.d.ts +83 -1
  5. package/dist/src/datasets.d.ts.map +1 -1
  6. package/dist/src/datasets.js +213 -37
  7. package/dist/src/datasets.js.map +1 -1
  8. package/dist/src/datasets.spec.js +273 -13
  9. package/dist/src/datasets.spec.js.map +1 -1
  10. package/dist/src/executions.d.ts +50 -15
  11. package/dist/src/executions.d.ts.map +1 -1
  12. package/dist/src/executions.js +57 -16
  13. package/dist/src/executions.js.map +1 -1
  14. package/dist/src/executions.spec.d.ts +6 -0
  15. package/dist/src/executions.spec.d.ts.map +1 -0
  16. package/dist/src/executions.spec.js +81 -0
  17. package/dist/src/executions.spec.js.map +1 -0
  18. package/dist/src/functions.d.ts +39 -8
  19. package/dist/src/functions.d.ts.map +1 -1
  20. package/dist/src/functions.js +39 -8
  21. package/dist/src/functions.js.map +1 -1
  22. package/dist/src/http.d.ts +65 -7
  23. package/dist/src/http.d.ts.map +1 -1
  24. package/dist/src/http.js +54 -14
  25. package/dist/src/http.js.map +1 -1
  26. package/dist/src/http.spec.js +106 -5
  27. package/dist/src/http.spec.js.map +1 -1
  28. package/dist/src/index.d.ts +7 -7
  29. package/dist/src/index.d.ts.map +1 -1
  30. package/dist/src/index.js +5 -5
  31. package/dist/src/index.js.map +1 -1
  32. package/dist/src/packages.d.ts.map +1 -1
  33. package/dist/src/packages.js +3 -3
  34. package/dist/src/packages.js.map +1 -1
  35. package/dist/src/packages.spec.d.ts +6 -0
  36. package/dist/src/packages.spec.d.ts.map +1 -0
  37. package/dist/src/packages.spec.js +118 -0
  38. package/dist/src/packages.spec.js.map +1 -0
  39. package/dist/src/platform.d.ts +103 -9
  40. package/dist/src/platform.d.ts.map +1 -1
  41. package/dist/src/platform.js +335 -315
  42. package/dist/src/platform.js.map +1 -1
  43. package/dist/src/platform.spec.d.ts +6 -0
  44. package/dist/src/platform.spec.d.ts.map +1 -0
  45. package/dist/src/platform.spec.js +85 -0
  46. package/dist/src/platform.spec.js.map +1 -0
  47. package/dist/src/records.spec.js +15 -5
  48. package/dist/src/records.spec.js.map +1 -1
  49. package/dist/src/repository.d.ts +8 -1
  50. package/dist/src/repository.d.ts.map +1 -1
  51. package/dist/src/repository.js +8 -1
  52. package/dist/src/repository.js.map +1 -1
  53. package/dist/src/tasks.d.ts +11 -7
  54. package/dist/src/tasks.d.ts.map +1 -1
  55. package/dist/src/tasks.js +16 -8
  56. package/dist/src/tasks.js.map +1 -1
  57. package/dist/src/types.d.ts +63 -5
  58. package/dist/src/types.d.ts.map +1 -1
  59. package/dist/src/types.js +7 -5
  60. package/dist/src/types.js.map +1 -1
  61. package/dist/src/workspaces.d.ts +16 -2
  62. package/dist/src/workspaces.d.ts.map +1 -1
  63. package/dist/src/workspaces.js +11 -4
  64. package/dist/src/workspaces.js.map +1 -1
  65. package/package.json +4 -4
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { East, StringType, IntegerType, BlobType, NullType, ArrayType, StructType, } from '@elaraai/east';
6
6
  import { EastError } from '@elaraai/east/internal';
7
- import { TreePathType, WorkspaceStateType, PackageObjectType } from '@elaraai/e3-types';
7
+ import { CallArgType, TreePathType, WorkspaceStateType, PackageObjectType, dataflowForceOption } from '@elaraai/e3-types';
8
8
  import { RepositoryStatusType, GcRequestType, GcResultType, FunctionCallRequestType, ExecuteResultType, OneShotRequestType, PackageListItemType, PackageImportResultType, WorkspaceInfoType, WorkspaceStatusResultType, TaskListItemType, TaskDetailsType, DataflowRequestType, DataflowGraphType, DataflowResultType, LogChunkType, } from './types.js';
9
9
  import { repoStatus, repoGc, } from './repository.js';
10
10
  import { packageList, packageGet, packageImport, packageExport, packageRemove, } from './packages.js';
@@ -88,7 +88,9 @@ LogChunkType);
88
88
  // Function / One-shot Platform Functions
89
89
  // =============================================================================
90
90
  /** Call a named function of a workspace's deployed package, run to
91
- * completion, returning the inline ExecuteResult. */
91
+ * completion, returning the inline ExecuteResult. An argument is a value, or
92
+ * a dataset of the workspace (`CallArg`'s `dataset`), pinned by its hash at
93
+ * launch and named in the result's `inputs`. */
92
94
  export const platform_function_call = East.asyncPlatform('e3_function_call', [StringType, StringType, StringType, StringType, FunctionCallRequestType, StringType], // url, repo, workspace, fn, request, token
93
95
  ExecuteResultType);
94
96
  /** Run an anonymous one-shot IR against a workspace: a platform-free one for
@@ -96,319 +98,335 @@ ExecuteResultType);
96
98
  * gives (see `oneShotExecute`). */
97
99
  export const platform_one_shot_execute = East.asyncPlatform('e3_one_shot_execute', [StringType, StringType, StringType, OneShotRequestType, StringType], // url, repo, workspace, request, token
98
100
  ExecuteResultType);
99
- // =============================================================================
100
- // Platform Implementation
101
- // =============================================================================
102
- const PlatformImpl = [
103
- // Repository
104
- platform_repo_status.implement(async (url, repo, token) => {
105
- try {
106
- return await repoStatus(url, repo, { token });
107
- }
108
- catch (err) {
109
- throw new EastError(`Failed to get repository status: ${err.message}`, {
110
- location: [{ filename: 'e3_repo_status', line: 0n, column: 0n }],
111
- cause: err,
112
- });
113
- }
114
- }),
115
- platform_repo_gc.implement(async (url, repo, options, token) => {
116
- try {
117
- return await repoGc(url, repo, options, { token });
118
- }
119
- catch (err) {
120
- throw new EastError(`Failed to run garbage collection: ${err.message}`, {
121
- location: [{ filename: 'e3_repo_gc', line: 0n, column: 0n }],
122
- cause: err,
123
- });
124
- }
125
- }),
126
- // Packages
127
- platform_package_list.implement(async (url, repo, token) => {
128
- try {
129
- return await packageList(url, repo, { token });
130
- }
131
- catch (err) {
132
- throw new EastError(`Failed to list packages: ${err.message}`, {
133
- location: [{ filename: 'e3_package_list', line: 0n, column: 0n }],
134
- cause: err,
135
- });
136
- }
137
- }),
138
- platform_package_get.implement(async (url, repo, name, version, token) => {
139
- try {
140
- return await packageGet(url, repo, name, version, { token });
141
- }
142
- catch (err) {
143
- throw new EastError(`Failed to get package ${name}@${version}: ${err.message}`, {
144
- location: [{ filename: 'e3_package_get', line: 0n, column: 0n }],
145
- cause: err,
146
- });
147
- }
148
- }),
149
- platform_package_import.implement(async (url, repo, archive, token) => {
150
- try {
151
- return await packageImport(url, repo, archive, { token });
152
- }
153
- catch (err) {
154
- throw new EastError(`Failed to import package: ${err.message}`, {
155
- location: [{ filename: 'e3_package_import', line: 0n, column: 0n }],
156
- cause: err,
157
- });
158
- }
159
- }),
160
- platform_package_export.implement(async (url, repo, name, version, token) => {
161
- try {
162
- return await packageExport(url, repo, name, version, { token });
163
- }
164
- catch (err) {
165
- throw new EastError(`Failed to export package ${name}@${version}: ${err.message}`, {
166
- location: [{ filename: 'e3_package_export', line: 0n, column: 0n }],
167
- cause: err,
168
- });
169
- }
170
- }),
171
- platform_package_remove.implement(async (url, repo, name, version, token) => {
172
- try {
173
- await packageRemove(url, repo, name, version, { token });
174
- return null;
175
- }
176
- catch (err) {
177
- throw new EastError(`Failed to remove package ${name}@${version}: ${err.message}`, {
178
- location: [{ filename: 'e3_package_remove', line: 0n, column: 0n }],
179
- cause: err,
180
- });
181
- }
182
- }),
183
- // Workspaces
184
- platform_workspace_list.implement(async (url, repo, token) => {
185
- try {
186
- return await workspaceList(url, repo, { token });
187
- }
188
- catch (err) {
189
- throw new EastError(`Failed to list workspaces: ${err.message}`, {
190
- location: [{ filename: 'e3_workspace_list', line: 0n, column: 0n }],
191
- cause: err,
192
- });
193
- }
194
- }),
195
- platform_workspace_create.implement(async (url, repo, name, token) => {
196
- try {
197
- return await workspaceCreate(url, repo, name, { token });
198
- }
199
- catch (err) {
200
- throw new EastError(`Failed to create workspace ${name}: ${err.message}`, {
201
- location: [{ filename: 'e3_workspace_create', line: 0n, column: 0n }],
202
- cause: err,
203
- });
204
- }
205
- }),
206
- platform_workspace_get.implement(async (url, repo, name, token) => {
207
- try {
208
- return await workspaceGet(url, repo, name, { token });
209
- }
210
- catch (err) {
211
- throw new EastError(`Failed to get workspace ${name}: ${err.message}`, {
212
- location: [{ filename: 'e3_workspace_get', line: 0n, column: 0n }],
213
- cause: err,
214
- });
215
- }
216
- }),
217
- platform_workspace_status.implement(async (url, repo, name, token) => {
218
- try {
219
- return await workspaceStatus(url, repo, name, { token });
220
- }
221
- catch (err) {
222
- throw new EastError(`Failed to get workspace status ${name}: ${err.message}`, {
223
- location: [{ filename: 'e3_workspace_status', line: 0n, column: 0n }],
224
- cause: err,
225
- });
226
- }
227
- }),
228
- platform_workspace_remove.implement(async (url, repo, name, token) => {
229
- try {
230
- await workspaceRemove(url, repo, name, { token });
231
- return null;
232
- }
233
- catch (err) {
234
- throw new EastError(`Failed to remove workspace ${name}: ${err.message}`, {
235
- location: [{ filename: 'e3_workspace_remove', line: 0n, column: 0n }],
236
- cause: err,
237
- });
238
- }
239
- }),
240
- platform_workspace_deploy.implement(async (url, repo, name, packageRef, token) => {
241
- try {
242
- await workspaceDeploy(url, repo, name, packageRef, { token });
243
- return null;
244
- }
245
- catch (err) {
246
- throw new EastError(`Failed to deploy ${packageRef} to workspace ${name}: ${err.message}`, {
247
- location: [{ filename: 'e3_workspace_deploy', line: 0n, column: 0n }],
248
- cause: err,
249
- });
250
- }
251
- }),
252
- platform_workspace_export.implement(async (url, repo, name, token) => {
253
- try {
254
- return await workspaceExport(url, repo, name, { token });
255
- }
256
- catch (err) {
257
- throw new EastError(`Failed to export workspace ${name}: ${err.message}`, {
258
- location: [{ filename: 'e3_workspace_export', line: 0n, column: 0n }],
259
- cause: err,
260
- });
261
- }
262
- }),
263
- // Datasets
264
- platform_dataset_list.implement(async (url, repo, workspace, token) => {
265
- try {
266
- return await datasetList(url, repo, workspace, { token });
267
- }
268
- catch (err) {
269
- throw new EastError(`Failed to list datasets in ${workspace}: ${err.message}`, {
270
- location: [{ filename: 'e3_dataset_list', line: 0n, column: 0n }],
271
- cause: err,
272
- });
273
- }
274
- }),
275
- platform_dataset_list_at.implement(async (url, repo, workspace, path, token) => {
276
- try {
277
- return await datasetListAt(url, repo, workspace, path, { token });
278
- }
279
- catch (err) {
280
- throw new EastError(`Failed to list datasets at path in ${workspace}: ${err.message}`, {
281
- location: [{ filename: 'e3_dataset_list_at', line: 0n, column: 0n }],
282
- cause: err,
283
- });
284
- }
285
- }),
286
- platform_dataset_get.implement(async (url, repo, workspace, path, token) => {
287
- try {
288
- return (await datasetGet(url, repo, workspace, path, { token })).data;
289
- }
290
- catch (err) {
291
- throw new EastError(`Failed to get dataset in ${workspace}: ${err.message}`, {
292
- location: [{ filename: 'e3_dataset_get', line: 0n, column: 0n }],
293
- cause: err,
294
- });
295
- }
296
- }),
297
- platform_dataset_set.implement(async (url, repo, workspace, path, data, token) => {
298
- try {
299
- await datasetSet(url, repo, workspace, path, data, { token });
300
- return null;
301
- }
302
- catch (err) {
303
- throw new EastError(`Failed to set dataset in ${workspace}: ${err.message}`, {
304
- location: [{ filename: 'e3_dataset_set', line: 0n, column: 0n }],
305
- cause: err,
306
- });
307
- }
308
- }),
309
- // Tasks
310
- platform_task_list.implement(async (url, repo, workspace, token) => {
311
- try {
312
- return await taskList(url, repo, workspace, { token });
313
- }
314
- catch (err) {
315
- throw new EastError(`Failed to list tasks in ${workspace}: ${err.message}`, {
316
- location: [{ filename: 'e3_task_list', line: 0n, column: 0n }],
317
- cause: err,
318
- });
319
- }
320
- }),
321
- platform_task_get.implement(async (url, repo, workspace, name, token) => {
322
- try {
323
- return await taskGet(url, repo, workspace, name, { token });
324
- }
325
- catch (err) {
326
- throw new EastError(`Failed to get task ${name} in ${workspace}: ${err.message}`, {
327
- location: [{ filename: 'e3_task_get', line: 0n, column: 0n }],
328
- cause: err,
329
- });
330
- }
331
- }),
332
- // Executions
333
- platform_dataflow_start.implement(async (url, repo, workspace, options, token) => {
334
- try {
335
- await dataflowExecuteLaunch(url, repo, workspace, {
336
- force: options.force,
337
- filter: options.filter.value ?? undefined,
338
- }, { token });
339
- return null;
340
- }
341
- catch (err) {
342
- throw new EastError(`Failed to start dataflow in ${workspace}: ${err.message}`, {
343
- location: [{ filename: 'e3_dataflow_start', line: 0n, column: 0n }],
344
- cause: err,
345
- });
346
- }
347
- }),
348
- platform_dataflow_execute.implement(async (url, repo, workspace, options, token) => {
349
- try {
350
- return await dataflowExecute(url, repo, workspace, {
351
- force: options.force,
352
- filter: options.filter.value ?? undefined,
353
- }, { token });
354
- }
355
- catch (err) {
356
- throw new EastError(`Failed to execute dataflow in ${workspace}: ${err.message}`, {
357
- location: [{ filename: 'e3_dataflow_execute', line: 0n, column: 0n }],
358
- cause: err,
359
- });
360
- }
361
- }),
362
- platform_dataflow_graph.implement(async (url, repo, workspace, token) => {
363
- try {
364
- return await dataflowGraph(url, repo, workspace, { token });
365
- }
366
- catch (err) {
367
- throw new EastError(`Failed to get dataflow graph for ${workspace}: ${err.message}`, {
368
- location: [{ filename: 'e3_dataflow_graph', line: 0n, column: 0n }],
369
- cause: err,
370
- });
371
- }
372
- }),
373
- platform_task_logs.implement(async (url, repo, workspace, task, options, token) => {
374
- try {
375
- return await taskLogs(url, repo, workspace, task, {
376
- stream: options.stream,
377
- offset: Number(options.offset),
378
- limit: Number(options.limit),
379
- }, { token });
380
- }
381
- catch (err) {
382
- throw new EastError(`Failed to get logs for task ${task} in ${workspace}: ${err.message}`, {
383
- location: [{ filename: 'e3_task_logs', line: 0n, column: 0n }],
384
- cause: err,
385
- });
386
- }
387
- }),
388
- // Functions / one-shot
389
- platform_function_call.implement(async (url, repo, workspace, fn, request, token) => {
390
- try {
391
- return await workspaceFunctionCall(url, repo, workspace, fn, request, { token });
392
- }
393
- catch (err) {
394
- throw new EastError(`Failed to call function ${fn} in ${workspace}: ${err.message}`, {
395
- location: [{ filename: 'e3_function_call', line: 0n, column: 0n }],
396
- cause: err,
397
- });
398
- }
399
- }),
400
- platform_one_shot_execute.implement(async (url, repo, workspace, request, token) => {
401
- try {
402
- return await oneShotExecute(url, repo, workspace, request, { token });
403
- }
404
- catch (err) {
405
- throw new EastError(`Failed to execute one-shot in ${workspace}: ${err.message}`, {
406
- location: [{ filename: 'e3_one_shot_execute', line: 0n, column: 0n }],
407
- cause: err,
408
- });
409
- }
410
- }),
411
- ];
101
+ /**
102
+ * The implementations of e3's platform functions, over a given `fetch`.
103
+ *
104
+ * @remarks
105
+ * `Platform.Implementation` is this over the global `fetch`. A host that
106
+ * answers e3's API itself — e3 running in a page — gives its own, so an East
107
+ * program that calls these functions reaches that e3.
108
+ *
109
+ * @param options - The `fetch` the functions' requests go through
110
+ * @returns The platform functions, to compile an East program with
111
+ */
112
+ export function platformImplementation(options = {}) {
113
+ const { fetch } = options;
114
+ const requestOptions = (token) => (fetch === undefined ? { token } : { token, fetch });
115
+ return [
116
+ // Repository
117
+ platform_repo_status.implement(async (url, repo, token) => {
118
+ try {
119
+ return await repoStatus(url, repo, requestOptions(token));
120
+ }
121
+ catch (err) {
122
+ throw new EastError(`Failed to get repository status: ${err.message}`, {
123
+ location: [{ filename: 'e3_repo_status', line: 0n, column: 0n }],
124
+ cause: err,
125
+ });
126
+ }
127
+ }),
128
+ platform_repo_gc.implement(async (url, repo, options, token) => {
129
+ try {
130
+ return await repoGc(url, repo, options, requestOptions(token));
131
+ }
132
+ catch (err) {
133
+ throw new EastError(`Failed to run garbage collection: ${err.message}`, {
134
+ location: [{ filename: 'e3_repo_gc', line: 0n, column: 0n }],
135
+ cause: err,
136
+ });
137
+ }
138
+ }),
139
+ // Packages
140
+ platform_package_list.implement(async (url, repo, token) => {
141
+ try {
142
+ return await packageList(url, repo, requestOptions(token));
143
+ }
144
+ catch (err) {
145
+ throw new EastError(`Failed to list packages: ${err.message}`, {
146
+ location: [{ filename: 'e3_package_list', line: 0n, column: 0n }],
147
+ cause: err,
148
+ });
149
+ }
150
+ }),
151
+ platform_package_get.implement(async (url, repo, name, version, token) => {
152
+ try {
153
+ return await packageGet(url, repo, name, version, requestOptions(token));
154
+ }
155
+ catch (err) {
156
+ throw new EastError(`Failed to get package ${name}@${version}: ${err.message}`, {
157
+ location: [{ filename: 'e3_package_get', line: 0n, column: 0n }],
158
+ cause: err,
159
+ });
160
+ }
161
+ }),
162
+ platform_package_import.implement(async (url, repo, archive, token) => {
163
+ try {
164
+ return await packageImport(url, repo, archive, requestOptions(token));
165
+ }
166
+ catch (err) {
167
+ throw new EastError(`Failed to import package: ${err.message}`, {
168
+ location: [{ filename: 'e3_package_import', line: 0n, column: 0n }],
169
+ cause: err,
170
+ });
171
+ }
172
+ }),
173
+ platform_package_export.implement(async (url, repo, name, version, token) => {
174
+ try {
175
+ return await packageExport(url, repo, name, version, requestOptions(token));
176
+ }
177
+ catch (err) {
178
+ throw new EastError(`Failed to export package ${name}@${version}: ${err.message}`, {
179
+ location: [{ filename: 'e3_package_export', line: 0n, column: 0n }],
180
+ cause: err,
181
+ });
182
+ }
183
+ }),
184
+ platform_package_remove.implement(async (url, repo, name, version, token) => {
185
+ try {
186
+ await packageRemove(url, repo, name, version, requestOptions(token));
187
+ return null;
188
+ }
189
+ catch (err) {
190
+ throw new EastError(`Failed to remove package ${name}@${version}: ${err.message}`, {
191
+ location: [{ filename: 'e3_package_remove', line: 0n, column: 0n }],
192
+ cause: err,
193
+ });
194
+ }
195
+ }),
196
+ // Workspaces
197
+ platform_workspace_list.implement(async (url, repo, token) => {
198
+ try {
199
+ return await workspaceList(url, repo, requestOptions(token));
200
+ }
201
+ catch (err) {
202
+ throw new EastError(`Failed to list workspaces: ${err.message}`, {
203
+ location: [{ filename: 'e3_workspace_list', line: 0n, column: 0n }],
204
+ cause: err,
205
+ });
206
+ }
207
+ }),
208
+ platform_workspace_create.implement(async (url, repo, name, token) => {
209
+ try {
210
+ return await workspaceCreate(url, repo, name, requestOptions(token));
211
+ }
212
+ catch (err) {
213
+ throw new EastError(`Failed to create workspace ${name}: ${err.message}`, {
214
+ location: [{ filename: 'e3_workspace_create', line: 0n, column: 0n }],
215
+ cause: err,
216
+ });
217
+ }
218
+ }),
219
+ platform_workspace_get.implement(async (url, repo, name, token) => {
220
+ try {
221
+ return await workspaceGet(url, repo, name, requestOptions(token));
222
+ }
223
+ catch (err) {
224
+ throw new EastError(`Failed to get workspace ${name}: ${err.message}`, {
225
+ location: [{ filename: 'e3_workspace_get', line: 0n, column: 0n }],
226
+ cause: err,
227
+ });
228
+ }
229
+ }),
230
+ platform_workspace_status.implement(async (url, repo, name, token) => {
231
+ try {
232
+ return await workspaceStatus(url, repo, name, requestOptions(token));
233
+ }
234
+ catch (err) {
235
+ throw new EastError(`Failed to get workspace status ${name}: ${err.message}`, {
236
+ location: [{ filename: 'e3_workspace_status', line: 0n, column: 0n }],
237
+ cause: err,
238
+ });
239
+ }
240
+ }),
241
+ platform_workspace_remove.implement(async (url, repo, name, token) => {
242
+ try {
243
+ await workspaceRemove(url, repo, name, requestOptions(token));
244
+ return null;
245
+ }
246
+ catch (err) {
247
+ throw new EastError(`Failed to remove workspace ${name}: ${err.message}`, {
248
+ location: [{ filename: 'e3_workspace_remove', line: 0n, column: 0n }],
249
+ cause: err,
250
+ });
251
+ }
252
+ }),
253
+ platform_workspace_deploy.implement(async (url, repo, name, packageRef, token) => {
254
+ try {
255
+ await workspaceDeploy(url, repo, name, packageRef, requestOptions(token));
256
+ return null;
257
+ }
258
+ catch (err) {
259
+ throw new EastError(`Failed to deploy ${packageRef} to workspace ${name}: ${err.message}`, {
260
+ location: [{ filename: 'e3_workspace_deploy', line: 0n, column: 0n }],
261
+ cause: err,
262
+ });
263
+ }
264
+ }),
265
+ platform_workspace_export.implement(async (url, repo, name, token) => {
266
+ try {
267
+ return await workspaceExport(url, repo, name, requestOptions(token));
268
+ }
269
+ catch (err) {
270
+ throw new EastError(`Failed to export workspace ${name}: ${err.message}`, {
271
+ location: [{ filename: 'e3_workspace_export', line: 0n, column: 0n }],
272
+ cause: err,
273
+ });
274
+ }
275
+ }),
276
+ // Datasets
277
+ platform_dataset_list.implement(async (url, repo, workspace, token) => {
278
+ try {
279
+ return await datasetList(url, repo, workspace, requestOptions(token));
280
+ }
281
+ catch (err) {
282
+ throw new EastError(`Failed to list datasets in ${workspace}: ${err.message}`, {
283
+ location: [{ filename: 'e3_dataset_list', line: 0n, column: 0n }],
284
+ cause: err,
285
+ });
286
+ }
287
+ }),
288
+ platform_dataset_list_at.implement(async (url, repo, workspace, path, token) => {
289
+ try {
290
+ return await datasetListAt(url, repo, workspace, path, requestOptions(token));
291
+ }
292
+ catch (err) {
293
+ throw new EastError(`Failed to list datasets at path in ${workspace}: ${err.message}`, {
294
+ location: [{ filename: 'e3_dataset_list_at', line: 0n, column: 0n }],
295
+ cause: err,
296
+ });
297
+ }
298
+ }),
299
+ platform_dataset_get.implement(async (url, repo, workspace, path, token) => {
300
+ try {
301
+ return (await datasetGet(url, repo, workspace, path, requestOptions(token))).data;
302
+ }
303
+ catch (err) {
304
+ throw new EastError(`Failed to get dataset in ${workspace}: ${err.message}`, {
305
+ location: [{ filename: 'e3_dataset_get', line: 0n, column: 0n }],
306
+ cause: err,
307
+ });
308
+ }
309
+ }),
310
+ platform_dataset_set.implement(async (url, repo, workspace, path, data, token) => {
311
+ try {
312
+ await datasetSet(url, repo, workspace, path, data, requestOptions(token));
313
+ return null;
314
+ }
315
+ catch (err) {
316
+ throw new EastError(`Failed to set dataset in ${workspace}: ${err.message}`, {
317
+ location: [{ filename: 'e3_dataset_set', line: 0n, column: 0n }],
318
+ cause: err,
319
+ });
320
+ }
321
+ }),
322
+ // Tasks
323
+ platform_task_list.implement(async (url, repo, workspace, token) => {
324
+ try {
325
+ return await taskList(url, repo, workspace, requestOptions(token));
326
+ }
327
+ catch (err) {
328
+ throw new EastError(`Failed to list tasks in ${workspace}: ${err.message}`, {
329
+ location: [{ filename: 'e3_task_list', line: 0n, column: 0n }],
330
+ cause: err,
331
+ });
332
+ }
333
+ }),
334
+ platform_task_get.implement(async (url, repo, workspace, name, token) => {
335
+ try {
336
+ return await taskGet(url, repo, workspace, name, requestOptions(token));
337
+ }
338
+ catch (err) {
339
+ throw new EastError(`Failed to get task ${name} in ${workspace}: ${err.message}`, {
340
+ location: [{ filename: 'e3_task_get', line: 0n, column: 0n }],
341
+ cause: err,
342
+ });
343
+ }
344
+ }),
345
+ // Executions
346
+ platform_dataflow_start.implement(async (url, repo, workspace, options, token) => {
347
+ try {
348
+ await dataflowExecuteLaunch(url, repo, workspace, {
349
+ force: dataflowForceOption(options.force),
350
+ filter: options.filter.value ?? undefined,
351
+ }, requestOptions(token));
352
+ return null;
353
+ }
354
+ catch (err) {
355
+ throw new EastError(`Failed to start dataflow in ${workspace}: ${err.message}`, {
356
+ location: [{ filename: 'e3_dataflow_start', line: 0n, column: 0n }],
357
+ cause: err,
358
+ });
359
+ }
360
+ }),
361
+ platform_dataflow_execute.implement(async (url, repo, workspace, options, token) => {
362
+ try {
363
+ return await dataflowExecute(url, repo, workspace, {
364
+ force: dataflowForceOption(options.force),
365
+ filter: options.filter.value ?? undefined,
366
+ }, requestOptions(token));
367
+ }
368
+ catch (err) {
369
+ throw new EastError(`Failed to execute dataflow in ${workspace}: ${err.message}`, {
370
+ location: [{ filename: 'e3_dataflow_execute', line: 0n, column: 0n }],
371
+ cause: err,
372
+ });
373
+ }
374
+ }),
375
+ platform_dataflow_graph.implement(async (url, repo, workspace, token) => {
376
+ try {
377
+ return await dataflowGraph(url, repo, workspace, requestOptions(token));
378
+ }
379
+ catch (err) {
380
+ throw new EastError(`Failed to get dataflow graph for ${workspace}: ${err.message}`, {
381
+ location: [{ filename: 'e3_dataflow_graph', line: 0n, column: 0n }],
382
+ cause: err,
383
+ });
384
+ }
385
+ }),
386
+ platform_task_logs.implement(async (url, repo, workspace, task, options, token) => {
387
+ try {
388
+ // A log chunk, as the platform function has always answered it: the
389
+ // execution the route names is the route's own
390
+ const { data, offset, size, totalSize, complete } = await taskLogs(url, repo, workspace, task, {
391
+ stream: options.stream,
392
+ offset: Number(options.offset),
393
+ limit: Number(options.limit),
394
+ }, requestOptions(token));
395
+ return { data, offset, size, totalSize, complete };
396
+ }
397
+ catch (err) {
398
+ throw new EastError(`Failed to get logs for task ${task} in ${workspace}: ${err.message}`, {
399
+ location: [{ filename: 'e3_task_logs', line: 0n, column: 0n }],
400
+ cause: err,
401
+ });
402
+ }
403
+ }),
404
+ // Functions / one-shot
405
+ platform_function_call.implement(async (url, repo, workspace, fn, request, token) => {
406
+ try {
407
+ return await workspaceFunctionCall(url, repo, workspace, fn, request, requestOptions(token));
408
+ }
409
+ catch (err) {
410
+ throw new EastError(`Failed to call function ${fn} in ${workspace}: ${err.message}`, {
411
+ location: [{ filename: 'e3_function_call', line: 0n, column: 0n }],
412
+ cause: err,
413
+ });
414
+ }
415
+ }),
416
+ platform_one_shot_execute.implement(async (url, repo, workspace, request, token) => {
417
+ try {
418
+ return await oneShotExecute(url, repo, workspace, request, requestOptions(token));
419
+ }
420
+ catch (err) {
421
+ throw new EastError(`Failed to execute one-shot in ${workspace}: ${err.message}`, {
422
+ location: [{ filename: 'e3_one_shot_execute', line: 0n, column: 0n }],
423
+ cause: err,
424
+ });
425
+ }
426
+ }),
427
+ ];
428
+ }
429
+ const PlatformImpl = platformImplementation();
412
430
  // =============================================================================
413
431
  // Grouped Export
414
432
  // =============================================================================
@@ -447,6 +465,7 @@ export const Platform = {
447
465
  functionCall: platform_function_call,
448
466
  oneShotExecute: platform_one_shot_execute,
449
467
  Implementation: PlatformImpl,
468
+ implementation: platformImplementation,
450
469
  Types: {
451
470
  RepositoryStatus: RepositoryStatusType,
452
471
  GcRequest: GcRequestType,
@@ -462,6 +481,7 @@ export const Platform = {
462
481
  DataflowResult: DataflowResultType,
463
482
  LogChunk: LogChunkType,
464
483
  LogOptions: LogOptionsType,
484
+ CallArg: CallArgType,
465
485
  FunctionCallRequest: FunctionCallRequestType,
466
486
  ExecuteResult: ExecuteResultType,
467
487
  OneShotRequest: OneShotRequestType,