@coreviz/sdk 1.0.0 → 1.0.3
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 +98 -8
- package/dist/coreviz.d.ts +39 -0
- package/dist/coreviz.js +141 -0
- package/dist/describe.d.ts +5 -1
- package/dist/describe.js +14 -6
- package/dist/edit.d.ts +2 -0
- package/dist/edit.js +13 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +3 -7
- package/dist/tag.d.ts +2 -0
- package/dist/tag.js +13 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @coreviz/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The official JavaScript/TypeScript SDK for CoreViz's Vision AI APIs. Easily integrate powerful image analysis and manipulation features into your applications.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,17 +8,107 @@ CoreViz SDK - A JavaScript/Node.js interface for CoreViz's Vision AI APIs.
|
|
|
8
8
|
npm install @coreviz/sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Configuration
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
To use the AI features, you need to instantiate the `CoreViz` class with your API key.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { CoreViz } from '@coreviz/sdk';
|
|
17
|
+
|
|
18
|
+
const coreviz = new CoreViz({
|
|
19
|
+
apiKey: process.env.COREVIZ_API_KEY // or 'your_api_key_here'
|
|
20
|
+
});
|
|
16
21
|
```
|
|
17
22
|
|
|
18
|
-
##
|
|
23
|
+
## API Reference
|
|
24
|
+
|
|
25
|
+
### `coreviz.describe(image)`
|
|
26
|
+
|
|
27
|
+
Generates a detailed text description of an image.
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
**Parameters:**
|
|
30
|
+
- `image` (string): The image to describe. Can be a base64 string or a URL.
|
|
31
|
+
|
|
32
|
+
**Returns:**
|
|
33
|
+
- `Promise<string>`: A text description of the image.
|
|
34
|
+
|
|
35
|
+
**Example:**
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const description = await coreviz.describe('https://example.com/image.jpg');
|
|
39
|
+
console.log(description);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### `coreviz.tag(image, options)`
|
|
43
|
+
|
|
44
|
+
Analyzes an image and returns relevant tags or classifications based on a prompt.
|
|
45
|
+
|
|
46
|
+
**Parameters:**
|
|
47
|
+
- `image` (string): The image to analyze. Can be a base64 string or a URL.
|
|
48
|
+
- `options` (object):
|
|
49
|
+
- `prompt` (string): The context or question to guide the tagging (e.g., "What objects are in this image?").
|
|
50
|
+
- `options` (string[], optional): A specific list of tags to choose from.
|
|
51
|
+
- `multiple` (boolean, optional): Whether to allow multiple tags (default: `true`).
|
|
52
|
+
|
|
53
|
+
**Returns:**
|
|
54
|
+
- `Promise<TagResponse>`: An object containing:
|
|
55
|
+
- `tags` (string[]): The list of identified tags.
|
|
56
|
+
- `raw` (unknown): The raw API response.
|
|
57
|
+
|
|
58
|
+
**Example:**
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
const result = await coreviz.tag('base64_image_string...', {
|
|
62
|
+
prompt: "Is this indoor or outdoor?",
|
|
63
|
+
options: ["indoor", "outdoor"],
|
|
64
|
+
multiple: false
|
|
65
|
+
});
|
|
66
|
+
console.log(result.tags); // ["indoor"]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### `coreviz.edit(image, options)`
|
|
70
|
+
|
|
71
|
+
Modifies an image based on a text prompt using generative AI.
|
|
72
|
+
|
|
73
|
+
**Parameters:**
|
|
74
|
+
- `image` (string): The image to edit. Can be a base64 string or a URL.
|
|
75
|
+
- `options` (object):
|
|
76
|
+
- `prompt` (string): Description of the desired edit.
|
|
77
|
+
- `aspectRatio` (string, optional): Target aspect ratio (`'match_input_image'`, `'1:1'`, `'16:9'`, `'9:16'`, `'4:3'`, `'3:4'`).
|
|
78
|
+
- `outputFormat` (string, optional): `'jpg'` or `'png'`.
|
|
79
|
+
- `model` (string, optional): The model to use (default: `'flux-kontext-max'`).
|
|
80
|
+
|
|
81
|
+
**Returns:**
|
|
82
|
+
- `Promise<string>`: The edited image as a base64 string or URL.
|
|
83
|
+
|
|
84
|
+
**Example:**
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
const editedImage = await coreviz.edit('https://example.com/photo.jpg', {
|
|
88
|
+
prompt: "Make it look like a painting",
|
|
89
|
+
aspectRatio: "1:1"
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### `coreviz.resize(input, maxWidth?, maxHeight?)`
|
|
94
|
+
|
|
95
|
+
Utility function to resize images client-side or server-side before processing. Also available as a standalone import.
|
|
96
|
+
|
|
97
|
+
**Parameters:**
|
|
98
|
+
- `input` (string | File): The image to resize.
|
|
99
|
+
- `maxWidth` (number, optional): Maximum width (default: 1920).
|
|
100
|
+
- `maxHeight` (number, optional): Maximum height (default: 1080).
|
|
101
|
+
|
|
102
|
+
**Returns:**
|
|
103
|
+
- `Promise<string>`: The resized image as a base64 string.
|
|
104
|
+
|
|
105
|
+
**Example:**
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
const resized = await coreviz.resize(myFileObject, 800, 600);
|
|
109
|
+
// or import { resize } from '@coreviz/sdk';
|
|
110
|
+
```
|
|
21
111
|
|
|
22
112
|
## License
|
|
23
113
|
|
|
24
|
-
MIT
|
|
114
|
+
MIT
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface CoreVizConfig {
|
|
2
|
+
apiKey?: string;
|
|
3
|
+
token?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DescribeOptions {
|
|
6
|
+
}
|
|
7
|
+
export interface EditOptions {
|
|
8
|
+
prompt: string;
|
|
9
|
+
aspectRatio?: 'match_input_image' | '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
|
|
10
|
+
outputFormat?: 'jpg' | 'png';
|
|
11
|
+
model?: 'flux-kontext-max' | 'google/nano-banana' | 'seedream-4';
|
|
12
|
+
}
|
|
13
|
+
export interface TagOptions {
|
|
14
|
+
prompt: string;
|
|
15
|
+
options?: string[];
|
|
16
|
+
multiple?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface TagResponse {
|
|
19
|
+
tags: string[];
|
|
20
|
+
raw?: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface EmbedOptions {
|
|
23
|
+
type?: 'image' | 'text';
|
|
24
|
+
}
|
|
25
|
+
export interface EmbedResponse {
|
|
26
|
+
embedding: number[];
|
|
27
|
+
}
|
|
28
|
+
export declare class CoreViz {
|
|
29
|
+
private apiKey?;
|
|
30
|
+
private token?;
|
|
31
|
+
constructor(config?: CoreVizConfig);
|
|
32
|
+
private getHeaders;
|
|
33
|
+
private handleResponse;
|
|
34
|
+
describe(image: string, options?: DescribeOptions): Promise<string>;
|
|
35
|
+
edit(image: string, options: EditOptions): Promise<string>;
|
|
36
|
+
tag(image: string, options: TagOptions): Promise<TagResponse>;
|
|
37
|
+
embed(input: string, options?: EmbedOptions): Promise<EmbedResponse>;
|
|
38
|
+
resize(input: string | File, maxWidth?: number, maxHeight?: number): Promise<string>;
|
|
39
|
+
}
|
package/dist/coreviz.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoreViz = void 0;
|
|
4
|
+
const resize_1 = require("./resize");
|
|
5
|
+
class CoreViz {
|
|
6
|
+
constructor(config = {}) {
|
|
7
|
+
this.apiKey = config.apiKey || (typeof process !== 'undefined' ? process.env.COREVIZ_API_KEY : undefined);
|
|
8
|
+
this.token = config.token;
|
|
9
|
+
}
|
|
10
|
+
getHeaders() {
|
|
11
|
+
const headers = {
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
};
|
|
14
|
+
if (this.token) {
|
|
15
|
+
headers['Authorization'] = `Bearer ${this.token}`;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
headers['x-api-key'] = this.apiKey || "";
|
|
19
|
+
}
|
|
20
|
+
return headers;
|
|
21
|
+
}
|
|
22
|
+
async handleResponse(response) {
|
|
23
|
+
if (response.status === 402) {
|
|
24
|
+
throw new Error('Insufficient credits');
|
|
25
|
+
}
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
throw new Error(`Request failed (${response.status})`);
|
|
28
|
+
}
|
|
29
|
+
const data = await response.json();
|
|
30
|
+
if (data.error) {
|
|
31
|
+
throw new Error(data.error);
|
|
32
|
+
}
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
async describe(image, options) {
|
|
36
|
+
try {
|
|
37
|
+
const resizedImage = await (0, resize_1.resize)(image);
|
|
38
|
+
const headers = this.getHeaders();
|
|
39
|
+
const response = await fetch(`https://lab.coreviz.io/api/ai/describe`, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
headers,
|
|
42
|
+
body: JSON.stringify({ image: resizedImage }),
|
|
43
|
+
});
|
|
44
|
+
const data = await this.handleResponse(response);
|
|
45
|
+
return data.description;
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
throw err instanceof Error ? err : new Error("An unexpected error occurred.");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async edit(image, options) {
|
|
52
|
+
try {
|
|
53
|
+
const resizedImage = await (0, resize_1.resize)(image);
|
|
54
|
+
const headers = this.getHeaders();
|
|
55
|
+
const response = await fetch(`https://lab.coreviz.io/api/ai/edit`, {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
headers,
|
|
58
|
+
body: JSON.stringify({
|
|
59
|
+
image: resizedImage,
|
|
60
|
+
prompt: options.prompt,
|
|
61
|
+
aspectRatio: options.aspectRatio || 'match_input_image',
|
|
62
|
+
outputFormat: options.outputFormat || 'jpg',
|
|
63
|
+
model: options.model || 'flux-kontext-max',
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
const data = await this.handleResponse(response);
|
|
67
|
+
return data.result;
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
throw err instanceof Error ? err : new Error("An unexpected error occurred.");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async tag(image, options) {
|
|
74
|
+
try {
|
|
75
|
+
const resizedImage = await (0, resize_1.resize)(image);
|
|
76
|
+
const headers = this.getHeaders();
|
|
77
|
+
const response = await fetch("https://lab.coreviz.io/api/ai/tag", {
|
|
78
|
+
method: 'POST',
|
|
79
|
+
headers,
|
|
80
|
+
body: JSON.stringify({
|
|
81
|
+
image: resizedImage,
|
|
82
|
+
prompt: options.prompt,
|
|
83
|
+
options: options.options && options.options.length > 0 ? options.options : undefined,
|
|
84
|
+
multiple: options.multiple ?? true,
|
|
85
|
+
}),
|
|
86
|
+
});
|
|
87
|
+
const data = await this.handleResponse(response);
|
|
88
|
+
const tags = Array.isArray(data.tags)
|
|
89
|
+
? data.tags
|
|
90
|
+
: Array.isArray(data.result)
|
|
91
|
+
? data.result
|
|
92
|
+
: typeof data.tag === 'string'
|
|
93
|
+
? [data.tag]
|
|
94
|
+
: [];
|
|
95
|
+
return {
|
|
96
|
+
tags,
|
|
97
|
+
raw: data,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
throw err instanceof Error ? err : new Error("An unexpected error occurred.");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async embed(input, options) {
|
|
105
|
+
try {
|
|
106
|
+
const headers = this.getHeaders();
|
|
107
|
+
let body = {};
|
|
108
|
+
// Determine type
|
|
109
|
+
let isImage = false;
|
|
110
|
+
if (options?.type) {
|
|
111
|
+
isImage = options.type === 'image';
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// Heuristic: Check if input starts with data:image or http
|
|
115
|
+
// Assuming http/https implies image URL in this context unless specified otherwise
|
|
116
|
+
isImage = input.startsWith('data:image') || input.startsWith('http://') || input.startsWith('https://');
|
|
117
|
+
}
|
|
118
|
+
if (isImage) {
|
|
119
|
+
const resizedImage = await (0, resize_1.resize)(input);
|
|
120
|
+
body.image = resizedImage;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
body.text = input;
|
|
124
|
+
}
|
|
125
|
+
const response = await fetch("https://lab.coreviz.io/api/ai/embed", {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers,
|
|
128
|
+
body: JSON.stringify(body),
|
|
129
|
+
});
|
|
130
|
+
const data = await this.handleResponse(response);
|
|
131
|
+
return data;
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
throw err instanceof Error ? err : new Error("An unexpected error occurred.");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async resize(input, maxWidth, maxHeight) {
|
|
138
|
+
return (0, resize_1.resize)(input, maxWidth, maxHeight);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.CoreViz = CoreViz;
|
package/dist/describe.d.ts
CHANGED
package/dist/describe.js
CHANGED
|
@@ -2,17 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.describe = describe;
|
|
4
4
|
const resize_1 = require("./resize");
|
|
5
|
-
async function describe(image) {
|
|
5
|
+
async function describe(image, options) {
|
|
6
6
|
try {
|
|
7
7
|
const resizedImage = await (0, resize_1.resize)(image);
|
|
8
|
+
const headers = {
|
|
9
|
+
'Content-Type': 'application/json',
|
|
10
|
+
};
|
|
11
|
+
if (options?.token) {
|
|
12
|
+
headers['Authorization'] = `Bearer ${options.token}`;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
headers['x-api-key'] = options?.apiKey || process.env.COREVIZ_API_KEY || "";
|
|
16
|
+
}
|
|
8
17
|
const response = await fetch(`https://lab.coreviz.io/api/ai/describe`, {
|
|
9
18
|
method: 'POST',
|
|
10
|
-
headers
|
|
11
|
-
'x-api-key': process.env.COREVIZ_API_KEY || "",
|
|
12
|
-
'Content-Type': 'application/json',
|
|
13
|
-
},
|
|
19
|
+
headers,
|
|
14
20
|
body: JSON.stringify({ image: resizedImage }),
|
|
15
21
|
});
|
|
22
|
+
if (response.status === 402) {
|
|
23
|
+
throw new Error('Insufficient credits');
|
|
24
|
+
}
|
|
16
25
|
if (!response.ok) {
|
|
17
26
|
throw new Error(`Failed to describe image (${response.status})`);
|
|
18
27
|
}
|
|
@@ -23,7 +32,6 @@ async function describe(image) {
|
|
|
23
32
|
return data.description;
|
|
24
33
|
}
|
|
25
34
|
catch (err) {
|
|
26
|
-
console.error('Error in describeImage:', err);
|
|
27
35
|
throw err instanceof Error ? err : new Error("An unexpected error occurred.");
|
|
28
36
|
}
|
|
29
37
|
}
|
package/dist/edit.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ export interface EditOptions {
|
|
|
3
3
|
aspectRatio?: 'match_input_image' | '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
|
|
4
4
|
outputFormat?: 'jpg' | 'png';
|
|
5
5
|
model?: 'flux-kontext-max' | 'google/nano-banana' | 'seedream-4';
|
|
6
|
+
token?: string;
|
|
7
|
+
apiKey?: string;
|
|
6
8
|
}
|
|
7
9
|
export declare function edit(image: string, options: EditOptions): Promise<string | undefined>;
|
package/dist/edit.js
CHANGED
|
@@ -5,12 +5,18 @@ const resize_1 = require("./resize");
|
|
|
5
5
|
async function edit(image, options) {
|
|
6
6
|
try {
|
|
7
7
|
const resizedImage = await (0, resize_1.resize)(image);
|
|
8
|
+
const headers = {
|
|
9
|
+
'Content-Type': 'application/json',
|
|
10
|
+
};
|
|
11
|
+
if (options.token) {
|
|
12
|
+
headers['Authorization'] = `Bearer ${options.token}`;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
headers['x-api-key'] = options.apiKey || process.env.COREVIZ_API_KEY || "";
|
|
16
|
+
}
|
|
8
17
|
const response = await fetch(`https://lab.coreviz.io/api/ai/edit`, {
|
|
9
18
|
method: 'POST',
|
|
10
|
-
headers
|
|
11
|
-
'x-api-key': process.env.COREVIZ_API_KEY || "",
|
|
12
|
-
'Content-Type': 'application/json',
|
|
13
|
-
},
|
|
19
|
+
headers,
|
|
14
20
|
body: JSON.stringify({
|
|
15
21
|
image: resizedImage,
|
|
16
22
|
prompt: options.prompt,
|
|
@@ -19,6 +25,9 @@ async function edit(image, options) {
|
|
|
19
25
|
model: options.model || 'flux-kontext-max',
|
|
20
26
|
}),
|
|
21
27
|
});
|
|
28
|
+
if (response.status === 402) {
|
|
29
|
+
throw new Error('Insufficient credits');
|
|
30
|
+
}
|
|
22
31
|
if (!response.ok) {
|
|
23
32
|
throw new Error(`Failed to edit image (${response.status})`);
|
|
24
33
|
}
|
|
@@ -29,7 +38,6 @@ async function edit(image, options) {
|
|
|
29
38
|
return data.result;
|
|
30
39
|
}
|
|
31
40
|
catch (err) {
|
|
32
|
-
console.error('Error in editImage:', err);
|
|
33
41
|
throw err instanceof Error ? err : new Error("An unexpected error occurred.");
|
|
34
42
|
}
|
|
35
43
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreViz, CoreVizConfig, DescribeOptions, EditOptions, TagOptions, TagResponse, EmbedOptions, EmbedResponse } from './coreviz';
|
|
2
2
|
import { resize } from './resize';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { describe, resize, edit, tag };
|
|
6
|
-
export type { EditOptions, TagOptions, TagResponse };
|
|
3
|
+
export { CoreViz, resize };
|
|
4
|
+
export type { CoreVizConfig, DescribeOptions, EditOptions, TagOptions, TagResponse, EmbedOptions, EmbedResponse };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.resize = exports.CoreViz = void 0;
|
|
4
|
+
const coreviz_1 = require("./coreviz");
|
|
5
|
+
Object.defineProperty(exports, "CoreViz", { enumerable: true, get: function () { return coreviz_1.CoreViz; } });
|
|
6
6
|
const resize_1 = require("./resize");
|
|
7
7
|
Object.defineProperty(exports, "resize", { enumerable: true, get: function () { return resize_1.resize; } });
|
|
8
|
-
const edit_1 = require("./edit");
|
|
9
|
-
Object.defineProperty(exports, "edit", { enumerable: true, get: function () { return edit_1.edit; } });
|
|
10
|
-
const tag_1 = require("./tag");
|
|
11
|
-
Object.defineProperty(exports, "tag", { enumerable: true, get: function () { return tag_1.tag; } });
|
package/dist/tag.d.ts
CHANGED
package/dist/tag.js
CHANGED
|
@@ -5,12 +5,18 @@ const resize_1 = require("./resize");
|
|
|
5
5
|
async function tag(image, options) {
|
|
6
6
|
try {
|
|
7
7
|
const resizedImage = await (0, resize_1.resize)(image);
|
|
8
|
+
const headers = {
|
|
9
|
+
'Content-Type': 'application/json',
|
|
10
|
+
};
|
|
11
|
+
if (options.token) {
|
|
12
|
+
headers['Authorization'] = `Bearer ${options.token}`;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
headers['x-api-key'] = options.apiKey || process.env.COREVIZ_API_KEY || "";
|
|
16
|
+
}
|
|
8
17
|
const response = await fetch("https://lab.coreviz.io/api/ai/tag", {
|
|
9
18
|
method: 'POST',
|
|
10
|
-
headers
|
|
11
|
-
'x-api-key': process.env.COREVIZ_API_KEY || "",
|
|
12
|
-
'Content-Type': 'application/json',
|
|
13
|
-
},
|
|
19
|
+
headers,
|
|
14
20
|
body: JSON.stringify({
|
|
15
21
|
image: resizedImage,
|
|
16
22
|
prompt: options.prompt,
|
|
@@ -18,6 +24,9 @@ async function tag(image, options) {
|
|
|
18
24
|
multiple: options.multiple ?? true,
|
|
19
25
|
}),
|
|
20
26
|
});
|
|
27
|
+
if (response.status === 402) {
|
|
28
|
+
throw new Error('Insufficient credits');
|
|
29
|
+
}
|
|
21
30
|
if (!response.ok) {
|
|
22
31
|
throw new Error(`Failed to tag image (${response.status})`);
|
|
23
32
|
}
|
|
@@ -38,7 +47,6 @@ async function tag(image, options) {
|
|
|
38
47
|
};
|
|
39
48
|
}
|
|
40
49
|
catch (err) {
|
|
41
|
-
console.error('Error in tagImage:', err);
|
|
42
50
|
throw err instanceof Error ? err : new Error("An unexpected error occurred.");
|
|
43
51
|
}
|
|
44
52
|
}
|
package/package.json
CHANGED