@rendobar/sdk 4.1.0 → 4.2.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/dist/index.cjs +104 -79
- package/dist/index.d.cts +104 -73
- package/dist/index.d.mts +104 -73
- package/dist/index.mjs +104 -79
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -6,6 +6,10 @@ let partysocket = require("partysocket");
|
|
|
6
6
|
* Use isApiError() to narrow in catch blocks.
|
|
7
7
|
*/
|
|
8
8
|
var ApiError = class extends Error {
|
|
9
|
+
code;
|
|
10
|
+
statusCode;
|
|
11
|
+
details;
|
|
12
|
+
retryAfter;
|
|
9
13
|
constructor(code, statusCode, message, details, retryAfter) {
|
|
10
14
|
super(message);
|
|
11
15
|
this.code = code;
|
|
@@ -53,7 +57,7 @@ var JobFailedError = class extends Error {
|
|
|
53
57
|
const DEFAULT_TIMEOUT = 3e4;
|
|
54
58
|
const DEFAULT_MAX_RETRIES = 2;
|
|
55
59
|
const RETRY_BASE_DELAY = 500;
|
|
56
|
-
const RETRYABLE_STATUS_CODES = new Set([
|
|
60
|
+
const RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
57
61
|
429,
|
|
58
62
|
500,
|
|
59
63
|
502,
|
|
@@ -172,90 +176,101 @@ function isAbortError(error) {
|
|
|
172
176
|
}
|
|
173
177
|
//#endregion
|
|
174
178
|
//#region src/resources/jobs.ts
|
|
175
|
-
const TERMINAL_STATUSES$1 = new Set([
|
|
179
|
+
const TERMINAL_STATUSES$1 = /* @__PURE__ */ new Set([
|
|
176
180
|
"complete",
|
|
177
181
|
"failed",
|
|
178
182
|
"cancelled"
|
|
179
183
|
]);
|
|
180
184
|
function createJobsResource(request) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
});
|
|
188
|
-
},
|
|
189
|
-
async get(id, options) {
|
|
190
|
-
return request(`/jobs/${id}`, { signal: options?.signal });
|
|
191
|
-
},
|
|
192
|
-
async list(params, options) {
|
|
193
|
-
return request("/jobs", {
|
|
194
|
-
query: params,
|
|
195
|
-
signal: options?.signal
|
|
196
|
-
});
|
|
197
|
-
},
|
|
198
|
-
async *listAll(params) {
|
|
199
|
-
let offset = 0;
|
|
200
|
-
const limit = params?.limit ?? 50;
|
|
201
|
-
while (true) {
|
|
202
|
-
const page = await request("/jobs", { query: {
|
|
203
|
-
...params,
|
|
204
|
-
limit,
|
|
205
|
-
offset
|
|
206
|
-
} });
|
|
207
|
-
for (const job of page.data) yield job;
|
|
208
|
-
if (offset + page.data.length >= page.meta.total) break;
|
|
209
|
-
offset += limit;
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
async wait(id, options = {}) {
|
|
213
|
-
const { timeout = 3e5, interval = 2e3, maxInterval = 1e4, onProgress, signal, throwOnFailure = false } = options;
|
|
214
|
-
const deadline = Date.now() + timeout;
|
|
215
|
-
let currentInterval = interval;
|
|
216
|
-
while (Date.now() < deadline) {
|
|
217
|
-
if (signal?.aborted) throw new DOMException("Wait aborted", "AbortError");
|
|
218
|
-
const job = await request(`/jobs/${id}`, { signal });
|
|
219
|
-
onProgress?.(job);
|
|
220
|
-
if (TERMINAL_STATUSES$1.has(job.status)) return resolveTerminal(id, job, throwOnFailure);
|
|
221
|
-
const remaining = deadline - Date.now();
|
|
222
|
-
const delay = Math.min(currentInterval, remaining);
|
|
223
|
-
if (delay <= 0) break;
|
|
224
|
-
await sleep(delay, signal);
|
|
225
|
-
currentInterval = Math.min(currentInterval * 1.5, maxInterval);
|
|
226
|
-
}
|
|
185
|
+
async function wait(id, options = {}) {
|
|
186
|
+
const { timeout = 3e5, interval = 2e3, maxInterval = 1e4, onProgress, signal, throwOnFailure = false } = options;
|
|
187
|
+
const deadline = Date.now() + timeout;
|
|
188
|
+
let currentInterval = interval;
|
|
189
|
+
while (Date.now() < deadline) {
|
|
190
|
+
if (signal?.aborted) throw new DOMException("Wait aborted", "AbortError");
|
|
227
191
|
const job = await request(`/jobs/${id}`, { signal });
|
|
228
192
|
onProgress?.(job);
|
|
229
193
|
if (TERMINAL_STATUSES$1.has(job.status)) return resolveTerminal(id, job, throwOnFailure);
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
194
|
+
const remaining = deadline - Date.now();
|
|
195
|
+
const delay = Math.min(currentInterval, remaining);
|
|
196
|
+
if (delay <= 0) break;
|
|
197
|
+
await sleep(delay, signal);
|
|
198
|
+
currentInterval = Math.min(currentInterval * 1.5, maxInterval);
|
|
199
|
+
}
|
|
200
|
+
const job = await request(`/jobs/${id}`, { signal });
|
|
201
|
+
onProgress?.(job);
|
|
202
|
+
if (TERMINAL_STATUSES$1.has(job.status)) return resolveTerminal(id, job, throwOnFailure);
|
|
203
|
+
throw new WaitTimeoutError(id, job.status, timeout);
|
|
204
|
+
}
|
|
205
|
+
async function create(params, options) {
|
|
206
|
+
return request("/jobs", {
|
|
207
|
+
method: "POST",
|
|
208
|
+
body: params,
|
|
209
|
+
signal: options?.signal
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
async function get(id, options) {
|
|
213
|
+
return request(`/jobs/${id}`, { signal: options?.signal });
|
|
214
|
+
}
|
|
215
|
+
async function list(params, options) {
|
|
216
|
+
return request("/jobs", {
|
|
217
|
+
query: params,
|
|
218
|
+
signal: options?.signal
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
async function* listAll(params) {
|
|
222
|
+
let offset = 0;
|
|
223
|
+
const limit = params?.limit ?? 50;
|
|
224
|
+
while (true) {
|
|
225
|
+
const page = await request("/jobs", { query: {
|
|
226
|
+
...params,
|
|
227
|
+
limit,
|
|
228
|
+
offset
|
|
229
|
+
} });
|
|
230
|
+
for (const job of page.data) yield job;
|
|
231
|
+
if (offset + page.data.length >= page.meta.total) break;
|
|
232
|
+
offset += limit;
|
|
258
233
|
}
|
|
234
|
+
}
|
|
235
|
+
async function cancel(id, options) {
|
|
236
|
+
return request(`/jobs/${id}/cancel`, {
|
|
237
|
+
method: "POST",
|
|
238
|
+
signal: options?.signal
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
async function download(id, options) {
|
|
242
|
+
return request(`/jobs/${id}/download`, {
|
|
243
|
+
raw: true,
|
|
244
|
+
signal: options?.signal
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
async function logs(id, options) {
|
|
248
|
+
return request(`/jobs/${id}/logs`, { signal: options?.signal });
|
|
249
|
+
}
|
|
250
|
+
async function getTimings(id, options) {
|
|
251
|
+
return request(`/jobs/${id}/timings`, { signal: options?.signal });
|
|
252
|
+
}
|
|
253
|
+
async function types(options) {
|
|
254
|
+
return request("/jobs/types", { signal: options?.signal });
|
|
255
|
+
}
|
|
256
|
+
async function stats(params, options) {
|
|
257
|
+
return request("/jobs/stats", {
|
|
258
|
+
query: params,
|
|
259
|
+
signal: options?.signal
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
create,
|
|
264
|
+
get,
|
|
265
|
+
list,
|
|
266
|
+
listAll,
|
|
267
|
+
wait,
|
|
268
|
+
cancel,
|
|
269
|
+
download,
|
|
270
|
+
logs,
|
|
271
|
+
getTimings,
|
|
272
|
+
types,
|
|
273
|
+
stats
|
|
259
274
|
};
|
|
260
275
|
}
|
|
261
276
|
/**
|
|
@@ -299,6 +314,7 @@ function createBillingResource(request) {
|
|
|
299
314
|
signal: options?.signal
|
|
300
315
|
});
|
|
301
316
|
},
|
|
317
|
+
/** Usage grouped by originating client (dashboard, sdk, cli, mcp, n8n, api, ...). */
|
|
302
318
|
async usageByClient(params, options) {
|
|
303
319
|
return request("/billing/usage-by-client", {
|
|
304
320
|
query: params,
|
|
@@ -442,7 +458,16 @@ async function mapLimit(items, limit, fn, signal) {
|
|
|
442
458
|
return out;
|
|
443
459
|
}
|
|
444
460
|
function createUploadsResource(request) {
|
|
445
|
-
return {
|
|
461
|
+
return {
|
|
462
|
+
/**
|
|
463
|
+
* One-call upload. Orchestrates the `/assets` flow: init → presigned PUT
|
|
464
|
+
* (small files) or parallel multipart (large files) → complete. Returns the
|
|
465
|
+
* ready Asset, whose `id` can be used as a job input reference.
|
|
466
|
+
*
|
|
467
|
+
* @param file - File content (Blob, ArrayBuffer, or Uint8Array).
|
|
468
|
+
* @param options.filename - Display filename (required).
|
|
469
|
+
*/
|
|
470
|
+
async create(file, options) {
|
|
446
471
|
const blob = toBlob(file);
|
|
447
472
|
const size = options.size ?? blob.size;
|
|
448
473
|
if (options.signal?.aborted) throw new Error("Upload aborted");
|
|
@@ -737,13 +762,13 @@ const WS_OPTIONS = {
|
|
|
737
762
|
reconnectionDelayGrowFactor: 1.5,
|
|
738
763
|
maxRetries: Infinity
|
|
739
764
|
};
|
|
740
|
-
const TERMINAL_STATUSES = new Set([
|
|
765
|
+
const TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
741
766
|
"complete",
|
|
742
767
|
"failed",
|
|
743
768
|
"cancelled"
|
|
744
769
|
]);
|
|
745
770
|
/** Known OrgEvent types — only dispatch events with recognized types. */
|
|
746
|
-
const KNOWN_EVENT_TYPES = new Set([
|
|
771
|
+
const KNOWN_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
747
772
|
"job.created",
|
|
748
773
|
"job.status",
|
|
749
774
|
"job.result",
|
package/dist/index.d.cts
CHANGED
|
@@ -190,7 +190,7 @@ declare const $output: unique symbol;
|
|
|
190
190
|
type $output = typeof $output;
|
|
191
191
|
declare const $input: unique symbol;
|
|
192
192
|
type $input = typeof $input;
|
|
193
|
-
type $replace<Meta, S extends $ZodType> = Meta extends $output ? output<S> : Meta extends $input ? input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends ((...args: infer P) => infer R) ? (...args: { [K in keyof P]: $replace<P[K], S
|
|
193
|
+
type $replace<Meta, S extends $ZodType> = Meta extends $output ? output<S> : Meta extends $input ? input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends ((...args: infer P) => infer R) ? (...args: { [K in keyof P]: $replace<P[K], S>; }) => $replace<R, S> : Meta extends object ? { [K in keyof Meta]: $replace<Meta[K], S>; } : Meta;
|
|
194
194
|
type MetadataType = object | undefined;
|
|
195
195
|
declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
|
|
196
196
|
_meta: Meta;
|
|
@@ -311,24 +311,24 @@ type NoUndefined<T> = T extends undefined ? never : T;
|
|
|
311
311
|
type LoosePartial<T extends object> = InexactPartial<T> & {
|
|
312
312
|
[k: string]: unknown;
|
|
313
313
|
};
|
|
314
|
-
type Mask<Keys extends PropertyKey> = { [K in Keys]?: true };
|
|
315
|
-
type Writeable<T> = { -readonly [P in keyof T]: T[P] } & {};
|
|
316
|
-
type InexactPartial<T> = { [P in keyof T]?: T[P] | undefined };
|
|
314
|
+
type Mask<Keys extends PropertyKey> = { [K in Keys]?: true; };
|
|
315
|
+
type Writeable<T> = { -readonly [P in keyof T]: T[P]; } & {};
|
|
316
|
+
type InexactPartial<T> = { [P in keyof T]?: T[P] | undefined; };
|
|
317
317
|
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
318
318
|
readonly [Symbol.toStringTag]: string;
|
|
319
319
|
} | Date | Error | Generator | Promise<unknown> | RegExp;
|
|
320
320
|
type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
|
|
321
321
|
type SomeObject = Record<PropertyKey, any>;
|
|
322
322
|
type Identity<T> = T;
|
|
323
|
-
type Flatten<T> = Identity<{ [k in keyof T]: T[k] }>;
|
|
324
|
-
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
325
|
-
type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A & keyof B extends never ? A & B : { [K in keyof A as K extends keyof B ? never : K]: A[K] } & { [K in keyof B]: B[K] }>;
|
|
323
|
+
type Flatten<T> = Identity<{ [k in keyof T]: T[k]; }>;
|
|
324
|
+
type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
|
325
|
+
type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A & keyof B extends never ? A & B : { [K in keyof A as K extends keyof B ? never : K]: A[K]; } & { [K in keyof B]: B[K]; }>;
|
|
326
326
|
type TupleItems = ReadonlyArray<SomeType>;
|
|
327
327
|
type AnyFunc = (...args: any[]) => any;
|
|
328
328
|
type MaybeAsync<T> = T | Promise<T>;
|
|
329
329
|
type EnumValue = string | number;
|
|
330
330
|
type EnumLike = Readonly<Record<string, EnumValue>>;
|
|
331
|
-
type ToEnum<T extends EnumValue> = Flatten<{ [k in T]: k }>;
|
|
331
|
+
type ToEnum<T extends EnumValue> = Flatten<{ [k in T]: k; }>;
|
|
332
332
|
type Literal = string | number | bigint | boolean | null | undefined;
|
|
333
333
|
type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
334
334
|
type HasLength = {
|
|
@@ -828,8 +828,8 @@ type OptionalInSchema = {
|
|
|
828
828
|
optin: "optional";
|
|
829
829
|
};
|
|
830
830
|
};
|
|
831
|
-
type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, output<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"] } & { -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"] } & Extra>;
|
|
832
|
-
type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, input<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{ -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"] } & { -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"] } & Extra>;
|
|
831
|
+
type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, output<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"]; } & { -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"]; } & Extra>;
|
|
832
|
+
type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, input<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{ -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"]; } & { -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"]; } & Extra>;
|
|
833
833
|
type $ZodObjectConfig = {
|
|
834
834
|
out: Record<string, unknown>;
|
|
835
835
|
in: Record<string, unknown>;
|
|
@@ -862,7 +862,9 @@ interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef
|
|
|
862
862
|
shape: Shape;
|
|
863
863
|
catchall?: $ZodType | undefined;
|
|
864
864
|
}
|
|
865
|
-
interface $ZodObjectInternals<
|
|
865
|
+
interface $ZodObjectInternals<
|
|
866
|
+
/** @ts-ignore Cast variance */
|
|
867
|
+
out Shape extends $ZodShape = $ZodShape, out Config extends $ZodObjectConfig = $ZodObjectConfig> extends _$ZodTypeInternals {
|
|
866
868
|
def: $ZodObjectDef<Shape>;
|
|
867
869
|
config: Config;
|
|
868
870
|
isst: $ZodIssueInvalidType | $ZodIssueUnrecognizedKeys;
|
|
@@ -873,7 +875,9 @@ interface $ZodObjectInternals< /** @ts-ignore Cast variance */out Shape extends
|
|
|
873
875
|
optout?: "optional" | undefined;
|
|
874
876
|
}
|
|
875
877
|
type $ZodLooseShape = Record<string, any>;
|
|
876
|
-
interface $ZodObject<
|
|
878
|
+
interface $ZodObject<
|
|
879
|
+
/** @ts-ignore Cast variance */
|
|
880
|
+
out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {}
|
|
877
881
|
declare const $ZodObject: $constructor<$ZodObject>;
|
|
878
882
|
type $InferUnionOutput<T extends SomeType> = T extends any ? output<T> : never;
|
|
879
883
|
type $InferUnionInput<T extends SomeType> = T extends any ? input<T> : never;
|
|
@@ -933,10 +937,10 @@ interface $ZodTupleDef<T extends TupleItems = readonly $ZodType[], Rest extends
|
|
|
933
937
|
rest: Rest;
|
|
934
938
|
}
|
|
935
939
|
type $InferTupleInputType<T extends TupleItems, Rest extends SomeType | null> = [...TupleInputTypeWithOptionals<T>, ...(Rest extends SomeType ? input<Rest>[] : [])];
|
|
936
|
-
type TupleInputTypeNoOptionals<T extends TupleItems> = { [k in keyof T]: input<T[k]
|
|
940
|
+
type TupleInputTypeNoOptionals<T extends TupleItems> = { [k in keyof T]: input<T[k]>; };
|
|
937
941
|
type TupleInputTypeWithOptionals<T extends TupleItems> = T extends readonly [...infer Prefix extends SomeType[], infer Tail extends SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...TupleInputTypeWithOptionals<Prefix>, input<Tail>?] : TupleInputTypeNoOptionals<T> : [];
|
|
938
942
|
type $InferTupleOutputType<T extends TupleItems, Rest extends SomeType | null> = [...TupleOutputTypeWithOptionals<T>, ...(Rest extends SomeType ? output<Rest>[] : [])];
|
|
939
|
-
type TupleOutputTypeNoOptionals<T extends TupleItems> = { [k in keyof T]: output<T[k]
|
|
943
|
+
type TupleOutputTypeNoOptionals<T extends TupleItems> = { [k in keyof T]: output<T[k]>; };
|
|
940
944
|
type TupleOutputTypeWithOptionals<T extends TupleItems> = T extends readonly [...infer Prefix extends SomeType[], infer Tail extends SomeType] ? Tail["_zod"]["optout"] extends "optional" ? [...TupleOutputTypeWithOptionals<Prefix>, output<Tail>?] : TupleOutputTypeNoOptionals<T> : [];
|
|
941
945
|
interface $ZodTupleInternals<T extends TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends _$ZodTypeInternals {
|
|
942
946
|
def: $ZodTupleDef<T, Rest>;
|
|
@@ -1006,7 +1010,9 @@ interface $ZodEnumDef<T extends EnumLike = EnumLike> extends $ZodTypeDef {
|
|
|
1006
1010
|
type: "enum";
|
|
1007
1011
|
entries: T;
|
|
1008
1012
|
}
|
|
1009
|
-
interface $ZodEnumInternals<
|
|
1013
|
+
interface $ZodEnumInternals<
|
|
1014
|
+
/** @ts-ignore Cast variance */
|
|
1015
|
+
out T extends EnumLike = EnumLike> extends $ZodTypeInternals<$InferEnumOutput<T>, $InferEnumInput<T>> {
|
|
1010
1016
|
def: $ZodEnumDef<T>;
|
|
1011
1017
|
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
1012
1018
|
values: PrimitiveSet;
|
|
@@ -1032,9 +1038,6 @@ interface $ZodLiteral<T extends Literal = Literal> extends $ZodType {
|
|
|
1032
1038
|
_zod: $ZodLiteralInternals<T>;
|
|
1033
1039
|
}
|
|
1034
1040
|
declare const $ZodLiteral: $constructor<$ZodLiteral>;
|
|
1035
|
-
type _File = typeof globalThis extends {
|
|
1036
|
-
File: infer F extends new (...args: any[]) => any;
|
|
1037
|
-
} ? InstanceType<F> : {};
|
|
1038
1041
|
/** Do not reference this directly. */
|
|
1039
1042
|
interface File extends _File {
|
|
1040
1043
|
readonly type: string;
|
|
@@ -1619,8 +1622,11 @@ interface $ZodIssueCustom extends $ZodIssueBase {
|
|
|
1619
1622
|
type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;
|
|
1620
1623
|
type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue$1<T> : never;
|
|
1621
1624
|
type RawIssue$1<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
|
|
1622
|
-
/** The input data */
|
|
1623
|
-
readonly
|
|
1625
|
+
/** The input data */
|
|
1626
|
+
readonly input: unknown;
|
|
1627
|
+
/** The schema or check that originated this issue. */
|
|
1628
|
+
readonly inst?: $ZodType | $ZodCheck;
|
|
1629
|
+
/** If `true`, Zod will continue executing checks/refinements after this issue. */
|
|
1624
1630
|
readonly continue?: boolean | undefined;
|
|
1625
1631
|
} & Record<string, unknown>> : never;
|
|
1626
1632
|
type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;
|
|
@@ -1643,11 +1649,11 @@ declare const $ZodError: $constructor<$ZodError>;
|
|
|
1643
1649
|
type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;
|
|
1644
1650
|
type _FlattenedError<T, U = string> = {
|
|
1645
1651
|
formErrors: U[];
|
|
1646
|
-
fieldErrors: { [P in keyof T]?: U[] };
|
|
1652
|
+
fieldErrors: { [P in keyof T]?: U[]; };
|
|
1647
1653
|
};
|
|
1648
|
-
type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? { [K in keyof T]?: $ZodFormattedError<T[K], U
|
|
1654
|
+
type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? { [K in keyof T]?: $ZodFormattedError<T[K], U>; } : T extends any[] ? {
|
|
1649
1655
|
[k: number]: $ZodFormattedError<T[number], U>;
|
|
1650
|
-
} : T extends object ? Flatten<{ [K in keyof T]?: $ZodFormattedError<T[K], U
|
|
1656
|
+
} : T extends object ? Flatten<{ [K in keyof T]?: $ZodFormattedError<T[K], U>; }> : any;
|
|
1651
1657
|
type $ZodFormattedError<T, U = string> = {
|
|
1652
1658
|
_errors: U[];
|
|
1653
1659
|
} & Flatten<_ZodFormattedError<T, U>>;
|
|
@@ -1668,7 +1674,7 @@ declare function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(name: st
|
|
|
1668
1674
|
}): $constructor<T, D>;
|
|
1669
1675
|
declare const $brand: unique symbol;
|
|
1670
1676
|
type $brand<T extends string | number | symbol = string | number | symbol> = {
|
|
1671
|
-
[$brand]: { [k in T]: true };
|
|
1677
|
+
[$brand]: { [k in T]: true; };
|
|
1672
1678
|
};
|
|
1673
1679
|
type $ZodBranded<T extends SomeType, Brand extends string | number | symbol, Dir extends "in" | "out" | "inout" = "out"> = T & (Dir extends "inout" ? {
|
|
1674
1680
|
_zod: {
|
|
@@ -1697,14 +1703,15 @@ type output<T> = T extends {
|
|
|
1697
1703
|
//#endregion
|
|
1698
1704
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.d.cts
|
|
1699
1705
|
type Params<T extends $ZodType | $ZodCheck, IssueTypes extends $ZodIssueBase, OmitKeys extends keyof T["_zod"]["def"] = never> = Flatten<Partial<EmptyToNever<Omit<T["_zod"]["def"], OmitKeys> & ([IssueTypes] extends [never] ? {} : {
|
|
1700
|
-
error?: string | $ZodErrorMap<IssueTypes> | undefined;
|
|
1706
|
+
error?: string | $ZodErrorMap<IssueTypes> | undefined;
|
|
1707
|
+
/** @deprecated This parameter is deprecated. Use `error` instead. */
|
|
1701
1708
|
message?: string | undefined;
|
|
1702
1709
|
})>>>;
|
|
1703
1710
|
type TypeParams<T extends $ZodType = $ZodType & {
|
|
1704
1711
|
_isst: never;
|
|
1705
1712
|
}, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error"> = never> = Params<T, NonNullable<T["_zod"]["isst"]>, "type" | "checks" | "error" | AlsoOmit>;
|
|
1706
|
-
type CheckParams<T extends $ZodCheck = $ZodCheck
|
|
1707
|
-
AlsoOmit extends Exclude<keyof T["_zod"]["def"], "check" | "error"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "check" | "error" | AlsoOmit>;
|
|
1713
|
+
type CheckParams<T extends $ZodCheck = $ZodCheck // & { _issc: never },
|
|
1714
|
+
, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "check" | "error"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "check" | "error" | AlsoOmit>;
|
|
1708
1715
|
type CheckStringFormatParams<T extends $ZodStringFormat = $ZodStringFormat, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "coerce" | "checks" | "error" | "check" | "format"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "type" | "coerce" | "checks" | "error" | "check" | "format" | AlsoOmit>;
|
|
1709
1716
|
type CheckTypeParams<T extends $ZodType & $ZodCheck = $ZodType & $ZodCheck, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error" | "check"> = never> = Params<T, NonNullable<T["_zod"]["isst"] | T["_zod"]["issc"]>, "type" | "checks" | "error" | "check" | AlsoOmit>;
|
|
1710
1717
|
type $ZodCheckEmailParams = CheckStringFormatParams<$ZodEmail, "when">;
|
|
@@ -1753,7 +1760,9 @@ type $ZodNonOptionalParams = TypeParams<$ZodNonOptional, "innerType">;
|
|
|
1753
1760
|
type $ZodCustomParams = CheckTypeParams<$ZodCustom, "fn">;
|
|
1754
1761
|
type $ZodSuperRefineIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
|
|
1755
1762
|
type RawIssue<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
|
|
1756
|
-
/** The schema or check that originated this issue. */
|
|
1763
|
+
/** The schema or check that originated this issue. */
|
|
1764
|
+
readonly inst?: $ZodType | $ZodCheck;
|
|
1765
|
+
/** If `true`, Zod will execute subsequent checks/refinements instead of immediately aborting */
|
|
1757
1766
|
readonly continue?: boolean | undefined;
|
|
1758
1767
|
} & Record<string, unknown>> : never;
|
|
1759
1768
|
interface $RefinementCtx<T = unknown> extends ParsePayload<T> {
|
|
@@ -2007,8 +2016,10 @@ interface ZodArray<T extends SomeType = $ZodType> extends _ZodType<$ZodArrayInte
|
|
|
2007
2016
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2008
2017
|
}
|
|
2009
2018
|
declare const ZodArray: $constructor<ZodArray>;
|
|
2010
|
-
type SafeExtendShape<Base extends $ZodShape, Ext extends $ZodLooseShape> = { [K in keyof Ext]: K extends keyof Base ? output<Ext[K]> extends output<Base[K]> ? input<Ext[K]> extends input<Base[K]> ? Ext[K] : never : never : Ext[K] };
|
|
2011
|
-
interface ZodObject<
|
|
2019
|
+
type SafeExtendShape<Base extends $ZodShape, Ext extends $ZodLooseShape> = { [K in keyof Ext]: K extends keyof Base ? output<Ext[K]> extends output<Base[K]> ? input<Ext[K]> extends input<Base[K]> ? Ext[K] : never : never : Ext[K]; };
|
|
2020
|
+
interface ZodObject<
|
|
2021
|
+
/** @ts-ignore Cast variance */
|
|
2022
|
+
out Shape extends $ZodShape = $ZodLooseShape, out Config extends $ZodObjectConfig = $strip> extends _ZodType<$ZodObjectInternals<Shape, Config>>, $ZodObject<Shape, Config> {
|
|
2012
2023
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2013
2024
|
shape: Shape;
|
|
2014
2025
|
keyof(): ZodEnum<ToEnum<keyof Shape & string>>;
|
|
@@ -2030,10 +2041,10 @@ interface ZodObject< /** @ts-ignore Cast variance */out Shape extends $ZodShape
|
|
|
2030
2041
|
merge<U extends ZodObject>(other: U): ZodObject<Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
|
|
2031
2042
|
pick<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
2032
2043
|
omit<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
2033
|
-
partial(): ZodObject<{ -readonly [k in keyof Shape]: ZodOptional<Shape[k]
|
|
2034
|
-
partial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k] }, Config>;
|
|
2035
|
-
required(): ZodObject<{ -readonly [k in keyof Shape]: ZodNonOptional<Shape[k]
|
|
2036
|
-
required<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k] }, Config>;
|
|
2044
|
+
partial(): ZodObject<{ -readonly [k in keyof Shape]: ZodOptional<Shape[k]>; }, Config>;
|
|
2045
|
+
partial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
2046
|
+
required(): ZodObject<{ -readonly [k in keyof Shape]: ZodNonOptional<Shape[k]>; }, Config>;
|
|
2047
|
+
required<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
2037
2048
|
}
|
|
2038
2049
|
declare const ZodObject: $constructor<ZodObject>;
|
|
2039
2050
|
interface ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends _ZodType<$ZodUnionInternals<T>>, $ZodUnion<T> {
|
|
@@ -2057,7 +2068,9 @@ interface ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends Som
|
|
|
2057
2068
|
valueType: Value;
|
|
2058
2069
|
}
|
|
2059
2070
|
declare const ZodRecord: $constructor<ZodRecord>;
|
|
2060
|
-
interface ZodEnum<
|
|
2071
|
+
interface ZodEnum<
|
|
2072
|
+
/** @ts-ignore Cast variance */
|
|
2073
|
+
out T extends EnumLike = EnumLike> extends _ZodType<$ZodEnumInternals<T>>, $ZodEnum<T> {
|
|
2061
2074
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2062
2075
|
enum: T;
|
|
2063
2076
|
options: Array<T[keyof T]>;
|
|
@@ -3142,7 +3155,7 @@ interface Envelope<E extends string, D> {
|
|
|
3142
3155
|
* The exact JSON body Rendobar POSTs to your endpoint, discriminated by `event`.
|
|
3143
3156
|
* Switch on `payload.event` and `payload.data` narrows to the matching shape.
|
|
3144
3157
|
*/
|
|
3145
|
-
type WebhookPayload = { [E in WebhookEventType]: Envelope<E, WebhookEventDataMap[E]
|
|
3158
|
+
type WebhookPayload = { [E in WebhookEventType]: Envelope<E, WebhookEventDataMap[E]>; }[WebhookEventType] | Envelope<"test", TestEventData>;
|
|
3146
3159
|
//#endregion
|
|
3147
3160
|
//#region src/types.d.ts
|
|
3148
3161
|
/**
|
|
@@ -3222,35 +3235,35 @@ interface ClientConfig {
|
|
|
3222
3235
|
}
|
|
3223
3236
|
declare function createClient(config?: ClientConfig): {
|
|
3224
3237
|
jobs: {
|
|
3225
|
-
create(params: CreateJobParams, options?: {
|
|
3238
|
+
create: (params: CreateJobParams, options?: {
|
|
3226
3239
|
signal?: AbortSignal;
|
|
3227
|
-
})
|
|
3228
|
-
get(id: string, options?: {
|
|
3240
|
+
}) => Promise<JobCreatedResponse>;
|
|
3241
|
+
get: (id: string, options?: {
|
|
3229
3242
|
signal?: AbortSignal;
|
|
3230
|
-
})
|
|
3231
|
-
list(params?: ListJobsParams, options?: {
|
|
3243
|
+
}) => Promise<JobResponse>;
|
|
3244
|
+
list: (params?: ListJobsParams, options?: {
|
|
3232
3245
|
signal?: AbortSignal;
|
|
3233
|
-
})
|
|
3234
|
-
listAll(params?: Omit<ListJobsParams, "offset">)
|
|
3235
|
-
wait(id: string, options?: WaitOptions)
|
|
3236
|
-
cancel(id: string, options?: {
|
|
3246
|
+
}) => Promise<JobListPage>;
|
|
3247
|
+
listAll: (params?: Omit<ListJobsParams, "offset">) => AsyncGenerator<JobResponse>;
|
|
3248
|
+
wait: (id: string, options?: WaitOptions) => Promise<JobResponse>;
|
|
3249
|
+
cancel: (id: string, options?: {
|
|
3237
3250
|
signal?: AbortSignal;
|
|
3238
|
-
})
|
|
3239
|
-
download(id: string, options?: {
|
|
3251
|
+
}) => Promise<JobResponse>;
|
|
3252
|
+
download: (id: string, options?: {
|
|
3240
3253
|
signal?: AbortSignal;
|
|
3241
|
-
})
|
|
3242
|
-
logs(id: string, options?: {
|
|
3254
|
+
}) => Promise<Response>;
|
|
3255
|
+
logs: (id: string, options?: {
|
|
3243
3256
|
signal?: AbortSignal;
|
|
3244
|
-
})
|
|
3245
|
-
getTimings(id: string, options?: {
|
|
3257
|
+
}) => Promise<LogEntryData[]>;
|
|
3258
|
+
getTimings: (id: string, options?: {
|
|
3246
3259
|
signal?: AbortSignal;
|
|
3247
|
-
})
|
|
3248
|
-
types(options?: {
|
|
3260
|
+
}) => Promise<JobTimings>;
|
|
3261
|
+
types: (options?: {
|
|
3249
3262
|
signal?: AbortSignal;
|
|
3250
|
-
})
|
|
3251
|
-
stats(params?: StatsParams, options?: {
|
|
3263
|
+
}) => Promise<JobType[]>;
|
|
3264
|
+
stats: (params?: StatsParams, options?: {
|
|
3252
3265
|
signal?: AbortSignal;
|
|
3253
|
-
})
|
|
3266
|
+
}) => Promise<JobStats>;
|
|
3254
3267
|
};
|
|
3255
3268
|
billing: {
|
|
3256
3269
|
state(options?: {
|
|
@@ -3401,7 +3414,7 @@ declare function createClient(config?: ClientConfig): {
|
|
|
3401
3414
|
signal?: AbortSignal;
|
|
3402
3415
|
}): Promise<void>;
|
|
3403
3416
|
getSettings(options?: {
|
|
3404
|
-
signal? /** Custom fetch function for testing or special runtimes.
|
|
3417
|
+
signal? /** Custom fetch function for testing or special runtimes. */ : AbortSignal;
|
|
3405
3418
|
}): Promise<OrgSettings>;
|
|
3406
3419
|
updateSettings(body: Partial<Pick<OrgSettings, "billingEmailsEnabled" | "defaultRegion" | "regionPinned">>, options?: {
|
|
3407
3420
|
signal?: AbortSignal;
|
|
@@ -3575,21 +3588,32 @@ type ListJobsParams = {
|
|
|
3575
3588
|
status?: string;
|
|
3576
3589
|
type?: string;
|
|
3577
3590
|
limit?: number;
|
|
3578
|
-
offset?: number;
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3591
|
+
offset?: number;
|
|
3592
|
+
/** Sort field. Default: created. */
|
|
3593
|
+
sort?: "created" | "duration" | "cost";
|
|
3594
|
+
/** Sort direction. Default: desc. */
|
|
3595
|
+
order?: "asc" | "desc";
|
|
3596
|
+
/** Filter by originating client (sdk | cli | mcp | dashboard | ...). */
|
|
3597
|
+
client?: string;
|
|
3598
|
+
/** Filter jobs created at or after this Unix ms timestamp. */
|
|
3599
|
+
from?: number;
|
|
3600
|
+
/** Filter jobs created at or before this Unix ms timestamp. */
|
|
3583
3601
|
to?: number;
|
|
3584
3602
|
};
|
|
3585
3603
|
type StatsParams = {
|
|
3586
|
-
/** Time window for the aggregate. Default: 24h. */
|
|
3604
|
+
/** Time window for the aggregate. Default: 24h. */
|
|
3605
|
+
window?: "24h" | "7d" | "30d";
|
|
3587
3606
|
};
|
|
3588
3607
|
type WaitOptions = {
|
|
3589
|
-
/** Max wait time in ms. Default: 300_000 (5 minutes). */
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3608
|
+
/** Max wait time in ms. Default: 300_000 (5 minutes). */
|
|
3609
|
+
timeout?: number;
|
|
3610
|
+
/** Initial poll interval in ms. Default: 2_000. Grows with exponential backoff. */
|
|
3611
|
+
interval?: number;
|
|
3612
|
+
/** Cap for the backoff poll interval in ms. Default: 10_000. */
|
|
3613
|
+
maxInterval?: number;
|
|
3614
|
+
/** Called on each poll with the latest job state. */
|
|
3615
|
+
onProgress?: (job: JobResponse) => void;
|
|
3616
|
+
/** Abort signal for cancellation. */
|
|
3593
3617
|
signal?: AbortSignal;
|
|
3594
3618
|
/**
|
|
3595
3619
|
* When true, throw JobFailedError if the job ends with status "failed" or "cancelled".
|
|
@@ -3671,12 +3695,19 @@ type UploadProgress = {
|
|
|
3671
3695
|
total: number;
|
|
3672
3696
|
};
|
|
3673
3697
|
type CreateUploadOptions = {
|
|
3674
|
-
/** Display filename, sent to the API and used in Content-Disposition. */
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3698
|
+
/** Display filename, sent to the API and used in Content-Disposition. */
|
|
3699
|
+
filename: string;
|
|
3700
|
+
/** Byte size. Auto-derived from the Blob when omitted. */
|
|
3701
|
+
size?: number;
|
|
3702
|
+
/** MIME type hint. */
|
|
3703
|
+
contentType?: string;
|
|
3704
|
+
/** Client-declared sha256, enables server-side dedup. */
|
|
3705
|
+
checksum?: string;
|
|
3706
|
+
/** true → 'persisted' lifecycle; default is ephemeral (24h TTL). */
|
|
3707
|
+
persist?: boolean;
|
|
3708
|
+
/** Parallel multipart part uploads. Default: 5. */
|
|
3709
|
+
concurrency?: number;
|
|
3710
|
+
/** Called as bytes finish uploading. */
|
|
3680
3711
|
onProgress?: (p: UploadProgress) => void;
|
|
3681
3712
|
signal?: AbortSignal;
|
|
3682
3713
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -190,7 +190,7 @@ declare const $output: unique symbol;
|
|
|
190
190
|
type $output = typeof $output;
|
|
191
191
|
declare const $input: unique symbol;
|
|
192
192
|
type $input = typeof $input;
|
|
193
|
-
type $replace<Meta, S extends $ZodType> = Meta extends $output ? output<S> : Meta extends $input ? input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends ((...args: infer P) => infer R) ? (...args: { [K in keyof P]: $replace<P[K], S
|
|
193
|
+
type $replace<Meta, S extends $ZodType> = Meta extends $output ? output<S> : Meta extends $input ? input<S> : Meta extends (infer M)[] ? $replace<M, S>[] : Meta extends ((...args: infer P) => infer R) ? (...args: { [K in keyof P]: $replace<P[K], S>; }) => $replace<R, S> : Meta extends object ? { [K in keyof Meta]: $replace<Meta[K], S>; } : Meta;
|
|
194
194
|
type MetadataType = object | undefined;
|
|
195
195
|
declare class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema extends $ZodType = $ZodType> {
|
|
196
196
|
_meta: Meta;
|
|
@@ -311,24 +311,24 @@ type NoUndefined<T> = T extends undefined ? never : T;
|
|
|
311
311
|
type LoosePartial<T extends object> = InexactPartial<T> & {
|
|
312
312
|
[k: string]: unknown;
|
|
313
313
|
};
|
|
314
|
-
type Mask<Keys extends PropertyKey> = { [K in Keys]?: true };
|
|
315
|
-
type Writeable<T> = { -readonly [P in keyof T]: T[P] } & {};
|
|
316
|
-
type InexactPartial<T> = { [P in keyof T]?: T[P] | undefined };
|
|
314
|
+
type Mask<Keys extends PropertyKey> = { [K in Keys]?: true; };
|
|
315
|
+
type Writeable<T> = { -readonly [P in keyof T]: T[P]; } & {};
|
|
316
|
+
type InexactPartial<T> = { [P in keyof T]?: T[P] | undefined; };
|
|
317
317
|
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
318
318
|
readonly [Symbol.toStringTag]: string;
|
|
319
319
|
} | Date | Error | Generator | Promise<unknown> | RegExp;
|
|
320
320
|
type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
|
|
321
321
|
type SomeObject = Record<PropertyKey, any>;
|
|
322
322
|
type Identity<T> = T;
|
|
323
|
-
type Flatten<T> = Identity<{ [k in keyof T]: T[k] }>;
|
|
324
|
-
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
325
|
-
type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A & keyof B extends never ? A & B : { [K in keyof A as K extends keyof B ? never : K]: A[K] } & { [K in keyof B]: B[K] }>;
|
|
323
|
+
type Flatten<T> = Identity<{ [k in keyof T]: T[k]; }>;
|
|
324
|
+
type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
|
325
|
+
type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A & keyof B extends never ? A & B : { [K in keyof A as K extends keyof B ? never : K]: A[K]; } & { [K in keyof B]: B[K]; }>;
|
|
326
326
|
type TupleItems = ReadonlyArray<SomeType>;
|
|
327
327
|
type AnyFunc = (...args: any[]) => any;
|
|
328
328
|
type MaybeAsync<T> = T | Promise<T>;
|
|
329
329
|
type EnumValue = string | number;
|
|
330
330
|
type EnumLike = Readonly<Record<string, EnumValue>>;
|
|
331
|
-
type ToEnum<T extends EnumValue> = Flatten<{ [k in T]: k }>;
|
|
331
|
+
type ToEnum<T extends EnumValue> = Flatten<{ [k in T]: k; }>;
|
|
332
332
|
type Literal = string | number | bigint | boolean | null | undefined;
|
|
333
333
|
type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
334
334
|
type HasLength = {
|
|
@@ -828,8 +828,8 @@ type OptionalInSchema = {
|
|
|
828
828
|
optin: "optional";
|
|
829
829
|
};
|
|
830
830
|
};
|
|
831
|
-
type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, output<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"] } & { -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"] } & Extra>;
|
|
832
|
-
type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, input<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{ -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"] } & { -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"] } & Extra>;
|
|
831
|
+
type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, output<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{ -readonly [k in keyof T as T[k] extends OptionalOutSchema ? never : k]: T[k]["_zod"]["output"]; } & { -readonly [k in keyof T as T[k] extends OptionalOutSchema ? k : never]?: T[k]["_zod"]["output"]; } & Extra>;
|
|
832
|
+
type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T ? IsAny<T[keyof T]> extends true ? Record<string, unknown> : Record<string, input<T[keyof T]>> : keyof (T & Extra) extends never ? Record<string, never> : Prettify<{ -readonly [k in keyof T as T[k] extends OptionalInSchema ? never : k]: T[k]["_zod"]["input"]; } & { -readonly [k in keyof T as T[k] extends OptionalInSchema ? k : never]?: T[k]["_zod"]["input"]; } & Extra>;
|
|
833
833
|
type $ZodObjectConfig = {
|
|
834
834
|
out: Record<string, unknown>;
|
|
835
835
|
in: Record<string, unknown>;
|
|
@@ -862,7 +862,9 @@ interface $ZodObjectDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef
|
|
|
862
862
|
shape: Shape;
|
|
863
863
|
catchall?: $ZodType | undefined;
|
|
864
864
|
}
|
|
865
|
-
interface $ZodObjectInternals<
|
|
865
|
+
interface $ZodObjectInternals<
|
|
866
|
+
/** @ts-ignore Cast variance */
|
|
867
|
+
out Shape extends $ZodShape = $ZodShape, out Config extends $ZodObjectConfig = $ZodObjectConfig> extends _$ZodTypeInternals {
|
|
866
868
|
def: $ZodObjectDef<Shape>;
|
|
867
869
|
config: Config;
|
|
868
870
|
isst: $ZodIssueInvalidType | $ZodIssueUnrecognizedKeys;
|
|
@@ -873,7 +875,9 @@ interface $ZodObjectInternals< /** @ts-ignore Cast variance */out Shape extends
|
|
|
873
875
|
optout?: "optional" | undefined;
|
|
874
876
|
}
|
|
875
877
|
type $ZodLooseShape = Record<string, any>;
|
|
876
|
-
interface $ZodObject<
|
|
878
|
+
interface $ZodObject<
|
|
879
|
+
/** @ts-ignore Cast variance */
|
|
880
|
+
out Shape extends Readonly<$ZodShape> = Readonly<$ZodShape>, out Params extends $ZodObjectConfig = $ZodObjectConfig> extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {}
|
|
877
881
|
declare const $ZodObject: $constructor<$ZodObject>;
|
|
878
882
|
type $InferUnionOutput<T extends SomeType> = T extends any ? output<T> : never;
|
|
879
883
|
type $InferUnionInput<T extends SomeType> = T extends any ? input<T> : never;
|
|
@@ -933,10 +937,10 @@ interface $ZodTupleDef<T extends TupleItems = readonly $ZodType[], Rest extends
|
|
|
933
937
|
rest: Rest;
|
|
934
938
|
}
|
|
935
939
|
type $InferTupleInputType<T extends TupleItems, Rest extends SomeType | null> = [...TupleInputTypeWithOptionals<T>, ...(Rest extends SomeType ? input<Rest>[] : [])];
|
|
936
|
-
type TupleInputTypeNoOptionals<T extends TupleItems> = { [k in keyof T]: input<T[k]
|
|
940
|
+
type TupleInputTypeNoOptionals<T extends TupleItems> = { [k in keyof T]: input<T[k]>; };
|
|
937
941
|
type TupleInputTypeWithOptionals<T extends TupleItems> = T extends readonly [...infer Prefix extends SomeType[], infer Tail extends SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...TupleInputTypeWithOptionals<Prefix>, input<Tail>?] : TupleInputTypeNoOptionals<T> : [];
|
|
938
942
|
type $InferTupleOutputType<T extends TupleItems, Rest extends SomeType | null> = [...TupleOutputTypeWithOptionals<T>, ...(Rest extends SomeType ? output<Rest>[] : [])];
|
|
939
|
-
type TupleOutputTypeNoOptionals<T extends TupleItems> = { [k in keyof T]: output<T[k]
|
|
943
|
+
type TupleOutputTypeNoOptionals<T extends TupleItems> = { [k in keyof T]: output<T[k]>; };
|
|
940
944
|
type TupleOutputTypeWithOptionals<T extends TupleItems> = T extends readonly [...infer Prefix extends SomeType[], infer Tail extends SomeType] ? Tail["_zod"]["optout"] extends "optional" ? [...TupleOutputTypeWithOptionals<Prefix>, output<Tail>?] : TupleOutputTypeNoOptionals<T> : [];
|
|
941
945
|
interface $ZodTupleInternals<T extends TupleItems = readonly $ZodType[], Rest extends SomeType | null = $ZodType | null> extends _$ZodTypeInternals {
|
|
942
946
|
def: $ZodTupleDef<T, Rest>;
|
|
@@ -1006,7 +1010,9 @@ interface $ZodEnumDef<T extends EnumLike = EnumLike> extends $ZodTypeDef {
|
|
|
1006
1010
|
type: "enum";
|
|
1007
1011
|
entries: T;
|
|
1008
1012
|
}
|
|
1009
|
-
interface $ZodEnumInternals<
|
|
1013
|
+
interface $ZodEnumInternals<
|
|
1014
|
+
/** @ts-ignore Cast variance */
|
|
1015
|
+
out T extends EnumLike = EnumLike> extends $ZodTypeInternals<$InferEnumOutput<T>, $InferEnumInput<T>> {
|
|
1010
1016
|
def: $ZodEnumDef<T>;
|
|
1011
1017
|
/** @deprecated Internal API, use with caution (not deprecated) */
|
|
1012
1018
|
values: PrimitiveSet;
|
|
@@ -1032,9 +1038,6 @@ interface $ZodLiteral<T extends Literal = Literal> extends $ZodType {
|
|
|
1032
1038
|
_zod: $ZodLiteralInternals<T>;
|
|
1033
1039
|
}
|
|
1034
1040
|
declare const $ZodLiteral: $constructor<$ZodLiteral>;
|
|
1035
|
-
type _File = typeof globalThis extends {
|
|
1036
|
-
File: infer F extends new (...args: any[]) => any;
|
|
1037
|
-
} ? InstanceType<F> : {};
|
|
1038
1041
|
/** Do not reference this directly. */
|
|
1039
1042
|
interface File extends _File {
|
|
1040
1043
|
readonly type: string;
|
|
@@ -1619,8 +1622,11 @@ interface $ZodIssueCustom extends $ZodIssueBase {
|
|
|
1619
1622
|
type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;
|
|
1620
1623
|
type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue$1<T> : never;
|
|
1621
1624
|
type RawIssue$1<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
|
|
1622
|
-
/** The input data */
|
|
1623
|
-
readonly
|
|
1625
|
+
/** The input data */
|
|
1626
|
+
readonly input: unknown;
|
|
1627
|
+
/** The schema or check that originated this issue. */
|
|
1628
|
+
readonly inst?: $ZodType | $ZodCheck;
|
|
1629
|
+
/** If `true`, Zod will continue executing checks/refinements after this issue. */
|
|
1624
1630
|
readonly continue?: boolean | undefined;
|
|
1625
1631
|
} & Record<string, unknown>> : never;
|
|
1626
1632
|
type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;
|
|
@@ -1643,11 +1649,11 @@ declare const $ZodError: $constructor<$ZodError>;
|
|
|
1643
1649
|
type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;
|
|
1644
1650
|
type _FlattenedError<T, U = string> = {
|
|
1645
1651
|
formErrors: U[];
|
|
1646
|
-
fieldErrors: { [P in keyof T]?: U[] };
|
|
1652
|
+
fieldErrors: { [P in keyof T]?: U[]; };
|
|
1647
1653
|
};
|
|
1648
|
-
type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? { [K in keyof T]?: $ZodFormattedError<T[K], U
|
|
1654
|
+
type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? { [K in keyof T]?: $ZodFormattedError<T[K], U>; } : T extends any[] ? {
|
|
1649
1655
|
[k: number]: $ZodFormattedError<T[number], U>;
|
|
1650
|
-
} : T extends object ? Flatten<{ [K in keyof T]?: $ZodFormattedError<T[K], U
|
|
1656
|
+
} : T extends object ? Flatten<{ [K in keyof T]?: $ZodFormattedError<T[K], U>; }> : any;
|
|
1651
1657
|
type $ZodFormattedError<T, U = string> = {
|
|
1652
1658
|
_errors: U[];
|
|
1653
1659
|
} & Flatten<_ZodFormattedError<T, U>>;
|
|
@@ -1668,7 +1674,7 @@ declare function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(name: st
|
|
|
1668
1674
|
}): $constructor<T, D>;
|
|
1669
1675
|
declare const $brand: unique symbol;
|
|
1670
1676
|
type $brand<T extends string | number | symbol = string | number | symbol> = {
|
|
1671
|
-
[$brand]: { [k in T]: true };
|
|
1677
|
+
[$brand]: { [k in T]: true; };
|
|
1672
1678
|
};
|
|
1673
1679
|
type $ZodBranded<T extends SomeType, Brand extends string | number | symbol, Dir extends "in" | "out" | "inout" = "out"> = T & (Dir extends "inout" ? {
|
|
1674
1680
|
_zod: {
|
|
@@ -1697,14 +1703,15 @@ type output<T> = T extends {
|
|
|
1697
1703
|
//#endregion
|
|
1698
1704
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.d.cts
|
|
1699
1705
|
type Params<T extends $ZodType | $ZodCheck, IssueTypes extends $ZodIssueBase, OmitKeys extends keyof T["_zod"]["def"] = never> = Flatten<Partial<EmptyToNever<Omit<T["_zod"]["def"], OmitKeys> & ([IssueTypes] extends [never] ? {} : {
|
|
1700
|
-
error?: string | $ZodErrorMap<IssueTypes> | undefined;
|
|
1706
|
+
error?: string | $ZodErrorMap<IssueTypes> | undefined;
|
|
1707
|
+
/** @deprecated This parameter is deprecated. Use `error` instead. */
|
|
1701
1708
|
message?: string | undefined;
|
|
1702
1709
|
})>>>;
|
|
1703
1710
|
type TypeParams<T extends $ZodType = $ZodType & {
|
|
1704
1711
|
_isst: never;
|
|
1705
1712
|
}, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error"> = never> = Params<T, NonNullable<T["_zod"]["isst"]>, "type" | "checks" | "error" | AlsoOmit>;
|
|
1706
|
-
type CheckParams<T extends $ZodCheck = $ZodCheck
|
|
1707
|
-
AlsoOmit extends Exclude<keyof T["_zod"]["def"], "check" | "error"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "check" | "error" | AlsoOmit>;
|
|
1713
|
+
type CheckParams<T extends $ZodCheck = $ZodCheck // & { _issc: never },
|
|
1714
|
+
, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "check" | "error"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "check" | "error" | AlsoOmit>;
|
|
1708
1715
|
type CheckStringFormatParams<T extends $ZodStringFormat = $ZodStringFormat, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "coerce" | "checks" | "error" | "check" | "format"> = never> = Params<T, NonNullable<T["_zod"]["issc"]>, "type" | "coerce" | "checks" | "error" | "check" | "format" | AlsoOmit>;
|
|
1709
1716
|
type CheckTypeParams<T extends $ZodType & $ZodCheck = $ZodType & $ZodCheck, AlsoOmit extends Exclude<keyof T["_zod"]["def"], "type" | "checks" | "error" | "check"> = never> = Params<T, NonNullable<T["_zod"]["isst"] | T["_zod"]["issc"]>, "type" | "checks" | "error" | "check" | AlsoOmit>;
|
|
1710
1717
|
type $ZodCheckEmailParams = CheckStringFormatParams<$ZodEmail, "when">;
|
|
@@ -1753,7 +1760,9 @@ type $ZodNonOptionalParams = TypeParams<$ZodNonOptional, "innerType">;
|
|
|
1753
1760
|
type $ZodCustomParams = CheckTypeParams<$ZodCustom, "fn">;
|
|
1754
1761
|
type $ZodSuperRefineIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
|
|
1755
1762
|
type RawIssue<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T, "message" | "path"> & {
|
|
1756
|
-
/** The schema or check that originated this issue. */
|
|
1763
|
+
/** The schema or check that originated this issue. */
|
|
1764
|
+
readonly inst?: $ZodType | $ZodCheck;
|
|
1765
|
+
/** If `true`, Zod will execute subsequent checks/refinements instead of immediately aborting */
|
|
1757
1766
|
readonly continue?: boolean | undefined;
|
|
1758
1767
|
} & Record<string, unknown>> : never;
|
|
1759
1768
|
interface $RefinementCtx<T = unknown> extends ParsePayload<T> {
|
|
@@ -2007,8 +2016,10 @@ interface ZodArray<T extends SomeType = $ZodType> extends _ZodType<$ZodArrayInte
|
|
|
2007
2016
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2008
2017
|
}
|
|
2009
2018
|
declare const ZodArray: $constructor<ZodArray>;
|
|
2010
|
-
type SafeExtendShape<Base extends $ZodShape, Ext extends $ZodLooseShape> = { [K in keyof Ext]: K extends keyof Base ? output<Ext[K]> extends output<Base[K]> ? input<Ext[K]> extends input<Base[K]> ? Ext[K] : never : never : Ext[K] };
|
|
2011
|
-
interface ZodObject<
|
|
2019
|
+
type SafeExtendShape<Base extends $ZodShape, Ext extends $ZodLooseShape> = { [K in keyof Ext]: K extends keyof Base ? output<Ext[K]> extends output<Base[K]> ? input<Ext[K]> extends input<Base[K]> ? Ext[K] : never : never : Ext[K]; };
|
|
2020
|
+
interface ZodObject<
|
|
2021
|
+
/** @ts-ignore Cast variance */
|
|
2022
|
+
out Shape extends $ZodShape = $ZodLooseShape, out Config extends $ZodObjectConfig = $strip> extends _ZodType<$ZodObjectInternals<Shape, Config>>, $ZodObject<Shape, Config> {
|
|
2012
2023
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2013
2024
|
shape: Shape;
|
|
2014
2025
|
keyof(): ZodEnum<ToEnum<keyof Shape & string>>;
|
|
@@ -2030,10 +2041,10 @@ interface ZodObject< /** @ts-ignore Cast variance */out Shape extends $ZodShape
|
|
|
2030
2041
|
merge<U extends ZodObject>(other: U): ZodObject<Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
|
|
2031
2042
|
pick<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
2032
2043
|
omit<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
2033
|
-
partial(): ZodObject<{ -readonly [k in keyof Shape]: ZodOptional<Shape[k]
|
|
2034
|
-
partial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k] }, Config>;
|
|
2035
|
-
required(): ZodObject<{ -readonly [k in keyof Shape]: ZodNonOptional<Shape[k]
|
|
2036
|
-
required<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k] }, Config>;
|
|
2044
|
+
partial(): ZodObject<{ -readonly [k in keyof Shape]: ZodOptional<Shape[k]>; }, Config>;
|
|
2045
|
+
partial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
2046
|
+
required(): ZodObject<{ -readonly [k in keyof Shape]: ZodNonOptional<Shape[k]>; }, Config>;
|
|
2047
|
+
required<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ -readonly [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k]; }, Config>;
|
|
2037
2048
|
}
|
|
2038
2049
|
declare const ZodObject: $constructor<ZodObject>;
|
|
2039
2050
|
interface ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends _ZodType<$ZodUnionInternals<T>>, $ZodUnion<T> {
|
|
@@ -2057,7 +2068,9 @@ interface ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value extends Som
|
|
|
2057
2068
|
valueType: Value;
|
|
2058
2069
|
}
|
|
2059
2070
|
declare const ZodRecord: $constructor<ZodRecord>;
|
|
2060
|
-
interface ZodEnum<
|
|
2071
|
+
interface ZodEnum<
|
|
2072
|
+
/** @ts-ignore Cast variance */
|
|
2073
|
+
out T extends EnumLike = EnumLike> extends _ZodType<$ZodEnumInternals<T>>, $ZodEnum<T> {
|
|
2061
2074
|
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
2062
2075
|
enum: T;
|
|
2063
2076
|
options: Array<T[keyof T]>;
|
|
@@ -3142,7 +3155,7 @@ interface Envelope<E extends string, D> {
|
|
|
3142
3155
|
* The exact JSON body Rendobar POSTs to your endpoint, discriminated by `event`.
|
|
3143
3156
|
* Switch on `payload.event` and `payload.data` narrows to the matching shape.
|
|
3144
3157
|
*/
|
|
3145
|
-
type WebhookPayload = { [E in WebhookEventType]: Envelope<E, WebhookEventDataMap[E]
|
|
3158
|
+
type WebhookPayload = { [E in WebhookEventType]: Envelope<E, WebhookEventDataMap[E]>; }[WebhookEventType] | Envelope<"test", TestEventData>;
|
|
3146
3159
|
//#endregion
|
|
3147
3160
|
//#region src/types.d.ts
|
|
3148
3161
|
/**
|
|
@@ -3222,35 +3235,35 @@ interface ClientConfig {
|
|
|
3222
3235
|
}
|
|
3223
3236
|
declare function createClient(config?: ClientConfig): {
|
|
3224
3237
|
jobs: {
|
|
3225
|
-
create(params: CreateJobParams, options?: {
|
|
3238
|
+
create: (params: CreateJobParams, options?: {
|
|
3226
3239
|
signal?: AbortSignal;
|
|
3227
|
-
})
|
|
3228
|
-
get(id: string, options?: {
|
|
3240
|
+
}) => Promise<JobCreatedResponse>;
|
|
3241
|
+
get: (id: string, options?: {
|
|
3229
3242
|
signal?: AbortSignal;
|
|
3230
|
-
})
|
|
3231
|
-
list(params?: ListJobsParams, options?: {
|
|
3243
|
+
}) => Promise<JobResponse>;
|
|
3244
|
+
list: (params?: ListJobsParams, options?: {
|
|
3232
3245
|
signal?: AbortSignal;
|
|
3233
|
-
})
|
|
3234
|
-
listAll(params?: Omit<ListJobsParams, "offset">)
|
|
3235
|
-
wait(id: string, options?: WaitOptions)
|
|
3236
|
-
cancel(id: string, options?: {
|
|
3246
|
+
}) => Promise<JobListPage>;
|
|
3247
|
+
listAll: (params?: Omit<ListJobsParams, "offset">) => AsyncGenerator<JobResponse>;
|
|
3248
|
+
wait: (id: string, options?: WaitOptions) => Promise<JobResponse>;
|
|
3249
|
+
cancel: (id: string, options?: {
|
|
3237
3250
|
signal?: AbortSignal;
|
|
3238
|
-
})
|
|
3239
|
-
download(id: string, options?: {
|
|
3251
|
+
}) => Promise<JobResponse>;
|
|
3252
|
+
download: (id: string, options?: {
|
|
3240
3253
|
signal?: AbortSignal;
|
|
3241
|
-
})
|
|
3242
|
-
logs(id: string, options?: {
|
|
3254
|
+
}) => Promise<Response>;
|
|
3255
|
+
logs: (id: string, options?: {
|
|
3243
3256
|
signal?: AbortSignal;
|
|
3244
|
-
})
|
|
3245
|
-
getTimings(id: string, options?: {
|
|
3257
|
+
}) => Promise<LogEntryData[]>;
|
|
3258
|
+
getTimings: (id: string, options?: {
|
|
3246
3259
|
signal?: AbortSignal;
|
|
3247
|
-
})
|
|
3248
|
-
types(options?: {
|
|
3260
|
+
}) => Promise<JobTimings>;
|
|
3261
|
+
types: (options?: {
|
|
3249
3262
|
signal?: AbortSignal;
|
|
3250
|
-
})
|
|
3251
|
-
stats(params?: StatsParams, options?: {
|
|
3263
|
+
}) => Promise<JobType[]>;
|
|
3264
|
+
stats: (params?: StatsParams, options?: {
|
|
3252
3265
|
signal?: AbortSignal;
|
|
3253
|
-
})
|
|
3266
|
+
}) => Promise<JobStats>;
|
|
3254
3267
|
};
|
|
3255
3268
|
billing: {
|
|
3256
3269
|
state(options?: {
|
|
@@ -3401,7 +3414,7 @@ declare function createClient(config?: ClientConfig): {
|
|
|
3401
3414
|
signal?: AbortSignal;
|
|
3402
3415
|
}): Promise<void>;
|
|
3403
3416
|
getSettings(options?: {
|
|
3404
|
-
signal? /** Custom fetch function for testing or special runtimes.
|
|
3417
|
+
signal? /** Custom fetch function for testing or special runtimes. */ : AbortSignal;
|
|
3405
3418
|
}): Promise<OrgSettings>;
|
|
3406
3419
|
updateSettings(body: Partial<Pick<OrgSettings, "billingEmailsEnabled" | "defaultRegion" | "regionPinned">>, options?: {
|
|
3407
3420
|
signal?: AbortSignal;
|
|
@@ -3575,21 +3588,32 @@ type ListJobsParams = {
|
|
|
3575
3588
|
status?: string;
|
|
3576
3589
|
type?: string;
|
|
3577
3590
|
limit?: number;
|
|
3578
|
-
offset?: number;
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3591
|
+
offset?: number;
|
|
3592
|
+
/** Sort field. Default: created. */
|
|
3593
|
+
sort?: "created" | "duration" | "cost";
|
|
3594
|
+
/** Sort direction. Default: desc. */
|
|
3595
|
+
order?: "asc" | "desc";
|
|
3596
|
+
/** Filter by originating client (sdk | cli | mcp | dashboard | ...). */
|
|
3597
|
+
client?: string;
|
|
3598
|
+
/** Filter jobs created at or after this Unix ms timestamp. */
|
|
3599
|
+
from?: number;
|
|
3600
|
+
/** Filter jobs created at or before this Unix ms timestamp. */
|
|
3583
3601
|
to?: number;
|
|
3584
3602
|
};
|
|
3585
3603
|
type StatsParams = {
|
|
3586
|
-
/** Time window for the aggregate. Default: 24h. */
|
|
3604
|
+
/** Time window for the aggregate. Default: 24h. */
|
|
3605
|
+
window?: "24h" | "7d" | "30d";
|
|
3587
3606
|
};
|
|
3588
3607
|
type WaitOptions = {
|
|
3589
|
-
/** Max wait time in ms. Default: 300_000 (5 minutes). */
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3608
|
+
/** Max wait time in ms. Default: 300_000 (5 minutes). */
|
|
3609
|
+
timeout?: number;
|
|
3610
|
+
/** Initial poll interval in ms. Default: 2_000. Grows with exponential backoff. */
|
|
3611
|
+
interval?: number;
|
|
3612
|
+
/** Cap for the backoff poll interval in ms. Default: 10_000. */
|
|
3613
|
+
maxInterval?: number;
|
|
3614
|
+
/** Called on each poll with the latest job state. */
|
|
3615
|
+
onProgress?: (job: JobResponse) => void;
|
|
3616
|
+
/** Abort signal for cancellation. */
|
|
3593
3617
|
signal?: AbortSignal;
|
|
3594
3618
|
/**
|
|
3595
3619
|
* When true, throw JobFailedError if the job ends with status "failed" or "cancelled".
|
|
@@ -3671,12 +3695,19 @@ type UploadProgress = {
|
|
|
3671
3695
|
total: number;
|
|
3672
3696
|
};
|
|
3673
3697
|
type CreateUploadOptions = {
|
|
3674
|
-
/** Display filename, sent to the API and used in Content-Disposition. */
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3698
|
+
/** Display filename, sent to the API and used in Content-Disposition. */
|
|
3699
|
+
filename: string;
|
|
3700
|
+
/** Byte size. Auto-derived from the Blob when omitted. */
|
|
3701
|
+
size?: number;
|
|
3702
|
+
/** MIME type hint. */
|
|
3703
|
+
contentType?: string;
|
|
3704
|
+
/** Client-declared sha256, enables server-side dedup. */
|
|
3705
|
+
checksum?: string;
|
|
3706
|
+
/** true → 'persisted' lifecycle; default is ephemeral (24h TTL). */
|
|
3707
|
+
persist?: boolean;
|
|
3708
|
+
/** Parallel multipart part uploads. Default: 5. */
|
|
3709
|
+
concurrency?: number;
|
|
3710
|
+
/** Called as bytes finish uploading. */
|
|
3680
3711
|
onProgress?: (p: UploadProgress) => void;
|
|
3681
3712
|
signal?: AbortSignal;
|
|
3682
3713
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,10 @@ import { WebSocket } from "partysocket";
|
|
|
5
5
|
* Use isApiError() to narrow in catch blocks.
|
|
6
6
|
*/
|
|
7
7
|
var ApiError = class extends Error {
|
|
8
|
+
code;
|
|
9
|
+
statusCode;
|
|
10
|
+
details;
|
|
11
|
+
retryAfter;
|
|
8
12
|
constructor(code, statusCode, message, details, retryAfter) {
|
|
9
13
|
super(message);
|
|
10
14
|
this.code = code;
|
|
@@ -52,7 +56,7 @@ var JobFailedError = class extends Error {
|
|
|
52
56
|
const DEFAULT_TIMEOUT = 3e4;
|
|
53
57
|
const DEFAULT_MAX_RETRIES = 2;
|
|
54
58
|
const RETRY_BASE_DELAY = 500;
|
|
55
|
-
const RETRYABLE_STATUS_CODES = new Set([
|
|
59
|
+
const RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
56
60
|
429,
|
|
57
61
|
500,
|
|
58
62
|
502,
|
|
@@ -171,90 +175,101 @@ function isAbortError(error) {
|
|
|
171
175
|
}
|
|
172
176
|
//#endregion
|
|
173
177
|
//#region src/resources/jobs.ts
|
|
174
|
-
const TERMINAL_STATUSES$1 = new Set([
|
|
178
|
+
const TERMINAL_STATUSES$1 = /* @__PURE__ */ new Set([
|
|
175
179
|
"complete",
|
|
176
180
|
"failed",
|
|
177
181
|
"cancelled"
|
|
178
182
|
]);
|
|
179
183
|
function createJobsResource(request) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
});
|
|
187
|
-
},
|
|
188
|
-
async get(id, options) {
|
|
189
|
-
return request(`/jobs/${id}`, { signal: options?.signal });
|
|
190
|
-
},
|
|
191
|
-
async list(params, options) {
|
|
192
|
-
return request("/jobs", {
|
|
193
|
-
query: params,
|
|
194
|
-
signal: options?.signal
|
|
195
|
-
});
|
|
196
|
-
},
|
|
197
|
-
async *listAll(params) {
|
|
198
|
-
let offset = 0;
|
|
199
|
-
const limit = params?.limit ?? 50;
|
|
200
|
-
while (true) {
|
|
201
|
-
const page = await request("/jobs", { query: {
|
|
202
|
-
...params,
|
|
203
|
-
limit,
|
|
204
|
-
offset
|
|
205
|
-
} });
|
|
206
|
-
for (const job of page.data) yield job;
|
|
207
|
-
if (offset + page.data.length >= page.meta.total) break;
|
|
208
|
-
offset += limit;
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
async wait(id, options = {}) {
|
|
212
|
-
const { timeout = 3e5, interval = 2e3, maxInterval = 1e4, onProgress, signal, throwOnFailure = false } = options;
|
|
213
|
-
const deadline = Date.now() + timeout;
|
|
214
|
-
let currentInterval = interval;
|
|
215
|
-
while (Date.now() < deadline) {
|
|
216
|
-
if (signal?.aborted) throw new DOMException("Wait aborted", "AbortError");
|
|
217
|
-
const job = await request(`/jobs/${id}`, { signal });
|
|
218
|
-
onProgress?.(job);
|
|
219
|
-
if (TERMINAL_STATUSES$1.has(job.status)) return resolveTerminal(id, job, throwOnFailure);
|
|
220
|
-
const remaining = deadline - Date.now();
|
|
221
|
-
const delay = Math.min(currentInterval, remaining);
|
|
222
|
-
if (delay <= 0) break;
|
|
223
|
-
await sleep(delay, signal);
|
|
224
|
-
currentInterval = Math.min(currentInterval * 1.5, maxInterval);
|
|
225
|
-
}
|
|
184
|
+
async function wait(id, options = {}) {
|
|
185
|
+
const { timeout = 3e5, interval = 2e3, maxInterval = 1e4, onProgress, signal, throwOnFailure = false } = options;
|
|
186
|
+
const deadline = Date.now() + timeout;
|
|
187
|
+
let currentInterval = interval;
|
|
188
|
+
while (Date.now() < deadline) {
|
|
189
|
+
if (signal?.aborted) throw new DOMException("Wait aborted", "AbortError");
|
|
226
190
|
const job = await request(`/jobs/${id}`, { signal });
|
|
227
191
|
onProgress?.(job);
|
|
228
192
|
if (TERMINAL_STATUSES$1.has(job.status)) return resolveTerminal(id, job, throwOnFailure);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
193
|
+
const remaining = deadline - Date.now();
|
|
194
|
+
const delay = Math.min(currentInterval, remaining);
|
|
195
|
+
if (delay <= 0) break;
|
|
196
|
+
await sleep(delay, signal);
|
|
197
|
+
currentInterval = Math.min(currentInterval * 1.5, maxInterval);
|
|
198
|
+
}
|
|
199
|
+
const job = await request(`/jobs/${id}`, { signal });
|
|
200
|
+
onProgress?.(job);
|
|
201
|
+
if (TERMINAL_STATUSES$1.has(job.status)) return resolveTerminal(id, job, throwOnFailure);
|
|
202
|
+
throw new WaitTimeoutError(id, job.status, timeout);
|
|
203
|
+
}
|
|
204
|
+
async function create(params, options) {
|
|
205
|
+
return request("/jobs", {
|
|
206
|
+
method: "POST",
|
|
207
|
+
body: params,
|
|
208
|
+
signal: options?.signal
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
async function get(id, options) {
|
|
212
|
+
return request(`/jobs/${id}`, { signal: options?.signal });
|
|
213
|
+
}
|
|
214
|
+
async function list(params, options) {
|
|
215
|
+
return request("/jobs", {
|
|
216
|
+
query: params,
|
|
217
|
+
signal: options?.signal
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
async function* listAll(params) {
|
|
221
|
+
let offset = 0;
|
|
222
|
+
const limit = params?.limit ?? 50;
|
|
223
|
+
while (true) {
|
|
224
|
+
const page = await request("/jobs", { query: {
|
|
225
|
+
...params,
|
|
226
|
+
limit,
|
|
227
|
+
offset
|
|
228
|
+
} });
|
|
229
|
+
for (const job of page.data) yield job;
|
|
230
|
+
if (offset + page.data.length >= page.meta.total) break;
|
|
231
|
+
offset += limit;
|
|
257
232
|
}
|
|
233
|
+
}
|
|
234
|
+
async function cancel(id, options) {
|
|
235
|
+
return request(`/jobs/${id}/cancel`, {
|
|
236
|
+
method: "POST",
|
|
237
|
+
signal: options?.signal
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
async function download(id, options) {
|
|
241
|
+
return request(`/jobs/${id}/download`, {
|
|
242
|
+
raw: true,
|
|
243
|
+
signal: options?.signal
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
async function logs(id, options) {
|
|
247
|
+
return request(`/jobs/${id}/logs`, { signal: options?.signal });
|
|
248
|
+
}
|
|
249
|
+
async function getTimings(id, options) {
|
|
250
|
+
return request(`/jobs/${id}/timings`, { signal: options?.signal });
|
|
251
|
+
}
|
|
252
|
+
async function types(options) {
|
|
253
|
+
return request("/jobs/types", { signal: options?.signal });
|
|
254
|
+
}
|
|
255
|
+
async function stats(params, options) {
|
|
256
|
+
return request("/jobs/stats", {
|
|
257
|
+
query: params,
|
|
258
|
+
signal: options?.signal
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
create,
|
|
263
|
+
get,
|
|
264
|
+
list,
|
|
265
|
+
listAll,
|
|
266
|
+
wait,
|
|
267
|
+
cancel,
|
|
268
|
+
download,
|
|
269
|
+
logs,
|
|
270
|
+
getTimings,
|
|
271
|
+
types,
|
|
272
|
+
stats
|
|
258
273
|
};
|
|
259
274
|
}
|
|
260
275
|
/**
|
|
@@ -298,6 +313,7 @@ function createBillingResource(request) {
|
|
|
298
313
|
signal: options?.signal
|
|
299
314
|
});
|
|
300
315
|
},
|
|
316
|
+
/** Usage grouped by originating client (dashboard, sdk, cli, mcp, n8n, api, ...). */
|
|
301
317
|
async usageByClient(params, options) {
|
|
302
318
|
return request("/billing/usage-by-client", {
|
|
303
319
|
query: params,
|
|
@@ -441,7 +457,16 @@ async function mapLimit(items, limit, fn, signal) {
|
|
|
441
457
|
return out;
|
|
442
458
|
}
|
|
443
459
|
function createUploadsResource(request) {
|
|
444
|
-
return {
|
|
460
|
+
return {
|
|
461
|
+
/**
|
|
462
|
+
* One-call upload. Orchestrates the `/assets` flow: init → presigned PUT
|
|
463
|
+
* (small files) or parallel multipart (large files) → complete. Returns the
|
|
464
|
+
* ready Asset, whose `id` can be used as a job input reference.
|
|
465
|
+
*
|
|
466
|
+
* @param file - File content (Blob, ArrayBuffer, or Uint8Array).
|
|
467
|
+
* @param options.filename - Display filename (required).
|
|
468
|
+
*/
|
|
469
|
+
async create(file, options) {
|
|
445
470
|
const blob = toBlob(file);
|
|
446
471
|
const size = options.size ?? blob.size;
|
|
447
472
|
if (options.signal?.aborted) throw new Error("Upload aborted");
|
|
@@ -736,13 +761,13 @@ const WS_OPTIONS = {
|
|
|
736
761
|
reconnectionDelayGrowFactor: 1.5,
|
|
737
762
|
maxRetries: Infinity
|
|
738
763
|
};
|
|
739
|
-
const TERMINAL_STATUSES = new Set([
|
|
764
|
+
const TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
740
765
|
"complete",
|
|
741
766
|
"failed",
|
|
742
767
|
"cancelled"
|
|
743
768
|
]);
|
|
744
769
|
/** Known OrgEvent types — only dispatch events with recognized types. */
|
|
745
|
-
const KNOWN_EVENT_TYPES = new Set([
|
|
770
|
+
const KNOWN_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
746
771
|
"job.created",
|
|
747
772
|
"job.status",
|
|
748
773
|
"job.result",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rendobar/sdk",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript client for the Rendobar media processing API",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@rendobar/shared": "workspace:*",
|
|
44
|
-
"tsdown": "^0.
|
|
44
|
+
"tsdown": "^0.22.0",
|
|
45
45
|
"typescript": "^5.9.3",
|
|
46
46
|
"vitest": "^4.0.18"
|
|
47
47
|
}
|