@mynthio/sdk 0.0.48 → 0.0.49

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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as AvailableVideoModel, c as VideoResolutionTier, i as AvailableModel, n as AVAILABLE_MODELS, o as ModelCapability, r as AVAILABLE_VIDEO_MODELS, s as VideoInputRole, t as MynthSDKTypes } from "./types.js";
1
+ import { _ as AvailableVideoModel, a as ImageRemoveBackgroundResult, b as VideoResolutionTier, c as MynthGeneratedImage, d as MynthCompletedTask, f as MynthTaskFailure, g as AvailableModel, h as AVAILABLE_VIDEO_MODELS, i as ImageReviewResult, l as MynthOutputImage, m as AVAILABLE_MODELS, n as MynthOutputVideo, o as ImageRateResult, p as MynthSDKTypes, r as ImageUpscaleResult, s as ImageGenerationResult, t as VideoGenerationResult, u as ImageAltResult, v as ModelCapability, y as VideoInputRole } from "./video-generation-result.js";
2
2
  //#region src/client.d.ts
3
3
  /**
4
4
  * Error thrown when an API request fails.
@@ -48,179 +48,6 @@ declare class MynthClient {
48
48
  getOrThrow<DataType>(path: string, options?: MynthClientRequestOptions): Promise<DataType>;
49
49
  }
50
50
  //#endregion
51
- //#region src/image-alt-result.d.ts
52
- /**
53
- * Represents the result of a completed image alt text task.
54
- */
55
- export declare class ImageAltResult {
56
- /** The task ID created for this alt text request */
57
- readonly taskId: string;
58
- /** Cost charged for the completed task */
59
- readonly cost: string;
60
- /** Generated alt text */
61
- readonly alt: string;
62
- constructor(data: {
63
- taskId: string;
64
- cost: string;
65
- alt: string;
66
- });
67
- static fromTaskData(data: MynthSDKTypes.ImageAltTaskData): ImageAltResult;
68
- }
69
- //#endregion
70
- //#region src/image-generation-result.d.ts
71
- type TypedImageResultImageSuccess<RatingT> = Omit<MynthSDKTypes.ImageResultImageSuccess, "rating"> & {
72
- rating?: RatingT;
73
- };
74
- type TypedImageResultImageFailure = MynthSDKTypes.ImageResultImageFailure;
75
- type TypedImageResultImage<RatingT> = TypedImageResultImageSuccess<RatingT> | TypedImageResultImageFailure;
76
- type TypedImageResult<RatingT> = Omit<MynthSDKTypes.ImageResult, "images"> & {
77
- images: TypedImageResultImage<RatingT>[];
78
- };
79
- /**
80
- * Represents a completed image generation task.
81
- *
82
- * @template MetadataT - Type of the metadata attached to the request
83
- * @template RatingT - Type of the rating response
84
- */
85
- export declare class ImageGenerationResult<MetadataT = Record<string, unknown> | undefined, RatingT = MynthSDKTypes.ImageResultRating | undefined> {
86
- /** Raw task data from the API */
87
- readonly data: MynthSDKTypes.ImageGenerationTaskData;
88
- constructor(data: MynthSDKTypes.ImageGenerationTaskData);
89
- /** Unique identifier for this task */
90
- get id(): string;
91
- /** Current status of the task */
92
- get status(): MynthSDKTypes.TaskStatus;
93
- /**
94
- * The generation result: images, the format each one was delivered in, and the model.
95
- * Returns `null` if the task hasn't completed yet.
96
- */
97
- get result(): TypedImageResult<RatingT> | null;
98
- /** Whether the task completed successfully */
99
- get isCompleted(): boolean;
100
- /** Whether the task failed */
101
- get isFailed(): boolean;
102
- /**
103
- * Get all successfully generated image URLs.
104
- * Convenience method that extracts just the URLs from successful images.
105
- * Images delivered only to a user destination may have a `null` url and are omitted here;
106
- * use `getImages()` and read `mynth_url` to access the CDN URL directly.
107
- */
108
- get urls(): string[];
109
- /**
110
- * Get generated images from the task result.
111
- *
112
- * @param options.includeFailed - If true, includes failed image results
113
- * @returns Array of image results
114
- */
115
- getImages(options: {
116
- includeFailed: true;
117
- }): TypedImageResultImage<RatingT>[];
118
- getImages(options?: {
119
- includeFailed?: false;
120
- }): TypedImageResultImageSuccess<RatingT>[];
121
- /**
122
- * Get the metadata that was attached to the generation request.
123
- */
124
- getMetadata(): MetadataT;
125
- }
126
- //#endregion
127
- //#region src/image-rate-result.d.ts
128
- /**
129
- * Represents the result of a completed image content rating task.
130
- *
131
- * @template LevelT - Union of possible rating level strings (e.g. `"sfw" | "nsfw"`)
132
- */
133
- export declare class ImageRateResult<LevelT extends string = "sfw" | "nsfw"> {
134
- /** The task ID created for this rating request */
135
- readonly taskId: string;
136
- /** Cost charged for the completed task */
137
- readonly cost: string;
138
- /** Assigned rating level */
139
- readonly level: LevelT;
140
- constructor(data: {
141
- taskId: string;
142
- cost: string;
143
- level: LevelT;
144
- });
145
- static fromTaskData<LevelT extends string = "sfw" | "nsfw">(data: MynthSDKTypes.ImageRateTaskData): ImageRateResult<LevelT>;
146
- }
147
- //#endregion
148
- //#region src/image-remove-background-result.d.ts
149
- /**
150
- * Represents the result of a completed image background removal task.
151
- *
152
- * @template MetadataT - Type of the metadata attached to the request
153
- */
154
- export declare class ImageRemoveBackgroundResult<MetadataT = Record<string, unknown> | undefined> {
155
- /** The task ID created for this request */
156
- readonly taskId: string;
157
- /** Cost charged for the completed task */
158
- readonly cost: string;
159
- /** The image with its background removed */
160
- readonly image: MynthSDKTypes.ImageRemoveBackgroundResultImage;
161
- /** Metadata attached to the request */
162
- readonly metadata: MetadataT;
163
- constructor(data: {
164
- taskId: string;
165
- cost: string;
166
- image: MynthSDKTypes.ImageRemoveBackgroundResultImage;
167
- metadata: MetadataT;
168
- });
169
- static fromTaskData<MetadataT = Record<string, unknown> | undefined>(data: MynthSDKTypes.ImageRemoveBackgroundTaskData): ImageRemoveBackgroundResult<MetadataT>;
170
- }
171
- //#endregion
172
- //#region src/image-review-result.d.ts
173
- /**
174
- * Represents the result of a completed image quality review task.
175
- */
176
- export declare class ImageReviewResult {
177
- /** The task ID created for this review request */
178
- readonly taskId: string;
179
- /** Cost charged for the completed task */
180
- readonly cost: string;
181
- /** Median reviewer score from 1 to 4. Higher is better. */
182
- readonly score: number;
183
- /** Review summary */
184
- readonly summary: string;
185
- /** Defects found by the reviewer panel */
186
- readonly findings: MynthSDKTypes.ImageReviewFinding[];
187
- /** Strengths identified by the reviewer panel */
188
- readonly strengths: MynthSDKTypes.ImageReviewStrength[];
189
- constructor(data: {
190
- taskId: string;
191
- cost: string;
192
- score: number;
193
- summary: string;
194
- findings: MynthSDKTypes.ImageReviewFinding[];
195
- strengths: MynthSDKTypes.ImageReviewStrength[];
196
- });
197
- static fromTaskData(data: MynthSDKTypes.ImageReviewTaskData): ImageReviewResult;
198
- }
199
- //#endregion
200
- //#region src/image-upscale-result.d.ts
201
- /**
202
- * Represents the result of a completed image upscale task.
203
- *
204
- * @template MetadataT - Type of the metadata attached to the request
205
- */
206
- export declare class ImageUpscaleResult<MetadataT = Record<string, unknown> | undefined> {
207
- /** The task ID created for this request */
208
- readonly taskId: string;
209
- /** Cost charged for the completed task */
210
- readonly cost: string;
211
- /** The upscaled image */
212
- readonly image: MynthSDKTypes.ImageUpscaleResultImage;
213
- /** Metadata attached to the request */
214
- readonly metadata: MetadataT;
215
- constructor(data: {
216
- taskId: string;
217
- cost: string;
218
- image: MynthSDKTypes.ImageUpscaleResultImage;
219
- metadata: MetadataT;
220
- });
221
- static fromTaskData<MetadataT = Record<string, unknown> | undefined>(data: MynthSDKTypes.ImageUpscaleTaskData): ImageUpscaleResult<MetadataT>;
222
- }
223
- //#endregion
224
51
  //#region src/task-async.d.ts
