@magiclabs.ai/magicbook-client 0.7.21 → 0.7.23-canary

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/index.d.cts CHANGED
@@ -4473,6 +4473,53 @@ declare const spreadServerSchema: z.ZodObject<{
4473
4473
  background?: unknown;
4474
4474
  }>;
4475
4475
  type SpreadServer = z.infer<typeof spreadServerSchema>;
4476
+ declare const spreadSchema: z.ZodObject<{
4477
+ id: z.ZodOptional<z.ZodString>;
4478
+ bookId: z.ZodString;
4479
+ state: z.ZodString;
4480
+ spreadType: z.ZodString;
4481
+ width: z.ZodOptional<z.ZodNumber>;
4482
+ height: z.ZodOptional<z.ZodNumber>;
4483
+ sequence: z.ZodNumber;
4484
+ wells: z.ZodArray<z.ZodUnknown, "many">;
4485
+ background: z.ZodUnknown;
4486
+ laidOutAt: z.ZodNullable<z.ZodString>;
4487
+ embellishedAt: z.ZodNullable<z.ZodString>;
4488
+ polishedAt: z.ZodNullable<z.ZodString>;
4489
+ metadata: z.ZodUnknown;
4490
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4491
+ }, "strip", z.ZodTypeAny, {
4492
+ state: string;
4493
+ sequence: number;
4494
+ wells: unknown[];
4495
+ bookId: string;
4496
+ spreadType: string;
4497
+ laidOutAt: string | null;
4498
+ embellishedAt: string | null;
4499
+ polishedAt: string | null;
4500
+ id?: string | undefined;
4501
+ url?: string | null | undefined;
4502
+ width?: number | undefined;
4503
+ height?: number | undefined;
4504
+ metadata?: unknown;
4505
+ background?: unknown;
4506
+ }, {
4507
+ state: string;
4508
+ sequence: number;
4509
+ wells: unknown[];
4510
+ bookId: string;
4511
+ spreadType: string;
4512
+ laidOutAt: string | null;
4513
+ embellishedAt: string | null;
4514
+ polishedAt: string | null;
4515
+ id?: string | undefined;
4516
+ url?: string | null | undefined;
4517
+ width?: number | undefined;
4518
+ height?: number | undefined;
4519
+ metadata?: unknown;
4520
+ background?: unknown;
4521
+ }>;
4522
+ type Spread = z.infer<typeof spreadSchema>;
4476
4523
 
