@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.
- package/README.md +25 -3
- package/dist/src/datasets-transfer.spec.js +40 -5
- package/dist/src/datasets-transfer.spec.js.map +1 -1
- package/dist/src/datasets.d.ts +83 -1
- package/dist/src/datasets.d.ts.map +1 -1
- package/dist/src/datasets.js +213 -37
- package/dist/src/datasets.js.map +1 -1
- package/dist/src/datasets.spec.js +273 -13
- package/dist/src/datasets.spec.js.map +1 -1
- package/dist/src/executions.d.ts +50 -15
- package/dist/src/executions.d.ts.map +1 -1
- package/dist/src/executions.js +57 -16
- package/dist/src/executions.js.map +1 -1
- package/dist/src/executions.spec.d.ts +6 -0
- package/dist/src/executions.spec.d.ts.map +1 -0
- package/dist/src/executions.spec.js +81 -0
- package/dist/src/executions.spec.js.map +1 -0
- package/dist/src/functions.d.ts +39 -8
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +39 -8
- package/dist/src/functions.js.map +1 -1
- package/dist/src/http.d.ts +65 -7
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +54 -14
- package/dist/src/http.js.map +1 -1
- package/dist/src/http.spec.js +106 -5
- package/dist/src/http.spec.js.map +1 -1
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/packages.d.ts.map +1 -1
- package/dist/src/packages.js +3 -3
- package/dist/src/packages.js.map +1 -1
- package/dist/src/packages.spec.d.ts +6 -0
- package/dist/src/packages.spec.d.ts.map +1 -0
- package/dist/src/packages.spec.js +118 -0
- package/dist/src/packages.spec.js.map +1 -0
- package/dist/src/platform.d.ts +103 -9
- package/dist/src/platform.d.ts.map +1 -1
- package/dist/src/platform.js +335 -315
- package/dist/src/platform.js.map +1 -1
- package/dist/src/platform.spec.d.ts +6 -0
- package/dist/src/platform.spec.d.ts.map +1 -0
- package/dist/src/platform.spec.js +85 -0
- package/dist/src/platform.spec.js.map +1 -0
- package/dist/src/records.spec.js +15 -5
- package/dist/src/records.spec.js.map +1 -1
- package/dist/src/repository.d.ts +8 -1
- package/dist/src/repository.d.ts.map +1 -1
- package/dist/src/repository.js +8 -1
- package/dist/src/repository.js.map +1 -1
- package/dist/src/tasks.d.ts +11 -7
- package/dist/src/tasks.d.ts.map +1 -1
- package/dist/src/tasks.js +16 -8
- package/dist/src/tasks.js.map +1 -1
- package/dist/src/types.d.ts +63 -5
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +7 -5
- package/dist/src/types.js.map +1 -1
- package/dist/src/workspaces.d.ts +16 -2
- package/dist/src/workspaces.d.ts.map +1 -1
- package/dist/src/workspaces.js +11 -4
- package/dist/src/workspaces.js.map +1 -1
- package/package.json +4 -4
package/dist/src/platform.js
CHANGED
|
@@ -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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
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,
|