@elaraai/e3-api-server 1.0.79 → 1.0.80
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 +83 -19
- package/dist/src/beast2.js +1 -1
- package/dist/src/beast2.js.map +1 -1
- package/dist/src/cli.js +13 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +8 -1
- package/dist/src/errors.js.map +1 -1
- package/dist/src/handlers/dataflow.d.ts +58 -11
- package/dist/src/handlers/dataflow.d.ts.map +1 -1
- package/dist/src/handlers/dataflow.js +120 -48
- package/dist/src/handlers/dataflow.js.map +1 -1
- package/dist/src/handlers/dataflow.spec.d.ts +6 -0
- package/dist/src/handlers/dataflow.spec.d.ts.map +1 -0
- package/dist/src/handlers/dataflow.spec.js +106 -0
- package/dist/src/handlers/dataflow.spec.js.map +1 -0
- package/dist/src/handlers/datasets.d.ts +60 -34
- package/dist/src/handlers/datasets.d.ts.map +1 -1
- package/dist/src/handlers/datasets.js +452 -306
- package/dist/src/handlers/datasets.js.map +1 -1
- package/dist/src/handlers/datasets.spec.js +338 -119
- package/dist/src/handlers/datasets.spec.js.map +1 -1
- package/dist/src/handlers/functions.d.ts.map +1 -1
- package/dist/src/handlers/functions.js +10 -8
- package/dist/src/handlers/functions.js.map +1 -1
- package/dist/src/handlers/functions.spec.js +2 -2
- package/dist/src/handlers/functions.spec.js.map +1 -1
- package/dist/src/handlers/index.d.ts +2 -2
- package/dist/src/handlers/index.d.ts.map +1 -1
- package/dist/src/handlers/index.js +2 -2
- package/dist/src/handlers/index.js.map +1 -1
- package/dist/src/handlers/records.d.ts.map +1 -1
- package/dist/src/handlers/records.js +15 -12
- package/dist/src/handlers/records.js.map +1 -1
- package/dist/src/handlers/records.spec.js +9 -5
- package/dist/src/handlers/records.spec.js.map +1 -1
- package/dist/src/handlers/repository.d.ts +59 -10
- package/dist/src/handlers/repository.d.ts.map +1 -1
- package/dist/src/handlers/repository.js +147 -40
- package/dist/src/handlers/repository.js.map +1 -1
- package/dist/src/handlers/tasks.d.ts +2 -1
- package/dist/src/handlers/tasks.d.ts.map +1 -1
- package/dist/src/handlers/tasks.js +31 -8
- package/dist/src/handlers/tasks.js.map +1 -1
- package/dist/src/handlers/tasks.spec.d.ts +6 -0
- package/dist/src/handlers/tasks.spec.d.ts.map +1 -0
- package/dist/src/handlers/tasks.spec.js +64 -0
- package/dist/src/handlers/tasks.spec.js.map +1 -0
- package/dist/src/handlers/workspaces.d.ts +44 -6
- package/dist/src/handlers/workspaces.d.ts.map +1 -1
- package/dist/src/handlers/workspaces.js +74 -40
- package/dist/src/handlers/workspaces.js.map +1 -1
- package/dist/src/handlers/workspaces.spec.d.ts +6 -0
- package/dist/src/handlers/workspaces.spec.d.ts.map +1 -0
- package/dist/src/handlers/workspaces.spec.js +164 -0
- package/dist/src/handlers/workspaces.spec.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/local-dataflow.d.ts +14 -0
- package/dist/src/local-dataflow.d.ts.map +1 -0
- package/dist/src/local-dataflow.js +41 -0
- package/dist/src/local-dataflow.js.map +1 -0
- package/dist/src/middleware/repository.d.ts +39 -0
- package/dist/src/middleware/repository.d.ts.map +1 -0
- package/dist/src/middleware/repository.js +77 -0
- package/dist/src/middleware/repository.js.map +1 -0
- package/dist/src/routes/data.d.ts +2 -2
- package/dist/src/routes/data.d.ts.map +1 -1
- package/dist/src/routes/data.js +22 -45
- package/dist/src/routes/data.js.map +1 -1
- package/dist/src/routes/datasets.d.ts +0 -3
- package/dist/src/routes/datasets.d.ts.map +1 -1
- package/dist/src/routes/datasets.js +40 -8
- package/dist/src/routes/datasets.js.map +1 -1
- package/dist/src/routes/executions.d.ts +37 -2
- package/dist/src/routes/executions.d.ts.map +1 -1
- package/dist/src/routes/executions.js +21 -12
- package/dist/src/routes/executions.js.map +1 -1
- package/dist/src/routes/index.d.ts +2 -1
- package/dist/src/routes/index.d.ts.map +1 -1
- package/dist/src/routes/index.js +1 -0
- package/dist/src/routes/index.js.map +1 -1
- package/dist/src/routes/objects.d.ts +16 -2
- package/dist/src/routes/objects.d.ts.map +1 -1
- package/dist/src/routes/objects.js +34 -3
- package/dist/src/routes/objects.js.map +1 -1
- package/dist/src/routes/repositories.d.ts +26 -0
- package/dist/src/routes/repositories.d.ts.map +1 -0
- package/dist/src/routes/repositories.js +58 -0
- package/dist/src/routes/repositories.js.map +1 -0
- package/dist/src/routes/repositories.spec.d.ts +6 -0
- package/dist/src/routes/repositories.spec.d.ts.map +1 -0
- package/dist/src/routes/repositories.spec.js +77 -0
- package/dist/src/routes/repositories.spec.js.map +1 -0
- package/dist/src/routes/repository.d.ts +12 -2
- package/dist/src/routes/repository.d.ts.map +1 -1
- package/dist/src/routes/repository.js +24 -9
- package/dist/src/routes/repository.js.map +1 -1
- package/dist/src/routes/transfer.d.ts +11 -9
- package/dist/src/routes/transfer.d.ts.map +1 -1
- package/dist/src/routes/transfer.js +90 -115
- package/dist/src/routes/transfer.js.map +1 -1
- package/dist/src/routes/workspaces.d.ts +14 -1
- package/dist/src/routes/workspaces.d.ts.map +1 -1
- package/dist/src/routes/workspaces.js +57 -46
- package/dist/src/routes/workspaces.js.map +1 -1
- package/dist/src/server.d.ts +18 -6
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +55 -182
- package/dist/src/server.js.map +1 -1
- package/dist/src/server.spec.d.ts +6 -0
- package/dist/src/server.spec.d.ts.map +1 -0
- package/dist/src/server.spec.js +59 -0
- package/dist/src/server.spec.js.map +1 -0
- package/dist/src/types.d.ts +200 -16
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +5 -2
- package/dist/src/types.js.map +1 -1
- package/package.json +5 -5
- package/dist/src/async-operation-state.d.ts +0 -37
- package/dist/src/async-operation-state.d.ts.map +0 -1
- package/dist/src/async-operation-state.js +0 -118
- package/dist/src/async-operation-state.js.map +0 -1
- package/dist/src/orchestrator-manager.d.ts +0 -45
- package/dist/src/orchestrator-manager.d.ts.map +0 -1
- package/dist/src/orchestrator-manager.js +0 -150
- package/dist/src/orchestrator-manager.js.map +0 -1
|
@@ -2,23 +2,72 @@
|
|
|
2
2
|
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
3
|
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
5
|
+
import { type GcRequest } from '@elaraai/e3-types';
|
|
6
|
+
import type { RepoGcStore, StorageBackend } from '@elaraai/e3-core';
|
|
7
|
+
/**
|
|
8
|
+
* The repositories a host keeps, by name.
|
|
9
|
+
*
|
|
10
|
+
* @param storage - Storage backend, whose `RepoStore` keeps the repositories
|
|
11
|
+
* @returns The response: the names, or the error
|
|
12
|
+
*/
|
|
13
|
+
export declare function listRepositories(storage: StorageBackend): Promise<Response>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a repository, with its record naming this release and every
|
|
16
|
+
* upgrade this e3 knows, since a new repository is in their forms.
|
|
17
|
+
*
|
|
18
|
+
* @param storage - Storage backend, whose `RepoStore` keeps the repositories
|
|
19
|
+
* @param repo - The new repository's name
|
|
20
|
+
* @returns The response: 201 with its name; or the error, as for one that
|
|
21
|
+
* exists, or whose removal is still being cleaned up
|
|
22
|
+
*/
|
|
23
|
+
export declare function createRepository(storage: StorageBackend, repo: string): Promise<Response>;
|
|
24
|
+
/**
|
|
25
|
+
* Removes a repository, resumably: it is marked `deleting` first, so the
|
|
26
|
+
* repository gate treats it as gone from then on, and a removal asked again
|
|
27
|
+
* answers at once; then its refs and its objects are deleted a batch at a
|
|
28
|
+
* time, and last the repository itself.
|
|
29
|
+
*
|
|
30
|
+
* @param storage - Storage backend, whose `RepoStore` keeps the repositories
|
|
31
|
+
* @param repo - The repository's name
|
|
32
|
+
* @returns The response: null once it is removed, or the error
|
|
33
|
+
*/
|
|
34
|
+
export declare function removeRepository(storage: StorageBackend, repo: string): Promise<Response>;
|
|
6
35
|
/**
|
|
7
36
|
* Get repository status.
|
|
8
37
|
*/
|
|
9
38
|
export declare function getStatus(storage: StorageBackend, repoPath: string): Promise<Response>;
|
|
10
39
|
/**
|
|
11
|
-
*
|
|
40
|
+
* The repository's record: the release of e3 that last wrote it, and the store
|
|
41
|
+
* upgrades it has had.
|
|
12
42
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
43
|
+
* @param storage - Storage backend
|
|
44
|
+
* @param repoPath - Repository identifier
|
|
45
|
+
* @returns The response: the record, or the error
|
|
15
46
|
*/
|
|
16
|
-
export declare function
|
|
17
|
-
dryRun: boolean;
|
|
18
|
-
minAge?: number;
|
|
19
|
-
}): Response;
|
|
47
|
+
export declare function getRecord(storage: StorageBackend, repoPath: string): Promise<Response>;
|
|
20
48
|
/**
|
|
21
|
-
*
|
|
49
|
+
* Start garbage collection, as a job the client polls.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* gc takes as long as the repository is large, which outlasts a request. So it
|
|
53
|
+
* runs as a job, in the compute the store dispatches it to: a local server's
|
|
54
|
+
* own process, or a cloud's. A poll reads the job's status from the store,
|
|
55
|
+
* whichever instance answers it.
|
|
56
|
+
*
|
|
57
|
+
* @param repo - The repository's name, which the job is filed under
|
|
58
|
+
* @param request - What gc keeps, and whether it deletes
|
|
59
|
+
* @param gcStore - Where the job is filed, and dispatched from
|
|
60
|
+
* @returns The response: 202 with the job's id, or the error
|
|
61
|
+
*/
|
|
62
|
+
export declare function startGc(repo: string, request: GcRequest, gcStore: RepoGcStore): Promise<Response>;
|
|
63
|
+
/**
|
|
64
|
+
* A gc job's status: still running, what gc did, or why it failed.
|
|
65
|
+
*
|
|
66
|
+
* @param gcStore - Where the job is filed
|
|
67
|
+
* @param repo - The repository's name
|
|
68
|
+
* @param executionId - The job's id
|
|
69
|
+
* @returns The response: the status, or the error when this repository started
|
|
70
|
+
* no such job
|
|
22
71
|
*/
|
|
23
|
-
export declare function getGcStatus(executionId: string): Response
|
|
72
|
+
export declare function getGcStatus(gcStore: RepoGcStore, repo: string, executionId: string): Promise<Response>;
|
|
24
73
|
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/handlers/repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/handlers/repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASpE;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAMjF;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkB/F;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmC/F;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAmBnB;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAMnB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,QAAQ,CAAC,CAcnB;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,QAAQ,CAAC,CAYnB"}
|
|
@@ -2,12 +2,96 @@
|
|
|
2
2
|
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
3
|
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { randomUUID } from 'node:crypto';
|
|
6
|
+
import { ArrayType, NullType, StringType, none, variant } from '@elaraai/east';
|
|
7
|
+
import { RepositoryRecordType } from '@elaraai/e3-types';
|
|
8
|
+
import { RepoAlreadyExistsError, RepoNotFoundError, packageList, repositoryOpen, workspaceList } from '@elaraai/e3-core';
|
|
7
9
|
import { sendSuccess, sendSuccessWithStatus, sendError } from '../beast2.js';
|
|
8
10
|
import { errorToVariant } from '../errors.js';
|
|
9
11
|
import { RepositoryStatusType, GcStartResultType, GcStatusResultType, } from '../types.js';
|
|
10
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The repositories a host keeps, by name.
|
|
14
|
+
*
|
|
15
|
+
* @param storage - Storage backend, whose `RepoStore` keeps the repositories
|
|
16
|
+
* @returns The response: the names, or the error
|
|
17
|
+
*/
|
|
18
|
+
export async function listRepositories(storage) {
|
|
19
|
+
try {
|
|
20
|
+
return sendSuccess(ArrayType(StringType), await storage.repos.list());
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
return sendError(ArrayType(StringType), errorToVariant(err));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a repository, with its record naming this release and every
|
|
28
|
+
* upgrade this e3 knows, since a new repository is in their forms.
|
|
29
|
+
*
|
|
30
|
+
* @param storage - Storage backend, whose `RepoStore` keeps the repositories
|
|
31
|
+
* @param repo - The new repository's name
|
|
32
|
+
* @returns The response: 201 with its name; or the error, as for one that
|
|
33
|
+
* exists, or whose removal is still being cleaned up
|
|
34
|
+
*/
|
|
35
|
+
export async function createRepository(storage, repo) {
|
|
36
|
+
try {
|
|
37
|
+
const existing = await storage.repos.getMetadata(repo);
|
|
38
|
+
if (existing) {
|
|
39
|
+
if (existing.status.type === 'deleting') {
|
|
40
|
+
return sendError(StringType, variant('internal', { message: `Repository '${repo}' cleanup in progress, try later` }));
|
|
41
|
+
}
|
|
42
|
+
return sendError(StringType, variant('internal', { message: `Repository '${repo}' already exists` }));
|
|
43
|
+
}
|
|
44
|
+
await storage.repos.create(repo);
|
|
45
|
+
return sendSuccessWithStatus(StringType, repo, 201);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
if (err instanceof RepoAlreadyExistsError) {
|
|
49
|
+
return sendError(StringType, variant('internal', { message: `Repository '${repo}' already exists` }));
|
|
50
|
+
}
|
|
51
|
+
return sendError(StringType, errorToVariant(err));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Removes a repository, resumably: it is marked `deleting` first, so the
|
|
56
|
+
* repository gate treats it as gone from then on, and a removal asked again
|
|
57
|
+
* answers at once; then its refs and its objects are deleted a batch at a
|
|
58
|
+
* time, and last the repository itself.
|
|
59
|
+
*
|
|
60
|
+
* @param storage - Storage backend, whose `RepoStore` keeps the repositories
|
|
61
|
+
* @param repo - The repository's name
|
|
62
|
+
* @returns The response: null once it is removed, or the error
|
|
63
|
+
*/
|
|
64
|
+
export async function removeRepository(storage, repo) {
|
|
65
|
+
try {
|
|
66
|
+
const existing = await storage.repos.getMetadata(repo);
|
|
67
|
+
if (!existing) {
|
|
68
|
+
return sendError(NullType, variant('repository_not_found', { repo }));
|
|
69
|
+
}
|
|
70
|
+
// Being removed already: the removal that marked it finishes it.
|
|
71
|
+
if (existing.status.type === 'deleting') {
|
|
72
|
+
return sendSuccess(NullType, null);
|
|
73
|
+
}
|
|
74
|
+
await storage.repos.setStatus(repo, 'deleting', 'active');
|
|
75
|
+
let cursor;
|
|
76
|
+
do {
|
|
77
|
+
const result = await storage.repos.deleteRefsBatch(repo, cursor);
|
|
78
|
+
cursor = result.status === 'continue' ? result.cursor : undefined;
|
|
79
|
+
} while (cursor);
|
|
80
|
+
cursor = undefined;
|
|
81
|
+
do {
|
|
82
|
+
const result = await storage.repos.deleteObjectsBatch(repo, cursor);
|
|
83
|
+
cursor = result.status === 'continue' ? result.cursor : undefined;
|
|
84
|
+
} while (cursor);
|
|
85
|
+
await storage.repos.remove(repo);
|
|
86
|
+
return sendSuccess(NullType, null);
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
if (err instanceof RepoNotFoundError) {
|
|
90
|
+
return sendError(NullType, variant('repository_not_found', { repo }));
|
|
91
|
+
}
|
|
92
|
+
return sendError(NullType, errorToVariant(err));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
11
95
|
/**
|
|
12
96
|
* Get repository status.
|
|
13
97
|
*/
|
|
@@ -31,49 +115,72 @@ export async function getStatus(storage, repoPath) {
|
|
|
31
115
|
}
|
|
32
116
|
}
|
|
33
117
|
/**
|
|
34
|
-
*
|
|
118
|
+
* The repository's record: the release of e3 that last wrote it, and the store
|
|
119
|
+
* upgrades it has had.
|
|
35
120
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
121
|
+
* @param storage - Storage backend
|
|
122
|
+
* @param repoPath - Repository identifier
|
|
123
|
+
* @returns The response: the record, or the error
|
|
38
124
|
*/
|
|
39
|
-
export function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
125
|
+
export async function getRecord(storage, repoPath) {
|
|
126
|
+
try {
|
|
127
|
+
return sendSuccess(RepositoryRecordType, await repositoryOpen(storage, repoPath));
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
return sendError(RepositoryRecordType, errorToVariant(err));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Start garbage collection, as a job the client polls.
|
|
135
|
+
*
|
|
136
|
+
* @remarks
|
|
137
|
+
* gc takes as long as the repository is large, which outlasts a request. So it
|
|
138
|
+
* runs as a job, in the compute the store dispatches it to: a local server's
|
|
139
|
+
* own process, or a cloud's. A poll reads the job's status from the store,
|
|
140
|
+
* whichever instance answers it.
|
|
141
|
+
*
|
|
142
|
+
* @param repo - The repository's name, which the job is filed under
|
|
143
|
+
* @param request - What gc keeps, and whether it deletes
|
|
144
|
+
* @param gcStore - Where the job is filed, and dispatched from
|
|
145
|
+
* @returns The response: 202 with the job's id, or the error
|
|
146
|
+
*/
|
|
147
|
+
export async function startGc(repo, request, gcStore) {
|
|
148
|
+
try {
|
|
149
|
+
const executionId = randomUUID();
|
|
150
|
+
await gcStore.create(executionId, {
|
|
151
|
+
repo,
|
|
152
|
+
request,
|
|
153
|
+
status: { status: variant('running', null), stats: none, error: none },
|
|
154
|
+
createdAt: new Date(),
|
|
155
|
+
});
|
|
156
|
+
await gcStore.execute(executionId, repo);
|
|
157
|
+
return sendSuccessWithStatus(GcStartResultType, { executionId }, 202);
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
return sendError(GcStartResultType, errorToVariant(err));
|
|
161
|
+
}
|
|
61
162
|
}
|
|
62
163
|
/**
|
|
63
|
-
*
|
|
164
|
+
* A gc job's status: still running, what gc did, or why it failed.
|
|
165
|
+
*
|
|
166
|
+
* @param gcStore - Where the job is filed
|
|
167
|
+
* @param repo - The repository's name
|
|
168
|
+
* @param executionId - The job's id
|
|
169
|
+
* @returns The response: the status, or the error when this repository started
|
|
170
|
+
* no such job
|
|
64
171
|
*/
|
|
65
|
-
export function getGcStatus(executionId) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
172
|
+
export async function getGcStatus(gcStore, repo, executionId) {
|
|
173
|
+
try {
|
|
174
|
+
const job = await gcStore.get(executionId);
|
|
175
|
+
if (job === null || job.repo !== repo) {
|
|
176
|
+
return sendError(GcStatusResultType, variant('internal', {
|
|
177
|
+
message: `repository '${repo}' has no gc job '${executionId}'`,
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
return sendSuccess(GcStatusResultType, job.status);
|
|
70
181
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return sendError(GcStatusResultType, variant('internal', {
|
|
74
|
-
message: `GC operation not found: ${executionId}`,
|
|
75
|
-
}));
|
|
182
|
+
catch (err) {
|
|
183
|
+
return sendError(GcStatusResultType, errorToVariant(err));
|
|
76
184
|
}
|
|
77
|
-
return sendSuccess(GcStatusResultType, status);
|
|
78
185
|
}
|
|
79
186
|
//# sourceMappingURL=repository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/handlers/repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/handlers/repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAkB,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,M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,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAoB,EACpB,IAAY,EACZ,WAAmB;IAEnB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC3C,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACtC,OAAO,SAAS,CAAC,kBAAkB,EAAE,OAAO,CAAC,UAAU,EAAE;gBACvD,OAAO,EAAE,eAAe,IAAI,oBAAoB,WAAW,GAAG;aAC/D,CAAC,CAAC,CAAC;QACN,CAAC;QACD,OAAO,WAAW,CAAC,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,SAAS,CAAC,kBAAkB,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC"}
|
|
@@ -14,7 +14,8 @@ export declare function getTask(storage: StorageBackend, repoPath: string, works
|
|
|
14
14
|
/**
|
|
15
15
|
* List execution history for a task: the latest attempt per distinct
|
|
16
16
|
* inputs hash, or — with `all` — every attempt (a forced re-run or a retry
|
|
17
|
-
* after a failure adds one under the same inputs hash).
|
|
17
|
+
* after a failure adds one under the same inputs hash). A split task's units
|
|
18
|
+
* are recorded under its hash too, and are left out: they are not its runs.
|
|
18
19
|
*/
|
|
19
20
|
export declare function listExecutions(storage: StorageBackend, repoPath: string, workspace: string, taskName: string, all?: boolean): Promise<Response>;
|
|
20
21
|
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../../src/handlers/tasks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD;;GAEG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,QAAQ,CAAC,CAiBnB;AAED;;GAEG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAiBnB;
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../../src/handlers/tasks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD;;GAEG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,QAAQ,CAAC,CAiBnB;AAED;;GAEG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAiBnB;AAgGD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,GAAG,UAAQ,GACV,OAAO,CAAC,QAAQ,CAAC,CAqBnB"}
|
|
@@ -13,11 +13,11 @@ import { TaskListItemType, TaskDetailsType, ExecutionListItemType } from '../typ
|
|
|
13
13
|
export async function listTasks(storage, repoPath, workspace) {
|
|
14
14
|
try {
|
|
15
15
|
const taskNames = await workspaceListTasks(storage, repoPath, workspace);
|
|
16
|
-
// Get hash +
|
|
16
|
+
// Get hash + role for each task (the object read is content-addressed and cheap)
|
|
17
17
|
const result = await Promise.all(taskNames.map(async (name) => {
|
|
18
18
|
const hash = await workspaceGetTaskHash(storage, repoPath, workspace, name);
|
|
19
19
|
const task = await workspaceGetTask(storage, repoPath, workspace, name);
|
|
20
|
-
return { name, hash,
|
|
20
|
+
return { name, hash, role: task.role };
|
|
21
21
|
}));
|
|
22
22
|
return sendSuccess(ArrayType(TaskListItemType), result);
|
|
23
23
|
}
|
|
@@ -35,11 +35,11 @@ export async function getTask(storage, repoPath, workspace, taskName) {
|
|
|
35
35
|
return sendSuccess(TaskDetailsType, {
|
|
36
36
|
name: taskName,
|
|
37
37
|
hash,
|
|
38
|
-
|
|
38
|
+
body: task.body,
|
|
39
|
+
runner: task.runner,
|
|
39
40
|
inputs: task.inputs,
|
|
40
41
|
output: task.output,
|
|
41
|
-
|
|
42
|
-
metadata: task.metadata,
|
|
42
|
+
role: task.role,
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
catch (err) {
|
|
@@ -59,6 +59,10 @@ function statusToApiStatus(status) {
|
|
|
59
59
|
return variant('failed', null);
|
|
60
60
|
case 'error':
|
|
61
61
|
return variant('error', null);
|
|
62
|
+
case 'cancelled':
|
|
63
|
+
return variant('cancelled', null);
|
|
64
|
+
case 'interrupted':
|
|
65
|
+
return variant('interrupted', null);
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
/**
|
|
@@ -80,6 +84,7 @@ function toExecutionListItem(inputsHash, status) {
|
|
|
80
84
|
completedAt: some(status.value.completedAt.toISOString()),
|
|
81
85
|
duration: some(calculateDuration(status.value.startedAt, status.value.completedAt)),
|
|
82
86
|
exitCode: none,
|
|
87
|
+
peakBytes: status.value.peakBytes,
|
|
83
88
|
};
|
|
84
89
|
}
|
|
85
90
|
if (status.type === 'failed') {
|
|
@@ -91,9 +96,24 @@ function toExecutionListItem(inputsHash, status) {
|
|
|
91
96
|
completedAt: some(status.value.completedAt.toISOString()),
|
|
92
97
|
duration: some(calculateDuration(status.value.startedAt, status.value.completedAt)),
|
|
93
98
|
exitCode: some(status.value.exitCode),
|
|
99
|
+
peakBytes: status.value.peakBytes,
|
|
94
100
|
};
|
|
95
101
|
}
|
|
96
|
-
if (status.type === '
|
|
102
|
+
if (status.type === 'cancelled') {
|
|
103
|
+
return {
|
|
104
|
+
inputsHash,
|
|
105
|
+
inputHashes: status.value.inputHashes,
|
|
106
|
+
status: statusToApiStatus(status),
|
|
107
|
+
startedAt: status.value.startedAt.toISOString(),
|
|
108
|
+
completedAt: some(status.value.completedAt.toISOString()),
|
|
109
|
+
duration: some(calculateDuration(status.value.startedAt, status.value.completedAt)),
|
|
110
|
+
exitCode: none,
|
|
111
|
+
peakBytes: none,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
// An interruption's completedAt is when it was found, not when the runner
|
|
115
|
+
// stopped, so it has no duration.
|
|
116
|
+
if (status.type === 'error' || status.type === 'interrupted') {
|
|
97
117
|
return {
|
|
98
118
|
inputsHash,
|
|
99
119
|
inputHashes: status.value.inputHashes,
|
|
@@ -102,6 +122,7 @@ function toExecutionListItem(inputsHash, status) {
|
|
|
102
122
|
completedAt: some(status.value.completedAt.toISOString()),
|
|
103
123
|
duration: none,
|
|
104
124
|
exitCode: none,
|
|
125
|
+
peakBytes: none,
|
|
105
126
|
};
|
|
106
127
|
}
|
|
107
128
|
// running
|
|
@@ -113,12 +134,14 @@ function toExecutionListItem(inputsHash, status) {
|
|
|
113
134
|
completedAt: none,
|
|
114
135
|
duration: none,
|
|
115
136
|
exitCode: none,
|
|
137
|
+
peakBytes: none,
|
|
116
138
|
};
|
|
117
139
|
}
|
|
118
140
|
/**
|
|
119
141
|
* List execution history for a task: the latest attempt per distinct
|
|
120
142
|
* inputs hash, or — with `all` — every attempt (a forced re-run or a retry
|
|
121
|
-
* after a failure adds one under the same inputs hash).
|
|
143
|
+
* after a failure adds one under the same inputs hash). A split task's units
|
|
144
|
+
* are recorded under its hash too, and are left out: they are not its runs.
|
|
122
145
|
*/
|
|
123
146
|
export async function listExecutions(storage, repoPath, workspace, taskName, all = false) {
|
|
124
147
|
try {
|
|
@@ -131,7 +154,7 @@ export async function listExecutions(storage, repoPath, workspace, taskName, all
|
|
|
131
154
|
.map(executionId => executionGet(storage, repoPath, taskHash, inputsHash, executionId)))
|
|
132
155
|
: [await executionGetLatest(storage, repoPath, taskHash, inputsHash)];
|
|
133
156
|
for (const status of statuses) {
|
|
134
|
-
if (status)
|
|
157
|
+
if (status && !status.value.unit)
|
|
135
158
|
result.push(toExecutionListItem(inputsHash, status));
|
|
136
159
|
}
|
|
137
160
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../../src/handlers/tasks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,qBAAqB,EAA0B,MAAM,aAAa,CAAC;AAE/G;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,OAAuB,EACvB,QAAgB,EAChB,SAAiB;IAEjB,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAEzE,iFAAiF;QACjF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAC9B,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,IAAI,GAAG,MAAM,oBAAoB,CAAC,OAAO,EAA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,SAAS,CAAC,SAAS,CAAC,qBAAqB,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.spec.d.ts","sourceRoot":"","sources":["../../../src/handlers/tasks.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Task route tests: a task's execution history lists its runs, and leaves out
|
|
7
|
+
* the units a split task runs under its hash, which are not runs of it.
|
|
8
|
+
*/
|
|
9
|
+
import { describe, it, beforeEach } from 'node:test';
|
|
10
|
+
import assert from 'node:assert/strict';
|
|
11
|
+
import { Hono } from 'hono';
|
|
12
|
+
import { ArrayType, decodeBeast2For, encodeBeast2For, none, some, variant } from '@elaraai/east';
|
|
13
|
+
import { InMemoryStorage } from '@elaraai/e3-core/test';
|
|
14
|
+
import { PackageObjectType, WorkspaceRecordType } from '@elaraai/e3-types';
|
|
15
|
+
import { createTaskRoutes } from '../routes/tasks.js';
|
|
16
|
+
import { ExecutionListItemType, ResponseType } from '../types.js';
|
|
17
|
+
const REPO = 'test-repo';
|
|
18
|
+
const WS = 'main';
|
|
19
|
+
const TASK = 'a'.repeat(64);
|
|
20
|
+
const decodeHistory = decodeBeast2For(ResponseType(ArrayType(ExecutionListItemType)));
|
|
21
|
+
describe('task routes', () => {
|
|
22
|
+
let storage;
|
|
23
|
+
let app;
|
|
24
|
+
beforeEach(async () => {
|
|
25
|
+
storage = new InMemoryStorage();
|
|
26
|
+
await storage.repos.create(REPO);
|
|
27
|
+
const pkg = await storage.objects.write(REPO, encodeBeast2For(PackageObjectType)({
|
|
28
|
+
tasks: new Map([['count', TASK]]),
|
|
29
|
+
data: { structure: variant('struct', new Map()), refs: new Map() },
|
|
30
|
+
functions: new Map(),
|
|
31
|
+
records: new Map(),
|
|
32
|
+
sources: new Map(),
|
|
33
|
+
}));
|
|
34
|
+
await storage.refs.workspaceWrite(REPO, WS, encodeBeast2For(WorkspaceRecordType)(some({
|
|
35
|
+
packageName: 'counts', packageVersion: '1.0.0', packageHash: pkg, deployedAt: new Date(0), currentRunId: none,
|
|
36
|
+
})));
|
|
37
|
+
app = new Hono();
|
|
38
|
+
app.route('/api/repos/:repo/workspaces/:ws/tasks', createTaskRoutes(storage, () => REPO));
|
|
39
|
+
});
|
|
40
|
+
/** The inputs hash of each execution the task's history lists. */
|
|
41
|
+
async function history(query = '') {
|
|
42
|
+
const response = await app.request(`/api/repos/r/workspaces/${WS}/tasks/count/executions${query}`);
|
|
43
|
+
const answer = decodeHistory(new Uint8Array(await response.arrayBuffer()));
|
|
44
|
+
if (answer.type !== 'success')
|
|
45
|
+
assert.fail(`the history was refused: ${answer.value.type}`);
|
|
46
|
+
return answer.value.map((item) => item.inputsHash);
|
|
47
|
+
}
|
|
48
|
+
it('lists a split task\'s runs, and none of the units it ran under its hash', async () => {
|
|
49
|
+
// Two runs of the task over the same inputs, and a piece and a merge of
|
|
50
|
+
// the second, each under inputs of its own.
|
|
51
|
+
const own = 'b'.repeat(64);
|
|
52
|
+
const executions = [[own, false], [own, false], ['c'.repeat(64), true], ['d'.repeat(64), true]];
|
|
53
|
+
for (const [i, [inputs, unit]] of executions.entries()) {
|
|
54
|
+
const executionId = `01900000-0000-7000-8000-00000000000${i + 1}`;
|
|
55
|
+
await storage.refs.executionWrite(REPO, TASK, inputs, executionId, variant('success', {
|
|
56
|
+
executionId, inputHashes: [], outputHash: 'f'.repeat(64),
|
|
57
|
+
startedAt: new Date(0), completedAt: new Date(1_000), peakBytes: none, plan: none, unit,
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
assert.deepEqual(await history(), [own]);
|
|
61
|
+
assert.deepEqual(await history('?all=true'), [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ACzC,MAAM,CAAC,SAAS,CAAC,MAAM,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
3
|
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
5
|
+
import { type WorkspaceDeployRequest } from '@elaraai/e3-types';
|
|
6
|
+
import type { StorageBackend, TaskRunner, WorkspaceDeployStore } from '@elaraai/e3-core';
|
|
6
7
|
/**
|
|
7
8
|
* List all workspaces in the repository.
|
|
8
9
|
*/
|
|
@@ -17,18 +18,55 @@ export declare function createWorkspace(storage: StorageBackend, repoPath: strin
|
|
|
17
18
|
export declare function getWorkspace(storage: StorageBackend, repoPath: string, name: string): Promise<Response>;
|
|
18
19
|
/**
|
|
19
20
|
* Get comprehensive workspace status.
|
|
21
|
+
*
|
|
22
|
+
* @param storage - Storage backend
|
|
23
|
+
* @param runner - The runner the repository's tasks run on, which says
|
|
24
|
+
* whether an execution recorded running can still finish
|
|
25
|
+
* @param repoPath - Repository identifier
|
|
26
|
+
* @param name - Workspace name
|
|
27
|
+
* @returns The response: the status, or the error
|
|
20
28
|
*/
|
|
21
|
-
export declare function getWorkspaceStatus(storage: StorageBackend, repoPath: string, name: string): Promise<Response>;
|
|
29
|
+
export declare function getWorkspaceStatus(storage: StorageBackend, runner: TaskRunner, repoPath: string, name: string): Promise<Response>;
|
|
22
30
|
/**
|
|
23
31
|
* Delete a workspace.
|
|
24
32
|
*/
|
|
25
33
|
export declare function deleteWorkspace(storage: StorageBackend, repoPath: string, name: string): Promise<Response>;
|
|
26
34
|
/**
|
|
27
|
-
*
|
|
35
|
+
* Start deploying a package to a workspace, as a job the client polls.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* A deploy that migrates a record, or builds an index over one, takes as long
|
|
39
|
+
* as the record is large, which outlasts a request. So the deploy runs as a
|
|
40
|
+
* job, in the compute the store dispatches it to: a local server's own
|
|
41
|
+
* process, or a cloud's. The package is resolved first, so a deploy of one the
|
|
42
|
+
* repository does not hold is refused at once, as `package_not_found`, and the
|
|
43
|
+
* job deploys exactly the version resolved.
|
|
44
|
+
*
|
|
45
|
+
* The job never opens a path-initialised input's file: its path is on the
|
|
46
|
+
* machine that exported the package. Each such input is left unassigned, and
|
|
47
|
+
* `e3 workspace deploy <url>` completes it over the dataset transfer protocol
|
|
48
|
+
* once the job has finished.
|
|
49
|
+
*
|
|
50
|
+
* @param storage - Storage backend
|
|
51
|
+
* @param repoPath - Repository identifier
|
|
52
|
+
* @param repo - The repository's name, which the job is filed under
|
|
53
|
+
* @param workspace - Workspace name
|
|
54
|
+
* @param request - The package, and what the deploy does with a record it
|
|
55
|
+
* cannot keep as it is
|
|
56
|
+
* @param deployStore - Where the job is filed, and dispatched from
|
|
57
|
+
* @returns The response: the job's id, or the error
|
|
28
58
|
*/
|
|
29
|
-
export declare function
|
|
59
|
+
export declare function startWorkspaceDeploy(storage: StorageBackend, repoPath: string, repo: string, workspace: string, request: WorkspaceDeployRequest, deployStore: WorkspaceDeployStore): Promise<Response>;
|
|
30
60
|
/**
|
|
31
|
-
*
|
|
61
|
+
* A deploy job's status: still running, what the deploy did, or why it did
|
|
62
|
+
* not.
|
|
63
|
+
*
|
|
64
|
+
* @param deployStore - Where the job is filed
|
|
65
|
+
* @param repo - The repository's name
|
|
66
|
+
* @param workspace - Workspace name
|
|
67
|
+
* @param id - The job's id
|
|
68
|
+
* @returns The response: the status, or the error when this workspace started
|
|
69
|
+
* no such job
|
|
32
70
|
*/
|
|
33
|
-
export declare function
|
|
71
|
+
export declare function getWorkspaceDeployStatus(deployStore: WorkspaceDeployStore, repo: string, workspace: string, id: string): Promise<Response>;
|
|
34
72
|
//# sourceMappingURL=workspaces.d.ts.map
|