@magiclabs.ai/magicbook-client 0.7.12-canary → 0.7.14-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/README.md +6 -0
- package/index.cjs +39 -11
- package/index.cjs.map +1 -1
- package/index.d.cts +15 -12
- package/index.d.ts +15 -12
- package/index.iife.js +39 -11
- package/index.js +39 -11
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -827,7 +827,7 @@ declare const styles: {
|
|
|
827
827
|
slug: string;
|
|
828
828
|
};
|
|
829
829
|
};
|
|
830
|
-
declare const bookSizes: readonly ["5x7", "6x6", "
|
|
830
|
+
declare const bookSizes: readonly ["4.5x4", "5x7", "6x6", "6x8", "7x5", "8x8", "8x11", "10x10", "11x8", "11x14", "12x12"];
|
|
831
831
|
declare const coverTypes: readonly ["sc", "hc", "pl"];
|
|
832
832
|
declare const pageTypes: readonly ["sp", "sl", "dl"];
|
|
833
833
|
declare const imageDensities: readonly ["low", "medium", "high"];
|
|
@@ -1183,6 +1183,7 @@ declare class MagicBookClient {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
|
|
1185
1185
|
type Image = {
|
|
1186
|
+
id?: string;
|
|
1186
1187
|
handle: string;
|
|
1187
1188
|
url: string;
|
|
1188
1189
|
width: number;
|
|
@@ -1197,11 +1198,12 @@ type Image = {
|
|
|
1197
1198
|
declare class Images {
|
|
1198
1199
|
private readonly client;
|
|
1199
1200
|
private parentId;
|
|
1200
|
-
|
|
1201
|
+
list: Array<Image>;
|
|
1201
1202
|
length: number;
|
|
1202
1203
|
designRequestState: State;
|
|
1203
1204
|
constructor(client: MagicBookClient, parentId: string, designRequestState: State);
|
|
1204
|
-
add(image: Image): Promise<
|
|
1205
|
+
add(image: Image): Promise<Image>;
|
|
1206
|
+
delete(imageId: string): Promise<number>;
|
|
1205
1207
|
}
|
|
1206
1208
|
declare const imageServerSchema: z.ZodObject<{
|
|
1207
1209
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -1241,6 +1243,7 @@ declare const imageServerSchema: z.ZodObject<{
|
|
|
1241
1243
|
metadata?: Record<string, unknown> | undefined;
|
|
1242
1244
|
}>;
|
|
1243
1245
|
declare class ImageServer {
|
|
1246
|
+
id?: string;
|
|
1244
1247
|
handle: string;
|
|
1245
1248
|
url: string;
|
|
1246
1249
|
width: number;
|
|
@@ -1267,7 +1270,7 @@ type TextStickerLevel = (typeof textStickerLevels)[number];
|
|
|
1267
1270
|
declare const DesignRequestOptions: {
|
|
1268
1271
|
occasion: readonly ["baby", "birthday", "default", "everyday", "family", "kids", "life-stories", "portfolio", "school-memories", "seasonal-holidays", "special-celebrations", "sports-and-hobbies", "travel", "wedding", "year-in-review"];
|
|
1269
1272
|
style: number[];
|
|
1270
|
-
bookSize: readonly ["5x7", "6x6", "
|
|
1273
|
+
bookSize: readonly ["4.5x4", "5x7", "6x6", "6x8", "7x5", "8x8", "8x11", "10x10", "11x8", "11x14", "12x12"];
|
|
1271
1274
|
coverType: readonly ["sc", "hc", "pl"];
|
|
1272
1275
|
pageType: readonly ["sp", "sl", "dl"];
|
|
1273
1276
|
imageDensity: readonly ["low", "medium", "high"];
|
|
@@ -1422,7 +1425,7 @@ declare class BookDesignRequest {
|
|
|
1422
1425
|
declare const bookDesignRequestSchema: z.ZodObject<{
|
|
1423
1426
|
occasion: z.ZodEnum<["baby", "birthday", "default", "everyday", "family", "kids", "life-stories", "portfolio", "school-memories", "seasonal-holidays", "special-celebrations", "sports-and-hobbies", "travel", "wedding", "year-in-review"]>;
|
|
1424
1427
|
style: z.ZodString;
|
|
1425
|
-
book_size: z.ZodEnum<["5x7", "6x6", "
|
|
1428
|
+
book_size: z.ZodEnum<["4.5x4", "5x7", "6x6", "6x8", "7x5", "8x8", "8x11", "10x10", "11x8", "11x14", "12x12"]>;
|
|
1426
1429
|
cover_type: z.ZodEnum<["sc", "hc", "pl"]>;
|
|
1427
1430
|
page_type: z.ZodEnum<["sp", "sl", "dl"]>;
|
|
1428
1431
|
image_density: z.ZodEnum<["low", "medium", "high"]>;
|
|
@@ -1432,7 +1435,7 @@ declare const bookDesignRequestSchema: z.ZodObject<{
|
|
|
1432
1435
|
}, "strip", z.ZodTypeAny, {
|
|
1433
1436
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1434
1437
|
style: string;
|
|
1435
|
-
book_size: "5x7" | "6x6" | "
|
|
1438
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1436
1439
|
cover_type: "sc" | "hc" | "pl";
|
|
1437
1440
|
page_type: "sp" | "sl" | "dl";
|
|
1438
1441
|
image_density: "low" | "medium" | "high";
|
|
@@ -1442,7 +1445,7 @@ declare const bookDesignRequestSchema: z.ZodObject<{
|
|
|
1442
1445
|
}, {
|
|
1443
1446
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1444
1447
|
style: string;
|
|
1445
|
-
book_size: "5x7" | "6x6" | "
|
|
1448
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1446
1449
|
cover_type: "sc" | "hc" | "pl";
|
|
1447
1450
|
page_type: "sp" | "sl" | "dl";
|
|
1448
1451
|
image_density: "low" | "medium" | "high";
|
|
@@ -1457,7 +1460,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1457
1460
|
design_request: z.ZodObject<{
|
|
1458
1461
|
occasion: z.ZodEnum<["baby", "birthday", "default", "everyday", "family", "kids", "life-stories", "portfolio", "school-memories", "seasonal-holidays", "special-celebrations", "sports-and-hobbies", "travel", "wedding", "year-in-review"]>;
|
|
1459
1462
|
style: z.ZodString;
|
|
1460
|
-
book_size: z.ZodEnum<["5x7", "6x6", "
|
|
1463
|
+
book_size: z.ZodEnum<["4.5x4", "5x7", "6x6", "6x8", "7x5", "8x8", "8x11", "10x10", "11x8", "11x14", "12x12"]>;
|
|
1461
1464
|
cover_type: z.ZodEnum<["sc", "hc", "pl"]>;
|
|
1462
1465
|
page_type: z.ZodEnum<["sp", "sl", "dl"]>;
|
|
1463
1466
|
image_density: z.ZodEnum<["low", "medium", "high"]>;
|
|
@@ -1467,7 +1470,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1467
1470
|
}, "strip", z.ZodTypeAny, {
|
|
1468
1471
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1469
1472
|
style: string;
|
|
1470
|
-
book_size: "5x7" | "6x6" | "
|
|
1473
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1471
1474
|
cover_type: "sc" | "hc" | "pl";
|
|
1472
1475
|
page_type: "sp" | "sl" | "dl";
|
|
1473
1476
|
image_density: "low" | "medium" | "high";
|
|
@@ -1477,7 +1480,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1477
1480
|
}, {
|
|
1478
1481
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1479
1482
|
style: string;
|
|
1480
|
-
book_size: "5x7" | "6x6" | "
|
|
1483
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1481
1484
|
cover_type: "sc" | "hc" | "pl";
|
|
1482
1485
|
page_type: "sp" | "sl" | "dl";
|
|
1483
1486
|
image_density: "low" | "medium" | "high";
|
|
@@ -1497,7 +1500,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1497
1500
|
design_request: {
|
|
1498
1501
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1499
1502
|
style: string;
|
|
1500
|
-
book_size: "5x7" | "6x6" | "
|
|
1503
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1501
1504
|
cover_type: "sc" | "hc" | "pl";
|
|
1502
1505
|
page_type: "sp" | "sl" | "dl";
|
|
1503
1506
|
image_density: "low" | "medium" | "high";
|
|
@@ -1519,7 +1522,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1519
1522
|
design_request: {
|
|
1520
1523
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1521
1524
|
style: string;
|
|
1522
|
-
book_size: "5x7" | "6x6" | "
|
|
1525
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1523
1526
|
cover_type: "sc" | "hc" | "pl";
|
|
1524
1527
|
page_type: "sp" | "sl" | "dl";
|
|
1525
1528
|
image_density: "low" | "medium" | "high";
|
package/index.d.ts
CHANGED
|
@@ -827,7 +827,7 @@ declare const styles: {
|
|
|
827
827
|
slug: string;
|
|
828
828
|
};
|
|
829
829
|
};
|
|
830
|
-
declare const bookSizes: readonly ["5x7", "6x6", "
|
|
830
|
+
declare const bookSizes: readonly ["4.5x4", "5x7", "6x6", "6x8", "7x5", "8x8", "8x11", "10x10", "11x8", "11x14", "12x12"];
|
|
831
831
|
declare const coverTypes: readonly ["sc", "hc", "pl"];
|
|
832
832
|
declare const pageTypes: readonly ["sp", "sl", "dl"];
|
|
833
833
|
declare const imageDensities: readonly ["low", "medium", "high"];
|
|
@@ -1183,6 +1183,7 @@ declare class MagicBookClient {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
|
|
1185
1185
|
type Image = {
|
|
1186
|
+
id?: string;
|
|
1186
1187
|
handle: string;
|
|
1187
1188
|
url: string;
|
|
1188
1189
|
width: number;
|
|
@@ -1197,11 +1198,12 @@ type Image = {
|
|
|
1197
1198
|
declare class Images {
|
|
1198
1199
|
private readonly client;
|
|
1199
1200
|
private parentId;
|
|
1200
|
-
|
|
1201
|
+
list: Array<Image>;
|
|
1201
1202
|
length: number;
|
|
1202
1203
|
designRequestState: State;
|
|
1203
1204
|
constructor(client: MagicBookClient, parentId: string, designRequestState: State);
|
|
1204
|
-
add(image: Image): Promise<
|
|
1205
|
+
add(image: Image): Promise<Image>;
|
|
1206
|
+
delete(imageId: string): Promise<number>;
|
|
1205
1207
|
}
|
|
1206
1208
|
declare const imageServerSchema: z.ZodObject<{
|
|
1207
1209
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -1241,6 +1243,7 @@ declare const imageServerSchema: z.ZodObject<{
|
|
|
1241
1243
|
metadata?: Record<string, unknown> | undefined;
|
|
1242
1244
|
}>;
|
|
1243
1245
|
declare class ImageServer {
|
|
1246
|
+
id?: string;
|
|
1244
1247
|
handle: string;
|
|
1245
1248
|
url: string;
|
|
1246
1249
|
width: number;
|
|
@@ -1267,7 +1270,7 @@ type TextStickerLevel = (typeof textStickerLevels)[number];
|
|
|
1267
1270
|
declare const DesignRequestOptions: {
|
|
1268
1271
|
occasion: readonly ["baby", "birthday", "default", "everyday", "family", "kids", "life-stories", "portfolio", "school-memories", "seasonal-holidays", "special-celebrations", "sports-and-hobbies", "travel", "wedding", "year-in-review"];
|
|
1269
1272
|
style: number[];
|
|
1270
|
-
bookSize: readonly ["5x7", "6x6", "
|
|
1273
|
+
bookSize: readonly ["4.5x4", "5x7", "6x6", "6x8", "7x5", "8x8", "8x11", "10x10", "11x8", "11x14", "12x12"];
|
|
1271
1274
|
coverType: readonly ["sc", "hc", "pl"];
|
|
1272
1275
|
pageType: readonly ["sp", "sl", "dl"];
|
|
1273
1276
|
imageDensity: readonly ["low", "medium", "high"];
|
|
@@ -1422,7 +1425,7 @@ declare class BookDesignRequest {
|
|
|
1422
1425
|
declare const bookDesignRequestSchema: z.ZodObject<{
|
|
1423
1426
|
occasion: z.ZodEnum<["baby", "birthday", "default", "everyday", "family", "kids", "life-stories", "portfolio", "school-memories", "seasonal-holidays", "special-celebrations", "sports-and-hobbies", "travel", "wedding", "year-in-review"]>;
|
|
1424
1427
|
style: z.ZodString;
|
|
1425
|
-
book_size: z.ZodEnum<["5x7", "6x6", "
|
|
1428
|
+
book_size: z.ZodEnum<["4.5x4", "5x7", "6x6", "6x8", "7x5", "8x8", "8x11", "10x10", "11x8", "11x14", "12x12"]>;
|
|
1426
1429
|
cover_type: z.ZodEnum<["sc", "hc", "pl"]>;
|
|
1427
1430
|
page_type: z.ZodEnum<["sp", "sl", "dl"]>;
|
|
1428
1431
|
image_density: z.ZodEnum<["low", "medium", "high"]>;
|
|
@@ -1432,7 +1435,7 @@ declare const bookDesignRequestSchema: z.ZodObject<{
|
|
|
1432
1435
|
}, "strip", z.ZodTypeAny, {
|
|
1433
1436
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1434
1437
|
style: string;
|
|
1435
|
-
book_size: "5x7" | "6x6" | "
|
|
1438
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1436
1439
|
cover_type: "sc" | "hc" | "pl";
|
|
1437
1440
|
page_type: "sp" | "sl" | "dl";
|
|
1438
1441
|
image_density: "low" | "medium" | "high";
|
|
@@ -1442,7 +1445,7 @@ declare const bookDesignRequestSchema: z.ZodObject<{
|
|
|
1442
1445
|
}, {
|
|
1443
1446
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1444
1447
|
style: string;
|
|
1445
|
-
book_size: "5x7" | "6x6" | "
|
|
1448
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1446
1449
|
cover_type: "sc" | "hc" | "pl";
|
|
1447
1450
|
page_type: "sp" | "sl" | "dl";
|
|
1448
1451
|
image_density: "low" | "medium" | "high";
|
|
@@ -1457,7 +1460,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1457
1460
|
design_request: z.ZodObject<{
|
|
1458
1461
|
occasion: z.ZodEnum<["baby", "birthday", "default", "everyday", "family", "kids", "life-stories", "portfolio", "school-memories", "seasonal-holidays", "special-celebrations", "sports-and-hobbies", "travel", "wedding", "year-in-review"]>;
|
|
1459
1462
|
style: z.ZodString;
|
|
1460
|
-
book_size: z.ZodEnum<["5x7", "6x6", "
|
|
1463
|
+
book_size: z.ZodEnum<["4.5x4", "5x7", "6x6", "6x8", "7x5", "8x8", "8x11", "10x10", "11x8", "11x14", "12x12"]>;
|
|
1461
1464
|
cover_type: z.ZodEnum<["sc", "hc", "pl"]>;
|
|
1462
1465
|
page_type: z.ZodEnum<["sp", "sl", "dl"]>;
|
|
1463
1466
|
image_density: z.ZodEnum<["low", "medium", "high"]>;
|
|
@@ -1467,7 +1470,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1467
1470
|
}, "strip", z.ZodTypeAny, {
|
|
1468
1471
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1469
1472
|
style: string;
|
|
1470
|
-
book_size: "5x7" | "6x6" | "
|
|
1473
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1471
1474
|
cover_type: "sc" | "hc" | "pl";
|
|
1472
1475
|
page_type: "sp" | "sl" | "dl";
|
|
1473
1476
|
image_density: "low" | "medium" | "high";
|
|
@@ -1477,7 +1480,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1477
1480
|
}, {
|
|
1478
1481
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1479
1482
|
style: string;
|
|
1480
|
-
book_size: "5x7" | "6x6" | "
|
|
1483
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1481
1484
|
cover_type: "sc" | "hc" | "pl";
|
|
1482
1485
|
page_type: "sp" | "sl" | "dl";
|
|
1483
1486
|
image_density: "low" | "medium" | "high";
|
|
@@ -1497,7 +1500,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1497
1500
|
design_request: {
|
|
1498
1501
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1499
1502
|
style: string;
|
|
1500
|
-
book_size: "5x7" | "6x6" | "
|
|
1503
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1501
1504
|
cover_type: "sc" | "hc" | "pl";
|
|
1502
1505
|
page_type: "sp" | "sl" | "dl";
|
|
1503
1506
|
image_density: "low" | "medium" | "high";
|
|
@@ -1519,7 +1522,7 @@ declare const bookPropsSchema: z.ZodObject<{
|
|
|
1519
1522
|
design_request: {
|
|
1520
1523
|
occasion: "baby" | "birthday" | "default" | "everyday" | "family" | "kids" | "life-stories" | "portfolio" | "school-memories" | "seasonal-holidays" | "special-celebrations" | "sports-and-hobbies" | "travel" | "wedding" | "year-in-review";
|
|
1521
1524
|
style: string;
|
|
1522
|
-
book_size: "5x7" | "6x6" | "
|
|
1525
|
+
book_size: "4.5x4" | "5x7" | "6x6" | "6x8" | "7x5" | "8x8" | "8x11" | "10x10" | "11x8" | "11x14" | "12x12";
|
|
1523
1526
|
cover_type: "sc" | "hc" | "pl";
|
|
1524
1527
|
page_type: "sp" | "sl" | "dl";
|
|
1525
1528
|
image_density: "low" | "medium" | "high";
|
package/index.iife.js
CHANGED
|
@@ -387,7 +387,19 @@ var MagicLabs = (() => {
|
|
|
387
387
|
"03f332e3b2b947ebae73b67a9a22b6f4": { slug: "winter-sparkle-snap" },
|
|
388
388
|
"97f70f6cdb5244a08d45772cccfa2788": { slug: "year-of-memories-snap" }
|
|
389
389
|
};
|
|
390
|
-
var bookSizes = [
|
|
390
|
+
var bookSizes = [
|
|
391
|
+
"4.5x4",
|
|
392
|
+
"5x7",
|
|
393
|
+
"6x6",
|
|
394
|
+
"6x8",
|
|
395
|
+
"7x5",
|
|
396
|
+
"8x8",
|
|
397
|
+
"8x11",
|
|
398
|
+
"10x10",
|
|
399
|
+
"11x8",
|
|
400
|
+
"11x14",
|
|
401
|
+
"12x12"
|
|
402
|
+
];
|
|
391
403
|
var coverTypes = ["sc", "hc", "pl"];
|
|
392
404
|
var pageTypes = ["sp", "sl", "dl"];
|
|
393
405
|
var imageDensities = ["low", "medium", "high"];
|
|
@@ -4485,21 +4497,34 @@ var MagicLabs = (() => {
|
|
|
4485
4497
|
constructor(client, parentId, designRequestState) {
|
|
4486
4498
|
this.client = client;
|
|
4487
4499
|
this.parentId = parentId;
|
|
4488
|
-
this.
|
|
4489
|
-
this.length = this.
|
|
4500
|
+
this.list = [];
|
|
4501
|
+
this.length = this.list.length;
|
|
4490
4502
|
this.designRequestState = designRequestState;
|
|
4491
4503
|
}
|
|
4492
4504
|
parentId;
|
|
4493
|
-
|
|
4505
|
+
list;
|
|
4494
4506
|
length;
|
|
4495
4507
|
designRequestState;
|
|
4496
4508
|
async add(image) {
|
|
4497
4509
|
if (!canSubmitDesignRequest(this.designRequestState)) {
|
|
4498
4510
|
throw new Error("You need to wait for the current design request to be ready before adding new images.");
|
|
4499
4511
|
} else {
|
|
4500
|
-
this.images.
|
|
4501
|
-
|
|
4502
|
-
|
|
4512
|
+
const serverImage = await this.client.engineAPI.images.addToBook(this.parentId, new ImageServer(image));
|
|
4513
|
+
const img = imageServerToImage(serverImage);
|
|
4514
|
+
this.list.push(img);
|
|
4515
|
+
this.length = this.list.length;
|
|
4516
|
+
return new Promise((resolve) => {
|
|
4517
|
+
resolve(img);
|
|
4518
|
+
});
|
|
4519
|
+
}
|
|
4520
|
+
}
|
|
4521
|
+
async delete(imageId) {
|
|
4522
|
+
if (!canSubmitDesignRequest(this.designRequestState)) {
|
|
4523
|
+
throw new Error("You need to wait for the current design request to be ready before deleting images.");
|
|
4524
|
+
} else {
|
|
4525
|
+
await this.client.engineAPI.images.delete(imageId, this.parentId);
|
|
4526
|
+
this.list.splice(this.list.findIndex((image) => image.handle === imageId), 1);
|
|
4527
|
+
this.length = this.list.length;
|
|
4503
4528
|
return new Promise((resolve) => {
|
|
4504
4529
|
resolve(this.length);
|
|
4505
4530
|
});
|
|
@@ -4520,6 +4545,7 @@ var MagicLabs = (() => {
|
|
|
4520
4545
|
metadata: z.record(z.unknown()).optional()
|
|
4521
4546
|
});
|
|
4522
4547
|
var ImageServer = class {
|
|
4548
|
+
id;
|
|
4523
4549
|
handle;
|
|
4524
4550
|
url;
|
|
4525
4551
|
width;
|
|
@@ -4531,6 +4557,7 @@ var MagicLabs = (() => {
|
|
|
4531
4557
|
filename;
|
|
4532
4558
|
metadata;
|
|
4533
4559
|
constructor(image) {
|
|
4560
|
+
this.id = image.id;
|
|
4534
4561
|
this.handle = image.handle;
|
|
4535
4562
|
this.url = image.url;
|
|
4536
4563
|
this.width = image.width;
|
|
@@ -4545,6 +4572,7 @@ var MagicLabs = (() => {
|
|
|
4545
4572
|
};
|
|
4546
4573
|
function imageServerToImage(imageServer) {
|
|
4547
4574
|
return {
|
|
4575
|
+
id: imageServer.id,
|
|
4548
4576
|
handle: imageServer.handle,
|
|
4549
4577
|
url: imageServer.url,
|
|
4550
4578
|
width: imageServer.width,
|
|
@@ -4751,7 +4779,7 @@ var MagicLabs = (() => {
|
|
|
4751
4779
|
toBook() {
|
|
4752
4780
|
const designRequest = {
|
|
4753
4781
|
...this,
|
|
4754
|
-
images: this.images
|
|
4782
|
+
images: this.images.list
|
|
4755
4783
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4756
4784
|
};
|
|
4757
4785
|
delete designRequest.client;
|
|
@@ -4962,7 +4990,7 @@ var MagicLabs = (() => {
|
|
|
4962
4990
|
retrieve(imageId, bookId) {
|
|
4963
4991
|
return handleAsyncFunction(async () => {
|
|
4964
4992
|
const res = await this.engineAPI.fetcher.call({
|
|
4965
|
-
path: `/v1/images/${imageId}/book/${bookId}
|
|
4993
|
+
path: `/v1/images/${imageId}/book/${bookId}`
|
|
4966
4994
|
});
|
|
4967
4995
|
return imageServerSchema.parse(res);
|
|
4968
4996
|
});
|
|
@@ -4970,7 +4998,7 @@ var MagicLabs = (() => {
|
|
|
4970
4998
|
update(imageId, bookId, image) {
|
|
4971
4999
|
return handleAsyncFunction(async () => {
|
|
4972
5000
|
const res = await this.engineAPI.fetcher.call({
|
|
4973
|
-
path: `/v1/images/${imageId}/book/${bookId}
|
|
5001
|
+
path: `/v1/images/${imageId}/book/${bookId}`,
|
|
4974
5002
|
options: {
|
|
4975
5003
|
method: "PUT",
|
|
4976
5004
|
body: cleanJSON(image)
|
|
@@ -4982,7 +5010,7 @@ var MagicLabs = (() => {
|
|
|
4982
5010
|
delete(imageId, bookId) {
|
|
4983
5011
|
return handleAsyncFunction(async () => {
|
|
4984
5012
|
await this.engineAPI.fetcher.call({
|
|
4985
|
-
path: `/v1/images/${imageId}/book/${bookId}
|
|
5013
|
+
path: `/v1/images/${imageId}/book/${bookId}`,
|
|
4986
5014
|
options: {
|
|
4987
5015
|
method: "DELETE"
|
|
4988
5016
|
}
|
package/index.js
CHANGED
|
@@ -317,7 +317,19 @@ var styles = {
|
|
|
317
317
|
"03f332e3b2b947ebae73b67a9a22b6f4": { slug: "winter-sparkle-snap" },
|
|
318
318
|
"97f70f6cdb5244a08d45772cccfa2788": { slug: "year-of-memories-snap" }
|
|
319
319
|
};
|
|
320
|
-
var bookSizes = [
|
|
320
|
+
var bookSizes = [
|
|
321
|
+
"4.5x4",
|
|
322
|
+
"5x7",
|
|
323
|
+
"6x6",
|
|
324
|
+
"6x8",
|
|
325
|
+
"7x5",
|
|
326
|
+
"8x8",
|
|
327
|
+
"8x11",
|
|
328
|
+
"10x10",
|
|
329
|
+
"11x8",
|
|
330
|
+
"11x14",
|
|
331
|
+
"12x12"
|
|
332
|
+
];
|
|
321
333
|
var coverTypes = ["sc", "hc", "pl"];
|
|
322
334
|
var pageTypes = ["sp", "sl", "dl"];
|
|
323
335
|
var imageDensities = ["low", "medium", "high"];
|
|
@@ -4423,21 +4435,34 @@ var Images = class {
|
|
|
4423
4435
|
constructor(client, parentId, designRequestState) {
|
|
4424
4436
|
this.client = client;
|
|
4425
4437
|
this.parentId = parentId;
|
|
4426
|
-
this.
|
|
4427
|
-
this.length = this.
|
|
4438
|
+
this.list = [];
|
|
4439
|
+
this.length = this.list.length;
|
|
4428
4440
|
this.designRequestState = designRequestState;
|
|
4429
4441
|
}
|
|
4430
4442
|
parentId;
|
|
4431
|
-
|
|
4443
|
+
list;
|
|
4432
4444
|
length;
|
|
4433
4445
|
designRequestState;
|
|
4434
4446
|
async add(image) {
|
|
4435
4447
|
if (!canSubmitDesignRequest(this.designRequestState)) {
|
|
4436
4448
|
throw new Error("You need to wait for the current design request to be ready before adding new images.");
|
|
4437
4449
|
} else {
|
|
4438
|
-
this.images.
|
|
4439
|
-
|
|
4440
|
-
|
|
4450
|
+
const serverImage = await this.client.engineAPI.images.addToBook(this.parentId, new ImageServer(image));
|
|
4451
|
+
const img = imageServerToImage(serverImage);
|
|
4452
|
+
this.list.push(img);
|
|
4453
|
+
this.length = this.list.length;
|
|
4454
|
+
return new Promise((resolve) => {
|
|
4455
|
+
resolve(img);
|
|
4456
|
+
});
|
|
4457
|
+
}
|
|
4458
|
+
}
|
|
4459
|
+
async delete(imageId) {
|
|
4460
|
+
if (!canSubmitDesignRequest(this.designRequestState)) {
|
|
4461
|
+
throw new Error("You need to wait for the current design request to be ready before deleting images.");
|
|
4462
|
+
} else {
|
|
4463
|
+
await this.client.engineAPI.images.delete(imageId, this.parentId);
|
|
4464
|
+
this.list.splice(this.list.findIndex((image) => image.handle === imageId), 1);
|
|
4465
|
+
this.length = this.list.length;
|
|
4441
4466
|
return new Promise((resolve) => {
|
|
4442
4467
|
resolve(this.length);
|
|
4443
4468
|
});
|
|
@@ -4458,6 +4483,7 @@ var imageServerSchema = z.object({
|
|
|
4458
4483
|
metadata: z.record(z.unknown()).optional()
|
|
4459
4484
|
});
|
|
4460
4485
|
var ImageServer = class {
|
|
4486
|
+
id;
|
|
4461
4487
|
handle;
|
|
4462
4488
|
url;
|
|
4463
4489
|
width;
|
|
@@ -4469,6 +4495,7 @@ var ImageServer = class {
|
|
|
4469
4495
|
filename;
|
|
4470
4496
|
metadata;
|
|
4471
4497
|
constructor(image) {
|
|
4498
|
+
this.id = image.id;
|
|
4472
4499
|
this.handle = image.handle;
|
|
4473
4500
|
this.url = image.url;
|
|
4474
4501
|
this.width = image.width;
|
|
@@ -4483,6 +4510,7 @@ var ImageServer = class {
|
|
|
4483
4510
|
};
|
|
4484
4511
|
function imageServerToImage(imageServer) {
|
|
4485
4512
|
return {
|
|
4513
|
+
id: imageServer.id,
|
|
4486
4514
|
handle: imageServer.handle,
|
|
4487
4515
|
url: imageServer.url,
|
|
4488
4516
|
width: imageServer.width,
|
|
@@ -4693,7 +4721,7 @@ var DesignRequest = class {
|
|
|
4693
4721
|
toBook() {
|
|
4694
4722
|
const designRequest = {
|
|
4695
4723
|
...this,
|
|
4696
|
-
images: this.images
|
|
4724
|
+
images: this.images.list
|
|
4697
4725
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4698
4726
|
};
|
|
4699
4727
|
delete designRequest.client;
|
|
@@ -4916,7 +4944,7 @@ var ImagesEndpoints = class {
|
|
|
4916
4944
|
retrieve(imageId, bookId) {
|
|
4917
4945
|
return handleAsyncFunction(async () => {
|
|
4918
4946
|
const res = await this.engineAPI.fetcher.call({
|
|
4919
|
-
path: `/v1/images/${imageId}/book/${bookId}
|
|
4947
|
+
path: `/v1/images/${imageId}/book/${bookId}`
|
|
4920
4948
|
});
|
|
4921
4949
|
return imageServerSchema.parse(res);
|
|
4922
4950
|
});
|
|
@@ -4924,7 +4952,7 @@ var ImagesEndpoints = class {
|
|
|
4924
4952
|
update(imageId, bookId, image) {
|
|
4925
4953
|
return handleAsyncFunction(async () => {
|
|
4926
4954
|
const res = await this.engineAPI.fetcher.call({
|
|
4927
|
-
path: `/v1/images/${imageId}/book/${bookId}
|
|
4955
|
+
path: `/v1/images/${imageId}/book/${bookId}`,
|
|
4928
4956
|
options: {
|
|
4929
4957
|
method: "PUT",
|
|
4930
4958
|
body: cleanJSON(image)
|
|
@@ -4936,7 +4964,7 @@ var ImagesEndpoints = class {
|
|
|
4936
4964
|
delete(imageId, bookId) {
|
|
4937
4965
|
return handleAsyncFunction(async () => {
|
|
4938
4966
|
await this.engineAPI.fetcher.call({
|
|
4939
|
-
path: `/v1/images/${imageId}/book/${bookId}
|
|
4967
|
+
path: `/v1/images/${imageId}/book/${bookId}`,
|
|
4940
4968
|
options: {
|
|
4941
4969
|
method: "DELETE"
|
|
4942
4970
|
}
|