225
52
  /**
226
53
  * Polling cadence overrides. Anything omitted keeps the image-task default.
@@ -329,52 +156,6 @@ export declare class TaskAsync<ResultT> {
329
156
  private sleep;
330
157
  }
331
158
  //#endregion
332
- //#region src/video-generation-result.d.ts
333
- /**
334
- * Represents a completed video generation task.
335
- *
336
- * @template MetadataT - Type of the metadata attached to the request
337
- */
338
- export declare class VideoGenerationResult<MetadataT = Record<string, unknown> | undefined> {
339
- /** Raw task data from the API */
340
- readonly data: MynthSDKTypes.VideoGenerationTaskData;
341
- constructor(data: MynthSDKTypes.VideoGenerationTaskData);
342
- /** Unique identifier for this task */
343
- get id(): string;
344
- /** Current status of the task */
345
- get status(): MynthSDKTypes.TaskStatus;
346
- /**
347
- * The generation result containing videos and model info.
348
- * Returns `null` if the task hasn't completed yet.
349
- */
350
- get result(): MynthSDKTypes.VideoResult | null;
351
- /** Whether the task completed successfully */
352
- get isCompleted(): boolean;
353
- /** Whether the task failed */
354
- get isFailed(): boolean;
355
- /**
356
- * Get all successfully generated video URLs.
357
- * Convenience method that extracts just the URLs from successful videos.
358
- */
359
- get urls(): string[];
360
- /**
361
- * Get generated videos from the task result.
362
- *
363
- * @param options.includeFailed - If true, includes failed video results
364
- * @returns Array of video results
365
- */
366
- getVideos(options: {
367
- includeFailed: true;
368
- }): MynthSDKTypes.VideoResultVideo[];
369
- getVideos(options?: {
370
- includeFailed?: false;
371
- }): MynthSDKTypes.VideoResultVideoSuccess[];
372
- /**
373
- * Get the metadata that was attached to the generation request.
374
- */
375
- getMetadata(): MetadataT;
376
- }
377
- //#endregion
378
159
  //#region src/index.d.ts
379
160
  /**
380
161
  * Configuration options for the Mynth client.
@@ -855,4 +636,4 @@ declare class Mynth {
855
636
  get video(): MynthVideo;
856
637
  }
857
638
  //#endregion
858
- export { AVAILABLE_MODELS, AVAILABLE_VIDEO_MODELS, type AvailableModel, type AvailableVideoModel, type ModelCapability, Mynth, Mynth as default, type MynthAPIErrorIssue, MynthImage, type MynthModel, type MynthModelPricing, MynthModels, type MynthOptions, type MynthRequestOptions, type MynthSDKTypes, MynthVideo, type TaskAsyncAccess, type TaskAsyncWaitOptions, type VideoInputRole, type VideoResolutionTier };
639
+ export { AVAILABLE_MODELS, AVAILABLE_VIDEO_MODELS, type AvailableModel, type AvailableVideoModel, type ImageAltResult, type ImageGenerationResult, type ImageRateResult, type ImageRemoveBackgroundResult, type ImageReviewResult, type ImageUpscaleResult, type ModelCapability, Mynth, Mynth as default, type MynthAPIErrorIssue, type MynthCompletedTask, type MynthGeneratedImage, MynthImage, type MynthModel, type MynthModelPricing, MynthModels, type MynthOptions, type MynthOutputImage, type MynthOutputVideo, type MynthRequestOptions, type MynthSDKTypes, type MynthTaskFailure, MynthVideo, type TaskAsyncAccess, type TaskAsyncWaitOptions, type VideoGenerationResult, type VideoInputRole, type VideoResolutionTier };
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { a as toImageUpscaleResult, c as toImageRateResult, l as toImageGenerationResult, n as completedTaskFromData, o as toImageReviewResult, s as toImageRemoveBackgroundResult, t as toVideoGenerationResult, u as toImageAltResult } from "./video-generation-result.js";
1
2
  //#region src/constants.ts
2
3
  /** Base URL for the Mynth API */
