@parallelworks/client 7.113.0 → 7.114.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;
@@ -14984,6 +15128,28 @@ export interface paths {
14984
15128
  patch?: never;
14985
15129
  trace?: never;
14986
15130
  };
15131
+ "/api/repositories/readme": {
15132
+ parameters: {
15133
+ query?: never;
15134
+ header?: never;
15135
+ path?: never;
15136
+ cookie?: never;
15137
+ };
15138
+ /**
15139
+ * Read a workflow README from a repository
15140
+ * @description > This is a user-centric route, so the response will always be in the context of the currently authenticated user.
15141
+ *
15142
+ * 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.
15143
+ */
15144
+ get: operations["get-repository-readme"];
15145
+ put?: never;
15146
+ post?: never;
15147
+ delete?: never;
15148
+ options?: never;
15149
+ head?: never;
15150
+ patch?: never;
15151
+ trace?: never;
15152
+ };
14987
15153
  "/api/repositories/thumbnail": {
14988
15154
  parameters: {
14989
15155
  query?: never;
@@ -14995,7 +15161,7 @@ export interface paths {
14995
15161
  * Read a workflow thumbnail from a repository
14996
15162
  * @description > This is a user-centric route, so the response will always be in the context of the currently authenticated user.
14997
15163
  *
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.
15164
+ * 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
15165
  */
15000
15166
  get: operations["get-repository-thumbnail"];
15001
15167
  put?: never;
@@ -15937,6 +16103,28 @@ export interface paths {
15937
16103
  patch?: never;
15938
16104
  trace?: never;
15939
16105
  };
16106
+ "/api/user/apps": {
16107
+ parameters: {
16108
+ query?: never;
16109
+ header?: never;
16110
+ path?: never;
16111
+ cookie?: never;
16112
+ };
16113
+ /**
16114
+ * List your apps
16115
+ * @description > This is a user-centric route, so the response will always be in the context of the currently authenticated user.
16116
+ *
16117
+ * Lists the platform's apps you can open, such as ACTIVATE itself and Tandem, for the app launcher.
16118
+ */
16119
+ get: operations["list-user-apps"];
16120
+ put?: never;
16121
+ post?: never;
16122
+ delete?: never;
16123
+ options?: never;
16124
+ head?: never;
16125
+ patch?: never;
16126
+ trace?: never;
16127
+ };
15940
16128
  "/api/user/changelog-seen": {
15941
16129
  parameters: {
15942
16130
  query?: never;
@@ -17963,6 +18151,17 @@ export interface components {
17963
18151
  */
17964
18152
  source: "platform" | "partner" | "organization";
17965
18153
  };
18154
+ App: {
18155
+ iconUrl: string;
18156
+ /**
18157
+ * @description Stable identifier of the app
18158
+ * @enum {string}
18159
+ */
18160
+ id: "activate" | "tandem";
18161
+ name: string;
18162
+ /** @description Where the app opens: a path on the platform, or an http(s) URL for an app on another domain */
18163
+ url: string;
18164
+ };
17966
18165
  AppBody: {
17967
18166
  /** @description Groups whose members may use the application. Empty means everyone in the organization. */
17968
18167
  allowedGroups?: string[] | null;
@@ -18082,6 +18281,9 @@ export interface components {
18082
18281
  reason?: string;
18083
18282
  subagentId?: string;
18084
18283
  };
18284
+ AppsOutputBody: {
18285
+ apps: components["schemas"]["App"][];
18286
+ };
18085
18287
  AskOption: {
18086
18288
  description?: string;
18087
18289
  label: string;
@@ -19483,6 +19685,137 @@ export interface components {
19483
19685
  userBootstrapController?: boolean;
19484
19686
  zone?: string;
19485
19687
  };
19688
+ BackgroundJob: {
19689
+ /**
19690
+ * Format: int64
19691
+ * @description Attempts started so far.
19692
+ */
19693
+ attempt: number;
19694
+ /**
19695
+ * Format: date-time
19696
+ * @description When the latest attempt started.
19697
+ */
19698
+ attemptedAt?: string;
19699
+ /**
19700
+ * Format: date-time
19701
+ * @description When the job was queued.
19702
+ */
19703
+ createdAt: string;
19704
+ /** @description One entry per failed attempt, oldest first. */
19705
+ errors: components["schemas"]["BackgroundJobError"][] | null;
19706
+ /**
19707
+ * Format: date-time
19708
+ * @description When the job finished.
19709
+ */
19710
+ finalizedAt?: string;
19711
+ /** @description Job id. */
19712
+ id: string;
19713
+ /** @description Type of job. */
19714
+ kind: string;
19715
+ /**
19716
+ * Format: int64
19717
+ * @description Attempts allowed before the job is discarded.
19718
+ */
19719
+ maxAttempts: number;
19720
+ /** @description Queue the job is on. */
19721
+ queue: string;
19722
+ /**
19723
+ * Format: date-time
19724
+ * @description When the job is, or was, due to run.
19725
+ */
19726
+ scheduledAt: string;
19727
+ /**
19728
+ * @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.
19729
+ * @enum {string}
19730
+ */
19731
+ state: "pending" | "available" | "scheduled" | "running" | "retryable" | "completed" | "cancelled" | "discarded";
19732
+ /** @description What the job does, for cloud provisioning tasks. */
19733
+ task?: components["schemas"]["BackgroundJobTask"];
19734
+ };
19735
+ BackgroundJobError: {
19736
+ /**
19737
+ * Format: date-time
19738
+ * @description When the attempt failed.
19739
+ */
19740
+ at: string;
19741
+ /**
19742
+ * Format: int64
19743
+ * @description Which attempt failed, starting at 1.
19744
+ */
19745
+ attempt: number;
19746
+ /** @description The failure. */
19747
+ error: string;
19748
+ };
19749
+ BackgroundJobQueue: {
19750
+ /**
19751
+ * Format: int64
19752
+ * @description Jobs ready to run.
19753
+ */
19754
+ available: number;
19755
+ /**
19756
+ * Format: int64
19757
+ * @description Jobs completed in the last minute.
19758
+ */
19759
+ completedLastMinute: number;
19760
+ /** @description Queue name. */
19761
+ name: string;
19762
+ /**
19763
+ * Format: double
19764
+ * @description How long the oldest ready job has waited. A growing value means workers are not keeping up.
19765
+ */
19766
+ oldestAvailableSeconds: number;
19767
+ /** @description Whether workers have stopped taking jobs from the queue. */
19768
+ paused: boolean;
19769
+ /**
19770
+ * Format: int64
19771
+ * @description Jobs waiting to run again after a failed attempt.
19772
+ */
19773
+ retryable: number;
19774
+ /**
19775
+ * Format: int64
19776
+ * @description Jobs running right now.
19777
+ */
19778
+ running: number;
19779
+ /**
19780
+ * Format: int64
19781
+ * @description Jobs due to run later.
19782
+ */
19783
+ scheduled: number;
19784
+ };
19785
+ BackgroundJobTask: {
19786
+ /** @description What the task does to the resource. */
19787
+ action: string;
19788
+ /** @description Task family: storage, compute, sessionless or kubernetes. */
19789
+ jobType: string;
19790
+ /** @description Id of the resource the task acts on. */
19791
+ resourceId?: string;
19792
+ /** @description Kind of resource the task acts on. */
19793
+ resourceType: string;
19794
+ };
19795
+ BackgroundJobWorker: {
19796
+ /** @description Host the worker runs on. */
19797
+ hostname: string;
19798
+ /** @description Worker id. */
19799
+ id: string;
19800
+ /** @description Whether this worker also rescues jobs from stopped workers and prunes history. */
19801
+ leader: boolean;
19802
+ /**
19803
+ * Format: int64
19804
+ * @description Jobs the worker is running right now.
19805
+ */
19806
+ running: number;
19807
+ /**
19808
+ * Format: date-time
19809
+ * @description When the worker started.
19810
+ */
19811
+ startedAt: string;
19812
+ };
19813
+ BackgroundJobsOverviewOutputBody: {
19814
+ /** @description Every queue with its depth, by name. */
19815
+ queues: components["schemas"]["BackgroundJobQueue"][] | null;
19816
+ /** @description Workers taking jobs right now. */
19817
+ workers: components["schemas"]["BackgroundJobWorker"][] | null;
19818
+ };
19486
19819
  BaseImageComplianceBody: {
19487
19820
  /**
19488
19821
  * @description How base-image compliance rules currently apply
@@ -23145,7 +23478,7 @@ export interface components {
23145
23478
  FieldError: {
23146
23479
  /** @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
23480
  code: string;
23148
- /** @description English explanation, for developers and logs. */
23481
+ /** @description Explanation, in the language the Content-Language header names; English without it. */
23149
23482
  detail?: string;
23150
23483
  /**
23151
23484
  * @description Where parameter is.
@@ -23554,6 +23887,10 @@ export interface components {
23554
23887
  /** @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
23888
  defaultSidebar: string[] | null;
23556
23889
  };
23890
+ GetReadmeOutputBody: {
23891
+ /** @description The file's contents, truncated at 100KB. */
23892
+ markdown: string;
23893
+ };
23557
23894
  GetTermsBody: {
23558
23895
  /** @description Markdown Terms & Conditions shown during onboarding. */
23559
23896
  termsAndConditions: string;
@@ -25813,6 +26150,12 @@ export interface components {
25813
26150
  /** @description Pass as cursor to read the next page */
25814
26151
  nextCursor?: string;
25815
26152
  };
26153
+ ListBackgroundJobsOutputBody: {
26154
+ /** @description One page of jobs, oldest first. */
26155
+ jobs: components["schemas"]["BackgroundJob"][] | null;
26156
+ /** @description Pass as after to fetch the next page. Absent on the last page. */
26157
+ next?: string;
26158
+ };
25816
26159
  ListConnectedAppsOutputBody: {
25817
26160
  /** @description Applications the user has granted access to */
25818
26161
  apps: components["schemas"]["ConnectedApp"][] | null;
@@ -26471,6 +26814,8 @@ export interface components {
26471
26814
  featured: boolean;
26472
26815
  /** @description Marketplace item ID */
26473
26816
  id: string;
26817
+ /** @description Platform route to retry the icon through when the provider refuses an anonymous read. */
26818
+ imageFallbackUrl?: string;
26474
26819
  /** @description Image URL for the item */
26475
26820
  imageUrl?: string;
26476
26821
  /** @description Published name of the item */
@@ -26509,6 +26854,8 @@ export interface components {
26509
26854
  featured: boolean;
26510
26855
  /** @description Marketplace item ID */
26511
26856
  id: string;
26857
+ /** @description Platform route to retry the icon through when the provider refuses an anonymous read. */
26858
+ imageFallbackUrl?: string;
26512
26859
  /** @description Image URL for the item */
26513
26860
  imageUrl?: string;
26514
26861
  /** @description Published name of the item */
@@ -28081,6 +28428,8 @@ export interface components {
28081
28428
  description?: string;
28082
28429
  /** @description Icon URL */
28083
28430
  icon?: string;
28431
+ /** @description Platform route to retry the icon through when the provider refuses an anonymous read. */
28432
+ iconFallback?: string;
28084
28433
  /** @description Marketplace item ID */
28085
28434
  id: string;
28086
28435
  /** @description Published name of the item */
@@ -28898,6 +29247,8 @@ export interface components {
28898
29247
  acmeDirectoryUrl?: string;
28899
29248
  /** @description URL of the uploaded app icon. Empty uses the built-in icon. */
28900
29249
  appIconUrl?: string;
29250
+ /** @description Whether browsers offer to install ACTIVATE as an app. */
29251
+ appInstallable: boolean;
28901
29252
  /** @description Name of the installed app. Empty uses the platform name. */
28902
29253
  appName?: string;
28903
29254
  /**
@@ -29374,7 +29725,7 @@ export interface components {
29374
29725
  Problem: {
29375
29726
  /** @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
29727
  code?: string;
29377
- /** @description English explanation of this occurrence, for developers and logs. */
29728
+ /** @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
29729
  detail?: string;
29379
29730
  /** @description For a validation problem, each invalid field and the rule it failed. */
29380
29731
  errors?: components["schemas"]["FieldError"][] | null;
@@ -31030,6 +31381,8 @@ export interface components {
31030
31381
  description?: string;
31031
31382
  /** @description Icon URL */
31032
31383
  icon?: string;
31384
+ /** @description Platform route to retry the icon through when the provider refuses an anonymous read. */
31385
+ iconFallback?: string;
31033
31386
  /** @description Marketplace item ID */
31034
31387
  id: string;
31035
31388
  /** @description Display name */
@@ -32120,6 +32473,8 @@ export interface components {
32120
32473
  * @example 60c72b2f9b1e8d001c8e4f3a
32121
32474
  */
32122
32475
  readonly id?: string;
32476
+ /** @description Platform route to retry the icon through when the provider refuses an anonymous read. */
32477
+ readonly imageFallbackUrl?: string;
32123
32478
  /** @description Icon shown in the UI for the session. Inherited from the launching workflow by default; customizable via the session icon endpoint. */
32124
32479
  readonly imageUrl?: string;
32125
32480
  /** @description Internal session URL. */
@@ -33243,6 +33598,8 @@ export interface components {
33243
33598
  acmeContactEmail?: string;
33244
33599
  /** @description ACME directory URL for automatic certificates. Empty uses Let's Encrypt production. */
33245
33600
  acmeDirectoryUrl?: string;
33601
+ /** @description Whether browsers offer to install ACTIVATE as an app. */
33602
+ appInstallable?: boolean;
33246
33603
  /** @description Name of the installed app. Empty uses the platform name. */
33247
33604
  appName?: string;
33248
33605
  /**
@@ -34440,6 +34797,8 @@ export interface components {
34440
34797
  favorite: boolean;
34441
34798
  /** @description Id of the workflow. */
34442
34799
  id: string;
34800
+ /** @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. */
34801
+ imageFallbackUrl?: string;
34443
34802
  /** @description URL of the workflow icon. */
34444
34803
  imageUrl?: string;
34445
34804
  /** @description ID of the marketplace item if installed from marketplace. */
@@ -34491,6 +34850,7 @@ export interface components {
34491
34850
  [key: string]: unknown;
34492
34851
  };
34493
34852
  id: string;
34853
+ imageFallbackUrl?: string;
34494
34854
  imageUrl?: string;
34495
34855
  inlineRun: boolean;
34496
34856
  inputs?: {
@@ -34548,6 +34908,7 @@ export interface components {
34548
34908
  createdAt?: string;
34549
34909
  displayName?: string;
34550
34910
  id: string;
34911
+ imageFallbackUrl?: string;
34551
34912
  imageUrl?: string;
34552
34913
  inlineRun: boolean;
34553
34914
  marketplace: boolean;
@@ -34952,6 +35313,197 @@ export interface operations {
34952
35313
  };
34953
35314
  };
34954
35315
  };
35316
+ "list-background-jobs": {
35317
+ parameters: {
35318
+ query?: {
35319
+ /** @description Only jobs on this queue. */
35320
+ queue?: string;
35321
+ /** @description Only jobs in these states. */
35322
+ state?: ("pending" | "available" | "scheduled" | "running" | "retryable" | "completed" | "cancelled" | "discarded")[] | null;
35323
+ /** @description Continue after this job id, from the next field of the previous page. */
35324
+ after?: string;
35325
+ /** @description Page size. */
35326
+ limit?: number;
35327
+ };
35328
+ header?: never;
35329
+ path?: never;
35330
+ cookie?: never;
35331
+ };
35332
+ requestBody?: never;
35333
+ responses: {
35334
+ /** @description OK */
35335
+ 200: {
35336
+ headers: {
35337
+ [name: string]: unknown;
35338
+ };
35339
+ content: {
35340
+ "application/json": components["schemas"]["ListBackgroundJobsOutputBody"];
35341
+ };
35342
+ };
35343
+ /** @description Error */
35344
+ default: {
35345
+ headers: {
35346
+ [name: string]: unknown;
35347
+ };
35348
+ content: {
35349
+ "application/json": components["schemas"]["Error"];
35350
+ };
35351
+ };
35352
+ };
35353
+ };
35354
+ "get-background-jobs-overview": {
35355
+ parameters: {
35356
+ query?: never;
35357
+ header?: never;
35358
+ path?: never;
35359
+ cookie?: never;
35360
+ };
35361
+ requestBody?: never;
35362
+ responses: {
35363
+ /** @description OK */
35364
+ 200: {
35365
+ headers: {
35366
+ [name: string]: unknown;
35367
+ };
35368
+ content: {
35369
+ "application/json": components["schemas"]["BackgroundJobsOverviewOutputBody"];
35370
+ };
35371
+ };
35372
+ /** @description Error */
35373
+ default: {
35374
+ headers: {
35375
+ [name: string]: unknown;
35376
+ };
35377
+ content: {
35378
+ "application/json": components["schemas"]["Error"];
35379
+ };
35380
+ };
35381
+ };
35382
+ };
35383
+ "pause-background-job-queue": {
35384
+ parameters: {
35385
+ query?: never;
35386
+ header?: never;
35387
+ path: {
35388
+ /** @description Queue name. */
35389
+ queue: string;
35390
+ };
35391
+ cookie?: never;
35392
+ };
35393
+ requestBody?: never;
35394
+ responses: {
35395
+ /** @description No Content */
35396
+ 204: {
35397
+ headers: {
35398
+ [name: string]: unknown;
35399
+ };
35400
+ content?: never;
35401
+ };
35402
+ /** @description Error */
35403
+ default: {
35404
+ headers: {
35405
+ [name: string]: unknown;
35406
+ };
35407
+ content: {
35408
+ "application/json": components["schemas"]["Error"];
35409
+ };
35410
+ };
35411
+ };
35412
+ };
35413
+ "resume-background-job-queue": {
35414
+ parameters: {
35415
+ query?: never;
35416
+ header?: never;
35417
+ path: {
35418
+ /** @description Queue name. */
35419
+ queue: string;
35420
+ };
35421
+ cookie?: never;
35422
+ };
35423
+ requestBody?: never;
35424
+ responses: {
35425
+ /** @description No Content */
35426
+ 204: {
35427
+ headers: {
35428
+ [name: string]: unknown;
35429
+ };
35430
+ content?: never;
35431
+ };
35432
+ /** @description Error */
35433
+ default: {
35434
+ headers: {
35435
+ [name: string]: unknown;
35436
+ };
35437
+ content: {
35438
+ "application/json": components["schemas"]["Error"];
35439
+ };
35440
+ };
35441
+ };
35442
+ };
35443
+ "cancel-background-job": {
35444
+ parameters: {
35445
+ query?: never;
35446
+ header?: never;
35447
+ path: {
35448
+ /** @description Job id. */
35449
+ jobId: string;
35450
+ };
35451
+ cookie?: never;
35452
+ };
35453
+ requestBody?: never;
35454
+ responses: {
35455
+ /** @description OK */
35456
+ 200: {
35457
+ headers: {
35458
+ [name: string]: unknown;
35459
+ };
35460
+ content: {
35461
+ "application/json": components["schemas"]["BackgroundJob"];
35462
+ };
35463
+ };
35464
+ /** @description Error */
35465
+ default: {
35466
+ headers: {
35467
+ [name: string]: unknown;
35468
+ };
35469
+ content: {
35470
+ "application/json": components["schemas"]["Error"];
35471
+ };
35472
+ };
35473
+ };
35474
+ };
35475
+ "retry-background-job": {
35476
+ parameters: {
35477
+ query?: never;
35478
+ header?: never;
35479
+ path: {
35480
+ /** @description Job id. */
35481
+ jobId: string;
35482
+ };
35483
+ cookie?: never;
35484
+ };
35485
+ requestBody?: never;
35486
+ responses: {
35487
+ /** @description OK */
35488
+ 200: {
35489
+ headers: {
35490
+ [name: string]: unknown;
35491
+ };
35492
+ content: {
35493
+ "application/json": components["schemas"]["BackgroundJob"];
35494
+ };
35495
+ };
35496
+ /** @description Error */
35497
+ default: {
35498
+ headers: {
35499
+ [name: string]: unknown;
35500
+ };
35501
+ content: {
35502
+ "application/json": components["schemas"]["Error"];
35503
+ };
35504
+ };
35505
+ };
35506
+ };
34955
35507
  "get-billing-crosscheck": {
34956
35508
  parameters: {
34957
35509
  query?: never;
@@ -64310,14 +64862,50 @@ export interface operations {
64310
64862
  };
64311
64863
  };
64312
64864
  };
64865
+ "get-repository-readme": {
64866
+ parameters: {
64867
+ query: {
64868
+ /** @description OWNER/REPO or the URL of a GitHub repository, or HOST/GROUP/PROJECT of a project on a registered GitLab server. */
64869
+ repo: string;
64870
+ /** @description Branch, tag or commit. */
64871
+ ref: string;
64872
+ /** @description Path of the file within the repository. */
64873
+ path: string;
64874
+ };
64875
+ header?: never;
64876
+ path?: never;
64877
+ cookie?: never;
64878
+ };
64879
+ requestBody?: never;
64880
+ responses: {
64881
+ /** @description OK */
64882
+ 200: {
64883
+ headers: {
64884
+ [name: string]: unknown;
64885
+ };
64886
+ content: {
64887
+ "application/json": components["schemas"]["GetReadmeOutputBody"];
64888
+ };
64889
+ };
64890
+ /** @description Error */
64891
+ default: {
64892
+ headers: {
64893
+ [name: string]: unknown;
64894
+ };
64895
+ content: {
64896
+ "application/json": components["schemas"]["Error"];
64897
+ };
64898
+ };
64899
+ };
64900
+ };
64313
64901
  "get-repository-thumbnail": {
64314
64902
  parameters: {
64315
64903
  query: {
64316
- /** @description HOST/GROUP/PROJECT of a project on a registered GitLab server. */
64904
+ /** @description OWNER/REPO or the URL of a GitHub repository, or HOST/GROUP/PROJECT of a project on a registered GitLab server. */
64317
64905
  repo: string;
64318
64906
  /** @description Branch, tag or commit. */
64319
64907
  ref: string;
64320
- /** @description Path of the image within the repository. */
64908
+ /** @description Path of the file within the repository. */
64321
64909
  path: string;
64322
64910
  };
64323
64911
  header?: never;
@@ -65824,6 +66412,35 @@ export interface operations {
65824
66412
  };
65825
66413
  };
65826
66414
  };
66415
+ "list-user-apps": {
66416
+ parameters: {
66417
+ query?: never;
66418
+ header?: never;
66419
+ path?: never;
66420
+ cookie?: never;
66421
+ };
66422
+ requestBody?: never;
66423
+ responses: {
66424
+ /** @description OK */
66425
+ 200: {
66426
+ headers: {
66427
+ [name: string]: unknown;
66428
+ };
66429
+ content: {
66430
+ "application/json": components["schemas"]["AppsOutputBody"];
66431
+ };
66432
+ };
66433
+ /** @description Error */
66434
+ default: {
66435
+ headers: {
66436
+ [name: string]: unknown;
66437
+ };
66438
+ content: {
66439
+ "application/json": components["schemas"]["Error"];
66440
+ };
66441
+ };
66442
+ };
66443
+ };
65827
66444
  "set-user-changelog-seen": {
65828
66445
  parameters: {
65829
66446
  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.114.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",