4477
4524
  declare class SpreadsEndpoints {
4478
4525
  private readonly engineAPI;
@@ -4525,6 +4572,7 @@ declare class SpreadsEndpoints {
4525
4572
  metadata?: unknown;
4526
4573
  background?: unknown;
4527
4574
  }>;
4575
+ render(spreadId: string, bookId: string, size?: number): Promise<any>;
4528
4576
  update(spreadId: string, bookId: string, spread: SpreadServer): Promise<{
4529
4577
  state: string;
4530
4578
  book_id: string;
@@ -7203,4 +7251,4 @@ declare const bookCreationRequestSchema: z.ZodObject<{
7203
7251
  }>;
7204
7252
  type BookCreationRequest = z.infer<typeof bookCreationRequestSchema>;
7205
7253
 
7206
- export { type Asset, Book, type BookCreationRequest, BookDesignRequest, type BookDesignRequestProps, type BookProps, type BookReport, type BookSize, type CoverType, type DesignOptions, type DesignOptionsServer, DesignRequest, type DesignRequestEvent, type DesignRequestEventDetail, DesignRequestOptions, type DesignRequestProps, type EmbellishmentLevel, type Format, type Image, type ImageAssignment, type ImageDensity, type ImageDensityOption, type ImageDensityOptionServer, type ImageDensityOptions, type ImageDensityOptionsServer, type ImageFilteringLevel, ImageServer, Images, MagicBookClient, type MagicShopBook, type Occasion, type Page, type PageType, type PhotoMetadata, type PhotoStrip, type Position, type Property, type ReportingData, type SflyCanvas, type SnapCanvas, type State, type Style, type SurfaceCategoryName, type TextStickerLevel, assetSchema, bookCreationRequestSchema, bookDesignRequestSchema, bookPropsSchema, bookSizes, canSubmitDesignRequest, cancelledEventDetail, coverTypes, designOptionsSchema, designOptionsServerSchema, embellishmentLevels, formats, imageAssignmentSchema, imageDensities, imageDensityOptionSchema, imageDensityOptionServerSchema, imageDensityOptionsSchema, imageDensityOptionsServerSchema, imageFilteringLevels, imageServerSchema, imageServerToImage, isDesignRequestSubmitted, magicShopBookSchema, occasions, pageSchema, pageTypes, photoMetadataSchema, photoStripSchema, positionSchema, propertySchema, reportingDataSchema, sflyCanvasSchema, snapCanvasSchema, states, statesToCloseWS, statesToReport, styles, surfaceCategoryNames, textStickerLevels, timeoutEventDetail };
7254
+ export { type Asset, Book, type BookCreationRequest, BookDesignRequest, type BookDesignRequestProps, type BookProps, type BookReport, type BookSize, type CoverType, type DesignOptions, type DesignOptionsServer, DesignRequest, type DesignRequestEvent, type DesignRequestEventDetail, DesignRequestOptions, type DesignRequestProps, type EmbellishmentLevel, type Format, type Image, type ImageAssignment, type ImageDensity, type ImageDensityOption, type ImageDensityOptionServer, type ImageDensityOptions, type ImageDensityOptionsServer, type ImageFilteringLevel, ImageServer, Images, MagicBookClient, type MagicShopBook, type Occasion, type Page, type PageType, type PhotoMetadata, type PhotoStrip, type Position, type Property, type ReportingData, type SflyCanvas, type SnapCanvas, type Spread, type SpreadServer, type State, type Style, type SurfaceCategoryName, type TextStickerLevel, assetSchema, bookCreationRequestSchema, bookDesignRequestSchema, bookPropsSchema, bookSizes, canSubmitDesignRequest, cancelledEventDetail, coverTypes, designOptionsSchema, designOptionsServerSchema, embellishmentLevels, formats, imageAssignmentSchema, imageDensities, imageDensityOptionSchema, imageDensityOptionServerSchema, imageDensityOptionsSchema, imageDensityOptionsServerSchema, imageFilteringLevels, imageServerSchema, imageServerToImage, isDesignRequestSubmitted, magicShopBookSchema, occasions, pageSchema, pageTypes, photoMetadataSchema, photoStripSchema, positionSchema, propertySchema, reportingDataSchema, sflyCanvasSchema, snapCanvasSchema, spreadSchema, spreadServerSchema, states, statesToCloseWS, statesToReport, styles, surfaceCategoryNames, textStickerLevels, timeoutEventDetail };
package/index.d.ts CHANGED
@@ -4473,6 +4473,53 @@ declare const spreadServerSchema: z.ZodObject<{
4473
4473
  background?: unknown;
4474
4474
  }>;
4475
4475
  type SpreadServer = z.infer<typeof spreadServerSchema>;
4476
+ declare const spreadSchema: z.ZodObject<{
4477
+ id: z.ZodOptional<z.ZodString>;
4478
+ bookId: z.ZodString;
4479
+ state: z.ZodString;
4480
+ spreadType: z.ZodString;
4481
+ width: z.ZodOptional<z.ZodNumber>;
4482
+ height: z.ZodOptional<z.ZodNumber>;
4483
+ sequence: z.ZodNumber;
4484
+ wells: z.ZodArray<z.ZodUnknown, "many">;
4485
+ background: z.ZodUnknown;
4486
+ laidOutAt: z.ZodNullable<z.ZodString>;
4487
+ embellishedAt: z.ZodNullable<z.ZodString>;
4488
+ polishedAt: z.ZodNullable<z.ZodString>;
4489
+ metadata: z.ZodUnknown;
4490
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4491
+ }, "strip", z.ZodTypeAny, {
4492
+ state: string;
4493
+ sequence: number;
4494
+ wells: unknown[];
4495
+ bookId: string;
4496
+ spreadType: string;
4497
+ laidOutAt: string | null;
4498
+ embellishedAt: string | null;
4499
+ polishedAt: string | null;
4500
+ id?: string | undefined;
4501
+ url?: string | null | undefined;
4502
+ width?: number | undefined;
4503
+ height?: number | undefined;
4504
+ metadata?: unknown;
4505
+ background?: unknown;
4506
+ }, {
4507
+ state: string;
4508
+ sequence: number;
4509
+ wells: unknown[];
4510
+ bookId: string;
4511
+ spreadType: string;
4512
+ laidOutAt: string | null;
4513
+ embellishedAt: string | null;
4514
+ polishedAt: string | null;
4515
+ id?: string | undefined;
4516
+ url?: string | null | undefined;
4517
+ width?: number | undefined;
4518
+ height?: number | undefined;
4519
+ metadata?: unknown;
4520
+ background?: unknown;
4521
+ }>;
4522
+ type Spread = z.infer<typeof spreadSchema>;
4476
4523
 
4477
4524
  declare class SpreadsEndpoints {
4478
4525
  private readonly engineAPI;
@@ -4525,6 +4572,7 @@ declare class SpreadsEndpoints {
4525
4572
  metadata?: unknown;
4526
4573
  background?: unknown;
4527
4574
  }>;
4575
+ render(spreadId: string, bookId: string, size?: number): Promise<any>;
4528
4576
  update(spreadId: string, bookId: string, spread: SpreadServer): Promise<{
4529
4577
  state: string;
4530
4578
  book_id: string;
@@ -7203,4 +7251,4 @@ declare const bookCreationRequestSchema: z.ZodObject<{
7203
7251
  }>;
7204
7252
  type BookCreationRequest = z.infer<typeof bookCreationRequestSchema>;
7205
7253
 
7206
- export { type Asset, Book, type BookCreationRequest, BookDesignRequest, type BookDesignRequestProps, type BookProps, type BookReport, type BookSize, type CoverType, type DesignOptions, type DesignOptionsServer, DesignRequest, type DesignRequestEvent, type DesignRequestEventDetail, DesignRequestOptions, type DesignRequestProps, type EmbellishmentLevel, type Format, type Image, type ImageAssignment, type ImageDensity, type ImageDensityOption, type ImageDensityOptionServer, type ImageDensityOptions, type ImageDensityOptionsServer, type ImageFilteringLevel, ImageServer, Images, MagicBookClient, type MagicShopBook, type Occasion, type Page, type PageType, type PhotoMetadata, type PhotoStrip, type Position, type Property, type ReportingData, type SflyCanvas, type SnapCanvas, type State, type Style, type SurfaceCategoryName, type TextStickerLevel, assetSchema, bookCreationRequestSchema, bookDesignRequestSchema, bookPropsSchema, bookSizes, canSubmitDesignRequest, cancelledEventDetail, coverTypes, designOptionsSchema, designOptionsServerSchema, embellishmentLevels, formats, imageAssignmentSchema, imageDensities, imageDensityOptionSchema, imageDensityOptionServerSchema, imageDensityOptionsSchema, imageDensityOptionsServerSchema, imageFilteringLevels, imageServerSchema, imageServerToImage, isDesignRequestSubmitted, magicShopBookSchema, occasions, pageSchema, pageTypes, photoMetadataSchema, photoStripSchema, positionSchema, propertySchema, reportingDataSchema, sflyCanvasSchema, snapCanvasSchema, states, statesToCloseWS, statesToReport, styles, surfaceCategoryNames, textStickerLevels, timeoutEventDetail };
7254
+ export { type Asset, Book, type BookCreationRequest, BookDesignRequest, type BookDesignRequestProps, type BookProps, type BookReport, type BookSize, type CoverType, type DesignOptions, type DesignOptionsServer, DesignRequest, type DesignRequestEvent, type DesignRequestEventDetail, DesignRequestOptions, type DesignRequestProps, type EmbellishmentLevel, type Format, type Image, type ImageAssignment, type ImageDensity, type ImageDensityOption, type ImageDensityOptionServer, type ImageDensityOptions, type ImageDensityOptionsServer, type ImageFilteringLevel, ImageServer, Images, MagicBookClient, type MagicShopBook, type Occasion, type Page, type PageType, type PhotoMetadata, type PhotoStrip, type Position, type Property, type ReportingData, type SflyCanvas, type SnapCanvas, type Spread, type SpreadServer, type State, type Style, type SurfaceCategoryName, type TextStickerLevel, assetSchema, bookCreationRequestSchema, bookDesignRequestSchema, bookPropsSchema, bookSizes, canSubmitDesignRequest, cancelledEventDetail, coverTypes, designOptionsSchema, designOptionsServerSchema, embellishmentLevels, formats, imageAssignmentSchema, imageDensities, imageDensityOptionSchema, imageDensityOptionServerSchema, imageDensityOptionsSchema, imageDensityOptionsServerSchema, imageFilteringLevels, imageServerSchema, imageServerToImage, isDesignRequestSubmitted, magicShopBookSchema, occasions, pageSchema, pageTypes, photoMetadataSchema, photoStripSchema, positionSchema, propertySchema, reportingDataSchema, sflyCanvasSchema, snapCanvasSchema, spreadSchema, spreadServerSchema, states, statesToCloseWS, statesToReport, styles, surfaceCategoryNames, textStickerLevels, timeoutEventDetail };
package/index.iife.js CHANGED
@@ -61,6 +61,8 @@ var MagicLabs = (() => {
61
61
  reportingDataSchema: () => reportingDataSchema,
62
62
  sflyCanvasSchema: () => sflyCanvasSchema,
63
63
  snapCanvasSchema: () => snapCanvasSchema,
64
+ spreadSchema: () => spreadSchema,
65
+ spreadServerSchema: () => spreadServerSchema,
64
66
  states: () => states,
65
67
  statesToCloseWS: () => statesToCloseWS,
66
68
  statesToReport: () => statesToReport,
@@ -1798,6 +1800,9 @@ var MagicLabs = (() => {
1798
1800
  return json.replace(/"([^"]+)":/g, "$1:");
1799
1801
  };
1800
1802
  var ZodError = class _ZodError extends Error {
1803
+ get errors() {
1804
+ return this.issues;
1805
+ }
1801
1806
  constructor(issues) {
1802
1807
  super();
1803
1808
  this.issues = [];
@@ -1816,9 +1821,6 @@ var MagicLabs = (() => {
1816
1821
  this.name = "ZodError";
1817
1822
  this.issues = issues;
1818
1823
  }
1819
- get errors() {
1820
- return this.issues;
1821
- }
1822
1824
  format(_mapper) {
1823
1825
  const mapper = _mapper || function(issue) {
1824
1826
  return issue.message;
@@ -2029,8 +2031,11 @@ var MagicLabs = (() => {
2029
2031
  path: ctx.path,
2030
2032
  errorMaps: [
2031
2033
  ctx.common.contextualErrorMap,
2034
+ // contextual error map is first priority
2032
2035
  ctx.schemaErrorMap,
2036
+ // then schema-bound map if available
2033
2037
  overrideMap,
2038
+ // then global override map
2034
2039
  overrideMap === errorMap ? void 0 : errorMap
2035
2040
  // then global default map
2036
2041
  ].filter((x) => !!x)
@@ -2186,34 +2191,6 @@ var MagicLabs = (() => {
2186
2191
  return { errorMap: customMap, description };
2187
2192
  }
2188
2193
  var ZodType = class {
2189
- constructor(def) {
2190
- this.spa = this.safeParseAsync;
2191
- this._def = def;
2192
- this.parse = this.parse.bind(this);
2193
- this.safeParse = this.safeParse.bind(this);
2194
- this.parseAsync = this.parseAsync.bind(this);
2195
- this.safeParseAsync = this.safeParseAsync.bind(this);
2196
- this.spa = this.spa.bind(this);
2197
- this.refine = this.refine.bind(this);
2198
- this.refinement = this.refinement.bind(this);
2199
- this.superRefine = this.superRefine.bind(this);
2200
- this.optional = this.optional.bind(this);
2201
- this.nullable = this.nullable.bind(this);
2202
- this.nullish = this.nullish.bind(this);
2203
- this.array = this.array.bind(this);
2204
- this.promise = this.promise.bind(this);
2205
- this.or = this.or.bind(this);
2206
- this.and = this.and.bind(this);
2207
- this.transform = this.transform.bind(this);
2208
- this.brand = this.brand.bind(this);
2209
- this.default = this.default.bind(this);
2210
- this.catch = this.catch.bind(this);
2211
- this.describe = this.describe.bind(this);
2212
- this.pipe = this.pipe.bind(this);
2213
- this.readonly = this.readonly.bind(this);
2214
- this.isNullable = this.isNullable.bind(this);
2215
- this.isOptional = this.isOptional.bind(this);
2216
- }
2217
2194
  get description() {
2218
2195
  return this._def.description;
2219
2196
  }
@@ -2277,6 +2254,43 @@ var MagicLabs = (() => {
2277
2254
  const result = this._parseSync({ data, path: ctx.path, parent: ctx });
2278
2255
  return handleResult(ctx, result);
2279
2256
  }
2257
+ "~validate"(data) {
2258
+ var _a, _b;
2259
+ const ctx = {
2260
+ common: {
2261
+ issues: [],
2262
+ async: !!this["~standard"].async
2263
+ },
2264
+ path: [],
2265
+ schemaErrorMap: this._def.errorMap,
2266
+ parent: null,
2267
+ data,
2268
+ parsedType: getParsedType(data)
2269
+ };
2270
+ if (!this["~standard"].async) {
2271
+ try {
2272
+ const result = this._parseSync({ data, path: [], parent: ctx });
2273
+ return isValid(result) ? {
2274
+ value: result.value
2275
+ } : {
2276
+ issues: ctx.common.issues
2277
+ };
2278
+ } catch (err) {
2279
+ if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
2280
+ this["~standard"].async = true;
2281
+ }
2282
+ ctx.common = {
2283
+ issues: [],
2284
+ async: true
2285
+ };
2286
+ }
2287
+ }
2288
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
2289
+ value: result.value
2290
+ } : {
2291
+ issues: ctx.common.issues
2292
+ });
2293
+ }
2280
2294
  async parseAsync(data, params) {
2281
2295
  const result = await this.safeParseAsync(data, params);
2282
2296
  if (result.success)
@@ -2354,6 +2368,39 @@ var MagicLabs = (() => {
2354
2368
  superRefine(refinement) {
2355
2369
  return this._refinement(refinement);
2356
2370
  }
2371
+ constructor(def) {
2372
+ this.spa = this.safeParseAsync;
2373
+ this._def = def;
2374
+ this.parse = this.parse.bind(this);
2375
+ this.safeParse = this.safeParse.bind(this);
2376
+ this.parseAsync = this.parseAsync.bind(this);
2377
+ this.safeParseAsync = this.safeParseAsync.bind(this);
2378
+ this.spa = this.spa.bind(this);
2379
+ this.refine = this.refine.bind(this);
2380
+ this.refinement = this.refinement.bind(this);
2381
+ this.superRefine = this.superRefine.bind(this);
2382
+ this.optional = this.optional.bind(this);
2383
+ this.nullable = this.nullable.bind(this);
2384
+ this.nullish = this.nullish.bind(this);
2385
+ this.array = this.array.bind(this);
2386
+ this.promise = this.promise.bind(this);
2387
+ this.or = this.or.bind(this);
2388
+ this.and = this.and.bind(this);
2389
+ this.transform = this.transform.bind(this);
2390
+ this.brand = this.brand.bind(this);
2391
+ this.default = this.default.bind(this);
2392
+ this.catch = this.catch.bind(this);
2393
+ this.describe = this.describe.bind(this);
2394
+ this.pipe = this.pipe.bind(this);
2395
+ this.readonly = this.readonly.bind(this);
2396
+ this.isNullable = this.isNullable.bind(this);
2397
+ this.isOptional = this.isOptional.bind(this);
2398
+ this["~standard"] = {
2399
+ version: 1,
2400
+ vendor: "zod",
2401
+ validate: (data) => this["~validate"](data)
2402
+ };
2403
+ }
2357
2404
  optional() {
2358
2405
  return ZodOptional.create(this, this._def);
2359
2406
  }
@@ -2364,7 +2411,7 @@ var MagicLabs = (() => {
2364
2411
  return this.nullable().optional();
2365
2412
  }
2366
2413
  array() {
2367
- return ZodArray.create(this, this._def);
2414
+ return ZodArray.create(this);
2368
2415
  }
2369
2416
  promise() {
2370
2417
  return ZodPromise.create(this, this._def);
@@ -2430,16 +2477,20 @@ var MagicLabs = (() => {
2430
2477
  };
2431
2478
  var cuidRegex = /^c[^\s-]{8,}$/i;
2432
2479
  var cuid2Regex = /^[0-9a-z]+$/;
2433
- var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
2480
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
2434
2481
  var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
2435
2482
  var nanoidRegex = /^[a-z0-9_-]{21}$/i;
2483
+ var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
2436
2484
  var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
2437
2485
  var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
2438
2486
  var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
2439
2487
  var emojiRegex;
2440
2488
  var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
2441
- var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
2489
+ var ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
2490
+ var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
2491
+ var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
2442
2492
  var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
2493
+ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
2443
2494
  var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
2444
2495
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
2445
2496
  function timeRegexSource(args) {
@@ -2472,6 +2523,33 @@ var MagicLabs = (() => {
2472
2523
  }
2473
2524
  return false;
2474
2525
  }
2526
+ function isValidJWT(jwt, alg) {
2527
+ if (!jwtRegex.test(jwt))
2528
+ return false;
2529
+ try {
2530
+ const [header] = jwt.split(".");
2531
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
2532
+ const decoded = JSON.parse(atob(base64));
2533
+ if (typeof decoded !== "object" || decoded === null)
2534
+ return false;
2535
+ if (!decoded.typ || !decoded.alg)
2536
+ return false;
2537
+ if (alg && decoded.alg !== alg)
2538
+ return false;
2539
+ return true;
2540
+ } catch (_a) {
2541
+ return false;
2542
+ }
2543
+ }
2544
+ function isValidCidr(ip, version) {
2545
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
2546
+ return true;
2547
+ }
2548
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
2549
+ return true;
2550
+ }
2551
+ return false;
2552
+ }
2475
2553
  var ZodString = class _ZodString extends ZodType {
2476
2554
  _parse(input) {
2477
2555
  if (this._def.coerce) {
@@ -2728,6 +2806,26 @@ var MagicLabs = (() => {
2728
2806
  });
2729
2807
  status.dirty();
2730
2808
  }
2809
+ } else if (check.kind === "jwt") {
2810
+ if (!isValidJWT(input.data, check.alg)) {
2811
+ ctx = this._getOrReturnCtx(input, ctx);
2812
+ addIssueToContext(ctx, {
2813
+ validation: "jwt",
2814
+ code: ZodIssueCode.invalid_string,
2815
+ message: check.message
2816
+ });
2817
+ status.dirty();
2818
+ }
2819
+ } else if (check.kind === "cidr") {
2820
+ if (!isValidCidr(input.data, check.version)) {
2821
+ ctx = this._getOrReturnCtx(input, ctx);
2822
+ addIssueToContext(ctx, {
2823
+ validation: "cidr",
2824
+ code: ZodIssueCode.invalid_string,
2825
+ message: check.message
2826
+ });
2827
+ status.dirty();
2828
+ }
2731
2829
  } else if (check.kind === "base64") {
2732
2830
  if (!base64Regex.test(input.data)) {
2733
2831
  ctx = this._getOrReturnCtx(input, ctx);
@@ -2738,6 +2836,16 @@ var MagicLabs = (() => {
2738
2836
  });
2739
2837
  status.dirty();
2740
2838
  }
2839
+ } else if (check.kind === "base64url") {
2840
+ if (!base64urlRegex.test(input.data)) {
2841
+ ctx = this._getOrReturnCtx(input, ctx);
2842
+ addIssueToContext(ctx, {
2843
+ validation: "base64url",
2844
+ code: ZodIssueCode.invalid_string,
2845
+ message: check.message
2846
+ });
2847
+ status.dirty();
2848
+ }
2741
2849
  } else {
2742
2850
  util.assertNever(check);
2743
2851
  }
@@ -2784,9 +2892,21 @@ var MagicLabs = (() => {
2784
2892
  base64(message) {
2785
2893
  return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
2786
2894
  }
2895
+ base64url(message) {
2896
+ return this._addCheck({
2897
+ kind: "base64url",
2898
+ ...errorUtil.errToObj(message)
2899
+ });
2900
+ }
2901
+ jwt(options) {
2902
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
2903
+ }
2787
2904
  ip(options) {
2788
2905
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
2789
2906
  }
2907
+ cidr(options) {
2908
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
2909
+ }
2790
2910
  datetime(options) {
2791
2911
  var _a, _b;
2792
2912
  if (typeof options === "string") {
@@ -2877,8 +2997,7 @@ var MagicLabs = (() => {
2877
2997
  });
2878
2998
  }
2879
2999
  /**
2880
- * @deprecated Use z.string().min(1) instead.
2881
- * @see {@link ZodString.min}
3000
+ * Equivalent to `.min(1)`
2882
3001
  */
2883
3002
  nonempty(message) {
2884
3003
  return this.min(1, errorUtil.errToObj(message));
@@ -2940,9 +3059,15 @@ var MagicLabs = (() => {
2940
3059
  get isIP() {
2941
3060
  return !!this._def.checks.find((ch) => ch.kind === "ip");
2942
3061
  }
3062
+ get isCIDR() {
3063
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
3064
+ }
2943
3065
  get isBase64() {
2944
3066
  return !!this._def.checks.find((ch) => ch.kind === "base64");
2945
3067
  }
3068
+ get isBase64url() {
3069
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
3070
+ }
2946
3071
  get minLength() {
2947
3072
  let min = null;
2948
3073
  for (const ch of this._def.checks) {
@@ -3220,17 +3345,15 @@ var MagicLabs = (() => {
3220
3345
  }
3221
3346
  _parse(input) {
3222
3347
  if (this._def.coerce) {
3223
- input.data = BigInt(input.data);
3348
+ try {
3349
+ input.data = BigInt(input.data);
3350
+ } catch (_a) {
3351
+ return this._getInvalidInput(input);
3352
+ }
3224
3353
  }
3225
3354
  const parsedType = this._getType(input);
3226
3355
  if (parsedType !== ZodParsedType.bigint) {
3227
- const ctx2 = this._getOrReturnCtx(input);
3228
- addIssueToContext(ctx2, {
3229
- code: ZodIssueCode.invalid_type,
3230
- expected: ZodParsedType.bigint,
3231
- received: ctx2.parsedType
3232
- });
3233
- return INVALID;
3356
+ return this._getInvalidInput(input);
3234
3357
  }
3235
3358
  let ctx = void 0;
3236
3359
  const status = new ParseStatus();
@@ -3277,6 +3400,15 @@ var MagicLabs = (() => {
3277
3400
  }
3278
3401
  return { status: status.value, value: input.data };
3279
3402
  }
3403
+ _getInvalidInput(input) {
3404
+ const ctx = this._getOrReturnCtx(input);
3405
+ addIssueToContext(ctx, {
3406
+ code: ZodIssueCode.invalid_type,
3407
+ expected: ZodParsedType.bigint,
3408
+ received: ctx.parsedType
3409
+ });
3410
+ return INVALID;
3411
+ }
3280
3412
  gte(value, message) {
3281
3413
  return this.setLimit("min", value, true, errorUtil.toString(message));
3282
3414
  }
@@ -6332,6 +6464,14 @@ var MagicLabs = (() => {
6332
6464
  return spreadServerSchema.parse(res);
6333
6465
  });
6334
6466
  }
6467
+ render(spreadId, bookId, size = 512) {
6468
+ return handleAsyncFunction(async () => {
6469
+ const res = await this.engineAPI.fetcher.call({
6470
+ path: `/v1/spreads/${spreadId}/book/${bookId}/render/${size}`
6471
+ });
6472
+ return res;
6473
+ });
6474
+ }
6335
6475
  update(spreadId, bookId, spread) {
6336
6476
  return handleAsyncFunction(async () => {
6337
6477
  const res = await this.engineAPI.fetcher.call({