@parallelworks/client 7.113.0 → 7.116.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.
package/README.md CHANGED
@@ -106,6 +106,22 @@ export function BucketList() {
106
106
  }
107
107
  ```
108
108
 
109
+ ## Errors
110
+
111
+ The client asks for errors as [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem details. Outside a browser it sends `Accept-Language` from the locale environment (`LC_ALL`, `LC_MESSAGES`, `LANG`), or from the `acceptLanguage` option. `toApiError` reads any error, including an older server's error envelope, as an `ApiError` with a stable `code`, `params`, the invalid `fields`, and the server's detail as `message`:
112
+
113
+ ```ts
114
+ import { Client, problemTypeUrl, toApiError } from '@parallelworks/client'
115
+
116
+ const { error } = await client.GET('/api/buckets')
117
+ if (error) {
118
+ const problem = toApiError(error)
119
+ console.error(problem.code, problem.message)
120
+ for (const field of problem.fields) console.error(` ${field.path}: ${field.detail}`)
121
+ console.error(problemTypeUrl(problem, 'https://activate.parallel.works'))
122
+ }
123
+ ```
124
+
109
125
  ## Documentation
110
126
 
111
127
  For full API documentation, visit [https://parallelworks.com/docs](https://parallelworks.com/docs).
package/dist/index.d.ts CHANGED
@@ -1,10 +1,28 @@
1
+ import { type ApiError } from '@parallelworks/problem';
1
2
  import createClient, { type ClientOptions as OpenAPIClientOptions } from 'openapi-fetch';
2
3
  import type { paths } from './types/api';
3
4
  export type { paths };
4
5
  export type { components, operations } from './types/api';
6
+ export { ApiError, codeForStatus, FieldError, fromResponseBody, problemMediaType, toApiError, } from '@parallelworks/problem';
5
7
  type OpenAPIFetchClient = ReturnType<typeof createClient<paths>>;
6
8
  export interface ClientOptions extends Omit<OpenAPIClientOptions, 'baseUrl'> {
9
+ /**
10
+ * The Accept-Language for error details. Outside a browser it defaults to
11
+ * the locale environment (see `acceptLanguageFromEnv`).
12
+ */
13
+ acceptLanguage?: string;
7
14
  }
15
+ /**
16
+ * The language of the POSIX locale environment (LC_ALL, then LC_MESSAGES,
17
+ * then LANG) as a language tag: `ja_JP.UTF-8` is `ja-JP`. Undefined when none
18
+ * is set or the locale is C or POSIX.
19
+ */
20
+ export declare function acceptLanguageFromEnv(env?: Record<string, string | undefined>): string | undefined;
21
+ /**
22
+ * The absolute URL documenting an error's problem type, resolved against the
23
+ * API's base URL. Undefined for `about:blank`, which documents nothing.
24
+ */
25
+ export declare function problemTypeUrl(error: ApiError, baseUrl: string): string | undefined;
8
26
  /** Prefix for Parallel Works API keys */
9
27
  export declare const API_KEY_PREFIX = "pwt_";
10
28
  /** Error thrown when credential parsing fails */
package/dist/index.js CHANGED
@@ -1,4 +1,34 @@
1
+ import { problemMiddleware } from '@parallelworks/problem';
1
2
  import createClient from 'openapi-fetch';
3
+ export { ApiError, codeForStatus, FieldError, fromResponseBody, problemMediaType, toApiError, } from '@parallelworks/problem';
4
+ /**
5
+ * The language of the POSIX locale environment (LC_ALL, then LC_MESSAGES,
6
+ * then LANG) as a language tag: `ja_JP.UTF-8` is `ja-JP`. Undefined when none
7
+ * is set or the locale is C or POSIX.
8
+ */
9
+ export function acceptLanguageFromEnv(env = globalThis.process?.env ?? {}) {
10
+ const locale = env['LC_ALL'] || env['LC_MESSAGES'] || env['LANG'];
11
+ const tag = locale?.split('.')[0]?.split('@')[0];
12
+ if (!tag || tag === 'C' || tag === 'POSIX' || !/^[\w-]+$/.test(tag)) {
13
+ return undefined;
14
+ }
15
+ return tag.replace(/_/g, '-');
16
+ }
17
+ /**
18
+ * The absolute URL documenting an error's problem type, resolved against the
19
+ * API's base URL. Undefined for `about:blank`, which documents nothing.
20
+ */
21
+ export function problemTypeUrl(error, baseUrl) {
22
+ if (error.type === 'about:blank') {
23
+ return undefined;
24
+ }
25
+ try {
26
+ return new URL(error.type, baseUrl).toString();
27
+ }
28
+ catch {
29
+ return undefined;
30
+ }
31
+ }
2
32
  /** Prefix for Parallel Works API keys */
3
33
  export const API_KEY_PREFIX = 'pwt_';
4
34
  /** Error thrown when credential parsing fails */
@@ -236,22 +266,28 @@ export class Client {
236
266
  * @returns Configured openapi-fetch client instance
237
267
  */
238
268
  build() {
269
+ const { acceptLanguage: language, ...options } = this.options;
270
+ const acceptLanguage = language ??
271
+ (typeof document === 'undefined' ? acceptLanguageFromEnv() : undefined);
239
272
  const client = createClient({
240
273
  baseUrl: this.baseUrl,
241
- ...this.options,
274
+ ...options,
242
275
  headers: {
243
- ...this.options.headers,
276
+ ...(acceptLanguage && { 'Accept-Language': acceptLanguage }),
277
+ ...options.headers,
244
278
  ...(this.authHeader && { Authorization: this.authHeader }),
245
279
  },
246
280
  });
281
+ client.use(problemMiddleware);
247
282
  // Attach HTTP status code to error response bodies so consumers
248
283
  // (e.g. SWR hooks) can distinguish 404s from other errors.
249
284
  // openapi-fetch parses the body after middleware, so we replace the
250
285
  // response with one whose body includes the status field.
251
- // Also guarantee `message` is populated — upstream infrastructure (WAFs,
252
- // proxies) can return non-2xx with an empty body, which would otherwise
253
- // short-circuit openapi-fetch (it returns `error: undefined` when
254
- // Content-Length is 0) and leave consumers with no error to react to.
286
+ // Also guarantee `message` is populated, from a problem's detail when it
287
+ // has one: upstream infrastructure (WAFs, proxies) can return non-2xx with
288
+ // an empty body, which would otherwise short-circuit openapi-fetch (it
289
+ // returns `error: undefined` when Content-Length is 0) and leave consumers
290
+ // with no error to react to.
255
291
  const statusMiddleware = {
256
292
  async onResponse({ response }) {
257
293
  if (!response.ok) {
@@ -262,7 +298,8 @@ export class Client {
262
298
  record['status'] = response.status;
263
299
  if (typeof record['message'] !== 'string' || !record['message']) {
264
300
  record['message'] =
265
- response.statusText ||
301
+ (typeof record['detail'] === 'string' && record['detail']) ||
302
+ response.statusText ||
266
303
  `Request failed with status ${response.status}`;
267
304
  }
268
305
  // Strip Content-Length from the original headers — we're replacing
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,108 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { acceptLanguageFromEnv, Client, problemMediaType, problemTypeUrl, toApiError, } from './index';
3
+ function respond(status, body, contentType) {
4
+ const requests = [];
5
+ const fetch = async (input) => {
6
+ requests.push(input);
7
+ return new Response(body, {
8
+ status,
9
+ statusText: status === 502 ? 'Bad Gateway' : '',
10
+ headers: { 'Content-Type': contentType },
11
+ });
12
+ };
13
+ return { fetch, requests };
14
+ }
15
+ async function failedRequest(status, body, contentType = problemMediaType) {
16
+ const { fetch, requests } = respond(status, body, contentType);
17
+ const client = new Client('https://activate.parallel.works', {
18
+ fetch,
19
+ acceptLanguage: 'ja-JP',
20
+ }).withToken('a.b.c');
21
+ const { error } = await client.GET('/api/workflows');
22
+ return { error: toApiError(error), raw: error, request: requests[0] };
23
+ }
24
+ describe('Client', () => {
25
+ it('asks for problem details in the chosen language', async () => {
26
+ const { request } = await failedRequest(404, '{}');
27
+ expect(request.headers.get('Accept')).toContain(problemMediaType);
28
+ expect(request.headers.get('Accept-Language')).toBe('ja-JP');
29
+ });
30
+ it('reads a problem', async () => {
31
+ const { error, raw } = await failedRequest(404, JSON.stringify({
32
+ type: '/problems/activate/workflow_not_found',
33
+ status: 404,
34
+ detail: 'ワークフローが見つかりません',
35
+ code: 'workflow_not_found',
36
+ params: { name: 'x' },
37
+ }));
38
+ expect(error.code).toBe('workflow_not_found');
39
+ expect(error.status).toBe(404);
40
+ expect(error.message).toBe('ワークフローが見つかりません');
41
+ expect(error.params).toEqual({ name: 'x' });
42
+ expect(raw).toMatchObject({ message: 'ワークフローが見つかりません' });
43
+ expect(problemTypeUrl(error, 'https://activate.parallel.works')).toBe('https://activate.parallel.works/problems/activate/workflow_not_found');
44
+ });
45
+ it('derives the code of an about:blank problem from its status', async () => {
46
+ const { error } = await failedRequest(403, JSON.stringify({ type: 'about:blank', status: 403, title: 'Forbidden' }));
47
+ expect(error.code).toBe('forbidden');
48
+ expect(problemTypeUrl(error, 'https://activate.parallel.works')).toBe(undefined);
49
+ });
50
+ it('reads the invalid fields of a validation problem', async () => {
51
+ const { error } = await failedRequest(422, JSON.stringify({
52
+ type: '/problems/activate/validation',
53
+ status: 422,
54
+ detail: 'validation failed',
55
+ code: 'validation',
56
+ errors: [
57
+ {
58
+ type: '/problems/activate/too_long',
59
+ code: 'too_long',
60
+ detail: 'too long',
61
+ pointer: '#/items/0/name',
62
+ params: { max: 3 },
63
+ },
64
+ {
65
+ type: '/problems/activate/required',
66
+ code: 'required',
67
+ parameter: 'org',
68
+ in: 'query',
69
+ },
70
+ ],
71
+ }));
72
+ expect(error.code).toBe('validation');
73
+ expect(error.fields.map(f => [f.path, f.code, f.params])).toEqual([
74
+ ['items[0].name', 'too_long', { max: 3 }],
75
+ ['org', 'required', {}],
76
+ ]);
77
+ });
78
+ it('reads the older envelope', async () => {
79
+ const { error } = await failedRequest(404, JSON.stringify({
80
+ error: true,
81
+ message: 'Workflow not found',
82
+ code: 'workflow_not_found',
83
+ }), 'application/json');
84
+ expect(error.code).toBe('workflow_not_found');
85
+ expect(error.message).toBe('Workflow not found');
86
+ });
87
+ it("reads a proxy's page", async () => {
88
+ const { error } = await failedRequest(502, '<html><body>Bad Gateway</body></html>', 'text/html');
89
+ expect(error.status).toBe(502);
90
+ expect(error.code).toBe('internal');
91
+ expect(error.message).toBe('Bad Gateway');
92
+ });
93
+ });
94
+ describe('acceptLanguageFromEnv', () => {
95
+ it.each([
96
+ [{ LANG: 'ja_JP.UTF-8' }, 'ja-JP'],
97
+ [{ LANG: 'de_DE.UTF-8@euro' }, 'de-DE'],
98
+ [{ LANG: 'es' }, 'es'],
99
+ [{ LANG: 'C' }, undefined],
100
+ [{ LANG: 'C.UTF-8' }, undefined],
101
+ [{ LANG: 'POSIX' }, undefined],
102
+ [{}, undefined],
103
+ [{ LC_MESSAGES: 'ko_KR.UTF-8', LANG: 'en_US.UTF-8' }, 'ko-KR'],
104
+ [{ LC_ALL: 'fr_FR.UTF-8', LC_MESSAGES: 'ko_KR.UTF-8' }, 'fr-FR'],
105
+ ])('%o is %s', (env, want) => {
106
+ expect(acceptLanguageFromEnv(env)).toBe(want);
107
+ });
108
+ });
@@ -128,6 +128,150 @@ export interface paths {
128
128
  patch?: never;
129
129
  trace?: never;
130
130
  };
131
+ "/api/admin/background-jobs": {
132
+ parameters: {
133
+ query?: never;
134
+ header?: never;
135
+ path?: never;
136
+ cookie?: never;
137
+ };
138
+ /**
139
+ * List background jobs
140
+ * @description > This is a system-level route, so the response will be independent of the currently authenticated user.
141
+ *
142
+ * > This is a platform-admin only route.
143
+ *
144
+ * Returns background jobs, waiting, running and finished, oldest first
145
+ */
146
+ get: operations["list-background-jobs"];
147
+ put?: never;
148
+ post?: never;
149
+ delete?: never;
150
+ options?: never;
151
+ head?: never;
152
+ patch?: never;
153
+ trace?: never;
154
+ };
155
+ "/api/admin/background-jobs/overview": {
156
+ parameters: {
157
+ query?: never;
158
+ header?: never;
159
+ path?: never;
160
+ cookie?: never;
161
+ };
162
+ /**
163
+ * Get background job queues and workers
164
+ * @description > This is a system-level route, so the response will be independent of the currently authenticated user.
165
+ *
166
+ * > This is a platform-admin only route.
167
+ *
168
+ * Returns the depth of every background job queue and the workers taking jobs from them
169
+ */
170
+ get: operations["get-background-jobs-overview"];
171
+ put?: never;
172
+ post?: never;
173
+ delete?: never;
174
+ options?: never;
175
+ head?: never;
176
+ patch?: never;
177
+ trace?: never;
178
+ };
179
+ "/api/admin/background-jobs/queues/{queue}/pause": {
180
+ parameters: {
181
+ query?: never;
182
+ header?: never;
183
+ path?: never;
184
+ cookie?: never;
185
+ };
186
+ get?: never;
187
+ put?: never;
188
+ /**
189
+ * Pause a background job queue
190
+ * @description > This is a system-level route, so the response will be independent of the currently authenticated user.
191
+ *
192
+ * > This is a platform-admin only route.
193
+ *
194
+ * Stops workers taking jobs from the queue. Running jobs finish and new jobs keep queueing
195
+ */
196
+ post: operations["pause-background-job-queue"];
197
+ delete?: never;
198
+ options?: never;
199
+ head?: never;
200
+ patch?: never;
201
+ trace?: never;
202
+ };
203
+ "/api/admin/background-jobs/queues/{queue}/resume": {
204
+ parameters: {
205
+ query?: never;
206
+ header?: never;
207
+ path?: never;
208
+ cookie?: never;
209
+ };
210
+ get?: never;
211
+ put?: never;
212
+ /**
213
+ * Resume a background job queue
214
+ * @description > This is a system-level route, so the response will be independent of the currently authenticated user.
215
+ *
216
+ * > This is a platform-admin only route.
217
+ *
218
+ * Lets workers take jobs from a paused queue again
219
+ */
220
+ post: operations["resume-background-job-queue"];
221
+ delete?: never;
222
+ options?: never;
223
+ head?: never;
224
+ patch?: never;
225
+ trace?: never;
226
+ };
227
+ "/api/admin/background-jobs/{jobId}/cancel": {
228
+ parameters: {
229
+ query?: never;
230
+ header?: never;
231
+ path?: never;
232
+ cookie?: never;
233
+ };
234
+ get?: never;
235
+ put?: never;
236
+ /**
237
+ * Cancel a background job
238
+ * @description > This is a system-level route, so the response will be independent of the currently authenticated user.
239
+ *
240
+ * > This is a platform-admin only route.
241
+ *
242
+ * Cancels a waiting job, or asks the worker running it to stop. A finished job is returned unchanged
243
+ */
244
+ post: operations["cancel-background-job"];
245
+ delete?: never;
246
+ options?: never;
247
+ head?: never;
248
+ patch?: never;
249
+ trace?: never;
250
+ };
251
+ "/api/admin/background-jobs/{jobId}/retry": {
252
+ parameters: {
253
+ query?: never;
254
+ header?: never;
255
+ path?: never;
256
+ cookie?: never;
257
+ };
258
+ get?: never;
259
+ put?: never;
260
+ /**
261
+ * Retry a background job
262
+ * @description > This is a system-level route, so the response will be independent of the currently authenticated user.
263
+ *
264
+ * > This is a platform-admin only route.
265
+ *
266
+ * Runs a job again as soon as possible. A cancelled or discarded job gets one more attempt; a waiting job has its schedule brought forward
267
+ */
268
+ post: operations["retry-background-job"];
269
+ delete?: never;
270
+ options?: never;
271
+ head?: never;
272
+ patch?: never;
273
+ trace?: never;
274
+ };
131
275
  "/api/admin/billing/crosscheck": {
132
276
  parameters: {
133
277
  query?: never;
@@ -11660,6 +11804,28 @@ export interface paths {
11660
11804
  patch?: never;
11661
11805
  trace?: never;
11662
11806
  };
11807
+ "/api/organizations/{organization}/users/{user}/compute/{targetId}/files": {
11808
+ parameters: {
11809
+ query?: never;
11810
+ header?: never;
11811
+ path?: never;
11812
+ cookie?: never;
11813
+ };
11814
+ /**
11815
+ * List files on a cluster or instance
11816
+ * @description > This is a user-centric route, so the response will always be in the context of the currently authenticated user.
11817
+ *
11818
+ * Lists a folder on a connected cluster or instance as the caller's Linux account, one page at a time.
11819
+ */
11820
+ get: operations["list-compute-files"];
11821
+ put?: never;
11822
+ post?: never;
11823
+ delete?: never;
11824
+ options?: never;
11825
+ head?: never;
11826
+ patch?: never;
11827
+ trace?: never;
11828
+ };
11663
11829
  "/api/organizations/{organization}/users/{user}/disks/{diskName}/snapshot": {
11664
11830
  parameters: {
11665
11831
  query?: never;
@@ -14984,6 +15150,28 @@ export interface paths {
14984
15150
  patch?: never;
14985
15151
  trace?: never;
14986
15152
  };
15153
+ "/api/repositories/readme": {
15154
+ parameters: {
15155
+ query?: never;
15156
+ header?: never;
15157
+ path?: never;
15158
+ cookie?: never;
15159
+ };
15160
+ /**
15161
+ * Read a workflow README from a repository
15162
+ * @description > This is a user-centric route, so the response will always be in the context of the currently authenticated user.
15163
+ *
15164
+ * Reads a markdown file from a GitHub repository or a project on one of the organization's registered GitLab servers, as the current user, so a private repository's README renders. Only a repository and a path within it are accepted, never a URL.
15165
+ */
15166
+ get: operations["get-repository-readme"];
15167
+ put?: never;
15168
+ post?: never;
15169
+ delete?: never;
15170
+ options?: never;
15171
+ head?: never;
15172
+ patch?: never;
15173
+ trace?: never;
15174
+ };
14987
15175
  "/api/repositories/thumbnail": {
14988
15176
  parameters: {
14989
15177
  query?: never;
@@ -14995,7 +15183,7 @@ export interface paths {
14995
15183
  * Read a workflow thumbnail from a repository
14996
15184
  * @description > This is a user-centric route, so the response will always be in the context of the currently authenticated user.
14997
15185
  *
14998
- * Streams an image file from a project on one of the organization's registered GitLab servers, read as the current user. GitHub thumbnails are served from GitHub directly.
15186
+ * Streams an image file from a GitHub repository or a project on one of the organization's registered GitLab servers, read as the current user.
14999
15187
  */
15000
15188
  get: operations["get-repository-thumbnail"];
15001
15189
  put?: never;
@@ -15937,6 +16125,28 @@ export interface paths {
15937
16125
  patch?: never;
15938
16126
  trace?: never;
15939
16127
  };
16128
+ "/api/user/apps": {
16129
+ parameters: {
16130
+ query?: never;
16131
+ header?: never;
16132
+ path?: never;
16133
+ cookie?: never;
16134
+ };
16135
+ /**
16136
+ * List your apps
16137
+ * @description > This is a user-centric route, so the response will always be in the context of the currently authenticated user.
16138
+ *
16139
+ * Lists the platform's apps you can open, such as ACTIVATE itself and Tandem, for the app launcher.
16140
+ */
16141
+ get: operations["list-user-apps"];
16142
+ put?: never;
16143
+ post?: never;
16144
+ delete?: never;
16145
+ options?: never;
16146
+ head?: never;
16147
+ patch?: never;
16148
+ trace?: never;
16149
+ };
15940
16150
  "/api/user/changelog-seen": {
15941
16151
  parameters: {
15942
16152
  query?: never;
@@ -17963,6 +18173,17 @@ export interface components {
17963
18173
  */
17964
18174
  source: "platform" | "partner" | "organization";
17965
18175
  };
18176
+ App: {
18177
+ iconUrl: string;
18178
+ /**
18179
+ * @description Stable identifier of the app
18180
+ * @enum {string}
18181
+ */
18182
+ id: "activate" | "tandem";
18183
+ name: string;
18184
+ /** @description Where the app opens: a path on the platform, or an http(s) URL for an app on another domain */
18185
+ url: string;
18186
+ };
17966
18187
  AppBody: {
17967
18188
  /** @description Groups whose members may use the application. Empty means everyone in the organization. */
17968
18189
  allowedGroups?: string[] | null;
@@ -18082,6 +18303,9 @@ export interface components {
18082
18303
  reason?: string;
18083
18304
  subagentId?: string;
18084
18305
  };
18306
+ AppsOutputBody: {
18307
+ apps: components["schemas"]["App"][];
18308
+ };
18085
18309
  AskOption: {
18086
18310
  description?: string;
18087
18311
  label: string;
@@ -19483,6 +19707,137 @@ export interface components {
19483
19707
  userBootstrapController?: boolean;
19484
19708
  zone?: string;
19485
19709
  };
19710
+ BackgroundJob: {
19711
+ /**
19712
+ * Format: int64
19713
+ * @description Attempts started so far.
19714
+ */
19715
+ attempt: number;
19716
+ /**
19717
+ * Format: date-time
19718
+ * @description When the latest attempt started.
19719
+ */
19720
+ attemptedAt?: string;
19721
+ /**
19722
+ * Format: date-time
19723
+ * @description When the job was queued.
19724
+ */
19725
+ createdAt: string;
19726
+ /** @description One entry per failed attempt, oldest first. */
19727
+ errors: components["schemas"]["BackgroundJobError"][] | null;
19728
+ /**
19729
+ * Format: date-time
19730
+ * @description When the job finished.
19731
+ */
19732
+ finalizedAt?: string;
19733
+ /** @description Job id. */
19734
+ id: string;
19735
+ /** @description Type of job. */
19736
+ kind: string;
19737
+ /**
19738
+ * Format: int64
19739
+ * @description Attempts allowed before the job is discarded.
19740
+ */
19741
+ maxAttempts: number;
19742
+ /** @description Queue the job is on. */
19743
+ queue: string;
19744
+ /**
19745
+ * Format: date-time
19746
+ * @description When the job is, or was, due to run.
19747
+ */
19748
+ scheduledAt: string;
19749
+ /**
19750
+ * @description Where the job is in its life: waiting (pending, available, scheduled, retryable), running, or finished (completed, cancelled, discarded). A discarded job ran out of attempts.
19751
+ * @enum {string}
19752
+ */
19753
+ state: "pending" | "available" | "scheduled" | "running" | "retryable" | "completed" | "cancelled" | "discarded";
19754
+ /** @description What the job does, for cloud provisioning tasks. */
19755
+ task?: components["schemas"]["BackgroundJobTask"];
19756
+ };
19757
+ BackgroundJobError: {
19758
+ /**
19759
+ * Format: date-time
19760
+ * @description When the attempt failed.
19761
+ */
19762
+ at: string;
19763
+ /**
19764
+ * Format: int64
19765
+ * @description Which attempt failed, starting at 1.
19766
+ */
19767
+ attempt: number;
19768
+ /** @description The failure. */
19769
+ error: string;
19770
+ };
19771
+ BackgroundJobQueue: {
19772
+ /**
19773
+ * Format: int64
19774
+ * @description Jobs ready to run.
19775
+ */
19776
+ available: number;
19777
+ /**
19778
+ * Format: int64
19779
+ * @description Jobs completed in the last minute.
19780
+ */
19781
+ completedLastMinute: number;
19782
+ /** @description Queue name. */
19783
+ name: string;
19784
+ /**
19785
+ * Format: double
19786
+ * @description How long the oldest ready job has waited. A growing value means workers are not keeping up.
19787
+ */
19788
+ oldestAvailableSeconds: number;
19789
+ /** @description Whether workers have stopped taking jobs from the queue. */
19790
+ paused: boolean;
19791
+ /**
19792
+ * Format: int64
19793
+ * @description Jobs waiting to run again after a failed attempt.
19794
+ */
19795
+ retryable: number;
19796
+ /**
19797
+ * Format: int64
19798
+ * @description Jobs running right now.
19799
+ */
19800
+ running: number;
19801
+ /**
19802
+ * Format: int64
19803
+ * @description Jobs due to run later.
19804
+ */
19805
+ scheduled: number;
19806
+ };
19807
+ BackgroundJobTask: {
19808
+ /** @description What the task does to the resource. */
19809
+ action: string;
19810
+ /** @description Task family: storage, compute, sessionless or kubernetes. */
19811
+ jobType: string;
19812
+ /** @description Id of the resource the task acts on. */
19813
+ resourceId?: string;
19814
+ /** @description Kind of resource the task acts on. */
19815
+ resourceType: string;
19816
+ };
19817
+ BackgroundJobWorker: {
19818
+ /** @description Host the worker runs on. */
19819
+ hostname: string;
19820
+ /** @description Worker id. */
19821
+ id: string;
19822
+ /** @description Whether this worker also rescues jobs from stopped workers and prunes history. */
19823
+ leader: boolean;
19824
+ /**
19825
+ * Format: int64
19826
+ * @description Jobs the worker is running right now.
19827
+ */
19828
+ running: number;
19829
+ /**
19830
+ * Format: date-time
19831
+ * @description When the worker started.
19832
+ */
19833
+ startedAt: string;
19834
+ };
19835
+ BackgroundJobsOverviewOutputBody: {
19836
+ /** @description Every queue with its depth, by name. */
19837
+ queues: components["schemas"]["BackgroundJobQueue"][] | null;
19838
+ /** @description Workers taking jobs right now. */
19839
+ workers: components["schemas"]["BackgroundJobWorker"][] | null;
19840
+ };
19486
19841
  BaseImageComplianceBody: {
19487
19842
  /**
19488
19843
  * @description How base-image compliance rules currently apply
@@ -23145,7 +23500,7 @@ export interface components {
23145
23500
  FieldError: {
23146
23501
  /** @description Stable name of the rule, for clients to show a localized message. New codes can appear: fall back to a generic message for one you don't know. */
23147
23502
  code: string;
23148
- /** @description English explanation, for developers and logs. */
23503
+ /** @description Explanation, in the language the Content-Language header names; English without it. */
23149
23504
  detail?: string;
23150
23505
  /**
23151
23506
  * @description Where parameter is.
@@ -23166,6 +23521,28 @@ export interface components {
23166
23521
  */
23167
23522
  type: string;
23168
23523
  };
23524
+ FileEntry: {
23525
+ mode: string;
23526
+ /** Format: date-time */
23527
+ modified: string;
23528
+ name: string;
23529
+ /** Format: int64 */
23530
+ size: number;
23531
+ symlink?: boolean;
23532
+ /** @enum {string} */
23533
+ type: "file" | "directory" | "other";
23534
+ };
23535
+ FileListing: {
23536
+ entries: components["schemas"]["FileEntry"][] | null;
23537
+ /** @description Pass as cursor to read the next page; absent on the last page. */
23538
+ nextCursor?: string;
23539
+ /** @description Absolute path of the listed directory on the target. */
23540
+ path: string;
23541
+ /** @description The root the path is relative to, as configured (for example ~). */
23542
+ root: string;
23543
+ /** @description The directory holds more entries than a listing reads. */
23544
+ truncated?: boolean;
23545
+ };
23169
23546
  FileOutputBody: {
23170
23547
  content: string;
23171
23548
  };
@@ -23373,6 +23750,8 @@ export interface components {
23373
23750
  allocationThreshold?: components["schemas"]["CrossedThreshold"];
23374
23751
  /** @description Whether the requesting user may change this cluster's configuration. */
23375
23752
  canEdit?: boolean;
23753
+ /** @description Features the cluster's connected agent supports, such as files. Absent when no agent is connected. */
23754
+ capabilities?: "files"[] | null;
23376
23755
  /**
23377
23756
  * @description The SSH connection string for the resource.
23378
23757
  * @example user@192.168.1.1
@@ -23554,6 +23933,10 @@ export interface components {
23554
23933
  /** @description The organization's configured default sidebar item IDs, or null when the organization has not set a custom default (users fall back to platform defaults). */
23555
23934
  defaultSidebar: string[] | null;
23556
23935
  };
23936
+ GetReadmeOutputBody: {
23937
+ /** @description The file's contents, truncated at 100KB. */
23938
+ markdown: string;
23939
+ };
23557
23940
  GetTermsBody: {
23558
23941
  /** @description Markdown Terms & Conditions shown during onboarding. */
23559
23942
  termsAndConditions: string;
@@ -24752,6 +25135,8 @@ export interface components {
24752
25135
  * @example x86_64
24753
25136
  */
24754
25137
  architecture?: string;
25138
+ /** @description Features the instance's connected agent supports, such as files. Absent when no agent is connected. */
25139
+ readonly capabilities?: "files"[] | null;
24755
25140
  /**
24756
25141
  * @description The cloud service provider for the Instance.
24757
25142
  * @example aws
@@ -25813,6 +26198,12 @@ export interface components {
25813
26198
  /** @description Pass as cursor to read the next page */
25814
26199
  nextCursor?: string;
25815
26200
  };
26201
+ ListBackgroundJobsOutputBody: {
26202
+ /** @description One page of jobs, oldest first. */
26203
+ jobs: components["schemas"]["BackgroundJob"][] | null;
26204
+ /** @description Pass as after to fetch the next page. Absent on the last page. */
26205
+ next?: string;
26206
+ };
25816
26207
  ListConnectedAppsOutputBody: {
25817
26208
  /** @description Applications the user has granted access to */
25818
26209
  apps: components["schemas"]["ConnectedApp"][] | null;
@@ -26471,6 +26862,8 @@ export interface components {
26471
26862
  featured: boolean;
26472
26863
  /** @description Marketplace item ID */
26473
26864
  id: string;
26865
+ /** @description Platform route to retry the icon through when the provider refuses an anonymous read. */
26866
+ imageFallbackUrl?: string;
26474
26867
  /** @description Image URL for the item */
26475
26868
  imageUrl?: string;
26476
26869
  /** @description Published name of the item */
@@ -26509,6 +26902,8 @@ export interface components {
26509
26902
  featured: boolean;
26510
26903
  /** @description Marketplace item ID */
26511
26904
  id: string;
26905
+ /** @description Platform route to retry the icon through when the provider refuses an anonymous read. */
26906
+ imageFallbackUrl?: string;
26512
26907
  /** @description Image URL for the item */
26513
26908
  imageUrl?: string;
26514
26909
  /** @description Published name of the item */
@@ -28081,6 +28476,8 @@ export interface components {
28081
28476
  description?: string;
28082
28477
  /** @description Icon URL */
28083
28478
  icon?: string;
28479
+ /** @description Platform route to retry the icon through when the provider refuses an anonymous read. */
28480
+ iconFallback?: string;
28084
28481
  /** @description Marketplace item ID */
28085
28482
  id: string;
28086
28483
  /** @description Published name of the item */
@@ -28898,6 +29295,8 @@ export interface components {
28898
29295
  acmeDirectoryUrl?: string;
28899
29296
  /** @description URL of the uploaded app icon. Empty uses the built-in icon. */
28900
29297
  appIconUrl?: string;
29298
+ /** @description Whether browsers offer to install ACTIVATE as an app. */
29299
+ appInstallable: boolean;
28901
29300
  /** @description Name of the installed app. Empty uses the platform name. */
28902
29301
  appName?: string;
28903
29302
  /**
@@ -29374,7 +29773,7 @@ export interface components {
29374
29773
  Problem: {
29375
29774
  /** @description Stable name of the problem type, for clients to show a localized message. New codes can appear: fall back to the status for one you don't know. Absent for about:blank: derive it from the status. */
29376
29775
  code?: string;
29377
- /** @description English explanation of this occurrence, for developers and logs. */
29776
+ /** @description Explanation of this occurrence, in the language the Content-Language header names. Without that header it is English, for developers and logs: show your own message for code instead. */
29378
29777
  detail?: string;
29379
29778
  /** @description For a validation problem, each invalid field and the rule it failed. */
29380
29779
  errors?: components["schemas"]["FieldError"][] | null;
@@ -31030,6 +31429,8 @@ export interface components {
31030
31429
  description?: string;
31031
31430
  /** @description Icon URL */
31032
31431
  icon?: string;
31432
+ /** @description Platform route to retry the icon through when the provider refuses an anonymous read. */
31433
+ iconFallback?: string;
31033
31434
  /** @description Marketplace item ID */
31034
31435
  id: string;
31035
31436
  /** @description Display name */
@@ -31387,6 +31788,8 @@ export interface components {
31387
31788
  * @description When the resource was first detected as orphaned.
31388
31789
  */
31389
31790
  orphanedAt?: string;
31791
+ /** @description Whether a platform install created the resource (deployment, network, or another install's tags); false for resources created outside the platform. */
31792
+ platformManaged: boolean;
31390
31793
  /** @description Private IP address. */
31391
31794
  privateIp?: string;
31392
31795
  /** @description Public IP address. */
@@ -32120,6 +32523,8 @@ export interface components {
32120
32523
  * @example 60c72b2f9b1e8d001c8e4f3a
32121
32524
  */
32122
32525
  readonly id?: string;
32526
+ /** @description Platform route to retry the icon through when the provider refuses an anonymous read. */
32527
+ readonly imageFallbackUrl?: string;
32123
32528
  /** @description Icon shown in the UI for the session. Inherited from the launching workflow by default; customizable via the session icon endpoint. */
32124
32529
  readonly imageUrl?: string;
32125
32530
  /** @description Internal session URL. */
@@ -33243,6 +33648,8 @@ export interface components {
33243
33648
  acmeContactEmail?: string;
33244
33649
  /** @description ACME directory URL for automatic certificates. Empty uses Let's Encrypt production. */
33245
33650
  acmeDirectoryUrl?: string;
33651
+ /** @description Whether browsers offer to install ACTIVATE as an app. */
33652
+ appInstallable?: boolean;
33246
33653
  /** @description Name of the installed app. Empty uses the platform name. */
33247
33654
  appName?: string;
33248
33655
  /**
@@ -34404,6 +34811,8 @@ export interface components {
34404
34811
  * @description Port of the worker's SSH server on the compute node. Present when the worker accepts SSH sessions through its own tunnel.
34405
34812
  */
34406
34813
  readonly sshServerPort?: number;
34814
+ /** @description Named pw ssh target (pw://username/cluster/worker) for reaching the worker's compute node. */
34815
+ readonly sshTarget?: string;
34407
34816
  /**
34408
34817
  * @description Worker status.
34409
34818
  * @enum {string}
@@ -34440,6 +34849,8 @@ export interface components {
34440
34849
  favorite: boolean;
34441
34850
  /** @description Id of the workflow. */
34442
34851
  id: string;
34852
+ /** @description Platform route to retry the icon through when the provider refuses an anonymous read, which is what a private repository does. Empty unless the icon is a repository thumbnail. */
34853
+ imageFallbackUrl?: string;
34443
34854
  /** @description URL of the workflow icon. */
34444
34855
  imageUrl?: string;
34445
34856
  /** @description ID of the marketplace item if installed from marketplace. */
@@ -34491,6 +34902,7 @@ export interface components {
34491
34902
  [key: string]: unknown;
34492
34903
  };
34493
34904
  id: string;
34905
+ imageFallbackUrl?: string;
34494
34906
  imageUrl?: string;
34495
34907
  inlineRun: boolean;
34496
34908
  inputs?: {
@@ -34548,6 +34960,7 @@ export interface components {
34548
34960
  createdAt?: string;
34549
34961
  displayName?: string;
34550
34962
  id: string;
34963
+ imageFallbackUrl?: string;
34551
34964
  imageUrl?: string;
34552
34965
  inlineRun: boolean;
34553
34966
  marketplace: boolean;
@@ -34952,6 +35365,197 @@ export interface operations {
34952
35365
  };
34953
35366
  };
34954
35367
  };
35368
+ "list-background-jobs": {
35369
+ parameters: {
35370
+ query?: {
35371
+ /** @description Only jobs on this queue. */
35372
+ queue?: string;
35373
+ /** @description Only jobs in these states. */
35374
+ state?: ("pending" | "available" | "scheduled" | "running" | "retryable" | "completed" | "cancelled" | "discarded")[] | null;
35375
+ /** @description Continue after this job id, from the next field of the previous page. */
35376
+ after?: string;
35377
+ /** @description Page size. */
35378
+ limit?: number;
35379
+ };
35380
+ header?: never;
35381
+ path?: never;
35382
+ cookie?: never;
35383
+ };
35384
+ requestBody?: never;
35385
+ responses: {
35386
+ /** @description OK */
35387
+ 200: {
35388
+ headers: {
35389
+ [name: string]: unknown;
35390
+ };
35391
+ content: {
35392
+ "application/json": components["schemas"]["ListBackgroundJobsOutputBody"];
35393
+ };
35394
+ };
35395
+ /** @description Error */
35396
+ default: {
35397
+ headers: {
35398
+ [name: string]: unknown;
35399
+ };
35400
+ content: {
35401
+ "application/json": components["schemas"]["Error"];
35402
+ };
35403
+ };
35404
+ };
35405
+ };
35406
+ "get-background-jobs-overview": {
35407
+ parameters: {
35408
+ query?: never;
35409
+ header?: never;
35410
+ path?: never;
35411
+ cookie?: never;
35412
+ };
35413
+ requestBody?: never;
35414
+ responses: {
35415
+ /** @description OK */
35416
+ 200: {
35417
+ headers: {
35418
+ [name: string]: unknown;
35419
+ };
35420
+ content: {
35421
+ "application/json": components["schemas"]["BackgroundJobsOverviewOutputBody"];
35422
+ };
35423
+ };
35424
+ /** @description Error */
35425
+ default: {
35426
+ headers: {
35427
+ [name: string]: unknown;
35428
+ };
35429
+ content: {
35430
+ "application/json": components["schemas"]["Error"];
35431
+ };
35432
+ };
35433
+ };
35434
+ };
35435
+ "pause-background-job-queue": {
35436
+ parameters: {
35437
+ query?: never;
35438
+ header?: never;
35439
+ path: {
35440
+ /** @description Queue name. */
35441
+ queue: string;
35442
+ };
35443
+ cookie?: never;
35444
+ };
35445
+ requestBody?: never;
35446
+ responses: {
35447
+ /** @description No Content */
35448
+ 204: {
35449
+ headers: {
35450
+ [name: string]: unknown;
35451
+ };
35452
+ content?: never;
35453
+ };
35454
+ /** @description Error */
35455
+ default: {
35456
+ headers: {
35457
+ [name: string]: unknown;
35458
+ };
35459
+ content: {
35460
+ "application/json": components["schemas"]["Error"];
35461
+ };
35462
+ };
35463
+ };
35464
+ };
35465
+ "resume-background-job-queue": {
35466
+ parameters: {
35467
+ query?: never;
35468
+ header?: never;
35469
+ path: {
35470
+ /** @description Queue name. */
35471
+ queue: string;
35472
+ };
35473
+ cookie?: never;
35474
+ };
35475
+ requestBody?: never;
35476
+ responses: {
35477
+ /** @description No Content */
35478
+ 204: {
35479
+ headers: {
35480
+ [name: string]: unknown;
35481
+ };
35482
+ content?: never;
35483
+ };
35484
+ /** @description Error */
35485
+ default: {
35486
+ headers: {
35487
+ [name: string]: unknown;
35488
+ };
35489
+ content: {
35490
+ "application/json": components["schemas"]["Error"];
35491
+ };
35492
+ };
35493
+ };
35494
+ };
35495
+ "cancel-background-job": {
35496
+ parameters: {
35497
+ query?: never;
35498
+ header?: never;
35499
+ path: {
35500
+ /** @description Job id. */
35501
+ jobId: string;
35502
+ };
35503
+ cookie?: never;
35504
+ };
35505
+ requestBody?: never;
35506
+ responses: {
35507
+ /** @description OK */
35508
+ 200: {
35509
+ headers: {
35510
+ [name: string]: unknown;
35511
+ };
35512
+ content: {
35513
+ "application/json": components["schemas"]["BackgroundJob"];
35514
+ };
35515
+ };
35516
+ /** @description Error */
35517
+ default: {
35518
+ headers: {
35519
+ [name: string]: unknown;
35520
+ };
35521
+ content: {
35522
+ "application/json": components["schemas"]["Error"];
35523
+ };
35524
+ };
35525
+ };
35526
+ };
35527
+ "retry-background-job": {
35528
+ parameters: {
35529
+ query?: never;
35530
+ header?: never;
35531
+ path: {
35532
+ /** @description Job id. */
35533
+ jobId: string;
35534
+ };
35535
+ cookie?: never;
35536
+ };
35537
+ requestBody?: never;
35538
+ responses: {
35539
+ /** @description OK */
35540
+ 200: {
35541
+ headers: {
35542
+ [name: string]: unknown;
35543
+ };
35544
+ content: {
35545
+ "application/json": components["schemas"]["BackgroundJob"];
35546
+ };
35547
+ };
35548
+ /** @description Error */
35549
+ default: {
35550
+ headers: {
35551
+ [name: string]: unknown;
35552
+ };
35553
+ content: {
35554
+ "application/json": components["schemas"]["Error"];
35555
+ };
35556
+ };
35557
+ };
35558
+ };
34955
35559
  "get-billing-crosscheck": {
34956
35560
  parameters: {
34957
35561
  query?: never;
@@ -36989,6 +37593,8 @@ export interface operations {
36989
37593
  organization?: string;
36990
37594
  /** @description Only resources flagged as orphaned. */
36991
37595
  orphan?: boolean;
37596
+ /** @description Only resources created by the platform (platform) or outside it (external). */
37597
+ managed?: "platform" | "external";
36992
37598
  /** @description Only resources that still exist in the cloud (hides terminated/deleted). */
36993
37599
  live?: boolean;
36994
37600
  /** @description Only resources last seen within this preset window. */
@@ -57637,6 +58243,49 @@ export interface operations {
57637
58243
  };
57638
58244
  };
57639
58245
  };
58246
+ "list-compute-files": {
58247
+ parameters: {
58248
+ query?: {
58249
+ /** @description Folder to list, relative to the root. Empty lists the root. */
58250
+ path?: string;
58251
+ /** @description The nextCursor of the previous page. */
58252
+ cursor?: string;
58253
+ /** @description Entries per page. Defaults to 1000. */
58254
+ limit?: number;
58255
+ };
58256
+ header?: never;
58257
+ path: {
58258
+ /** @description The name of the organization. */
58259
+ organization: string;
58260
+ /** @description Username of the target user. */
58261
+ user: string;
58262
+ /** @description ID of the cluster or instance. */
58263
+ targetId: string;
58264
+ };
58265
+ cookie?: never;
58266
+ };
58267
+ requestBody?: never;
58268
+ responses: {
58269
+ /** @description OK */
58270
+ 200: {
58271
+ headers: {
58272
+ [name: string]: unknown;
58273
+ };
58274
+ content: {
58275
+ "application/json": components["schemas"]["FileListing"];
58276
+ };
58277
+ };
58278
+ /** @description Error */
58279
+ default: {
58280
+ headers: {
58281
+ [name: string]: unknown;
58282
+ };
58283
+ content: {
58284
+ "application/json": components["schemas"]["Error"];
58285
+ };
58286
+ };
58287
+ };
58288
+ };
57640
58289
  "create-disk-snapshot": {
57641
58290
  parameters: {
57642
58291
  query?: never;
@@ -64310,14 +64959,50 @@ export interface operations {
64310
64959
  };
64311
64960
  };
64312
64961
  };
64962
+ "get-repository-readme": {
64963
+ parameters: {
64964
+ query: {
64965
+ /** @description OWNER/REPO or the URL of a GitHub repository, or HOST/GROUP/PROJECT of a project on a registered GitLab server. */
64966
+ repo: string;
64967
+ /** @description Branch, tag or commit. */
64968
+ ref: string;
64969
+ /** @description Path of the file within the repository. */
64970
+ path: string;
64971
+ };
64972
+ header?: never;
64973
+ path?: never;
64974
+ cookie?: never;
64975
+ };
64976
+ requestBody?: never;
64977
+ responses: {
64978
+ /** @description OK */
64979
+ 200: {
64980
+ headers: {
64981
+ [name: string]: unknown;
64982
+ };
64983
+ content: {
64984
+ "application/json": components["schemas"]["GetReadmeOutputBody"];
64985
+ };
64986
+ };
64987
+ /** @description Error */
64988
+ default: {
64989
+ headers: {
64990
+ [name: string]: unknown;
64991
+ };
64992
+ content: {
64993
+ "application/json": components["schemas"]["Error"];
64994
+ };
64995
+ };
64996
+ };
64997
+ };
64313
64998
  "get-repository-thumbnail": {
64314
64999
  parameters: {
64315
65000
  query: {
64316
- /** @description HOST/GROUP/PROJECT of a project on a registered GitLab server. */
65001
+ /** @description OWNER/REPO or the URL of a GitHub repository, or HOST/GROUP/PROJECT of a project on a registered GitLab server. */
64317
65002
  repo: string;
64318
65003
  /** @description Branch, tag or commit. */
64319
65004
  ref: string;
64320
- /** @description Path of the image within the repository. */
65005
+ /** @description Path of the file within the repository. */
64321
65006
  path: string;
64322
65007
  };
64323
65008
  header?: never;
@@ -65824,6 +66509,35 @@ export interface operations {
65824
66509
  };
65825
66510
  };
65826
66511
  };
66512
+ "list-user-apps": {
66513
+ parameters: {
66514
+ query?: never;
66515
+ header?: never;
66516
+ path?: never;
66517
+ cookie?: never;
66518
+ };
66519
+ requestBody?: never;
66520
+ responses: {
66521
+ /** @description OK */
66522
+ 200: {
66523
+ headers: {
66524
+ [name: string]: unknown;
66525
+ };
66526
+ content: {
66527
+ "application/json": components["schemas"]["AppsOutputBody"];
66528
+ };
66529
+ };
66530
+ /** @description Error */
66531
+ default: {
66532
+ headers: {
66533
+ [name: string]: unknown;
66534
+ };
66535
+ content: {
66536
+ "application/json": components["schemas"]["Error"];
66537
+ };
66538
+ };
66539
+ };
66540
+ };
65827
66541
  "set-user-changelog-seen": {
65828
66542
  parameters: {
65829
66543
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/client",
3
- "version": "7.113.0",
3
+ "version": "7.116.0",
4
4
  "description": "Official TypeScript client for Parallel Works ACTIVATE API",
5
5
  "type": "module",
6
6
  "exports": {
@@ -14,6 +14,7 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
+ "@parallelworks/problem": "^0.2.0",
17
18
  "openapi-fetch": "^0.17.0"
18
19
  },
19
20
  "peerDependencies": {
@@ -40,6 +41,7 @@
40
41
  "chokidar-cli": "^3.0.0",
41
42
  "openapi-typescript": "^7.13.0",
42
43
  "typescript": "^5.4.0",
44
+ "vitest": "^4.1.8",
43
45
  "@types/node": "^22.0.0",
44
46
  "openapi-typescript-helpers": "^0.0.15",
45
47
  "type-fest": "^5.4.1",