3
4
  const API_URL = "https://api.mynth.io";
@@ -483,221 +484,6 @@ var MynthClient = class {
483
484
  }
484
485
  };
485
486
  //#endregion
486
- //#region src/image-alt-result.ts
487
- /**
488
- * Represents the result of a completed image alt text task.
489
- */
490
- var ImageAltResult = class ImageAltResult {
491
- /** The task ID created for this alt text request */
492
- taskId;
493
- /** Cost charged for the completed task */
494
- cost;
495
- /** Generated alt text */
496
- alt;
497
- constructor(data) {
498
- this.taskId = data.taskId;
499
- this.cost = data.cost;
500
- this.alt = data.alt;
501
- }
502
- static fromTaskData(data) {
503
- if (data.status !== "completed" || data.result === null) throw new Error(`Image alt task ${data.id} is not completed`);
504
- if (data.cost === null) throw new Error(`Image alt task ${data.id} is missing cost`);
505
- return new ImageAltResult({
506
- taskId: data.id,
507
- cost: data.cost,
508
- alt: data.result.alt
509
- });
510
- }
511
- };
512
- //#endregion
513
- //#region src/image-generation-result.ts
514
- /**
515
- * Represents a completed image generation task.
516
- *
517
- * @template MetadataT - Type of the metadata attached to the request
518
- * @template RatingT - Type of the rating response
519
- */
520
- var ImageGenerationResult = class {
521
- /** Raw task data from the API */
522
- data;
523
- constructor(data) {
524
- this.data = data;
525
- }
526
- /** Unique identifier for this task */
527
- get id() {
528
- return this.data.id;
529
- }
530
- /** Current status of the task */
531
- get status() {
532
- return this.data.status;
533
- }
534
- /**
535
- * The generation result: images, the format each one was delivered in, and the model.
536
- * Returns `null` if the task hasn't completed yet.
537
- */
538
- get result() {
539
- return this.data.result;
540
- }
541
- /** Whether the task completed successfully */
542
- get isCompleted() {
543
- return this.data.status === "completed";
544
- }
545
- /** Whether the task failed */
546
- get isFailed() {
547
- return this.data.status === "failed";
548
- }
549
- /**
550
- * Get all successfully generated image URLs.
551
- * Convenience method that extracts just the URLs from successful images.
552
- * Images delivered only to a user destination may have a `null` url and are omitted here;
553
- * use `getImages()` and read `mynth_url` to access the CDN URL directly.
554
- */
555
- get urls() {
556
- return this.data.result?.images.filter((img) => img.status === "success").map((img) => img.url).filter((url) => url !== null) ?? [];
557
- }
558
- getImages(options = {}) {
559
- if (options.includeFailed) return this.data.result?.images ?? [];
560
- return this.data.result?.images.filter((image) => image.status === "success") ?? [];
561
- }
562
- /**
563
- * Get the metadata that was attached to the generation request.
564
- */
565
- getMetadata() {
566
- return this.data.request?.metadata;
567
- }
568
- };
569
- //#endregion
570
- //#region src/image-rate-result.ts
571
- /**
572
- * Represents the result of a completed image content rating task.
573
- *
574
- * @template LevelT - Union of possible rating level strings (e.g. `"sfw" | "nsfw"`)
575
- */
576
- var ImageRateResult = class ImageRateResult {
577
- /** The task ID created for this rating request */
578
- taskId;
579
- /** Cost charged for the completed task */
580
- cost;
581
- /** Assigned rating level */
582
- level;
583
- constructor(data) {
584
- this.taskId = data.taskId;
585
- this.cost = data.cost;
586
- this.level = data.level;
587
- }
588
- static fromTaskData(data) {
589
- if (data.status !== "completed" || data.result === null) throw new Error(`Image rate task ${data.id} is not completed`);
590
- if (data.cost === null) throw new Error(`Image rate task ${data.id} is missing cost`);
591
- return new ImageRateResult({
592
- taskId: data.id,
593
- cost: data.cost,
594
- level: data.result.level
595
- });
596
- }
597
- };
598
- //#endregion
599
- //#region src/image-remove-background-result.ts
600
- /**
601
- * Represents the result of a completed image background removal task.
602
- *
603
- * @template MetadataT - Type of the metadata attached to the request
604
- */
605
- var ImageRemoveBackgroundResult = class ImageRemoveBackgroundResult {
606
- /** The task ID created for this request */
607
- taskId;
608
- /** Cost charged for the completed task */
609
- cost;
610
- /** The image with its background removed */
611
- image;
612
- /** Metadata attached to the request */
613
- metadata;
614
- constructor(data) {
615
- this.taskId = data.taskId;
616
- this.cost = data.cost;
617
- this.image = data.image;
618
- this.metadata = data.metadata;
619
- }
620
- static fromTaskData(data) {
621
- if (data.status !== "completed" || data.result === null) throw new Error(`Image remove background task ${data.id} is not completed`);
622
- if (data.cost === null) throw new Error(`Image remove background task ${data.id} is missing cost`);
623
- return new ImageRemoveBackgroundResult({
624
- taskId: data.id,
625
- cost: data.cost,
626
- image: data.result.image,
627
- metadata: data.request.metadata
628
- });
629
- }
630
- };
631
- //#endregion
632
- //#region src/image-review-result.ts
633
- /**
634
- * Represents the result of a completed image quality review task.
635
- */
636
- var ImageReviewResult = class ImageReviewResult {
637
- /** The task ID created for this review request */
638
- taskId;
639
- /** Cost charged for the completed task */
640
- cost;
641
- /** Median reviewer score from 1 to 4. Higher is better. */
642
- score;
643
- /** Review summary */
644
- summary;
645
- /** Defects found by the reviewer panel */
646
- findings;
647
- /** Strengths identified by the reviewer panel */
648
- strengths;
649
- constructor(data) {
650
- this.taskId = data.taskId;
651
- this.cost = data.cost;
652
- this.score = data.score;
653
- this.summary = data.summary;
654
- this.findings = data.findings;
655
- this.strengths = data.strengths;
656
- }
657
- static fromTaskData(data) {
658
- if (data.status !== "completed" || data.result === null) throw new Error(`Image review task ${data.id} is not completed`);
659
- if (data.cost === null) throw new Error(`Image review task ${data.id} is missing cost`);
660
- return new ImageReviewResult({
661
- taskId: data.id,
662
- cost: data.cost,
663
- ...data.result
664
- });
665
- }
666
- };
667
- //#endregion
668
- //#region src/image-upscale-result.ts
669
- /**
670
- * Represents the result of a completed image upscale task.
671
- *
672
- * @template MetadataT - Type of the metadata attached to the request
673
- */
674
- var ImageUpscaleResult = class ImageUpscaleResult {
675
- /** The task ID created for this request */
676
- taskId;
677
- /** Cost charged for the completed task */
678
- cost;
679
- /** The upscaled image */
680
- image;
681
- /** Metadata attached to the request */
682
- metadata;
683
- constructor(data) {
684
- this.taskId = data.taskId;
685
- this.cost = data.cost;
686
- this.image = data.image;
687
- this.metadata = data.metadata;
688
- }
689
- static fromTaskData(data) {
690
- if (data.status !== "completed" || data.result === null) throw new Error(`Image upscale task ${data.id} is not completed`);
691
- if (data.cost === null) throw new Error(`Image upscale task ${data.id} is missing cost`);
692
- return new ImageUpscaleResult({
693
- taskId: data.id,
694
- cost: data.cost,
695
- image: data.result.image,
696
- metadata: data.request.metadata
697
- });
698
- }
699
- };
700
- //#endregion
701
487
  //#region src/task-async.ts
