@elaraai/e3-cloud-client 0.0.0-stage → 1.0.89-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/LICENSE.md +54 -0
  2. package/README.md +238 -2
  3. package/dist/src/admin-users.d.ts +36 -0
  4. package/dist/src/admin-users.d.ts.map +1 -0
  5. package/dist/src/admin-users.js +56 -0
  6. package/dist/src/admin-users.js.map +1 -0
  7. package/dist/src/apps.d.ts +210 -0
  8. package/dist/src/apps.d.ts.map +1 -0
  9. package/dist/src/apps.js +265 -0
  10. package/dist/src/apps.js.map +1 -0
  11. package/dist/src/deployment-settings.d.ts +63 -0
  12. package/dist/src/deployment-settings.d.ts.map +1 -0
  13. package/dist/src/deployment-settings.js +79 -0
  14. package/dist/src/deployment-settings.js.map +1 -0
  15. package/dist/src/feedback.d.ts +132 -0
  16. package/dist/src/feedback.d.ts.map +1 -0
  17. package/dist/src/feedback.js +166 -0
  18. package/dist/src/feedback.js.map +1 -0
  19. package/dist/src/history.d.ts +126 -0
  20. package/dist/src/history.d.ts.map +1 -0
  21. package/dist/src/history.js +144 -0
  22. package/dist/src/history.js.map +1 -0
  23. package/dist/src/index.d.ts +64 -0
  24. package/dist/src/index.d.ts.map +1 -0
  25. package/dist/src/index.js +67 -0
  26. package/dist/src/index.js.map +1 -0
  27. package/dist/src/invitations.d.ts +17 -0
  28. package/dist/src/invitations.d.ts.map +1 -0
  29. package/dist/src/invitations.js +31 -0
  30. package/dist/src/invitations.js.map +1 -0
  31. package/dist/src/me.d.ts +11 -0
  32. package/dist/src/me.d.ts.map +1 -0
  33. package/dist/src/me.js +18 -0
  34. package/dist/src/me.js.map +1 -0
  35. package/dist/src/records.d.ts +127 -0
  36. package/dist/src/records.d.ts.map +1 -0
  37. package/dist/src/records.js +226 -0
  38. package/dist/src/records.js.map +1 -0
  39. package/dist/src/roles.d.ts +72 -0
  40. package/dist/src/roles.d.ts.map +1 -0
  41. package/dist/src/roles.js +95 -0
  42. package/dist/src/roles.js.map +1 -0
  43. package/dist/src/schedules.d.ts +25 -0
  44. package/dist/src/schedules.d.ts.map +1 -0
  45. package/dist/src/schedules.js +45 -0
  46. package/dist/src/schedules.js.map +1 -0
  47. package/dist/src/secrets.d.ts +20 -0
  48. package/dist/src/secrets.d.ts.map +1 -0
  49. package/dist/src/secrets.js +37 -0
  50. package/dist/src/secrets.js.map +1 -0
  51. package/dist/src/task-configs.d.ts +101 -0
  52. package/dist/src/task-configs.d.ts.map +1 -0
  53. package/dist/src/task-configs.js +157 -0
  54. package/dist/src/task-configs.js.map +1 -0
  55. package/dist/src/user-settings.d.ts +34 -0
  56. package/dist/src/user-settings.d.ts.map +1 -0
  57. package/dist/src/user-settings.js +83 -0
  58. package/dist/src/user-settings.js.map +1 -0
  59. package/dist/src/users.d.ts +84 -0
  60. package/dist/src/users.d.ts.map +1 -0
  61. package/dist/src/users.js +100 -0
  62. package/dist/src/users.js.map +1 -0
  63. package/package.json +23 -3
