@sokol111/ecommerce-image-service-api 1.0.29 → 1.0.30
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/api.d.ts +1 -9
- package/dist/api.js +3 -27
- package/dist/api.schemas.d.ts +14 -90
- package/dist/api.schemas.js +1 -20
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ConfirmRequest, DeleteImageParams, GetDeliveryUrl200, GetDeliveryUrlParams, Image, PresignRequest, PresignResponse, PromoteImages200, PromoteRequest } from './api.schemas';
|
|
3
3
|
export declare const getImageServiceAPI: () => {
|
|
4
4
|
createPresign: <TData = AxiosResponse<PresignResponse, any, {}>>(presignRequest: PresignRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
5
5
|
confirmUpload: <TData = AxiosResponse<Image, any, {}>>(confirmRequest: ConfirmRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
6
|
-
listImages: <TData = AxiosResponse<ListImages200, any, {}>>(params?: ListImagesParams, options?: AxiosRequestConfig) => Promise<TData>;
|
|
7
6
|
getImage: <TData = AxiosResponse<Image, any, {}>>(id: string, options?: AxiosRequestConfig) => Promise<TData>;
|
|
8
|
-
updateImage: <TData = AxiosResponse<Image, any, {}>>(id: string, imagePatch: ImagePatch, options?: AxiosRequestConfig) => Promise<TData>;
|
|
9
7
|
deleteImage: <TData = AxiosResponse<void, any, {}>>(id: string, params?: DeleteImageParams, options?: AxiosRequestConfig) => Promise<TData>;
|
|
10
8
|
getDeliveryUrl: <TData = AxiosResponse<GetDeliveryUrl200, any, {}>>(id: string, params?: GetDeliveryUrlParams, options?: AxiosRequestConfig) => Promise<TData>;
|
|
11
|
-
getDeliveryUrls: <TData = AxiosResponse<BatchUrlResponse, any, {}>>(batchUrlRequest: BatchUrlRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
12
9
|
promoteImages: <TData = AxiosResponse<PromoteImages200, any, {}>>(promoteRequest: PromoteRequest, options?: AxiosRequestConfig) => Promise<TData>;
|
|
13
|
-
processImage: <TData = AxiosResponse<void, any, {}>>(processImageBody: ProcessImageBody, options?: AxiosRequestConfig) => Promise<TData>;
|
|
14
10
|
};
|
|
15
11
|
export type CreatePresignResult = AxiosResponse<PresignResponse>;
|
|
16
12
|
export type ConfirmUploadResult = AxiosResponse<Image>;
|
|
17
|
-
export type ListImagesResult = AxiosResponse<ListImages200>;
|
|
18
13
|
export type GetImageResult = AxiosResponse<Image>;
|
|
19
|
-
export type UpdateImageResult = AxiosResponse<Image>;
|
|
20
14
|
export type DeleteImageResult = AxiosResponse<void>;
|
|
21
15
|
export type GetDeliveryUrlResult = AxiosResponse<GetDeliveryUrl200>;
|
|
22
|
-
export type GetDeliveryUrlsResult = AxiosResponse<BatchUrlResponse>;
|
|
23
16
|
export type PromoteImagesResult = AxiosResponse<PromoteImages200>;
|
|
24
|
-
export type ProcessImageResult = AxiosResponse<void>;
|
package/dist/api.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Image Service API
|
|
5
5
|
* API for managing images
|
|
6
|
-
* OpenAPI spec version: 1.0.
|
|
6
|
+
* OpenAPI spec version: 1.0.30
|
|
7
7
|
*/
|
|
8
8
|
import axios from 'axios';
|
|
9
9
|
export const getImageServiceAPI = () => {
|
|
10
10
|
/**
|
|
11
|
-
* @summary Create a
|
|
11
|
+
* @summary Create a POST policy for uploading an image to MinIO/S3 with size validation
|
|
12
12
|
*/
|
|
13
13
|
const createPresign = (presignRequest, options) => {
|
|
14
14
|
return axios.post(`/v1/images/presign`, presignRequest, options);
|
|
@@ -19,24 +19,12 @@ export const getImageServiceAPI = () => {
|
|
|
19
19
|
const confirmUpload = (confirmRequest, options) => {
|
|
20
20
|
return axios.post(`/v1/images/confirm`, confirmRequest, options);
|
|
21
21
|
};
|
|
22
|
-
/**
|
|
23
|
-
* @summary List/search images by owner/filters
|
|
24
|
-
*/
|
|
25
|
-
const listImages = (params, options) => {
|
|
26
|
-
return axios.get(`/v1/images`, Object.assign(Object.assign({}, options), { params: Object.assign(Object.assign({}, params), options === null || options === void 0 ? void 0 : options.params) }));
|
|
27
|
-
};
|
|
28
22
|
/**
|
|
29
23
|
* @summary Get image metadata
|
|
30
24
|
*/
|
|
31
25
|
const getImage = (id, options) => {
|
|
32
26
|
return axios.get(`/v1/images/${id}`, options);
|
|
33
27
|
};
|
|
34
|
-
/**
|
|
35
|
-
* @summary Update image metadata (alt, role, order)
|
|
36
|
-
*/
|
|
37
|
-
const updateImage = (id, imagePatch, options) => {
|
|
38
|
-
return axios.patch(`/v1/images/${id}`, imagePatch, options);
|
|
39
|
-
};
|
|
40
28
|
/**
|
|
41
29
|
* @summary Delete image (soft or hard, per policy)
|
|
42
30
|
*/
|
|
@@ -49,23 +37,11 @@ export const getImageServiceAPI = () => {
|
|
|
49
37
|
const getDeliveryUrl = (id, params, options) => {
|
|
50
38
|
return axios.get(`/v1/images/${id}/url`, Object.assign(Object.assign({}, options), { params: Object.assign(Object.assign({}, params), options === null || options === void 0 ? void 0 : options.params) }));
|
|
51
39
|
};
|
|
52
|
-
/**
|
|
53
|
-
* @summary Generate signed imgproxy URLs for multiple images in a single request
|
|
54
|
-
*/
|
|
55
|
-
const getDeliveryUrls = (batchUrlRequest, options) => {
|
|
56
|
-
return axios.post(`/v1/images/urls`, batchUrlRequest, options);
|
|
57
|
-
};
|
|
58
40
|
/**
|
|
59
41
|
* @summary Promote images from a product draft to a final product
|
|
60
42
|
*/
|
|
61
43
|
const promoteImages = (promoteRequest, options) => {
|
|
62
44
|
return axios.post(`/v1/images/promote`, promoteRequest, options);
|
|
63
45
|
};
|
|
64
|
-
|
|
65
|
-
* @summary Trigger (or retry) variant generation for an image
|
|
66
|
-
*/
|
|
67
|
-
const processImage = (processImageBody, options) => {
|
|
68
|
-
return axios.post(`/v1/internal/images/process`, processImageBody, options);
|
|
69
|
-
};
|
|
70
|
-
return { createPresign, confirmUpload, listImages, getImage, updateImage, deleteImage, getDeliveryUrl, getDeliveryUrls, promoteImages, processImage };
|
|
46
|
+
return { createPresign, confirmUpload, getImage, deleteImage, getDeliveryUrl, promoteImages };
|
|
71
47
|
};
|
package/dist/api.schemas.d.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
* Image Service API
|
|
5
5
|
* API for managing images
|
|
6
|
-
* OpenAPI spec version: 1.0.
|
|
6
|
+
* OpenAPI spec version: 1.0.30
|
|
7
7
|
*/
|
|
8
8
|
export type OwnerType = typeof OwnerType[keyof typeof OwnerType];
|
|
9
9
|
export declare const OwnerType: {
|
|
10
|
-
readonly
|
|
10
|
+
readonly draft: "draft";
|
|
11
11
|
readonly product: "product";
|
|
12
12
|
readonly user: "user";
|
|
13
13
|
};
|
|
@@ -19,11 +19,8 @@ export declare const ImageRole: {
|
|
|
19
19
|
};
|
|
20
20
|
export type ImageStatus = typeof ImageStatus[keyof typeof ImageStatus];
|
|
21
21
|
export declare const ImageStatus: {
|
|
22
|
-
readonly pending: "pending";
|
|
23
22
|
readonly uploaded: "uploaded";
|
|
24
|
-
readonly processing: "processing";
|
|
25
23
|
readonly ready: "ready";
|
|
26
|
-
readonly failed: "failed";
|
|
27
24
|
readonly deleted: "deleted";
|
|
28
25
|
};
|
|
29
26
|
export interface Variant {
|
|
@@ -57,12 +54,6 @@ export interface Image {
|
|
|
57
54
|
createdAt: string;
|
|
58
55
|
modifiedAt: string;
|
|
59
56
|
}
|
|
60
|
-
export interface ImagePatch {
|
|
61
|
-
alt?: string;
|
|
62
|
-
role?: ImageRole;
|
|
63
|
-
/** Position in the product gallery */
|
|
64
|
-
order?: number;
|
|
65
|
-
}
|
|
66
57
|
export type PresignRequestContentType = typeof PresignRequestContentType[keyof typeof PresignRequestContentType];
|
|
67
58
|
export declare const PresignRequestContentType: {
|
|
68
59
|
readonly 'image/jpeg': "image/jpeg";
|
|
@@ -88,16 +79,25 @@ export interface PresignRequest {
|
|
|
88
79
|
size: number;
|
|
89
80
|
role: ImageRole;
|
|
90
81
|
}
|
|
91
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Form fields to include with POST upload. Must be sent BEFORE the file field.
|
|
84
|
+
Includes: key, Content-Type, policy, x-amz-algorithm, x-amz-credential, x-amz-date, x-amz-signature
|
|
85
|
+
|
|
86
|
+
*/
|
|
87
|
+
export type PresignResponseFormData = {
|
|
92
88
|
[key: string]: string;
|
|
93
89
|
};
|
|
94
90
|
export interface PresignResponse {
|
|
91
|
+
/** URL to POST the file to (multipart/form-data) */
|
|
95
92
|
uploadUrl: string;
|
|
96
|
-
/** Signed JWT token
|
|
93
|
+
/** Signed JWT token for confirm endpoint (contains key, ownerType, ownerId, role, etc.) */
|
|
97
94
|
uploadToken: string;
|
|
98
95
|
/** TTL in seconds */
|
|
99
96
|
expiresIn: number;
|
|
100
|
-
|
|
97
|
+
/** Form fields to include with POST upload. Must be sent BEFORE the file field.
|
|
98
|
+
Includes: key, Content-Type, policy, x-amz-algorithm, x-amz-credential, x-amz-date, x-amz-signature
|
|
99
|
+
*/
|
|
100
|
+
formData: PresignResponseFormData;
|
|
101
101
|
}
|
|
102
102
|
export interface ConfirmRequest {
|
|
103
103
|
/**
|
|
@@ -123,57 +123,6 @@ export interface PromoteRequest {
|
|
|
123
123
|
/** If omitted — promote all images of the draft */
|
|
124
124
|
images?: string[];
|
|
125
125
|
}
|
|
126
|
-
export type BatchUrlRequestFit = typeof BatchUrlRequestFit[keyof typeof BatchUrlRequestFit];
|
|
127
|
-
export declare const BatchUrlRequestFit: {
|
|
128
|
-
readonly cover: "cover";
|
|
129
|
-
readonly contain: "contain";
|
|
130
|
-
readonly fill: "fill";
|
|
131
|
-
readonly inside: "inside";
|
|
132
|
-
readonly outside: "outside";
|
|
133
|
-
};
|
|
134
|
-
export type BatchUrlRequestFormat = typeof BatchUrlRequestFormat[keyof typeof BatchUrlRequestFormat];
|
|
135
|
-
export declare const BatchUrlRequestFormat: {
|
|
136
|
-
readonly original: "original";
|
|
137
|
-
readonly webp: "webp";
|
|
138
|
-
readonly avif: "avif";
|
|
139
|
-
readonly jpeg: "jpeg";
|
|
140
|
-
readonly png: "png";
|
|
141
|
-
};
|
|
142
|
-
export interface BatchUrlRequest {
|
|
143
|
-
/**
|
|
144
|
-
* List of image IDs to get URLs for (max 50)
|
|
145
|
-
* @minItems 1
|
|
146
|
-
* @maxItems 50
|
|
147
|
-
*/
|
|
148
|
-
imageIds: string[];
|
|
149
|
-
/**
|
|
150
|
-
* Width in pixels
|
|
151
|
-
* @minimum 1
|
|
152
|
-
*/
|
|
153
|
-
w?: number;
|
|
154
|
-
/**
|
|
155
|
-
* Height in pixels
|
|
156
|
-
* @minimum 1
|
|
157
|
-
*/
|
|
158
|
-
h?: number;
|
|
159
|
-
fit?: BatchUrlRequestFit;
|
|
160
|
-
format?: BatchUrlRequestFormat;
|
|
161
|
-
/**
|
|
162
|
-
* @minimum 1
|
|
163
|
-
* @maximum 100
|
|
164
|
-
*/
|
|
165
|
-
quality?: number;
|
|
166
|
-
}
|
|
167
|
-
export interface BatchUrlResponse {
|
|
168
|
-
urls: ImageUrl[];
|
|
169
|
-
/** Image IDs that were not found */
|
|
170
|
-
notFound?: string[];
|
|
171
|
-
}
|
|
172
|
-
export interface ImageUrl {
|
|
173
|
-
imageId: string;
|
|
174
|
-
url: string;
|
|
175
|
-
expiresAt?: string;
|
|
176
|
-
}
|
|
177
126
|
export type ProblemErrorsItem = {
|
|
178
127
|
field?: string;
|
|
179
128
|
message?: string;
|
|
@@ -190,26 +139,6 @@ export interface Problem {
|
|
|
190
139
|
traceId?: string;
|
|
191
140
|
errors?: ProblemErrorsItem[];
|
|
192
141
|
}
|
|
193
|
-
export type ListImagesParams = {
|
|
194
|
-
ownerType?: OwnerType;
|
|
195
|
-
ownerId?: string;
|
|
196
|
-
status?: ImageStatus;
|
|
197
|
-
/**
|
|
198
|
-
* @minimum 1
|
|
199
|
-
*/
|
|
200
|
-
page?: number;
|
|
201
|
-
/**
|
|
202
|
-
* @minimum 1
|
|
203
|
-
* @maximum 200
|
|
204
|
-
*/
|
|
205
|
-
pageSize?: number;
|
|
206
|
-
};
|
|
207
|
-
export type ListImages200 = {
|
|
208
|
-
items?: Image[];
|
|
209
|
-
page?: number;
|
|
210
|
-
pageSize?: number;
|
|
211
|
-
total?: number;
|
|
212
|
-
};
|
|
213
142
|
export type DeleteImageParams = {
|
|
214
143
|
/**
|
|
215
144
|
* If true — delete objects in MinIO and remove DB record permanently
|
|
@@ -270,8 +199,3 @@ export type GetDeliveryUrl200 = {
|
|
|
270
199
|
export type PromoteImages200 = {
|
|
271
200
|
promoted?: Image[];
|
|
272
201
|
};
|
|
273
|
-
export type ProcessImageBody = {
|
|
274
|
-
imageId?: string;
|
|
275
|
-
/** Name of the preset (variant set), if used */
|
|
276
|
-
preset?: string;
|
|
277
|
-
};
|
package/dist/api.schemas.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
2
2
|
export const OwnerType = {
|
|
3
|
-
|
|
3
|
+
draft: 'draft',
|
|
4
4
|
product: 'product',
|
|
5
5
|
user: 'user',
|
|
6
6
|
};
|
|
@@ -12,11 +12,8 @@ export const ImageRole = {
|
|
|
12
12
|
};
|
|
13
13
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
14
14
|
export const ImageStatus = {
|
|
15
|
-
pending: 'pending',
|
|
16
15
|
uploaded: 'uploaded',
|
|
17
|
-
processing: 'processing',
|
|
18
16
|
ready: 'ready',
|
|
19
|
-
failed: 'failed',
|
|
20
17
|
deleted: 'deleted',
|
|
21
18
|
};
|
|
22
19
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
@@ -27,22 +24,6 @@ export const PresignRequestContentType = {
|
|
|
27
24
|
'image/avif': 'image/avif',
|
|
28
25
|
};
|
|
29
26
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
30
|
-
export const BatchUrlRequestFit = {
|
|
31
|
-
cover: 'cover',
|
|
32
|
-
contain: 'contain',
|
|
33
|
-
fill: 'fill',
|
|
34
|
-
inside: 'inside',
|
|
35
|
-
outside: 'outside',
|
|
36
|
-
};
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
38
|
-
export const BatchUrlRequestFormat = {
|
|
39
|
-
original: 'original',
|
|
40
|
-
webp: 'webp',
|
|
41
|
-
avif: 'avif',
|
|
42
|
-
jpeg: 'jpeg',
|
|
43
|
-
png: 'png',
|
|
44
|
-
};
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
46
27
|
export const GetDeliveryUrlFit = {
|
|
47
28
|
cover: 'cover',
|
|
48
29
|
contain: 'contain',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sokol111/ecommerce-image-service-api",
|
|
3
3
|
"description": "Generated TypeScript Axios client from OpenAPI for ecommerce-image-service-api",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.30",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"module": "dist/index.js",
|