702
488
  const POLLING_TIMEOUT_MS = 18e5;
703
489
  const FAST_POLLING_DURATION_MS = 12e3;
@@ -1039,60 +825,6 @@ async function resolveInputs(client, inputs, { signal } = {}) {
1039
825
  });
1040
826
  }
1041
827
  //#endregion
1042
- //#region src/video-generation-result.ts
1043
- /**
1044
- * Represents a completed video generation task.
1045
- *
1046
- * @template MetadataT - Type of the metadata attached to the request
1047
- */
1048
- var VideoGenerationResult = class {
1049
- /** Raw task data from the API */
1050
- data;
1051
- constructor(data) {
1052
- this.data = data;
1053
- }
1054
- /** Unique identifier for this task */
1055
- get id() {
1056
- return this.data.id;
1057
- }
1058
- /** Current status of the task */
1059
- get status() {
1060
- return this.data.status;
1061
- }
1062
- /**
1063
- * The generation result containing videos and model info.
1064
- * Returns `null` if the task hasn't completed yet.
1065
- */
1066
- get result() {
1067
- return this.data.result;
1068
- }
1069
- /** Whether the task completed successfully */
1070
- get isCompleted() {
1071
- return this.data.status === "completed";
1072
- }
1073
- /** Whether the task failed */
1074
- get isFailed() {
1075
- return this.data.status === "failed";
1076
- }
1077
- /**
1078
- * Get all successfully generated video URLs.
1079
- * Convenience method that extracts just the URLs from successful videos.
1080
- */
1081
- get urls() {
1082
- return this.getVideos().map((video) => video.url);
1083
- }
1084
- getVideos(options = {}) {
1085
- if (options.includeFailed) return this.data.result?.videos ?? [];
1086
- return this.data.result?.videos.filter((video) => video.status === "success") ?? [];
1087
- }
1088
- /**
1089
- * Get the metadata that was attached to the generation request.
1090
- */
1091
- getMetadata() {
1092
- return this.data.request?.metadata;
1093
- }
1094
- };
1095
- //#endregion
1096
828
  //#region src/index.ts
