@nexim/upload-types
Version:
TypeScript types and interfaces for Nexim Media Upload Service, including image preset configurations and file handling types
115 lines • 3.46 kB
TypeScript
import type { ErrorResponse } from '@alwatr/nanotron';
/**
* Configuration presets for image upload and processing.
* Each preset defines both client-side and server-side image processing parameters.
*/
export declare const uploadImagePresetRecord: {
readonly 'product-image': {
readonly client: {
readonly defaultAppendName: ".jpeg";
readonly quality: 75;
readonly height: number;
readonly width: number;
};
readonly format: readonly [{
readonly type: "webp";
readonly appendName: ".webp.org";
readonly formatOptions: {
readonly quality: 75;
};
}, {
readonly type: "jpeg";
readonly appendName: ".jpeg";
readonly formatOptions: {
readonly quality: 75;
readonly mozjpeg: true;
};
}];
};
readonly 'financial-document': {
readonly client: {
readonly defaultAppendName: ".jpeg";
readonly quality: 75;
readonly height: number;
readonly width: number;
};
readonly format: readonly [{
readonly type: "webp";
readonly appendName: ".webp.org";
readonly formatOptions: {
readonly quality: 75;
};
}, {
readonly type: "jpeg";
readonly appendName: ".jpeg";
readonly formatOptions: {
readonly quality: 75;
readonly mozjpeg: true;
};
}];
};
readonly 'blog-post-cover': {
readonly client: {
readonly defaultAppendName: ".jpeg";
readonly quality: 75;
readonly height: number;
readonly width: number;
};
readonly format: readonly [{
readonly type: "webp";
readonly appendName: ".webp.org";
readonly formatOptions: {
readonly quality: 75;
};
}, {
readonly type: "jpeg";
readonly appendName: ".jpeg";
readonly formatOptions: {
readonly quality: 75;
readonly mozjpeg: true;
};
}];
};
};
/**
* Details about an uploaded file stored in the system.
* Includes common fields and type-specific fields using a discriminated union.
*/
export type FileDetail = {
/** ID of the user who uploaded the file */
userId: string;
/** Description of the file for maintenance */
description: string;
} & ({
/** Indicates this is a regular file */
type: 'file';
} | {
/** Indicates this is an image with multiple format variants */
type: 'image';
/** List of file name suffixes for each variant */
variants: string[];
});
/**
* The error response type from the service API.
* Inherits from the base ErrorResponse type.
*
* @internal
*/
export type ErrorServiceResponse = ErrorResponse;
/**
* The success response type from the service API.
* Contains a data payload of the specified generic type.
*
* @internal
*/
export type SuccessServiceResponse<TData extends Json> = {
ok: true;
data: TData;
};
/**
* Combined type representing either a success or error response.
*
* @internal
*/
export type ServiceResponse<TData extends Json> = SuccessServiceResponse<TData> | ErrorResponse;
//# sourceMappingURL=main.d.ts.map