@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
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import { type Schedule, type ScheduleRequest } from '@elaraai/e3-cloud-types';
6
+ import { type RequestOptions } from '@elaraai/e3-api-client';
7
+ /**
8
+ * Get the schedule for a workspace.
9
+ *
10
+ * @returns The schedule, or null if none exists
11
+ */
12
+ export declare function getSchedule(url: string, repo: string, workspace: string, options: RequestOptions): Promise<Schedule | null>;
13
+ /**
14
+ * Create or update a schedule for a workspace.
15
+ */
16
+ export declare function setSchedule(url: string, repo: string, workspace: string, request: ScheduleRequest, options: RequestOptions): Promise<Schedule>;
17
+ /**
18
+ * Delete a schedule for a workspace.
19
+ */
20
+ export declare function removeSchedule(url: string, repo: string, workspace: string, options: RequestOptions): Promise<void>;
21
+ /**
22
+ * List all schedules for a repository.
23
+ */
24
+ export declare function listSchedules(url: string, repo: string, options: RequestOptions): Promise<Schedule[]>;
25
+ //# sourceMappingURL=schedules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedules.d.ts","sourceRoot":"","sources":["../../src/schedules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEtF;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAc1B;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,QAAQ,CAAC,CASnB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAOrB"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Schedule management API functions using BEAST2 format.
7
+ */
8
+ import { ArrayType, NullType } from '@elaraai/east';
9
+ import { ScheduleType, ScheduleRequestType, } from '@elaraai/e3-cloud-types';
10
+ import { get, put, del, ApiError } from '@elaraai/e3-api-client';
11
+ /**
12
+ * Get the schedule for a workspace.
13
+ *
14
+ * @returns The schedule, or null if none exists
15
+ */
16
+ export async function getSchedule(url, repo, workspace, options) {
17
+ try {
18
+ return await get(url, `/repos/${encodeURIComponent(repo)}/workspaces/${encodeURIComponent(workspace)}/schedule`, ScheduleType, options);
19
+ }
20
+ catch (err) {
21
+ if (err instanceof ApiError && err.code === 'not_found') {
22
+ return null;
23
+ }
24
+ throw err;
25
+ }
26
+ }
27
+ /**
28
+ * Create or update a schedule for a workspace.
29
+ */
30
+ export async function setSchedule(url, repo, workspace, request, options) {
31
+ return put(url, `/repos/${encodeURIComponent(repo)}/workspaces/${encodeURIComponent(workspace)}/schedule`, request, ScheduleRequestType, ScheduleType, options);
32
+ }
33
+ /**
34
+ * Delete a schedule for a workspace.
35
+ */
36
+ export async function removeSchedule(url, repo, workspace, options) {
37
+ await del(url, `/repos/${encodeURIComponent(repo)}/workspaces/${encodeURIComponent(workspace)}/schedule`, NullType, options);
38
+ }
39
+ /**
40
+ * List all schedules for a repository.
41
+ */
42
+ export async function listSchedules(url, repo, options) {
43
+ return get(url, `/repos/${encodeURIComponent(repo)}/schedules`, ArrayType(ScheduleType), options);
44
+ }
45
+ //# sourceMappingURL=schedules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedules.js","sourceRoot":"","sources":["../../src/schedules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,mBAAmB,GAGpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAuB,MAAM,wBAAwB,CAAC;AAEtF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAW,EACX,IAAY,EACZ,SAAiB,EACjB,OAAuB;IAEvB,IAAI,CAAC;QACH,OAAO,MAAM,GAAG,CACd,GAAG,EACH,UAAU,kBAAkB,CAAC,IAAI,CAAC,eAAe,kBAAkB,CAAC,SAAS,CAAC,WAAW,EACzF,YAAY,EACZ,OAAO,CACR,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YACxD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAW,EACX,IAAY,EACZ,SAAiB,EACjB,OAAwB,EACxB,OAAuB;IAEvB,OAAO,GAAG,CACR,GAAG,EACH,UAAU,kBAAkB,CAAC,IAAI,CAAC,eAAe,kBAAkB,CAAC,SAAS,CAAC,WAAW,EACzF,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAW,EACX,IAAY,EACZ,SAAiB,EACjB,OAAuB;IAEvB,MAAM,GAAG,CACP,GAAG,EACH,UAAU,kBAAkB,CAAC,IAAI,CAAC,eAAe,kBAAkB,CAAC,SAAS,CAAC,WAAW,EACzF,QAAQ,EACR,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,GAAW,EACX,IAAY,EACZ,OAAuB;IAEvB,OAAO,GAAG,CACR,GAAG,EACH,UAAU,kBAAkB,CAAC,IAAI,CAAC,YAAY,EAC9C,SAAS,CAAC,YAAY,CAAC,EACvB,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import { type SecretList } from '@elaraai/e3-cloud-types';
6
+ import { type RequestOptions } from '@elaraai/e3-api-client';
7
+ /**
8
+ * List the repo's secrets — names and last-modified times only, never values.
9
+ */
10
+ export declare function listSecrets(url: string, repo: string, options: RequestOptions): Promise<SecretList>;
11
+ /**
12
+ * Set (create or overwrite) one secret. The value travels request-body-only;
13
+ * the runner injects it into task environments as `name`.
14
+ */
15
+ export declare function putSecret(url: string, repo: string, name: string, value: string, options: RequestOptions): Promise<void>;
16
+ /**
17
+ * Delete one secret. Deleting a non-existent name is a no-op.
18
+ */
19
+ export declare function deleteSecret(url: string, repo: string, name: string, options: RequestOptions): Promise<void>;
20
+ //# sourceMappingURL=secrets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/secrets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI5E;;GAEG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,UAAU,CAAC,CAErB;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CAEf"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Secrets API functions (per-repo task credentials) using BEAST2 format.
7
+ *
8
+ * The API surface is write-only: values flow IN through {@link putSecret} and
9
+ * are never returned by any endpoint — {@link listSecrets} exposes names and
10
+ * modification times only. Task code reads values at runtime with
11
+ * `Env.get("NAME")` (east-node-std); the platform injects them into the
12
+ * runner's process environment.
13
+ */
14
+ import { NullType } from '@elaraai/east';
15
+ import { SecretListType, SecretValueType } from '@elaraai/e3-cloud-types';
16
+ import { get, put, del } from '@elaraai/e3-api-client';
17
+ const basePath = (repo) => `/repos/${encodeURIComponent(repo)}/secrets`;
18
+ /**
19
+ * List the repo's secrets — names and last-modified times only, never values.
20
+ */
21
+ export async function listSecrets(url, repo, options) {
22
+ return get(url, basePath(repo), SecretListType, options);
23
+ }
24
+ /**
25
+ * Set (create or overwrite) one secret. The value travels request-body-only;
26
+ * the runner injects it into task environments as `name`.
27
+ */
28
+ export async function putSecret(url, repo, name, value, options) {
29
+ await put(url, `${basePath(repo)}/${encodeURIComponent(name)}`, { value }, SecretValueType, NullType, options);
30
+ }
31
+ /**
32
+ * Delete one secret. Deleting a non-existent name is a no-op.
33
+ */
34
+ export async function deleteSecret(url, repo, name, options) {
35
+ await del(url, `${basePath(repo)}/${encodeURIComponent(name)}`, NullType, options);
36
+ }
37
+ //# sourceMappingURL=secrets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../src/secrets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAmB,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAuB,MAAM,wBAAwB,CAAC;AAE5E,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,UAAU,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC;AAEhF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAW,EACX,IAAY,EACZ,OAAuB;IAEvB,OAAO,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;AAC3D,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,GAAW,EACX,IAAY,EACZ,IAAY,EACZ,KAAa,EACb,OAAuB;IAEvB,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACjH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,GAAW,EACX,IAAY,EACZ,IAAY,EACZ,OAAuB;IAEvB,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACrF,CAAC"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import { type ComputeSize, type ComputeConfigMap, type TaskTimeout, type TimeoutConfigMap, type TaskConfigs, type DelegationTarget, type WorkspaceWidth, type RepositorySettings } from '@elaraai/e3-cloud-types';
6
+ import { type RequestOptions } from '@elaraai/e3-api-client';
7
+ /**
8
+ * List all compute configs for a workspace.
9
+ */
10
+ export declare function listCompute(url: string, repo: string, workspace: string, options: RequestOptions): Promise<ComputeConfigMap>;
11
+ /**
12
+ * Get the compute config for a task.
13
+ */
14
+ export declare function getCompute(url: string, repo: string, workspace: string, taskName: string, options: RequestOptions): Promise<ComputeSize>;
15
+ /**
16
+ * Set the compute size for a task.
17
+ */
18
+ export declare function setCompute(url: string, repo: string, workspace: string, taskName: string, size: ComputeSize, options: RequestOptions): Promise<ComputeSize>;
19
+ /**
20
+ * Batch set compute configs for a workspace.
21
+ */
22
+ export declare function setComputeBatch(url: string, repo: string, workspace: string, configs: ComputeConfigMap, options: RequestOptions): Promise<ComputeConfigMap>;
23
+ /**
24
+ * Remove the compute config for a task.
25
+ */
26
+ export declare function removeCompute(url: string, repo: string, workspace: string, taskName: string, options: RequestOptions): Promise<void>;
27
+ /**
28
+ * List all timeout configs for a workspace.
29
+ */
30
+ export declare function listTimeout(url: string, repo: string, workspace: string, options: RequestOptions): Promise<TimeoutConfigMap>;
31
+ /**
32
+ * Get the timeout for a task (returns effective default if not explicitly set).
33
+ */
34
+ export declare function getTimeout(url: string, repo: string, workspace: string, taskName: string, options: RequestOptions): Promise<TaskTimeout>;
35
+ /**
36
+ * Set the timeout for a task.
37
+ */
38
+ export declare function setTimeout(url: string, repo: string, workspace: string, taskName: string, timeout: TaskTimeout, options: RequestOptions): Promise<TaskTimeout>;
39
+ /**
40
+ * Batch set timeout configs for a workspace.
41
+ */
42
+ export declare function setTimeoutBatch(url: string, repo: string, workspace: string, configs: TimeoutConfigMap, options: RequestOptions): Promise<TimeoutConfigMap>;
43
+ /**
44
+ * Remove several tasks' timeout configs at once, in one request.
45
+ *
46
+ * @returns The workspace's timeout configs left
47
+ */
48
+ export declare function removeTimeoutBatch(url: string, repo: string, workspace: string, taskNames: readonly string[], options: RequestOptions): Promise<TimeoutConfigMap>;
49
+ /**
50
+ * Remove the timeout config for a task.
51
+ */
52
+ export declare function removeTimeout(url: string, repo: string, workspace: string, taskName: string, options: RequestOptions): Promise<void>;
53
+ /**
54
+ * List all task configs (compute + timeout) for a workspace.
55
+ */
56
+ export declare function listTaskConfigs(url: string, repo: string, workspace: string, options: RequestOptions): Promise<TaskConfigs>;
57
+ /**
58
+ * Every workspace of a repository's settings, in one request (owner or
59
+ * admin): each one's task configs, task and function delegations, dataflow
60
+ * width, feedback switch and last run, by name.
61
+ */
62
+ export declare function repositorySettings(url: string, repo: string, options: RequestOptions): Promise<RepositorySettings>;
63
+ /**
64
+ * List all delegation overrides for a workspace.
65
+ */
66
+ export declare function listDelegation(url: string, repo: string, workspace: string, options: RequestOptions): Promise<Map<string, DelegationTarget>>;
67
+ /**
68
+ * Set the delegation override for a task (Rack or Cloud; remove = Auto).
69
+ */
70
+ export declare function setDelegation(url: string, repo: string, workspace: string, taskName: string, target: DelegationTarget, options: RequestOptions): Promise<DelegationTarget>;
71
+ /**
72
+ * Remove the delegation override for a task (back to Auto — follow policy).
73
+ */
74
+ export declare function removeDelegation(url: string, repo: string, workspace: string, taskName: string, options: RequestOptions): Promise<void>;
75
+ /**
76
+ * List all function delegation overrides for a workspace.
77
+ */
78
+ export declare function listFunctionDelegation(url: string, repo: string, workspace: string, options: RequestOptions): Promise<Map<string, DelegationTarget>>;
79
+ /**
80
+ * Opt a function into rack execution (or pin it to cloud).
81
+ */
82
+ export declare function setFunctionDelegation(url: string, repo: string, workspace: string, functionName: string, target: DelegationTarget, options: RequestOptions): Promise<DelegationTarget>;
83
+ /**
84
+ * Remove the function delegation override (back to cloud).
85
+ */
86
+ export declare function removeFunctionDelegation(url: string, repo: string, workspace: string, functionName: string, options: RequestOptions): Promise<void>;
87
+ /**
88
+ * Get a workspace's dataflow width: its own, if set, the deployment's, and the
89
+ * most it may be.
90
+ */
91
+ export declare function getWidth(url: string, repo: string, workspace: string, options: RequestOptions): Promise<WorkspaceWidth>;
92
+ /**
93
+ * Set a workspace's dataflow width: the tasks and units its runs keep in
94
+ * flight, from 1 to the deployment's most. A run takes it when it starts.
95
+ */
96
+ export declare function setWidth(url: string, repo: string, workspace: string, width: bigint, options: RequestOptions): Promise<WorkspaceWidth>;
97
+ /**
98
+ * Clear a workspace's dataflow width: its runs take the deployment's.
99
+ */
100
+ export declare function removeWidth(url: string, repo: string, workspace: string, options: RequestOptions): Promise<WorkspaceWidth>;
101
+ //# sourceMappingURL=task-configs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-configs.d.ts","sourceRoot":"","sources":["../../src/task-configs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAAwB,KAAK,gBAAgB,EAE7D,KAAK,cAAc,EAEnB,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAOlF;;GAEG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SA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,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAE3B;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CAEf;AAID;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC,CAEzB;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC,CAEzB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC,CAEzB"}
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Task config API functions using BEAST2 format.
7
+ */
8
+ import { ArrayType, DictType, IntegerType, NullType, StringType } from '@elaraai/east';
9
+ import { ComputeSizeType, ComputeConfigMapType, TaskTimeoutType, TimeoutConfigMapType, TaskConfigsType, DelegationTargetType, WorkspaceWidthType, RepositorySettingsType } from '@elaraai/e3-cloud-types';
10
+ import { get, post, put, del } from '@elaraai/e3-api-client';
11
+ const basePath = (repo, ws) => `/repos/${encodeURIComponent(repo)}/workspaces/${encodeURIComponent(ws)}/task-configs`;
12
+ // ── Compute ─────────────────────────────────────────────────────────────────
13
+ /**
14
+ * List all compute configs for a workspace.
15
+ */
16
+ export async function listCompute(url, repo, workspace, options) {
17
+ return get(url, `${basePath(repo, workspace)}/compute`, ComputeConfigMapType, options);
18
+ }
19
+ /**
20
+ * Get the compute config for a task.
21
+ */
22
+ export async function getCompute(url, repo, workspace, taskName, options) {
23
+ return get(url, `${basePath(repo, workspace)}/compute/${encodeURIComponent(taskName)}`, ComputeSizeType, options);
24
+ }
25
+ /**
26
+ * Set the compute size for a task.
27
+ */
28
+ export async function setCompute(url, repo, workspace, taskName, size, options) {
29
+ return put(url, `${basePath(repo, workspace)}/compute/${encodeURIComponent(taskName)}`, size, ComputeSizeType, ComputeSizeType, options);
30
+ }
31
+ /**
32
+ * Batch set compute configs for a workspace.
33
+ */
34
+ export async function setComputeBatch(url, repo, workspace, configs, options) {
35
+ return post(url, `${basePath(repo, workspace)}/compute`, configs, ComputeConfigMapType, ComputeConfigMapType, options);
36
+ }
37
+ /**
38
+ * Remove the compute config for a task.
39
+ */
40
+ export async function removeCompute(url, repo, workspace, taskName, options) {
41
+ await del(url, `${basePath(repo, workspace)}/compute/${encodeURIComponent(taskName)}`, NullType, options);
42
+ }
43
+ // ── Timeout ─────────────────────────────────────────────────────────────────
44
+ /**
45
+ * List all timeout configs for a workspace.
46
+ */
47
+ export async function listTimeout(url, repo, workspace, options) {
48
+ return get(url, `${basePath(repo, workspace)}/timeout`, TimeoutConfigMapType, options);
49
+ }
50
+ /**
51
+ * Get the timeout for a task (returns effective default if not explicitly set).
52
+ */
53
+ export async function getTimeout(url, repo, workspace, taskName, options) {
54
+ return get(url, `${basePath(repo, workspace)}/timeout/${encodeURIComponent(taskName)}`, TaskTimeoutType, options);
55
+ }
56
+ /**
57
+ * Set the timeout for a task.
58
+ */
59
+ export async function setTimeout(url, repo, workspace, taskName, timeout, options) {
60
+ return put(url, `${basePath(repo, workspace)}/timeout/${encodeURIComponent(taskName)}`, timeout, TaskTimeoutType, TaskTimeoutType, options);
61
+ }
62
+ /**
63
+ * Batch set timeout configs for a workspace.
64
+ */
65
+ export async function setTimeoutBatch(url, repo, workspace, configs, options) {
66
+ return post(url, `${basePath(repo, workspace)}/timeout`, configs, TimeoutConfigMapType, TimeoutConfigMapType, options);
67
+ }
68
+ /**
69
+ * Remove several tasks' timeout configs at once, in one request.
70
+ *
71
+ * @returns The workspace's timeout configs left
72
+ */
73
+ export async function removeTimeoutBatch(url, repo, workspace, taskNames, options) {
74
+ return post(url, `${basePath(repo, workspace)}/timeout/remove`, [...taskNames], ArrayType(StringType), TimeoutConfigMapType, options);
75
+ }
76
+ /**
77
+ * Remove the timeout config for a task.
78
+ */
79
+ export async function removeTimeout(url, repo, workspace, taskName, options) {
80
+ await del(url, `${basePath(repo, workspace)}/timeout/${encodeURIComponent(taskName)}`, NullType, options);
81
+ }
82
+ // ── Unified ─────────────────────────────────────────────────────────────────
83
+ /**
84
+ * List all task configs (compute + timeout) for a workspace.
85
+ */
86
+ export async function listTaskConfigs(url, repo, workspace, options) {
87
+ return get(url, basePath(repo, workspace), TaskConfigsType, options);
88
+ }
89
+ // ── A repository's settings ─────────────────────────────────────────────────
90
+ /**
91
+ * Every workspace of a repository's settings, in one request (owner or
92
+ * admin): each one's task configs, task and function delegations, dataflow
93
+ * width, feedback switch and last run, by name.
94
+ */
95
+ export async function repositorySettings(url, repo, options) {
96
+ return get(url, `/repos/${encodeURIComponent(repo)}/settings`, RepositorySettingsType, options);
97
+ }
98
+ // ── Delegation override (a task's location) ─────────────────────────────────
99
+ /**
100
+ * List all delegation overrides for a workspace.
101
+ */
102
+ export async function listDelegation(url, repo, workspace, options) {
103
+ return get(url, `${basePath(repo, workspace)}/delegation`, DictType(StringType, DelegationTargetType), options);
104
+ }
105
+ /**
106
+ * Set the delegation override for a task (Rack or Cloud; remove = Auto).
107
+ */
108
+ export async function setDelegation(url, repo, workspace, taskName, target, options) {
109
+ return put(url, `${basePath(repo, workspace)}/delegation/${encodeURIComponent(taskName)}`, target, DelegationTargetType, DelegationTargetType, options);
110
+ }
111
+ /**
112
+ * Remove the delegation override for a task (back to Auto — follow policy).
113
+ */
114
+ export async function removeDelegation(url, repo, workspace, taskName, options) {
115
+ await del(url, `${basePath(repo, workspace)}/delegation/${encodeURIComponent(taskName)}`, NullType, options);
116
+ }
117
+ // ── Function delegation (opt-in only, no policy matching) ───────────────────
118
+ /**
119
+ * List all function delegation overrides for a workspace.
120
+ */
121
+ export async function listFunctionDelegation(url, repo, workspace, options) {
122
+ return get(url, `${basePath(repo, workspace)}/function-delegation`, DictType(StringType, DelegationTargetType), options);
123
+ }
124
+ /**
125
+ * Opt a function into rack execution (or pin it to cloud).
126
+ */
127
+ export async function setFunctionDelegation(url, repo, workspace, functionName, target, options) {
128
+ return put(url, `${basePath(repo, workspace)}/function-delegation/${encodeURIComponent(functionName)}`, target, DelegationTargetType, DelegationTargetType, options);
129
+ }
130
+ /**
131
+ * Remove the function delegation override (back to cloud).
132
+ */
133
+ export async function removeFunctionDelegation(url, repo, workspace, functionName, options) {
134
+ await del(url, `${basePath(repo, workspace)}/function-delegation/${encodeURIComponent(functionName)}`, NullType, options);
135
+ }
136
+ // ── Dataflow width (owner or admin) ─────────────────────────────────────────
137
+ /**
138
+ * Get a workspace's dataflow width: its own, if set, the deployment's, and the
139
+ * most it may be.
140
+ */
141
+ export async function getWidth(url, repo, workspace, options) {
142
+ return get(url, `${basePath(repo, workspace)}/width`, WorkspaceWidthType, options);
143
+ }
144
+ /**
145
+ * Set a workspace's dataflow width: the tasks and units its runs keep in
146
+ * flight, from 1 to the deployment's most. A run takes it when it starts.
147
+ */
148
+ export async function setWidth(url, repo, workspace, width, options) {
149
+ return put(url, `${basePath(repo, workspace)}/width`, width, IntegerType, WorkspaceWidthType, options);
150
+ }
151
+ /**
152
+ * Clear a workspace's dataflow width: its runs take the deployment's.
153
+ */
154
+ export async function removeWidth(url, repo, workspace, options) {
155
+ return del(url, `${basePath(repo, workspace)}/width`, WorkspaceWidthType, options);
156
+ }
157
+ //# sourceMappingURL=task-configs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-configs.js","sourceRoot":"","sources":["../../src/task-configs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,eAAe,EAKG,oBAAoB,EACtC,kBAAkB,EAElB,sBAAsB,EACG,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAuB,MAAM,wBAAwB,CAAC;AAElF,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAU,EAAE,EAAE,CAC5C,UAAU,kBAAkB,CAAC,IAAI,CAAC,eAAe,kBAAkB,CAAC,EAAE,CAAC,eAAe,CAAC;AAEzF,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAW,EACX,IAAY,EACZ,SAAiB,EACjB,OAAuB;IAEvB,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,UAAU,EAAE,oBAAoB,EAAE,OAAO,CAAC,CAAC;AACzF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,GAAW,EACX,IAAY,EACZ,SAAiB,EACjB,QAAgB,EAChB,OAAuB;IAEvB,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,YAAY,kBAAkB,CAAC,QAAQ,CAAC,EAAE,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;AACpH,CAAC;AAED;;GAEG;AACH,MAAM,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vB,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,GAAW,EACX,IAAY,EACZ,SAAiB,EACjB,KAAa,EACb,OAAuB;IAEvB,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;AACzG,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAW,EACX,IAAY,EACZ,SAAiB,EACjB,OAAuB;IAEvB,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;AACrF,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Per-user per-workspace settings API functions.
7
+ *
8
+ * These functions use raw HTTP (application/octet-stream) rather than BEAST2
9
+ * because user settings are stored as opaque binary blobs.
10
+ */
11
+ import { type RequestOptions } from '@elaraai/e3-api-client';
12
+ /**
13
+ * Get user settings for the authenticated user in a workspace.
14
+ *
15
+ * @returns The settings binary data, or null if no settings exist.
16
+ * @throws {ApiError} On application-level errors
17
+ * @throws {AuthError} On 401 Unauthorized
18
+ */
19
+ export declare function getUserSettings(url: string, repo: string, workspace: string, options: RequestOptions): Promise<Uint8Array | null>;
20
+ /**
21
+ * Put user settings for the authenticated user in a workspace.
22
+ *
23
+ * @throws {ApiError} On application-level errors (not_found, conflict, payload_too_large)
24
+ * @throws {AuthError} On 401 Unauthorized
25
+ */
26
+ export declare function putUserSettings(url: string, repo: string, workspace: string, data: Uint8Array, options: RequestOptions): Promise<void>;
27
+ /**
28
+ * Delete user settings for the authenticated user in a workspace.
29
+ *
30
+ * @throws {ApiError} On application-level errors
31
+ * @throws {AuthError} On 401 Unauthorized
32
+ */
33
+ export declare function deleteUserSettings(url: string, repo: string, workspace: string, options: RequestOptions): Promise<void>;
34
+ //# sourceMappingURL=user-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-settings.d.ts","sourceRoot":"","sources":["../../src/user-settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAsBxF;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAW5B;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CAQf"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Per-user per-workspace settings API functions.
7
+ *
8
+ * These functions use raw HTTP (application/octet-stream) rather than BEAST2
9
+ * because user settings are stored as opaque binary blobs.
10
+ */
11
+ import { AuthError, parseErrorBody } from '@elaraai/e3-api-client';
12
+ function headers(options) {
13
+ const h = {};
14
+ if (options.token)
15
+ h['Authorization'] = `Bearer ${options.token}`;
16
+ return h;
17
+ }
18
+ function settingsPath(repo, workspace) {
19
+ return `/api/repos/${encodeURIComponent(repo)}/workspaces/${encodeURIComponent(workspace)}/user-settings`;
20
+ }
21
+ /**
22
+ * Throws a refusal as the rest of the client does: the route answers JSON
23
+ * `{ error: { type, message } }`, read by e3-api-client's `parseErrorBody`.
24
+ */
25
+ async function handleErrorResponse(res) {
26
+ const text = await res.text();
27
+ if (res.status === 401)
28
+ throw new AuthError(text || res.statusText);
29
+ throw parseErrorBody(text, `http_${res.status}`);
30
+ }
31
+ /**
32
+ * Get user settings for the authenticated user in a workspace.
33
+ *
34
+ * @returns The settings binary data, or null if no settings exist.
35
+ * @throws {ApiError} On application-level errors
36
+ * @throws {AuthError} On 401 Unauthorized
37
+ */
38
+ export async function getUserSettings(url, repo, workspace, options) {
39
+ const res = await fetch(`${url}${settingsPath(repo, workspace)}`, {
40
+ method: 'GET',
41
+ headers: headers(options),
42
+ });
43
+ if (res.status === 204)
44
+ return null;
45
+ if (!res.ok)
46
+ return handleErrorResponse(res);
47
+ const buffer = await res.arrayBuffer();
48
+ return new Uint8Array(buffer);
49
+ }
50
+ /**
51
+ * Put user settings for the authenticated user in a workspace.
52
+ *
53
+ * @throws {ApiError} On application-level errors (not_found, conflict, payload_too_large)
54
+ * @throws {AuthError} On 401 Unauthorized
55
+ */
56
+ export async function putUserSettings(url, repo, workspace, data, options) {
57
+ const res = await fetch(`${url}${settingsPath(repo, workspace)}`, {
58
+ method: 'PUT',
59
+ headers: { ...headers(options), 'Content-Type': 'application/octet-stream' },
60
+ body: data,
61
+ });
62
+ if (res.status === 204)
63
+ return;
64
+ if (!res.ok)
65
+ return handleErrorResponse(res);
66
+ }
67
+ /**
68
+ * Delete user settings for the authenticated user in a workspace.
69
+ *
70
+ * @throws {ApiError} On application-level errors
71
+ * @throws {AuthError} On 401 Unauthorized
72
+ */
73
+ export async function deleteUserSettings(url, repo, workspace, options) {
74
+ const res = await fetch(`${url}${settingsPath(repo, workspace)}`, {
75
+ method: 'DELETE',
76
+ headers: headers(options),
77
+ });
78
+ if (res.status === 204)
79
+ return;
80
+ if (!res.ok)
81
+ return handleErrorResponse(res);
82
+ }
83
+ //# sourceMappingURL=user-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-settings.js","sourceRoot":"","sources":["../../src/user-settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAuB,MAAM,wBAAwB,CAAC;AAExF,SAAS,OAAO,CAAC,OAAuB;IACtC,MAAM,CAAC,GAA2B,EAAE,CAAC;IACrC,IAAI,OAAO,CAAC,KAAK;QAAE,CAAC,CAAC,eAAe,CAAC,GAAG,UAAU,OAAO,CAAC,KAAK,EAAE,CAAC;IAClE,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,YAAY,CAAC,IAAY,EAAE,SAAiB;IACnD,OAAO,cAAc,kBAAkB,CAAC,IAAI,CAAC,eAAe,kBAAkB,CAAC,SAAS,CAAC,gBAAgB,CAAC;AAC5G,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,mBAAmB,CAAC,GAAa;IAC9C,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;QAAE,MAAM,IAAI,SAAS,CAAC,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IACpE,MAAM,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAW,EACX,IAAY,EACZ,SAAiB,EACjB,OAAuB;IAEvB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG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EH,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO;IAC/B,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,OAAO,mBAAmB,CAAC,GAAG,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import { type RepoInvitation, type RepoUser, type WhoamiResponse, type AddUserRequest } from '@elaraai/e3-cloud-types';
6
+ import { type RequestOptions } from '@elaraai/e3-api-client';
7
+ /**
8
+ * Get current user info.
9
+ *
10
+ * @param url - The base URL of the e3 server (e.g., 'https://e3.example.com')
11
+ * @param options - Request options including authentication token
12
+ * @returns The current user's identity and admin status
13
+ * @throws {ApiError} On application-level errors
14
+ * @throws {AuthError} On 401 Unauthorized
15
+ */
16
+ export declare function whoami(url: string, options: RequestOptions): Promise<WhoamiResponse>;
17
+ /**
18
+ * List users with access to a repository.
19
+ *
20
+ * Requires: owner role on the repository.
21
+ *
22
+ * @param url - The base URL of the e3 server
23
+ * @param repo - The repository name
24
+ * @param options - Request options including authentication token
25
+ * @returns List of users with access to the repository
26
+ * @throws {ApiError} On application-level errors
27
+ * @throws {AuthError} On 401 Unauthorized
28
+ */
29
+ export declare function repoUsers(url: string, repo: string, options: RequestOptions): Promise<RepoUser[]>;
30
+ /**
31
+ * Add a user to a repository.
32
+ *
33
+ * Requires: owner role on the repository.
34
+ *
35
+ * @param url - The base URL of the e3 server
36
+ * @param repo - The repository name
37
+ * @param request - The add user request containing email and role
38
+ * @param options - Request options including authentication token
39
+ * @returns The newly added user
40
+ * @throws {ApiError} On application-level errors (e.g., user_not_found, forbidden)
41
+ * @throws {AuthError} On 401 Unauthorized
42
+ */
43
+ export declare function addUser(url: string, repo: string, request: AddUserRequest, options: RequestOptions): Promise<RepoUser>;
44
+ /**
45
+ * Remove a user from a repository.
46
+ *
47
+ * Requires: owner role on the repository.
48
+ *
49
+ * @param url - The base URL of the e3 server
50
+ * @param repo - The repository name
51
+ * @param userId - The user ID to remove
52
+ * @param options - Request options including authentication token
53
+ * @throws {ApiError} On application-level errors (e.g., forbidden, last_owner)
54
+ * @throws {AuthError} On 401 Unauthorized
55
+ */
56
+ export declare function removeUser(url: string, repo: string, userId: string, options: RequestOptions): Promise<void>;
57
+ /**
58
+ * The people added to a repository who have not signed in yet: its pending
59
+ * invitations, each with the role its claim gives. Owner or admin.
60
+ * Their roles change as any person's do, by adding them again (`addUser`
61
+ * upserts an invitation's grant).
62
+ *
63
+ * @param url - The base URL of the e3 server
64
+ * @param repo - The repository name
65
+ * @param options - Request options including authentication token
66
+ * @returns The invitations, newest first
67
+ * @throws {ApiError} On application-level errors (e.g., forbidden)
68
+ * @throws {AuthError} On 401 Unauthorized
69
+ */
70
+ export declare function repoInvitations(url: string, repo: string, options: RequestOptions): Promise<RepoInvitation[]>;
71
+ /**
72
+ * Takes a repository's grant out of a pending invitation: someone added who
73
+ * has not signed in yet gets no access to it at their first sign-in.
74
+ * Owner or admin.
75
+ *
76
+ * @param url - The base URL of the e3 server
77
+ * @param repo - The repository name
78
+ * @param email - The invitee's email
79
+ * @param options - Request options including authentication token
80
+ * @throws {ApiError} On application-level errors (e.g., forbidden, user_not_found for no pending invitation)
81
+ * @throws {AuthError} On 401 Unauthorized
82
+ */
83
+ export declare function revokeRepoInvitation(url: string, repo: string, email: string, options: RequestOptions): Promise<void>;
84
+ //# sourceMappingURL=users.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/users.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;;;;;;;GAQG;AACH,wBAAsB,MAAM,C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