@rendobar/sdk 2.2.0 → 3.0.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 +148 -11
- package/dist/index.d.cts +227 -48
- package/dist/index.d.mts +227 -48
- package/dist/index.mjs +148 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -303,13 +303,130 @@ function createBillingResource(request) {
|
|
|
303
303
|
}
|
|
304
304
|
//#endregion
|
|
305
305
|
//#region src/resources/uploads.ts
|
|
306
|
+
function toBlob(file) {
|
|
307
|
+
return file instanceof Blob ? file : new Blob([file]);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* PUT a body to a presigned R2 url with bounded retry.
|
|
311
|
+
*
|
|
312
|
+
* Returns the ETag string when the bucket exposes it, or `null` when the
|
|
313
|
+
* response header is absent (e.g. bucket CORS not exposing ETag). Only
|
|
314
|
+
* network/HTTP failures trigger retries; a missing ETag is not retried because
|
|
315
|
+
* it is a deterministic misconfiguration, not a transient error.
|
|
316
|
+
*/
|
|
317
|
+
async function putWithRetry(url, body, signal, attempts = 3) {
|
|
318
|
+
let lastErr;
|
|
319
|
+
for (let i = 0; i < attempts; i++) {
|
|
320
|
+
if (signal?.aborted) throw new Error("Upload aborted");
|
|
321
|
+
try {
|
|
322
|
+
const res = await fetch(url, {
|
|
323
|
+
method: "PUT",
|
|
324
|
+
body,
|
|
325
|
+
signal
|
|
326
|
+
});
|
|
327
|
+
if (!res.ok) throw new Error(`Upload PUT failed: ${res.status}`);
|
|
328
|
+
return res.headers.get("etag");
|
|
329
|
+
} catch (e) {
|
|
330
|
+
lastErr = e;
|
|
331
|
+
if (signal?.aborted) throw e;
|
|
332
|
+
if (i < attempts - 1) await new Promise((r) => setTimeout(r, 200 * 2 ** i));
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
throw lastErr;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Run `fn` over `items` with at most `limit` in flight; preserves order.
|
|
339
|
+
* Workers stop pulling new items once `signal` is aborted, enabling fast
|
|
340
|
+
* cancellation when one part fails.
|
|
341
|
+
*/
|
|
342
|
+
async function mapLimit(items, limit, fn, signal) {
|
|
343
|
+
const out = new Array(items.length);
|
|
344
|
+
let next = 0;
|
|
345
|
+
const worker = async () => {
|
|
346
|
+
while (next < items.length) {
|
|
347
|
+
if (signal?.aborted) break;
|
|
348
|
+
const i = next++;
|
|
349
|
+
out[i] = await fn(items[i]);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
const workers = Math.min(Math.max(1, limit), items.length);
|
|
353
|
+
await Promise.all(Array.from({ length: workers }, worker));
|
|
354
|
+
return out;
|
|
355
|
+
}
|
|
306
356
|
function createUploadsResource(request) {
|
|
307
|
-
return { async
|
|
308
|
-
|
|
357
|
+
return { async create(file, options) {
|
|
358
|
+
const blob = toBlob(file);
|
|
359
|
+
const size = options.size ?? blob.size;
|
|
360
|
+
if (options.signal?.aborted) throw new Error("Upload aborted");
|
|
361
|
+
const init = await (await request("/assets", {
|
|
309
362
|
method: "POST",
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
363
|
+
body: {
|
|
364
|
+
filename: options.filename,
|
|
365
|
+
size,
|
|
366
|
+
contentType: options.contentType,
|
|
367
|
+
checksum: options.checksum,
|
|
368
|
+
lifecycle: options.persist ? "persisted" : "ephemeral"
|
|
369
|
+
},
|
|
370
|
+
raw: true,
|
|
371
|
+
signal: options.signal
|
|
372
|
+
})).json();
|
|
373
|
+
if (init.status === "deduplicated") {
|
|
374
|
+
options.onProgress?.({
|
|
375
|
+
loaded: size,
|
|
376
|
+
total: size
|
|
377
|
+
});
|
|
378
|
+
return init.data;
|
|
379
|
+
}
|
|
380
|
+
if (init.status === "presigned") {
|
|
381
|
+
await putWithRetry(init.upload.url, blob, options.signal);
|
|
382
|
+
options.onProgress?.({
|
|
383
|
+
loaded: size,
|
|
384
|
+
total: size
|
|
385
|
+
});
|
|
386
|
+
return request(`/assets/${init.data.id}/complete`, {
|
|
387
|
+
method: "POST",
|
|
388
|
+
body: {},
|
|
389
|
+
signal: options.signal
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
const internal = new AbortController();
|
|
393
|
+
const combinedSignal = options.signal ? AbortSignal.any([options.signal, internal.signal]) : internal.signal;
|
|
394
|
+
const { partSize, parts } = init.upload;
|
|
395
|
+
let loaded = 0;
|
|
396
|
+
let partError = null;
|
|
397
|
+
const completed = await mapLimit(parts, options.concurrency ?? 5, async (p) => {
|
|
398
|
+
const start = (p.partNumber - 1) * partSize;
|
|
399
|
+
const chunk = blob.slice(start, Math.min(start + partSize, size));
|
|
400
|
+
let etag;
|
|
401
|
+
try {
|
|
402
|
+
etag = await putWithRetry(p.url, chunk, combinedSignal);
|
|
403
|
+
} catch (e) {
|
|
404
|
+
internal.abort();
|
|
405
|
+
partError = e instanceof Error ? e : new Error(String(e));
|
|
406
|
+
throw partError;
|
|
407
|
+
}
|
|
408
|
+
if (etag === null) {
|
|
409
|
+
internal.abort();
|
|
410
|
+
const corsErr = /* @__PURE__ */ new Error("Multipart upload requires the ETag response header. Configure the R2 bucket CORS to expose 'ETag'.");
|
|
411
|
+
partError = corsErr;
|
|
412
|
+
throw corsErr;
|
|
413
|
+
}
|
|
414
|
+
loaded += chunk.size;
|
|
415
|
+
options.onProgress?.({
|
|
416
|
+
loaded,
|
|
417
|
+
total: size
|
|
418
|
+
});
|
|
419
|
+
return {
|
|
420
|
+
partNumber: p.partNumber,
|
|
421
|
+
etag
|
|
422
|
+
};
|
|
423
|
+
}, combinedSignal);
|
|
424
|
+
if (partError) throw partError;
|
|
425
|
+
completed.sort((a, b) => a.partNumber - b.partNumber);
|
|
426
|
+
return request(`/assets/${init.data.id}/complete`, {
|
|
427
|
+
method: "POST",
|
|
428
|
+
body: { parts: completed },
|
|
429
|
+
signal: options.signal
|
|
313
430
|
});
|
|
314
431
|
} };
|
|
315
432
|
}
|
|
@@ -449,12 +566,32 @@ function createBatchesResource(request) {
|
|
|
449
566
|
//#endregion
|
|
450
567
|
//#region src/resources/assets.ts
|
|
451
568
|
function createAssetsResource(request) {
|
|
452
|
-
return {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
569
|
+
return {
|
|
570
|
+
async list(params, options) {
|
|
571
|
+
return request("/assets", {
|
|
572
|
+
query: params,
|
|
573
|
+
signal: options?.signal
|
|
574
|
+
});
|
|
575
|
+
},
|
|
576
|
+
async get(id, options) {
|
|
577
|
+
return request(`/assets/${id}`, { signal: options?.signal });
|
|
578
|
+
},
|
|
579
|
+
async delete(id, options) {
|
|
580
|
+
return request(`/assets/${id}`, {
|
|
581
|
+
method: "DELETE",
|
|
582
|
+
signal: options?.signal
|
|
583
|
+
});
|
|
584
|
+
},
|
|
585
|
+
async download(id, options) {
|
|
586
|
+
return request(`/assets/${id}/download`, { signal: options?.signal });
|
|
587
|
+
},
|
|
588
|
+
async templates(params, options) {
|
|
589
|
+
return request("/assets/templates", {
|
|
590
|
+
query: params,
|
|
591
|
+
signal: options?.signal
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
};
|
|
458
595
|
}
|
|
459
596
|
//#endregion
|
|
460
597
|
//#region src/resources/team.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema.d.cts
|
|
2
2
|
type _JSONSchema = boolean | JSONSchema;
|
|
3
3
|
type JSONSchema = {
|
|
4
4
|
[k: string]: unknown;
|
|
@@ -66,7 +66,7 @@ type JSONSchema = {
|
|
|
66
66
|
};
|
|
67
67
|
type BaseSchema = JSONSchema;
|
|
68
68
|
//#endregion
|
|
69
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
69
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/standard-schema.d.cts
|
|
70
70
|
/** The Standard interface. */
|
|
71
71
|
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
72
72
|
/** The Standard properties. */
|
|
@@ -185,7 +185,7 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
185
185
|
}
|
|
186
186
|
interface StandardSchemaWithJSONProps<Input = unknown, Output = Input> extends StandardSchemaV1.Props<Input, Output>, StandardJSONSchemaV1.Props<Input, Output> {}
|
|
187
187
|
//#endregion
|
|
188
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
188
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.d.cts
|
|
189
189
|
declare const $output: unique symbol;
|
|
190
190
|
type $output = typeof $output;
|
|
191
191
|
declare const $input: unique symbol;
|
|
@@ -212,7 +212,7 @@ interface JSONSchemaMeta {
|
|
|
212
212
|
}
|
|
213
213
|
interface GlobalMeta extends JSONSchemaMeta {}
|
|
214
214
|
//#endregion
|
|
215
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
215
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.d.cts
|
|
216
216
|
type Processor<T extends $ZodType = $ZodType> = (schema: T, ctx: ToJSONSchemaContext, json: BaseSchema, params: ProcessParams) => void;
|
|
217
217
|
interface JSONSchemaGeneratorParams {
|
|
218
218
|
processors: Record<string, Processor>;
|
|
@@ -301,7 +301,7 @@ interface ZodStandardJSONSchemaPayload<T> extends BaseSchema {
|
|
|
301
301
|
"~standard": ZodStandardSchemaWithJSON$1<T>;
|
|
302
302
|
}
|
|
303
303
|
//#endregion
|
|
304
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
304
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.d.cts
|
|
305
305
|
type JWTAlgorithm = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "EdDSA" | (string & {});
|
|
306
306
|
type MimeTypes = "application/json" | "application/xml" | "application/x-www-form-urlencoded" | "application/javascript" | "application/pdf" | "application/zip" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/octet-stream" | "application/graphql" | "text/html" | "text/plain" | "text/css" | "text/javascript" | "text/csv" | "image/png" | "image/jpeg" | "image/gif" | "image/svg+xml" | "image/webp" | "audio/mpeg" | "audio/ogg" | "audio/wav" | "audio/webm" | "video/mp4" | "video/webm" | "video/ogg" | "font/woff" | "font/woff2" | "font/ttf" | "font/otf" | "multipart/form-data" | (string & {});
|
|
307
307
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
@@ -312,6 +312,7 @@ type LoosePartial<T extends object> = InexactPartial<T> & {
|
|
|
312
312
|
[k: string]: unknown;
|
|
313
313
|
};
|
|
314
314
|
type Mask<Keys extends PropertyKey> = { [K in Keys]?: true };
|
|
315
|
+
type Writeable<T> = { -readonly [P in keyof T]: T[P] } & {};
|
|
315
316
|
type InexactPartial<T> = { [P in keyof T]?: T[P] | undefined };
|
|
316
317
|
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
317
318
|
readonly [Symbol.toStringTag]: string;
|
|
@@ -341,14 +342,14 @@ declare abstract class Class {
|
|
|
341
342
|
constructor(..._args: any[]);
|
|
342
343
|
}
|
|
343
344
|
//#endregion
|
|
344
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
345
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.d.cts
|
|
345
346
|
declare const version: {
|
|
346
347
|
readonly major: 4;
|
|
347
|
-
readonly minor:
|
|
348
|
+
readonly minor: 4;
|
|
348
349
|
readonly patch: number;
|
|
349
350
|
};
|
|
350
351
|
//#endregion
|
|
351
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
352
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.d.cts
|
|
352
353
|
interface ParseContext<T extends $ZodIssueBase = never> {
|
|
353
354
|
/** Customize error messages. */
|
|
354
355
|
readonly error?: $ZodErrorMap<T>;
|
|
@@ -366,8 +367,13 @@ interface ParseContextInternal<T extends $ZodIssueBase = never> extends ParseCon
|
|
|
366
367
|
interface ParsePayload<T = unknown> {
|
|
367
368
|
value: T;
|
|
368
369
|
issues: $ZodRawIssue[];
|
|
369
|
-
/** A
|
|
370
|
+
/** A way to mark a whole payload as aborted. Used in codecs/pipes. */
|
|
370
371
|
aborted?: boolean;
|
|
372
|
+
/** @internal Marks a value as a fallback that an outer wrapper (e.g.
|
|
373
|
+
* $ZodOptional) may override with its own interpretation when input was
|
|
374
|
+
* undefined. Set by $ZodCatch when catchValue substitutes and by every
|
|
375
|
+
* $ZodTransform invocation. */
|
|
376
|
+
fallback?: boolean | undefined;
|
|
371
377
|
}
|
|
372
378
|
type CheckFn<T> = (input: ParsePayload<T>) => MaybeAsync<void>;
|
|
373
379
|
interface $ZodTypeDef {
|
|
@@ -509,10 +515,25 @@ interface $ZodNanoID extends $ZodType {
|
|
|
509
515
|
_zod: $ZodNanoIDInternals;
|
|
510
516
|
}
|
|
511
517
|
declare const $ZodNanoID: $constructor<$ZodNanoID>;
|
|
518
|
+
/**
|
|
519
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
520
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
521
|
+
* See https://github.com/paralleldrive/cuid.
|
|
522
|
+
*/
|
|
512
523
|
interface $ZodCUIDInternals extends $ZodStringFormatInternals<"cuid"> {}
|
|
524
|
+
/**
|
|
525
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
526
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
527
|
+
* See https://github.com/paralleldrive/cuid.
|
|
528
|
+
*/
|
|
513
529
|
interface $ZodCUID extends $ZodType {
|
|
514
530
|
_zod: $ZodCUIDInternals;
|
|
515
531
|
}
|
|
532
|
+
/**
|
|
533
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
534
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
535
|
+
* See https://github.com/paralleldrive/cuid.
|
|
536
|
+
*/
|
|
516
537
|
declare const $ZodCUID: $constructor<$ZodCUID>;
|
|
517
538
|
interface $ZodCUID2Internals extends $ZodStringFormatInternals<"cuid2"> {}
|
|
518
539
|
interface $ZodCUID2 extends $ZodType {
|
|
@@ -1327,13 +1348,13 @@ interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
|
|
|
1327
1348
|
declare const $ZodCustom: $constructor<$ZodCustom>;
|
|
1328
1349
|
type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
|
|
1329
1350
|
//#endregion
|
|
1330
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1351
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.d.cts
|
|
1331
1352
|
interface $ZodCheckDef {
|
|
1332
1353
|
check: string;
|
|
1333
1354
|
error?: $ZodErrorMap<never> | undefined;
|
|
1334
1355
|
/** If true, no later checks will be executed if this check fails. Default `false`. */
|
|
1335
1356
|
abort?: boolean | undefined;
|
|
1336
|
-
/** If provided,
|
|
1357
|
+
/** If provided, the check runs only when this returns `true`. By default, it is skipped if prior parsing produced aborting issues. */
|
|
1337
1358
|
when?: ((payload: ParsePayload) => boolean) | undefined;
|
|
1338
1359
|
}
|
|
1339
1360
|
interface $ZodCheckInternals<T> {
|
|
@@ -1509,7 +1530,7 @@ interface $ZodCheckEndsWith extends $ZodCheckInternals<string> {
|
|
|
1509
1530
|
}
|
|
1510
1531
|
declare const $ZodCheckEndsWith: $constructor<$ZodCheckEndsWith>;
|
|
1511
1532
|
//#endregion
|
|
1512
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1533
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.d.cts
|
|
1513
1534
|
interface $ZodIssueBase {
|
|
1514
1535
|
readonly code?: string;
|
|
1515
1536
|
readonly input?: unknown;
|
|
@@ -1561,6 +1582,7 @@ interface $ZodIssueInvalidUnionNoMatch extends $ZodIssueBase {
|
|
|
1561
1582
|
readonly errors: $ZodIssue[][];
|
|
1562
1583
|
readonly input?: unknown;
|
|
1563
1584
|
readonly discriminator?: string | undefined;
|
|
1585
|
+
readonly options?: Primitive[];
|
|
1564
1586
|
readonly inclusive?: true;
|
|
1565
1587
|
}
|
|
1566
1588
|
interface $ZodIssueInvalidUnionMultipleMatch extends $ZodIssueBase {
|
|
@@ -1630,7 +1652,7 @@ type $ZodFormattedError<T, U = string> = {
|
|
|
1630
1652
|
_errors: U[];
|
|
1631
1653
|
} & Flatten<_ZodFormattedError<T, U>>;
|
|
1632
1654
|
//#endregion
|
|
1633
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1655
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.d.cts
|
|
1634
1656
|
type ZodTrait = {
|
|
1635
1657
|
_zod: {
|
|
1636
1658
|
def: any;
|
|
@@ -1673,7 +1695,7 @@ type output<T> = T extends {
|
|
|
1673
1695
|
};
|
|
1674
1696
|
} ? T["_zod"]["output"] : unknown;
|
|
1675
1697
|
//#endregion
|
|
1676
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1698
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.d.cts
|
|
1677
1699
|
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] ? {} : {
|
|
1678
1700
|
error?: string | $ZodErrorMap<IssueTypes> | undefined; /** @deprecated This parameter is deprecated. Use `error` instead. */
|
|
1679
1701
|
message?: string | undefined;
|
|
@@ -1691,6 +1713,11 @@ type $ZodCheckUUIDParams = CheckStringFormatParams<$ZodUUID, "pattern" | "when">
|
|
|
1691
1713
|
type $ZodCheckURLParams = CheckStringFormatParams<$ZodURL, "when">;
|
|
1692
1714
|
type $ZodCheckEmojiParams = CheckStringFormatParams<$ZodEmoji, "when">;
|
|
1693
1715
|
type $ZodCheckNanoIDParams = CheckStringFormatParams<$ZodNanoID, "when">;
|
|
1716
|
+
/**
|
|
1717
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
1718
|
+
* (timestamps embedded in the id). Use {@link _cuid2} instead.
|
|
1719
|
+
* See https://github.com/paralleldrive/cuid.
|
|
1720
|
+
*/
|
|
1694
1721
|
type $ZodCheckCUIDParams = CheckStringFormatParams<$ZodCUID, "when">;
|
|
1695
1722
|
type $ZodCheckCUID2Params = CheckStringFormatParams<$ZodCUID2, "when">;
|
|
1696
1723
|
type $ZodCheckULIDParams = CheckStringFormatParams<$ZodULID, "when">;
|
|
@@ -1732,8 +1759,12 @@ type RawIssue<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T,
|
|
|
1732
1759
|
interface $RefinementCtx<T = unknown> extends ParsePayload<T> {
|
|
1733
1760
|
addIssue(arg: string | $ZodSuperRefineIssue): void;
|
|
1734
1761
|
}
|
|
1762
|
+
interface $ZodSuperRefineParams {
|
|
1763
|
+
/** If provided, the refinement runs only when this returns `true`. By default, it is skipped if prior parsing produced aborting issues. */
|
|
1764
|
+
when?: ((payload: ParsePayload) => boolean) | undefined;
|
|
1765
|
+
}
|
|
1735
1766
|
//#endregion
|
|
1736
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1767
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.d.cts
|
|
1737
1768
|
/** An Error-like class used to store Zod validation issues. */
|
|
1738
1769
|
interface ZodError<T = unknown> extends $ZodError<T> {
|
|
1739
1770
|
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
@@ -1751,7 +1782,7 @@ interface ZodError<T = unknown> extends $ZodError<T> {
|
|
|
1751
1782
|
}
|
|
1752
1783
|
declare const ZodError: $constructor<ZodError>;
|
|
1753
1784
|
//#endregion
|
|
1754
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1785
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.d.cts
|
|
1755
1786
|
type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
|
|
1756
1787
|
type ZodSafeParseSuccess<T> = {
|
|
1757
1788
|
success: true;
|
|
@@ -1764,7 +1795,7 @@ type ZodSafeParseError<T> = {
|
|
|
1764
1795
|
error: ZodError<T>;
|
|
1765
1796
|
};
|
|
1766
1797
|
//#endregion
|
|
1767
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1798
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.d.cts
|
|
1768
1799
|
type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<input<T>, output<T>>;
|
|
1769
1800
|
interface ZodType<out Output = unknown, out Input = unknown, out Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> extends $ZodType<Output, Input, Internals> {
|
|
1770
1801
|
def: Internals["def"];
|
|
@@ -1799,7 +1830,7 @@ interface ZodType<out Output = unknown, out Input = unknown, out Internals exten
|
|
|
1799
1830
|
safeEncodeAsync(data: output<this>, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<input<this>>>;
|
|
1800
1831
|
safeDecodeAsync(data: input<this>, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<output<this>>>;
|
|
1801
1832
|
refine<Ch extends (arg: output<this>) => unknown | Promise<unknown>>(check: Ch, params?: string | $ZodCustomParams): Ch extends ((arg: any) => arg is infer R) ? this & ZodType<R, input<this>> : this;
|
|
1802
|
-
superRefine(refinement: (arg: output<this>, ctx: $RefinementCtx<output<this>>) => void | Promise<void
|
|
1833
|
+
superRefine(refinement: (arg: output<this>, ctx: $RefinementCtx<output<this>>) => void | Promise<void>, params?: $ZodSuperRefineParams): this;
|
|
1803
1834
|
overwrite(fn: (x: output<this>) => output<this>): this;
|
|
1804
1835
|
optional(): ZodOptional<this>;
|
|
1805
1836
|
exactOptional(): ZodExactOptional<this>;
|
|
@@ -1891,7 +1922,11 @@ interface ZodString extends _ZodString<$ZodStringInternals<string>> {
|
|
|
1891
1922
|
nanoid(params?: string | $ZodCheckNanoIDParams): this;
|
|
1892
1923
|
/** @deprecated Use `z.guid()` instead. */
|
|
1893
1924
|
guid(params?: string | $ZodCheckGUIDParams): this;
|
|
1894
|
-
/**
|
|
1925
|
+
/**
|
|
1926
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
1927
|
+
* (timestamps embedded in the id). Use `z.cuid2()` instead.
|
|
1928
|
+
* See https://github.com/paralleldrive/cuid.
|
|
1929
|
+
*/
|
|
1895
1930
|
cuid(params?: string | $ZodCheckCUIDParams): this;
|
|
1896
1931
|
/** @deprecated Use `z.cuid2()` instead. */
|
|
1897
1932
|
cuid2(params?: string | $ZodCheckCUID2Params): this;
|
|
@@ -1987,18 +2022,18 @@ interface ZodObject< /** @ts-ignore Cast variance */out Shape extends $ZodShape
|
|
|
1987
2022
|
strict(): ZodObject<Shape, $strict>;
|
|
1988
2023
|
/** This is the default behavior. This method call is likely unnecessary. */
|
|
1989
2024
|
strip(): ZodObject<Shape, $strip>;
|
|
1990
|
-
extend<U extends $ZodLooseShape>(shape: U): ZodObject<Extend<Shape, U
|
|
1991
|
-
safeExtend<U extends $ZodLooseShape>(shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, SomeType>>): ZodObject<Extend<Shape, U
|
|
2025
|
+
extend<U extends $ZodLooseShape>(shape: U): ZodObject<Extend<Shape, Writeable<U>>, Config>;
|
|
2026
|
+
safeExtend<U extends $ZodLooseShape>(shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, SomeType>>): ZodObject<Extend<Shape, Writeable<U>>, Config>;
|
|
1992
2027
|
/**
|
|
1993
2028
|
* @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
|
|
1994
2029
|
*/
|
|
1995
2030
|
merge<U extends ZodObject>(other: U): ZodObject<Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
|
|
1996
2031
|
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>;
|
|
1997
2032
|
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>;
|
|
1998
|
-
partial(): ZodObject<{ [k in keyof Shape]: ZodOptional<Shape[k]> }, Config>;
|
|
1999
|
-
partial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k] }, Config>;
|
|
2000
|
-
required(): ZodObject<{ [k in keyof Shape]: ZodNonOptional<Shape[k]> }, Config>;
|
|
2001
|
-
required<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k] }, Config>;
|
|
2033
|
+
partial(): ZodObject<{ -readonly [k in keyof Shape]: ZodOptional<Shape[k]> }, Config>;
|
|
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]> }, Config>;
|
|
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>;
|
|
2002
2037
|
}
|
|
2003
2038
|
declare const ZodObject: $constructor<ZodObject>;
|
|
2004
2039
|
interface ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends _ZodType<$ZodUnionInternals<T>>, $ZodUnion<T> {
|
|
@@ -2540,6 +2575,7 @@ declare const transactionSchema: ZodObject<{
|
|
|
2540
2575
|
paidAmount: ZodNumber;
|
|
2541
2576
|
bonusAmount: ZodNumber;
|
|
2542
2577
|
jobId: ZodNullable<ZodString>;
|
|
2578
|
+
jobType: ZodNullable<ZodString>;
|
|
2543
2579
|
balanceAfter: ZodNumber;
|
|
2544
2580
|
createdAt: ZodNumber;
|
|
2545
2581
|
}, $strip>;
|
|
@@ -2624,6 +2660,128 @@ declare const paymentMethodSchema: ZodObject<{
|
|
|
2624
2660
|
wallet: ZodOptional<ZodNullable<ZodString>>;
|
|
2625
2661
|
isDefault: ZodBoolean;
|
|
2626
2662
|
}, $strip>;
|
|
2663
|
+
declare const assetSchema: ZodObject<{
|
|
2664
|
+
id: ZodString;
|
|
2665
|
+
url: ZodString;
|
|
2666
|
+
orgId: ZodString;
|
|
2667
|
+
createdBy: ZodNullable<ZodString>;
|
|
2668
|
+
lifecycle: ZodString;
|
|
2669
|
+
status: ZodString;
|
|
2670
|
+
source: ZodString;
|
|
2671
|
+
kind: ZodString;
|
|
2672
|
+
scope: ZodString;
|
|
2673
|
+
region: ZodString;
|
|
2674
|
+
etag: ZodNullable<ZodString>;
|
|
2675
|
+
checksum: ZodNullable<ZodString>;
|
|
2676
|
+
declaredSize: ZodNullable<ZodNumber>;
|
|
2677
|
+
sizeBytes: ZodNullable<ZodNumber>;
|
|
2678
|
+
contentType: ZodNullable<ZodString>;
|
|
2679
|
+
mediaType: ZodNullable<ZodString>;
|
|
2680
|
+
filename: ZodNullable<ZodString>;
|
|
2681
|
+
expiresAt: ZodNullable<ZodNumber>;
|
|
2682
|
+
metadata: ZodNullable<ZodString>;
|
|
2683
|
+
createdAt: ZodNumber;
|
|
2684
|
+
updatedAt: ZodNumber;
|
|
2685
|
+
}, $strip>;
|
|
2686
|
+
declare const assetInitResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
2687
|
+
status: ZodLiteral<"presigned">;
|
|
2688
|
+
data: ZodObject<{
|
|
2689
|
+
id: ZodString;
|
|
2690
|
+
url: ZodString;
|
|
2691
|
+
orgId: ZodString;
|
|
2692
|
+
createdBy: ZodNullable<ZodString>;
|
|
2693
|
+
lifecycle: ZodString;
|
|
2694
|
+
status: ZodString;
|
|
2695
|
+
source: ZodString;
|
|
2696
|
+
kind: ZodString;
|
|
2697
|
+
scope: ZodString;
|
|
2698
|
+
region: ZodString;
|
|
2699
|
+
etag: ZodNullable<ZodString>;
|
|
2700
|
+
checksum: ZodNullable<ZodString>;
|
|
2701
|
+
declaredSize: ZodNullable<ZodNumber>;
|
|
2702
|
+
sizeBytes: ZodNullable<ZodNumber>;
|
|
2703
|
+
contentType: ZodNullable<ZodString>;
|
|
2704
|
+
mediaType: ZodNullable<ZodString>;
|
|
2705
|
+
filename: ZodNullable<ZodString>;
|
|
2706
|
+
expiresAt: ZodNullable<ZodNumber>;
|
|
2707
|
+
metadata: ZodNullable<ZodString>;
|
|
2708
|
+
createdAt: ZodNumber;
|
|
2709
|
+
updatedAt: ZodNumber;
|
|
2710
|
+
}, $strip>;
|
|
2711
|
+
upload: ZodObject<{
|
|
2712
|
+
method: ZodLiteral<"PUT">;
|
|
2713
|
+
url: ZodString;
|
|
2714
|
+
expiresAt: ZodNumber;
|
|
2715
|
+
}, $strip>;
|
|
2716
|
+
}, $strip>, ZodObject<{
|
|
2717
|
+
status: ZodLiteral<"multipart">;
|
|
2718
|
+
data: ZodObject<{
|
|
2719
|
+
id: ZodString;
|
|
2720
|
+
url: ZodString;
|
|
2721
|
+
orgId: ZodString;
|
|
2722
|
+
createdBy: ZodNullable<ZodString>;
|
|
2723
|
+
lifecycle: ZodString;
|
|
2724
|
+
status: ZodString;
|
|
2725
|
+
source: ZodString;
|
|
2726
|
+
kind: ZodString;
|
|
2727
|
+
scope: ZodString;
|
|
2728
|
+
region: ZodString;
|
|
2729
|
+
etag: ZodNullable<ZodString>;
|
|
2730
|
+
checksum: ZodNullable<ZodString>;
|
|
2731
|
+
declaredSize: ZodNullable<ZodNumber>;
|
|
2732
|
+
sizeBytes: ZodNullable<ZodNumber>;
|
|
2733
|
+
contentType: ZodNullable<ZodString>;
|
|
2734
|
+
mediaType: ZodNullable<ZodString>;
|
|
2735
|
+
filename: ZodNullable<ZodString>;
|
|
2736
|
+
expiresAt: ZodNullable<ZodNumber>;
|
|
2737
|
+
metadata: ZodNullable<ZodString>;
|
|
2738
|
+
createdAt: ZodNumber;
|
|
2739
|
+
updatedAt: ZodNumber;
|
|
2740
|
+
}, $strip>;
|
|
2741
|
+
upload: ZodObject<{
|
|
2742
|
+
uploadId: ZodString;
|
|
2743
|
+
partSize: ZodNumber;
|
|
2744
|
+
parts: ZodArray<ZodObject<{
|
|
2745
|
+
partNumber: ZodNumber;
|
|
2746
|
+
url: ZodString;
|
|
2747
|
+
}, $strip>>;
|
|
2748
|
+
expiresAt: ZodNumber;
|
|
2749
|
+
}, $strip>;
|
|
2750
|
+
}, $strip>, ZodObject<{
|
|
2751
|
+
status: ZodLiteral<"deduplicated">;
|
|
2752
|
+
data: ZodObject<{
|
|
2753
|
+
id: ZodString;
|
|
2754
|
+
url: ZodString;
|
|
2755
|
+
orgId: ZodString;
|
|
2756
|
+
createdBy: ZodNullable<ZodString>;
|
|
2757
|
+
lifecycle: ZodString;
|
|
2758
|
+
status: ZodString;
|
|
2759
|
+
source: ZodString;
|
|
2760
|
+
kind: ZodString;
|
|
2761
|
+
scope: ZodString;
|
|
2762
|
+
region: ZodString;
|
|
2763
|
+
etag: ZodNullable<ZodString>;
|
|
2764
|
+
checksum: ZodNullable<ZodString>;
|
|
2765
|
+
declaredSize: ZodNullable<ZodNumber>;
|
|
2766
|
+
sizeBytes: ZodNullable<ZodNumber>;
|
|
2767
|
+
contentType: ZodNullable<ZodString>;
|
|
2768
|
+
mediaType: ZodNullable<ZodString>;
|
|
2769
|
+
filename: ZodNullable<ZodString>;
|
|
2770
|
+
expiresAt: ZodNullable<ZodNumber>;
|
|
2771
|
+
metadata: ZodNullable<ZodString>;
|
|
2772
|
+
createdAt: ZodNumber;
|
|
2773
|
+
updatedAt: ZodNumber;
|
|
2774
|
+
}, $strip>;
|
|
2775
|
+
}, $strip>], "status">;
|
|
2776
|
+
declare const assetDownloadResponseSchema: ZodObject<{
|
|
2777
|
+
url: ZodString;
|
|
2778
|
+
expiresAt: ZodNumber;
|
|
2779
|
+
}, $strip>;
|
|
2780
|
+
declare const assetListMetaSchema: ZodObject<{
|
|
2781
|
+
total: ZodNumber;
|
|
2782
|
+
limit: ZodNumber;
|
|
2783
|
+
offset: ZodNumber;
|
|
2784
|
+
}, $strip>;
|
|
2627
2785
|
type JobResponse = output<typeof jobResponseSchema>;
|
|
2628
2786
|
type JobStep = output<typeof jobStepSchema>;
|
|
2629
2787
|
type Output = output<typeof jobOutputSchema>;
|
|
@@ -2643,6 +2801,10 @@ type ApiKey = output<typeof apiKeySchema>;
|
|
|
2643
2801
|
type PaginationMeta = output<typeof paginationMetaSchema>;
|
|
2644
2802
|
type BillingInvoice = output<typeof billingInvoiceSchema>;
|
|
2645
2803
|
type PaymentMethod = output<typeof paymentMethodSchema>;
|
|
2804
|
+
type AssetResponse = output<typeof assetSchema>;
|
|
2805
|
+
type AssetInitResponse = output<typeof assetInitResponseSchema>;
|
|
2806
|
+
type AssetDownloadResponse = output<typeof assetDownloadResponseSchema>;
|
|
2807
|
+
type AssetListMeta = output<typeof assetListMetaSchema>;
|
|
2646
2808
|
//#endregion
|
|
2647
2809
|
//#region ../shared/src/events/org-events.d.ts
|
|
2648
2810
|
declare const orgEventSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
@@ -2907,10 +3069,7 @@ declare function createClient(config?: ClientConfig): {
|
|
|
2907
3069
|
}>;
|
|
2908
3070
|
};
|
|
2909
3071
|
uploads: {
|
|
2910
|
-
|
|
2911
|
-
filename?: string;
|
|
2912
|
-
signal?: AbortSignal;
|
|
2913
|
-
}): Promise<UploadResult>;
|
|
3072
|
+
create(file: Blob | BufferSource, options: CreateUploadOptions): Promise<AssetResponse>;
|
|
2914
3073
|
};
|
|
2915
3074
|
webhooks: {
|
|
2916
3075
|
create(params: CreateWebhookParams, options?: {
|
|
@@ -3018,12 +3177,26 @@ declare function createClient(config?: ClientConfig): {
|
|
|
3018
3177
|
}>;
|
|
3019
3178
|
};
|
|
3020
3179
|
assets: {
|
|
3180
|
+
list(params?: ListAssetsParams, options?: {
|
|
3181
|
+
signal?: AbortSignal;
|
|
3182
|
+
}): Promise<AssetListPage>;
|
|
3183
|
+
get(id: string, options?: {
|
|
3184
|
+
signal?: AbortSignal;
|
|
3185
|
+
}): Promise<AssetResponse>;
|
|
3186
|
+
delete(id: string, options?: {
|
|
3187
|
+
signal?: AbortSignal;
|
|
3188
|
+
}): Promise<{
|
|
3189
|
+
deleted: boolean;
|
|
3190
|
+
}>;
|
|
3191
|
+
download(id: string, options?: {
|
|
3192
|
+
signal?: AbortSignal;
|
|
3193
|
+
}): Promise<AssetDownloadResponse>;
|
|
3021
3194
|
templates(params?: {
|
|
3022
3195
|
category?: string;
|
|
3023
3196
|
limit?: number;
|
|
3024
3197
|
}, options?: {
|
|
3025
3198
|
signal?: AbortSignal;
|
|
3026
|
-
}): Promise<
|
|
3199
|
+
}): Promise<AssetListPage>;
|
|
3027
3200
|
};
|
|
3028
3201
|
team: {
|
|
3029
3202
|
invite(params: {
|
|
@@ -3225,26 +3398,32 @@ type BatchResult = {
|
|
|
3225
3398
|
};
|
|
3226
3399
|
//#endregion
|
|
3227
3400
|
//#region src/resources/uploads.d.ts
|
|
3228
|
-
type
|
|
3229
|
-
|
|
3401
|
+
type UploadProgress = {
|
|
3402
|
+
loaded: number;
|
|
3403
|
+
total: number;
|
|
3404
|
+
};
|
|
3405
|
+
type CreateUploadOptions = {
|
|
3406
|
+
/** Display filename, sent to the API and used in Content-Disposition. */filename: string; /** Byte size. Auto-derived from the Blob when omitted. */
|
|
3407
|
+
size?: number; /** MIME type hint. */
|
|
3408
|
+
contentType?: string; /** Client-declared sha256, enables server-side dedup. */
|
|
3409
|
+
checksum?: string; /** true → 'persisted' lifecycle; default is ephemeral (24h TTL). */
|
|
3410
|
+
persist?: boolean; /** Parallel multipart part uploads. Default: 5. */
|
|
3411
|
+
concurrency?: number; /** Called as bytes finish uploading. */
|
|
3412
|
+
onProgress?: (p: UploadProgress) => void;
|
|
3413
|
+
signal?: AbortSignal;
|
|
3230
3414
|
};
|
|
3231
3415
|
//#endregion
|
|
3232
3416
|
//#region src/resources/assets.d.ts
|
|
3233
|
-
type
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
status: string;
|
|
3244
|
-
category: string | null;
|
|
3245
|
-
thumbnailKey: string | null;
|
|
3246
|
-
createdAt: number;
|
|
3247
|
-
updatedAt: number;
|
|
3417
|
+
type ListAssetsParams = {
|
|
3418
|
+
lifecycle?: "ephemeral" | "persisted";
|
|
3419
|
+
status?: "pending" | "uploading" | "ready" | "failed" | "expired";
|
|
3420
|
+
kind?: string;
|
|
3421
|
+
limit?: number;
|
|
3422
|
+
offset?: number;
|
|
3423
|
+
};
|
|
3424
|
+
type AssetListPage = {
|
|
3425
|
+
data: AssetResponse[];
|
|
3426
|
+
meta: AssetListMeta;
|
|
3248
3427
|
};
|
|
3249
3428
|
//#endregion
|
|
3250
|
-
export { ApiError, type ApiKey, type Asset, type BatchResult, type BillingInvoice, type BillingState, type ClientConfig, type Cost, type CreateJobParams, type CreateWebhookParams, type FfmpegParams, type FileType, type JobResponse as Job, type JobCreatedResponse, type JobError, type JobListPage, type JobStep, type JobSubscribeOptions, type JobSubscription, type JobTimings, type JobType, type ListDeliveriesParams, type ListJobsParams, type LogEntryData, type OrgCurrentResponse, type OrgEvent, type Organization, type Output, type OutputFile, type PaginationMeta, type PaymentMethod, type RealtimeConnectOptions, type RealtimeConnection, type RendobarClient, type Transaction, type TransactionListParams, type UpdateWebhookParams, type
|
|
3429
|
+
export { ApiError, type ApiKey, type AssetResponse as Asset, type AssetDownloadResponse, type AssetInitResponse, type AssetListMeta, type AssetListPage, type BatchResult, type BillingInvoice, type BillingState, type ClientConfig, type Cost, type CreateJobParams, type CreateUploadOptions, type CreateWebhookParams, type FfmpegParams, type FileType, type JobResponse as Job, type JobCreatedResponse, type JobError, type JobListPage, type JobStep, type JobSubscribeOptions, type JobSubscription, type JobTimings, type JobType, type ListAssetsParams, type ListDeliveriesParams, type ListJobsParams, type LogEntryData, type OrgCurrentResponse, type OrgEvent, type Organization, type Output, type OutputFile, type PaginationMeta, type PaymentMethod, type RealtimeConnectOptions, type RealtimeConnection, type RendobarClient, type Transaction, type TransactionListParams, type UpdateWebhookParams, type UploadProgress, type UsageParams, type UsageSummary, type WaitOptions, type WebhookDelivery, type WebhookEndpoint, createClient, isApiError, jobData, outputUrl };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema.d.cts
|
|
2
2
|
type _JSONSchema = boolean | JSONSchema;
|
|
3
3
|
type JSONSchema = {
|
|
4
4
|
[k: string]: unknown;
|
|
@@ -66,7 +66,7 @@ type JSONSchema = {
|
|
|
66
66
|
};
|
|
67
67
|
type BaseSchema = JSONSchema;
|
|
68
68
|
//#endregion
|
|
69
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
69
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/standard-schema.d.cts
|
|
70
70
|
/** The Standard interface. */
|
|
71
71
|
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
72
72
|
/** The Standard properties. */
|
|
@@ -185,7 +185,7 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
185
185
|
}
|
|
186
186
|
interface StandardSchemaWithJSONProps<Input = unknown, Output = Input> extends StandardSchemaV1.Props<Input, Output>, StandardJSONSchemaV1.Props<Input, Output> {}
|
|
187
187
|
//#endregion
|
|
188
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
188
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.d.cts
|
|
189
189
|
declare const $output: unique symbol;
|
|
190
190
|
type $output = typeof $output;
|
|
191
191
|
declare const $input: unique symbol;
|
|
@@ -212,7 +212,7 @@ interface JSONSchemaMeta {
|
|
|
212
212
|
}
|
|
213
213
|
interface GlobalMeta extends JSONSchemaMeta {}
|
|
214
214
|
//#endregion
|
|
215
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
215
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.d.cts
|
|
216
216
|
type Processor<T extends $ZodType = $ZodType> = (schema: T, ctx: ToJSONSchemaContext, json: BaseSchema, params: ProcessParams) => void;
|
|
217
217
|
interface JSONSchemaGeneratorParams {
|
|
218
218
|
processors: Record<string, Processor>;
|
|
@@ -301,7 +301,7 @@ interface ZodStandardJSONSchemaPayload<T> extends BaseSchema {
|
|
|
301
301
|
"~standard": ZodStandardSchemaWithJSON$1<T>;
|
|
302
302
|
}
|
|
303
303
|
//#endregion
|
|
304
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
304
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.d.cts
|
|
305
305
|
type JWTAlgorithm = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "EdDSA" | (string & {});
|
|
306
306
|
type MimeTypes = "application/json" | "application/xml" | "application/x-www-form-urlencoded" | "application/javascript" | "application/pdf" | "application/zip" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/octet-stream" | "application/graphql" | "text/html" | "text/plain" | "text/css" | "text/javascript" | "text/csv" | "image/png" | "image/jpeg" | "image/gif" | "image/svg+xml" | "image/webp" | "audio/mpeg" | "audio/ogg" | "audio/wav" | "audio/webm" | "video/mp4" | "video/webm" | "video/ogg" | "font/woff" | "font/woff2" | "font/ttf" | "font/otf" | "multipart/form-data" | (string & {});
|
|
307
307
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
@@ -312,6 +312,7 @@ type LoosePartial<T extends object> = InexactPartial<T> & {
|
|
|
312
312
|
[k: string]: unknown;
|
|
313
313
|
};
|
|
314
314
|
type Mask<Keys extends PropertyKey> = { [K in Keys]?: true };
|
|
315
|
+
type Writeable<T> = { -readonly [P in keyof T]: T[P] } & {};
|
|
315
316
|
type InexactPartial<T> = { [P in keyof T]?: T[P] | undefined };
|
|
316
317
|
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
317
318
|
readonly [Symbol.toStringTag]: string;
|
|
@@ -341,14 +342,14 @@ declare abstract class Class {
|
|
|
341
342
|
constructor(..._args: any[]);
|
|
342
343
|
}
|
|
343
344
|
//#endregion
|
|
344
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
345
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.d.cts
|
|
345
346
|
declare const version: {
|
|
346
347
|
readonly major: 4;
|
|
347
|
-
readonly minor:
|
|
348
|
+
readonly minor: 4;
|
|
348
349
|
readonly patch: number;
|
|
349
350
|
};
|
|
350
351
|
//#endregion
|
|
351
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
352
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.d.cts
|
|
352
353
|
interface ParseContext<T extends $ZodIssueBase = never> {
|
|
353
354
|
/** Customize error messages. */
|
|
354
355
|
readonly error?: $ZodErrorMap<T>;
|
|
@@ -366,8 +367,13 @@ interface ParseContextInternal<T extends $ZodIssueBase = never> extends ParseCon
|
|
|
366
367
|
interface ParsePayload<T = unknown> {
|
|
367
368
|
value: T;
|
|
368
369
|
issues: $ZodRawIssue[];
|
|
369
|
-
/** A
|
|
370
|
+
/** A way to mark a whole payload as aborted. Used in codecs/pipes. */
|
|
370
371
|
aborted?: boolean;
|
|
372
|
+
/** @internal Marks a value as a fallback that an outer wrapper (e.g.
|
|
373
|
+
* $ZodOptional) may override with its own interpretation when input was
|
|
374
|
+
* undefined. Set by $ZodCatch when catchValue substitutes and by every
|
|
375
|
+
* $ZodTransform invocation. */
|
|
376
|
+
fallback?: boolean | undefined;
|
|
371
377
|
}
|
|
372
378
|
type CheckFn<T> = (input: ParsePayload<T>) => MaybeAsync<void>;
|
|
373
379
|
interface $ZodTypeDef {
|
|
@@ -509,10 +515,25 @@ interface $ZodNanoID extends $ZodType {
|
|
|
509
515
|
_zod: $ZodNanoIDInternals;
|
|
510
516
|
}
|
|
511
517
|
declare const $ZodNanoID: $constructor<$ZodNanoID>;
|
|
518
|
+
/**
|
|
519
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
520
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
521
|
+
* See https://github.com/paralleldrive/cuid.
|
|
522
|
+
*/
|
|
512
523
|
interface $ZodCUIDInternals extends $ZodStringFormatInternals<"cuid"> {}
|
|
524
|
+
/**
|
|
525
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
526
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
527
|
+
* See https://github.com/paralleldrive/cuid.
|
|
528
|
+
*/
|
|
513
529
|
interface $ZodCUID extends $ZodType {
|
|
514
530
|
_zod: $ZodCUIDInternals;
|
|
515
531
|
}
|
|
532
|
+
/**
|
|
533
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
534
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
535
|
+
* See https://github.com/paralleldrive/cuid.
|
|
536
|
+
*/
|
|
516
537
|
declare const $ZodCUID: $constructor<$ZodCUID>;
|
|
517
538
|
interface $ZodCUID2Internals extends $ZodStringFormatInternals<"cuid2"> {}
|
|
518
539
|
interface $ZodCUID2 extends $ZodType {
|
|
@@ -1327,13 +1348,13 @@ interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
|
|
|
1327
1348
|
declare const $ZodCustom: $constructor<$ZodCustom>;
|
|
1328
1349
|
type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
|
|
1329
1350
|
//#endregion
|
|
1330
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1351
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.d.cts
|
|
1331
1352
|
interface $ZodCheckDef {
|
|
1332
1353
|
check: string;
|
|
1333
1354
|
error?: $ZodErrorMap<never> | undefined;
|
|
1334
1355
|
/** If true, no later checks will be executed if this check fails. Default `false`. */
|
|
1335
1356
|
abort?: boolean | undefined;
|
|
1336
|
-
/** If provided,
|
|
1357
|
+
/** If provided, the check runs only when this returns `true`. By default, it is skipped if prior parsing produced aborting issues. */
|
|
1337
1358
|
when?: ((payload: ParsePayload) => boolean) | undefined;
|
|
1338
1359
|
}
|
|
1339
1360
|
interface $ZodCheckInternals<T> {
|
|
@@ -1509,7 +1530,7 @@ interface $ZodCheckEndsWith extends $ZodCheckInternals<string> {
|
|
|
1509
1530
|
}
|
|
1510
1531
|
declare const $ZodCheckEndsWith: $constructor<$ZodCheckEndsWith>;
|
|
1511
1532
|
//#endregion
|
|
1512
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1533
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.d.cts
|
|
1513
1534
|
interface $ZodIssueBase {
|
|
1514
1535
|
readonly code?: string;
|
|
1515
1536
|
readonly input?: unknown;
|
|
@@ -1561,6 +1582,7 @@ interface $ZodIssueInvalidUnionNoMatch extends $ZodIssueBase {
|
|
|
1561
1582
|
readonly errors: $ZodIssue[][];
|
|
1562
1583
|
readonly input?: unknown;
|
|
1563
1584
|
readonly discriminator?: string | undefined;
|
|
1585
|
+
readonly options?: Primitive[];
|
|
1564
1586
|
readonly inclusive?: true;
|
|
1565
1587
|
}
|
|
1566
1588
|
interface $ZodIssueInvalidUnionMultipleMatch extends $ZodIssueBase {
|
|
@@ -1630,7 +1652,7 @@ type $ZodFormattedError<T, U = string> = {
|
|
|
1630
1652
|
_errors: U[];
|
|
1631
1653
|
} & Flatten<_ZodFormattedError<T, U>>;
|
|
1632
1654
|
//#endregion
|
|
1633
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1655
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.d.cts
|
|
1634
1656
|
type ZodTrait = {
|
|
1635
1657
|
_zod: {
|
|
1636
1658
|
def: any;
|
|
@@ -1673,7 +1695,7 @@ type output<T> = T extends {
|
|
|
1673
1695
|
};
|
|
1674
1696
|
} ? T["_zod"]["output"] : unknown;
|
|
1675
1697
|
//#endregion
|
|
1676
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1698
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.d.cts
|
|
1677
1699
|
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] ? {} : {
|
|
1678
1700
|
error?: string | $ZodErrorMap<IssueTypes> | undefined; /** @deprecated This parameter is deprecated. Use `error` instead. */
|
|
1679
1701
|
message?: string | undefined;
|
|
@@ -1691,6 +1713,11 @@ type $ZodCheckUUIDParams = CheckStringFormatParams<$ZodUUID, "pattern" | "when">
|
|
|
1691
1713
|
type $ZodCheckURLParams = CheckStringFormatParams<$ZodURL, "when">;
|
|
1692
1714
|
type $ZodCheckEmojiParams = CheckStringFormatParams<$ZodEmoji, "when">;
|
|
1693
1715
|
type $ZodCheckNanoIDParams = CheckStringFormatParams<$ZodNanoID, "when">;
|
|
1716
|
+
/**
|
|
1717
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
1718
|
+
* (timestamps embedded in the id). Use {@link _cuid2} instead.
|
|
1719
|
+
* See https://github.com/paralleldrive/cuid.
|
|
1720
|
+
*/
|
|
1694
1721
|
type $ZodCheckCUIDParams = CheckStringFormatParams<$ZodCUID, "when">;
|
|
1695
1722
|
type $ZodCheckCUID2Params = CheckStringFormatParams<$ZodCUID2, "when">;
|
|
1696
1723
|
type $ZodCheckULIDParams = CheckStringFormatParams<$ZodULID, "when">;
|
|
@@ -1732,8 +1759,12 @@ type RawIssue<T extends $ZodIssueBase> = T extends any ? Flatten<MakePartial<T,
|
|
|
1732
1759
|
interface $RefinementCtx<T = unknown> extends ParsePayload<T> {
|
|
1733
1760
|
addIssue(arg: string | $ZodSuperRefineIssue): void;
|
|
1734
1761
|
}
|
|
1762
|
+
interface $ZodSuperRefineParams {
|
|
1763
|
+
/** If provided, the refinement runs only when this returns `true`. By default, it is skipped if prior parsing produced aborting issues. */
|
|
1764
|
+
when?: ((payload: ParsePayload) => boolean) | undefined;
|
|
1765
|
+
}
|
|
1735
1766
|
//#endregion
|
|
1736
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1767
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.d.cts
|
|
1737
1768
|
/** An Error-like class used to store Zod validation issues. */
|
|
1738
1769
|
interface ZodError<T = unknown> extends $ZodError<T> {
|
|
1739
1770
|
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
@@ -1751,7 +1782,7 @@ interface ZodError<T = unknown> extends $ZodError<T> {
|
|
|
1751
1782
|
}
|
|
1752
1783
|
declare const ZodError: $constructor<ZodError>;
|
|
1753
1784
|
//#endregion
|
|
1754
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1785
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.d.cts
|
|
1755
1786
|
type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
|
|
1756
1787
|
type ZodSafeParseSuccess<T> = {
|
|
1757
1788
|
success: true;
|
|
@@ -1764,7 +1795,7 @@ type ZodSafeParseError<T> = {
|
|
|
1764
1795
|
error: ZodError<T>;
|
|
1765
1796
|
};
|
|
1766
1797
|
//#endregion
|
|
1767
|
-
//#region ../../node_modules/.pnpm/zod@4.3
|
|
1798
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.d.cts
|
|
1768
1799
|
type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<input<T>, output<T>>;
|
|
1769
1800
|
interface ZodType<out Output = unknown, out Input = unknown, out Internals extends $ZodTypeInternals<Output, Input> = $ZodTypeInternals<Output, Input>> extends $ZodType<Output, Input, Internals> {
|
|
1770
1801
|
def: Internals["def"];
|
|
@@ -1799,7 +1830,7 @@ interface ZodType<out Output = unknown, out Input = unknown, out Internals exten
|
|
|
1799
1830
|
safeEncodeAsync(data: output<this>, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<input<this>>>;
|
|
1800
1831
|
safeDecodeAsync(data: input<this>, params?: ParseContext<$ZodIssue>): Promise<ZodSafeParseResult<output<this>>>;
|
|
1801
1832
|
refine<Ch extends (arg: output<this>) => unknown | Promise<unknown>>(check: Ch, params?: string | $ZodCustomParams): Ch extends ((arg: any) => arg is infer R) ? this & ZodType<R, input<this>> : this;
|
|
1802
|
-
superRefine(refinement: (arg: output<this>, ctx: $RefinementCtx<output<this>>) => void | Promise<void
|
|
1833
|
+
superRefine(refinement: (arg: output<this>, ctx: $RefinementCtx<output<this>>) => void | Promise<void>, params?: $ZodSuperRefineParams): this;
|
|
1803
1834
|
overwrite(fn: (x: output<this>) => output<this>): this;
|
|
1804
1835
|
optional(): ZodOptional<this>;
|
|
1805
1836
|
exactOptional(): ZodExactOptional<this>;
|
|
@@ -1891,7 +1922,11 @@ interface ZodString extends _ZodString<$ZodStringInternals<string>> {
|
|
|
1891
1922
|
nanoid(params?: string | $ZodCheckNanoIDParams): this;
|
|
1892
1923
|
/** @deprecated Use `z.guid()` instead. */
|
|
1893
1924
|
guid(params?: string | $ZodCheckGUIDParams): this;
|
|
1894
|
-
/**
|
|
1925
|
+
/**
|
|
1926
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
1927
|
+
* (timestamps embedded in the id). Use `z.cuid2()` instead.
|
|
1928
|
+
* See https://github.com/paralleldrive/cuid.
|
|
1929
|
+
*/
|
|
1895
1930
|
cuid(params?: string | $ZodCheckCUIDParams): this;
|
|
1896
1931
|
/** @deprecated Use `z.cuid2()` instead. */
|
|
1897
1932
|
cuid2(params?: string | $ZodCheckCUID2Params): this;
|
|
@@ -1987,18 +2022,18 @@ interface ZodObject< /** @ts-ignore Cast variance */out Shape extends $ZodShape
|
|
|
1987
2022
|
strict(): ZodObject<Shape, $strict>;
|
|
1988
2023
|
/** This is the default behavior. This method call is likely unnecessary. */
|
|
1989
2024
|
strip(): ZodObject<Shape, $strip>;
|
|
1990
|
-
extend<U extends $ZodLooseShape>(shape: U): ZodObject<Extend<Shape, U
|
|
1991
|
-
safeExtend<U extends $ZodLooseShape>(shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, SomeType>>): ZodObject<Extend<Shape, U
|
|
2025
|
+
extend<U extends $ZodLooseShape>(shape: U): ZodObject<Extend<Shape, Writeable<U>>, Config>;
|
|
2026
|
+
safeExtend<U extends $ZodLooseShape>(shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, SomeType>>): ZodObject<Extend<Shape, Writeable<U>>, Config>;
|
|
1992
2027
|
/**
|
|
1993
2028
|
* @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
|
|
1994
2029
|
*/
|
|
1995
2030
|
merge<U extends ZodObject>(other: U): ZodObject<Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
|
|
1996
2031
|
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>;
|
|
1997
2032
|
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>;
|
|
1998
|
-
partial(): ZodObject<{ [k in keyof Shape]: ZodOptional<Shape[k]> }, Config>;
|
|
1999
|
-
partial<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ [k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k]> : Shape[k] }, Config>;
|
|
2000
|
-
required(): ZodObject<{ [k in keyof Shape]: ZodNonOptional<Shape[k]> }, Config>;
|
|
2001
|
-
required<M extends Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): ZodObject<{ [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k] }, Config>;
|
|
2033
|
+
partial(): ZodObject<{ -readonly [k in keyof Shape]: ZodOptional<Shape[k]> }, Config>;
|
|
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]> }, Config>;
|
|
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>;
|
|
2002
2037
|
}
|
|
2003
2038
|
declare const ZodObject: $constructor<ZodObject>;
|
|
2004
2039
|
interface ZodUnion<T extends readonly SomeType[] = readonly $ZodType[]> extends _ZodType<$ZodUnionInternals<T>>, $ZodUnion<T> {
|
|
@@ -2540,6 +2575,7 @@ declare const transactionSchema: ZodObject<{
|
|
|
2540
2575
|
paidAmount: ZodNumber;
|
|
2541
2576
|
bonusAmount: ZodNumber;
|
|
2542
2577
|
jobId: ZodNullable<ZodString>;
|
|
2578
|
+
jobType: ZodNullable<ZodString>;
|
|
2543
2579
|
balanceAfter: ZodNumber;
|
|
2544
2580
|
createdAt: ZodNumber;
|
|
2545
2581
|
}, $strip>;
|
|
@@ -2624,6 +2660,128 @@ declare const paymentMethodSchema: ZodObject<{
|
|
|
2624
2660
|
wallet: ZodOptional<ZodNullable<ZodString>>;
|
|
2625
2661
|
isDefault: ZodBoolean;
|
|
2626
2662
|
}, $strip>;
|
|
2663
|
+
declare const assetSchema: ZodObject<{
|
|
2664
|
+
id: ZodString;
|
|
2665
|
+
url: ZodString;
|
|
2666
|
+
orgId: ZodString;
|
|
2667
|
+
createdBy: ZodNullable<ZodString>;
|
|
2668
|
+
lifecycle: ZodString;
|
|
2669
|
+
status: ZodString;
|
|
2670
|
+
source: ZodString;
|
|
2671
|
+
kind: ZodString;
|
|
2672
|
+
scope: ZodString;
|
|
2673
|
+
region: ZodString;
|
|
2674
|
+
etag: ZodNullable<ZodString>;
|
|
2675
|
+
checksum: ZodNullable<ZodString>;
|
|
2676
|
+
declaredSize: ZodNullable<ZodNumber>;
|
|
2677
|
+
sizeBytes: ZodNullable<ZodNumber>;
|
|
2678
|
+
contentType: ZodNullable<ZodString>;
|
|
2679
|
+
mediaType: ZodNullable<ZodString>;
|
|
2680
|
+
filename: ZodNullable<ZodString>;
|
|
2681
|
+
expiresAt: ZodNullable<ZodNumber>;
|
|
2682
|
+
metadata: ZodNullable<ZodString>;
|
|
2683
|
+
createdAt: ZodNumber;
|
|
2684
|
+
updatedAt: ZodNumber;
|
|
2685
|
+
}, $strip>;
|
|
2686
|
+
declare const assetInitResponseSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
2687
|
+
status: ZodLiteral<"presigned">;
|
|
2688
|
+
data: ZodObject<{
|
|
2689
|
+
id: ZodString;
|
|
2690
|
+
url: ZodString;
|
|
2691
|
+
orgId: ZodString;
|
|
2692
|
+
createdBy: ZodNullable<ZodString>;
|
|
2693
|
+
lifecycle: ZodString;
|
|
2694
|
+
status: ZodString;
|
|
2695
|
+
source: ZodString;
|
|
2696
|
+
kind: ZodString;
|
|
2697
|
+
scope: ZodString;
|
|
2698
|
+
region: ZodString;
|
|
2699
|
+
etag: ZodNullable<ZodString>;
|
|
2700
|
+
checksum: ZodNullable<ZodString>;
|
|
2701
|
+
declaredSize: ZodNullable<ZodNumber>;
|
|
2702
|
+
sizeBytes: ZodNullable<ZodNumber>;
|
|
2703
|
+
contentType: ZodNullable<ZodString>;
|
|
2704
|
+
mediaType: ZodNullable<ZodString>;
|
|
2705
|
+
filename: ZodNullable<ZodString>;
|
|
2706
|
+
expiresAt: ZodNullable<ZodNumber>;
|
|
2707
|
+
metadata: ZodNullable<ZodString>;
|
|
2708
|
+
createdAt: ZodNumber;
|
|
2709
|
+
updatedAt: ZodNumber;
|
|
2710
|
+
}, $strip>;
|
|
2711
|
+
upload: ZodObject<{
|
|
2712
|
+
method: ZodLiteral<"PUT">;
|
|
2713
|
+
url: ZodString;
|
|
2714
|
+
expiresAt: ZodNumber;
|
|
2715
|
+
}, $strip>;
|
|
2716
|
+
}, $strip>, ZodObject<{
|
|
2717
|
+
status: ZodLiteral<"multipart">;
|
|
2718
|
+
data: ZodObject<{
|
|
2719
|
+
id: ZodString;
|
|
2720
|
+
url: ZodString;
|
|
2721
|
+
orgId: ZodString;
|
|
2722
|
+
createdBy: ZodNullable<ZodString>;
|
|
2723
|
+
lifecycle: ZodString;
|
|
2724
|
+
status: ZodString;
|
|
2725
|
+
source: ZodString;
|
|
2726
|
+
kind: ZodString;
|
|
2727
|
+
scope: ZodString;
|
|
2728
|
+
region: ZodString;
|
|
2729
|
+
etag: ZodNullable<ZodString>;
|
|
2730
|
+
checksum: ZodNullable<ZodString>;
|
|
2731
|
+
declaredSize: ZodNullable<ZodNumber>;
|
|
2732
|
+
sizeBytes: ZodNullable<ZodNumber>;
|
|
2733
|
+
contentType: ZodNullable<ZodString>;
|
|
2734
|
+
mediaType: ZodNullable<ZodString>;
|
|
2735
|
+
filename: ZodNullable<ZodString>;
|
|
2736
|
+
expiresAt: ZodNullable<ZodNumber>;
|
|
2737
|
+
metadata: ZodNullable<ZodString>;
|
|
2738
|
+
createdAt: ZodNumber;
|
|
2739
|
+
updatedAt: ZodNumber;
|
|
2740
|
+
}, $strip>;
|
|
2741
|
+
upload: ZodObject<{
|
|
2742
|
+
uploadId: ZodString;
|
|
2743
|
+
partSize: ZodNumber;
|
|
2744
|
+
parts: ZodArray<ZodObject<{
|
|
2745
|
+
partNumber: ZodNumber;
|
|
2746
|
+
url: ZodString;
|
|
2747
|
+
}, $strip>>;
|
|
2748
|
+
expiresAt: ZodNumber;
|
|
2749
|
+
}, $strip>;
|
|
2750
|
+
}, $strip>, ZodObject<{
|
|
2751
|
+
status: ZodLiteral<"deduplicated">;
|
|
2752
|
+
data: ZodObject<{
|
|
2753
|
+
id: ZodString;
|
|
2754
|
+
url: ZodString;
|
|
2755
|
+
orgId: ZodString;
|
|
2756
|
+
createdBy: ZodNullable<ZodString>;
|
|
2757
|
+
lifecycle: ZodString;
|
|
2758
|
+
status: ZodString;
|
|
2759
|
+
source: ZodString;
|
|
2760
|
+
kind: ZodString;
|
|
2761
|
+
scope: ZodString;
|
|
2762
|
+
region: ZodString;
|
|
2763
|
+
etag: ZodNullable<ZodString>;
|
|
2764
|
+
checksum: ZodNullable<ZodString>;
|
|
2765
|
+
declaredSize: ZodNullable<ZodNumber>;
|
|
2766
|
+
sizeBytes: ZodNullable<ZodNumber>;
|
|
2767
|
+
contentType: ZodNullable<ZodString>;
|
|
2768
|
+
mediaType: ZodNullable<ZodString>;
|
|
2769
|
+
filename: ZodNullable<ZodString>;
|
|
2770
|
+
expiresAt: ZodNullable<ZodNumber>;
|
|
2771
|
+
metadata: ZodNullable<ZodString>;
|
|
2772
|
+
createdAt: ZodNumber;
|
|
2773
|
+
updatedAt: ZodNumber;
|
|
2774
|
+
}, $strip>;
|
|
2775
|
+
}, $strip>], "status">;
|
|
2776
|
+
declare const assetDownloadResponseSchema: ZodObject<{
|
|
2777
|
+
url: ZodString;
|
|
2778
|
+
expiresAt: ZodNumber;
|
|
2779
|
+
}, $strip>;
|
|
2780
|
+
declare const assetListMetaSchema: ZodObject<{
|
|
2781
|
+
total: ZodNumber;
|
|
2782
|
+
limit: ZodNumber;
|
|
2783
|
+
offset: ZodNumber;
|
|
2784
|
+
}, $strip>;
|
|
2627
2785
|
type JobResponse = output<typeof jobResponseSchema>;
|
|
2628
2786
|
type JobStep = output<typeof jobStepSchema>;
|
|
2629
2787
|
type Output = output<typeof jobOutputSchema>;
|
|
@@ -2643,6 +2801,10 @@ type ApiKey = output<typeof apiKeySchema>;
|
|
|
2643
2801
|
type PaginationMeta = output<typeof paginationMetaSchema>;
|
|
2644
2802
|
type BillingInvoice = output<typeof billingInvoiceSchema>;
|
|
2645
2803
|
type PaymentMethod = output<typeof paymentMethodSchema>;
|
|
2804
|
+
type AssetResponse = output<typeof assetSchema>;
|
|
2805
|
+
type AssetInitResponse = output<typeof assetInitResponseSchema>;
|
|
2806
|
+
type AssetDownloadResponse = output<typeof assetDownloadResponseSchema>;
|
|
2807
|
+
type AssetListMeta = output<typeof assetListMetaSchema>;
|
|
2646
2808
|
//#endregion
|
|
2647
2809
|
//#region ../shared/src/events/org-events.d.ts
|
|
2648
2810
|
declare const orgEventSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
@@ -2907,10 +3069,7 @@ declare function createClient(config?: ClientConfig): {
|
|
|
2907
3069
|
}>;
|
|
2908
3070
|
};
|
|
2909
3071
|
uploads: {
|
|
2910
|
-
|
|
2911
|
-
filename?: string;
|
|
2912
|
-
signal?: AbortSignal;
|
|
2913
|
-
}): Promise<UploadResult>;
|
|
3072
|
+
create(file: Blob | BufferSource, options: CreateUploadOptions): Promise<AssetResponse>;
|
|
2914
3073
|
};
|
|
2915
3074
|
webhooks: {
|
|
2916
3075
|
create(params: CreateWebhookParams, options?: {
|
|
@@ -3018,12 +3177,26 @@ declare function createClient(config?: ClientConfig): {
|
|
|
3018
3177
|
}>;
|
|
3019
3178
|
};
|
|
3020
3179
|
assets: {
|
|
3180
|
+
list(params?: ListAssetsParams, options?: {
|
|
3181
|
+
signal?: AbortSignal;
|
|
3182
|
+
}): Promise<AssetListPage>;
|
|
3183
|
+
get(id: string, options?: {
|
|
3184
|
+
signal?: AbortSignal;
|
|
3185
|
+
}): Promise<AssetResponse>;
|
|
3186
|
+
delete(id: string, options?: {
|
|
3187
|
+
signal?: AbortSignal;
|
|
3188
|
+
}): Promise<{
|
|
3189
|
+
deleted: boolean;
|
|
3190
|
+
}>;
|
|
3191
|
+
download(id: string, options?: {
|
|
3192
|
+
signal?: AbortSignal;
|
|
3193
|
+
}): Promise<AssetDownloadResponse>;
|
|
3021
3194
|
templates(params?: {
|
|
3022
3195
|
category?: string;
|
|
3023
3196
|
limit?: number;
|
|
3024
3197
|
}, options?: {
|
|
3025
3198
|
signal?: AbortSignal;
|
|
3026
|
-
}): Promise<
|
|
3199
|
+
}): Promise<AssetListPage>;
|
|
3027
3200
|
};
|
|
3028
3201
|
team: {
|
|
3029
3202
|
invite(params: {
|
|
@@ -3225,26 +3398,32 @@ type BatchResult = {
|
|
|
3225
3398
|
};
|
|
3226
3399
|
//#endregion
|
|
3227
3400
|
//#region src/resources/uploads.d.ts
|
|
3228
|
-
type
|
|
3229
|
-
|
|
3401
|
+
type UploadProgress = {
|
|
3402
|
+
loaded: number;
|
|
3403
|
+
total: number;
|
|
3404
|
+
};
|
|
3405
|
+
type CreateUploadOptions = {
|
|
3406
|
+
/** Display filename, sent to the API and used in Content-Disposition. */filename: string; /** Byte size. Auto-derived from the Blob when omitted. */
|
|
3407
|
+
size?: number; /** MIME type hint. */
|
|
3408
|
+
contentType?: string; /** Client-declared sha256, enables server-side dedup. */
|
|
3409
|
+
checksum?: string; /** true → 'persisted' lifecycle; default is ephemeral (24h TTL). */
|
|
3410
|
+
persist?: boolean; /** Parallel multipart part uploads. Default: 5. */
|
|
3411
|
+
concurrency?: number; /** Called as bytes finish uploading. */
|
|
3412
|
+
onProgress?: (p: UploadProgress) => void;
|
|
3413
|
+
signal?: AbortSignal;
|
|
3230
3414
|
};
|
|
3231
3415
|
//#endregion
|
|
3232
3416
|
//#region src/resources/assets.d.ts
|
|
3233
|
-
type
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
status: string;
|
|
3244
|
-
category: string | null;
|
|
3245
|
-
thumbnailKey: string | null;
|
|
3246
|
-
createdAt: number;
|
|
3247
|
-
updatedAt: number;
|
|
3417
|
+
type ListAssetsParams = {
|
|
3418
|
+
lifecycle?: "ephemeral" | "persisted";
|
|
3419
|
+
status?: "pending" | "uploading" | "ready" | "failed" | "expired";
|
|
3420
|
+
kind?: string;
|
|
3421
|
+
limit?: number;
|
|
3422
|
+
offset?: number;
|
|
3423
|
+
};
|
|
3424
|
+
type AssetListPage = {
|
|
3425
|
+
data: AssetResponse[];
|
|
3426
|
+
meta: AssetListMeta;
|
|
3248
3427
|
};
|
|
3249
3428
|
//#endregion
|
|
3250
|
-
export { ApiError, type ApiKey, type Asset, type BatchResult, type BillingInvoice, type BillingState, type ClientConfig, type Cost, type CreateJobParams, type CreateWebhookParams, type FfmpegParams, type FileType, type JobResponse as Job, type JobCreatedResponse, type JobError, type JobListPage, type JobStep, type JobSubscribeOptions, type JobSubscription, type JobTimings, type JobType, type ListDeliveriesParams, type ListJobsParams, type LogEntryData, type OrgCurrentResponse, type OrgEvent, type Organization, type Output, type OutputFile, type PaginationMeta, type PaymentMethod, type RealtimeConnectOptions, type RealtimeConnection, type RendobarClient, type Transaction, type TransactionListParams, type UpdateWebhookParams, type
|
|
3429
|
+
export { ApiError, type ApiKey, type AssetResponse as Asset, type AssetDownloadResponse, type AssetInitResponse, type AssetListMeta, type AssetListPage, type BatchResult, type BillingInvoice, type BillingState, type ClientConfig, type Cost, type CreateJobParams, type CreateUploadOptions, type CreateWebhookParams, type FfmpegParams, type FileType, type JobResponse as Job, type JobCreatedResponse, type JobError, type JobListPage, type JobStep, type JobSubscribeOptions, type JobSubscription, type JobTimings, type JobType, type ListAssetsParams, type ListDeliveriesParams, type ListJobsParams, type LogEntryData, type OrgCurrentResponse, type OrgEvent, type Organization, type Output, type OutputFile, type PaginationMeta, type PaymentMethod, type RealtimeConnectOptions, type RealtimeConnection, type RendobarClient, type Transaction, type TransactionListParams, type UpdateWebhookParams, type UploadProgress, type UsageParams, type UsageSummary, type WaitOptions, type WebhookDelivery, type WebhookEndpoint, createClient, isApiError, jobData, outputUrl };
|
package/dist/index.mjs
CHANGED
|
@@ -302,13 +302,130 @@ function createBillingResource(request) {
|
|
|
302
302
|
}
|
|
303
303
|
//#endregion
|
|
304
304
|
//#region src/resources/uploads.ts
|
|
305
|
+
function toBlob(file) {
|
|
306
|
+
return file instanceof Blob ? file : new Blob([file]);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* PUT a body to a presigned R2 url with bounded retry.
|
|
310
|
+
*
|
|
311
|
+
* Returns the ETag string when the bucket exposes it, or `null` when the
|
|
312
|
+
* response header is absent (e.g. bucket CORS not exposing ETag). Only
|
|
313
|
+
* network/HTTP failures trigger retries; a missing ETag is not retried because
|
|
314
|
+
* it is a deterministic misconfiguration, not a transient error.
|
|
315
|
+
*/
|
|
316
|
+
async function putWithRetry(url, body, signal, attempts = 3) {
|
|
317
|
+
let lastErr;
|
|
318
|
+
for (let i = 0; i < attempts; i++) {
|
|
319
|
+
if (signal?.aborted) throw new Error("Upload aborted");
|
|
320
|
+
try {
|
|
321
|
+
const res = await fetch(url, {
|
|
322
|
+
method: "PUT",
|
|
323
|
+
body,
|
|
324
|
+
signal
|
|
325
|
+
});
|
|
326
|
+
if (!res.ok) throw new Error(`Upload PUT failed: ${res.status}`);
|
|
327
|
+
return res.headers.get("etag");
|
|
328
|
+
} catch (e) {
|
|
329
|
+
lastErr = e;
|
|
330
|
+
if (signal?.aborted) throw e;
|
|
331
|
+
if (i < attempts - 1) await new Promise((r) => setTimeout(r, 200 * 2 ** i));
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
throw lastErr;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Run `fn` over `items` with at most `limit` in flight; preserves order.
|
|
338
|
+
* Workers stop pulling new items once `signal` is aborted, enabling fast
|
|
339
|
+
* cancellation when one part fails.
|
|
340
|
+
*/
|
|
341
|
+
async function mapLimit(items, limit, fn, signal) {
|
|
342
|
+
const out = new Array(items.length);
|
|
343
|
+
let next = 0;
|
|
344
|
+
const worker = async () => {
|
|
345
|
+
while (next < items.length) {
|
|
346
|
+
if (signal?.aborted) break;
|
|
347
|
+
const i = next++;
|
|
348
|
+
out[i] = await fn(items[i]);
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
const workers = Math.min(Math.max(1, limit), items.length);
|
|
352
|
+
await Promise.all(Array.from({ length: workers }, worker));
|
|
353
|
+
return out;
|
|
354
|
+
}
|
|
305
355
|
function createUploadsResource(request) {
|
|
306
|
-
return { async
|
|
307
|
-
|
|
356
|
+
return { async create(file, options) {
|
|
357
|
+
const blob = toBlob(file);
|
|
358
|
+
const size = options.size ?? blob.size;
|
|
359
|
+
if (options.signal?.aborted) throw new Error("Upload aborted");
|
|
360
|
+
const init = await (await request("/assets", {
|
|
308
361
|
method: "POST",
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
362
|
+
body: {
|
|
363
|
+
filename: options.filename,
|
|
364
|
+
size,
|
|
365
|
+
contentType: options.contentType,
|
|
366
|
+
checksum: options.checksum,
|
|
367
|
+
lifecycle: options.persist ? "persisted" : "ephemeral"
|
|
368
|
+
},
|
|
369
|
+
raw: true,
|
|
370
|
+
signal: options.signal
|
|
371
|
+
})).json();
|
|
372
|
+
if (init.status === "deduplicated") {
|
|
373
|
+
options.onProgress?.({
|
|
374
|
+
loaded: size,
|
|
375
|
+
total: size
|
|
376
|
+
});
|
|
377
|
+
return init.data;
|
|
378
|
+
}
|
|
379
|
+
if (init.status === "presigned") {
|
|
380
|
+
await putWithRetry(init.upload.url, blob, options.signal);
|
|
381
|
+
options.onProgress?.({
|
|
382
|
+
loaded: size,
|
|
383
|
+
total: size
|
|
384
|
+
});
|
|
385
|
+
return request(`/assets/${init.data.id}/complete`, {
|
|
386
|
+
method: "POST",
|
|
387
|
+
body: {},
|
|
388
|
+
signal: options.signal
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
const internal = new AbortController();
|
|
392
|
+
const combinedSignal = options.signal ? AbortSignal.any([options.signal, internal.signal]) : internal.signal;
|
|
393
|
+
const { partSize, parts } = init.upload;
|
|
394
|
+
let loaded = 0;
|
|
395
|
+
let partError = null;
|
|
396
|
+
const completed = await mapLimit(parts, options.concurrency ?? 5, async (p) => {
|
|
397
|
+
const start = (p.partNumber - 1) * partSize;
|
|
398
|
+
const chunk = blob.slice(start, Math.min(start + partSize, size));
|
|
399
|
+
let etag;
|
|
400
|
+
try {
|
|
401
|
+
etag = await putWithRetry(p.url, chunk, combinedSignal);
|
|
402
|
+
} catch (e) {
|
|
403
|
+
internal.abort();
|
|
404
|
+
partError = e instanceof Error ? e : new Error(String(e));
|
|
405
|
+
throw partError;
|
|
406
|
+
}
|
|
407
|
+
if (etag === null) {
|
|
408
|
+
internal.abort();
|
|
409
|
+
const corsErr = /* @__PURE__ */ new Error("Multipart upload requires the ETag response header. Configure the R2 bucket CORS to expose 'ETag'.");
|
|
410
|
+
partError = corsErr;
|
|
411
|
+
throw corsErr;
|
|
412
|
+
}
|
|
413
|
+
loaded += chunk.size;
|
|
414
|
+
options.onProgress?.({
|
|
415
|
+
loaded,
|
|
416
|
+
total: size
|
|
417
|
+
});
|
|
418
|
+
return {
|
|
419
|
+
partNumber: p.partNumber,
|
|
420
|
+
etag
|
|
421
|
+
};
|
|
422
|
+
}, combinedSignal);
|
|
423
|
+
if (partError) throw partError;
|
|
424
|
+
completed.sort((a, b) => a.partNumber - b.partNumber);
|
|
425
|
+
return request(`/assets/${init.data.id}/complete`, {
|
|
426
|
+
method: "POST",
|
|
427
|
+
body: { parts: completed },
|
|
428
|
+
signal: options.signal
|
|
312
429
|
});
|
|
313
430
|
} };
|
|
314
431
|
}
|
|
@@ -448,12 +565,32 @@ function createBatchesResource(request) {
|
|
|
448
565
|
//#endregion
|
|
449
566
|
//#region src/resources/assets.ts
|
|
450
567
|
function createAssetsResource(request) {
|
|
451
|
-
return {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
568
|
+
return {
|
|
569
|
+
async list(params, options) {
|
|
570
|
+
return request("/assets", {
|
|
571
|
+
query: params,
|
|
572
|
+
signal: options?.signal
|
|
573
|
+
});
|
|
574
|
+
},
|
|
575
|
+
async get(id, options) {
|
|
576
|
+
return request(`/assets/${id}`, { signal: options?.signal });
|
|
577
|
+
},
|
|
578
|
+
async delete(id, options) {
|
|
579
|
+
return request(`/assets/${id}`, {
|
|
580
|
+
method: "DELETE",
|
|
581
|
+
signal: options?.signal
|
|
582
|
+
});
|
|
583
|
+
},
|
|
584
|
+
async download(id, options) {
|
|
585
|
+
return request(`/assets/${id}/download`, { signal: options?.signal });
|
|
586
|
+
},
|
|
587
|
+
async templates(params, options) {
|
|
588
|
+
return request("/assets/templates", {
|
|
589
|
+
query: params,
|
|
590
|
+
signal: options?.signal
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
};
|
|
457
594
|
}
|
|
458
595
|
//#endregion
|
|
459
596
|
//#region src/resources/team.ts
|