@veruna/api-contracts 1.0.18 → 1.0.19
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/build/controllers/ai-provider.controllers.d.ts +5 -0
- package/build/controllers/ai-provider.controllers.js +8 -0
- package/build/controllers/file.controllers.d.ts +5 -0
- package/build/controllers/file.controllers.js +8 -0
- package/build/controllers/index.d.ts +2 -0
- package/build/controllers/index.js +6 -1
- package/build/rest-api.d.ts +21 -0
- package/build/rest-api.js +26 -0
- package/build/routes/ai-provider-admin.routes.d.ts +11 -0
- package/build/routes/ai-provider-admin.routes.js +14 -0
- package/build/routes/ai-provider-public.routes.d.ts +7 -0
- package/build/routes/ai-provider-public.routes.js +10 -0
- package/build/routes/file.routes.d.ts +14 -0
- package/build/routes/file.routes.js +20 -0
- package/build/routes/index.d.ts +3 -0
- package/build/routes/index.js +7 -1
- package/build/v1/ai-provider/admin/commands/create-provider.command.d.ts +23 -0
- package/build/v1/ai-provider/admin/commands/create-provider.command.js +13 -0
- package/build/v1/ai-provider/admin/commands/delete-provider.command.d.ts +14 -0
- package/build/v1/ai-provider/admin/commands/delete-provider.command.js +17 -0
- package/build/v1/ai-provider/admin/commands/index.d.ts +3 -0
- package/build/v1/ai-provider/admin/commands/index.js +19 -0
- package/build/v1/ai-provider/admin/commands/update-provider.command.d.ts +27 -0
- package/build/v1/ai-provider/admin/commands/update-provider.command.js +14 -0
- package/build/v1/ai-provider/admin/queries/get-provider.query.d.ts +20 -0
- package/build/v1/ai-provider/admin/queries/get-provider.query.js +13 -0
- package/build/v1/ai-provider/admin/queries/get-providers.query.d.ts +31 -0
- package/build/v1/ai-provider/admin/queries/get-providers.query.js +14 -0
- package/build/v1/ai-provider/admin/queries/index.d.ts +2 -0
- package/build/v1/ai-provider/admin/queries/index.js +18 -0
- package/build/v1/ai-provider/ai-provider.errors.d.ts +7 -0
- package/build/v1/ai-provider/ai-provider.errors.js +23 -0
- package/build/v1/ai-provider/index.d.ts +5 -0
- package/build/v1/ai-provider/index.js +21 -0
- package/build/v1/ai-provider/public/queries/get-active-providers.query.d.ts +18 -0
- package/build/v1/ai-provider/public/queries/get-active-providers.query.js +16 -0
- package/build/v1/ai-provider/public/queries/index.d.ts +1 -0
- package/build/v1/ai-provider/public/queries/index.js +17 -0
- package/build/v1/ai-provider/schemas/ai-provider-status.enum.d.ts +7 -0
- package/build/v1/ai-provider/schemas/ai-provider-status.enum.js +11 -0
- package/build/v1/ai-provider/schemas/create-provider-request.schema.d.ts +9 -0
- package/build/v1/ai-provider/schemas/create-provider-request.schema.js +16 -0
- package/build/v1/ai-provider/schemas/index.d.ts +5 -0
- package/build/v1/ai-provider/schemas/index.js +21 -0
- package/build/v1/ai-provider/schemas/provider-response.schema.d.ts +15 -0
- package/build/v1/ai-provider/schemas/provider-response.schema.js +18 -0
- package/build/v1/ai-provider/schemas/route-params.schema.d.ts +4 -0
- package/build/v1/ai-provider/schemas/route-params.schema.js +8 -0
- package/build/v1/ai-provider/schemas/update-provider-request.schema.d.ts +9 -0
- package/build/v1/ai-provider/schemas/update-provider-request.schema.js +17 -0
- package/build/v1/file/commands/delete-file-by-key.command.d.ts +15 -0
- package/build/v1/file/commands/delete-file-by-key.command.js +15 -0
- package/build/v1/file/commands/delete-file.command.d.ts +15 -0
- package/build/v1/file/commands/delete-file.command.js +18 -0
- package/build/v1/file/commands/index.d.ts +4 -0
- package/build/v1/file/commands/index.js +20 -0
- package/build/v1/file/commands/upload-file.command.d.ts +16 -0
- package/build/v1/file/commands/upload-file.command.js +15 -0
- package/build/v1/file/commands/upload-image.command.d.ts +19 -0
- package/build/v1/file/commands/upload-image.command.js +15 -0
- package/build/v1/file/file.errors.d.ts +15 -0
- package/build/v1/file/file.errors.js +73 -0
- package/build/v1/file/index.d.ts +6 -0
- package/build/v1/file/index.js +26 -0
- package/build/v1/file/queries/get-file.query.d.ts +33 -0
- package/build/v1/file/queries/get-file.query.js +18 -0
- package/build/v1/file/queries/index.d.ts +3 -0
- package/build/v1/file/queries/index.js +19 -0
- package/build/v1/file/queries/list-files.query.d.ts +38 -0
- package/build/v1/file/queries/list-files.query.js +15 -0
- package/build/v1/file/queries/list-folders.query.d.ts +17 -0
- package/build/v1/file/queries/list-folders.query.js +15 -0
- package/build/v1/file/schemas/delete-file-by-key-request.schema.d.ts +7 -0
- package/build/v1/file/schemas/delete-file-by-key-request.schema.js +10 -0
- package/build/v1/file/schemas/delete-file-response.schema.d.ts +15 -0
- package/build/v1/file/schemas/delete-file-response.schema.js +18 -0
- package/build/v1/file/schemas/file-category.enum.d.ts +9 -0
- package/build/v1/file/schemas/file-category.enum.js +13 -0
- package/build/v1/file/schemas/file-response.schema.d.ts +18 -0
- package/build/v1/file/schemas/file-response.schema.js +21 -0
- package/build/v1/file/schemas/file-status.enum.d.ts +10 -0
- package/build/v1/file/schemas/file-status.enum.js +14 -0
- package/build/v1/file/schemas/file-variant-response.schema.d.ts +13 -0
- package/build/v1/file/schemas/file-variant-response.schema.js +16 -0
- package/build/v1/file/schemas/file-with-variants-response.schema.d.ts +26 -0
- package/build/v1/file/schemas/file-with-variants-response.schema.js +13 -0
- package/build/v1/file/schemas/folder-response.schema.d.ts +17 -0
- package/build/v1/file/schemas/folder-response.schema.js +17 -0
- package/build/v1/file/schemas/image-format.enum.d.ts +7 -0
- package/build/v1/file/schemas/image-format.enum.js +11 -0
- package/build/v1/file/schemas/index.d.ts +16 -0
- package/build/v1/file/schemas/index.js +37 -0
- package/build/v1/file/schemas/list-files-request.schema.d.ts +14 -0
- package/build/v1/file/schemas/list-files-request.schema.js +17 -0
- package/build/v1/file/schemas/list-files-response.schema.d.ts +26 -0
- package/build/v1/file/schemas/list-files-response.schema.js +13 -0
- package/build/v1/file/schemas/list-folders-request.schema.d.ts +7 -0
- package/build/v1/file/schemas/list-folders-request.schema.js +10 -0
- package/build/v1/file/schemas/upload-file-request.schema.d.ts +7 -0
- package/build/v1/file/schemas/upload-file-request.schema.js +10 -0
- package/build/v1/file/schemas/upload-file-response.schema.d.ts +9 -0
- package/build/v1/file/schemas/upload-file-response.schema.js +12 -0
- package/build/v1/file/schemas/upload-image-request.schema.d.ts +18 -0
- package/build/v1/file/schemas/upload-image-request.schema.js +28 -0
- package/build/v1/file/schemas/upload-image-response.schema.d.ts +10 -0
- package/build/v1/file/schemas/upload-image-response.schema.js +19 -0
- package/build/v1/index.d.ts +1 -0
- package/build/v1/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AiProviderStatus } from './ai-provider-status.enum';
|
|
3
|
+
export declare const CreateProviderRequestSchema: z.ZodObject<{
|
|
4
|
+
title: z.ZodString;
|
|
5
|
+
icon: z.ZodString;
|
|
6
|
+
status: z.ZodDefault<z.ZodEnum<typeof AiProviderStatus>>;
|
|
7
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type CreateProviderRequest = z.infer<typeof CreateProviderRequestSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateProviderRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ai_provider_status_enum_1 = require("./ai-provider-status.enum");
|
|
6
|
+
exports.CreateProviderRequestSchema = zod_1.z.object({
|
|
7
|
+
title: zod_1.z.string().min(1).max(100),
|
|
8
|
+
icon: zod_1.z
|
|
9
|
+
.string()
|
|
10
|
+
.url()
|
|
11
|
+
.refine((url) => url.startsWith('https://'), {
|
|
12
|
+
message: 'Icon URL must use HTTPS',
|
|
13
|
+
}),
|
|
14
|
+
status: zod_1.z.nativeEnum(ai_provider_status_enum_1.AiProviderStatus).default(ai_provider_status_enum_1.AiProviderStatus.ACTIVE),
|
|
15
|
+
order: zod_1.z.number().int().nonnegative().default(0),
|
|
16
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ai-provider-status.enum"), exports);
|
|
18
|
+
__exportStar(require("./provider-response.schema"), exports);
|
|
19
|
+
__exportStar(require("./create-provider-request.schema"), exports);
|
|
20
|
+
__exportStar(require("./update-provider-request.schema"), exports);
|
|
21
|
+
__exportStar(require("./route-params.schema"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AiProviderStatus } from './ai-provider-status.enum';
|
|
3
|
+
/**
|
|
4
|
+
* AI Provider Response Schema
|
|
5
|
+
*/
|
|
6
|
+
export declare const ProviderResponseSchema: z.ZodObject<{
|
|
7
|
+
uuid: z.ZodString;
|
|
8
|
+
title: z.ZodString;
|
|
9
|
+
icon: z.ZodString;
|
|
10
|
+
status: z.ZodEnum<typeof AiProviderStatus>;
|
|
11
|
+
order: z.ZodNumber;
|
|
12
|
+
createdAt: z.ZodString;
|
|
13
|
+
updatedAt: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type ProviderResponse = z.infer<typeof ProviderResponseSchema>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const shared_1 = require("../../../shared");
|
|
6
|
+
const ai_provider_status_enum_1 = require("./ai-provider-status.enum");
|
|
7
|
+
/**
|
|
8
|
+
* AI Provider Response Schema
|
|
9
|
+
*/
|
|
10
|
+
exports.ProviderResponseSchema = zod_1.z.object({
|
|
11
|
+
uuid: zod_1.z.string().regex(shared_1.UUID_REGEX),
|
|
12
|
+
title: zod_1.z.string(),
|
|
13
|
+
icon: zod_1.z.string(),
|
|
14
|
+
status: zod_1.z.enum(ai_provider_status_enum_1.AiProviderStatus),
|
|
15
|
+
order: zod_1.z.number().int().nonnegative(),
|
|
16
|
+
createdAt: zod_1.z.string().regex(shared_1.DATETIME_REGEX),
|
|
17
|
+
updatedAt: zod_1.z.string().regex(shared_1.DATETIME_REGEX),
|
|
18
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderUuidParamSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const shared_1 = require("../../../shared");
|
|
6
|
+
exports.ProviderUuidParamSchema = zod_1.z.object({
|
|
7
|
+
uuid: zod_1.z.string().regex(shared_1.UUID_REGEX),
|
|
8
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AiProviderStatus } from './ai-provider-status.enum';
|
|
3
|
+
export declare const UpdateProviderRequestSchema: z.ZodObject<{
|
|
4
|
+
title: z.ZodOptional<z.ZodString>;
|
|
5
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
6
|
+
status: z.ZodOptional<z.ZodEnum<typeof AiProviderStatus>>;
|
|
7
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export type UpdateProviderRequest = z.infer<typeof UpdateProviderRequestSchema>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateProviderRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ai_provider_status_enum_1 = require("./ai-provider-status.enum");
|
|
6
|
+
exports.UpdateProviderRequestSchema = zod_1.z.object({
|
|
7
|
+
title: zod_1.z.string().min(1).max(100).optional(),
|
|
8
|
+
icon: zod_1.z
|
|
9
|
+
.string()
|
|
10
|
+
.url()
|
|
11
|
+
.refine((url) => url.startsWith('https://'), {
|
|
12
|
+
message: 'Icon URL must use HTTPS',
|
|
13
|
+
})
|
|
14
|
+
.optional(),
|
|
15
|
+
status: zod_1.z.nativeEnum(ai_provider_status_enum_1.AiProviderStatus).optional(),
|
|
16
|
+
order: zod_1.z.number().int().nonnegative().optional(),
|
|
17
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpMethod } from '../../../shared/http-method';
|
|
3
|
+
export declare namespace FileDeleteByKeyCommand {
|
|
4
|
+
const Request: z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
const Response: z.ZodObject<{
|
|
8
|
+
message: z.ZodString;
|
|
9
|
+
key: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
const URL: "/api/v1/files/by-key";
|
|
12
|
+
const METHOD = HttpMethod.DELETE;
|
|
13
|
+
type RequestType = z.infer<typeof Request>;
|
|
14
|
+
type ResponseType = z.infer<typeof Response>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileDeleteByKeyCommand = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const rest_api_1 = require("../../../rest-api");
|
|
6
|
+
const http_method_1 = require("../../../shared/http-method");
|
|
7
|
+
var FileDeleteByKeyCommand;
|
|
8
|
+
(function (FileDeleteByKeyCommand) {
|
|
9
|
+
// Request/Response
|
|
10
|
+
FileDeleteByKeyCommand.Request = schemas_1.DeleteFileByKeyQuerySchema;
|
|
11
|
+
FileDeleteByKeyCommand.Response = schemas_1.DeleteFileByKeyResponseSchema;
|
|
12
|
+
// URL/Method
|
|
13
|
+
FileDeleteByKeyCommand.URL = rest_api_1.REST_API.V1.FILE.DELETE_BY_KEY;
|
|
14
|
+
FileDeleteByKeyCommand.METHOD = http_method_1.HttpMethod.DELETE;
|
|
15
|
+
})(FileDeleteByKeyCommand || (exports.FileDeleteByKeyCommand = FileDeleteByKeyCommand = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpMethod } from '../../../shared/http-method';
|
|
3
|
+
export declare namespace FileDeleteCommand {
|
|
4
|
+
const Request: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
const Response: z.ZodObject<{
|
|
8
|
+
success: z.ZodBoolean;
|
|
9
|
+
message: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
const URL: (id: string) => string;
|
|
12
|
+
const METHOD = HttpMethod.DELETE;
|
|
13
|
+
type RequestType = z.infer<typeof Request>;
|
|
14
|
+
type ResponseType = z.infer<typeof Response>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileDeleteCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../schemas");
|
|
6
|
+
const rest_api_1 = require("../../../rest-api");
|
|
7
|
+
const http_method_1 = require("../../../shared/http-method");
|
|
8
|
+
var FileDeleteCommand;
|
|
9
|
+
(function (FileDeleteCommand) {
|
|
10
|
+
// Request/Response
|
|
11
|
+
FileDeleteCommand.Request = zod_1.z.object({
|
|
12
|
+
id: zod_1.z.string().uuid(),
|
|
13
|
+
});
|
|
14
|
+
FileDeleteCommand.Response = schemas_1.DeleteFileResponseSchema;
|
|
15
|
+
// URL/Method
|
|
16
|
+
FileDeleteCommand.URL = rest_api_1.REST_API.V1.FILE.DELETE_BY_ID;
|
|
17
|
+
FileDeleteCommand.METHOD = http_method_1.HttpMethod.DELETE;
|
|
18
|
+
})(FileDeleteCommand || (exports.FileDeleteCommand = FileDeleteCommand = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./upload-image.command"), exports);
|
|
18
|
+
__exportStar(require("./upload-file.command"), exports);
|
|
19
|
+
__exportStar(require("./delete-file.command"), exports);
|
|
20
|
+
__exportStar(require("./delete-file-by-key.command"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpMethod } from '../../../shared/http-method';
|
|
3
|
+
export declare namespace FileUploadCommand {
|
|
4
|
+
const Request: z.ZodObject<{
|
|
5
|
+
folder: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
const Response: z.ZodObject<{
|
|
8
|
+
key: z.ZodString;
|
|
9
|
+
cdnUrl: z.ZodString;
|
|
10
|
+
s3Url: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
const URL: "/api/v1/files/upload";
|
|
13
|
+
const METHOD = HttpMethod.PUT;
|
|
14
|
+
type RequestType = z.infer<typeof Request>;
|
|
15
|
+
type ResponseType = z.infer<typeof Response>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileUploadCommand = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const rest_api_1 = require("../../../rest-api");
|
|
6
|
+
const http_method_1 = require("../../../shared/http-method");
|
|
7
|
+
var FileUploadCommand;
|
|
8
|
+
(function (FileUploadCommand) {
|
|
9
|
+
// Request/Response
|
|
10
|
+
FileUploadCommand.Request = schemas_1.UploadFileQuerySchema;
|
|
11
|
+
FileUploadCommand.Response = schemas_1.UploadFileResponseSchema;
|
|
12
|
+
// URL/Method
|
|
13
|
+
FileUploadCommand.URL = rest_api_1.REST_API.V1.FILE.UPLOAD;
|
|
14
|
+
FileUploadCommand.METHOD = http_method_1.HttpMethod.PUT;
|
|
15
|
+
})(FileUploadCommand || (exports.FileUploadCommand = FileUploadCommand = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpMethod } from '../../../shared/http-method';
|
|
3
|
+
export declare namespace FileUploadImageCommand {
|
|
4
|
+
const Request: z.ZodObject<{
|
|
5
|
+
folder: z.ZodString;
|
|
6
|
+
formats: z.ZodString;
|
|
7
|
+
sizes: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
const Response: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
variants: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
12
|
+
cdnUrl: z.ZodString;
|
|
13
|
+
s3Url: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
const URL: "/api/v1/files/upload-image";
|
|
16
|
+
const METHOD = HttpMethod.PUT;
|
|
17
|
+
type RequestType = z.infer<typeof Request>;
|
|
18
|
+
type ResponseType = z.infer<typeof Response>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileUploadImageCommand = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const rest_api_1 = require("../../../rest-api");
|
|
6
|
+
const http_method_1 = require("../../../shared/http-method");
|
|
7
|
+
var FileUploadImageCommand;
|
|
8
|
+
(function (FileUploadImageCommand) {
|
|
9
|
+
// Request/Response
|
|
10
|
+
FileUploadImageCommand.Request = schemas_1.UploadImageQuerySchema;
|
|
11
|
+
FileUploadImageCommand.Response = schemas_1.UploadImageResponseSchema;
|
|
12
|
+
// URL/Method
|
|
13
|
+
FileUploadImageCommand.URL = rest_api_1.REST_API.V1.FILE.UPLOAD_IMAGE;
|
|
14
|
+
FileUploadImageCommand.METHOD = http_method_1.HttpMethod.PUT;
|
|
15
|
+
})(FileUploadImageCommand || (exports.FileUploadImageCommand = FileUploadImageCommand = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ErrorMetadata } from '../../shared';
|
|
2
|
+
export declare enum FileErrorCode {
|
|
3
|
+
INVALID_REQUEST = "INVALID_REQUEST",
|
|
4
|
+
INVALID_FILE_TYPE = "INVALID_FILE_TYPE",
|
|
5
|
+
FILE_TOO_LARGE = "FILE_TOO_LARGE",
|
|
6
|
+
MISSING_PARAMETER = "MISSING_PARAMETER",
|
|
7
|
+
INVALID_PARAMETER = "INVALID_PARAMETER",
|
|
8
|
+
UNAUTHORIZED = "UNAUTHORIZED",
|
|
9
|
+
FORBIDDEN = "FORBIDDEN",
|
|
10
|
+
FILE_NOT_FOUND = "FILE_NOT_FOUND",
|
|
11
|
+
UPLOAD_FAILED = "UPLOAD_FAILED",
|
|
12
|
+
CONVERSION_FAILED = "CONVERSION_FAILED",
|
|
13
|
+
INTERNAL_ERROR = "INTERNAL_ERROR"
|
|
14
|
+
}
|
|
15
|
+
export declare const FILE_ERRORS: Record<FileErrorCode, ErrorMetadata>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FILE_ERRORS = exports.FileErrorCode = void 0;
|
|
4
|
+
var FileErrorCode;
|
|
5
|
+
(function (FileErrorCode) {
|
|
6
|
+
// 400 - Bad Request
|
|
7
|
+
FileErrorCode["INVALID_REQUEST"] = "INVALID_REQUEST";
|
|
8
|
+
FileErrorCode["INVALID_FILE_TYPE"] = "INVALID_FILE_TYPE";
|
|
9
|
+
FileErrorCode["FILE_TOO_LARGE"] = "FILE_TOO_LARGE";
|
|
10
|
+
FileErrorCode["MISSING_PARAMETER"] = "MISSING_PARAMETER";
|
|
11
|
+
FileErrorCode["INVALID_PARAMETER"] = "INVALID_PARAMETER";
|
|
12
|
+
// 401 - Unauthorized
|
|
13
|
+
FileErrorCode["UNAUTHORIZED"] = "UNAUTHORIZED";
|
|
14
|
+
// 403 - Forbidden
|
|
15
|
+
FileErrorCode["FORBIDDEN"] = "FORBIDDEN";
|
|
16
|
+
// 404 - Not Found
|
|
17
|
+
FileErrorCode["FILE_NOT_FOUND"] = "FILE_NOT_FOUND";
|
|
18
|
+
// 500 - Server Errors
|
|
19
|
+
FileErrorCode["UPLOAD_FAILED"] = "UPLOAD_FAILED";
|
|
20
|
+
FileErrorCode["CONVERSION_FAILED"] = "CONVERSION_FAILED";
|
|
21
|
+
FileErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
|
22
|
+
})(FileErrorCode || (exports.FileErrorCode = FileErrorCode = {}));
|
|
23
|
+
exports.FILE_ERRORS = {
|
|
24
|
+
// 400 - Bad Request
|
|
25
|
+
[FileErrorCode.INVALID_REQUEST]: {
|
|
26
|
+
code: FileErrorCode.INVALID_REQUEST,
|
|
27
|
+
statusCode: 400,
|
|
28
|
+
},
|
|
29
|
+
[FileErrorCode.INVALID_FILE_TYPE]: {
|
|
30
|
+
code: FileErrorCode.INVALID_FILE_TYPE,
|
|
31
|
+
statusCode: 400,
|
|
32
|
+
},
|
|
33
|
+
[FileErrorCode.FILE_TOO_LARGE]: {
|
|
34
|
+
code: FileErrorCode.FILE_TOO_LARGE,
|
|
35
|
+
statusCode: 400,
|
|
36
|
+
},
|
|
37
|
+
[FileErrorCode.MISSING_PARAMETER]: {
|
|
38
|
+
code: FileErrorCode.MISSING_PARAMETER,
|
|
39
|
+
statusCode: 400,
|
|
40
|
+
},
|
|
41
|
+
[FileErrorCode.INVALID_PARAMETER]: {
|
|
42
|
+
code: FileErrorCode.INVALID_PARAMETER,
|
|
43
|
+
statusCode: 400,
|
|
44
|
+
},
|
|
45
|
+
// 401 - Unauthorized
|
|
46
|
+
[FileErrorCode.UNAUTHORIZED]: {
|
|
47
|
+
code: FileErrorCode.UNAUTHORIZED,
|
|
48
|
+
statusCode: 401,
|
|
49
|
+
},
|
|
50
|
+
// 403 - Forbidden
|
|
51
|
+
[FileErrorCode.FORBIDDEN]: {
|
|
52
|
+
code: FileErrorCode.FORBIDDEN,
|
|
53
|
+
statusCode: 403,
|
|
54
|
+
},
|
|
55
|
+
// 404 - Not Found
|
|
56
|
+
[FileErrorCode.FILE_NOT_FOUND]: {
|
|
57
|
+
code: FileErrorCode.FILE_NOT_FOUND,
|
|
58
|
+
statusCode: 404,
|
|
59
|
+
},
|
|
60
|
+
// 500 - Server Errors
|
|
61
|
+
[FileErrorCode.UPLOAD_FAILED]: {
|
|
62
|
+
code: FileErrorCode.UPLOAD_FAILED,
|
|
63
|
+
statusCode: 500,
|
|
64
|
+
},
|
|
65
|
+
[FileErrorCode.CONVERSION_FAILED]: {
|
|
66
|
+
code: FileErrorCode.CONVERSION_FAILED,
|
|
67
|
+
statusCode: 500,
|
|
68
|
+
},
|
|
69
|
+
[FileErrorCode.INTERNAL_ERROR]: {
|
|
70
|
+
code: FileErrorCode.INTERNAL_ERROR,
|
|
71
|
+
statusCode: 500,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.FILE_ROUTES = exports.FILE_CONTROLLER = void 0;
|
|
18
|
+
__exportStar(require("./schemas"), exports);
|
|
19
|
+
__exportStar(require("./file.errors"), exports);
|
|
20
|
+
__exportStar(require("./commands"), exports);
|
|
21
|
+
__exportStar(require("./queries"), exports);
|
|
22
|
+
// Re-export from centralized locations
|
|
23
|
+
var controllers_1 = require("../../controllers");
|
|
24
|
+
Object.defineProperty(exports, "FILE_CONTROLLER", { enumerable: true, get: function () { return controllers_1.FILE_CONTROLLER; } });
|
|
25
|
+
var routes_1 = require("../../routes");
|
|
26
|
+
Object.defineProperty(exports, "FILE_ROUTES", { enumerable: true, get: function () { return routes_1.FILE_ROUTES; } });
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpMethod } from '../../../shared/http-method';
|
|
3
|
+
export declare namespace FileGetByIdQuery {
|
|
4
|
+
const Request: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
const Response: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
folder: z.ZodString;
|
|
10
|
+
filename: z.ZodString;
|
|
11
|
+
size: z.ZodNumber;
|
|
12
|
+
contentType: z.ZodString;
|
|
13
|
+
category: z.ZodEnum<typeof import("../schemas").FileCategory>;
|
|
14
|
+
status: z.ZodEnum<typeof import("../schemas").FileStatus>;
|
|
15
|
+
url: z.ZodOptional<z.ZodString>;
|
|
16
|
+
uploadedBy: z.ZodString;
|
|
17
|
+
uploadedAt: z.ZodString;
|
|
18
|
+
updatedAt: z.ZodString;
|
|
19
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
sizeName: z.ZodString;
|
|
22
|
+
format: z.ZodString;
|
|
23
|
+
sizeBytes: z.ZodNumber;
|
|
24
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
url: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
const URL: (id: string) => string;
|
|
30
|
+
const METHOD = HttpMethod.GET;
|
|
31
|
+
type RequestType = z.infer<typeof Request>;
|
|
32
|
+
type ResponseType = z.infer<typeof Response>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileGetByIdQuery = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../schemas");
|
|
6
|
+
const rest_api_1 = require("../../../rest-api");
|
|
7
|
+
const http_method_1 = require("../../../shared/http-method");
|
|
8
|
+
var FileGetByIdQuery;
|
|
9
|
+
(function (FileGetByIdQuery) {
|
|
10
|
+
// Request/Response
|
|
11
|
+
FileGetByIdQuery.Request = zod_1.z.object({
|
|
12
|
+
id: zod_1.z.string().uuid(),
|
|
13
|
+
});
|
|
14
|
+
FileGetByIdQuery.Response = schemas_1.FileWithVariantsResponseSchema;
|
|
15
|
+
// URL/Method
|
|
16
|
+
FileGetByIdQuery.URL = rest_api_1.REST_API.V1.FILE.GET_BY_ID;
|
|
17
|
+
FileGetByIdQuery.METHOD = http_method_1.HttpMethod.GET;
|
|
18
|
+
})(FileGetByIdQuery || (exports.FileGetByIdQuery = FileGetByIdQuery = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-file.query"), exports);
|
|
18
|
+
__exportStar(require("./list-files.query"), exports);
|
|
19
|
+
__exportStar(require("./list-folders.query"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpMethod } from '../../../shared/http-method';
|
|
3
|
+
export declare namespace FileListQuery {
|
|
4
|
+
const Request: z.ZodObject<{
|
|
5
|
+
folder: z.ZodOptional<z.ZodString>;
|
|
6
|
+
status: z.ZodOptional<z.ZodEnum<typeof import("../schemas").FileStatus>>;
|
|
7
|
+
category: z.ZodOptional<z.ZodEnum<typeof import("../schemas").FileCategory>>;
|
|
8
|
+
uploadedBy: z.ZodOptional<z.ZodString>;
|
|
9
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
10
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
const Response: z.ZodObject<{
|
|
13
|
+
data: z.ZodArray<z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
folder: z.ZodString;
|
|
16
|
+
filename: z.ZodString;
|
|
17
|
+
size: z.ZodNumber;
|
|
18
|
+
contentType: z.ZodString;
|
|
19
|
+
category: z.ZodEnum<typeof import("../schemas").FileCategory>;
|
|
20
|
+
status: z.ZodEnum<typeof import("../schemas").FileStatus>;
|
|
21
|
+
url: z.ZodOptional<z.ZodString>;
|
|
22
|
+
uploadedBy: z.ZodString;
|
|
23
|
+
uploadedAt: z.ZodString;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
meta: z.ZodObject<{
|
|
26
|
+
page: z.ZodNumber;
|
|
27
|
+
limit: z.ZodNumber;
|
|
28
|
+
total: z.ZodNumber;
|
|
29
|
+
totalPages: z.ZodNumber;
|
|
30
|
+
hasNext: z.ZodBoolean;
|
|
31
|
+
hasPrev: z.ZodBoolean;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
const URL: "/api/v1/files";
|
|
35
|
+
const METHOD = HttpMethod.GET;
|
|
36
|
+
type RequestType = z.infer<typeof Request>;
|
|
37
|
+
type ResponseType = z.infer<typeof Response>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileListQuery = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const rest_api_1 = require("../../../rest-api");
|
|
6
|
+
const http_method_1 = require("../../../shared/http-method");
|
|
7
|
+
var FileListQuery;
|
|
8
|
+
(function (FileListQuery) {
|
|
9
|
+
// Request/Response
|
|
10
|
+
FileListQuery.Request = schemas_1.ListFilesQuerySchema;
|
|
11
|
+
FileListQuery.Response = schemas_1.ListFilesResponseSchema;
|
|
12
|
+
// URL/Method
|
|
13
|
+
FileListQuery.URL = rest_api_1.REST_API.V1.FILE.LIST;
|
|
14
|
+
FileListQuery.METHOD = http_method_1.HttpMethod.GET;
|
|
15
|
+
})(FileListQuery || (exports.FileListQuery = FileListQuery = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { HttpMethod } from '../../../shared/http-method';
|
|
3
|
+
export declare namespace FileFoldersListQuery {
|
|
4
|
+
const Request: z.ZodObject<{
|
|
5
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
const Response: z.ZodObject<{
|
|
8
|
+
folders: z.ZodArray<z.ZodObject<{
|
|
9
|
+
path: z.ZodString;
|
|
10
|
+
fileCount: z.ZodNumber;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
const URL: "/api/v1/files/folders";
|
|
14
|
+
const METHOD = HttpMethod.GET;
|
|
15
|
+
type RequestType = z.infer<typeof Request>;
|
|
16
|
+
type ResponseType = z.infer<typeof Response>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileFoldersListQuery = void 0;
|
|
4
|
+
const schemas_1 = require("../schemas");
|
|
5
|
+
const rest_api_1 = require("../../../rest-api");
|
|
6
|
+
const http_method_1 = require("../../../shared/http-method");
|
|
7
|
+
var FileFoldersListQuery;
|
|
8
|
+
(function (FileFoldersListQuery) {
|
|
9
|
+
// Request/Response
|
|
10
|
+
FileFoldersListQuery.Request = schemas_1.ListFoldersQuerySchema;
|
|
11
|
+
FileFoldersListQuery.Response = schemas_1.ListFoldersResponseSchema;
|
|
12
|
+
// URL/Method
|
|
13
|
+
FileFoldersListQuery.URL = rest_api_1.REST_API.V1.FILE.FOLDERS;
|
|
14
|
+
FileFoldersListQuery.METHOD = http_method_1.HttpMethod.GET;
|
|
15
|
+
})(FileFoldersListQuery || (exports.FileFoldersListQuery = FileFoldersListQuery = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteFileByKeyQuerySchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Delete file by key query parameters schema
|
|
7
|
+
*/
|
|
8
|
+
exports.DeleteFileByKeyQuerySchema = zod_1.z.object({
|
|
9
|
+
key: zod_1.z.string().min(1),
|
|
10
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Delete file by ID response schema
|
|
4
|
+
*/
|
|
5
|
+
export declare const DeleteFileResponseSchema: z.ZodObject<{
|
|
6
|
+
success: z.ZodBoolean;
|
|
7
|
+
message: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
/**
|
|
10
|
+
* Delete file by key response schema (legacy)
|
|
11
|
+
*/
|
|
12
|
+
export declare const DeleteFileByKeyResponseSchema: z.ZodObject<{
|
|
13
|
+
message: z.ZodString;
|
|
14
|
+
key: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|