magic-hour 0.47.0 → 0.49.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.
Files changed (54) hide show
  1. package/README.md +0 -5
  2. package/dist/environment.d.ts +1 -1
  3. package/dist/environment.js +1 -1
  4. package/dist/resources/v1/index.d.ts +0 -1
  5. package/dist/resources/v1/index.js +1 -2
  6. package/dist/resources/v1/resource-client.d.ts +0 -3
  7. package/dist/resources/v1/resource-client.js +0 -6
  8. package/dist/types/index.d.ts +0 -4
  9. package/dist/types/v1-ai-talking-photo-create-body-style-generation-mode-enum.d.ts +8 -5
  10. package/dist/types/v1-ai-talking-photo-create-body-style.d.ts +15 -6
  11. package/dist/types/v1-ai-talking-photo-create-body-style.js +20 -2
  12. package/package.json +2 -2
  13. package/dist/core/api-error.d.ts +0 -6
  14. package/dist/core/api-error.js +0 -11
  15. package/dist/core/api-promise.d.ts +0 -28
  16. package/dist/core/api-promise.js +0 -252
  17. package/dist/core/auth.d.ts +0 -76
  18. package/dist/core/auth.js +0 -232
  19. package/dist/core/binary-response.d.ts +0 -6
  20. package/dist/core/binary-response.js +0 -10
  21. package/dist/core/content-type.d.ts +0 -4
  22. package/dist/core/content-type.js +0 -12
  23. package/dist/core/core-client.d.ts +0 -58
  24. package/dist/core/core-client.js +0 -168
  25. package/dist/core/form-data.d.ts +0 -26
  26. package/dist/core/form-data.js +0 -83
  27. package/dist/core/index.d.ts +0 -9
  28. package/dist/core/index.js +0 -28
  29. package/dist/core/logger.d.ts +0 -48
  30. package/dist/core/logger.js +0 -82
  31. package/dist/core/query.d.ts +0 -8
  32. package/dist/core/query.js +0 -77
  33. package/dist/core/runtime.d.ts +0 -4
  34. package/dist/core/runtime.js +0 -20
  35. package/dist/core/zod.d.ts +0 -13
  36. package/dist/core/zod.js +0 -60
  37. package/dist/examples/logging-example.d.ts +0 -10
  38. package/dist/examples/logging-example.js +0 -137
  39. package/dist/logging-client.d.ts +0 -39
  40. package/dist/logging-client.js +0 -116
  41. package/dist/resources/v1/ai-photo-editor/index.d.ts +0 -2
  42. package/dist/resources/v1/ai-photo-editor/index.js +0 -5
  43. package/dist/resources/v1/ai-photo-editor/request-types.d.ts +0 -41
  44. package/dist/resources/v1/ai-photo-editor/request-types.js +0 -85
  45. package/dist/resources/v1/ai-photo-editor/resource-client.d.ts +0 -65
  46. package/dist/resources/v1/ai-photo-editor/resource-client.js +0 -111
  47. package/dist/types/v1-ai-photo-editor-create-body-assets.d.ts +0 -27
  48. package/dist/types/v1-ai-photo-editor-create-body-assets.js +0 -67
  49. package/dist/types/v1-ai-photo-editor-create-body-style.d.ts +0 -57
  50. package/dist/types/v1-ai-photo-editor-create-body-style.js +0 -95
  51. package/dist/types/v1-ai-photo-editor-create-body.d.ts +0 -41
  52. package/dist/types/v1-ai-photo-editor-create-body.js +0 -85
  53. package/dist/types/v1-ai-photo-editor-create-response.d.ts +0 -34
  54. package/dist/types/v1-ai-photo-editor-create-response.js +0 -75
