@perstack/api-client 0.0.47 → 0.0.48
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 +38 -51
- package/dist/{index.d.mts → bundle.d.mts} +1004 -374
- package/dist/bundle.d.mts.map +1 -0
- package/dist/{index.mjs → bundle.mjs} +692 -442
- package/dist/bundle.mjs.map +1 -0
- package/package.json +5 -4
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -5,7 +5,10 @@ import { activityOrGroupSchema, checkpointSchema as perstackCheckpointSchema, in
|
|
|
5
5
|
//#region ../constants/index.ts
|
|
6
6
|
const organizationNameRegex = /^[a-z0-9][a-z0-9_.-]*$/;
|
|
7
7
|
const maxOrganizationNameLength = 128;
|
|
8
|
+
const applicationNameRegex = /^[a-z0-9][a-z0-9_.-]*$/;
|
|
8
9
|
const maxApplicationNameLength = 255;
|
|
10
|
+
const maxVariableValueLength = 65536;
|
|
11
|
+
const maxSecretValueLength = 65536;
|
|
9
12
|
const expertKeyRegex = /^((?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*)(?:@((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?)|@([a-z0-9][a-z0-9_.-]*))?$/;
|
|
10
13
|
const expertNameRegex = /^(@[a-z0-9][a-z0-9_-]*\/)?[a-z0-9][a-z0-9_-]*$/;
|
|
11
14
|
const scopeNameRegex = /^[a-z0-9][a-z0-9_-]*$/;
|
|
@@ -53,7 +56,7 @@ const providerSchema = z.enum([
|
|
|
53
56
|
"amazon-bedrock",
|
|
54
57
|
"google-vertex"
|
|
55
58
|
]);
|
|
56
|
-
const datetimeSchema = z.string().datetime();
|
|
59
|
+
const datetimeSchema = z.string().datetime({ offset: true });
|
|
57
60
|
const expertKeyFieldSchema = z.string().min(1).max(maxExpertKeyLength).regex(expertKeyRegex);
|
|
58
61
|
const expertNameFieldSchema = z.string().min(1).max(maxExpertNameLength).regex(expertNameRegex);
|
|
59
62
|
const expertVersionFieldSchema = z.string().min(1).max(maxExpertVersionTagLength).regex(expertVersionRegex);
|
|
@@ -98,41 +101,84 @@ const organizationSchema = z.object({
|
|
|
98
101
|
});
|
|
99
102
|
|
|
100
103
|
//#endregion
|
|
101
|
-
//#region ../models/src/domain/
|
|
102
|
-
const
|
|
103
|
-
const applicationStatusSchema = z.enum([
|
|
104
|
+
//#region ../models/src/domain/user.ts
|
|
105
|
+
const userStatusSchema = z.enum([
|
|
104
106
|
"active",
|
|
105
107
|
"inactive",
|
|
106
108
|
"deleted"
|
|
107
109
|
]);
|
|
108
|
-
const
|
|
109
|
-
type: z.literal("
|
|
110
|
+
const userSchema = z.object({
|
|
111
|
+
type: z.literal("user"),
|
|
110
112
|
id: cuidSchema,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
email: z.string().email(),
|
|
114
|
+
emailVerified: z.boolean(),
|
|
115
|
+
name: z.string().min(1).max(255).optional(),
|
|
116
|
+
image: z.string().url().optional(),
|
|
117
|
+
status: userStatusSchema,
|
|
118
|
+
organizations: z.array(organizationSchema),
|
|
113
119
|
createdAt: datetimeSchema,
|
|
114
|
-
updatedAt: datetimeSchema
|
|
115
|
-
name: applicationNameSchema,
|
|
116
|
-
status: applicationStatusSchema
|
|
120
|
+
updatedAt: datetimeSchema
|
|
117
121
|
});
|
|
118
122
|
|
|
119
123
|
//#endregion
|
|
120
|
-
//#region ../models/src/
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
})
|
|
125
|
-
const
|
|
124
|
+
//#region ../models/src/domain/apiKey.ts
|
|
125
|
+
const apiKeyPermissionsSchema = z.object({
|
|
126
|
+
operations: z.array(z.string()),
|
|
127
|
+
experts: z.union([z.array(z.string()), z.literal("*")]).optional()
|
|
128
|
+
});
|
|
129
|
+
const apiKeySchema = z.object({
|
|
130
|
+
type: z.literal("apiKey"),
|
|
131
|
+
id: cuidSchema,
|
|
132
|
+
name: z.string().min(1).max(255).optional(),
|
|
133
|
+
start: z.string().optional(),
|
|
134
|
+
prefix: z.string().optional(),
|
|
135
|
+
user: userSchema.optional(),
|
|
136
|
+
enabled: z.boolean(),
|
|
137
|
+
expiresAt: datetimeSchema.optional(),
|
|
138
|
+
permissions: apiKeyPermissionsSchema.optional(),
|
|
139
|
+
lastRequest: datetimeSchema.optional(),
|
|
140
|
+
createdAt: datetimeSchema,
|
|
141
|
+
updatedAt: datetimeSchema
|
|
142
|
+
});
|
|
143
|
+
const createApiKeyInputSchema = z.object({
|
|
144
|
+
name: z.string().min(1).max(255).optional(),
|
|
145
|
+
organizationId: cuidSchema,
|
|
146
|
+
operations: z.array(z.string()).optional(),
|
|
147
|
+
experts: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
148
|
+
expiresIn: z.number().min(60).optional()
|
|
149
|
+
});
|
|
150
|
+
const createApiKeyResponseSchema = z.object({
|
|
151
|
+
apiKey: apiKeySchema,
|
|
152
|
+
key: z.string()
|
|
153
|
+
});
|
|
126
154
|
|
|
127
155
|
//#endregion
|
|
128
|
-
//#region ../models/src/api/
|
|
129
|
-
const request$
|
|
130
|
-
|
|
156
|
+
//#region ../models/src/api/api-keys/create.ts
|
|
157
|
+
const request$49 = { body: z.object({
|
|
158
|
+
name: z.string().min(1).max(255).optional(),
|
|
159
|
+
operations: z.array(z.string()).optional(),
|
|
160
|
+
experts: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
161
|
+
wildcardApplicationAccess: z.boolean().optional(),
|
|
162
|
+
applicationIds: z.array(cuidSchema).optional(),
|
|
163
|
+
expiresIn: z.number().min(60).optional()
|
|
164
|
+
}) };
|
|
165
|
+
const response$51 = z.object({ data: z.object({
|
|
166
|
+
apiKey: apiKeySchema.extend({
|
|
167
|
+
permissions: apiKeyPermissionsSchema.optional(),
|
|
168
|
+
wildcardApplicationAccess: z.boolean(),
|
|
169
|
+
applicationIds: z.array(cuidSchema)
|
|
170
|
+
}),
|
|
171
|
+
key: z.string()
|
|
172
|
+
}) });
|
|
131
173
|
|
|
132
174
|
//#endregion
|
|
133
|
-
//#region ../models/src/api/
|
|
134
|
-
const request$
|
|
135
|
-
const response$
|
|
175
|
+
//#region ../models/src/api/api-keys/get.ts
|
|
176
|
+
const request$48 = { params: z.object({ apiKeyId: cuidSchema }) };
|
|
177
|
+
const response$50 = z.object({ data: z.object({ apiKey: apiKeySchema.extend({
|
|
178
|
+
permissions: apiKeyPermissionsSchema.optional(),
|
|
179
|
+
wildcardApplicationAccess: z.boolean(),
|
|
180
|
+
applicationIds: z.array(cuidSchema)
|
|
181
|
+
}) }) });
|
|
136
182
|
|
|
137
183
|
//#endregion
|
|
138
184
|
//#region ../../node_modules/ts-dedent/dist/index.js
|
|
@@ -219,9 +265,73 @@ const errorUnauthorizedFlexible = z.object({
|
|
|
219
265
|
reason: z.string()
|
|
220
266
|
}).describe("Unauthorized");
|
|
221
267
|
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region ../models/src/api/api-keys/getAll.ts
|
|
270
|
+
const request$47 = { query: z.object({
|
|
271
|
+
take: z.coerce.number().min(1).max(100).default(20),
|
|
272
|
+
skip: z.coerce.number().min(0).default(0)
|
|
273
|
+
}) };
|
|
274
|
+
const apiKeyWithApplicationsSchema = apiKeySchema.extend({
|
|
275
|
+
permissions: apiKeyPermissionsSchema.optional(),
|
|
276
|
+
wildcardApplicationAccess: z.boolean(),
|
|
277
|
+
applicationIds: z.array(cuidSchema)
|
|
278
|
+
});
|
|
279
|
+
const response$49 = z.object({
|
|
280
|
+
data: z.object({ apiKeys: z.array(apiKeyWithApplicationsSchema) }),
|
|
281
|
+
meta: paginationMeta
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region ../models/src/api/api-keys/revoke.ts
|
|
286
|
+
const request$46 = { params: z.object({ apiKeyId: cuidSchema }) };
|
|
287
|
+
const response$48 = z.object({ data: z.object({ apiKey: apiKeySchema.extend({
|
|
288
|
+
permissions: apiKeyPermissionsSchema.optional(),
|
|
289
|
+
wildcardApplicationAccess: z.boolean(),
|
|
290
|
+
applicationIds: z.array(cuidSchema)
|
|
291
|
+
}) }) });
|
|
292
|
+
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region ../models/src/domain/application.ts
|
|
295
|
+
const applicationNameSchema = z.string().min(1).max(maxApplicationNameLength).regex(applicationNameRegex);
|
|
296
|
+
const applicationStatusSchema = z.enum([
|
|
297
|
+
"active",
|
|
298
|
+
"inactive",
|
|
299
|
+
"deleted"
|
|
300
|
+
]);
|
|
301
|
+
const applicationSchema = z.object({
|
|
302
|
+
type: z.literal("application"),
|
|
303
|
+
id: cuidSchema,
|
|
304
|
+
organizationId: cuidSchema,
|
|
305
|
+
organization: organizationSchema,
|
|
306
|
+
createdAt: datetimeSchema,
|
|
307
|
+
updatedAt: datetimeSchema,
|
|
308
|
+
name: applicationNameSchema,
|
|
309
|
+
status: applicationStatusSchema,
|
|
310
|
+
expertCount: z.number().describe("Number of expert draft scopes associated with this application").optional(),
|
|
311
|
+
providers: z.array(providerSchema).describe("List of configured providers for this application").optional()
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region ../models/src/api/applications/create.ts
|
|
316
|
+
const request$45 = { body: z.object({
|
|
317
|
+
name: applicationNameSchema,
|
|
318
|
+
applicationGroupId: cuidSchema.optional()
|
|
319
|
+
}) };
|
|
320
|
+
const response$47 = z.object({ data: z.object({ application: applicationSchema }) });
|
|
321
|
+
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region ../models/src/api/applications/delete.ts
|
|
324
|
+
const request$44 = { params: z.object({ applicationId: cuidSchema }) };
|
|
325
|
+
const response$46 = z.object({ data: z.object({ application: applicationSchema }) });
|
|
326
|
+
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region ../models/src/api/applications/get.ts
|
|
329
|
+
const request$43 = { params: z.object({ applicationId: cuidSchema }) };
|
|
330
|
+
const response$45 = z.object({ data: z.object({ application: applicationSchema }) });
|
|
331
|
+
|
|
222
332
|
//#endregion
|
|
223
333
|
//#region ../models/src/api/applications/getAll.ts
|
|
224
|
-
const request$
|
|
334
|
+
const request$42 = { query: z.object({
|
|
225
335
|
name: z.union([z.string(), z.array(z.string())]).optional().transform((v) => Array.isArray(v) ? v.join(",") : v),
|
|
226
336
|
sort: z.enum([
|
|
227
337
|
"name",
|
|
@@ -229,29 +339,29 @@ const request$35 = { query: z.object({
|
|
|
229
339
|
"updatedAt"
|
|
230
340
|
]).optional(),
|
|
231
341
|
order: z.enum(["asc", "desc"]).optional(),
|
|
232
|
-
take: z.coerce.number().min(1).max(100).default(
|
|
342
|
+
take: z.coerce.number().min(1).max(100).default(20),
|
|
233
343
|
skip: z.coerce.number().min(0).default(0)
|
|
234
344
|
}) };
|
|
235
|
-
const response$
|
|
345
|
+
const response$44 = z.object({
|
|
236
346
|
data: z.object({ applications: z.array(applicationSchema) }),
|
|
237
347
|
meta: paginationMeta
|
|
238
348
|
});
|
|
239
349
|
|
|
240
350
|
//#endregion
|
|
241
351
|
//#region ../models/src/api/applications/update.ts
|
|
242
|
-
const request$
|
|
352
|
+
const request$41 = {
|
|
243
353
|
params: z.object({ applicationId: cuidSchema }),
|
|
244
354
|
body: z.object({
|
|
245
355
|
name: applicationNameSchema.optional(),
|
|
246
356
|
status: applicationStatusSchema.exclude(["deleted"]).optional()
|
|
247
357
|
}).refine((data) => data.name !== void 0 || data.status !== void 0, { message: "At least one field must be provided" })
|
|
248
358
|
};
|
|
249
|
-
const response$
|
|
359
|
+
const response$43 = z.object({ data: z.object({ application: applicationSchema }) });
|
|
250
360
|
|
|
251
361
|
//#endregion
|
|
252
362
|
//#region ../models/src/domain/secret.ts
|
|
253
363
|
const secretNameSchema = z.string().min(1, "Secret name is required").max(255, "Secret name must be 255 characters or less").regex(/^[A-Z][A-Z0-9_]*$/, "Secret name must start with uppercase letter and contain only uppercase letters, numbers, and underscores");
|
|
254
|
-
const secretValueSchema = z.string().min(1, "Secret value is required");
|
|
364
|
+
const secretValueSchema = z.string().min(1, "Secret value is required").max(maxSecretValueLength);
|
|
255
365
|
const secretMetadataSchema = z.object({
|
|
256
366
|
name: z.string(),
|
|
257
367
|
createdAt: datetimeSchema,
|
|
@@ -268,49 +378,49 @@ const secretSchema = z.object({
|
|
|
268
378
|
|
|
269
379
|
//#endregion
|
|
270
380
|
//#region ../models/src/api/env/secrets/create.ts
|
|
271
|
-
const request$
|
|
381
|
+
const request$40 = { body: z.object({
|
|
272
382
|
applicationId: cuidSchema,
|
|
273
383
|
name: secretNameSchema,
|
|
274
384
|
value: secretValueSchema
|
|
275
385
|
}) };
|
|
276
|
-
const response$
|
|
386
|
+
const response$42 = z.object({ data: z.object({ secret: secretMetadataSchema }) });
|
|
277
387
|
|
|
278
388
|
//#endregion
|
|
279
389
|
//#region ../models/src/api/env/secrets/delete.ts
|
|
280
|
-
const request$
|
|
390
|
+
const request$39 = {
|
|
281
391
|
params: z.object({ name: z.string().min(1) }),
|
|
282
392
|
query: z.object({ applicationId: cuidSchema })
|
|
283
393
|
};
|
|
284
|
-
const response$
|
|
394
|
+
const response$41 = z.null();
|
|
285
395
|
|
|
286
396
|
//#endregion
|
|
287
397
|
//#region ../models/src/api/env/secrets/get.ts
|
|
288
|
-
const request$
|
|
398
|
+
const request$38 = {
|
|
289
399
|
params: z.object({ name: z.string().min(1) }),
|
|
290
400
|
query: z.object({ applicationId: cuidSchema })
|
|
291
401
|
};
|
|
292
|
-
const response$
|
|
402
|
+
const response$40 = z.object({ data: z.object({ secret: secretMetadataSchema }) });
|
|
293
403
|
|
|
294
404
|
//#endregion
|
|
295
405
|
//#region ../models/src/api/env/secrets/getAll.ts
|
|
296
|
-
const request$
|
|
297
|
-
const response$
|
|
406
|
+
const request$37 = { query: z.object({ applicationId: cuidSchema.optional() }) };
|
|
407
|
+
const response$39 = z.object({ data: z.object({ secrets: z.array(secretMetadataSchema) }) });
|
|
298
408
|
|
|
299
409
|
//#endregion
|
|
300
410
|
//#region ../models/src/api/env/secrets/update.ts
|
|
301
|
-
const request$
|
|
411
|
+
const request$36 = {
|
|
302
412
|
params: z.object({ name: z.string().min(1) }),
|
|
303
413
|
body: z.object({
|
|
304
414
|
applicationId: cuidSchema,
|
|
305
415
|
value: secretValueSchema
|
|
306
416
|
})
|
|
307
417
|
};
|
|
308
|
-
const response$
|
|
418
|
+
const response$38 = z.object({ data: z.object({ secret: secretMetadataSchema }) });
|
|
309
419
|
|
|
310
420
|
//#endregion
|
|
311
421
|
//#region ../models/src/domain/variable.ts
|
|
312
|
-
const variableNameSchema = z.string().min(1).max(255).regex(/^[A-
|
|
313
|
-
const variableValueSchema = z.string();
|
|
422
|
+
const variableNameSchema = z.string().min(1).max(255).regex(/^[A-Z][A-Z0-9_]*$/, "Variable name must start with uppercase letter and contain only uppercase letters, digits, and underscores");
|
|
423
|
+
const variableValueSchema = z.string().max(maxVariableValueLength);
|
|
314
424
|
const variableSchema = z.object({
|
|
315
425
|
type: z.literal("variable"),
|
|
316
426
|
id: cuidSchema,
|
|
@@ -329,44 +439,44 @@ const variableResponseSchema = z.object({
|
|
|
329
439
|
|
|
330
440
|
//#endregion
|
|
331
441
|
//#region ../models/src/api/env/variables/create.ts
|
|
332
|
-
const request$
|
|
442
|
+
const request$35 = { body: z.object({
|
|
333
443
|
applicationId: cuidSchema,
|
|
334
444
|
name: variableNameSchema,
|
|
335
445
|
value: variableValueSchema
|
|
336
446
|
}) };
|
|
337
|
-
const response$
|
|
447
|
+
const response$37 = z.object({ data: z.object({ variable: variableResponseSchema }) });
|
|
338
448
|
|
|
339
449
|
//#endregion
|
|
340
450
|
//#region ../models/src/api/env/variables/delete.ts
|
|
341
|
-
const request$
|
|
451
|
+
const request$34 = {
|
|
342
452
|
params: z.object({ name: z.string().min(1) }),
|
|
343
453
|
query: z.object({ applicationId: cuidSchema })
|
|
344
454
|
};
|
|
345
|
-
const response$
|
|
455
|
+
const response$36 = z.null();
|
|
346
456
|
|
|
347
457
|
//#endregion
|
|
348
458
|
//#region ../models/src/api/env/variables/get.ts
|
|
349
|
-
const request$
|
|
459
|
+
const request$33 = {
|
|
350
460
|
params: z.object({ name: z.string().min(1) }),
|
|
351
461
|
query: z.object({ applicationId: cuidSchema })
|
|
352
462
|
};
|
|
353
|
-
const response$
|
|
463
|
+
const response$35 = z.object({ data: z.object({ variable: variableResponseSchema }) });
|
|
354
464
|
|
|
355
465
|
//#endregion
|
|
356
466
|
//#region ../models/src/api/env/variables/getAll.ts
|
|
357
|
-
const request$
|
|
358
|
-
const response$
|
|
467
|
+
const request$32 = { query: z.object({ applicationId: cuidSchema }) };
|
|
468
|
+
const response$34 = z.object({ data: z.object({ variables: z.array(variableResponseSchema) }) });
|
|
359
469
|
|
|
360
470
|
//#endregion
|
|
361
471
|
//#region ../models/src/api/env/variables/update.ts
|
|
362
|
-
const request$
|
|
472
|
+
const request$31 = {
|
|
363
473
|
params: z.object({ name: z.string().min(1) }),
|
|
364
474
|
body: z.object({
|
|
365
475
|
applicationId: cuidSchema,
|
|
366
476
|
value: variableValueSchema
|
|
367
477
|
})
|
|
368
478
|
};
|
|
369
|
-
const response$
|
|
479
|
+
const response$33 = z.object({ data: z.object({ variable: variableResponseSchema }) });
|
|
370
480
|
|
|
371
481
|
//#endregion
|
|
372
482
|
//#region ../models/src/domain/expertScope.ts
|
|
@@ -507,8 +617,8 @@ const expertDefinitionSchema = z.object({
|
|
|
507
617
|
|
|
508
618
|
//#endregion
|
|
509
619
|
//#region ../models/src/api/experts/delete.ts
|
|
510
|
-
const request$
|
|
511
|
-
const response$
|
|
620
|
+
const request$30 = { params: z.object({ scopeName: scopeNameRefSchema }) };
|
|
621
|
+
const response$32 = z.object({ data: expertMetadataSchema.extend({
|
|
512
622
|
yanked: z.literal(true),
|
|
513
623
|
latestTagUpdated: z.boolean()
|
|
514
624
|
}) });
|
|
@@ -554,14 +664,14 @@ const expertDefinitionContentSchema = z.object({
|
|
|
554
664
|
|
|
555
665
|
//#endregion
|
|
556
666
|
//#region ../models/src/api/experts/drafts/create.ts
|
|
557
|
-
const request$
|
|
667
|
+
const request$29 = {
|
|
558
668
|
params: z.object({ scopeName: scopeNameSchema }),
|
|
559
669
|
body: z.object({
|
|
560
670
|
applicationId: cuidSchema,
|
|
561
671
|
experts: z.array(expertSchema)
|
|
562
672
|
})
|
|
563
673
|
};
|
|
564
|
-
const response$
|
|
674
|
+
const response$31 = z.object({ data: z.object({
|
|
565
675
|
scope: expertDraftScopeSchema,
|
|
566
676
|
draftRef: expertDraftRefSchema,
|
|
567
677
|
definition: expertDefinitionContentSchema
|
|
@@ -569,22 +679,22 @@ const response$24 = z.object({ data: z.object({
|
|
|
569
679
|
|
|
570
680
|
//#endregion
|
|
571
681
|
//#region ../models/src/api/experts/drafts/delete.ts
|
|
572
|
-
const request$
|
|
682
|
+
const request$28 = { params: z.object({
|
|
573
683
|
scopeName: scopeNameSchema,
|
|
574
684
|
draftRef: expertDraftRefSchema.shape.id
|
|
575
685
|
}) };
|
|
576
|
-
const response$
|
|
686
|
+
const response$30 = z.object({ data: z.object({
|
|
577
687
|
deleted: z.boolean(),
|
|
578
688
|
draftRef: z.string()
|
|
579
689
|
}) });
|
|
580
690
|
|
|
581
691
|
//#endregion
|
|
582
692
|
//#region ../models/src/api/experts/drafts/get.ts
|
|
583
|
-
const request$
|
|
693
|
+
const request$27 = { params: z.object({
|
|
584
694
|
scopeName: scopeNameSchema,
|
|
585
695
|
draftRef: expertDraftRefSchema.shape.id
|
|
586
696
|
}) };
|
|
587
|
-
const response$
|
|
697
|
+
const response$29 = z.object({ data: z.object({
|
|
588
698
|
scope: expertDraftScopeSchema,
|
|
589
699
|
draftRef: expertDraftRefSchema,
|
|
590
700
|
definition: expertDefinitionContentSchema
|
|
@@ -592,28 +702,28 @@ const response$22 = z.object({ data: z.object({
|
|
|
592
702
|
|
|
593
703
|
//#endregion
|
|
594
704
|
//#region ../models/src/api/experts/drafts/getAll.ts
|
|
595
|
-
const request$
|
|
705
|
+
const request$26 = {
|
|
596
706
|
params: z.object({ scopeName: expertDraftScopeSchema.shape.name }),
|
|
597
707
|
query: z.object({
|
|
598
|
-
|
|
599
|
-
|
|
708
|
+
take: z.coerce.number().int().min(1).max(100).default(20),
|
|
709
|
+
skip: z.coerce.number().int().min(0).default(0)
|
|
600
710
|
})
|
|
601
711
|
};
|
|
602
|
-
const response$
|
|
603
|
-
draftRefs: z.array(expertDraftRefSchema),
|
|
604
|
-
|
|
605
|
-
})
|
|
712
|
+
const response$28 = z.object({
|
|
713
|
+
data: z.object({ draftRefs: z.array(expertDraftRefSchema) }),
|
|
714
|
+
meta: paginationMeta
|
|
715
|
+
});
|
|
606
716
|
|
|
607
717
|
//#endregion
|
|
608
718
|
//#region ../models/src/api/experts/drafts/update.ts
|
|
609
|
-
const request$
|
|
719
|
+
const request$25 = {
|
|
610
720
|
params: z.object({
|
|
611
721
|
scopeName: scopeNameSchema,
|
|
612
722
|
draftRef: expertDraftRefSchema.shape.id
|
|
613
723
|
}),
|
|
614
724
|
body: z.object({ experts: z.array(expertSchema) })
|
|
615
725
|
};
|
|
616
|
-
const response$
|
|
726
|
+
const response$27 = z.object({ data: z.object({
|
|
617
727
|
scope: expertDraftScopeSchema,
|
|
618
728
|
draftRef: expertDraftRefSchema,
|
|
619
729
|
definition: expertDefinitionContentSchema
|
|
@@ -621,7 +731,7 @@ const response$20 = z.object({ data: z.object({
|
|
|
621
731
|
|
|
622
732
|
//#endregion
|
|
623
733
|
//#region ../models/src/api/experts/drafts/version.ts
|
|
624
|
-
const request$
|
|
734
|
+
const request$24 = {
|
|
625
735
|
params: z.object({
|
|
626
736
|
scopeName: scopeNameSchema,
|
|
627
737
|
draftRef: z.string().min(1)
|
|
@@ -631,7 +741,7 @@ const request$17 = {
|
|
|
631
741
|
tag: z.string().max(maxExpertVersionTagLength, "Tag is too long.").regex(tagNameRegex, "Invalid tag format. (e.g. latest)").optional()
|
|
632
742
|
})
|
|
633
743
|
};
|
|
634
|
-
const response$
|
|
744
|
+
const response$26 = z.object({ data: z.object({
|
|
635
745
|
scope: expertScopeSchema,
|
|
636
746
|
version: expertVersionSchema,
|
|
637
747
|
definitionUrl: z.string()
|
|
@@ -639,7 +749,7 @@ const response$19 = z.object({ data: z.object({
|
|
|
639
749
|
|
|
640
750
|
//#endregion
|
|
641
751
|
//#region ../models/src/api/experts/featured.ts
|
|
642
|
-
const response$
|
|
752
|
+
const response$25 = z.object({ data: z.object({ featuredExperts: z.array(z.object({
|
|
643
753
|
scope: expertScopeSchema,
|
|
644
754
|
currentVersion: expertVersionSchema,
|
|
645
755
|
displayOrder: z.number().int().min(0).max(2),
|
|
@@ -648,15 +758,15 @@ const response$18 = z.object({ data: z.object({ featuredExperts: z.array(z.objec
|
|
|
648
758
|
|
|
649
759
|
//#endregion
|
|
650
760
|
//#region ../models/src/api/experts/get.ts
|
|
651
|
-
const request$
|
|
652
|
-
const response$
|
|
761
|
+
const request$23 = { params: z.object({ scopeName: scopeNameRefSchema }) };
|
|
762
|
+
const response$24 = z.object({ data: z.object({
|
|
653
763
|
definition: expertDefinitionSchema,
|
|
654
764
|
yanked: z.boolean().optional()
|
|
655
765
|
}) });
|
|
656
766
|
|
|
657
767
|
//#endregion
|
|
658
768
|
//#region ../models/src/api/experts/getAll.ts
|
|
659
|
-
const request$
|
|
769
|
+
const request$22 = { query: z.object({
|
|
660
770
|
filter: z.string().describe("Filter by scope name (partial match)").optional(),
|
|
661
771
|
category: z.enum([
|
|
662
772
|
"general",
|
|
@@ -667,36 +777,36 @@ const request$15 = { query: z.object({
|
|
|
667
777
|
"automation"
|
|
668
778
|
]).describe("Filter by category").optional(),
|
|
669
779
|
includeDrafts: z.coerce.boolean().default(false).describe("Include unpublished scopes (owner only)").optional(),
|
|
670
|
-
|
|
671
|
-
|
|
780
|
+
take: z.coerce.number().min(1).max(100).default(20),
|
|
781
|
+
skip: z.coerce.number().min(0).default(0)
|
|
672
782
|
}) };
|
|
673
|
-
const response$
|
|
674
|
-
experts: z.array(expertScopeSchema.extend({ currentVersion: expertVersionSchema })),
|
|
675
|
-
|
|
676
|
-
})
|
|
783
|
+
const response$23 = z.object({
|
|
784
|
+
data: z.object({ experts: z.array(expertScopeSchema.extend({ currentVersion: expertVersionSchema })) }),
|
|
785
|
+
meta: paginationMeta
|
|
786
|
+
});
|
|
677
787
|
|
|
678
788
|
//#endregion
|
|
679
789
|
//#region ../models/src/api/experts/meta.ts
|
|
680
|
-
const request$
|
|
790
|
+
const request$21 = {
|
|
681
791
|
params: z.object({ scopeName: scopeNameRefSchema }),
|
|
682
792
|
query: z.object({ public: z.enum(["true", "false"]).transform((val) => val === "true").optional().default(false).describe("Public access check (no auth)") })
|
|
683
793
|
};
|
|
684
|
-
const response$
|
|
794
|
+
const response$22 = z.object({ data: expertMetadataSchema.extend({ definitionUrl: z.string() }) });
|
|
685
795
|
|
|
686
796
|
//#endregion
|
|
687
797
|
//#region ../models/src/api/experts/publish.ts
|
|
688
|
-
const request$
|
|
689
|
-
const response$
|
|
798
|
+
const request$20 = { params: z.object({ scopeName: scopeNameSchema }) };
|
|
799
|
+
const response$21 = z.object({ data: z.object({ scope: expertScopeSchema }) });
|
|
690
800
|
|
|
691
801
|
//#endregion
|
|
692
802
|
//#region ../models/src/api/experts/unpublish.ts
|
|
693
|
-
const request$
|
|
694
|
-
const response$
|
|
803
|
+
const request$19 = { params: z.object({ scopeName: scopeNameSchema }) };
|
|
804
|
+
const response$20 = z.object({ data: z.object({ scope: expertScopeSchema }) });
|
|
695
805
|
|
|
696
806
|
//#endregion
|
|
697
807
|
//#region ../models/src/api/experts/versions.ts
|
|
698
|
-
const request$
|
|
699
|
-
const response$
|
|
808
|
+
const request$18 = { params: z.object({ scopeName: scopeNameSchema }) };
|
|
809
|
+
const response$19 = z.object({ data: z.object({ versions: z.array(expertVersionSchema) }) });
|
|
700
810
|
|
|
701
811
|
//#endregion
|
|
702
812
|
//#region ../models/src/domain/checkpoint.ts
|
|
@@ -775,44 +885,44 @@ const requestCheckpointSchema = perstackCheckpointSchema.omit({
|
|
|
775
885
|
id: true,
|
|
776
886
|
runId: true
|
|
777
887
|
}).extend({ runId: z.string().optional() });
|
|
778
|
-
const request$
|
|
888
|
+
const request$17 = {
|
|
779
889
|
params: z.object({ jobId: cuidSchema }),
|
|
780
890
|
body: z.object({
|
|
781
891
|
checkpoint: requestCheckpointSchema,
|
|
782
892
|
step: stepSchema
|
|
783
893
|
})
|
|
784
894
|
};
|
|
785
|
-
const response$
|
|
895
|
+
const response$18 = z.object({ data: z.object({ checkpoint: apiCheckpointSchema }) });
|
|
786
896
|
|
|
787
897
|
//#endregion
|
|
788
898
|
//#region ../models/src/api/jobs/checkpoints/get.ts
|
|
789
|
-
const request$
|
|
899
|
+
const request$16 = { params: z.object({
|
|
790
900
|
jobId: cuidSchema,
|
|
791
901
|
checkpointId: cuidSchema
|
|
792
902
|
}) };
|
|
793
|
-
const response$
|
|
903
|
+
const response$17 = z.object({ data: z.object({ checkpoint: apiCheckpointSchema }) });
|
|
794
904
|
|
|
795
905
|
//#endregion
|
|
796
906
|
//#region ../models/src/api/jobs/checkpoints/getAll.ts
|
|
797
|
-
const request$
|
|
907
|
+
const request$15 = {
|
|
798
908
|
params: z.object({ jobId: cuidSchema }),
|
|
799
909
|
query: z.object({
|
|
800
910
|
filter: z.string().min(1).max(256).optional(),
|
|
801
911
|
sort: z.enum(["createdAt", "updatedAt"]).optional(),
|
|
802
912
|
order: z.enum(["asc", "desc"]).optional(),
|
|
803
|
-
take: z.coerce.number().min(1).max(100).default(
|
|
913
|
+
take: z.coerce.number().min(1).max(100).default(20),
|
|
804
914
|
skip: z.coerce.number().min(0).default(0)
|
|
805
915
|
})
|
|
806
916
|
};
|
|
807
|
-
const response$
|
|
917
|
+
const response$16 = z.object({
|
|
808
918
|
data: z.object({ checkpoints: z.array(apiCheckpointSchema) }),
|
|
809
919
|
meta: paginationMeta
|
|
810
920
|
});
|
|
811
921
|
|
|
812
922
|
//#endregion
|
|
813
923
|
//#region ../models/src/api/jobs/checkpoints/stream.ts
|
|
814
|
-
const request$
|
|
815
|
-
const response$
|
|
924
|
+
const request$14 = { params: z.object({ jobId: cuidSchema }) };
|
|
925
|
+
const response$15 = z.object({ data: apiCheckpointSchema });
|
|
816
926
|
|
|
817
927
|
//#endregion
|
|
818
928
|
//#region ../support-models/src/index.ts
|
|
@@ -1014,7 +1124,7 @@ const jobSchema = z.object({
|
|
|
1014
1124
|
|
|
1015
1125
|
//#endregion
|
|
1016
1126
|
//#region ../models/src/api/jobs/continue.ts
|
|
1017
|
-
const request$
|
|
1127
|
+
const request$13 = {
|
|
1018
1128
|
params: z.object({ jobId: cuidSchema }),
|
|
1019
1129
|
body: z.object({
|
|
1020
1130
|
query: jobSchema.shape.query.optional(),
|
|
@@ -1027,11 +1137,11 @@ const request$6 = {
|
|
|
1027
1137
|
maxRetries: z.coerce.number().optional()
|
|
1028
1138
|
})
|
|
1029
1139
|
};
|
|
1030
|
-
const response$
|
|
1140
|
+
const response$14 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1031
1141
|
|
|
1032
1142
|
//#endregion
|
|
1033
1143
|
//#region ../models/src/api/jobs/create.ts
|
|
1034
|
-
const request$
|
|
1144
|
+
const request$12 = { body: z.object({
|
|
1035
1145
|
applicationId: cuidSchema.describe("Application ID to create the job in"),
|
|
1036
1146
|
expertKey: expertKeyFieldSchema,
|
|
1037
1147
|
query: jobSchema.shape.query.optional(),
|
|
@@ -1042,135 +1152,33 @@ const request$5 = { body: z.object({
|
|
|
1042
1152
|
maxSteps: z.coerce.number().optional(),
|
|
1043
1153
|
maxRetries: z.coerce.number().optional()
|
|
1044
1154
|
}) };
|
|
1045
|
-
const response$
|
|
1155
|
+
const response$13 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1046
1156
|
|
|
1047
1157
|
//#endregion
|
|
1048
1158
|
//#region ../models/src/api/jobs/get.ts
|
|
1049
|
-
const request$
|
|
1050
|
-
const response$
|
|
1159
|
+
const request$11 = { params: z.object({ jobId: cuidSchema }) };
|
|
1160
|
+
const response$12 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1051
1161
|
|
|
1052
1162
|
//#endregion
|
|
1053
1163
|
//#region ../models/src/api/jobs/getAll.ts
|
|
1054
|
-
const request$
|
|
1164
|
+
const request$10 = { query: z.object({
|
|
1055
1165
|
sort: z.enum(["createdAt", "updatedAt"]).optional(),
|
|
1056
1166
|
order: z.enum(["asc", "desc"]).optional(),
|
|
1057
|
-
take: z.coerce.number().min(1).max(100).default(
|
|
1167
|
+
take: z.coerce.number().min(1).max(100).default(20),
|
|
1058
1168
|
skip: z.coerce.number().min(0).default(0)
|
|
1059
1169
|
}) };
|
|
1060
|
-
const response$
|
|
1170
|
+
const response$11 = z.object({
|
|
1061
1171
|
data: z.object({ jobs: z.array(jobSchema) }),
|
|
1062
1172
|
meta: paginationMeta
|
|
1063
1173
|
});
|
|
1064
1174
|
|
|
1065
1175
|
//#endregion
|
|
1066
1176
|
//#region ../models/src/api/jobs/update.ts
|
|
1067
|
-
const request$
|
|
1177
|
+
const request$9 = {
|
|
1068
1178
|
params: z.object({ jobId: cuidSchema }),
|
|
1069
1179
|
body: z.object({ status: jobStatusSchema })
|
|
1070
1180
|
};
|
|
1071
|
-
const response$
|
|
1072
|
-
|
|
1073
|
-
//#endregion
|
|
1074
|
-
//#region ../models/src/api/jobs/workspace/get.ts
|
|
1075
|
-
const workspaceCommitSchema = z.object({
|
|
1076
|
-
sha: z.string(),
|
|
1077
|
-
message: z.string(),
|
|
1078
|
-
author: z.string(),
|
|
1079
|
-
timestamp: z.string()
|
|
1080
|
-
});
|
|
1081
|
-
const workspaceStatsSchema = z.object({
|
|
1082
|
-
commits: z.number().int().min(0),
|
|
1083
|
-
filesChanged: z.number().int().min(0),
|
|
1084
|
-
additions: z.number().int().min(0),
|
|
1085
|
-
deletions: z.number().int().min(0)
|
|
1086
|
-
});
|
|
1087
|
-
const workspaceSchema = z.object({
|
|
1088
|
-
jobId: z.string(),
|
|
1089
|
-
branch: z.string(),
|
|
1090
|
-
baseBranch: z.string(),
|
|
1091
|
-
lastCommit: workspaceCommitSchema.optional(),
|
|
1092
|
-
stats: workspaceStatsSchema.optional()
|
|
1093
|
-
});
|
|
1094
|
-
const request$1 = { params: z.object({ jobId: cuidSchema }) };
|
|
1095
|
-
const response$2 = z.object({ data: z.object({ workspace: workspaceSchema }) });
|
|
1096
|
-
|
|
1097
|
-
//#endregion
|
|
1098
|
-
//#region ../models/src/api/jobs/workspace/tree.ts
|
|
1099
|
-
const workspaceItemSchema = z.object({
|
|
1100
|
-
type: z.enum(["directory", "file"]),
|
|
1101
|
-
path: z.string(),
|
|
1102
|
-
name: z.string(),
|
|
1103
|
-
size: z.number().optional(),
|
|
1104
|
-
sha: z.string().optional()
|
|
1105
|
-
});
|
|
1106
|
-
const request = {
|
|
1107
|
-
params: z.object({ jobId: cuidSchema }),
|
|
1108
|
-
query: z.object({
|
|
1109
|
-
path: z.string().optional(),
|
|
1110
|
-
recursive: z.coerce.boolean().optional()
|
|
1111
|
-
})
|
|
1112
|
-
};
|
|
1113
|
-
const response$1 = z.object({ data: z.object({ items: z.array(workspaceItemSchema) }) });
|
|
1114
|
-
|
|
1115
|
-
//#endregion
|
|
1116
|
-
//#region ../models/src/domain/user.ts
|
|
1117
|
-
const userStatusSchema = z.enum([
|
|
1118
|
-
"active",
|
|
1119
|
-
"inactive",
|
|
1120
|
-
"deleted"
|
|
1121
|
-
]);
|
|
1122
|
-
const userSchema = z.object({
|
|
1123
|
-
type: z.literal("user"),
|
|
1124
|
-
id: cuidSchema,
|
|
1125
|
-
email: z.string().email(),
|
|
1126
|
-
emailVerified: z.boolean(),
|
|
1127
|
-
name: z.string().min(1).max(255).optional(),
|
|
1128
|
-
image: z.string().url().optional(),
|
|
1129
|
-
status: userStatusSchema,
|
|
1130
|
-
organizations: z.array(organizationSchema),
|
|
1131
|
-
createdAt: datetimeSchema,
|
|
1132
|
-
updatedAt: datetimeSchema
|
|
1133
|
-
});
|
|
1134
|
-
|
|
1135
|
-
//#endregion
|
|
1136
|
-
//#region ../models/src/api/session/get.ts
|
|
1137
|
-
const response = z.object({ data: z.object({
|
|
1138
|
-
user: userSchema,
|
|
1139
|
-
organization: organizationSchema,
|
|
1140
|
-
application: applicationSchema.nullable()
|
|
1141
|
-
}) });
|
|
1142
|
-
|
|
1143
|
-
//#endregion
|
|
1144
|
-
//#region ../models/src/domain/apiKey.ts
|
|
1145
|
-
const apiKeyPermissionsSchema = z.object({
|
|
1146
|
-
operations: z.array(z.string()),
|
|
1147
|
-
experts: z.union([z.array(z.string()), z.literal("*")]).optional()
|
|
1148
|
-
});
|
|
1149
|
-
const apiKeySchema = z.object({
|
|
1150
|
-
type: z.literal("apiKey"),
|
|
1151
|
-
id: cuidSchema,
|
|
1152
|
-
name: z.string().min(1).max(255).optional(),
|
|
1153
|
-
start: z.string().optional(),
|
|
1154
|
-
prefix: z.string().optional(),
|
|
1155
|
-
user: userSchema.optional(),
|
|
1156
|
-
enabled: z.boolean(),
|
|
1157
|
-
expiresAt: datetimeSchema.optional(),
|
|
1158
|
-
permissions: apiKeyPermissionsSchema.optional(),
|
|
1159
|
-
lastRequest: datetimeSchema.optional(),
|
|
1160
|
-
createdAt: datetimeSchema,
|
|
1161
|
-
updatedAt: datetimeSchema
|
|
1162
|
-
});
|
|
1163
|
-
const createApiKeyInputSchema = z.object({
|
|
1164
|
-
name: z.string().min(1).max(255).optional(),
|
|
1165
|
-
organizationId: cuidSchema,
|
|
1166
|
-
operations: z.array(z.string()).optional(),
|
|
1167
|
-
experts: z.union([z.array(z.string()), z.literal("*")]).optional(),
|
|
1168
|
-
expiresIn: z.number().min(60).optional()
|
|
1169
|
-
});
|
|
1170
|
-
const createApiKeyResponseSchema = z.object({
|
|
1171
|
-
apiKey: apiKeySchema,
|
|
1172
|
-
key: z.string()
|
|
1173
|
-
});
|
|
1181
|
+
const response$10 = z.object({ data: z.object({ job: jobSchema }) });
|
|
1174
1182
|
|
|
1175
1183
|
//#endregion
|
|
1176
1184
|
//#region ../models/src/domain/providerSetting.ts
|
|
@@ -1228,6 +1236,112 @@ const providerSettingSchema = z.object({
|
|
|
1228
1236
|
createdAt: datetimeSchema,
|
|
1229
1237
|
updatedAt: datetimeSchema
|
|
1230
1238
|
});
|
|
1239
|
+
const providerSettingResponseSchema = z.object({
|
|
1240
|
+
type: z.literal("providerSetting"),
|
|
1241
|
+
id: cuidSchema,
|
|
1242
|
+
provider: providerSchema,
|
|
1243
|
+
settings: providerSettingsSchema.optional(),
|
|
1244
|
+
createdAt: datetimeSchema,
|
|
1245
|
+
updatedAt: datetimeSchema
|
|
1246
|
+
});
|
|
1247
|
+
const providerApiKeyMetadataSchema = z.object({
|
|
1248
|
+
id: cuidSchema,
|
|
1249
|
+
name: z.string(),
|
|
1250
|
+
createdAt: datetimeSchema,
|
|
1251
|
+
updatedAt: datetimeSchema,
|
|
1252
|
+
lastUsedAt: datetimeSchema.nullable(),
|
|
1253
|
+
expiresAt: datetimeSchema.nullable()
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
//#endregion
|
|
1257
|
+
//#region ../models/src/api/provider-settings/api-keys/create.ts
|
|
1258
|
+
const request$8 = {
|
|
1259
|
+
params: z.object({
|
|
1260
|
+
applicationId: cuidSchema,
|
|
1261
|
+
provider: providerSchema
|
|
1262
|
+
}),
|
|
1263
|
+
body: z.object({
|
|
1264
|
+
name: z.string().min(1).max(255),
|
|
1265
|
+
value: z.string().min(1)
|
|
1266
|
+
})
|
|
1267
|
+
};
|
|
1268
|
+
const response$9 = z.object({ data: z.object({ apiKey: providerApiKeyMetadataSchema }) });
|
|
1269
|
+
|
|
1270
|
+
//#endregion
|
|
1271
|
+
//#region ../models/src/api/provider-settings/api-keys/delete.ts
|
|
1272
|
+
const request$7 = { params: z.object({
|
|
1273
|
+
applicationId: cuidSchema,
|
|
1274
|
+
provider: providerSchema,
|
|
1275
|
+
apiKeyId: cuidSchema
|
|
1276
|
+
}) };
|
|
1277
|
+
const response$8 = z.null();
|
|
1278
|
+
|
|
1279
|
+
//#endregion
|
|
1280
|
+
//#region ../models/src/api/provider-settings/api-keys/getAll.ts
|
|
1281
|
+
const request$6 = { params: z.object({
|
|
1282
|
+
applicationId: cuidSchema,
|
|
1283
|
+
provider: providerSchema
|
|
1284
|
+
}) };
|
|
1285
|
+
const response$7 = z.object({ data: z.object({ apiKeys: z.array(providerApiKeyMetadataSchema) }) });
|
|
1286
|
+
|
|
1287
|
+
//#endregion
|
|
1288
|
+
//#region ../models/src/api/provider-settings/create.ts
|
|
1289
|
+
const request$5 = {
|
|
1290
|
+
params: z.object({ applicationId: cuidSchema }),
|
|
1291
|
+
body: z.object({
|
|
1292
|
+
provider: providerSchema,
|
|
1293
|
+
settings: providerSettingsSchema.optional()
|
|
1294
|
+
})
|
|
1295
|
+
};
|
|
1296
|
+
const response$6 = z.object({ data: z.object({ providerSetting: providerSettingResponseSchema }) });
|
|
1297
|
+
|
|
1298
|
+
//#endregion
|
|
1299
|
+
//#region ../models/src/api/provider-settings/delete.ts
|
|
1300
|
+
const request$4 = { params: z.object({
|
|
1301
|
+
applicationId: cuidSchema,
|
|
1302
|
+
provider: providerSchema
|
|
1303
|
+
}) };
|
|
1304
|
+
const response$5 = z.null();
|
|
1305
|
+
|
|
1306
|
+
//#endregion
|
|
1307
|
+
//#region ../models/src/api/provider-settings/get.ts
|
|
1308
|
+
const request$3 = { params: z.object({
|
|
1309
|
+
applicationId: cuidSchema,
|
|
1310
|
+
provider: providerSchema
|
|
1311
|
+
}) };
|
|
1312
|
+
const response$4 = z.object({ data: z.object({
|
|
1313
|
+
providerSetting: providerSettingResponseSchema,
|
|
1314
|
+
apiKeys: z.array(providerApiKeyMetadataSchema)
|
|
1315
|
+
}) });
|
|
1316
|
+
|
|
1317
|
+
//#endregion
|
|
1318
|
+
//#region ../models/src/api/provider-settings/getAll.ts
|
|
1319
|
+
const request$2 = { params: z.object({ applicationId: cuidSchema }) };
|
|
1320
|
+
const response$3 = z.object({ data: z.object({ providerSettings: z.array(providerSettingResponseSchema) }) });
|
|
1321
|
+
|
|
1322
|
+
//#endregion
|
|
1323
|
+
//#region ../models/src/api/provider-settings/update.ts
|
|
1324
|
+
const request$1 = {
|
|
1325
|
+
params: z.object({
|
|
1326
|
+
applicationId: cuidSchema,
|
|
1327
|
+
provider: providerSchema
|
|
1328
|
+
}),
|
|
1329
|
+
body: z.object({ settings: providerSettingsSchema.optional() })
|
|
1330
|
+
};
|
|
1331
|
+
const response$2 = z.object({ data: z.object({ providerSetting: providerSettingResponseSchema }) });
|
|
1332
|
+
|
|
1333
|
+
//#endregion
|
|
1334
|
+
//#region ../models/src/api/session/get.ts
|
|
1335
|
+
const response$1 = z.object({ data: z.object({
|
|
1336
|
+
user: userSchema,
|
|
1337
|
+
organization: organizationSchema,
|
|
1338
|
+
application: applicationSchema.nullable()
|
|
1339
|
+
}) });
|
|
1340
|
+
|
|
1341
|
+
//#endregion
|
|
1342
|
+
//#region ../models/src/api/session/setApplication.ts
|
|
1343
|
+
const request = { body: z.object({ applicationId: z.string().min(1, "Application ID is required") }) };
|
|
1344
|
+
const response = z.object({ data: z.object({ success: z.literal(true) }) });
|
|
1231
1345
|
|
|
1232
1346
|
//#endregion
|
|
1233
1347
|
//#region ../models/src/domain/providerApiKey.ts
|
|
@@ -1278,6 +1392,7 @@ const runSchema = z.object({
|
|
|
1278
1392
|
//#region src/lib/errors.ts
|
|
1279
1393
|
function createValidationError(error) {
|
|
1280
1394
|
return {
|
|
1395
|
+
errorType: "validation",
|
|
1281
1396
|
code: 400,
|
|
1282
1397
|
message: `Validation failed: ${error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")}`,
|
|
1283
1398
|
reason: error.issues
|
|
@@ -1285,158 +1400,254 @@ function createValidationError(error) {
|
|
|
1285
1400
|
}
|
|
1286
1401
|
function createAbortError() {
|
|
1287
1402
|
return {
|
|
1403
|
+
errorType: "abort",
|
|
1288
1404
|
code: 0,
|
|
1289
1405
|
message: "Request aborted",
|
|
1290
1406
|
aborted: true
|
|
1291
1407
|
};
|
|
1292
1408
|
}
|
|
1409
|
+
function createTimeoutError() {
|
|
1410
|
+
return {
|
|
1411
|
+
errorType: "timeout",
|
|
1412
|
+
code: 0,
|
|
1413
|
+
message: "Request timed out"
|
|
1414
|
+
};
|
|
1415
|
+
}
|
|
1293
1416
|
function createNetworkError(error) {
|
|
1294
1417
|
return {
|
|
1418
|
+
errorType: "network",
|
|
1295
1419
|
code: 0,
|
|
1296
1420
|
message: error instanceof Error ? error.message : "Network error",
|
|
1297
|
-
reason: error
|
|
1421
|
+
reason: error,
|
|
1422
|
+
cause: error instanceof Error ? error : void 0
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
async function handleHttpError(response$52) {
|
|
1426
|
+
let errorBody;
|
|
1427
|
+
try {
|
|
1428
|
+
errorBody = await response$52.json();
|
|
1429
|
+
} catch {
|
|
1430
|
+
errorBody = void 0;
|
|
1431
|
+
}
|
|
1432
|
+
return {
|
|
1433
|
+
ok: false,
|
|
1434
|
+
error: createHttpError(response$52.status, response$52.statusText, errorBody)
|
|
1298
1435
|
};
|
|
1299
1436
|
}
|
|
1300
1437
|
function createHttpError(status, statusText, body) {
|
|
1301
1438
|
if (typeof body === "object" && body !== null) {
|
|
1302
1439
|
const hasReason = "reason" in body;
|
|
1303
1440
|
if ("error" in body && typeof body.error === "string") return {
|
|
1441
|
+
errorType: "http",
|
|
1304
1442
|
code: status,
|
|
1305
1443
|
message: body.error,
|
|
1306
1444
|
reason: hasReason ? body.reason : void 0
|
|
1307
1445
|
};
|
|
1308
1446
|
if (hasReason) return {
|
|
1447
|
+
errorType: "http",
|
|
1309
1448
|
code: status,
|
|
1310
1449
|
message: statusText,
|
|
1311
1450
|
reason: body.reason
|
|
1312
1451
|
};
|
|
1313
1452
|
}
|
|
1314
1453
|
return {
|
|
1454
|
+
errorType: "http",
|
|
1315
1455
|
code: status,
|
|
1316
1456
|
message: statusText
|
|
1317
1457
|
};
|
|
1318
1458
|
}
|
|
1459
|
+
function isHttpError(error) {
|
|
1460
|
+
return error.errorType === "http";
|
|
1461
|
+
}
|
|
1462
|
+
function isNetworkError(error) {
|
|
1463
|
+
return error.errorType === "network";
|
|
1464
|
+
}
|
|
1465
|
+
function isTimeoutError(error) {
|
|
1466
|
+
return error.errorType === "timeout";
|
|
1467
|
+
}
|
|
1468
|
+
function isValidationError(error) {
|
|
1469
|
+
return error.errorType === "validation";
|
|
1470
|
+
}
|
|
1471
|
+
function isAbortError(error) {
|
|
1472
|
+
return error.errorType === "abort";
|
|
1473
|
+
}
|
|
1474
|
+
function isClientError(error) {
|
|
1475
|
+
return error.errorType !== "http";
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
//#endregion
|
|
1479
|
+
//#region src/endpoints/api-keys.ts
|
|
1480
|
+
const BASE_PATH$6 = "/api/v1/api_keys";
|
|
1481
|
+
function createApiKeysApi(fetcher) {
|
|
1482
|
+
return {
|
|
1483
|
+
async create(input, options) {
|
|
1484
|
+
const result = request$49.body.safeParse(input);
|
|
1485
|
+
if (!result.success) return {
|
|
1486
|
+
ok: false,
|
|
1487
|
+
error: createValidationError(result.error)
|
|
1488
|
+
};
|
|
1489
|
+
return fetcher.post(BASE_PATH$6, input, options);
|
|
1490
|
+
},
|
|
1491
|
+
async list(input, options) {
|
|
1492
|
+
const queryParams = new URLSearchParams();
|
|
1493
|
+
if (input?.take !== void 0) queryParams.set("take", String(input.take));
|
|
1494
|
+
if (input?.skip !== void 0) queryParams.set("skip", String(input.skip));
|
|
1495
|
+
const queryString = queryParams.toString();
|
|
1496
|
+
const url = queryString ? `${BASE_PATH$6}?${queryString}` : BASE_PATH$6;
|
|
1497
|
+
return fetcher.get(url, options);
|
|
1498
|
+
},
|
|
1499
|
+
async get(id, options) {
|
|
1500
|
+
const result = request$48.params.safeParse({ apiKeyId: id });
|
|
1501
|
+
if (!result.success) return {
|
|
1502
|
+
ok: false,
|
|
1503
|
+
error: createValidationError(result.error)
|
|
1504
|
+
};
|
|
1505
|
+
return fetcher.get(`${BASE_PATH$6}/${id}`, options);
|
|
1506
|
+
},
|
|
1507
|
+
async revoke(id, options) {
|
|
1508
|
+
const result = request$46.params.safeParse({ apiKeyId: id });
|
|
1509
|
+
if (!result.success) return {
|
|
1510
|
+
ok: false,
|
|
1511
|
+
error: createValidationError(result.error)
|
|
1512
|
+
};
|
|
1513
|
+
return fetcher.post(`${BASE_PATH$6}/${id}/revoke`, {}, options);
|
|
1514
|
+
}
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1319
1517
|
|
|
1320
1518
|
//#endregion
|
|
1321
|
-
//#region src/
|
|
1322
|
-
|
|
1323
|
-
function buildQueryString$4(params) {
|
|
1519
|
+
//#region src/lib/query-string.ts
|
|
1520
|
+
function buildQueryString(params) {
|
|
1324
1521
|
if (!params) return "";
|
|
1325
1522
|
const searchParams = new URLSearchParams();
|
|
1326
|
-
|
|
1327
|
-
if (params.sort !== void 0) searchParams.set("sort", params.sort);
|
|
1328
|
-
if (params.order !== void 0) searchParams.set("order", params.order);
|
|
1329
|
-
if (params.take !== void 0) searchParams.set("take", params.take.toString());
|
|
1330
|
-
if (params.skip !== void 0) searchParams.set("skip", params.skip.toString());
|
|
1523
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0) searchParams.set(key, String(value));
|
|
1331
1524
|
const queryString = searchParams.toString();
|
|
1332
1525
|
return queryString ? `?${queryString}` : "";
|
|
1333
1526
|
}
|
|
1527
|
+
|
|
1528
|
+
//#endregion
|
|
1529
|
+
//#region src/endpoints/applications.ts
|
|
1530
|
+
const BASE_PATH$5 = "/api/v1/applications";
|
|
1334
1531
|
function createApplicationsApi(fetcher) {
|
|
1335
1532
|
return {
|
|
1336
1533
|
async list(params, options) {
|
|
1337
1534
|
if (params) {
|
|
1338
|
-
const result = request$
|
|
1535
|
+
const result = request$42.query.safeParse(params);
|
|
1339
1536
|
if (!result.success) return {
|
|
1340
1537
|
ok: false,
|
|
1341
1538
|
error: createValidationError(result.error)
|
|
1342
1539
|
};
|
|
1343
1540
|
}
|
|
1344
|
-
const queryString = buildQueryString
|
|
1345
|
-
return fetcher.get(`${BASE_PATH$
|
|
1541
|
+
const queryString = buildQueryString(params);
|
|
1542
|
+
return fetcher.get(`${BASE_PATH$5}${queryString}`, options);
|
|
1346
1543
|
},
|
|
1347
1544
|
async get(id, options) {
|
|
1348
|
-
return fetcher.get(`${BASE_PATH$
|
|
1545
|
+
return fetcher.get(`${BASE_PATH$5}/${id}`, options);
|
|
1349
1546
|
},
|
|
1350
1547
|
async create(input, options) {
|
|
1351
|
-
const result = request$
|
|
1548
|
+
const result = request$45.body.safeParse(input);
|
|
1352
1549
|
if (!result.success) return {
|
|
1353
1550
|
ok: false,
|
|
1354
1551
|
error: createValidationError(result.error)
|
|
1355
1552
|
};
|
|
1356
|
-
return fetcher.post(BASE_PATH$
|
|
1553
|
+
return fetcher.post(BASE_PATH$5, input, options);
|
|
1357
1554
|
},
|
|
1358
1555
|
async update(id, input, options) {
|
|
1359
|
-
const result = request$
|
|
1556
|
+
const result = request$41.body.safeParse(input);
|
|
1360
1557
|
if (!result.success) return {
|
|
1361
1558
|
ok: false,
|
|
1362
1559
|
error: createValidationError(result.error)
|
|
1363
1560
|
};
|
|
1364
|
-
return fetcher.post(`${BASE_PATH$
|
|
1561
|
+
return fetcher.post(`${BASE_PATH$5}/${id}`, input, options);
|
|
1365
1562
|
},
|
|
1366
1563
|
async delete(id, options) {
|
|
1367
|
-
return fetcher.delete(`${BASE_PATH$
|
|
1564
|
+
return fetcher.delete(`${BASE_PATH$5}/${id}`, options);
|
|
1368
1565
|
}
|
|
1369
1566
|
};
|
|
1370
1567
|
}
|
|
1371
1568
|
|
|
1372
1569
|
//#endregion
|
|
1373
1570
|
//#region src/endpoints/env-secrets.ts
|
|
1374
|
-
const BASE_PATH$
|
|
1571
|
+
const BASE_PATH$4 = "/api/v1/env/secrets";
|
|
1375
1572
|
function createSecretsApi(fetcher) {
|
|
1376
1573
|
return {
|
|
1377
|
-
async list(options) {
|
|
1378
|
-
|
|
1574
|
+
async list(params, options) {
|
|
1575
|
+
if (params) {
|
|
1576
|
+
const result = request$37.query.safeParse(params);
|
|
1577
|
+
if (!result.success) return {
|
|
1578
|
+
ok: false,
|
|
1579
|
+
error: createValidationError(result.error)
|
|
1580
|
+
};
|
|
1581
|
+
}
|
|
1582
|
+
const queryString = buildQueryString(params);
|
|
1583
|
+
return fetcher.get(`${BASE_PATH$4}${queryString}`, options);
|
|
1379
1584
|
},
|
|
1380
1585
|
async get(name, options) {
|
|
1381
1586
|
const encodedName = encodeURIComponent(name);
|
|
1382
|
-
return fetcher.get(`${BASE_PATH$
|
|
1587
|
+
return fetcher.get(`${BASE_PATH$4}/${encodedName}`, options);
|
|
1383
1588
|
},
|
|
1384
1589
|
async create(input, options) {
|
|
1385
|
-
const result = request$
|
|
1590
|
+
const result = request$40.body.safeParse(input);
|
|
1386
1591
|
if (!result.success) return {
|
|
1387
1592
|
ok: false,
|
|
1388
1593
|
error: createValidationError(result.error)
|
|
1389
1594
|
};
|
|
1390
|
-
return fetcher.post(BASE_PATH$
|
|
1595
|
+
return fetcher.post(BASE_PATH$4, input, options);
|
|
1391
1596
|
},
|
|
1392
1597
|
async update(name, input, options) {
|
|
1393
|
-
const result = request$
|
|
1598
|
+
const result = request$36.body.safeParse(input);
|
|
1394
1599
|
if (!result.success) return {
|
|
1395
1600
|
ok: false,
|
|
1396
1601
|
error: createValidationError(result.error)
|
|
1397
1602
|
};
|
|
1398
1603
|
const encodedName = encodeURIComponent(name);
|
|
1399
|
-
return fetcher.put(`${BASE_PATH$
|
|
1604
|
+
return fetcher.put(`${BASE_PATH$4}/${encodedName}`, input, options);
|
|
1400
1605
|
},
|
|
1401
1606
|
async delete(name, options) {
|
|
1402
1607
|
const encodedName = encodeURIComponent(name);
|
|
1403
|
-
return fetcher.deleteNoContent(`${BASE_PATH$
|
|
1608
|
+
return fetcher.deleteNoContent(`${BASE_PATH$4}/${encodedName}`, options);
|
|
1404
1609
|
}
|
|
1405
1610
|
};
|
|
1406
1611
|
}
|
|
1407
1612
|
|
|
1408
1613
|
//#endregion
|
|
1409
1614
|
//#region src/endpoints/env-variables.ts
|
|
1410
|
-
const BASE_PATH$
|
|
1615
|
+
const BASE_PATH$3 = "/api/v1/env/variables";
|
|
1411
1616
|
function createVariablesApi(fetcher) {
|
|
1412
1617
|
return {
|
|
1413
|
-
async list(options) {
|
|
1414
|
-
|
|
1618
|
+
async list(params, options) {
|
|
1619
|
+
const result = request$32.query.safeParse(params);
|
|
1620
|
+
if (!result.success) return {
|
|
1621
|
+
ok: false,
|
|
1622
|
+
error: createValidationError(result.error)
|
|
1623
|
+
};
|
|
1624
|
+
const queryString = buildQueryString(params);
|
|
1625
|
+
return fetcher.get(`${BASE_PATH$3}${queryString}`, options);
|
|
1415
1626
|
},
|
|
1416
1627
|
async get(name, options) {
|
|
1417
1628
|
const encodedName = encodeURIComponent(name);
|
|
1418
|
-
return fetcher.get(`${BASE_PATH$
|
|
1629
|
+
return fetcher.get(`${BASE_PATH$3}/${encodedName}`, options);
|
|
1419
1630
|
},
|
|
1420
1631
|
async create(input, options) {
|
|
1421
|
-
const result = request$
|
|
1632
|
+
const result = request$35.body.safeParse(input);
|
|
1422
1633
|
if (!result.success) return {
|
|
1423
1634
|
ok: false,
|
|
1424
1635
|
error: createValidationError(result.error)
|
|
1425
1636
|
};
|
|
1426
|
-
return fetcher.post(BASE_PATH$
|
|
1637
|
+
return fetcher.post(BASE_PATH$3, input, options);
|
|
1427
1638
|
},
|
|
1428
1639
|
async update(name, input, options) {
|
|
1429
|
-
const result = request$
|
|
1640
|
+
const result = request$31.body.safeParse(input);
|
|
1430
1641
|
if (!result.success) return {
|
|
1431
1642
|
ok: false,
|
|
1432
1643
|
error: createValidationError(result.error)
|
|
1433
1644
|
};
|
|
1434
1645
|
const encodedName = encodeURIComponent(name);
|
|
1435
|
-
return fetcher.put(`${BASE_PATH$
|
|
1646
|
+
return fetcher.put(`${BASE_PATH$3}/${encodedName}`, input, options);
|
|
1436
1647
|
},
|
|
1437
1648
|
async delete(name, options) {
|
|
1438
1649
|
const encodedName = encodeURIComponent(name);
|
|
1439
|
-
return fetcher.deleteNoContent(`${BASE_PATH$
|
|
1650
|
+
return fetcher.deleteNoContent(`${BASE_PATH$3}/${encodedName}`, options);
|
|
1440
1651
|
}
|
|
1441
1652
|
};
|
|
1442
1653
|
}
|
|
@@ -1452,26 +1663,18 @@ function createEnvApi(fetcher) {
|
|
|
1452
1663
|
|
|
1453
1664
|
//#endregion
|
|
1454
1665
|
//#region src/endpoints/experts-drafts.ts
|
|
1455
|
-
function buildQueryString$3(params) {
|
|
1456
|
-
if (!params) return "";
|
|
1457
|
-
const searchParams = new URLSearchParams();
|
|
1458
|
-
if (params.limit !== void 0) searchParams.set("limit", params.limit.toString());
|
|
1459
|
-
if (params.offset !== void 0) searchParams.set("offset", params.offset.toString());
|
|
1460
|
-
const queryString = searchParams.toString();
|
|
1461
|
-
return queryString ? `?${queryString}` : "";
|
|
1462
|
-
}
|
|
1463
1666
|
function createDraftsApi(fetcher, basePath) {
|
|
1464
1667
|
return {
|
|
1465
1668
|
async list(scopeName, params, options) {
|
|
1466
1669
|
if (params) {
|
|
1467
|
-
const result = request$
|
|
1670
|
+
const result = request$26.query.safeParse(params);
|
|
1468
1671
|
if (!result.success) return {
|
|
1469
1672
|
ok: false,
|
|
1470
1673
|
error: createValidationError(result.error)
|
|
1471
1674
|
};
|
|
1472
1675
|
}
|
|
1473
1676
|
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1474
|
-
const queryString = buildQueryString
|
|
1677
|
+
const queryString = buildQueryString(params);
|
|
1475
1678
|
return fetcher.get(`${basePath}/${encodedScopeName}/drafts${queryString}`, options);
|
|
1476
1679
|
},
|
|
1477
1680
|
async get(scopeName, draftRef, options) {
|
|
@@ -1480,7 +1683,7 @@ function createDraftsApi(fetcher, basePath) {
|
|
|
1480
1683
|
return fetcher.get(`${basePath}/${encodedScopeName}/drafts/${encodedDraftRef}`, options);
|
|
1481
1684
|
},
|
|
1482
1685
|
async create(scopeName, input, options) {
|
|
1483
|
-
const result = request$
|
|
1686
|
+
const result = request$29.body.safeParse(input);
|
|
1484
1687
|
if (!result.success) return {
|
|
1485
1688
|
ok: false,
|
|
1486
1689
|
error: createValidationError(result.error)
|
|
@@ -1489,7 +1692,7 @@ function createDraftsApi(fetcher, basePath) {
|
|
|
1489
1692
|
return fetcher.post(`${basePath}/${encodedScopeName}/drafts`, input, options);
|
|
1490
1693
|
},
|
|
1491
1694
|
async update(scopeName, draftRef, input, options) {
|
|
1492
|
-
const result = request$
|
|
1695
|
+
const result = request$25.body.safeParse(input);
|
|
1493
1696
|
if (!result.success) return {
|
|
1494
1697
|
ok: false,
|
|
1495
1698
|
error: createValidationError(result.error)
|
|
@@ -1504,7 +1707,7 @@ function createDraftsApi(fetcher, basePath) {
|
|
|
1504
1707
|
return fetcher.delete(`${basePath}/${encodedScopeName}/drafts/${encodedDraftRef}`, options);
|
|
1505
1708
|
},
|
|
1506
1709
|
async assignVersion(scopeName, draftRef, input, options) {
|
|
1507
|
-
const result = request$
|
|
1710
|
+
const result = request$24.body.safeParse(input);
|
|
1508
1711
|
if (!result.success) return {
|
|
1509
1712
|
ok: false,
|
|
1510
1713
|
error: createValidationError(result.error)
|
|
@@ -1527,56 +1730,45 @@ function createVersionsApi(fetcher, basePath) {
|
|
|
1527
1730
|
|
|
1528
1731
|
//#endregion
|
|
1529
1732
|
//#region src/endpoints/experts.ts
|
|
1530
|
-
const BASE_PATH$
|
|
1531
|
-
function buildQueryString$2(params) {
|
|
1532
|
-
if (!params) return "";
|
|
1533
|
-
const searchParams = new URLSearchParams();
|
|
1534
|
-
if (params.filter !== void 0) searchParams.set("filter", params.filter);
|
|
1535
|
-
if (params.category !== void 0) searchParams.set("category", params.category);
|
|
1536
|
-
if (params.includeDrafts !== void 0) searchParams.set("includeDrafts", params.includeDrafts.toString());
|
|
1537
|
-
if (params.limit !== void 0) searchParams.set("limit", params.limit.toString());
|
|
1538
|
-
if (params.offset !== void 0) searchParams.set("offset", params.offset.toString());
|
|
1539
|
-
const queryString = searchParams.toString();
|
|
1540
|
-
return queryString ? `?${queryString}` : "";
|
|
1541
|
-
}
|
|
1733
|
+
const BASE_PATH$2 = "/api/v1/experts";
|
|
1542
1734
|
function createExpertsApi(fetcher) {
|
|
1543
1735
|
return {
|
|
1544
1736
|
async list(params, options) {
|
|
1545
1737
|
if (params) {
|
|
1546
|
-
const result = request$
|
|
1738
|
+
const result = request$22.query.safeParse(params);
|
|
1547
1739
|
if (!result.success) return {
|
|
1548
1740
|
ok: false,
|
|
1549
1741
|
error: createValidationError(result.error)
|
|
1550
1742
|
};
|
|
1551
1743
|
}
|
|
1552
|
-
const queryString = buildQueryString
|
|
1553
|
-
return fetcher.get(`${BASE_PATH$
|
|
1744
|
+
const queryString = buildQueryString(params);
|
|
1745
|
+
return fetcher.get(`${BASE_PATH$2}${queryString}`, options);
|
|
1554
1746
|
},
|
|
1555
1747
|
async get(key, options) {
|
|
1556
1748
|
const encodedKey = encodeURIComponent(key);
|
|
1557
|
-
return fetcher.get(`${BASE_PATH$
|
|
1749
|
+
return fetcher.get(`${BASE_PATH$2}/${encodedKey}`, options);
|
|
1558
1750
|
},
|
|
1559
1751
|
async getFeatured(options) {
|
|
1560
|
-
return fetcher.get(`${BASE_PATH$
|
|
1752
|
+
return fetcher.get(`${BASE_PATH$2}/featured`, options);
|
|
1561
1753
|
},
|
|
1562
1754
|
async getMeta(key, options) {
|
|
1563
1755
|
const encodedKey = encodeURIComponent(key);
|
|
1564
|
-
return fetcher.get(`${BASE_PATH$
|
|
1756
|
+
return fetcher.get(`${BASE_PATH$2}/${encodedKey}/meta`, options);
|
|
1565
1757
|
},
|
|
1566
1758
|
async publish(scopeName, options) {
|
|
1567
1759
|
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1568
|
-
return fetcher.post(`${BASE_PATH$
|
|
1760
|
+
return fetcher.post(`${BASE_PATH$2}/${encodedScopeName}/publish`, {}, options);
|
|
1569
1761
|
},
|
|
1570
1762
|
async unpublish(scopeName, options) {
|
|
1571
1763
|
const encodedScopeName = encodeURIComponent(scopeName);
|
|
1572
|
-
return fetcher.post(`${BASE_PATH$
|
|
1764
|
+
return fetcher.post(`${BASE_PATH$2}/${encodedScopeName}/unpublish`, {}, options);
|
|
1573
1765
|
},
|
|
1574
1766
|
async yank(key, options) {
|
|
1575
1767
|
const encodedKey = encodeURIComponent(key);
|
|
1576
|
-
return fetcher.delete(`${BASE_PATH$
|
|
1768
|
+
return fetcher.delete(`${BASE_PATH$2}/${encodedKey}`, options);
|
|
1577
1769
|
},
|
|
1578
|
-
drafts: createDraftsApi(fetcher, BASE_PATH$
|
|
1579
|
-
versions: createVersionsApi(fetcher, BASE_PATH$
|
|
1770
|
+
drafts: createDraftsApi(fetcher, BASE_PATH$2),
|
|
1771
|
+
versions: createVersionsApi(fetcher, BASE_PATH$2)
|
|
1580
1772
|
};
|
|
1581
1773
|
}
|
|
1582
1774
|
|
|
@@ -1606,34 +1798,24 @@ async function* parseSSE(reader) {
|
|
|
1606
1798
|
|
|
1607
1799
|
//#endregion
|
|
1608
1800
|
//#region src/endpoints/jobs-checkpoints.ts
|
|
1609
|
-
function buildQueryString$1(params) {
|
|
1610
|
-
if (!params) return "";
|
|
1611
|
-
const searchParams = new URLSearchParams();
|
|
1612
|
-
if (params.take !== void 0) searchParams.set("take", params.take.toString());
|
|
1613
|
-
if (params.skip !== void 0) searchParams.set("skip", params.skip.toString());
|
|
1614
|
-
if (params.sort !== void 0) searchParams.set("sort", params.sort);
|
|
1615
|
-
if (params.order !== void 0) searchParams.set("order", params.order);
|
|
1616
|
-
const queryString = searchParams.toString();
|
|
1617
|
-
return queryString ? `?${queryString}` : "";
|
|
1618
|
-
}
|
|
1619
1801
|
function createCheckpointsApi(fetcher, basePath) {
|
|
1620
1802
|
return {
|
|
1621
1803
|
async list(jobId, params, options) {
|
|
1622
1804
|
if (params) {
|
|
1623
|
-
const result = request$
|
|
1805
|
+
const result = request$15.query.safeParse(params);
|
|
1624
1806
|
if (!result.success) return {
|
|
1625
1807
|
ok: false,
|
|
1626
1808
|
error: createValidationError(result.error)
|
|
1627
1809
|
};
|
|
1628
1810
|
}
|
|
1629
|
-
const queryString = buildQueryString
|
|
1811
|
+
const queryString = buildQueryString(params);
|
|
1630
1812
|
return fetcher.get(`${basePath}/${jobId}/checkpoints${queryString}`, options);
|
|
1631
1813
|
},
|
|
1632
1814
|
async get(jobId, checkpointId, options) {
|
|
1633
1815
|
return fetcher.get(`${basePath}/${jobId}/checkpoints/${checkpointId}`, options);
|
|
1634
1816
|
},
|
|
1635
1817
|
async create(jobId, input, options) {
|
|
1636
|
-
const result = request$
|
|
1818
|
+
const result = request$17.body.safeParse(input);
|
|
1637
1819
|
if (!result.success) return {
|
|
1638
1820
|
ok: false,
|
|
1639
1821
|
error: createValidationError(result.error)
|
|
@@ -1642,104 +1824,134 @@ function createCheckpointsApi(fetcher, basePath) {
|
|
|
1642
1824
|
},
|
|
1643
1825
|
async *stream(jobId, options) {
|
|
1644
1826
|
const result = await fetcher.getStream(`${basePath}/${jobId}/checkpoints/stream`, options);
|
|
1645
|
-
if (!result.ok)
|
|
1827
|
+
if (!result.ok) {
|
|
1828
|
+
yield {
|
|
1829
|
+
ok: false,
|
|
1830
|
+
error: result.error
|
|
1831
|
+
};
|
|
1832
|
+
return;
|
|
1833
|
+
}
|
|
1646
1834
|
const reader = result.data.getReader();
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
function buildTreeQueryString(params) {
|
|
1655
|
-
if (!params) return "";
|
|
1656
|
-
const searchParams = new URLSearchParams();
|
|
1657
|
-
if (params.path !== void 0) searchParams.set("path", params.path);
|
|
1658
|
-
if (params.recursive !== void 0) searchParams.set("recursive", params.recursive.toString());
|
|
1659
|
-
const queryString = searchParams.toString();
|
|
1660
|
-
return queryString ? `?${queryString}` : "";
|
|
1661
|
-
}
|
|
1662
|
-
function createWorkspaceApi(fetcher, basePath) {
|
|
1663
|
-
return {
|
|
1664
|
-
async get(jobId, options) {
|
|
1665
|
-
return fetcher.get(`${basePath}/${jobId}/workspace`, options);
|
|
1666
|
-
},
|
|
1667
|
-
async tree(jobId, params, options) {
|
|
1668
|
-
if (params) {
|
|
1669
|
-
const result = request.query.safeParse(params);
|
|
1670
|
-
if (!result.success) return {
|
|
1835
|
+
try {
|
|
1836
|
+
for await (const checkpoint of parseSSE(reader)) yield {
|
|
1837
|
+
ok: true,
|
|
1838
|
+
data: checkpoint
|
|
1839
|
+
};
|
|
1840
|
+
} catch (error) {
|
|
1841
|
+
if (error instanceof DOMException && error.name === "AbortError") yield {
|
|
1671
1842
|
ok: false,
|
|
1672
|
-
error:
|
|
1843
|
+
error: createAbortError()
|
|
1844
|
+
};
|
|
1845
|
+
else yield {
|
|
1846
|
+
ok: false,
|
|
1847
|
+
error: createNetworkError(error)
|
|
1673
1848
|
};
|
|
1674
1849
|
}
|
|
1675
|
-
const queryString = buildTreeQueryString(params);
|
|
1676
|
-
return fetcher.get(`${basePath}/${jobId}/workspace/tree${queryString}`, options);
|
|
1677
|
-
},
|
|
1678
|
-
async blob(jobId, path, options) {
|
|
1679
|
-
const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
1680
|
-
return fetcher.getBlob(`${basePath}/${jobId}/workspace/blob/${normalizedPath}`, options);
|
|
1681
1850
|
}
|
|
1682
1851
|
};
|
|
1683
1852
|
}
|
|
1684
1853
|
|
|
1685
1854
|
//#endregion
|
|
1686
1855
|
//#region src/endpoints/jobs.ts
|
|
1687
|
-
const BASE_PATH = "/api/v1/jobs";
|
|
1688
|
-
function buildQueryString(params) {
|
|
1689
|
-
if (!params) return "";
|
|
1690
|
-
const searchParams = new URLSearchParams();
|
|
1691
|
-
if (params.take !== void 0) searchParams.set("take", params.take.toString());
|
|
1692
|
-
if (params.skip !== void 0) searchParams.set("skip", params.skip.toString());
|
|
1693
|
-
if (params.sort !== void 0) searchParams.set("sort", params.sort);
|
|
1694
|
-
if (params.order !== void 0) searchParams.set("order", params.order);
|
|
1695
|
-
const queryString = searchParams.toString();
|
|
1696
|
-
return queryString ? `?${queryString}` : "";
|
|
1697
|
-
}
|
|
1856
|
+
const BASE_PATH$1 = "/api/v1/jobs";
|
|
1698
1857
|
function createJobsApi(fetcher) {
|
|
1699
1858
|
return {
|
|
1700
1859
|
async list(params, options) {
|
|
1701
1860
|
if (params) {
|
|
1702
|
-
const result = request$
|
|
1861
|
+
const result = request$10.query.safeParse(params);
|
|
1703
1862
|
if (!result.success) return {
|
|
1704
1863
|
ok: false,
|
|
1705
1864
|
error: createValidationError(result.error)
|
|
1706
1865
|
};
|
|
1707
1866
|
}
|
|
1708
1867
|
const queryString = buildQueryString(params);
|
|
1709
|
-
return fetcher.get(`${BASE_PATH}${queryString}`, options);
|
|
1868
|
+
return fetcher.get(`${BASE_PATH$1}${queryString}`, options);
|
|
1710
1869
|
},
|
|
1711
1870
|
async get(id, options) {
|
|
1712
|
-
return fetcher.get(`${BASE_PATH}/${id}`, options);
|
|
1871
|
+
return fetcher.get(`${BASE_PATH$1}/${id}`, options);
|
|
1713
1872
|
},
|
|
1714
1873
|
async start(input, options) {
|
|
1715
|
-
const result = request$
|
|
1874
|
+
const result = request$12.body.safeParse(input);
|
|
1716
1875
|
if (!result.success) return {
|
|
1717
1876
|
ok: false,
|
|
1718
1877
|
error: createValidationError(result.error)
|
|
1719
1878
|
};
|
|
1720
|
-
return fetcher.post(BASE_PATH, input, options);
|
|
1879
|
+
return fetcher.post(BASE_PATH$1, input, options);
|
|
1721
1880
|
},
|
|
1722
1881
|
async update(id, input, options) {
|
|
1723
|
-
const result = request$
|
|
1882
|
+
const result = request$9.body.safeParse(input);
|
|
1724
1883
|
if (!result.success) return {
|
|
1725
1884
|
ok: false,
|
|
1726
1885
|
error: createValidationError(result.error)
|
|
1727
1886
|
};
|
|
1728
|
-
return fetcher.post(`${BASE_PATH}/${id}`, input, options);
|
|
1887
|
+
return fetcher.post(`${BASE_PATH$1}/${id}`, input, options);
|
|
1729
1888
|
},
|
|
1730
1889
|
async continue(id, input, options) {
|
|
1731
|
-
const result = request$
|
|
1890
|
+
const result = request$13.body.safeParse(input);
|
|
1732
1891
|
if (!result.success) return {
|
|
1733
1892
|
ok: false,
|
|
1734
1893
|
error: createValidationError(result.error)
|
|
1735
1894
|
};
|
|
1736
|
-
return fetcher.post(`${BASE_PATH}/${id}/continue`, input, options);
|
|
1895
|
+
return fetcher.post(`${BASE_PATH$1}/${id}/continue`, input, options);
|
|
1737
1896
|
},
|
|
1738
1897
|
async cancel(id, options) {
|
|
1739
|
-
return fetcher.post(`${BASE_PATH}/${id}/cancel`, {}, options);
|
|
1898
|
+
return fetcher.post(`${BASE_PATH$1}/${id}/cancel`, {}, options);
|
|
1740
1899
|
},
|
|
1741
|
-
checkpoints: createCheckpointsApi(fetcher, BASE_PATH)
|
|
1742
|
-
|
|
1900
|
+
checkpoints: createCheckpointsApi(fetcher, BASE_PATH$1)
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
//#endregion
|
|
1905
|
+
//#region src/endpoints/provider-settings.ts
|
|
1906
|
+
const BASE_PATH = "/api/v1/applications";
|
|
1907
|
+
function createProviderSettingsApi(fetcher) {
|
|
1908
|
+
return {
|
|
1909
|
+
async list(applicationId, options) {
|
|
1910
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings`, options);
|
|
1911
|
+
},
|
|
1912
|
+
async get(applicationId, provider, options) {
|
|
1913
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1914
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, options);
|
|
1915
|
+
},
|
|
1916
|
+
async create(applicationId, input, options) {
|
|
1917
|
+
const result = request$5.body.safeParse(input);
|
|
1918
|
+
if (!result.success) return {
|
|
1919
|
+
ok: false,
|
|
1920
|
+
error: createValidationError(result.error)
|
|
1921
|
+
};
|
|
1922
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings`, input, options);
|
|
1923
|
+
},
|
|
1924
|
+
async update(applicationId, provider, input, options) {
|
|
1925
|
+
const result = request$1.body.safeParse(input);
|
|
1926
|
+
if (!result.success) return {
|
|
1927
|
+
ok: false,
|
|
1928
|
+
error: createValidationError(result.error)
|
|
1929
|
+
};
|
|
1930
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1931
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, input, options);
|
|
1932
|
+
},
|
|
1933
|
+
async delete(applicationId, provider, options) {
|
|
1934
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1935
|
+
return fetcher.deleteNoContent(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, options);
|
|
1936
|
+
},
|
|
1937
|
+
async listApiKeys(applicationId, provider, options) {
|
|
1938
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1939
|
+
return fetcher.get(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys`, options);
|
|
1940
|
+
},
|
|
1941
|
+
async createApiKey(applicationId, provider, input, options) {
|
|
1942
|
+
const result = request$8.body.safeParse(input);
|
|
1943
|
+
if (!result.success) return {
|
|
1944
|
+
ok: false,
|
|
1945
|
+
error: createValidationError(result.error)
|
|
1946
|
+
};
|
|
1947
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1948
|
+
return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys`, input, options);
|
|
1949
|
+
},
|
|
1950
|
+
async deleteApiKey(applicationId, provider, apiKeyId, options) {
|
|
1951
|
+
const encodedProvider = encodeURIComponent(provider);
|
|
1952
|
+
const encodedApiKeyId = encodeURIComponent(apiKeyId);
|
|
1953
|
+
return fetcher.deleteNoContent(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys/${encodedApiKeyId}`, options);
|
|
1954
|
+
}
|
|
1743
1955
|
};
|
|
1744
1956
|
}
|
|
1745
1957
|
|
|
@@ -1755,8 +1967,9 @@ function createFetcher(config) {
|
|
|
1755
1967
|
function buildUrl(path) {
|
|
1756
1968
|
return `${baseUrl}${path}`;
|
|
1757
1969
|
}
|
|
1758
|
-
function buildHeaders() {
|
|
1759
|
-
const headers = {
|
|
1970
|
+
function buildHeaders(options) {
|
|
1971
|
+
const headers = {};
|
|
1972
|
+
if (options?.hasBody) headers["Content-Type"] = "application/json";
|
|
1760
1973
|
if (apiKey) headers.Authorization = `Bearer ${apiKey}`;
|
|
1761
1974
|
return headers;
|
|
1762
1975
|
}
|
|
@@ -1765,7 +1978,11 @@ function createFetcher(config) {
|
|
|
1765
1978
|
}
|
|
1766
1979
|
function createTimeoutSignal(externalSignal) {
|
|
1767
1980
|
const controller = new AbortController();
|
|
1768
|
-
|
|
1981
|
+
let timedOut = false;
|
|
1982
|
+
const timeoutId = setTimeout(() => {
|
|
1983
|
+
timedOut = true;
|
|
1984
|
+
controller.abort();
|
|
1985
|
+
}, timeout);
|
|
1769
1986
|
let abortHandler;
|
|
1770
1987
|
if (externalSignal) if (externalSignal.aborted) controller.abort();
|
|
1771
1988
|
else {
|
|
@@ -1777,40 +1994,86 @@ function createFetcher(config) {
|
|
|
1777
1994
|
cleanup: () => {
|
|
1778
1995
|
clearTimeout(timeoutId);
|
|
1779
1996
|
if (abortHandler && externalSignal) externalSignal.removeEventListener("abort", abortHandler);
|
|
1780
|
-
}
|
|
1997
|
+
},
|
|
1998
|
+
isTimeout: () => timedOut
|
|
1781
1999
|
};
|
|
1782
2000
|
}
|
|
1783
|
-
|
|
1784
|
-
const
|
|
2001
|
+
function wrapStreamWithIdleTimeout(stream, idleTimeoutMs, externalSignal) {
|
|
2002
|
+
const reader = stream.getReader();
|
|
2003
|
+
const controller = new AbortController();
|
|
2004
|
+
let timeoutId;
|
|
2005
|
+
let abortHandler;
|
|
2006
|
+
if (externalSignal) if (externalSignal.aborted) controller.abort();
|
|
2007
|
+
else {
|
|
2008
|
+
abortHandler = () => controller.abort();
|
|
2009
|
+
externalSignal.addEventListener("abort", abortHandler);
|
|
2010
|
+
}
|
|
2011
|
+
function resetTimeout() {
|
|
2012
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
2013
|
+
timeoutId = setTimeout(() => controller.abort(), idleTimeoutMs);
|
|
2014
|
+
}
|
|
2015
|
+
function cleanup() {
|
|
2016
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
2017
|
+
if (abortHandler && externalSignal) externalSignal.removeEventListener("abort", abortHandler);
|
|
2018
|
+
}
|
|
2019
|
+
return new ReadableStream({
|
|
2020
|
+
start() {
|
|
2021
|
+
resetTimeout();
|
|
2022
|
+
},
|
|
2023
|
+
async pull(streamController) {
|
|
2024
|
+
try {
|
|
2025
|
+
const result = await Promise.race([reader.read(), new Promise((_, reject) => {
|
|
2026
|
+
if (controller.signal.aborted) reject(new DOMException("Stream idle timeout", "AbortError"));
|
|
2027
|
+
controller.signal.addEventListener("abort", () => {
|
|
2028
|
+
reject(new DOMException("Stream idle timeout", "AbortError"));
|
|
2029
|
+
});
|
|
2030
|
+
})]);
|
|
2031
|
+
if (result.done) {
|
|
2032
|
+
cleanup();
|
|
2033
|
+
streamController.close();
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
resetTimeout();
|
|
2037
|
+
streamController.enqueue(result.value);
|
|
2038
|
+
} catch (error) {
|
|
2039
|
+
cleanup();
|
|
2040
|
+
reader.cancel().catch(() => {});
|
|
2041
|
+
if (error instanceof DOMException && error.name === "AbortError") streamController.error(new DOMException("Stream idle timeout", "AbortError"));
|
|
2042
|
+
else streamController.error(error);
|
|
2043
|
+
}
|
|
2044
|
+
},
|
|
2045
|
+
cancel(reason) {
|
|
2046
|
+
cleanup();
|
|
2047
|
+
reader.cancel(reason).catch(() => {});
|
|
2048
|
+
}
|
|
2049
|
+
});
|
|
2050
|
+
}
|
|
2051
|
+
async function request$50(method, path, body, options) {
|
|
2052
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
1785
2053
|
try {
|
|
1786
|
-
const response$
|
|
2054
|
+
const response$52 = await fetch(buildUrl(path), {
|
|
1787
2055
|
method,
|
|
1788
|
-
headers: buildHeaders(),
|
|
2056
|
+
headers: buildHeaders(body ? { hasBody: true } : void 0),
|
|
1789
2057
|
body: body ? JSON.stringify(body) : void 0,
|
|
1790
2058
|
signal,
|
|
1791
2059
|
credentials: getCredentials()
|
|
1792
2060
|
});
|
|
1793
|
-
if (!response$
|
|
1794
|
-
let errorBody;
|
|
1795
|
-
try {
|
|
1796
|
-
errorBody = await response$41.json();
|
|
1797
|
-
} catch {
|
|
1798
|
-
errorBody = void 0;
|
|
1799
|
-
}
|
|
1800
|
-
return {
|
|
1801
|
-
ok: false,
|
|
1802
|
-
error: createHttpError(response$41.status, response$41.statusText, errorBody)
|
|
1803
|
-
};
|
|
1804
|
-
}
|
|
2061
|
+
if (!response$52.ok) return handleHttpError(response$52);
|
|
1805
2062
|
return {
|
|
1806
2063
|
ok: true,
|
|
1807
|
-
data: await response$
|
|
2064
|
+
data: await response$52.json()
|
|
1808
2065
|
};
|
|
1809
2066
|
} catch (error) {
|
|
1810
|
-
if (error instanceof Error && error.name === "AbortError")
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
2067
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
2068
|
+
if (isTimeout()) return {
|
|
2069
|
+
ok: false,
|
|
2070
|
+
error: createTimeoutError()
|
|
2071
|
+
};
|
|
2072
|
+
return {
|
|
2073
|
+
ok: false,
|
|
2074
|
+
error: createAbortError()
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
1814
2077
|
return {
|
|
1815
2078
|
ok: false,
|
|
1816
2079
|
error: createNetworkError(error)
|
|
@@ -1820,35 +2083,30 @@ function createFetcher(config) {
|
|
|
1820
2083
|
}
|
|
1821
2084
|
}
|
|
1822
2085
|
async function requestBlob(path, options) {
|
|
1823
|
-
const { signal, cleanup } = createTimeoutSignal(options?.signal);
|
|
2086
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
1824
2087
|
try {
|
|
1825
|
-
const response$
|
|
2088
|
+
const response$52 = await fetch(buildUrl(path), {
|
|
1826
2089
|
method: "GET",
|
|
1827
2090
|
headers: buildHeaders(),
|
|
1828
2091
|
signal,
|
|
1829
2092
|
credentials: getCredentials()
|
|
1830
2093
|
});
|
|
1831
|
-
if (!response$
|
|
1832
|
-
let errorBody;
|
|
1833
|
-
try {
|
|
1834
|
-
errorBody = await response$41.json();
|
|
1835
|
-
} catch {
|
|
1836
|
-
errorBody = void 0;
|
|
1837
|
-
}
|
|
1838
|
-
return {
|
|
1839
|
-
ok: false,
|
|
1840
|
-
error: createHttpError(response$41.status, response$41.statusText, errorBody)
|
|
1841
|
-
};
|
|
1842
|
-
}
|
|
2094
|
+
if (!response$52.ok) return handleHttpError(response$52);
|
|
1843
2095
|
return {
|
|
1844
2096
|
ok: true,
|
|
1845
|
-
data: await response$
|
|
2097
|
+
data: await response$52.blob()
|
|
1846
2098
|
};
|
|
1847
2099
|
} catch (error) {
|
|
1848
|
-
if (error instanceof Error && error.name === "AbortError")
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
2100
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
2101
|
+
if (isTimeout()) return {
|
|
2102
|
+
ok: false,
|
|
2103
|
+
error: createTimeoutError()
|
|
2104
|
+
};
|
|
2105
|
+
return {
|
|
2106
|
+
ok: false,
|
|
2107
|
+
error: createAbortError()
|
|
2108
|
+
};
|
|
2109
|
+
}
|
|
1852
2110
|
return {
|
|
1853
2111
|
ok: false,
|
|
1854
2112
|
error: createNetworkError(error)
|
|
@@ -1858,28 +2116,19 @@ function createFetcher(config) {
|
|
|
1858
2116
|
}
|
|
1859
2117
|
}
|
|
1860
2118
|
async function requestStream(path, options) {
|
|
1861
|
-
const { signal, cleanup } = createTimeoutSignal(options?.signal);
|
|
2119
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
1862
2120
|
try {
|
|
1863
|
-
const response$
|
|
2121
|
+
const response$52 = await fetch(buildUrl(path), {
|
|
1864
2122
|
method: "GET",
|
|
1865
2123
|
headers: buildHeaders(),
|
|
1866
2124
|
signal,
|
|
1867
2125
|
credentials: getCredentials()
|
|
1868
2126
|
});
|
|
1869
|
-
if (!response$
|
|
1870
|
-
let errorBody;
|
|
1871
|
-
try {
|
|
1872
|
-
errorBody = await response$41.json();
|
|
1873
|
-
} catch {
|
|
1874
|
-
errorBody = void 0;
|
|
1875
|
-
}
|
|
2127
|
+
if (!response$52.ok) {
|
|
1876
2128
|
cleanup();
|
|
1877
|
-
return
|
|
1878
|
-
ok: false,
|
|
1879
|
-
error: createHttpError(response$41.status, response$41.statusText, errorBody)
|
|
1880
|
-
};
|
|
2129
|
+
return handleHttpError(response$52);
|
|
1881
2130
|
}
|
|
1882
|
-
if (!response$
|
|
2131
|
+
if (!response$52.body) {
|
|
1883
2132
|
cleanup();
|
|
1884
2133
|
return {
|
|
1885
2134
|
ok: false,
|
|
@@ -1887,16 +2136,23 @@ function createFetcher(config) {
|
|
|
1887
2136
|
};
|
|
1888
2137
|
}
|
|
1889
2138
|
cleanup();
|
|
2139
|
+
const idleTimeout = options?.streamIdleTimeout ?? timeout;
|
|
1890
2140
|
return {
|
|
1891
2141
|
ok: true,
|
|
1892
|
-
data: response$
|
|
2142
|
+
data: wrapStreamWithIdleTimeout(response$52.body, idleTimeout, options?.signal)
|
|
1893
2143
|
};
|
|
1894
2144
|
} catch (error) {
|
|
1895
2145
|
cleanup();
|
|
1896
|
-
if (error instanceof Error && error.name === "AbortError")
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
2146
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
2147
|
+
if (isTimeout()) return {
|
|
2148
|
+
ok: false,
|
|
2149
|
+
error: createTimeoutError()
|
|
2150
|
+
};
|
|
2151
|
+
return {
|
|
2152
|
+
ok: false,
|
|
2153
|
+
error: createAbortError()
|
|
2154
|
+
};
|
|
2155
|
+
}
|
|
1900
2156
|
return {
|
|
1901
2157
|
ok: false,
|
|
1902
2158
|
error: createNetworkError(error)
|
|
@@ -1904,35 +2160,30 @@ function createFetcher(config) {
|
|
|
1904
2160
|
}
|
|
1905
2161
|
}
|
|
1906
2162
|
async function requestNoContent(method, path, options) {
|
|
1907
|
-
const { signal, cleanup } = createTimeoutSignal(options?.signal);
|
|
2163
|
+
const { signal, cleanup, isTimeout } = createTimeoutSignal(options?.signal);
|
|
1908
2164
|
try {
|
|
1909
|
-
const response$
|
|
2165
|
+
const response$52 = await fetch(buildUrl(path), {
|
|
1910
2166
|
method,
|
|
1911
2167
|
headers: buildHeaders(),
|
|
1912
2168
|
signal,
|
|
1913
2169
|
credentials: getCredentials()
|
|
1914
2170
|
});
|
|
1915
|
-
if (!response$
|
|
1916
|
-
let errorBody;
|
|
1917
|
-
try {
|
|
1918
|
-
errorBody = await response$41.json();
|
|
1919
|
-
} catch {
|
|
1920
|
-
errorBody = void 0;
|
|
1921
|
-
}
|
|
1922
|
-
return {
|
|
1923
|
-
ok: false,
|
|
1924
|
-
error: createHttpError(response$41.status, response$41.statusText, errorBody)
|
|
1925
|
-
};
|
|
1926
|
-
}
|
|
2171
|
+
if (!response$52.ok) return handleHttpError(response$52);
|
|
1927
2172
|
return {
|
|
1928
2173
|
ok: true,
|
|
1929
2174
|
data: void 0
|
|
1930
2175
|
};
|
|
1931
2176
|
} catch (error) {
|
|
1932
|
-
if (error instanceof Error && error.name === "AbortError")
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
2177
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
2178
|
+
if (isTimeout()) return {
|
|
2179
|
+
ok: false,
|
|
2180
|
+
error: createTimeoutError()
|
|
2181
|
+
};
|
|
2182
|
+
return {
|
|
2183
|
+
ok: false,
|
|
2184
|
+
error: createAbortError()
|
|
2185
|
+
};
|
|
2186
|
+
}
|
|
1936
2187
|
return {
|
|
1937
2188
|
ok: false,
|
|
1938
2189
|
error: createNetworkError(error)
|
|
@@ -1942,10 +2193,10 @@ function createFetcher(config) {
|
|
|
1942
2193
|
}
|
|
1943
2194
|
}
|
|
1944
2195
|
return {
|
|
1945
|
-
get: (path, options) => request$
|
|
1946
|
-
post: (path, body, options) => request$
|
|
1947
|
-
put: (path, body, options) => request$
|
|
1948
|
-
delete: (path, options) => request$
|
|
2196
|
+
get: (path, options) => request$50("GET", path, void 0, options),
|
|
2197
|
+
post: (path, body, options) => request$50("POST", path, body, options),
|
|
2198
|
+
put: (path, body, options) => request$50("PUT", path, body, options),
|
|
2199
|
+
delete: (path, options) => request$50("DELETE", path, void 0, options),
|
|
1949
2200
|
deleteNoContent: (path, options) => requestNoContent("DELETE", path, options),
|
|
1950
2201
|
getBlob: (path, options) => requestBlob(path, options),
|
|
1951
2202
|
getStream: (path, options) => requestStream(path, options)
|
|
@@ -1953,14 +2204,16 @@ function createFetcher(config) {
|
|
|
1953
2204
|
}
|
|
1954
2205
|
|
|
1955
2206
|
//#endregion
|
|
1956
|
-
//#region src/client.ts
|
|
2207
|
+
//#region src/client-public.ts
|
|
1957
2208
|
function createApiClient(config) {
|
|
1958
2209
|
const fetcher = createFetcher(config);
|
|
1959
2210
|
return {
|
|
2211
|
+
apiKeys: createApiKeysApi(fetcher),
|
|
1960
2212
|
applications: createApplicationsApi(fetcher),
|
|
1961
2213
|
env: createEnvApi(fetcher),
|
|
1962
2214
|
jobs: createJobsApi(fetcher),
|
|
1963
|
-
experts: createExpertsApi(fetcher)
|
|
2215
|
+
experts: createExpertsApi(fetcher),
|
|
2216
|
+
providerSettings: createProviderSettingsApi(fetcher)
|
|
1964
2217
|
};
|
|
1965
2218
|
}
|
|
1966
2219
|
|
|
@@ -1998,14 +2251,11 @@ function stringifyApiKeyPermissions(permissions) {
|
|
|
1998
2251
|
|
|
1999
2252
|
//#endregion
|
|
2000
2253
|
//#region src/lib/auth.ts
|
|
2001
|
-
/**
|
|
2002
|
-
* Build authentication headers from AuthOptions.
|
|
2003
|
-
*/
|
|
2004
2254
|
function buildAuthHeaders(auth) {
|
|
2005
2255
|
if (auth.type === "apiKey") return { Authorization: `Bearer ${auth.apiKey}` };
|
|
2006
2256
|
return { Cookie: auth.cookie };
|
|
2007
2257
|
}
|
|
2008
2258
|
|
|
2009
2259
|
//#endregion
|
|
2010
|
-
export { buildAuthHeaders, createAbortError, createApiClient, createFetcher, createHttpError, createNetworkError, createValidationError, matchExperts, matchOperations, matchWildcard, parseApiKeyPermissions, parseSSE, stringifyApiKeyPermissions };
|
|
2011
|
-
//# sourceMappingURL=
|
|
2260
|
+
export { buildAuthHeaders, buildQueryString, createAbortError, createApiClient, createFetcher, createHttpError, createNetworkError, createTimeoutError, createValidationError, handleHttpError, isAbortError, isClientError, isHttpError, isNetworkError, isTimeoutError, isValidationError, matchExperts, matchOperations, matchWildcard, parseApiKeyPermissions, parseSSE, stringifyApiKeyPermissions };
|
|
2261
|
+
//# sourceMappingURL=bundle.mjs.map
|