@sokol111/ecommerce-image-service-api 1.0.27 → 1.0.28

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.
@@ -0,0 +1,277 @@
1
+ /**
2
+ * Generated by orval v7.13.2 🍺
3
+ * Do not edit manually.
4
+ * Image Service API
5
+ * API for managing images
6
+ * OpenAPI spec version: 1.0.28
7
+ */
8
+ export type OwnerType = typeof OwnerType[keyof typeof OwnerType];
9
+ export declare const OwnerType: {
10
+ readonly productDraft: "productDraft";
11
+ readonly product: "product";
12
+ readonly user: "user";
13
+ };
14
+ export type ImageRole = typeof ImageRole[keyof typeof ImageRole];
15
+ export declare const ImageRole: {
16
+ readonly main: "main";
17
+ readonly gallery: "gallery";
18
+ readonly other: "other";
19
+ };
20
+ export type ImageStatus = typeof ImageStatus[keyof typeof ImageStatus];
21
+ export declare const ImageStatus: {
22
+ readonly pending: "pending";
23
+ readonly uploaded: "uploaded";
24
+ readonly processing: "processing";
25
+ readonly ready: "ready";
26
+ readonly failed: "failed";
27
+ readonly deleted: "deleted";
28
+ };
29
+ export interface Variant {
30
+ name?: string;
31
+ /** S3 key of the variant */
32
+ key?: string;
33
+ width?: number;
34
+ height?: number;
35
+ mime?: string;
36
+ size?: number;
37
+ }
38
+ export interface Image {
39
+ id: string;
40
+ ownerType: OwnerType;
41
+ ownerId: string;
42
+ role: ImageRole;
43
+ /** S3 key of the original image */
44
+ key: string;
45
+ /**
46
+ * Optional — direct URL if public or via proxy
47
+ * @nullable
48
+ */
49
+ url?: string | null;
50
+ alt: string;
51
+ mime: string;
52
+ size: number;
53
+ /** @nullable */
54
+ hash?: string | null;
55
+ status: ImageStatus;
56
+ variants?: Variant[];
57
+ createdAt: string;
58
+ modifiedAt: string;
59
+ }
60
+ export interface ImagePatch {
61
+ alt?: string;
62
+ role?: ImageRole;
63
+ /** Position in the product gallery */
64
+ order?: number;
65
+ }
66
+ export type PresignRequestContentType = typeof PresignRequestContentType[keyof typeof PresignRequestContentType];
67
+ export declare const PresignRequestContentType: {
68
+ readonly 'image/jpeg': "image/jpeg";
69
+ readonly 'image/png': "image/png";
70
+ readonly 'image/webp': "image/webp";
71
+ readonly 'image/avif': "image/avif";
72
+ };
73
+ export interface PresignRequest {
74
+ ownerType: OwnerType;
75
+ /**
76
+ * Draft ID or owner ID
77
+ * @minLength 1
78
+ */
79
+ ownerId: string;
80
+ /** @minLength 1 */
81
+ filename: string;
82
+ contentType: PresignRequestContentType;
83
+ /**
84
+ * Size in bytes
85
+ * @minimum 1
86
+ * @maximum 10485760
87
+ */
88
+ size: number;
89
+ role: ImageRole;
90
+ }
91
+ export type PresignResponseRequiredHeaders = {
92
+ [key: string]: string;
93
+ };
94
+ export interface PresignResponse {
95
+ uploadUrl: string;
96
+ /** Signed JWT token containing upload metadata (key, ownerType, ownerId, role, etc.) */
97
+ uploadToken: string;
98
+ /** TTL in seconds */
99
+ expiresIn: number;
100
+ requiredHeaders: PresignResponseRequiredHeaders;
101
+ }
102
+ export interface ConfirmRequest {
103
+ /**
104
+ * Signed JWT token from presign response
105
+ * @minLength 1
106
+ */
107
+ uploadToken: string;
108
+ alt: string;
109
+ role: ImageRole;
110
+ /**
111
+ * e.g., SHA256 hex for additional integrity check
112
+ * @nullable
113
+ */
114
+ checksum?: string | null;
115
+ }
116
+ export interface PromoteRequest {
117
+ /** @minLength 1 */
118
+ draftId: string;
119
+ /** @minLength 1 */
120
+ productId: string;
121
+ /** If true — copy to products/{productId}/... and remove old objects */
122
+ move: boolean;
123
+ /** If omitted — promote all images of the draft */
124
+ images?: string[];
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
+ export type ProblemErrorsItem = {
178
+ field?: string;
179
+ message?: string;
180
+ };
181
+ /**
182
+ * RFC7807 Problem Details
183
+ */
184
+ export interface Problem {
185
+ type: string;
186
+ title: string;
187
+ status: number;
188
+ detail?: string;
189
+ instance?: string;
190
+ traceId?: string;
191
+ errors?: ProblemErrorsItem[];
192
+ }
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
+ export type DeleteImageParams = {
214
+ /**
215
+ * If true — delete objects in MinIO and remove DB record permanently
216
+ */
217
+ hard?: boolean;
218
+ };
219
+ export type GetDeliveryUrlParams = {
220
+ /**
221
+ * Name of a pre-generated variant (if exists)
222
+ */
223
+ variant?: string;
224
+ /**
225
+ * @minimum 1
226
+ */
227
+ w?: number;
228
+ /**
229
+ * @minimum 1
230
+ */
231
+ h?: number;
232
+ fit?: GetDeliveryUrlFit;
233
+ format?: GetDeliveryUrlFormat;
234
+ /**
235
+ * @minimum 1
236
+ * @maximum 100
237
+ */
238
+ quality?: number;
239
+ /**
240
+ * @minimum 0.5
241
+ * @maximum 3
242
+ */
243
+ dpr?: number;
244
+ /**
245
+ * If imgproxy is configured with signature expiration, an `expires` param will be included
246
+ * @minimum 0
247
+ */
248
+ ttlSeconds?: number;
249
+ };
250
+ export type GetDeliveryUrlFit = typeof GetDeliveryUrlFit[keyof typeof GetDeliveryUrlFit];
251
+ export declare const GetDeliveryUrlFit: {
252
+ readonly cover: "cover";
253
+ readonly contain: "contain";
254
+ readonly fill: "fill";
255
+ readonly inside: "inside";
256
+ readonly outside: "outside";
257
+ };
258
+ export type GetDeliveryUrlFormat = typeof GetDeliveryUrlFormat[keyof typeof GetDeliveryUrlFormat];
259
+ export declare const GetDeliveryUrlFormat: {
260
+ readonly original: "original";
261
+ readonly webp: "webp";
262
+ readonly avif: "avif";
263
+ readonly jpeg: "jpeg";
264
+ readonly png: "png";
265
+ };
266
+ export type GetDeliveryUrl200 = {
267
+ url: string;
268
+ expiresAt?: string;
269
+ };
270
+ export type PromoteImages200 = {
271
+ promoted?: Image[];
272
+ };
273
+ export type ProcessImageBody = {
274
+ imageId?: string;
275
+ /** Name of the preset (variant set), if used */
276
+ preset?: string;
277
+ };
@@ -0,0 +1,60 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
2
+ export const OwnerType = {
3
+ productDraft: 'productDraft',
4
+ product: 'product',
5
+ user: 'user',
6
+ };
7
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
8
+ export const ImageRole = {
9
+ main: 'main',
10
+ gallery: 'gallery',
11
+ other: 'other',
12
+ };
13
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
14
+ export const ImageStatus = {
15
+ pending: 'pending',
16
+ uploaded: 'uploaded',
17
+ processing: 'processing',
18
+ ready: 'ready',
19
+ failed: 'failed',
20
+ deleted: 'deleted',
21
+ };
22
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
23
+ export const PresignRequestContentType = {
24
+ 'image/jpeg': 'image/jpeg',
25
+ 'image/png': 'image/png',
26
+ 'image/webp': 'image/webp',
27
+ 'image/avif': 'image/avif',
28
+ };
29
+ // 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
+ export const GetDeliveryUrlFit = {
47
+ cover: 'cover',
48
+ contain: 'contain',
49
+ fill: 'fill',
50
+ inside: 'inside',
51
+ outside: 'outside',
52
+ };
53
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
54
+ export const GetDeliveryUrlFormat = {
55
+ original: 'original',
56
+ webp: 'webp',
57
+ avif: 'avif',
58
+ jpeg: 'jpeg',
59
+ png: 'png',
60
+ };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,2 @@
1
- /**
2
- * Image Service API
3
- * API for managing images
4
- *
5
- * The version of the OpenAPI document: 1.0.27
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- export * from "./api";
13
- export * from "./configuration";
1
+ export * from './api';
2
+ export * from './api.schemas';
package/dist/index.js CHANGED
@@ -1,15 +1,2 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Image Service API
5
- * API for managing images
6
- *
7
- * The version of the OpenAPI document: 1.0.27
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- export * from "./api";
15
- export * from "./configuration";
1
+ export * from './api';
2
+ export * from './api.schemas';
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.27",
4
+ "version": "1.0.28",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "module": "dist/index.js",
@@ -10,17 +10,12 @@
10
10
  "prepare": "npm run build"
11
11
  },
12
12
  "keywords": ["openapi", "typescript", "axios", "sdk"],
13
- "author": "Sokol111",
14
13
  "license": "MIT",
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/Sokol111/ecommerce-image-service-api.git"
18
- },
19
14
  "dependencies": {
20
- "axios": "^1.6.1"
15
+ "axios": "^1.10.0"
21
16
  },
22
17
  "devDependencies": {
23
- "typescript": "^5.4.0"
18
+ "typescript": "^5"
24
19
  },
25
20
  "publishConfig": {
26
21
  "access": "public"
package/dist/base.d.ts DELETED
@@ -1,42 +0,0 @@
1
- /**
2
- * Image Service API
3
- * API for managing images
4
- *
5
- * The version of the OpenAPI document: 1.0.27
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import type { Configuration } from './configuration';
13
- import type { AxiosInstance, RawAxiosRequestConfig } from 'axios';
14
- export declare const BASE_PATH: string;
15
- export declare const COLLECTION_FORMATS: {
16
- csv: string;
17
- ssv: string;
18
- tsv: string;
19
- pipes: string;
20
- };
21
- export interface RequestArgs {
22
- url: string;
23
- options: RawAxiosRequestConfig;
24
- }
25
- export declare class BaseAPI {
26
- protected basePath: string;
27
- protected axios: AxiosInstance;
28
- protected configuration: Configuration | undefined;
29
- constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
30
- }
31
- export declare class RequiredError extends Error {
32
- field: string;
33
- constructor(field: string, msg?: string);
34
- }
35
- interface ServerMap {
36
- [key: string]: {
37
- url: string;
38
- description: string;
39
- }[];
40
- }
41
- export declare const operationServerMap: ServerMap;
42
- export {};
package/dist/base.js DELETED
@@ -1,41 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Image Service API
5
- * API for managing images
6
- *
7
- * The version of the OpenAPI document: 1.0.27
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- import globalAxios from 'axios';
15
- export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
16
- export const COLLECTION_FORMATS = {
17
- csv: ",",
18
- ssv: " ",
19
- tsv: "\t",
20
- pipes: "|",
21
- };
22
- export class BaseAPI {
23
- constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
24
- var _a;
25
- this.basePath = basePath;
26
- this.axios = axios;
27
- if (configuration) {
28
- this.configuration = configuration;
29
- this.basePath = (_a = configuration.basePath) !== null && _a !== void 0 ? _a : basePath;
30
- }
31
- }
32
- }
33
- ;
34
- export class RequiredError extends Error {
35
- constructor(field, msg) {
36
- super(msg);
37
- this.field = field;
38
- this.name = "RequiredError";
39
- }
40
- }
41
- export const operationServerMap = {};
package/dist/common.d.ts DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * Image Service API
3
- * API for managing images
4
- *
5
- * The version of the OpenAPI document: 1.0.27
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import type { Configuration } from "./configuration";
13
- import type { RequestArgs } from "./base";
14
- import type { AxiosInstance, AxiosResponse } from 'axios';
15
- export declare const DUMMY_BASE_URL = "https://example.com";
16
- /**
17
- *
18
- * @throws {RequiredError}
19
- */
20
- export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
21
- export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
22
- export declare const setBasicAuthToObject: (object: any, configuration?: Configuration) => void;
23
- export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
24
- export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
25
- export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
26
- export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
27
- export declare const toPathString: (url: URL) => string;
28
- export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
package/dist/common.js DELETED
@@ -1,112 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Image Service API
5
- * API for managing images
6
- *
7
- * The version of the OpenAPI document: 1.0.27
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
- import { RequiredError } from "./base";
24
- export const DUMMY_BASE_URL = 'https://example.com';
25
- /**
26
- *
27
- * @throws {RequiredError}
28
- */
29
- export const assertParamExists = function (functionName, paramName, paramValue) {
30
- if (paramValue === null || paramValue === undefined) {
31
- throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
32
- }
33
- };
34
- export const setApiKeyToObject = function (object, keyParamName, configuration) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- if (configuration && configuration.apiKey) {
37
- const localVarApiKeyValue = typeof configuration.apiKey === 'function'
38
- ? yield configuration.apiKey(keyParamName)
39
- : yield configuration.apiKey;
40
- object[keyParamName] = localVarApiKeyValue;
41
- }
42
- });
43
- };
44
- export const setBasicAuthToObject = function (object, configuration) {
45
- if (configuration && (configuration.username || configuration.password)) {
46
- object["auth"] = { username: configuration.username, password: configuration.password };
47
- }
48
- };
49
- export const setBearerAuthToObject = function (object, configuration) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- if (configuration && configuration.accessToken) {
52
- const accessToken = typeof configuration.accessToken === 'function'
53
- ? yield configuration.accessToken()
54
- : yield configuration.accessToken;
55
- object["Authorization"] = "Bearer " + accessToken;
56
- }
57
- });
58
- };
59
- export const setOAuthToObject = function (object, name, scopes, configuration) {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- if (configuration && configuration.accessToken) {
62
- const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
63
- ? yield configuration.accessToken(name, scopes)
64
- : yield configuration.accessToken;
65
- object["Authorization"] = "Bearer " + localVarAccessTokenValue;
66
- }
67
- });
68
- };
69
- function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
70
- if (parameter == null)
71
- return;
72
- if (typeof parameter === "object") {
73
- if (Array.isArray(parameter)) {
74
- parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
75
- }
76
- else {
77
- Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
78
- }
79
- }
80
- else {
81
- if (urlSearchParams.has(key)) {
82
- urlSearchParams.append(key, parameter);
83
- }
84
- else {
85
- urlSearchParams.set(key, parameter);
86
- }
87
- }
88
- }
89
- export const setSearchParams = function (url, ...objects) {
90
- const searchParams = new URLSearchParams(url.search);
91
- setFlattenedQueryParams(searchParams, objects);
92
- url.search = searchParams.toString();
93
- };
94
- export const serializeDataIfNeeded = function (value, requestOptions, configuration) {
95
- const nonString = typeof value !== 'string';
96
- const needsSerialization = nonString && configuration && configuration.isJsonMime
97
- ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
98
- : nonString;
99
- return needsSerialization
100
- ? JSON.stringify(value !== undefined ? value : {})
101
- : (value || "");
102
- };
103
- export const toPathString = function (url) {
104
- return url.pathname + url.search + url.hash;
105
- };
106
- export const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
107
- return (axios = globalAxios, basePath = BASE_PATH) => {
108
- var _a;
109
- const axiosRequestArgs = Object.assign(Object.assign({}, axiosArgs.options), { url: (axios.defaults.baseURL ? '' : (_a = configuration === null || configuration === void 0 ? void 0 : configuration.basePath) !== null && _a !== void 0 ? _a : basePath) + axiosArgs.url });
110
- return axios.request(axiosRequestArgs);
111
- };
112
- };