package/LICENSE.md ADDED
@@ -0,0 +1,54 @@
1
+ # Business Source License 1.1
2
+
3
+ Copyright (c) 2025 Elara AI Pty Ltd
4
+
5
+ ## License
6
+
7
+ **Licensor:** Elara AI Pty Ltd
8
+
9
+ **Licensed Work:** @elaraai/e3-cloud-client
10
+
11
+ **Change Date:** Four years from the date of each release
12
+
13
+ **Change License:** AGPL-3.0
14
+
15
+ ## Terms
16
+
17
+ The Licensed Work is provided under the terms of the Business Source License 1.1 as detailed below.
18
+
19
+ ### Grant of Rights
20
+
21
+ The Licensor grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work.
22
+
23
+ ### Production Use Limitation
24
+
25
+ **"Production Use"** means any use by or on behalf of a for-profit entity, other than for evaluation, testing, or development purposes.
26
+
27
+ Production Use requires a separate commercial license from the Licensor.
28
+
29
+ ### Change Date
30
+
31
+ On the Change Date (four years after each release), the Licensed Work will be made available under the Change License (AGPL-3.0).
32
+
33
+ ### No Warranty
34
+
35
+ THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. THE LICENSOR DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
36
+
37
+ ### Package-Specific Licenses
38
+
39
+ Individual packages within this repository may have different licensing terms. See the LICENSE.md file in each package directory for details.
40
+
41
+ ## Commercial Licensing
42
+
43
+ To obtain a commercial license for Production Use, contact:
44
+
45
+ **Email:** support@elara.ai
46
+ **Website:** https://elaraai.com
47
+
48
+ ## Governing Law
49
+
50
+ This license is governed by the laws of New South Wales, Australia.
51
+
52
+ ---
53
+
54
+ *Elara AI Pty Ltd*
package/README.md CHANGED
@@ -1,3 +1,239 @@
1
- # Temporary Holding Version
1
+ # @elaraai/e3-cloud-client
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ HTTP client library for the e3 cloud API: what e3's own API client
4
+ (`@elaraai/e3-api-client`) doesn't cover — users and roles, schedules, task
5
+ configs, secrets, record history and backups, feedback, apps, releases and
6
+ staging, and rack delegation.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @elaraai/e3-cloud-client
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```typescript
17
+ import { whoami, repoUsers, addUser, removeUser, ApiError } from '@elaraai/e3-cloud-client';
18
+ import { variant } from '@elaraai/east';
19
+
20
+ const options = { token: 'my-access-token' };
21
+
22
+ // Get current user
23
+ const me = await whoami('https://e3.example.com', options);
24
+ console.log(`Logged in as ${me.sub}, admin: ${me.isAdmin}`);
25
+
26
+ // List users on a repo
27
+ const users = await repoUsers('https://e3.example.com', 'my-repo', options);
28
+
29
+ // Add a user holding business roles
30
+ const newUser = await addUser(
31
+ 'https://e3.example.com',
32
+ 'my-repo',
33
+ { email: 'bob@example.com', role: variant('user', { roles: ['Rostering'] }) },
34
+ options
35
+ );
36
+
37
+ // Remove a user
38
+ await removeUser('https://e3.example.com', 'my-repo', 'user-id', options);
39
+ ```
40
+
41
+ ## API
42
+
43
+ ### `whoami(url, options): Promise<WhoamiResponse>`
44
+
45
+ Get current user info.
46
+
47
+ ### `repoUsers(url, repo, options): Promise<RepoUser[]>`
48
+
49
+ List the people of a repository (owner or admin).
50
+
51
+ ### `addUser(url, repo, request, options): Promise<RepoUser>`
52
+
53
+ Add a person to a repository, or change their role: an owner, or a user holding business roles the repository has (or the built-in `All apps`). 400 `bad_request` for a role it does not have.
54
+
55
+ ### Business roles
56
+
57
+ | Function | Answers |
58
+ |---|---|
59
+ | `listRoles(url, repo, options)` | A repository's roles, by name (owner or admin) |
60
+ | `getRole(url, repo, name, options)` | One; 404 `not_found` |
61
+ | `putRole(url, repo, role, options)` | Writes it whole, made or replaced, and answers it as stored; 400 `invalid_name` or `bad_request` (an app twice, no page, a page an app does not have). An app not deployed yet may be granted |
62
+ | `deleteRole(url, repo, name, options)` | Removes it, idempotently; 409 `role_in_use` while anyone holds it |
63
+ | `myAccess(url, options)` | What the caller's roles grant: each app, with its pages, in the repositories it is no owner of |
64
+
65
+ ### `removeUser(url, repo, userId, options): Promise<void>`
66
+
67
+ Remove a user from a repository.
68
+
69
+ ### The deployment's people (admin)
70
+
71
+ | Function | Answers |
72
+ |---|---|
73
+ | `listAdminUsers(url, options)` | Every person: the directory's users, the pending invitations, each one's memberships and last sign-in (Admin › Users) |
74
+ | `lookupPeople(url, { subs?, emails? }, options)` | The people of the given subjects and emails the directory holds (`PersonList`: each one's sub, email, name and whether they may sign in), each once: what a page needs to name who did something, never the whole directory. At most `PEOPLE_LOOKUP_MAX` (100) keys |
75
+ | `disableUser(url, sub, options)`, `enableUser(url, sub, options)` | Blocks or restores a person's sign-in; never the caller's own |
76
+
77
+ ### `listCompute(url, repo, workspace, options): Promise<ComputeConfigMap>`
78
+
79
+ List all compute configs for a workspace.
80
+
81
+ ### `getCompute(url, repo, workspace, taskName, options): Promise<ComputeSize>`
82
+
83
+ Get the compute size for a task.
84
+
85
+ ### `setCompute(url, repo, workspace, taskName, size, options): Promise<ComputeSize>`
86
+
87
+ Set the compute size for a task.
88
+
89
+ ### `setComputeBatch(url, repo, workspace, configs, options): Promise<ComputeConfigMap>`
90
+
91
+ Batch set compute configs for a workspace.
92
+
93
+ ### `removeCompute(url, repo, workspace, taskName, options): Promise<void>`
94
+
95
+ Remove the compute config for a task.
96
+
97
+ ### `listTimeout(url, repo, workspace, options): Promise<TimeoutConfigMap>`
98
+
99
+ List all timeout configs for a workspace.
100
+
101
+ ### `getTimeout(url, repo, workspace, taskName, options): Promise<TaskTimeout>`
102
+
103
+ Get the timeout for a task. Returns the effective default (15m for serverless, 1440m for sized) if not explicitly set.
104
+
105
+ ### `setTimeout(url, repo, workspace, taskName, timeout, options): Promise<TaskTimeout>`
106
+
107
+ Set the timeout for a task.
108
+
109
+ ### `setTimeoutBatch(url, repo, workspace, configs, options): Promise<TimeoutConfigMap>`
110
+
111
+ Batch set timeout configs for a workspace.
112
+
113
+ ### `removeTimeoutBatch(url, repo, workspace, taskNames, options): Promise<TimeoutConfigMap>`
114
+
115
+ Remove several tasks' timeouts in one request (`POST …/task-configs/timeout/remove`); answers those left. A compute config is removed in a batch by setting the task `serverless` (`setComputeBatch`).
116
+
117
+ ### `removeTimeout(url, repo, workspace, taskName, options): Promise<void>`
118
+
119
+ Remove the timeout config for a task.
120
+
121
+ ### `listTaskConfigs(url, repo, workspace, options): Promise<TaskConfigs>`
122
+
123
+ List all task configs (compute + timeout) for a workspace.
124
+
125
+ ### `repositorySettings(url, repo, options): Promise<RepositorySettings>`
126
+
127
+ Every workspace of a repository's settings in one request (owner or admin):
128
+ each one's task configs, task and function delegations, dataflow width (as
129
+ `getWidth` answers it), feedback switch and last run's summary
130
+ (`WorkspaceSettings`, by workspace).
131
+
132
+ ### Feedback
133
+
134
+ Notes users send about a part of a workspace's pages (`FB-<number>`). Owners,
135
+ admins, and users in a workspace they are granted an app of send and read
136
+ their own; owners and admins read every note, close and reopen them, and turn
137
+ feedback on or off.
138
+
139
+ | Function | Answers |
140
+ |---|---|
141
+ | `getFeedbackSettings(url, repo, ws, options)` | `{ enabled }` |
142
+ | `putFeedbackSettings(url, repo, ws, enabled, options)` | `{ enabled }` (owner or admin) |
143
+ | `addFeedback(url, repo, ws, request, options)` | `{ id, number }`; `feedback_disabled` while off, `bad_request` past a limit |
144
+ | `listMyFeedback(url, repo, ws, options, { status?, limit?, cursor? })` | `FeedbackMine`: the caller's own summaries, newest first, and `next` |
145
+ | `listFeedback(url, repo, ws, options, { status?, limit?, cursor? })` | `FeedbackList`: the workspace's notes, whole, `next` and `counts` (owner or admin) |
146
+ | `getFeedback(url, repo, ws, number, options, { status? })` | `FeedbackNote` (owner or admin, or its sender); `not_found` |
147
+ | `feedbackScreenshotUrl(url, repo, ws, number, options, { status? })` | a URL good for 15 minutes, fetched without the API's auth |
148
+ | `closeFeedback(url, repo, ws, number, options)`, `reopenFeedback(…)` | `FeedbackNote`, moved (owner or admin) |
149
+
150
+ `status` is `'open'` (the default for lists) or `'closed'`; passing it to a
151
+ note's reads saves the server a read. The `Feedback*` types and the limits
152
+ (`FEEDBACK_*`, `feedbackId`) are re-exported from `@elaraai/e3-cloud-types`.
153
+
154
+ ### Apps
155
+
156
+ Pages and menus deployed to a workspace, each its own deployable, built with
157
+ `@elaraai/e3-cloud-ui`. Owners and admins read every app, and a user the apps
158
+ their business roles grant; owners and admins upload, deploy, list versions
159
+ and remove.
160
+
161
+ | Function | Answers |
162
+ |---|---|
163
+ | `appList(url, repo, ws, options)` | the workspace's apps (`AppSummary[]`), each its current version |
164
+ | `appGet(url, repo, ws, app, options)` | `AppSummary`; `not_found` |
165
+ | `appVersions(url, repo, ws, app, options, { limit?, cursor? })` | `AppVersionPage`: kept versions, newest first, and `next` |
166
+ | `appUpload(url, repo, ws, app, bytes, options)` | the source a deploy names: asks where the app object's bytes go and PUTs them there |
167
+ | `appDeploy(url, repo, ws, app, { source, forPlatform, dryRun }, options)` | `AppDeployResponse`: `refused` (every problem), `checked`, `live` or `staged` |
168
+ | `appsDeploy(url, repo, ws, { apps, forPlatform, dryRun }, options)` | the same, for several apps together |
169
+ | `appRemove(url, repo, ws, app, options)` | `{ name, users }`: `users` is empty (a business role's grant of the app is kept, and gives it again if it is deployed again) |
170
+ | `appDeployWait(url, repo, ws, job, options, { onProgress?, signal?, refresh?, deadlineMs? })` | `WorkspaceDeployResult`: waits for the deploy job an app deployed with its package started (`deploying`), polling e3's `GET …/deploy/:id` (100 ms, backing off to 1 s, and to 5 s once the job has run a minute); `refresh` gives each poll its request options afresh (a token refreshed as it expires, for a deploy that outlives it); `deadlineMs` stops waiting (the job runs on); its apps are live once it completes; throws when the deploy fails, and the apps stay as they were |
171
+ | `myAppList(url, options)` | `AppList`: the apps you can open across the repositories you belong to — every app of each repository you own but a staging workspace's, and the apps your business roles grant — by repository, workspace and name; the console's sidebar lists them, `myAccess` says which pages |
172
+ | `repositoryAppList(url, repo, options)` | `RepositoryApps` (owner or admin): the repository's apps in every workspace, each its current version and any staged bundle, with the e3 the platform runs (`platform`): an app built with another e3 and with no bundle staged for it needs a rebuild |
173
+ | `myAppRebuilds(url, options)` | `AppRebuilds`: the apps that need a rebuild in the repositories you manage (every repository, for an admin; those you own, else), each built with another e3 than the platform runs with no bundle built with it staged, by repository, workspace and name, with the e3 the platform runs (`platform`); a platform deploy is refused while one has no build for the e3 it deploys |
174
+ | `adminAppList(url, options, { limit?, cursor? })` | `AdminAppPage` (admin): a page of the deployment's apps by repository, workspace and name, `next`, the e3 the platform runs (`platform`), and when each of the page's workspaces was last released to (`lastReleases`) |
175
+
176
+ A deploy throws `ApiError` with `package_missing` (import the package, then
177
+ deploy), `package_version_conflict`, `package_deploy_unavailable` (a server
178
+ that deploys no package with its apps), `package_differs`, `app_conflict` or
179
+ `workspace_busy`. An app built against another package than its workspace
180
+ runs answers `deploying`: the package deploys first, keeping the inputs
181
+ people set, and the app goes live as the job completes. `appProblemText`, `appProblemLines` and `appProblemsText`
182
+ print the problems; the `App*` types and limits are re-exported from
183
+ `@elaraai/e3-cloud-types`.
184
+
185
+ ### Staging, releases and history
186
+
187
+ A workspace's staging, another workspace of its repository that releases to
188
+ it, **protects** it: its package and apps then change only by a release from
189
+ its staging, or a rollback. A protected workspace refuses an app deploy or
190
+ removal (`workspace_protected`, naming its staging) unless an admin forces it
191
+ (`appDeploy`'s `force`, `appRemove`'s `{ force: true }`; anyone else asking is
192
+ `forbidden`), and its history records each forced change.
193
+
194
+ | Function | Answers |
195
+ |---|---|
196
+ | `addStaging(url, repo, live, { name, start, plan }, options)` | `AddStagingResponse` (owner or admin): `planned` or `added`, the plan (what it starts as: a copy of `live`, made or replacing a workspace of the name whole, or `as_is`; what a copy replaces; what it protects); `staging_conflict` when either is linked already, `not_found`, `workspace_busy` |
197
+ | `stopStaging(url, repo, live, options)` | `StagingLink` (admins alone): the staging and the workspace it no longer protects; nothing is deleted |
198
+ | `releaseWorkspace(url, repo, target, { from, carry, removeApps, plan }, options)` | `ReleaseResponse` (owner or admin; `from` must be the target's staging, else `not_staging`): `planned`, `refused` (its problems and checks in the plan; `nothing_to_release` when it would change nothing), `released` (its apps switched) or `releasing` (`{job, plan}`, the deploy job `appDeployWait` waits on); the plan's `undoes` names the changes forced onto the target since its last release, and each app's `stagedFor` the next e3's bundle it stages or clears |
199
+ | `rollbackWorkspace(url, repo, ws, { to, plan }, options)` | the same, for an entry of the workspace's history: the one `to` names, or (none) the newest completed one that differs from what it runs |
200
+ | `workspaceHistory(url, repo, ws, options, { limit?, before? })` | `WorkspaceHistoryPage`: entries newest first, and `next` |
201
+ | `repositoryHistory(url, repo, options)` | `RepositoryHistory` (owner or admin): every workspace with a history, in brief, by name: its newest entry, its newest under way and its newest completed change (`WorkspaceHistorySummary`), in one request |
202
+ | `workspaceHistoryEntry(url, repo, ws, id, options)` | `WorkspaceHistoryEntry` |
203
+ | `getReleaseSettings(url, repo, ws, options)` | where a workspace releases to, when it is a staging |
204
+ | `getRepositoryReleaseSettings(url, repo, options)` | `RepositoryReleaseSettings`: each staging, and the workspace it protects |
205
+
206
+ A release throws `ApiError` with `not_found`, `not_staging`, `workspace_busy`
207
+ (retry once the deploy, copy, removal or run that holds the target ends),
208
+ `source_changed`, `app_conflict`, `entry_not_completed`, `entry_not_a_change`
209
+ (a rollback to an entry that changed only a protection) or
210
+ `package_deploy_unavailable`. `releaseProblemText` and
211
+ `releasePlanRefusalLines` print a plan's problems; the `Release*` types and
212
+ `RELEASE_CARRY_MAX` are re-exported from `@elaraai/e3-cloud-types`.
213
+
214
+ ## Error Handling
215
+
216
+ All API functions throw on failure. Two error types are re-exported from `@elaraai/e3-api-client`:
217
+
218
+ - **`ApiError`** — Application-level errors (e.g., `forbidden`, `not_found`, `user_not_found`)
219
+ - **`AuthError`** — 401 Unauthorized (token expired or invalid)
220
+
221
+ ```typescript
222
+ import { whoami, ApiError, AuthError } from '@elaraai/e3-cloud-client';
223
+
224
+ try {
225
+ const me = await whoami(url, options);
226
+ console.log('User:', me.sub);
227
+ } catch (error) {
228
+ if (error instanceof AuthError) {
229
+ console.error('Not authenticated');
230
+ } else if (error instanceof ApiError) {
231
+ console.error('Error:', error.code, error.message);
232
+ }
233
+ }
234
+ ```
235
+
236
+ ## License
237
+
238
+ [BSL 1.1](./LICENSE.md). Production use needs a commercial license from Elara
239
+ AI Pty Ltd. Each release becomes AGPL-3.0 four years after it is released.
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import { type AdminUserList, type PersonList } from '@elaraai/e3-cloud-types';
6
+ import { type RequestOptions } from '@elaraai/e3-api-client';
7
+ /**
8
+ * List all deployment users (admin only), sorted by email.
9
+ */
10
+ export declare function listAdminUsers(url: string, options: RequestOptions): Promise<AdminUserList>;
11
+ /**
12
+ * Block a user's platform sign-in (admin only; never your own account).
13
+ *
14
+ * Takes effect at once: their next request is refused (`account_disabled`),
15
+ * with a token already issued too.
16
+ */
17
+ export declare function disableUser(url: string, sub: string, options: RequestOptions): Promise<void>;
18
+ /**
19
+ * Restore a user's platform sign-in (admin only).
20
+ */
21
+ export declare function enableUser(url: string, sub: string, options: RequestOptions): Promise<void>;
22
+ /**
23
+ * The people of the given subjects and emails, those the directory holds
24
+ * (admin): what a page needs to name who did something, never the whole
25
+ * directory. At most `PEOPLE_LOOKUP_MAX` subjects and emails together.
26
+ *
27
+ * @param url - Base URL of the e3 API server
28
+ * @param keys - The subjects and emails to look up
29
+ * @param options - Request options including auth token
30
+ * @returns The people found
31
+ */
32
+ export declare function lookupPeople(url: string, keys: {
33
+ subs?: readonly string[];
34
+ emails?: readonly string[];
35
+ }, options: RequestOptions): Promise<PersonList>;
36
+ //# sourceMappingURL=admin-users.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-users.d.ts","sourceRoot":"","sources":["../../src/admin-users.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,EAAqC,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACjH,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExE;;GAEG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAEjG;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAElG;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjG;AAID;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAM5J"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Deployment-level admin user API functions using BEAST2 format.
7
+ *
8
+ * One merged row per person: directory record, invitation state (with the
9
+ * identity provider's onboarding outcome), repo memberships and last seen. Disable/enable
10
+ * act on this platform only: the person's identity-provider account is
11
+ * unaffected.
12
+ */
13
+ import { NullType } from '@elaraai/east';
14
+ import { AdminUserListType, PersonListType } from '@elaraai/e3-cloud-types';
15
+ import { get, post } from '@elaraai/e3-api-client';
16
+ /**
17
+ * List all deployment users (admin only), sorted by email.
18
+ */
19
+ export async function listAdminUsers(url, options) {
20
+ return get(url, '/admin/users', AdminUserListType, options);
21
+ }
22
+ /**
23
+ * Block a user's platform sign-in (admin only; never your own account).
24
+ *
25
+ * Takes effect at once: their next request is refused (`account_disabled`),
26
+ * with a token already issued too.
27
+ */
28
+ export async function disableUser(url, sub, options) {
29
+ await post(url, `/admin/users/${encodeURIComponent(sub)}/disable`, null, NullType, NullType, options);
30
+ }
31
+ /**
32
+ * Restore a user's platform sign-in (admin only).
33
+ */
34
+ export async function enableUser(url, sub, options) {
35
+ await post(url, `/admin/users/${encodeURIComponent(sub)}/enable`, null, NullType, NullType, options);
36
+ }
37
+ /**
38
+ * The people of the given subjects and emails, those the directory holds
39
+ * (admin): what a page needs to name who did something, never the whole
40
+ * directory. At most `PEOPLE_LOOKUP_MAX` subjects and emails together.
41
+ *
42
+ * @param url - Base URL of the e3 API server
43
+ * @param keys - The subjects and emails to look up
44
+ * @param options - Request options including auth token
45
+ * @returns The people found
46
+ */
47
+ export async function lookupPeople(url, keys, options) {
48
+ const query = new URLSearchParams();
49
+ for (const sub of keys.subs ?? [])
50
+ query.append('sub', sub);
51
+ for (const email of keys.emails ?? [])
52
+ query.append('email', email);
53
+ const text = query.toString();
54
+ return get(url, `/admin/people${text === '' ? '' : `?${text}`}`, PersonListType, options);
55
+ }
56
+ //# sourceMappingURL=admin-users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-users.js","sourceRoot":"","sources":["../../src/admin-users.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAuC,MAAM,yBAAyB,CAAC;AACjH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,wBAAwB,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAW,EAAE,OAAuB;IACvE,OAAO,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,OAAuB;IACjF,MAAM,IAAI,CAAC,GAAG,EAAE,gBAAgB,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACxG,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,GAAW,EAAE,OAAuB;IAChF,MAAM,IAAI,CAAC,GAAG,EAAE,gBAAgB,kBAAkB,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACvG,CAAC;AAID;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAW,EAAE,IAA8D,EAAE,OAAuB;IACrI,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE,CAAC;IACpC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE;QAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC5D,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE;QAAE,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC9B,OAAO,GAAG,CAAC,GAAG,EAAE,gBAAgB,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;AAC5F,CAAC"}
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import { type AdminAppPage, type AppRebuilds, type RepositoryApps, type AppDeployRequest, type AppDeployResponse, type AppList, type AppRemoved, type AppSource, type AppSummary, type AppVersionPage, type AppsDeployRequest } from '@elaraai/e3-cloud-types';
6
+ import { type RequestOptions } from '@elaraai/e3-api-client';
7
+ import { type WorkspaceDeployProgress, type WorkspaceDeployResult } from '@elaraai/e3-types';
8
+ /** Which page of an app's versions to read. */
9
+ export interface AppVersionsOptions {
10
+ /** The page's size (server default 20, at most 50) */
11
+ limit?: number;
12
+ /** The previous page's `next` */
13
+ cursor?: string;
14
+ }
15
+ /**
16
+ * A workspace's apps, each its current version.
17
+ *
18
+ * @param url - Base URL of the e3 API server
19
+ * @param repo - Repository name
20
+ * @param ws - Workspace name
21
+ * @param options - Request options including auth token
22
+ * @returns The apps, by name
23
+ */
24
+ export declare function appList(url: string, repo: string, ws: string, options: RequestOptions): Promise<AppList>;
25
+ /**
26
+ * An app: its current version, the hash of the one before, and any bundle
27
+ * staged for the platform's next e3.
28
+ *
29
+ * @param url - Base URL of the e3 API server
30
+ * @param repo - Repository name
31
+ * @param ws - Workspace name
32
+ * @param app - The app's name
33
+ * @param options - Request options including auth token
34
+ * @returns The app
35
+ * @throws {ApiError} `not_found` when the workspace has no app of the name
36
+ */
37
+ export declare function appGet(url: string, repo: string, ws: string, app: string, options: RequestOptions): Promise<AppSummary>;
38
+ /**
39
+ * A page of an app's kept versions, newest first (owner or admin).
40
+ *
41
+ * @param url - Base URL of the e3 API server
42
+ * @param repo - Repository name
43
+ * @param ws - Workspace name
44
+ * @param app - The app's name
45
+ * @param options - Request options including auth token
46
+ * @param page - The page's size and the cursor
47
+ * @returns The page and the next page's cursor
48
+ */
49
+ export declare function appVersions(url: string, repo: string, ws: string, app: string, options: RequestOptions, page?: AppVersionsOptions): Promise<AppVersionPage>;
50
+ /**
51
+ * Uploads an app object (owner or admin): asks where its bytes go, then
52
+ * PUTs them there, to a URL that takes only bytes of their hash.
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 bytes - The app object, as `@elaraai/e3-cloud-ui`'s `encodeAppObject` encodes it
59
+ * @param options - Request options including auth token
60
+ * @returns The source a deploy names: the upload, by its id
61
+ * @throws {Error} When the PUT is refused
62
+ */
63
+ export declare function appUpload(url: string, repo: string, ws: string, app: string, bytes: Uint8Array, options: RequestOptions): Promise<AppSource>;
64
+ /**
65
+ * A deploy as {@link appDeploy} takes it: the request, `force` unset unless
66
+ * asked (only an admin forces a deploy past a workspace's
67
+ * protection).
68
+ */
69
+ export type AppDeployAsk = Omit<AppDeployRequest, 'force'> & {
70
+ readonly force?: boolean;
71
+ };
72
+ /** A deploy of several as {@link appsDeploy} takes it: `force` unset unless asked. */
73
+ export type AppsDeployAsk = Omit<AppsDeployRequest, 'force'> & {
74
+ readonly force?: boolean;
75
+ };
76
+ /**
77
+ * Deploys an app (owner or admin): checked against the package it was
78
+ * built against; live at once when the workspace runs that package, or
79
+ * staged for the platform's next e3. A protected workspace, one with a
80
+ * staging, refuses it (`workspace_protected`) unless an admin forces it.
81
+ *
82
+ * @param url - Base URL of the e3 API server
83
+ * @param repo - Repository name
84
+ * @param ws - Workspace name
85
+ * @param app - The app's name
86
+ * @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
87
+ * @param options - Request options including auth token
88
+ * @returns `refused`, `checked`, `live` or `staged`
89
+ */
90
+ export declare function appDeploy(url: string, repo: string, ws: string, app: string, request: AppDeployAsk, options: RequestOptions): Promise<AppDeployResponse>;
91
+ /**
92
+ * Deploys several apps built against one package, together (owner or admin):
93
+ * each is checked with the others in place of their current versions, and
94
+ * they switch together or not at all.
95
+ *
96
+ * @param url - Base URL of the e3 API server
97
+ * @param repo - Repository name
98
+ * @param ws - Workspace name
99
+ * @param request - The apps, whether to stage them or only check them, and whether to force them
100
+ * @param options - Request options including auth token
101
+ * @returns `refused`, `checked`, `live` or `staged`
102
+ */
103
+ export declare function appsDeploy(url: string, repo: string, ws: string, request: AppsDeployAsk, options: RequestOptions): Promise<AppDeployResponse>;
104
+ /** How {@link appRemove} removes an app. */
105
+ export interface AppRemoveOptions {
106
+ /**
107
+ * Remove it past its workspace's protection: admins
108
+ * only, recorded in the workspace's history as forced; without it a
109
+ * protected workspace refuses the removal (`workspace_protected`)
110
+ */
111
+ force?: boolean;
112
+ }
113
+ /**
114
+ * Removes an app (owner or admin): its current version and every version it
115
+ * keeps. A protected workspace, one with a staging, refuses it unless an
116
+ * admin forces it.
117
+ *
118
+ * @param url - Base URL of the e3 API server
119
+ * @param repo - Repository name
120
+ * @param ws - Workspace name
121
+ * @param app - The app's name
122
+ * @param options - Request options including auth token
123
+ * @param remove - Whether to force it past the workspace's protection
124
+ * @returns The app's name, and the users whose role names it, whose rows are left to an admin
125
+ */
126
+ export declare function appRemove(url: string, repo: string, ws: string, app: string, options: RequestOptions, remove?: AppRemoveOptions): Promise<AppRemoved>;
127
+ /** Which page of the deployment's apps to read. */
128
+ export interface AdminAppListOptions {
129
+ /** The page's size (server default 50, at most 100) */
130
+ limit?: number;
131
+ /** The previous page's `next` */
132
+ cursor?: string;
133
+ }
134
+ /** How {@link appDeployWait} waits for a deploy job. */
135
+ export interface AppDeployWaitOptions {
136
+ /** Called with the job's progress each time a poll finds it running */
137
+ onProgress?: (progress: WorkspaceDeployProgress) => void;
138
+ signal?: AbortSignal;
139
+ /**
140
+ * The request options for each poll, read afresh (a token refreshed as it
141
+ * expires, for a deploy that outlives it); absent, `options` throughout
142
+ */
143
+ refresh?: () => Promise<RequestOptions>;
144
+ /** How long to wait at most, in milliseconds, before giving up; absent, as long as the job runs */
145
+ deadlineMs?: number;
146
+ }
147
+ /**
148
+ * Waits for the deploy job an app deployed with its package started
149
+ * (`deploying`): polls e3's `GET …/workspaces/:ws/deploy/:id` until it
150
+ * ends. Its apps are live once it has completed.
151
+ *
152
+ * @param url - Base URL of the e3 API server
153
+ * @param repo - Repository name
154
+ * @param ws - Workspace name
155
+ * @param job - The job, as `deploying` names it
156
+ * @param options - Request options including auth token
157
+ * @param waitOptions - Its progress and cancellation
158
+ * @returns What the deploy decided for each record, index and input
159
+ * @throws {Error} When the deploy fails: its apps stay as they were
160
+ */
161
+ export declare function appDeployWait(url: string, repo: string, ws: string, job: string, options: RequestOptions, waitOptions?: AppDeployWaitOptions): Promise<WorkspaceDeployResult>;
162
+ /**
163
+ * The apps you can open across the repositories you belong to: every
164
+ * app of each repository you own, but a staging workspace's (the console
165
+ * reaches those by its switch), and the apps your business roles grant (a
166
+ * staging's too where a role names it), by repository,
167
+ * workspace and name, each its current version. The console's sidebar lists
168
+ * them; `myAccess` says which pages of each.
169
+ *
170
+ * @param url - Base URL of the e3 API server
171
+ * @param options - Request options including auth token
172
+ * @returns Your apps
173
+ */
174
+ export declare function myAppList(url: string, options: RequestOptions): Promise<AppList>;
175
+ /**
176
+ * The apps that need a rebuild in the repositories you manage (every
177
+ * repository, for an admin; those you own, else): each built with another e3
178
+ * than the platform runs, with no bundle built with it staged, by
179
+ * repository, workspace and name; with the e3 the platform runs. A platform
180
+ * deploy is refused while one has no build for the e3 it deploys.
181
+ *
182
+ * @param url - Base URL of the e3 API server
183
+ * @param options - Request options including auth token
184
+ * @returns The apps, and the platform's e3
185
+ */
186
+ export declare function myAppRebuilds(url: string, options: RequestOptions): Promise<AppRebuilds>;
187
+ /**
188
+ * A repository's apps in every workspace, by workspace and name, each its
189
+ * current version and any staged bundle, with the e3 the platform runs
190
+ * (owner or admin): an app built with another e3, with no bundle built with
191
+ * the platform's staged, needs a rebuild.
192
+ *
193
+ * @param url - Base URL of the e3 API server
194
+ * @param repo - Repository name
195
+ * @param options - Request options including auth token
196
+ * @returns Its apps, and the platform's e3
197
+ */
198
+ export declare function repositoryAppList(url: string, repo: string, options: RequestOptions): Promise<RepositoryApps>;
199
+ /**
200
+ * A page of the deployment's apps, by repository, workspace and name, each
201
+ * its current version and any staged bundle, with the e3 the platform runs
202
+ * (admin).
203
+ *
204
+ * @param url - Base URL of the e3 API server
205
+ * @param options - Request options including auth token
206
+ * @param page - The page's size and the cursor
207
+ * @returns The page, the next page's cursor, and the platform's e3
208
+ */
209
+ export declare function adminAppList(url: string, options: RequestOptions, page?: AdminAppListOptions): Promise<AdminAppPage>;
210
+ //# sourceMappingURL=apps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/apps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+BH,OAAO,EAaL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,wBAAwB,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