1097
829
  /**
1098
830
  * Attempts to read the API key from environment variables.
@@ -1214,7 +946,7 @@ var MynthImage = class {
1214
946
  return new TaskAsync(data.taskId, {
1215
947
  client: this.client,
1216
948
  pat: data.access?.publicAccessToken,
1217
- resultFactory: (data) => new ImageGenerationResult(data)
949
+ resultFactory: (data) => toImageGenerationResult(completedTaskFromData(data, "Image generation"))
1218
950
  });
1219
951
  }
1220
952
  /**
@@ -1283,7 +1015,7 @@ var MynthImage = class {
1283
1015
  })).data;
1284
1016
  return new TaskAsync(data.taskId, {
1285
1017
  client: this.client,
1286
- resultFactory: (taskData) => ImageRateResult.fromTaskData(taskData)
1018
+ resultFactory: (taskData) => toImageRateResult(completedTaskFromData(taskData, "Image rate"))
1287
1019
  });
1288
1020
  }
1289
1021
  /**
@@ -1325,7 +1057,7 @@ var MynthImage = class {
1325
1057
  const data = (await this.client.post(ALT_IMAGE_PATH, { url })).data;
1326
1058
  return new TaskAsync(data.taskId, {
1327
1059
  client: this.client,
1328
- resultFactory: (taskData) => ImageAltResult.fromTaskData(taskData)
1060
+ resultFactory: (taskData) => toImageAltResult(completedTaskFromData(taskData, "Image alt"))
1329
1061
  });
1330
1062
  }
1331
1063
  /**
@@ -1362,7 +1094,7 @@ var MynthImage = class {
1362
1094
  })).data;
1363
1095
  return new TaskAsync(data.taskId, {
1364
1096
  client: this.client,
1365
- resultFactory: (taskData) => ImageReviewResult.fromTaskData(taskData)
1097
+ resultFactory: (taskData) => toImageReviewResult(completedTaskFromData(taskData, "Image review"))
1366
1098
  });
1367
1099
  }
1368
1100
  /**
@@ -1410,7 +1142,7 @@ var MynthImage = class {
1410
1142
  return new TaskAsync(data.taskId, {
1411
1143
  client: this.client,
1412
1144
  pat: data.access?.publicAccessToken,
1413
- resultFactory: (taskData) => ImageRemoveBackgroundResult.fromTaskData(taskData)
1145
+ resultFactory: (taskData) => toImageRemoveBackgroundResult(completedTaskFromData(taskData, "Image remove background"))
1414
1146
  });
1415
1147
  }
1416
1148
  /**
@@ -1459,7 +1191,7 @@ var MynthImage = class {
1459
1191
  return new TaskAsync(data.taskId, {
1460
1192
  client: this.client,
1461
1193
  pat: data.access?.publicAccessToken,
1462
- resultFactory: (taskData) => ImageUpscaleResult.fromTaskData(taskData)
1194
+ resultFactory: (taskData) => toImageUpscaleResult(completedTaskFromData(taskData, "Image upscale"))
1463
1195
  });
1464
1196
  }
1465
1197
  };
@@ -1598,7 +1330,7 @@ var MynthVideo = class {
1598
1330
  client: this.client,
1599
1331
  pat: data.access?.publicAccessToken,
1600
1332
  polling: VIDEO_POLLING,
1601
- resultFactory: (taskData) => new VideoGenerationResult(taskData)
1333
+ resultFactory: (taskData) => toVideoGenerationResult(completedTaskFromData(taskData, "Video generation"))
1602
1334
  });
1603
1335
  }
1604
1336
  };
@@ -1675,4 +1407,4 @@ var Mynth = class {
1675
1407
  }
1676
1408
  };
1677
1409
  //#endregion
1678
- export { AVAILABLE_MODELS, AVAILABLE_VIDEO_MODELS, ImageAltResult, ImageGenerationResult, ImageRateResult, ImageRemoveBackgroundResult, ImageReviewResult, ImageUpscaleResult, Mynth, Mynth as default, MynthAPIError, MynthImage, MynthModels, MynthVideo, TaskAsync, TaskAsyncFetchError, TaskAsyncTaskFailedError, TaskAsyncTaskFetchError, TaskAsyncTimeoutError, TaskAsyncUnauthorizedError, VideoGenerationResult };
1410
+ export { AVAILABLE_MODELS, AVAILABLE_VIDEO_MODELS, Mynth, Mynth as default, MynthAPIError, MynthImage, MynthModels, MynthVideo, TaskAsync, TaskAsyncFetchError, TaskAsyncTaskFailedError, TaskAsyncTaskFetchError, TaskAsyncTimeoutError, TaskAsyncUnauthorizedError };
@@ -20,8 +20,8 @@ export type MynthWebhookHandlerOptions = WebhookHandlerOptions;
20
20
  * import { mynthWebhookHandler } from "@mynthio/sdk/next";
21
21
  *
22
22
  * export const POST = mynthWebhookHandler({
23
- * imageTaskCompleted: async (payload, { deliveryId }) => {
24
- * console.log(deliveryId, payload.task.id);
23
+ * imageTaskCompleted: async (result, { deliveryId }) => {
24
+ * console.log(deliveryId, result.taskId);
25
25
  * },
26
26
  * });
27
27
  * ```
@@ -9,8 +9,8 @@ import { t as handleWebhookRequest } from "../handler.js";
9
9
  * import { mynthWebhookHandler } from "@mynthio/sdk/next";
10
10
  *
11
11
  * export const POST = mynthWebhookHandler({
12
- * imageTaskCompleted: async (payload, { deliveryId }) => {
13
- * console.log(deliveryId, payload.task.id);
12
+ * imageTaskCompleted: async (result, { deliveryId }) => {
13
+ * console.log(deliveryId, result.taskId);
14
14
  * },
15
15
  * });
16
16
  * ```