@@ -1,85 +0,0 @@
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$CreateRequest = void 0;
37
- const make_api_request_js_1 = require("make-api-request-js");
38
- const z = __importStar(require("zod"));
39
- const v1_ai_photo_editor_create_body_assets_1 = require("../../../types/v1-ai-photo-editor-create-body-assets");
40
- const v1_ai_photo_editor_create_body_style_1 = require("../../../types/v1-ai-photo-editor-create-body-style");
41
- /**
42
- * Takes network data, validates it, and transforms keys to match typescript object CreateRequest
43
- */
44
- const SchemaIn$CreateRequest = z
45
- .object({
46
- assets: v1_ai_photo_editor_create_body_assets_1.Schemas$V1AiPhotoEditorCreateBodyAssets.in,
47
- name: z.string().optional(),
48
- resolution: z.number().int(),
49
- steps: z.number().int().optional(),
50
- style: v1_ai_photo_editor_create_body_style_1.Schemas$V1AiPhotoEditorCreateBodyStyle.in,
51
- })
52
- .transform((obj) => {
53
- return (0, make_api_request_js_1.zodTransform)(obj, {
54
- assets: "assets",
55
- name: "name",
56
- resolution: "resolution",
57
- steps: "steps",
58
- style: "style",
59
- });
60
- });
61
- /**
62
- * @internal
63
- * Takes typescript data, validates it, and maps keys to match the expected external object External$CreateRequest
64
- */
65
- const SchemaOut$CreateRequest = z
66
- .object({
67
- assets: v1_ai_photo_editor_create_body_assets_1.Schemas$V1AiPhotoEditorCreateBodyAssets.out,
68
- name: z.string().optional(),
69
- resolution: z.number().int(),
70
- steps: z.number().int().optional(),
71
- style: v1_ai_photo_editor_create_body_style_1.Schemas$V1AiPhotoEditorCreateBodyStyle.out,
72
- })
73
- .transform((obj) => {
74
- return (0, make_api_request_js_1.zodTransform)(obj, {
75
- assets: "assets",
76
- name: "name",
77
- resolution: "resolution",
78
- steps: "steps",
79
- style: "style",
80
- });
81
- });
82
- exports.Schemas$CreateRequest = {
83
- in: SchemaIn$CreateRequest,
84
- out: SchemaOut$CreateRequest,
85
- };
@@ -1,65 +0,0 @@
1
- import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
2
- import { types } from "../../../index.js";
3
- import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type";
4
- import * as requests from "../../../resources/v1/ai-photo-editor/request-types";
5
- type GenerateRequest = GenerateRequestType<requests.CreateRequest, {
6
- /**
7
- * The image used to generate the output. This value is either
8
- * - a direct URL to the image file
9
- * - a path to a local file
10
- *
11
- * Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
12
- */
13
- imageFilePath: string;
14
- }>;
15
- export declare class AiPhotoEditorClient extends CoreResourceClient {
16
- constructor(coreClient: CoreClient, opts: ResourceClientOptions);
17
- /**
18
- * AI Photo Editor
19
- *
20
- * > **NOTE**: this API is still in early development stages, and should be avoided
21
- *
22
- * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
23
- *
24
- * @example
25
- * ```typescript
26
- * import Client from "../../../index.js";
27
- *
28
- * const client = new Client({ token: process.env["API_TOKEN"]!! });
29
- * const res = await client.v1.aiPhotoEditor.generate(
30
- * {
31
- * assets: { imageFilePath: "/path/to/1234.png" },
32
- * name: "Photo Editor image",
33
- * resolution: 768,
34
- * style: {
35
- * imageDescription: "A photo of a person",
36
- * likenessStrength: 5.2,
37
- * negativePrompt: "painting, cartoon, sketch",
38
- * prompt: "A photo portrait of a person wearing a hat",
39
- * promptStrength: 3.75,
40
- * steps: 4,
41
- * upscaleFactor: 2,
42
- * upscaleFidelity: 0.5,
43
- * },
44
- * },
45
- * {
46
- * waitForCompletion: true,
47
- * downloadOutputs: true,
48
- * downloadDirectory: "outputs",
49
- * },
50
- * );
51
- * ```
52
- */
53
- generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../image-projects/resource-client").V1ImageProjectsGetResponseWithDownloads>;
54
- /**
55
- * AI Photo Editor
56
- *
57
- * > **NOTE**: this API is still in early development stages, and should be avoided. Please reach out to us if you're interested in this API.
58
- *
59
- * Edit photo using AI. Each photo costs 10 credits.
60
- *
61
- * POST /v1/ai-photo-editor
62
- */
63
- create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1AiPhotoEditorCreateResponse>;
64
- }
65
- export {};
@@ -1,111 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.AiPhotoEditorClient = void 0;
24
- const make_api_request_js_1 = require("make-api-request-js");
25
- const logger_1 = require("../../../logger");
26
- const files_1 = require("../../../resources/v1/files");
27
- const image_projects_1 = require("../../../resources/v1/image-projects");
28
- const v1_ai_photo_editor_create_body_1 = require("../../../types/v1-ai-photo-editor-create-body");
29
- const v1_ai_photo_editor_create_response_1 = require("../../../types/v1-ai-photo-editor-create-response");
30
- class AiPhotoEditorClient extends make_api_request_js_1.CoreResourceClient {
31
- constructor(coreClient, opts) {
32
- super(coreClient, opts);
33
- }
34
- /**
35
- * AI Photo Editor
36
- *
37
- * > **NOTE**: this API is still in early development stages, and should be avoided
38
- *
39
- * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
40
- *
41
- * @example
42
- * ```typescript
43
- * import Client from "../../../index.js";
44
- *
45
- * const client = new Client({ token: process.env["API_TOKEN"]!! });
46
- * const res = await client.v1.aiPhotoEditor.generate(
47
- * {
48
- * assets: { imageFilePath: "/path/to/1234.png" },
49
- * name: "Photo Editor image",
50
- * resolution: 768,
51
- * style: {
52
- * imageDescription: "A photo of a person",
53
- * likenessStrength: 5.2,
54
- * negativePrompt: "painting, cartoon, sketch",
55
- * prompt: "A photo portrait of a person wearing a hat",
56
- * promptStrength: 3.75,
57
- * steps: 4,
58
- * upscaleFactor: 2,
59
- * upscaleFidelity: 0.5,
60
- * },
61
- * },
62
- * {
63
- * waitForCompletion: true,
64
- * downloadOutputs: true,
65
- * downloadDirectory: "outputs",
66
- * },
67
- * );
68
- * ```
69
- */
70
- generate(request_1) {
71
- return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
72
- const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
73
- const fileClient = new files_1.FilesClient(this._client, this._opts);
74
- const _a = request.assets, { imageFilePath } = _a, restAssets = __rest(_a, ["imageFilePath"]);
75
- (0, logger_1.getLogger)().debug(`Uploading file ${imageFilePath} to Magic Hour's storage`);
76
- const [uploadedImageFilePath] = yield Promise.all([
77
- fileClient.uploadFile(imageFilePath),
78
- ]);
79
- (0, logger_1.getLogger)().info(`Uploaded file ${imageFilePath} to Magic Hour's storage as ${uploadedImageFilePath}`);
80
- const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { imageFilePath: uploadedImageFilePath }) }), createOpts);
81
- (0, logger_1.getLogger)().info(`Created AiPhotoEditorClient project ${createResponse.id}`);
82
- const projectsClient = new image_projects_1.ImageProjectsClient(this._client, this._opts);
83
- (0, logger_1.getLogger)().debug(`Checking result for AiPhotoEditorClient project ${createResponse.id}`);
84
- const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
85
- downloadOutputs,
86
- downloadDirectory }, createOpts));
87
- return result;
88
- });
89
- }
90
- /**
91
- * AI Photo Editor
92
- *
93
- * > **NOTE**: this API is still in early development stages, and should be avoided. Please reach out to us if you're interested in this API.
94
- *
95
- * Edit photo using AI. Each photo costs 10 credits.
96
- *
97
- * POST /v1/ai-photo-editor
98
- */
99
- create(request, opts) {
100
- return this._client.makeRequest({
101
- method: "post",
102
- path: "/v1/ai-photo-editor",
103
- auth: ["bearerAuth"],
104
- contentType: "application/json",
105
- body: v1_ai_photo_editor_create_body_1.Schemas$V1AiPhotoEditorCreateBody.out.parse(request),
106
- responseSchema: v1_ai_photo_editor_create_response_1.Schemas$V1AiPhotoEditorCreateResponse.in,
107
- opts,
108
- });
109
- }
110
- }
111
- exports.AiPhotoEditorClient = AiPhotoEditorClient;
@@ -1,27 +0,0 @@
1
- import * as z from "zod";
2
- /**
3
- * Provide the assets for photo editor
4
- */
5
- export type V1AiPhotoEditorCreateBodyAssets = {
6
- /**
7
- * The image used to generate the output. This value is either
8
- * - a direct URL to the video file
9
- * - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
10
- *
11
- * See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details.
12
- *
13
- */
14
- imageFilePath: string;
15
- };
16
- /**
17
- * @internal
18
- * V1AiPhotoEditorCreateBodyAssets without any key transformation, this is what
19
- * we expect to come in as network data
20
- */
21
- export type External$V1AiPhotoEditorCreateBodyAssets = {
22
- image_file_path: string;
23
- };
24
- export declare const Schemas$V1AiPhotoEditorCreateBodyAssets: {
25
- in: z.ZodType<V1AiPhotoEditorCreateBodyAssets, z.ZodTypeDef, unknown>;
26
- out: z.ZodType<External$V1AiPhotoEditorCreateBodyAssets, z.ZodTypeDef, V1AiPhotoEditorCreateBodyAssets>;
27
- };
@@ -1,67 +0,0 @@
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$V1AiPhotoEditorCreateBodyAssets = void 0;
37
- const make_api_request_js_1 = require("make-api-request-js");
38
- const z = __importStar(require("zod"));
39
- /**
40
- * Takes network data, validates it, and transforms keys to match typescript object V1AiPhotoEditorCreateBodyAssets
41
- */
42
- const SchemaIn$V1AiPhotoEditorCreateBodyAssets = z
43
- .object({
44
- image_file_path: z.string(),
45
- })
46
- .transform((obj) => {
47
- return (0, make_api_request_js_1.zodTransform)(obj, {
48
- image_file_path: "imageFilePath",
49
- });
50
- });
51
- /**
52
- * @internal
53
- * Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiPhotoEditorCreateBodyAssets
54
- */
55
- const SchemaOut$V1AiPhotoEditorCreateBodyAssets = z
56
- .object({
57
- imageFilePath: z.string(),
58
- })
59
- .transform((obj) => {
60
- return (0, make_api_request_js_1.zodTransform)(obj, {
61
- imageFilePath: "image_file_path",
62
- });
63
- });
64
- exports.Schemas$V1AiPhotoEditorCreateBodyAssets = {
65
- in: SchemaIn$V1AiPhotoEditorCreateBodyAssets,
66
- out: SchemaOut$V1AiPhotoEditorCreateBodyAssets,
67
- };
@@ -1,57 +0,0 @@
1
- import * as z from "zod";
2
- /**
3
- * V1AiPhotoEditorCreateBodyStyle
4
- */
5
- export type V1AiPhotoEditorCreateBodyStyle = {
6
- /**
7
- * Use this to describe what your input image is. This helps maintain aspects of the image you don't want to change.
8
- */
9
- imageDescription: string;
10
- /**
11
- * Determines the input image's influence. Higher values align the output more with the initial image.
12
- */
13
- likenessStrength: number;
14
- /**
15
- * What you want to avoid seeing in the final output; has a minor effect.
16
- */
17
- negativePrompt?: string | undefined;
18
- /**
19
- * What you want your final output to look like. We recommend starting with the image description and making minor edits for best results.
20
- */
21
- prompt: string;
22
- /**
23
- * Determines the prompt's influence. Higher values align the output more with the prompt.
24
- */
25
- promptStrength: number;
26
- /**
27
- * Number of iterations used to generate the output. Higher values improve quality and increase the strength of the prompt but increase processing time.
28
- */
29
- steps?: number | undefined;
30
- /**
31
- * The multiplier applied to an image's original dimensions during the upscaling process. For example, a scale of 2 doubles the width and height (e.g., from 512x512 to 1024x1024).
32
- */
33
- upscaleFactor?: number | undefined;
34
- /**
35
- * Upscale fidelity refers to the level of quality desired in the generated image. Fidelity value of 1 means more details.
36
- */
37
- upscaleFidelity?: number | undefined;
38
- };
39
- /**
40
- * @internal
41
- * V1AiPhotoEditorCreateBodyStyle without any key transformation, this is what
42
- * we expect to come in as network data
43
- */
44
- export type External$V1AiPhotoEditorCreateBodyStyle = {
45
- image_description: string;
46
- likeness_strength: number;
47
- negative_prompt?: string | undefined;
48
- prompt: string;
49
- prompt_strength: number;
50
- steps?: number | undefined;
51
- upscale_factor?: number | undefined;
52
- upscale_fidelity?: number | undefined;
53
- };
54
- export declare const Schemas$V1AiPhotoEditorCreateBodyStyle: {
55
- in: z.ZodType<V1AiPhotoEditorCreateBodyStyle, z.ZodTypeDef, unknown>;
56
- out: z.ZodType<External$V1AiPhotoEditorCreateBodyStyle, z.ZodTypeDef, V1AiPhotoEditorCreateBodyStyle>;
57
- };
@@ -1,95 +0,0 @@
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$V1AiPhotoEditorCreateBodyStyle = void 0;
37
- const make_api_request_js_1 = require("make-api-request-js");
38
- const z = __importStar(require("zod"));
39
- /**
40
- * Takes network data, validates it, and transforms keys to match typescript object V1AiPhotoEditorCreateBodyStyle
41
- */
42
- const SchemaIn$V1AiPhotoEditorCreateBodyStyle = z
43
- .object({
44
- image_description: z.string(),
45
- likeness_strength: z.number(),
46
- negative_prompt: z.string().optional(),
47
- prompt: z.string(),
48
- prompt_strength: z.number(),
49
- steps: z.number().int().optional(),
50
- upscale_factor: z.number().int().optional(),
51
- upscale_fidelity: z.number().optional(),
52
- })
53
- .transform((obj) => {
54
- return (0, make_api_request_js_1.zodTransform)(obj, {
55
- image_description: "imageDescription",
56
- likeness_strength: "likenessStrength",
57
- negative_prompt: "negativePrompt",
58
- prompt: "prompt",
59
- prompt_strength: "promptStrength",
60
- steps: "steps",
61
- upscale_factor: "upscaleFactor",
62
- upscale_fidelity: "upscaleFidelity",
63
- });
64
- });
65
- /**
66
- * @internal
67
- * Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiPhotoEditorCreateBodyStyle
68
- */
69
- const SchemaOut$V1AiPhotoEditorCreateBodyStyle = z
70
- .object({
71
- imageDescription: z.string(),
72
- likenessStrength: z.number(),
73
- negativePrompt: z.string().optional(),
74
- prompt: z.string(),
75
- promptStrength: z.number(),
76
- steps: z.number().int().optional(),
77
- upscaleFactor: z.number().int().optional(),
78
- upscaleFidelity: z.number().optional(),
79
- })
80
- .transform((obj) => {
81
- return (0, make_api_request_js_1.zodTransform)(obj, {
82
- imageDescription: "image_description",
83
- likenessStrength: "likeness_strength",
84
- negativePrompt: "negative_prompt",
85
- prompt: "prompt",
86
- promptStrength: "prompt_strength",
87
- steps: "steps",
88
- upscaleFactor: "upscale_factor",
89
- upscaleFidelity: "upscale_fidelity",
90
- });
91
- });
92
- exports.Schemas$V1AiPhotoEditorCreateBodyStyle = {
93
- in: SchemaIn$V1AiPhotoEditorCreateBodyStyle,
94
- out: SchemaOut$V1AiPhotoEditorCreateBodyStyle,
95
- };
@@ -1,41 +0,0 @@
1
- import * as z from "zod";
2
- import { External$V1AiPhotoEditorCreateBodyAssets, V1AiPhotoEditorCreateBodyAssets } from "./v1-ai-photo-editor-create-body-assets";
3
- import { External$V1AiPhotoEditorCreateBodyStyle, V1AiPhotoEditorCreateBodyStyle } from "./v1-ai-photo-editor-create-body-style";
4
- /**
5
- * V1AiPhotoEditorCreateBody
6
- */
7
- export type V1AiPhotoEditorCreateBody = {
8
- /**
9
- * Provide the assets for photo editor
10
- */
11
- assets: V1AiPhotoEditorCreateBodyAssets;
12
- /**
13
- * Give your image a custom name for easy identification.
14
- */
15
- name?: string | undefined;
16
- /**
17
- * The resolution of the final output image. The allowed value is based on your subscription. Please refer to our [pricing page](https://magichour.ai/pricing) for more details
18
- */
19
- resolution: number;
20
- /**
21
- * Deprecated: Please use `.style.steps` instead. Number of iterations used to generate the output. Higher values improve quality and increase the strength of the prompt but increase processing time.
22
- */
23
- steps?: number | undefined;
24
- style: V1AiPhotoEditorCreateBodyStyle;
25
- };
26
- /**
27
- * @internal
28
- * V1AiPhotoEditorCreateBody without any key transformation, this is what
29
- * we expect to come in as network data
30
- */
31
- export type External$V1AiPhotoEditorCreateBody = {
32
- assets: External$V1AiPhotoEditorCreateBodyAssets;
33
- name?: string | undefined;
34
- resolution: number;
35
- steps?: number | undefined;
36
- style: External$V1AiPhotoEditorCreateBodyStyle;
37
- };
38
- export declare const Schemas$V1AiPhotoEditorCreateBody: {
39
- in: z.ZodType<V1AiPhotoEditorCreateBody, z.ZodTypeDef, unknown>;
40
- out: z.ZodType<External$V1AiPhotoEditorCreateBody, z.ZodTypeDef, V1AiPhotoEditorCreateBody>;
41
- };
@@ -1,85 +0,0 @@
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$V1AiPhotoEditorCreateBody = void 0;
37
- const make_api_request_js_1 = require("make-api-request-js");
38
- const z = __importStar(require("zod"));
39
- const v1_ai_photo_editor_create_body_assets_1 = require("./v1-ai-photo-editor-create-body-assets");
40
- const v1_ai_photo_editor_create_body_style_1 = require("./v1-ai-photo-editor-create-body-style");
41
- /**
42
- * Takes network data, validates it, and transforms keys to match typescript object V1AiPhotoEditorCreateBody
43
- */
44
- const SchemaIn$V1AiPhotoEditorCreateBody = z
45
- .object({
46
- assets: v1_ai_photo_editor_create_body_assets_1.Schemas$V1AiPhotoEditorCreateBodyAssets.in,
47
- name: z.string().optional(),
48
- resolution: z.number().int(),
49
- steps: z.number().int().optional(),
50
- style: v1_ai_photo_editor_create_body_style_1.Schemas$V1AiPhotoEditorCreateBodyStyle.in,
51
- })
52
- .transform((obj) => {
53
- return (0, make_api_request_js_1.zodTransform)(obj, {
54
- assets: "assets",
55
- name: "name",
56
- resolution: "resolution",
57
- steps: "steps",
58
- style: "style",
59
- });
60
- });
61
- /**
62
- * @internal
63
- * Takes typescript data, validates it, and maps keys to match the expected external object External$V1AiPhotoEditorCreateBody
64
- */
65
- const SchemaOut$V1AiPhotoEditorCreateBody = z
66
- .object({
67
- assets: v1_ai_photo_editor_create_body_assets_1.Schemas$V1AiPhotoEditorCreateBodyAssets.out,
68
- name: z.string().optional(),
69
- resolution: z.number().int(),
70
- steps: z.number().int().optional(),
71
- style: v1_ai_photo_editor_create_body_style_1.Schemas$V1AiPhotoEditorCreateBodyStyle.out,
72
- })
73
- .transform((obj) => {
74
- return (0, make_api_request_js_1.zodTransform)(obj, {
75
- assets: "assets",
76
- name: "name",
77
- resolution: "resolution",
78
- steps: "steps",
79
- style: "style",
80
- });
81
- });
82
- exports.Schemas$V1AiPhotoEditorCreateBody = {
83
- in: SchemaIn$V1AiPhotoEditorCreateBody,
84
- out: SchemaOut$V1AiPhotoEditorCreateBody,
85
- };
@@ -1,34 +0,0 @@
1
- import * as z from "zod";
2
- /**
3
- * Success
4
- */
5
- export type V1AiPhotoEditorCreateResponse = {
6
- /**
7
- * The amount of credits deducted from your account to generate the image. We charge credits right when the request is made.
8
- *
9
- * If an error occurred while generating the image(s), credits will be refunded and this field will be updated to include the refund.
10
- */
11
- creditsCharged: number;
12
- /**
13
- * Deprecated: Previously represented the number of frames (original name of our credit system) used for image generation. Use 'credits_charged' instead.
14
- */
15
- frameCost: number;
16
- /**
17
- * Unique ID of the image. Use it with the [Get image Project API](https://docs.magichour.ai/api-reference/image-projects/get-image-details) to fetch status and downloads.
18
- */
19
- id: string;
20
- };
21
- /**
22
- * @internal
23
- * V1AiPhotoEditorCreateResponse without any key transformation, this is what
24
- * we expect to come in as network data
25
- */
26
- export type External$V1AiPhotoEditorCreateResponse = {
27
- credits_charged: number;
28
- frame_cost: number;
29
- id: string;
30
- };
31
- export declare const Schemas$V1AiPhotoEditorCreateResponse: {
32
- in: z.ZodType<V1AiPhotoEditorCreateResponse, z.ZodTypeDef, unknown>;
33
- out: z.ZodType<External$V1AiPhotoEditorCreateResponse, z.ZodTypeDef, V1AiPhotoEditorCreateResponse>;
34
- };