magic-hour 0.27.0 → 0.29.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.
@@ -1,4 +1,4 @@
1
1
  export declare enum Environment {
2
2
  Environment = "https://api.magichour.ai",
3
- MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.27.0"
3
+ MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.29.0"
4
4
  }
@@ -4,5 +4,5 @@ exports.Environment = void 0;
4
4
  var Environment;
5
5
  (function (Environment) {
6
6
  Environment["Environment"] = "https://api.magichour.ai";
7
- Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.27.0";
7
+ Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.29.0";
8
8
  })(Environment || (exports.Environment = Environment = {}));
@@ -10,7 +10,7 @@ export type CreateRequest = {
10
10
  */
11
11
  assets: V1AiTalkingPhotoCreateBodyAssets;
12
12
  /**
13
- * The end time of the input audio in seconds. The maximum duration allowed is 30 seconds.
13
+ * The end time of the input audio in seconds. The maximum duration allowed is 60 seconds.
14
14
  */
15
15
  endSeconds: number;
16
16
  /**
@@ -18,7 +18,7 @@ export type CreateRequest = {
18
18
  */
19
19
  name?: string | undefined;
20
20
  /**
21
- * The start time of the input audio in seconds. The maximum duration allowed is 30 seconds.
21
+ * The start time of the input audio in seconds. The maximum duration allowed is 60 seconds.
22
22
  */
23
23
  startSeconds: number;
24
24
  /**
@@ -147,6 +147,8 @@ export { V1FaceSwapCreateResponse404MessageEnum } from "./v1-face-swap-create-re
147
147
  export { V1FaceSwapCreateResponse422 } from "./v1-face-swap-create-response422";
148
148
  export { V1FaceSwapPhotoCreateBody } from "./v1-face-swap-photo-create-body";
149
149
  export { V1FaceSwapPhotoCreateBodyAssets } from "./v1-face-swap-photo-create-body-assets";
150
+ export { V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem } from "./v1-face-swap-photo-create-body-assets-face-mappings-item";
151
+ export { V1FaceSwapPhotoCreateBodyAssetsFaceSwapModeEnum } from "./v1-face-swap-photo-create-body-assets-face-swap-mode-enum";
150
152
  export { V1FaceSwapPhotoCreateResponse } from "./v1-face-swap-photo-create-response";
151
153
  export { V1FaceSwapPhotoCreateResponse400 } from "./v1-face-swap-photo-create-response400";
152
154
  export { V1FaceSwapPhotoCreateResponse401 } from "./v1-face-swap-photo-create-response401";
@@ -10,7 +10,7 @@ export type V1AiTalkingPhotoCreateBody = {
10
10
  */
11
11
  assets: V1AiTalkingPhotoCreateBodyAssets;
12
12
  /**
13
- * The end time of the input audio in seconds. The maximum duration allowed is 30 seconds.
13
+ * The end time of the input audio in seconds. The maximum duration allowed is 60 seconds.
14
14
  */
15
15
  endSeconds: number;
16
16
  /**
@@ -18,7 +18,7 @@ export type V1AiTalkingPhotoCreateBody = {
18
18
  */
19
19
  name?: string | undefined;
20
20
  /**
21
- * The start time of the input audio in seconds. The maximum duration allowed is 30 seconds.
21
+ * The start time of the input audio in seconds. The maximum duration allowed is 60 seconds.
22
22
  */
23
23
  startSeconds: number;
24
24
  /**
@@ -0,0 +1,30 @@
1
+ import * as z from "zod";
2
+ /**
3
+ * V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem
4
+ */
5
+ export type V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem = {
6
+ /**
7
+ * The face image that will be used to replace the face in the `original_face`. This value can be either the `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls), or the url of the file.
8
+ */
9
+ newFace: string;
10
+ /**
11
+ * The face detected from the image in `target_file_path`. The file name is in the format of `<face_frame>-<face_index>.png`. This value is corresponds to the response in the face detection API [COMING SOON].
12
+ *
13
+ * * The face_frame is the frame number of the face in the target image. For images, the frame number is always 0.
14
+ * * The face_index is the index of the face in the target image, starting from 0 going left to right.
15
+ */
16
+ originalFace: string;
17
+ };
18
+ /**
19
+ * @internal
20
+ * V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem without any key transformation, this is what
21
+ * we expect to come in as network data
22
+ */
23
+ export type External$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem = {
24
+ new_face: string;
25
+ original_face: string;
26
+ };
27
+ export declare const Schemas$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem: {
28
+ in: z.ZodType<V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem, z.ZodTypeDef, unknown>;
29
+ out: z.ZodType<External$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem, z.ZodTypeDef, V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem>;
30
+ };
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Schemas$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem = void 0;
37
+ const core_1 = require("../core");
38
+ const z = __importStar(require("zod"));
39
+ /**
40
+ * Takes network data, validates it, and transforms keys to match typescript object V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem
41
+ */
42
+ const SchemaIn$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem = z
43
+ .object({
44
+ new_face: z.string(),
45
+ original_face: z.string(),
46
+ })
47
+ .transform((obj) => {
48
+ return (0, core_1.zodTransform)(obj, {
49
+ new_face: "newFace",
50
+ original_face: "originalFace",
51
+ });
52
+ });
53
+ /**
54
+ * @internal
55
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem
56
+ */
57
+ const SchemaOut$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem = z
58
+ .object({
59
+ newFace: z.string(),
60
+ originalFace: z.string(),
61
+ })
62
+ .transform((obj) => {
63
+ return (0, core_1.zodTransform)(obj, {
64
+ newFace: "new_face",
65
+ originalFace: "original_face",
66
+ });
67
+ });
68
+ exports.Schemas$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem = {
69
+ in: SchemaIn$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem,
70
+ out: SchemaOut$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem,
71
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The mode of face swap.
3
+ * * `all-faces` - Swap all faces in the target image. `source_file_path` is required.
4
+ * * `individual-faces` - Swap individual faces in the target image. `source_faces` is required.
5
+ */
6
+ export type V1FaceSwapPhotoCreateBodyAssetsFaceSwapModeEnum = "all-faces" | "individual-faces";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +1,25 @@
1
+ import { External$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem, V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem } from "./v1-face-swap-photo-create-body-assets-face-mappings-item";
1
2
  import * as z from "zod";
2
3
  /**
3
4
  * Provide the assets for face swap photo
4
5
  */
5
6
  export type V1FaceSwapPhotoCreateBodyAssets = {
6
7
  /**
7
- * This is the image from which the face is extracted. This value can be either the `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls), or the url of the file.
8
+ * This is the array of face mappings used for multiple face swap. The value is required if `face_swap_mode` is `individual-faces`.
8
9
  */
9
- sourceFilePath: string;
10
+ faceMappings?: V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem[] | undefined;
11
+ /**
12
+ * The mode of face swap.
13
+ * * `all-faces` - Swap all faces in the target image. `source_file_path` is required.
14
+ * * `individual-faces` - Swap individual faces in the target image. `source_faces` is required.
15
+ */
16
+ faceSwapMode?: ("all-faces" | "individual-faces") | undefined;
17
+ /**
18
+ * This is the image from which the face is extracted. The value is required if `face_swap_mode` is `all-faces`.
19
+ *
20
+ * This value can be either the `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls), or the url of the file.
21
+ */
22
+ sourceFilePath?: string | undefined;
10
23
  /**
11
24
  * This is the image where the face from the source image will be placed. This value can be either the `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls), or the url of the file.
12
25
  */
@@ -18,7 +31,9 @@ export type V1FaceSwapPhotoCreateBodyAssets = {
18
31
  * we expect to come in as network data
19
32
  */
20
33
  export type External$V1FaceSwapPhotoCreateBodyAssets = {
21
- source_file_path: string;
34
+ face_mappings?: External$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem[] | undefined;
35
+ face_swap_mode?: ("all-faces" | "individual-faces") | undefined;
36
+ source_file_path?: string | undefined;
22
37
  target_file_path: string;
23
38
  };
24
39
  export declare const Schemas$V1FaceSwapPhotoCreateBodyAssets: {
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Schemas$V1FaceSwapPhotoCreateBodyAssets = void 0;
37
+ const v1_face_swap_photo_create_body_assets_face_mappings_item_1 = require("./v1-face-swap-photo-create-body-assets-face-mappings-item");
37
38
  const core_1 = require("../core");
38
39
  const z = __importStar(require("zod"));
39
40
  /**
@@ -41,11 +42,17 @@ const z = __importStar(require("zod"));
41
42
  */
42
43
  const SchemaIn$V1FaceSwapPhotoCreateBodyAssets = z
43
44
  .object({
44
- source_file_path: z.string(),
45
+ face_mappings: z
46
+ .array(v1_face_swap_photo_create_body_assets_face_mappings_item_1.Schemas$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem.in)
47
+ .optional(),
48
+ face_swap_mode: z.enum(["all-faces", "individual-faces"]).optional(),
49
+ source_file_path: z.string().optional(),
45
50
  target_file_path: z.string(),
46
51
  })
47
52
  .transform((obj) => {
48
53
  return (0, core_1.zodTransform)(obj, {
54
+ face_mappings: "faceMappings",
55
+ face_swap_mode: "faceSwapMode",
49
56
  source_file_path: "sourceFilePath",
50
57
  target_file_path: "targetFilePath",
51
58
  });
@@ -56,11 +63,17 @@ const SchemaIn$V1FaceSwapPhotoCreateBodyAssets = z
56
63
  */
57
64
  const SchemaOut$V1FaceSwapPhotoCreateBodyAssets = z
58
65
  .object({
59
- sourceFilePath: z.string(),
66
+ faceMappings: z
67
+ .array(v1_face_swap_photo_create_body_assets_face_mappings_item_1.Schemas$V1FaceSwapPhotoCreateBodyAssetsFaceMappingsItem.out)
68
+ .optional(),
69
+ faceSwapMode: z.enum(["all-faces", "individual-faces"]).optional(),
70
+ sourceFilePath: z.string().optional(),
60
71
  targetFilePath: z.string(),
61
72
  })
62
73
  .transform((obj) => {
63
74
  return (0, core_1.zodTransform)(obj, {
75
+ faceMappings: "face_mappings",
76
+ faceSwapMode: "face_swap_mode",
64
77
  sourceFilePath: "source_file_path",
65
78
  targetFilePath: "target_file_path",
66
79
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "magic-hour",
3
- "version": "0.27.0",
3
+ "version": "0.29.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {