arkos 1.4.0-canary.92 → 1.4.1-canary.2
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/cjs/app.js +1 -1
- package/dist/cjs/app.js.map +1 -1
- package/dist/cjs/exports/index.js.map +1 -1
- package/dist/cjs/modules/auth/auth.controller.js +1 -1
- package/dist/cjs/modules/auth/auth.controller.js.map +1 -1
- package/dist/cjs/modules/auth/auth.service.js +2 -3
- package/dist/cjs/modules/auth/auth.service.js.map +1 -1
- package/dist/cjs/modules/auth/utils/services/auth-action.service.js +50 -8
- package/dist/cjs/modules/auth/utils/services/auth-action.service.js.map +1 -1
- package/dist/cjs/modules/base/base.controller.js +6 -3
- package/dist/cjs/modules/base/base.controller.js.map +1 -1
- package/dist/cjs/modules/base/base.middlewares.js +8 -4
- package/dist/cjs/modules/base/base.middlewares.js.map +1 -1
- package/dist/cjs/modules/error-handler/error-handler.controller.js +2 -2
- package/dist/cjs/modules/error-handler/error-handler.controller.js.map +1 -1
- package/dist/cjs/modules/error-handler/utils/catch-async.js.map +1 -1
- package/dist/cjs/modules/swagger/swagger.router.js +6 -4
- package/dist/cjs/modules/swagger/swagger.router.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/built-in-route-path-object-manager.js +7 -0
- package/dist/cjs/modules/swagger/utils/built-in-route-path-object-manager.js.map +1 -0
- package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +308 -183
- package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +357 -288
- package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -5
- package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +280 -243
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js.map +1 -1
- package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js +8 -6
- package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -1
- package/dist/cjs/server.js +17 -15
- package/dist/cjs/server.js.map +1 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/new-arkos-config.js.map +1 -1
- package/dist/cjs/utils/arkos-router/index.js +32 -5
- package/dist/cjs/utils/arkos-router/index.js.map +1 -1
- package/dist/cjs/utils/arkos-router/types/index.js.map +1 -1
- package/dist/cjs/utils/arkos-router/utils/helpers/index.js +11 -0
- package/dist/cjs/utils/arkos-router/utils/helpers/index.js.map +1 -1
- package/dist/cjs/utils/cli/dev.js +12 -53
- package/dist/cjs/utils/cli/dev.js.map +1 -1
- package/dist/cjs/utils/cli/export-auth-action.js +1 -1
- package/dist/cjs/utils/cli/export-auth-action.js.map +1 -1
- package/dist/cjs/utils/cli/generate.js +3 -3
- package/dist/cjs/utils/cli/generate.js.map +1 -1
- package/dist/cjs/utils/cli/index.js +1 -1
- package/dist/cjs/utils/cli/index.js.map +1 -1
- package/dist/cjs/utils/cli/start.js +14 -10
- package/dist/cjs/utils/cli/start.js.map +1 -1
- package/dist/cjs/utils/cli/utils/cli.helpers.js +1 -1
- package/dist/cjs/utils/cli/utils/runtime-cli-commander.js +51 -6
- package/dist/cjs/utils/cli/utils/runtime-cli-commander.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +3 -3
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +3 -3
- package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/middlewares-template.js +6 -3
- package/dist/cjs/utils/cli/utils/template-generator/templates/middlewares-template.js.map +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js +3 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
- package/dist/cjs/utils/dotenv.helpers.js +10 -6
- package/dist/cjs/utils/dotenv.helpers.js.map +1 -1
- package/dist/cjs/utils/helpers/api.features.helpers.js +174 -81
- package/dist/cjs/utils/helpers/api.features.helpers.js.map +1 -1
- package/dist/cjs/utils/helpers/prisma.helpers.js +40 -1
- package/dist/cjs/utils/helpers/prisma.helpers.js.map +1 -1
- package/dist/cjs/utils/helpers/routers.helpers.js +0 -1
- package/dist/cjs/utils/helpers/routers.helpers.js.map +1 -1
- package/dist/esm/app.js +1 -1
- package/dist/esm/app.js.map +1 -1
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/modules/auth/auth.controller.js +1 -1
- package/dist/esm/modules/auth/auth.controller.js.map +1 -1
- package/dist/esm/modules/auth/auth.service.js +3 -4
- package/dist/esm/modules/auth/auth.service.js.map +1 -1
- package/dist/esm/modules/auth/utils/services/auth-action.service.js +50 -5
- package/dist/esm/modules/auth/utils/services/auth-action.service.js.map +1 -1
- package/dist/esm/modules/base/base.controller.js +6 -3
- package/dist/esm/modules/base/base.controller.js.map +1 -1
- package/dist/esm/modules/base/base.middlewares.js +8 -4
- package/dist/esm/modules/base/base.middlewares.js.map +1 -1
- package/dist/esm/modules/error-handler/error-handler.controller.js +2 -2
- package/dist/esm/modules/error-handler/error-handler.controller.js.map +1 -1
- package/dist/esm/modules/error-handler/utils/catch-async.js.map +1 -1
- package/dist/esm/modules/swagger/swagger.router.js +6 -4
- package/dist/esm/modules/swagger/swagger.router.js.map +1 -1
- package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js +5 -0
- package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js.map +1 -0
- package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +308 -183
- package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +357 -288
- package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -2
- package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +280 -243
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js.map +1 -1
- package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js +8 -6
- package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -1
- package/dist/esm/server.js +17 -15
- package/dist/esm/server.js.map +1 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/new-arkos-config.js.map +1 -1
- package/dist/esm/utils/arkos-router/index.js +33 -6
- package/dist/esm/utils/arkos-router/index.js.map +1 -1
- package/dist/esm/utils/arkos-router/types/index.js.map +1 -1
- package/dist/esm/utils/arkos-router/utils/helpers/index.js +10 -0
- package/dist/esm/utils/arkos-router/utils/helpers/index.js.map +1 -1
- package/dist/esm/utils/cli/dev.js +13 -54
- package/dist/esm/utils/cli/dev.js.map +1 -1
- package/dist/esm/utils/cli/export-auth-action.js +1 -1
- package/dist/esm/utils/cli/export-auth-action.js.map +1 -1
- package/dist/esm/utils/cli/generate.js +3 -3
- package/dist/esm/utils/cli/generate.js.map +1 -1
- package/dist/esm/utils/cli/index.js +1 -1
- package/dist/esm/utils/cli/index.js.map +1 -1
- package/dist/esm/utils/cli/start.js +14 -10
- package/dist/esm/utils/cli/start.js.map +1 -1
- package/dist/esm/utils/cli/utils/cli.helpers.js +1 -1
- package/dist/esm/utils/cli/utils/runtime-cli-commander.js +52 -7
- package/dist/esm/utils/cli/utils/runtime-cli-commander.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +3 -3
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +3 -3
- package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/middlewares-template.js +6 -3
- package/dist/esm/utils/cli/utils/template-generator/templates/middlewares-template.js.map +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js +3 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
- package/dist/esm/utils/dotenv.helpers.js +10 -6
- package/dist/esm/utils/dotenv.helpers.js.map +1 -1
- package/dist/esm/utils/helpers/api.features.helpers.js +174 -81
- package/dist/esm/utils/helpers/api.features.helpers.js.map +1 -1
- package/dist/esm/utils/helpers/prisma.helpers.js +39 -1
- package/dist/esm/utils/helpers/prisma.helpers.js.map +1 -1
- package/dist/esm/utils/helpers/routers.helpers.js +0 -1
- package/dist/esm/utils/helpers/routers.helpers.js.map +1 -1
- package/dist/types/exports/index.d.ts +2 -1
- package/dist/types/modules/auth/auth.router.d.ts +1 -1
- package/dist/types/modules/auth/auth.service.d.ts +2 -2
- package/dist/types/modules/base/base.router.d.ts +1 -1
- package/dist/types/modules/swagger/utils/built-in-route-path-object-manager.d.ts +4 -0
- package/dist/types/modules/swagger/utils/helpers/get-authentication-json-schema-paths.d.ts +1 -1
- package/dist/types/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.d.ts +1 -1
- package/dist/types/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.d.ts +1 -1
- package/dist/types/modules/swagger/utils/helpers/swagger.router.helpers.d.ts +1 -1
- package/dist/types/types/index.d.ts +5 -5
- package/dist/types/types/new-arkos-config.d.ts +1 -1
- package/dist/types/utils/arkos-router/types/index.d.ts +15 -14
- package/dist/types/utils/arkos-router/utils/helpers/index.d.ts +1 -0
- package/dist/types/utils/helpers/prisma.helpers.d.ts +1 -0
- package/package.json +2 -2
|
@@ -8,8 +8,8 @@ const dynamic_loader_1 = require("../../../../utils/dynamic-loader");
|
|
|
8
8
|
const base_router_helpers_1 = require("../../../base/utils/helpers/base.router.helpers");
|
|
9
9
|
const deepmerge_helper_1 = __importDefault(require("../../../../utils/helpers/deepmerge.helper"));
|
|
10
10
|
const file_upload_service_1 = require("../../../file-upload/file-upload.service");
|
|
11
|
-
function getFileUploadJsonSchemaPaths(arkosConfig) {
|
|
12
|
-
const paths = {};
|
|
11
|
+
function getFileUploadJsonSchemaPaths(arkosConfig, existingPaths) {
|
|
12
|
+
const paths = { ...existingPaths };
|
|
13
13
|
if (!arkosConfig.fileUpload)
|
|
14
14
|
return paths;
|
|
15
15
|
const FileUploadModuleComponents = (0, dynamic_loader_1.getModuleComponents)("file-upload");
|
|
@@ -60,359 +60,428 @@ function getFileUploadJsonSchemaPaths(arkosConfig) {
|
|
|
60
60
|
const cleanBasePath = basePathname.endsWith("/")
|
|
61
61
|
? basePathname.slice(0, -1)
|
|
62
62
|
: basePathname;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
63
|
+
const pathname = `${cleanBasePath}/{filePath*}`;
|
|
64
|
+
if (!paths[pathname])
|
|
65
|
+
paths[pathname] = {};
|
|
66
|
+
const currentPath = paths[pathname].get;
|
|
67
|
+
const defaultParameters = [
|
|
68
|
+
{
|
|
69
|
+
name: "filePath",
|
|
70
|
+
in: "path",
|
|
71
|
+
required: true,
|
|
72
|
+
schema: { type: "string" },
|
|
73
|
+
description: "Path to the file including file type directory (e.g., images/photo.jpg, videos/clip.mp4)",
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
const existingParams = currentPath?.parameters || [];
|
|
77
|
+
const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
|
|
78
|
+
const mergedParameters = [
|
|
79
|
+
...existingParams,
|
|
80
|
+
...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
|
|
81
|
+
];
|
|
82
|
+
const defaultSpec = {
|
|
83
|
+
tags: ["File Upload", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
|
|
84
|
+
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
85
|
+
? "Retrieve uploaded file"
|
|
86
|
+
: currentPath?.summary,
|
|
87
|
+
description: currentPath?.description ||
|
|
88
|
+
`Serves static files from the upload directory (${baseUploadDir}). This endpoint uses wildcard path matching to serve files from any subdirectory.`,
|
|
89
|
+
operationId: currentPath?.operationId || "findFile",
|
|
90
|
+
...(shouldIncludeSecurity("View") && {
|
|
91
|
+
security: [{ BearerAuth: [] }],
|
|
92
|
+
}),
|
|
93
|
+
parameters: mergedParameters,
|
|
94
|
+
responses: {
|
|
95
|
+
...(currentPath?.responses || {}),
|
|
96
|
+
"200": currentPath?.responses?.["200"] || {
|
|
97
|
+
description: "File retrieved successfully",
|
|
98
|
+
content: {
|
|
99
|
+
"application/octet-stream": {
|
|
100
|
+
schema: {
|
|
101
|
+
type: "string",
|
|
102
|
+
format: "binary",
|
|
90
103
|
},
|
|
91
104
|
},
|
|
92
105
|
},
|
|
93
|
-
"404": {
|
|
94
|
-
description: "File not found",
|
|
95
|
-
},
|
|
96
|
-
...(shouldIncludeSecurity("View") && {
|
|
97
|
-
"401": { description: "Authentication required" },
|
|
98
|
-
"403": { description: "Insufficient permissions to view files" },
|
|
99
|
-
}),
|
|
100
106
|
},
|
|
107
|
+
"404": currentPath?.responses?.["404"] || {
|
|
108
|
+
description: "File not found",
|
|
109
|
+
},
|
|
110
|
+
...(shouldIncludeSecurity("View") && {
|
|
111
|
+
"401": currentPath?.responses?.["401"] || {
|
|
112
|
+
description: "Authentication required",
|
|
113
|
+
},
|
|
114
|
+
"403": currentPath?.responses?.["403"] || {
|
|
115
|
+
description: "Insufficient permissions to view files",
|
|
116
|
+
},
|
|
117
|
+
}),
|
|
101
118
|
},
|
|
102
119
|
};
|
|
120
|
+
paths[pathname].get = { ...(currentPath || {}), ...defaultSpec };
|
|
103
121
|
}
|
|
104
122
|
if (!isFileUploadEndpointDisabled("uploadFile")) {
|
|
105
123
|
const cleanBasePath = basePathname.endsWith("/")
|
|
106
124
|
? basePathname.slice(0, -1)
|
|
107
125
|
: basePathname;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
126
|
+
const pathname = `${cleanBasePath}/{fileType}`;
|
|
127
|
+
if (!paths[pathname])
|
|
128
|
+
paths[pathname] = {};
|
|
129
|
+
const currentPath = paths[pathname].post;
|
|
130
|
+
const defaultParameters = [
|
|
131
|
+
{
|
|
132
|
+
name: "fileType",
|
|
133
|
+
in: "path",
|
|
134
|
+
required: true,
|
|
135
|
+
schema: {
|
|
136
|
+
type: "string",
|
|
137
|
+
enum: ["images", "videos", "documents", "files"],
|
|
138
|
+
},
|
|
139
|
+
description: "Type of file being uploaded",
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "format",
|
|
143
|
+
in: "query",
|
|
144
|
+
required: false,
|
|
145
|
+
schema: {
|
|
146
|
+
type: "string",
|
|
147
|
+
enum: ["jpeg", "jpg", "png", "webp", "gif", "avif"],
|
|
148
|
+
},
|
|
149
|
+
description: "Image format for conversion (only applicable for fileType=images)",
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "width",
|
|
153
|
+
in: "query",
|
|
154
|
+
required: false,
|
|
155
|
+
schema: { type: "integer", minimum: 1 },
|
|
156
|
+
description: "Target width for image resize (only applicable for fileType=images)",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "height",
|
|
160
|
+
in: "query",
|
|
161
|
+
required: false,
|
|
162
|
+
schema: { type: "integer", minimum: 1 },
|
|
163
|
+
description: "Target height for image resize (only applicable for fileType=images)",
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "resizeTo",
|
|
167
|
+
in: "query",
|
|
168
|
+
required: false,
|
|
169
|
+
schema: {
|
|
170
|
+
type: "string",
|
|
171
|
+
enum: ["cover", "contain", "fill", "inside", "outside"],
|
|
172
|
+
},
|
|
173
|
+
description: "Resize strategy (only applicable for fileType=images)",
|
|
174
|
+
},
|
|
175
|
+
];
|
|
176
|
+
const existingParams = currentPath?.parameters || [];
|
|
177
|
+
const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
|
|
178
|
+
const mergedParameters = [
|
|
179
|
+
...existingParams,
|
|
180
|
+
...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
|
|
181
|
+
];
|
|
182
|
+
const defaultSpec = {
|
|
183
|
+
tags: ["File Upload", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
|
|
184
|
+
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
185
|
+
? "Upload file(s)"
|
|
186
|
+
: currentPath?.summary,
|
|
187
|
+
description: currentPath?.description ||
|
|
188
|
+
"Upload one or multiple files. Supports image processing options for image uploads.",
|
|
189
|
+
operationId: currentPath?.operationId || "uploadFile",
|
|
190
|
+
...(shouldIncludeSecurity("Create") && {
|
|
191
|
+
security: [{ BearerAuth: [] }],
|
|
192
|
+
}),
|
|
193
|
+
parameters: mergedParameters,
|
|
194
|
+
requestBody: currentPath?.requestBody || {
|
|
195
|
+
required: true,
|
|
196
|
+
content: {
|
|
197
|
+
"multipart/form-data": {
|
|
156
198
|
schema: {
|
|
157
|
-
type: "
|
|
158
|
-
|
|
199
|
+
type: "object",
|
|
200
|
+
properties: {
|
|
201
|
+
images: {
|
|
202
|
+
type: "array",
|
|
203
|
+
items: { type: "string", format: "binary" },
|
|
204
|
+
description: getFileTypeDescription("images"),
|
|
205
|
+
},
|
|
206
|
+
videos: {
|
|
207
|
+
type: "array",
|
|
208
|
+
items: { type: "string", format: "binary" },
|
|
209
|
+
description: getFileTypeDescription("videos"),
|
|
210
|
+
},
|
|
211
|
+
documents: {
|
|
212
|
+
type: "array",
|
|
213
|
+
items: { type: "string", format: "binary" },
|
|
214
|
+
description: getFileTypeDescription("documents"),
|
|
215
|
+
},
|
|
216
|
+
files: {
|
|
217
|
+
type: "array",
|
|
218
|
+
items: { type: "string", format: "binary" },
|
|
219
|
+
description: getFileTypeDescription("files"),
|
|
220
|
+
},
|
|
221
|
+
},
|
|
159
222
|
},
|
|
160
|
-
description: "Resize strategy (only applicable for fileType=images)",
|
|
161
223
|
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
responses: {
|
|
227
|
+
...(currentPath?.responses || {}),
|
|
228
|
+
"200": currentPath?.responses?.["200"] || {
|
|
229
|
+
description: "File(s) uploaded successfully",
|
|
165
230
|
content: {
|
|
166
|
-
"
|
|
231
|
+
"application/json": {
|
|
167
232
|
schema: {
|
|
168
233
|
type: "object",
|
|
169
234
|
properties: {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
documents: {
|
|
181
|
-
type: "array",
|
|
182
|
-
items: { type: "string", format: "binary" },
|
|
183
|
-
description: getFileTypeDescription("documents"),
|
|
184
|
-
},
|
|
185
|
-
files: {
|
|
186
|
-
type: "array",
|
|
187
|
-
items: { type: "string", format: "binary" },
|
|
188
|
-
description: getFileTypeDescription("files"),
|
|
235
|
+
success: { type: "boolean", example: true },
|
|
236
|
+
data: {
|
|
237
|
+
oneOf: [
|
|
238
|
+
{ type: "string", description: "URL of uploaded file" },
|
|
239
|
+
{
|
|
240
|
+
type: "array",
|
|
241
|
+
items: { type: "string" },
|
|
242
|
+
description: "URLs of uploaded files",
|
|
243
|
+
},
|
|
244
|
+
],
|
|
189
245
|
},
|
|
246
|
+
message: { type: "string" },
|
|
190
247
|
},
|
|
191
248
|
},
|
|
192
249
|
},
|
|
193
250
|
},
|
|
194
251
|
},
|
|
195
|
-
|
|
196
|
-
"
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
type: "object",
|
|
202
|
-
properties: {
|
|
203
|
-
success: { type: "boolean", example: true },
|
|
204
|
-
data: {
|
|
205
|
-
oneOf: [
|
|
206
|
-
{ type: "string", description: "URL of uploaded file" },
|
|
207
|
-
{
|
|
208
|
-
type: "array",
|
|
209
|
-
items: { type: "string" },
|
|
210
|
-
description: "URLs of uploaded files",
|
|
211
|
-
},
|
|
212
|
-
],
|
|
213
|
-
},
|
|
214
|
-
message: { type: "string" },
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
},
|
|
252
|
+
"400": currentPath?.responses?.["400"] || {
|
|
253
|
+
description: "Invalid file type, size limit exceeded, or no file uploaded",
|
|
254
|
+
},
|
|
255
|
+
...(shouldIncludeSecurity("Create") && {
|
|
256
|
+
"401": currentPath?.responses?.["401"] || {
|
|
257
|
+
description: "Authentication required",
|
|
219
258
|
},
|
|
220
|
-
"
|
|
221
|
-
description: "
|
|
259
|
+
"403": currentPath?.responses?.["403"] || {
|
|
260
|
+
description: "Insufficient permissions to upload files",
|
|
222
261
|
},
|
|
223
|
-
|
|
224
|
-
"401": { description: "Authentication required" },
|
|
225
|
-
"403": { description: "Insufficient permissions to upload files" },
|
|
226
|
-
}),
|
|
227
|
-
},
|
|
262
|
+
}),
|
|
228
263
|
},
|
|
229
264
|
};
|
|
265
|
+
paths[pathname].post = { ...(currentPath || {}), ...defaultSpec };
|
|
230
266
|
}
|
|
231
267
|
if (!isFileUploadEndpointDisabled("updateFile")) {
|
|
232
268
|
const cleanBasePath = basePathname.endsWith("/")
|
|
233
269
|
? basePathname.slice(0, -1)
|
|
234
270
|
: basePathname;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
271
|
+
const pathname = `${cleanBasePath}/{fileType}/{fileName}`;
|
|
272
|
+
if (!paths[pathname])
|
|
273
|
+
paths[pathname] = {};
|
|
274
|
+
const currentPath = paths[pathname].patch;
|
|
275
|
+
const defaultParameters = [
|
|
276
|
+
{
|
|
277
|
+
name: "fileType",
|
|
278
|
+
in: "path",
|
|
279
|
+
required: true,
|
|
280
|
+
schema: {
|
|
281
|
+
type: "string",
|
|
282
|
+
enum: ["images", "videos", "documents", "files"],
|
|
283
|
+
},
|
|
284
|
+
description: "Type of file being updated",
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
name: "fileName",
|
|
288
|
+
in: "path",
|
|
289
|
+
required: true,
|
|
290
|
+
schema: { type: "string" },
|
|
291
|
+
description: "Name of the file to update",
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: "format",
|
|
295
|
+
in: "query",
|
|
296
|
+
required: false,
|
|
297
|
+
schema: {
|
|
298
|
+
type: "string",
|
|
299
|
+
enum: ["jpeg", "jpg", "png", "webp", "gif", "avif"],
|
|
300
|
+
},
|
|
301
|
+
description: "Image format for conversion (only applicable for fileType=images)",
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: "width",
|
|
305
|
+
in: "query",
|
|
306
|
+
required: false,
|
|
307
|
+
schema: { type: "integer", minimum: 1 },
|
|
308
|
+
description: "Target width for image resize (only applicable for fileType=images)",
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: "height",
|
|
312
|
+
in: "query",
|
|
313
|
+
required: false,
|
|
314
|
+
schema: { type: "integer", minimum: 1 },
|
|
315
|
+
description: "Target height for image resize (only applicable for fileType=images)",
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: "resizeTo",
|
|
319
|
+
in: "query",
|
|
320
|
+
required: false,
|
|
321
|
+
schema: {
|
|
322
|
+
type: "string",
|
|
323
|
+
enum: ["cover", "contain", "fill", "inside", "outside"],
|
|
324
|
+
},
|
|
325
|
+
description: "Resize strategy (only applicable for fileType=images)",
|
|
326
|
+
},
|
|
327
|
+
];
|
|
328
|
+
const existingParams = currentPath?.parameters || [];
|
|
329
|
+
const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
|
|
330
|
+
const mergedParameters = [
|
|
331
|
+
...existingParams,
|
|
332
|
+
...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
|
|
333
|
+
];
|
|
334
|
+
const defaultSpec = {
|
|
335
|
+
tags: ["File Upload", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
|
|
336
|
+
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
337
|
+
? "Update existing file"
|
|
338
|
+
: currentPath?.summary,
|
|
339
|
+
description: currentPath?.description ||
|
|
340
|
+
"Replace an existing file with a new one. Deletes the old file and uploads the new one.",
|
|
341
|
+
operationId: currentPath?.operationId || "updateFile",
|
|
342
|
+
...(shouldIncludeSecurity("Update") && {
|
|
343
|
+
security: [{ BearerAuth: [] }],
|
|
344
|
+
}),
|
|
345
|
+
parameters: mergedParameters,
|
|
346
|
+
requestBody: currentPath?.requestBody || {
|
|
347
|
+
required: true,
|
|
348
|
+
content: {
|
|
349
|
+
"multipart/form-data": {
|
|
291
350
|
schema: {
|
|
292
|
-
type: "
|
|
293
|
-
|
|
351
|
+
type: "object",
|
|
352
|
+
properties: {
|
|
353
|
+
images: {
|
|
354
|
+
type: "array",
|
|
355
|
+
items: { type: "string", format: "binary" },
|
|
356
|
+
description: getFileTypeDescription("images"),
|
|
357
|
+
},
|
|
358
|
+
videos: {
|
|
359
|
+
type: "array",
|
|
360
|
+
items: { type: "string", format: "binary" },
|
|
361
|
+
description: getFileTypeDescription("videos"),
|
|
362
|
+
},
|
|
363
|
+
documents: {
|
|
364
|
+
type: "array",
|
|
365
|
+
items: { type: "string", format: "binary" },
|
|
366
|
+
description: getFileTypeDescription("documents"),
|
|
367
|
+
},
|
|
368
|
+
files: {
|
|
369
|
+
type: "array",
|
|
370
|
+
items: { type: "string", format: "binary" },
|
|
371
|
+
description: getFileTypeDescription("files"),
|
|
372
|
+
},
|
|
373
|
+
},
|
|
294
374
|
},
|
|
295
|
-
description: "Resize strategy (only applicable for fileType=images)",
|
|
296
375
|
},
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
responses: {
|
|
379
|
+
...(currentPath?.responses || {}),
|
|
380
|
+
"200": currentPath?.responses?.["200"] || {
|
|
381
|
+
description: "File updated successfully",
|
|
300
382
|
content: {
|
|
301
|
-
"
|
|
383
|
+
"application/json": {
|
|
302
384
|
schema: {
|
|
303
385
|
type: "object",
|
|
304
386
|
properties: {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
documents: {
|
|
316
|
-
type: "array",
|
|
317
|
-
items: { type: "string", format: "binary" },
|
|
318
|
-
description: getFileTypeDescription("documents"),
|
|
319
|
-
},
|
|
320
|
-
files: {
|
|
321
|
-
type: "array",
|
|
322
|
-
items: { type: "string", format: "binary" },
|
|
323
|
-
description: getFileTypeDescription("files"),
|
|
387
|
+
success: { type: "boolean", example: true },
|
|
388
|
+
data: {
|
|
389
|
+
oneOf: [
|
|
390
|
+
{ type: "string", description: "URL of updated file" },
|
|
391
|
+
{
|
|
392
|
+
type: "array",
|
|
393
|
+
items: { type: "string" },
|
|
394
|
+
description: "URLs of updated files",
|
|
395
|
+
},
|
|
396
|
+
],
|
|
324
397
|
},
|
|
398
|
+
message: { type: "string" },
|
|
325
399
|
},
|
|
326
400
|
},
|
|
327
401
|
},
|
|
328
402
|
},
|
|
329
403
|
},
|
|
330
|
-
|
|
331
|
-
"
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
data: {
|
|
340
|
-
oneOf: [
|
|
341
|
-
{ type: "string", description: "URL of updated file" },
|
|
342
|
-
{
|
|
343
|
-
type: "array",
|
|
344
|
-
items: { type: "string" },
|
|
345
|
-
description: "URLs of updated files",
|
|
346
|
-
},
|
|
347
|
-
],
|
|
348
|
-
},
|
|
349
|
-
message: { type: "string" },
|
|
350
|
-
},
|
|
351
|
-
},
|
|
352
|
-
},
|
|
353
|
-
},
|
|
354
|
-
},
|
|
355
|
-
"400": {
|
|
356
|
-
description: "Invalid file type, size limit exceeded, or no file uploaded",
|
|
404
|
+
"400": currentPath?.responses?.["400"] || {
|
|
405
|
+
description: "Invalid file type, size limit exceeded, or no file uploaded",
|
|
406
|
+
},
|
|
407
|
+
"404": currentPath?.responses?.["404"] || {
|
|
408
|
+
description: "Original file not found",
|
|
409
|
+
},
|
|
410
|
+
...(shouldIncludeSecurity("Update") && {
|
|
411
|
+
"401": currentPath?.responses?.["401"] || {
|
|
412
|
+
description: "Authentication required",
|
|
357
413
|
},
|
|
358
|
-
"
|
|
359
|
-
description: "
|
|
414
|
+
"403": currentPath?.responses?.["403"] || {
|
|
415
|
+
description: "Insufficient permissions to update files",
|
|
360
416
|
},
|
|
361
|
-
|
|
362
|
-
"401": { description: "Authentication required" },
|
|
363
|
-
"403": { description: "Insufficient permissions to update files" },
|
|
364
|
-
}),
|
|
365
|
-
},
|
|
417
|
+
}),
|
|
366
418
|
},
|
|
367
419
|
};
|
|
420
|
+
paths[pathname].patch = { ...(currentPath || {}), ...defaultSpec };
|
|
368
421
|
}
|
|
369
422
|
if (!isFileUploadEndpointDisabled("deleteFile")) {
|
|
370
423
|
const cleanBasePath = basePathname.endsWith("/")
|
|
371
424
|
? basePathname.slice(0, -1)
|
|
372
425
|
: basePathname;
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
paths[
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
426
|
+
const pathname = `${cleanBasePath}/{fileType}/{fileName}`;
|
|
427
|
+
if (!paths[pathname])
|
|
428
|
+
paths[pathname] = {};
|
|
429
|
+
const currentPath = paths[pathname].delete;
|
|
430
|
+
const defaultParameters = [
|
|
431
|
+
{
|
|
432
|
+
name: "fileType",
|
|
433
|
+
in: "path",
|
|
434
|
+
required: true,
|
|
435
|
+
schema: {
|
|
436
|
+
type: "string",
|
|
437
|
+
enum: ["images", "videos", "documents", "files"],
|
|
438
|
+
},
|
|
439
|
+
description: "Type of file being deleted",
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
name: "fileName",
|
|
443
|
+
in: "path",
|
|
444
|
+
required: true,
|
|
445
|
+
schema: { type: "string" },
|
|
446
|
+
description: "Name of the file to delete",
|
|
447
|
+
},
|
|
448
|
+
];
|
|
449
|
+
const existingParams = currentPath?.parameters || [];
|
|
450
|
+
const existingParamKeys = new Set(existingParams.map((p) => `${p.in}-${p.name}`));
|
|
451
|
+
const mergedParameters = [
|
|
452
|
+
...existingParams,
|
|
453
|
+
...defaultParameters.filter((p) => !existingParamKeys.has(`${p.in}-${p.name}`)),
|
|
454
|
+
];
|
|
455
|
+
const defaultSpec = {
|
|
456
|
+
tags: ["File Upload", ...(currentPath?.tags || [])].filter((tag) => tag !== "Defaults"),
|
|
457
|
+
summary: currentPath?.summary === pathname || !currentPath?.summary
|
|
458
|
+
? "Delete file"
|
|
459
|
+
: currentPath?.summary,
|
|
460
|
+
description: currentPath?.description || "Delete an uploaded file from the server",
|
|
461
|
+
operationId: currentPath?.operationId || "deleteFile",
|
|
381
462
|
...(shouldIncludeSecurity("Delete") && {
|
|
382
463
|
security: [{ BearerAuth: [] }],
|
|
383
464
|
}),
|
|
384
|
-
parameters:
|
|
385
|
-
{
|
|
386
|
-
name: "fileType",
|
|
387
|
-
in: "path",
|
|
388
|
-
required: true,
|
|
389
|
-
schema: {
|
|
390
|
-
type: "string",
|
|
391
|
-
enum: ["images", "videos", "documents", "files"],
|
|
392
|
-
},
|
|
393
|
-
description: "Type of file being deleted",
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
name: "fileName",
|
|
397
|
-
in: "path",
|
|
398
|
-
required: true,
|
|
399
|
-
schema: { type: "string" },
|
|
400
|
-
description: "Name of the file to delete",
|
|
401
|
-
},
|
|
402
|
-
],
|
|
465
|
+
parameters: mergedParameters,
|
|
403
466
|
responses: {
|
|
404
|
-
|
|
467
|
+
...(currentPath?.responses || {}),
|
|
468
|
+
"204": currentPath?.responses?.["204"] || {
|
|
405
469
|
description: "File deleted successfully",
|
|
406
470
|
},
|
|
407
|
-
"404": {
|
|
471
|
+
"404": currentPath?.responses?.["404"] || {
|
|
408
472
|
description: "File not found",
|
|
409
473
|
},
|
|
410
474
|
...(shouldIncludeSecurity("Delete") && {
|
|
411
|
-
"401":
|
|
412
|
-
|
|
475
|
+
"401": currentPath?.responses?.["401"] || {
|
|
476
|
+
description: "Authentication required",
|
|
477
|
+
},
|
|
478
|
+
"403": currentPath?.responses?.["403"] || {
|
|
479
|
+
description: "Insufficient permissions to delete files",
|
|
480
|
+
},
|
|
413
481
|
}),
|
|
414
482
|
},
|
|
415
483
|
};
|
|
484
|
+
paths[pathname].delete = { ...(currentPath || {}), ...defaultSpec };
|
|
416
485
|
}
|
|
417
486
|
return paths;
|
|
418
487
|
}
|