@elaraai/e3-cloud-client 0.0.0-stage → 1.0.90
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/LICENSE.md +54 -0
- package/README.md +238 -2
- package/dist/src/admin-users.d.ts +36 -0
- package/dist/src/admin-users.d.ts.map +1 -0
- package/dist/src/admin-users.js +56 -0
- package/dist/src/admin-users.js.map +1 -0
- package/dist/src/apps.d.ts +210 -0
- package/dist/src/apps.d.ts.map +1 -0
- package/dist/src/apps.js +265 -0
- package/dist/src/apps.js.map +1 -0
- package/dist/src/deployment-settings.d.ts +63 -0
- package/dist/src/deployment-settings.d.ts.map +1 -0
- package/dist/src/deployment-settings.js +79 -0
- package/dist/src/deployment-settings.js.map +1 -0
- package/dist/src/feedback.d.ts +132 -0
- package/dist/src/feedback.d.ts.map +1 -0
- package/dist/src/feedback.js +166 -0
- package/dist/src/feedback.js.map +1 -0
- package/dist/src/history.d.ts +126 -0
- package/dist/src/history.d.ts.map +1 -0
- package/dist/src/history.js +144 -0
- package/dist/src/history.js.map +1 -0
- package/dist/src/index.d.ts +64 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +67 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/invitations.d.ts +17 -0
- package/dist/src/invitations.d.ts.map +1 -0
- package/dist/src/invitations.js +31 -0
- package/dist/src/invitations.js.map +1 -0
- package/dist/src/me.d.ts +11 -0
- package/dist/src/me.d.ts.map +1 -0
- package/dist/src/me.js +18 -0
- package/dist/src/me.js.map +1 -0
- package/dist/src/records.d.ts +127 -0
- package/dist/src/records.d.ts.map +1 -0
- package/dist/src/records.js +226 -0
- package/dist/src/records.js.map +1 -0
- package/dist/src/roles.d.ts +72 -0
- package/dist/src/roles.d.ts.map +1 -0
- package/dist/src/roles.js +95 -0
- package/dist/src/roles.js.map +1 -0
- package/dist/src/schedules.d.ts +25 -0
- package/dist/src/schedules.d.ts.map +1 -0
- package/dist/src/schedules.js +45 -0
- package/dist/src/schedules.js.map +1 -0
- package/dist/src/secrets.d.ts +20 -0
- package/dist/src/secrets.d.ts.map +1 -0
- package/dist/src/secrets.js +37 -0
- package/dist/src/secrets.js.map +1 -0
- package/dist/src/task-configs.d.ts +101 -0
- package/dist/src/task-configs.d.ts.map +1 -0
- package/dist/src/task-configs.js +157 -0
- package/dist/src/task-configs.js.map +1 -0
- package/dist/src/user-settings.d.ts +34 -0
- package/dist/src/user-settings.d.ts.map +1 -0
- package/dist/src/user-settings.js +83 -0
- package/dist/src/user-settings.js.map +1 -0
- package/dist/src/users.d.ts +84 -0
- package/dist/src/users.d.ts.map +1 -0
- package/dist/src/users.js +100 -0
- package/dist/src/users.js.map +1 -0
- package/package.json +23 -3
package/dist/src/apps.js
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Apps: pages and menus deployed to a workspace, each its own
|
|
7
|
+
* deployable, built with `@elaraai/e3-cloud-ui`.
|
|
8
|
+
*
|
|
9
|
+
* - Owners and admins list a workspace's apps ({@link appList}) and read one
|
|
10
|
+
* ({@link appGet}): its current version, whose object `GET …/objects/:hash`
|
|
11
|
+
* reads. A user lists and reads the apps their business roles grant.
|
|
12
|
+
* - Owners and admins upload an app object ({@link appUpload}), deploy it
|
|
13
|
+
* ({@link appDeploy}, or several together with {@link appsDeploy}), list an
|
|
14
|
+
* app's versions ({@link appVersions}) and remove it ({@link appRemove}).
|
|
15
|
+
* - The deployment's admins list every app, a page at a time, with the e3
|
|
16
|
+
* the platform runs ({@link adminAppList}, the CLI's `app list-all`).
|
|
17
|
+
* - A repository's owners and admins list its apps, with the e3 the platform
|
|
18
|
+
* runs ({@link repositoryAppList}): what the console's Needs rebuild reads.
|
|
19
|
+
*
|
|
20
|
+
* A deploy answers `refused` with every problem (print them with
|
|
21
|
+
* e3-cloud-types' `appProblemText`), `checked` for a dry run, `live`,
|
|
22
|
+
* `deploying` (the workspace runs another package: it deploys first, as the
|
|
23
|
+
* job named, keeping the inputs people set, and the apps go live as it
|
|
24
|
+
* completes; {@link appDeployWait} waits for it), or `staged` for the
|
|
25
|
+
* platform's next e3. It throws `ApiError` with code `package_missing` when
|
|
26
|
+
* the repository does not hold the package the app was built against (import
|
|
27
|
+
* it, then deploy), `package_version_conflict` when it holds another of that
|
|
28
|
+
* version, `package_deploy_unavailable` when the server deploys no package
|
|
29
|
+
* with its apps, `app_conflict` when another deploy came first, and
|
|
30
|
+
* `workspace_busy` while a deploy holds the workspace.
|
|
31
|
+
*/
|
|
32
|
+
import { variant } from '@elaraai/east';
|
|
33
|
+
import { AdminAppPageType, AppRebuildsType, RepositoryAppsType, AppDeployRequestType, AppDeployResponseType, AppListType, AppRemovedType, AppSummaryType, AppUploadRequestType, AppUploadType, AppVersionPageType, AppsDeployRequestType, } from '@elaraai/e3-cloud-types';
|
|
34
|
+
import { del, get, post } from '@elaraai/e3-api-client';
|
|
35
|
+
import { WorkspaceDeployStatusType } from '@elaraai/e3-types';
|
|
36
|
+
const enc = encodeURIComponent;
|
|
37
|
+
const appsBase = (repo, ws) => `/repos/${enc(repo)}/workspaces/${enc(ws)}/apps`;
|
|
38
|
+
/**
|
|
39
|
+
* A workspace's apps, each its current version.
|
|
40
|
+
*
|
|
41
|
+
* @param url - Base URL of the e3 API server
|
|
42
|
+
* @param repo - Repository name
|
|
43
|
+
* @param ws - Workspace name
|
|
44
|
+
* @param options - Request options including auth token
|
|
45
|
+
* @returns The apps, by name
|
|
46
|
+
*/
|
|
47
|
+
export async function appList(url, repo, ws, options) {
|
|
48
|
+
return get(url, appsBase(repo, ws), AppListType, options);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* An app: its current version, the hash of the one before, and any bundle
|
|
52
|
+
* staged for the platform's next e3.
|
|
53
|
+
*
|
|
54
|
+
* @param url - Base URL of the e3 API server
|
|
55
|
+
* @param repo - Repository name
|
|
56
|
+
* @param ws - Workspace name
|
|
57
|
+
* @param app - The app's name
|
|
58
|
+
* @param options - Request options including auth token
|
|
59
|
+
* @returns The app
|
|
60
|
+
* @throws {ApiError} `not_found` when the workspace has no app of the name
|
|
61
|
+
*/
|
|
62
|
+
export async function appGet(url, repo, ws, app, options) {
|
|
63
|
+
return get(url, `${appsBase(repo, ws)}/${enc(app)}`, AppSummaryType, options);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A page of an app's kept versions, newest first (owner or admin).
|
|
67
|
+
*
|
|
68
|
+
* @param url - Base URL of the e3 API server
|
|
69
|
+
* @param repo - Repository name
|
|
70
|
+
* @param ws - Workspace name
|
|
71
|
+
* @param app - The app's name
|
|
72
|
+
* @param options - Request options including auth token
|
|
73
|
+
* @param page - The page's size and the cursor
|
|
74
|
+
* @returns The page and the next page's cursor
|
|
75
|
+
*/
|
|
76
|
+
export async function appVersions(url, repo, ws, app, options, page = {}) {
|
|
77
|
+
const query = new URLSearchParams();
|
|
78
|
+
if (page.limit !== undefined)
|
|
79
|
+
query.set('limit', String(page.limit));
|
|
80
|
+
if (page.cursor !== undefined)
|
|
81
|
+
query.set('cursor', page.cursor);
|
|
82
|
+
const text = query.toString();
|
|
83
|
+
return get(url, `${appsBase(repo, ws)}/${enc(app)}/versions${text === '' ? '' : `?${text}`}`, AppVersionPageType, options);
|
|
84
|
+
}
|
|
85
|
+
/** A SHA-256, in hex. */
|
|
86
|
+
async function sha256Hex(bytes) {
|
|
87
|
+
const digest = await globalThis.crypto.subtle.digest('SHA-256', bytes);
|
|
88
|
+
return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Uploads an app object (owner or admin): asks where its bytes go, then
|
|
92
|
+
* PUTs them there, to a URL that takes only bytes of their hash.
|
|
93
|
+
*
|
|
94
|
+
* @param url - Base URL of the e3 API server
|
|
95
|
+
* @param repo - Repository name
|
|
96
|
+
* @param ws - Workspace name
|
|
97
|
+
* @param app - The app's name
|
|
98
|
+
* @param bytes - The app object, as `@elaraai/e3-cloud-ui`'s `encodeAppObject` encodes it
|
|
99
|
+
* @param options - Request options including auth token
|
|
100
|
+
* @returns The source a deploy names: the upload, by its id
|
|
101
|
+
* @throws {Error} When the PUT is refused
|
|
102
|
+
*/
|
|
103
|
+
export async function appUpload(url, repo, ws, app, bytes, options) {
|
|
104
|
+
const hash = await sha256Hex(bytes);
|
|
105
|
+
const target = await post(url, `${appsBase(repo, ws)}/${enc(app)}/uploads`, { size: BigInt(bytes.byteLength), hash }, AppUploadRequestType, AppUploadType, options);
|
|
106
|
+
const response = await fetch(target.url, {
|
|
107
|
+
method: 'PUT',
|
|
108
|
+
headers: Object.fromEntries(target.headers),
|
|
109
|
+
body: bytes,
|
|
110
|
+
});
|
|
111
|
+
if (!response.ok)
|
|
112
|
+
throw new Error(`The upload of app '${app}' was refused: HTTP ${response.status} ${await response.text()}`);
|
|
113
|
+
return variant('upload', target.id);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Deploys an app (owner or admin): checked against the package it was
|
|
117
|
+
* built against; live at once when the workspace runs that package, or
|
|
118
|
+
* staged for the platform's next e3. A protected workspace, one with a
|
|
119
|
+
* staging, refuses it (`workspace_protected`) unless an admin forces it.
|
|
120
|
+
*
|
|
121
|
+
* @param url - Base URL of the e3 API server
|
|
122
|
+
* @param repo - Repository name
|
|
123
|
+
* @param ws - Workspace name
|
|
124
|
+
* @param app - The app's name
|
|
125
|
+
* @param request - Its object (an upload, or an object the repository holds), whether to stage it or only check it, and whether to force it
|
|
126
|
+
* @param options - Request options including auth token
|
|
127
|
+
* @returns `refused`, `checked`, `live` or `staged`
|
|
128
|
+
*/
|
|
129
|
+
export async function appDeploy(url, repo, ws, app, request, options) {
|
|
130
|
+
return post(url, `${appsBase(repo, ws)}/${enc(app)}/deploy`, { ...request, force: request.force ?? false }, AppDeployRequestType, AppDeployResponseType, options);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Deploys several apps built against one package, together (owner or admin):
|
|
134
|
+
* each is checked with the others in place of their current versions, and
|
|
135
|
+
* they switch together or not at all.
|
|
136
|
+
*
|
|
137
|
+
* @param url - Base URL of the e3 API server
|
|
138
|
+
* @param repo - Repository name
|
|
139
|
+
* @param ws - Workspace name
|
|
140
|
+
* @param request - The apps, whether to stage them or only check them, and whether to force them
|
|
141
|
+
* @param options - Request options including auth token
|
|
142
|
+
* @returns `refused`, `checked`, `live` or `staged`
|
|
143
|
+
*/
|
|
144
|
+
export async function appsDeploy(url, repo, ws, request, options) {
|
|
145
|
+
return post(url, appsBase(repo, ws), { ...request, force: request.force ?? false }, AppsDeployRequestType, AppDeployResponseType, options);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Removes an app (owner or admin): its current version and every version it
|
|
149
|
+
* keeps. A protected workspace, one with a staging, refuses it unless an
|
|
150
|
+
* admin forces it.
|
|
151
|
+
*
|
|
152
|
+
* @param url - Base URL of the e3 API server
|
|
153
|
+
* @param repo - Repository name
|
|
154
|
+
* @param ws - Workspace name
|
|
155
|
+
* @param app - The app's name
|
|
156
|
+
* @param options - Request options including auth token
|
|
157
|
+
* @param remove - Whether to force it past the workspace's protection
|
|
158
|
+
* @returns The app's name, and the users whose role names it, whose rows are left to an admin
|
|
159
|
+
*/
|
|
160
|
+
export async function appRemove(url, repo, ws, app, options, remove = {}) {
|
|
161
|
+
return del(url, `${appsBase(repo, ws)}/${enc(app)}${remove.force === true ? '?force=true' : ''}`, AppRemovedType, options);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The waits between polls of a deploy job: 100 ms, backing off to a second as
|
|
165
|
+
* e3-api-client's deploy polls do, and to 5 s once the job has run a minute.
|
|
166
|
+
*/
|
|
167
|
+
const JOB_POLL_MIN_MS = 100;
|
|
168
|
+
const JOB_POLL_MAX_MS = 1000;
|
|
169
|
+
const JOB_POLL_LONG_MS = 5000;
|
|
170
|
+
const JOB_LONG_AFTER_MS = 60_000;
|
|
171
|
+
/**
|
|
172
|
+
* Waits for the deploy job an app deployed with its package started
|
|
173
|
+
* (`deploying`): polls e3's `GET …/workspaces/:ws/deploy/:id` until it
|
|
174
|
+
* ends. Its apps are live once it has completed.
|
|
175
|
+
*
|
|
176
|
+
* @param url - Base URL of the e3 API server
|
|
177
|
+
* @param repo - Repository name
|
|
178
|
+
* @param ws - Workspace name
|
|
179
|
+
* @param job - The job, as `deploying` names it
|
|
180
|
+
* @param options - Request options including auth token
|
|
181
|
+
* @param waitOptions - Its progress and cancellation
|
|
182
|
+
* @returns What the deploy decided for each record, index and input
|
|
183
|
+
* @throws {Error} When the deploy fails: its apps stay as they were
|
|
184
|
+
*/
|
|
185
|
+
export async function appDeployWait(url, repo, ws, job, options, waitOptions = {}) {
|
|
186
|
+
const path = `/repos/${enc(repo)}/workspaces/${enc(ws)}/deploy/${enc(job)}`;
|
|
187
|
+
const started = Date.now();
|
|
188
|
+
for (let wait = JOB_POLL_MIN_MS;; wait = Math.min(wait * 2, JOB_POLL_MAX_MS)) {
|
|
189
|
+
waitOptions.signal?.throwIfAborted();
|
|
190
|
+
const status = await get(url, path, WorkspaceDeployStatusType, waitOptions.refresh === undefined ? options : await waitOptions.refresh());
|
|
191
|
+
if (status.type === 'completed')
|
|
192
|
+
return status.value;
|
|
193
|
+
if (status.type === 'failed')
|
|
194
|
+
throw new Error(`Workspace deploy failed: ${status.value.message}`);
|
|
195
|
+
waitOptions.onProgress?.(status.value);
|
|
196
|
+
const ran = Date.now() - started;
|
|
197
|
+
if (waitOptions.deadlineMs !== undefined && ran >= waitOptions.deadlineMs) {
|
|
198
|
+
throw new Error(`The deploy job ${job} is still running after ${Math.round(ran / 1000)} s: stopped waiting (it runs on; its history says how it ends)`);
|
|
199
|
+
}
|
|
200
|
+
await new Promise((resolve) => setTimeout(resolve, ran >= JOB_LONG_AFTER_MS ? JOB_POLL_LONG_MS : wait));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* The apps you can open across the repositories you belong to: every
|
|
205
|
+
* app of each repository you own, but a staging workspace's (the console
|
|
206
|
+
* reaches those by its switch), and the apps your business roles grant (a
|
|
207
|
+
* staging's too where a role names it), by repository,
|
|
208
|
+
* workspace and name, each its current version. The console's sidebar lists
|
|
209
|
+
* them; `myAccess` says which pages of each.
|
|
210
|
+
*
|
|
211
|
+
* @param url - Base URL of the e3 API server
|
|
212
|
+
* @param options - Request options including auth token
|
|
213
|
+
* @returns Your apps
|
|
214
|
+
*/
|
|
215
|
+
export async function myAppList(url, options) {
|
|
216
|
+
return get(url, '/me/apps', AppListType, options);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* The apps that need a rebuild in the repositories you manage (every
|
|
220
|
+
* repository, for an admin; those you own, else): each built with another e3
|
|
221
|
+
* than the platform runs, with no bundle built with it staged, by
|
|
222
|
+
* repository, workspace and name; with the e3 the platform runs. A platform
|
|
223
|
+
* deploy is refused while one has no build for the e3 it deploys.
|
|
224
|
+
*
|
|
225
|
+
* @param url - Base URL of the e3 API server
|
|
226
|
+
* @param options - Request options including auth token
|
|
227
|
+
* @returns The apps, and the platform's e3
|
|
228
|
+
*/
|
|
229
|
+
export async function myAppRebuilds(url, options) {
|
|
230
|
+
return get(url, '/me/rebuilds', AppRebuildsType, options);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* A repository's apps in every workspace, by workspace and name, each its
|
|
234
|
+
* current version and any staged bundle, with the e3 the platform runs
|
|
235
|
+
* (owner or admin): an app built with another e3, with no bundle built with
|
|
236
|
+
* the platform's staged, needs a rebuild.
|
|
237
|
+
*
|
|
238
|
+
* @param url - Base URL of the e3 API server
|
|
239
|
+
* @param repo - Repository name
|
|
240
|
+
* @param options - Request options including auth token
|
|
241
|
+
* @returns Its apps, and the platform's e3
|
|
242
|
+
*/
|
|
243
|
+
export async function repositoryAppList(url, repo, options) {
|
|
244
|
+
return get(url, `/repos/${encodeURIComponent(repo)}/apps`, RepositoryAppsType, options);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* A page of the deployment's apps, by repository, workspace and name, each
|
|
248
|
+
* its current version and any staged bundle, with the e3 the platform runs
|
|
249
|
+
* (admin).
|
|
250
|
+
*
|
|
251
|
+
* @param url - Base URL of the e3 API server
|
|
252
|
+
* @param options - Request options including auth token
|
|
253
|
+
* @param page - The page's size and the cursor
|
|
254
|
+
* @returns The page, the next page's cursor, and the platform's e3
|
|
255
|
+
*/
|
|
256
|
+
export async function adminAppList(url, options, page = {}) {
|
|
257
|
+
const query = new URLSearchParams();
|
|
258
|
+
if (page.limit !== undefined)
|
|
259
|
+
query.set('limit', String(page.limit));
|
|
260
|
+
if (page.cursor !== undefined)
|
|
261
|
+
query.set('cursor', page.cursor);
|
|
262
|
+
const text = query.toString();
|
|
263
|
+
return get(url, `/admin/apps${text === '' ? '' : `?${text}`}`, AdminAppPageType, options);
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=apps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/apps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,qBAAqB,GAYtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAA4D,MAAM,mBAAmB,CAAC;AAExH,M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GAAG,IAAI,eAAe,EAAE,CAAC;IACpC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;QAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAChE,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC9B,OAAO,GAAG,CAAC,GAAG,EAAE,cAAc,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Deployment execution-settings API — the admin-gated delegation
|
|
7
|
+
* policy, rack fleet, and enrollment endpoints under /admin/execution.
|
|
8
|
+
*/
|
|
9
|
+
import { DateTimeType, OptionType, StringType, StructType, type ValueTypeOf } from '@elaraai/east';
|
|
10
|
+
import { type DelegationPolicy, type RackActivityEntry, type RackRegistration, type RackSecurityPolicy } from '@elaraai/e3-cloud-types';
|
|
11
|
+
import { type RequestOptions } from '@elaraai/e3-api-client';
|
|
12
|
+
/** Wire shape of a minted enrollment token (mirrors the route): with the
|
|
13
|
+
* deployment's e3 version, the rack's default runtime. */
|
|
14
|
+
export declare const EnrollmentTokenType: StructType<{
|
|
15
|
+
readonly enrollmentToken: StringType;
|
|
16
|
+
readonly apiUrl: StringType;
|
|
17
|
+
readonly expiresAt: DateTimeType;
|
|
18
|
+
readonly e3Version: OptionType<StringType>;
|
|
19
|
+
}>;
|
|
20
|
+
export type EnrollmentToken = ValueTypeOf<typeof EnrollmentTokenType>;
|
|
21
|
+
/**
|
|
22
|
+
* Read the deployment's delegation policy (the disabled default when unset).
|
|
23
|
+
*/
|
|
24
|
+
export declare function getDelegationPolicy(url: string, options: RequestOptions): Promise<DelegationPolicy>;
|
|
25
|
+
/**
|
|
26
|
+
* Save the deployment's delegation policy.
|
|
27
|
+
*/
|
|
28
|
+
export declare function setDelegationPolicy(url: string, policy: DelegationPolicy, options: RequestOptions): Promise<DelegationPolicy>;
|
|
29
|
+
/**
|
|
30
|
+
* Read the deployment's rack security policy.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getRackSecurityPolicy(url: string, options: RequestOptions): Promise<RackSecurityPolicy>;
|
|
33
|
+
/**
|
|
34
|
+
* Save the deployment's rack security policy.
|
|
35
|
+
*/
|
|
36
|
+
export declare function setRackSecurityPolicy(url: string, policy: RackSecurityPolicy, options: RequestOptions): Promise<RackSecurityPolicy>;
|
|
37
|
+
/**
|
|
38
|
+
* List the enrolled rack fleet (health, tiers, capacity).
|
|
39
|
+
*/
|
|
40
|
+
export declare function listRacks(url: string, options: RequestOptions): Promise<RackRegistration[]>;
|
|
41
|
+
/**
|
|
42
|
+
* A rack's recent activity (leases claimed, newest first) — the fleet
|
|
43
|
+
* timeline, not task logs.
|
|
44
|
+
*/
|
|
45
|
+
export declare function rackActivity(url: string, rackId: string, options: RequestOptions): Promise<RackActivityEntry[]>;
|
|
46
|
+
/** Body of the boot-approval call (mirrors the route). */
|
|
47
|
+
export declare const ApproveBootRequestType: StructType<{
|
|
48
|
+
readonly bootId: StringType;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Approve a rack's reported boot (start approval). 409s if the rack
|
|
52
|
+
* rebooted since the fleet table was read — refresh and approve again.
|
|
53
|
+
*/
|
|
54
|
+
export declare function approveRackBoot(url: string, rackId: string, bootId: string, options: RequestOptions): Promise<RackRegistration>;
|
|
55
|
+
/**
|
|
56
|
+
* Mint a single-use rack enrollment token.
|
|
57
|
+
*/
|
|
58
|
+
export declare function enrollRack(url: string, options: RequestOptions): Promise<EnrollmentToken>;
|
|
59
|
+
/**
|
|
60
|
+
* Deregister a rack (revokes its token).
|
|
61
|
+
*/
|
|
62
|
+
export declare function deregisterRack(url: string, rackId: string, options: RequestOptions): Promise<boolean>;
|
|
63
|
+
//# sourceMappingURL=deployment-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-settings.d.ts","sourceRoot":"","sources":["../../src/deployment-settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,EAA0B,YAAY,EAAY,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACrI,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAIlF;2DAC2D;AAC3D,eAAO,MAAM,mBAAmB;;;;;EAK9B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAEzG;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAE7G;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,kBAAkB,CAAC,CAE7B;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAEjG;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAErH;AAED,0DAA0D;AAC1D,eAAO,MAAM,sBAAsB;;EAAqC,CAAC;AAEzE;;;GAGG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAE/F;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAE3G"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Deployment execution-settings API — the admin-gated delegation
|
|
7
|
+
* policy, rack fleet, and enrollment endpoints under /admin/execution.
|
|
8
|
+
*/
|
|
9
|
+
import { ArrayType, BooleanType, DateTimeType, NullType, OptionType, StringType, StructType } from '@elaraai/east';
|
|
10
|
+
import { DelegationPolicyType, RackActivityEntryType, RackRegistrationType, RackSecurityPolicyType, } from '@elaraai/e3-cloud-types';
|
|
11
|
+
import { get, put, post, del } from '@elaraai/e3-api-client';
|
|
12
|
+
const base = '/admin/execution';
|
|
13
|
+
/** Wire shape of a minted enrollment token (mirrors the route): with the
|
|
14
|
+
* deployment's e3 version, the rack's default runtime. */
|
|
15
|
+
export const EnrollmentTokenType = StructType({
|
|
16
|
+
enrollmentToken: StringType,
|
|
17
|
+
apiUrl: StringType,
|
|
18
|
+
expiresAt: DateTimeType,
|
|
19
|
+
e3Version: OptionType(StringType),
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Read the deployment's delegation policy (the disabled default when unset).
|
|
23
|
+
*/
|
|
24
|
+
export async function getDelegationPolicy(url, options) {
|
|
25
|
+
return get(url, `${base}/delegation`, DelegationPolicyType, options);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Save the deployment's delegation policy.
|
|
29
|
+
*/
|
|
30
|
+
export async function setDelegationPolicy(url, policy, options) {
|
|
31
|
+
return put(url, `${base}/delegation`, policy, DelegationPolicyType, DelegationPolicyType, options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Read the deployment's rack security policy.
|
|
35
|
+
*/
|
|
36
|
+
export async function getRackSecurityPolicy(url, options) {
|
|
37
|
+
return get(url, `${base}/security`, RackSecurityPolicyType, options);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Save the deployment's rack security policy.
|
|
41
|
+
*/
|
|
42
|
+
export async function setRackSecurityPolicy(url, policy, options) {
|
|
43
|
+
return put(url, `${base}/security`, policy, RackSecurityPolicyType, RackSecurityPolicyType, options);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* List the enrolled rack fleet (health, tiers, capacity).
|
|
47
|
+
*/
|
|
48
|
+
export async function listRacks(url, options) {
|
|
49
|
+
return get(url, `${base}/racks`, ArrayType(RackRegistrationType), options);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A rack's recent activity (leases claimed, newest first) — the fleet
|
|
53
|
+
* timeline, not task logs.
|
|
54
|
+
*/
|
|
55
|
+
export async function rackActivity(url, rackId, options) {
|
|
56
|
+
return get(url, `${base}/racks/${encodeURIComponent(rackId)}/activity`, ArrayType(RackActivityEntryType), options);
|
|
57
|
+
}
|
|
58
|
+
/** Body of the boot-approval call (mirrors the route). */
|
|
59
|
+
export const ApproveBootRequestType = StructType({ bootId: StringType });
|
|
60
|
+
/**
|
|
61
|
+
* Approve a rack's reported boot (start approval). 409s if the rack
|
|
62
|
+
* rebooted since the fleet table was read — refresh and approve again.
|
|
63
|
+
*/
|
|
64
|
+
export async function approveRackBoot(url, rackId, bootId, options) {
|
|
65
|
+
return post(url, `${base}/racks/${encodeURIComponent(rackId)}/approve`, { bootId }, ApproveBootRequestType, RackRegistrationType, options);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Mint a single-use rack enrollment token.
|
|
69
|
+
*/
|
|
70
|
+
export async function enrollRack(url, options) {
|
|
71
|
+
return post(url, `${base}/racks/enroll`, null, NullType, EnrollmentTokenType, options);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Deregister a rack (revokes its token).
|
|
75
|
+
*/
|
|
76
|
+
export async function deregisterRack(url, rackId, options) {
|
|
77
|
+
return del(url, `${base}/racks/${encodeURIComponent(rackId)}`, BooleanType, options);
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=deployment-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-settings.js","sourceRoot":"","sources":["../../src/deployment-settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAoB,MAAM,eAAe,CAAC;AACrI,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,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Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { type FeedbackList, type FeedbackMine, type FeedbackNote, type FeedbackSendRequest, type FeedbackSent, type FeedbackSettings } from '@elaraai/e3-cloud-types';
|
|
6
|
+
import { type RequestOptions } from '@elaraai/e3-api-client';
|
|
7
|
+
/** A note's status, as a request names it. */
|
|
8
|
+
export type FeedbackStatusName = 'open' | 'closed';
|
|
9
|
+
/** Which page of a list to read. */
|
|
10
|
+
export interface FeedbackListOptions {
|
|
11
|
+
/** Open or closed notes (default open) */
|
|
12
|
+
status?: FeedbackStatusName;
|
|
13
|
+
/** The page's size (server default 25, at most 50) */
|
|
14
|
+
limit?: number;
|
|
15
|
+
/** The previous page's `next` */
|
|
16
|
+
cursor?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Which note to read: its status, when the caller knows it, saves the server a read. */
|
|
19
|
+
export interface FeedbackNoteOptions {
|
|
20
|
+
status?: FeedbackStatusName;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Whether a workspace takes feedback. The UI asks once per workspace page.
|
|
24
|
+
*
|
|
25
|
+
* @param url - Base URL of the e3 API server
|
|
26
|
+
* @param repo - Repository name
|
|
27
|
+
* @param ws - Workspace name
|
|
28
|
+
* @param options - Request options including auth token
|
|
29
|
+
* @returns `{ enabled }`
|
|
30
|
+
*/
|
|
31
|
+
export declare function getFeedbackSettings(url: string, repo: string, ws: string, options: RequestOptions): Promise<FeedbackSettings>;
|
|
32
|
+
/**
|
|
33
|
+
* Turn a workspace's feedback on or off (owner or admin). Its notes are kept
|
|
34
|
+
* either way, and numbering goes on where it stopped.
|
|
35
|
+
*
|
|
36
|
+
* @param url - Base URL of the e3 API server
|
|
37
|
+
* @param repo - Repository name
|
|
38
|
+
* @param ws - Workspace name
|
|
39
|
+
* @param enabled - Whether the workspace takes feedback
|
|
40
|
+
* @param options - Request options including auth token
|
|
41
|
+
* @returns The workspace's settings, as set
|
|
42
|
+
*/
|
|
43
|
+
export declare function putFeedbackSettings(url: string, repo: string, ws: string, enabled: boolean, options: RequestOptions): Promise<FeedbackSettings>;
|
|
44
|
+
/**
|
|
45
|
+
* Send a note: its text, the page, the part, the data behind the view and the
|
|
46
|
+
* screenshot, in one body. The server adds the sender and the time.
|
|
47
|
+
*
|
|
48
|
+
* @param url - Base URL of the e3 API server
|
|
49
|
+
* @param repo - Repository name
|
|
50
|
+
* @param ws - Workspace name
|
|
51
|
+
* @param request - The note and its context
|
|
52
|
+
* @param options - Request options including auth token
|
|
53
|
+
* @returns The note's id (`FB-<number>`) and number
|
|
54
|
+
* @throws {ApiError} `feedback_disabled` while the workspace takes no
|
|
55
|
+
* feedback; `bad_request` naming a field past its limit
|
|
56
|
+
*/
|
|
57
|
+
export declare function addFeedback(url: string, repo: string, ws: string, request: FeedbackSendRequest, options: RequestOptions): Promise<FeedbackSent>;
|
|
58
|
+
/**
|
|
59
|
+
* A page of the caller's own notes of one status, newest first, each as a
|
|
60
|
+
* summary (its first 200 characters).
|
|
61
|
+
*
|
|
62
|
+
* @param url - Base URL of the e3 API server
|
|
63
|
+
* @param repo - Repository name
|
|
64
|
+
* @param ws - Workspace name
|
|
65
|
+
* @param options - Request options including auth token
|
|
66
|
+
* @param page - The status, the page's size and the cursor
|
|
67
|
+
* @returns The page and the next page's cursor
|
|
68
|
+
*/
|
|
69
|
+
export declare function listMyFeedback(url: string, repo: string, ws: string, options: RequestOptions, page?: FeedbackListOptions): Promise<FeedbackMine>;
|
|
70
|
+
/**
|
|
71
|
+
* A page of a workspace's notes of one status, newest first, each whole, and
|
|
72
|
+
* how many are open and closed (owner or admin).
|
|
73
|
+
*
|
|
74
|
+
* @param url - Base URL of the e3 API server
|
|
75
|
+
* @param repo - Repository name
|
|
76
|
+
* @param ws - Workspace name
|
|
77
|
+
* @param options - Request options including auth token
|
|
78
|
+
* @param page - The status, the page's size and the cursor
|
|
79
|
+
* @returns The page, the next page's cursor, and the counts
|
|
80
|
+
*/
|
|
81
|
+
export declare function listFeedback(url: string, repo: string, ws: string, options: RequestOptions, page?: FeedbackListOptions): Promise<FeedbackList>;
|
|
82
|
+
/**
|
|
83
|
+
* A note, whole (owner or admin, or its sender).
|
|
84
|
+
*
|
|
85
|
+
* @param url - Base URL of the e3 API server
|
|
86
|
+
* @param repo - Repository name
|
|
87
|
+
* @param ws - Workspace name
|
|
88
|
+
* @param number - The note's number
|
|
89
|
+
* @param options - Request options including auth token
|
|
90
|
+
* @param opts - Its status, when known
|
|
91
|
+
* @returns The note
|
|
92
|
+
* @throws {ApiError} `not_found` when the workspace has no such note (of that status)
|
|
93
|
+
*/
|
|
94
|
+
export declare function getFeedback(url: string, repo: string, ws: string, number: number | bigint, options: RequestOptions, opts?: FeedbackNoteOptions): Promise<FeedbackNote>;
|
|
95
|
+
/**
|
|
96
|
+
* Where a note's screenshot can be read: a URL good for 15 minutes, fetched
|
|
97
|
+
* without the API's auth (owner or admin, or its sender).
|
|
98
|
+
*
|
|
99
|
+
* @param url - Base URL of the e3 API server
|
|
100
|
+
* @param repo - Repository name
|
|
101
|
+
* @param ws - Workspace name
|
|
102
|
+
* @param number - The note's number
|
|
103
|
+
* @param options - Request options including auth token
|
|
104
|
+
* @param opts - Its status, when known
|
|
105
|
+
* @returns The URL
|
|
106
|
+
* @throws {ApiError} `not_found` when the note is not there, or was sent
|
|
107
|
+
* without a screenshot
|
|
108
|
+
*/
|
|
109
|
+
export declare function feedbackScreenshotUrl(url: string, repo: string, ws: string, number: number | bigint, options: RequestOptions, opts?: FeedbackNoteOptions): Promise<string>;
|
|
110
|
+
/**
|
|
111
|
+
* Close a note (owner or admin). Closing a closed note changes nothing.
|
|
112
|
+
*
|
|
113
|
+
* @param url - Base URL of the e3 API server
|
|
114
|
+
* @param repo - Repository name
|
|
115
|
+
* @param ws - Workspace name
|
|
116
|
+
* @param number - The note's number
|
|
117
|
+
* @param options - Request options including auth token
|
|
118
|
+
* @returns The note, closed
|
|
119
|
+
*/
|
|
120
|
+
export declare function closeFeedback(url: string, repo: string, ws: string, number: number | bigint, options: RequestOptions): Promise<FeedbackNote>;
|
|
121
|
+
/**
|
|
122
|
+
* Reopen a note (owner or admin). Reopening an open note changes nothing.
|
|
123
|
+
*
|
|
124
|
+
* @param url - Base URL of the e3 API server
|
|
125
|
+
* @param repo - Repository name
|
|
126
|
+
* @param ws - Workspace name
|
|
127
|
+
* @param number - The note's number
|
|
128
|
+
* @param options - Request options including auth token
|
|
129
|
+
* @returns The note, open
|
|
130
|
+
*/
|
|
131
|
+
export declare function reopenFeedback(url: string, repo: string, ws: string, number: number | bigint, options: RequestOptions): Promise<FeedbackNote>;
|
|
132
|
+
//# sourceMappingURL=feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../src/feedback.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7E,8CAA8C;AAC9C,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEnD,oCAAoC;AACpC,MAAM,WAAW,mBAAmB;IAClC,0CAA0C;IAC1C,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,yFAAyF;AACzF,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B;AAeD;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,EACX,IA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