@ai-grator/api 0.1.37 → 0.1.39
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/admin/endpoints/admin.ts +18 -0
- package/admin/endpoints/commands/create-admin-model-family.command.ts +28 -0
- package/admin/endpoints/commands/create-admin-page.command.ts +56 -0
- package/admin/endpoints/commands/delete-admin-model-family.command.ts +29 -0
- package/admin/endpoints/commands/delete-admin-page.command.ts +28 -0
- package/admin/endpoints/commands/index.ts +8 -0
- package/admin/endpoints/commands/update-admin-model-family.command.ts +38 -0
- package/admin/endpoints/commands/update-admin-organization.command.ts +28 -0
- package/admin/endpoints/commands/update-admin-page-status.command.ts +37 -0
- package/admin/endpoints/commands/update-admin-page.command.ts +55 -0
- package/admin/endpoints/queries/get-admin-model-families.query.ts +22 -0
- package/admin/endpoints/queries/get-admin-organization.query.ts +21 -0
- package/admin/endpoints/queries/get-admin-page.query.ts +29 -0
- package/admin/endpoints/queries/get-admin-pages.query.ts +38 -0
- package/admin/endpoints/queries/index.ts +4 -0
- package/admin/models/admin-page-list-item.schema.ts +19 -0
- package/admin/models/admin-page-response.schema.ts +33 -0
- package/admin/models/index.ts +2 -0
- package/build/admin/endpoints/admin.d.ts +12 -0
- package/build/admin/endpoints/admin.d.ts.map +1 -1
- package/build/admin/endpoints/admin.js +15 -0
- package/build/admin/endpoints/commands/create-admin-model-family.command.d.ts +41 -0
- package/build/admin/endpoints/commands/create-admin-model-family.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/create-admin-model-family.command.js +24 -0
- package/build/admin/endpoints/commands/create-admin-page.command.d.ts +801 -0
- package/build/admin/endpoints/commands/create-admin-page.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/create-admin-page.command.js +44 -0
- package/build/admin/endpoints/commands/delete-admin-model-family.command.d.ts +27 -0
- package/build/admin/endpoints/commands/delete-admin-model-family.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/delete-admin-model-family.command.js +26 -0
- package/build/admin/endpoints/commands/delete-admin-page.command.d.ts +26 -0
- package/build/admin/endpoints/commands/delete-admin-page.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/delete-admin-page.command.js +25 -0
- package/build/admin/endpoints/commands/index.d.ts +8 -0
- package/build/admin/endpoints/commands/index.d.ts.map +1 -1
- package/build/admin/endpoints/commands/index.js +8 -0
- package/build/admin/endpoints/commands/update-admin-model-family.command.d.ts +49 -0
- package/build/admin/endpoints/commands/update-admin-model-family.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/update-admin-model-family.command.js +30 -0
- package/build/admin/endpoints/commands/update-admin-organization.command.d.ts +71 -0
- package/build/admin/endpoints/commands/update-admin-organization.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/update-admin-organization.command.js +24 -0
- package/build/admin/endpoints/commands/update-admin-page-status.command.d.ts +433 -0
- package/build/admin/endpoints/commands/update-admin-page-status.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/update-admin-page-status.command.js +32 -0
- package/build/admin/endpoints/commands/update-admin-page.command.d.ts +801 -0
- package/build/admin/endpoints/commands/update-admin-page.command.d.ts.map +1 -0
- package/build/admin/endpoints/commands/update-admin-page.command.js +50 -0
- package/build/admin/endpoints/queries/get-admin-model-families.query.d.ts +30 -0
- package/build/admin/endpoints/queries/get-admin-model-families.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-model-families.query.js +21 -0
- package/build/admin/endpoints/queries/get-admin-organization.query.d.ts +41 -0
- package/build/admin/endpoints/queries/get-admin-organization.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-organization.query.js +19 -0
- package/build/admin/endpoints/queries/get-admin-page.query.d.ts +424 -0
- package/build/admin/endpoints/queries/get-admin-page.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-page.query.js +26 -0
- package/build/admin/endpoints/queries/get-admin-pages.query.d.ts +74 -0
- package/build/admin/endpoints/queries/get-admin-pages.query.d.ts.map +1 -0
- package/build/admin/endpoints/queries/get-admin-pages.query.js +35 -0
- package/build/admin/endpoints/queries/index.d.ts +4 -0
- package/build/admin/endpoints/queries/index.d.ts.map +1 -1
- package/build/admin/endpoints/queries/index.js +4 -0
- package/build/admin/models/admin-page-list-item.schema.d.ts +18 -0
- package/build/admin/models/admin-page-list-item.schema.d.ts.map +1 -0
- package/build/admin/models/admin-page-list-item.schema.js +19 -0
- package/build/admin/models/admin-page-response.schema.d.ts +204 -0
- package/build/admin/models/admin-page-response.schema.d.ts.map +1 -0
- package/build/admin/models/admin-page-response.schema.js +24 -0
- package/build/admin/models/index.d.ts +2 -0
- package/build/admin/models/index.d.ts.map +1 -1
- package/build/admin/models/index.js +2 -0
- package/build/errors/errors.d.ts +94 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +94 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/model-page/endpoints/model-page.d.ts +4 -0
- package/build/model-page/endpoints/model-page.d.ts.map +1 -1
- package/build/model-page/endpoints/model-page.js +5 -1
- package/build/model-page/endpoints/queries/get-public-model-by-slug.query.d.ts +84 -6
- package/build/model-page/endpoints/queries/get-public-model-by-slug.query.d.ts.map +1 -1
- package/build/model-page/endpoints/queries/get-public-page-by-slug.query.d.ts +387 -0
- package/build/model-page/endpoints/queries/get-public-page-by-slug.query.d.ts.map +1 -0
- package/build/model-page/endpoints/queries/get-public-page-by-slug.query.js +25 -0
- package/build/model-page/endpoints/queries/index.d.ts +1 -0
- package/build/model-page/endpoints/queries/index.d.ts.map +1 -1
- package/build/model-page/endpoints/queries/index.js +1 -0
- package/build/model-page/enums/index.d.ts +6 -0
- package/build/model-page/enums/index.d.ts.map +1 -0
- package/build/model-page/enums/index.js +21 -0
- package/build/model-page/enums/page-locale.enum.d.ts +4 -0
- package/build/model-page/enums/page-locale.enum.d.ts.map +1 -0
- package/build/model-page/enums/page-locale.enum.js +7 -0
- package/build/model-page/enums/page-status.enum.d.ts +7 -0
- package/build/model-page/enums/page-status.enum.d.ts.map +1 -0
- package/build/model-page/enums/page-status.enum.js +10 -0
- package/build/model-page/enums/page-type.enum.d.ts +8 -0
- package/build/model-page/enums/page-type.enum.d.ts.map +1 -0
- package/build/model-page/enums/page-type.enum.js +11 -0
- package/build/model-page/enums/robots.enum.d.ts +9 -0
- package/build/model-page/enums/robots.enum.d.ts.map +1 -0
- package/build/model-page/enums/robots.enum.js +13 -0
- package/build/model-page/enums/twitter-card.enum.d.ts +5 -0
- package/build/model-page/enums/twitter-card.enum.d.ts.map +1 -0
- package/build/model-page/enums/twitter-card.enum.js +8 -0
- package/build/model-page/index.d.ts +1 -0
- package/build/model-page/index.d.ts.map +1 -1
- package/build/model-page/index.js +1 -0
- package/build/model-page/models/index.d.ts +4 -0
- package/build/model-page/models/index.d.ts.map +1 -1
- package/build/model-page/models/index.js +4 -0
- package/build/model-page/models/model-family.schema.d.ts +16 -0
- package/build/model-page/models/model-family.schema.d.ts.map +1 -0
- package/build/model-page/models/model-family.schema.js +16 -0
- package/build/model-page/models/page-content.schema.d.ts +37 -0
- package/build/model-page/models/page-content.schema.d.ts.map +1 -1
- package/build/model-page/models/page-content.schema.js +13 -1
- package/build/model-page/models/public-model-detail.schema.d.ts +42 -3
- package/build/model-page/models/public-model-detail.schema.d.ts.map +1 -1
- package/build/model-page/models/public-model-detail.schema.js +7 -3
- package/build/model-page/models/public-page.schema.d.ts +187 -0
- package/build/model-page/models/public-page.schema.d.ts.map +1 -0
- package/build/model-page/models/public-page.schema.js +16 -0
- package/build/model-page/models/schema-toggles.schema.d.ts +22 -0
- package/build/model-page/models/schema-toggles.schema.d.ts.map +1 -0
- package/build/model-page/models/schema-toggles.schema.js +22 -0
- package/build/model-page/models/seo-meta.schema.d.ts +84 -0
- package/build/model-page/models/seo-meta.schema.d.ts.map +1 -0
- package/build/model-page/models/seo-meta.schema.js +53 -0
- package/build/organization/endpoints/index.d.ts +3 -0
- package/build/organization/endpoints/index.d.ts.map +1 -0
- package/build/organization/endpoints/index.js +18 -0
- package/build/organization/endpoints/organization.d.ts +5 -0
- package/build/organization/endpoints/organization.d.ts.map +1 -0
- package/build/organization/endpoints/organization.js +7 -0
- package/build/organization/endpoints/queries/get-organization.query.d.ts +37 -0
- package/build/organization/endpoints/queries/get-organization.query.d.ts.map +1 -0
- package/build/organization/endpoints/queries/get-organization.query.js +17 -0
- package/build/organization/endpoints/queries/index.d.ts +2 -0
- package/build/organization/endpoints/queries/index.d.ts.map +1 -0
- package/build/organization/endpoints/queries/index.js +17 -0
- package/build/organization/index.d.ts +3 -0
- package/build/organization/index.d.ts.map +1 -0
- package/build/organization/index.js +18 -0
- package/build/organization/models/index.d.ts +2 -0
- package/build/organization/models/index.d.ts.map +1 -0
- package/build/organization/models/index.js +17 -0
- package/build/organization/models/organization.schema.d.ts +30 -0
- package/build/organization/models/organization.schema.d.ts.map +1 -0
- package/build/organization/models/organization.schema.js +20 -0
- package/build/scripts/generate-openapi.js +115 -462
- package/build/tsconfig.tsbuildinfo +1 -1
- package/errors/errors.ts +94 -0
- package/index.ts +1 -0
- package/model-page/endpoints/model-page.ts +6 -0
- package/model-page/endpoints/queries/get-public-page-by-slug.query.ts +28 -0
- package/model-page/endpoints/queries/index.ts +1 -0
- package/model-page/enums/index.ts +5 -0
- package/model-page/enums/page-locale.enum.ts +3 -0
- package/model-page/enums/page-status.enum.ts +6 -0
- package/model-page/enums/page-type.enum.ts +7 -0
- package/model-page/enums/robots.enum.ts +9 -0
- package/model-page/enums/twitter-card.enum.ts +4 -0
- package/model-page/index.ts +1 -0
- package/model-page/models/index.ts +4 -0
- package/model-page/models/model-family.schema.ts +18 -0
- package/model-page/models/page-content.schema.ts +15 -0
- package/model-page/models/public-model-detail.schema.ts +7 -3
- package/model-page/models/public-page.schema.ts +17 -0
- package/model-page/models/schema-toggles.schema.ts +25 -0
- package/model-page/models/seo-meta.schema.ts +64 -0
- package/organization/endpoints/index.ts +2 -0
- package/organization/endpoints/organization.ts +5 -0
- package/organization/endpoints/queries/get-organization.query.ts +16 -0
- package/organization/endpoints/queries/index.ts +1 -0
- package/organization/index.ts +2 -0
- package/organization/models/index.ts +1 -0
- package/organization/models/organization.schema.ts +22 -0
- package/package.json +1 -1
- package/scripts/generate-openapi.ts +195 -496
|
@@ -5,6 +5,13 @@ import { OpenAPIRegistry, OpenApiGeneratorV3 } from '@asteasolutions/zod-to-open
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
7
|
import type { HttpContract } from '../_common/http-contract.helper';
|
|
8
|
+
|
|
9
|
+
type ContractGroup = {
|
|
10
|
+
controller: string;
|
|
11
|
+
tag: string;
|
|
12
|
+
contracts: HttpContract[];
|
|
13
|
+
bodyContentType?: string;
|
|
14
|
+
};
|
|
8
15
|
import { HttpErrorResponseSchema } from '../_common/error.contract';
|
|
9
16
|
import { HttpSuccessResponseSchema } from '../_common/success.contract';
|
|
10
17
|
import { ADMIN_CONTROLLER } from '../admin/endpoints/admin';
|
|
@@ -214,8 +221,79 @@ import {
|
|
|
214
221
|
CreatePaymentCommandBody,
|
|
215
222
|
CreatePaymentCommandResponse,
|
|
216
223
|
} from '../payment/endpoints/commands/create-payment.command';
|
|
224
|
+
import { ORGANIZATION_CONTROLLER } from '../organization/endpoints/organization';
|
|
225
|
+
import {
|
|
226
|
+
GetOrganizationQuery,
|
|
227
|
+
GetOrganizationQueryResponse,
|
|
228
|
+
} from '../organization/endpoints/queries/get-organization.query';
|
|
229
|
+
import {
|
|
230
|
+
CreateAdminPageCommand,
|
|
231
|
+
CreateAdminPageCommandBody,
|
|
232
|
+
CreateAdminPageCommandResponse,
|
|
233
|
+
} from '../admin/endpoints/commands/create-admin-page.command';
|
|
234
|
+
import {
|
|
235
|
+
UpdateAdminPageCommand,
|
|
236
|
+
UpdateAdminPageCommandBody,
|
|
237
|
+
UpdateAdminPageCommandParams,
|
|
238
|
+
UpdateAdminPageCommandResponse,
|
|
239
|
+
} from '../admin/endpoints/commands/update-admin-page.command';
|
|
240
|
+
import {
|
|
241
|
+
UpdateAdminPageStatusCommand,
|
|
242
|
+
UpdateAdminPageStatusCommandBody,
|
|
243
|
+
UpdateAdminPageStatusCommandParams,
|
|
244
|
+
UpdateAdminPageStatusCommandResponse,
|
|
245
|
+
} from '../admin/endpoints/commands/update-admin-page-status.command';
|
|
246
|
+
import {
|
|
247
|
+
DeleteAdminPageCommand,
|
|
248
|
+
DeleteAdminPageCommandParams,
|
|
249
|
+
DeleteAdminPageCommandResponse,
|
|
250
|
+
} from '../admin/endpoints/commands/delete-admin-page.command';
|
|
251
|
+
import {
|
|
252
|
+
CreateAdminModelFamilyCommand,
|
|
253
|
+
CreateAdminModelFamilyCommandBody,
|
|
254
|
+
CreateAdminModelFamilyCommandResponse,
|
|
255
|
+
} from '../admin/endpoints/commands/create-admin-model-family.command';
|
|
256
|
+
import {
|
|
257
|
+
UpdateAdminModelFamilyCommand,
|
|
258
|
+
UpdateAdminModelFamilyCommandBody,
|
|
259
|
+
UpdateAdminModelFamilyCommandParams,
|
|
260
|
+
UpdateAdminModelFamilyCommandResponse,
|
|
261
|
+
} from '../admin/endpoints/commands/update-admin-model-family.command';
|
|
262
|
+
import {
|
|
263
|
+
DeleteAdminModelFamilyCommand,
|
|
264
|
+
DeleteAdminModelFamilyCommandParams,
|
|
265
|
+
DeleteAdminModelFamilyCommandResponse,
|
|
266
|
+
} from '../admin/endpoints/commands/delete-admin-model-family.command';
|
|
267
|
+
import {
|
|
268
|
+
UpdateAdminOrganizationCommand,
|
|
269
|
+
UpdateAdminOrganizationCommandBody,
|
|
270
|
+
UpdateAdminOrganizationCommandResponse,
|
|
271
|
+
} from '../admin/endpoints/commands/update-admin-organization.command';
|
|
272
|
+
import {
|
|
273
|
+
GetAdminPagesQuery,
|
|
274
|
+
GetAdminPagesQueryQuery,
|
|
275
|
+
GetAdminPagesQueryResponse,
|
|
276
|
+
} from '../admin/endpoints/queries/get-admin-pages.query';
|
|
277
|
+
import {
|
|
278
|
+
GetAdminPageQuery,
|
|
279
|
+
GetAdminPageQueryParams,
|
|
280
|
+
GetAdminPageQueryResponse,
|
|
281
|
+
} from '../admin/endpoints/queries/get-admin-page.query';
|
|
282
|
+
import {
|
|
283
|
+
GetAdminModelFamiliesQuery,
|
|
284
|
+
GetAdminModelFamiliesQueryResponse,
|
|
285
|
+
} from '../admin/endpoints/queries/get-admin-model-families.query';
|
|
286
|
+
import {
|
|
287
|
+
GetAdminOrganizationQuery,
|
|
288
|
+
GetAdminOrganizationQueryResponse,
|
|
289
|
+
} from '../admin/endpoints/queries/get-admin-organization.query';
|
|
217
290
|
import { AI_MODELS_CONTROLLER } from '../ai-model/endpoints/ai-model';
|
|
218
|
-
import {
|
|
291
|
+
import {
|
|
292
|
+
GetPublicPageBySlugQuery,
|
|
293
|
+
GetPublicPageBySlugQueryParams,
|
|
294
|
+
GetPublicPageBySlugQueryResponse,
|
|
295
|
+
} from '../model-page/endpoints/queries/get-public-page-by-slug.query';
|
|
296
|
+
import { PUBLIC_MODEL_CONTROLLER, PUBLIC_PAGE_CONTROLLER } from '../model-page/endpoints/model-page';
|
|
219
297
|
import {
|
|
220
298
|
GetAiModelByUuidQuery,
|
|
221
299
|
GetAiModelByUuidQueryParams,
|
|
@@ -363,6 +441,11 @@ import {
|
|
|
363
441
|
|
|
364
442
|
const supportedHttpMethods = new Set(['get', 'post', 'put', 'patch', 'delete']);
|
|
365
443
|
|
|
444
|
+
type OpenApiResponse = {
|
|
445
|
+
description: string;
|
|
446
|
+
content: Record<string, { schema: z.ZodTypeAny }>;
|
|
447
|
+
};
|
|
448
|
+
|
|
366
449
|
function toOpenApiPath(controller: string, routePath: string): string {
|
|
367
450
|
const normalizedController = controller.replace(/^\/+|\/+$/g, '');
|
|
368
451
|
const normalizedRoute = routePath.replace(/^\/+|\/+$/g, '');
|
|
@@ -374,8 +457,8 @@ function toOpenApiPath(controller: string, routePath: string): string {
|
|
|
374
457
|
function buildResponses(
|
|
375
458
|
contractsResponses: HttpContract['responses'],
|
|
376
459
|
schemaResolver: (schema: z.ZodTypeAny) => z.ZodTypeAny,
|
|
377
|
-
) {
|
|
378
|
-
const entries = Object.entries(contractsResponses).map(([status, schema]) => {
|
|
460
|
+
): Record<string, OpenApiResponse> {
|
|
461
|
+
const entries = Object.entries(contractsResponses).map(([status, schema]): [string, OpenApiResponse] => {
|
|
379
462
|
return [
|
|
380
463
|
status,
|
|
381
464
|
{
|
|
@@ -396,8 +479,8 @@ function buildSseSuccessResponses(
|
|
|
396
479
|
contractsResponses: HttpContract['responses'],
|
|
397
480
|
successStatus: number,
|
|
398
481
|
schemaResolver: (schema: z.ZodTypeAny) => z.ZodTypeAny,
|
|
399
|
-
) {
|
|
400
|
-
const entries = Object.entries(contractsResponses).map(([status, schema]) => {
|
|
482
|
+
): Record<string, OpenApiResponse> {
|
|
483
|
+
const entries = Object.entries(contractsResponses).map(([status, schema]): [string, OpenApiResponse] => {
|
|
401
484
|
const statusCode = Number(status);
|
|
402
485
|
const contentType = statusCode === successStatus ? 'text/event-stream' : 'application/json';
|
|
403
486
|
|
|
@@ -572,6 +655,34 @@ async function main() {
|
|
|
572
655
|
registerSchema('MarketplaceCardHistoryQuery', GetMarketplaceCardHistoryQueryQuery);
|
|
573
656
|
registerSchema('MarketplaceCardHistoryResponse', GetMarketplaceCardHistoryQueryResponse);
|
|
574
657
|
registerSchema('MarketplaceCardConfigResponse', GetMarketplaceCardConfigResponse);
|
|
658
|
+
registerSchema('AdminGetPagesQuery', GetAdminPagesQueryQuery);
|
|
659
|
+
registerSchema('AdminGetPagesResponse', GetAdminPagesQueryResponse);
|
|
660
|
+
registerSchema('AdminGetPageParams', GetAdminPageQueryParams);
|
|
661
|
+
registerSchema('AdminGetPageResponse', GetAdminPageQueryResponse);
|
|
662
|
+
registerSchema('AdminCreatePageRequest', CreateAdminPageCommandBody);
|
|
663
|
+
registerSchema('AdminCreatePageResponse', CreateAdminPageCommandResponse);
|
|
664
|
+
registerSchema('AdminUpdatePageParams', UpdateAdminPageCommandParams);
|
|
665
|
+
registerSchema('AdminUpdatePageRequest', UpdateAdminPageCommandBody);
|
|
666
|
+
registerSchema('AdminUpdatePageResponse', UpdateAdminPageCommandResponse);
|
|
667
|
+
registerSchema('AdminUpdatePageStatusParams', UpdateAdminPageStatusCommandParams);
|
|
668
|
+
registerSchema('AdminUpdatePageStatusRequest', UpdateAdminPageStatusCommandBody);
|
|
669
|
+
registerSchema('AdminUpdatePageStatusResponse', UpdateAdminPageStatusCommandResponse);
|
|
670
|
+
registerSchema('AdminDeletePageParams', DeleteAdminPageCommandParams);
|
|
671
|
+
registerSchema('AdminDeletePageResponse', DeleteAdminPageCommandResponse);
|
|
672
|
+
registerSchema('AdminGetModelFamiliesResponse', GetAdminModelFamiliesQueryResponse);
|
|
673
|
+
registerSchema('AdminCreateModelFamilyRequest', CreateAdminModelFamilyCommandBody);
|
|
674
|
+
registerSchema('AdminCreateModelFamilyResponse', CreateAdminModelFamilyCommandResponse);
|
|
675
|
+
registerSchema('AdminUpdateModelFamilyParams', UpdateAdminModelFamilyCommandParams);
|
|
676
|
+
registerSchema('AdminUpdateModelFamilyRequest', UpdateAdminModelFamilyCommandBody);
|
|
677
|
+
registerSchema('AdminUpdateModelFamilyResponse', UpdateAdminModelFamilyCommandResponse);
|
|
678
|
+
registerSchema('AdminDeleteModelFamilyParams', DeleteAdminModelFamilyCommandParams);
|
|
679
|
+
registerSchema('AdminDeleteModelFamilyResponse', DeleteAdminModelFamilyCommandResponse);
|
|
680
|
+
registerSchema('AdminGetOrganizationResponse', GetAdminOrganizationQueryResponse);
|
|
681
|
+
registerSchema('AdminUpdateOrganizationRequest', UpdateAdminOrganizationCommandBody);
|
|
682
|
+
registerSchema('AdminUpdateOrganizationResponse', UpdateAdminOrganizationCommandResponse);
|
|
683
|
+
registerSchema('OrganizationGetResponse', GetOrganizationQueryResponse);
|
|
684
|
+
registerSchema('PublicPageGetBySlugParams', GetPublicPageBySlugQueryParams);
|
|
685
|
+
registerSchema('PublicPageGetBySlugResponse', GetPublicPageBySlugQueryResponse);
|
|
575
686
|
registerSchema('UserContextGetResponse', GetUserContextQueryResponse);
|
|
576
687
|
registerSchema('UserContextUpsertRequest', UpsertUserContextCommandBody);
|
|
577
688
|
registerSchema('UserContextUpsertResponse', UpsertUserContextCommandResponse);
|
|
@@ -626,6 +737,7 @@ async function main() {
|
|
|
626
737
|
];
|
|
627
738
|
const aiModelContracts: HttpContract[] = [GetAllAiModelsQuery, GetAiModelByUuidQuery];
|
|
628
739
|
const publicModelContracts: HttpContract[] = [ListPublicModelsQuery, GetPublicModelBySlugQuery];
|
|
740
|
+
const publicPageContracts: HttpContract[] = [GetPublicPageBySlugQuery];
|
|
629
741
|
const modelCatalogContracts: HttpContract[] = [GetModelCatalogQuery];
|
|
630
742
|
const generationModelContracts: HttpContract[] = [
|
|
631
743
|
GetGenerationModelsQuery,
|
|
@@ -669,505 +781,92 @@ async function main() {
|
|
|
669
781
|
GetAdminSupportChatMessagesQuery,
|
|
670
782
|
SendAdminSupportReplyCommand,
|
|
671
783
|
MarkAdminSupportChatReadCommand,
|
|
784
|
+
GetAdminPagesQuery,
|
|
785
|
+
GetAdminPageQuery,
|
|
786
|
+
CreateAdminPageCommand,
|
|
787
|
+
UpdateAdminPageCommand,
|
|
788
|
+
UpdateAdminPageStatusCommand,
|
|
789
|
+
DeleteAdminPageCommand,
|
|
790
|
+
GetAdminModelFamiliesQuery,
|
|
791
|
+
CreateAdminModelFamilyCommand,
|
|
792
|
+
UpdateAdminModelFamilyCommand,
|
|
793
|
+
DeleteAdminModelFamilyCommand,
|
|
794
|
+
GetAdminOrganizationQuery,
|
|
795
|
+
UpdateAdminOrganizationCommand,
|
|
672
796
|
];
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
797
|
+
const organizationContracts: HttpContract[] = [GetOrganizationQuery];
|
|
798
|
+
|
|
799
|
+
const DEFAULT_BODY_CONTENT_TYPE = 'application/json';
|
|
800
|
+
const SSE_CREATED_CONTRACTS = new Set<HttpContract>([CreateMessageCommand]);
|
|
801
|
+
|
|
802
|
+
const registerContractGroup = ({
|
|
803
|
+
controller,
|
|
804
|
+
tag,
|
|
805
|
+
contracts,
|
|
806
|
+
bodyContentType = DEFAULT_BODY_CONTENT_TYPE,
|
|
807
|
+
}: ContractGroup): void => {
|
|
808
|
+
for (const contract of contracts) {
|
|
809
|
+
const method = contract.method.toLowerCase();
|
|
810
|
+
|
|
811
|
+
if (!supportedHttpMethods.has(method)) {
|
|
812
|
+
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
registry.registerPath({
|
|
816
|
+
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
817
|
+
path: toOpenApiPath(controller, contract.path),
|
|
818
|
+
summary: contract.summary,
|
|
819
|
+
tags: [tag],
|
|
820
|
+
request: {
|
|
821
|
+
...(contract.request?.body
|
|
822
|
+
? {
|
|
823
|
+
body: {
|
|
824
|
+
required: true,
|
|
825
|
+
content: {
|
|
826
|
+
[bodyContentType]: {
|
|
827
|
+
schema: resolveSchema(contract.request.body),
|
|
828
|
+
},
|
|
693
829
|
},
|
|
694
830
|
},
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
: {}),
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
702
|
-
});
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
for (const contract of chatContracts) {
|
|
706
|
-
const method = contract.method.toLowerCase();
|
|
707
|
-
if (!supportedHttpMethods.has(method)) {
|
|
708
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
registry.registerPath({
|
|
712
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
713
|
-
path: toOpenApiPath(CHAT_CONTROLLER, contract.path),
|
|
714
|
-
summary: contract.summary,
|
|
715
|
-
tags: ['Chat'],
|
|
716
|
-
request: {
|
|
717
|
-
...(contract.request?.body
|
|
718
|
-
? {
|
|
719
|
-
body: {
|
|
720
|
-
required: true,
|
|
721
|
-
content: {
|
|
722
|
-
'application/json': {
|
|
723
|
-
schema: resolveSchema(contract.request.body),
|
|
724
|
-
},
|
|
725
|
-
},
|
|
726
|
-
},
|
|
727
|
-
}
|
|
728
|
-
: {}),
|
|
729
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
730
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
731
|
-
},
|
|
732
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
for (const contract of messageContracts) {
|
|
737
|
-
const method = contract.method.toLowerCase();
|
|
738
|
-
if (!supportedHttpMethods.has(method)) {
|
|
739
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
registry.registerPath({
|
|
743
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
744
|
-
path: toOpenApiPath(MESSAGE_CONTROLLER, contract.path),
|
|
745
|
-
summary: contract.summary,
|
|
746
|
-
tags: ['Message'],
|
|
747
|
-
request: {
|
|
748
|
-
...(contract.request?.body
|
|
749
|
-
? {
|
|
750
|
-
body: {
|
|
751
|
-
required: true,
|
|
752
|
-
content: {
|
|
753
|
-
'application/json': {
|
|
754
|
-
schema: resolveSchema(contract.request.body),
|
|
755
|
-
},
|
|
756
|
-
},
|
|
757
|
-
},
|
|
758
|
-
}
|
|
759
|
-
: {}),
|
|
760
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
761
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
762
|
-
},
|
|
763
|
-
responses:
|
|
764
|
-
contract === CreateMessageCommand
|
|
831
|
+
}
|
|
832
|
+
: {}),
|
|
833
|
+
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
834
|
+
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
835
|
+
},
|
|
836
|
+
responses: SSE_CREATED_CONTRACTS.has(contract)
|
|
765
837
|
? buildSseSuccessResponses(contract.responses, 201, resolveSchema)
|
|
766
838
|
: buildResponses(contract.responses, resolveSchema),
|
|
767
|
-
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
for (const contract of fileContracts) {
|
|
771
|
-
const method = contract.method.toLowerCase();
|
|
772
|
-
if (!supportedHttpMethods.has(method)) {
|
|
773
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
839
|
+
});
|
|
774
840
|
}
|
|
841
|
+
};
|
|
775
842
|
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
for (const contract of supportContracts) {
|
|
802
|
-
const method = contract.method.toLowerCase();
|
|
803
|
-
if (!supportedHttpMethods.has(method)) {
|
|
804
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
registry.registerPath({
|
|
808
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
809
|
-
path: toOpenApiPath(SUPPORT_CONTROLLER, contract.path),
|
|
810
|
-
summary: contract.summary,
|
|
811
|
-
tags: ['Support'],
|
|
812
|
-
request: {
|
|
813
|
-
...(contract.request?.body
|
|
814
|
-
? {
|
|
815
|
-
body: {
|
|
816
|
-
required: true,
|
|
817
|
-
content: {
|
|
818
|
-
'application/json': {
|
|
819
|
-
schema: resolveSchema(contract.request.body),
|
|
820
|
-
},
|
|
821
|
-
},
|
|
822
|
-
},
|
|
823
|
-
}
|
|
824
|
-
: {}),
|
|
825
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
826
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
827
|
-
},
|
|
828
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
829
|
-
});
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
for (const contract of walletContracts) {
|
|
833
|
-
const method = contract.method.toLowerCase();
|
|
834
|
-
if (!supportedHttpMethods.has(method)) {
|
|
835
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
registry.registerPath({
|
|
839
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
840
|
-
path: toOpenApiPath(WALLET_CONTROLLER, contract.path),
|
|
841
|
-
summary: contract.summary,
|
|
842
|
-
tags: ['Wallet'],
|
|
843
|
-
request: {
|
|
844
|
-
...(contract.request?.body
|
|
845
|
-
? {
|
|
846
|
-
body: {
|
|
847
|
-
required: true,
|
|
848
|
-
content: {
|
|
849
|
-
'application/json': {
|
|
850
|
-
schema: resolveSchema(contract.request.body),
|
|
851
|
-
},
|
|
852
|
-
},
|
|
853
|
-
},
|
|
854
|
-
}
|
|
855
|
-
: {}),
|
|
856
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
857
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
858
|
-
},
|
|
859
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
860
|
-
});
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
for (const contract of paymentContracts) {
|
|
864
|
-
const method = contract.method.toLowerCase();
|
|
865
|
-
if (!supportedHttpMethods.has(method)) {
|
|
866
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
registry.registerPath({
|
|
870
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
871
|
-
path: toOpenApiPath(PAYMENT_CONTROLLER, contract.path),
|
|
872
|
-
summary: contract.summary,
|
|
873
|
-
tags: ['Payment'],
|
|
874
|
-
request: {
|
|
875
|
-
...(contract.request?.body
|
|
876
|
-
? {
|
|
877
|
-
body: {
|
|
878
|
-
required: true,
|
|
879
|
-
content: {
|
|
880
|
-
'application/json': {
|
|
881
|
-
schema: resolveSchema(contract.request.body),
|
|
882
|
-
},
|
|
883
|
-
},
|
|
884
|
-
},
|
|
885
|
-
}
|
|
886
|
-
: {}),
|
|
887
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
888
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
889
|
-
},
|
|
890
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
891
|
-
});
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
for (const contract of aiModelContracts) {
|
|
895
|
-
const method = contract.method.toLowerCase();
|
|
896
|
-
if (!supportedHttpMethods.has(method)) {
|
|
897
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
registry.registerPath({
|
|
901
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
902
|
-
path: toOpenApiPath(AI_MODELS_CONTROLLER, contract.path),
|
|
903
|
-
summary: contract.summary,
|
|
904
|
-
tags: ['AI Models'],
|
|
905
|
-
request: {
|
|
906
|
-
...(contract.request?.body
|
|
907
|
-
? {
|
|
908
|
-
body: {
|
|
909
|
-
required: true,
|
|
910
|
-
content: {
|
|
911
|
-
'application/json': {
|
|
912
|
-
schema: resolveSchema(contract.request.body),
|
|
913
|
-
},
|
|
914
|
-
},
|
|
915
|
-
},
|
|
916
|
-
}
|
|
917
|
-
: {}),
|
|
918
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
919
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
920
|
-
},
|
|
921
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
for (const contract of publicModelContracts) {
|
|
926
|
-
const method = contract.method.toLowerCase();
|
|
927
|
-
if (!supportedHttpMethods.has(method)) {
|
|
928
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
registry.registerPath({
|
|
932
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
933
|
-
path: toOpenApiPath(PUBLIC_MODEL_CONTROLLER, contract.path),
|
|
934
|
-
summary: contract.summary,
|
|
935
|
-
tags: ['Models (public)'],
|
|
936
|
-
request: {
|
|
937
|
-
...(contract.request?.body
|
|
938
|
-
? {
|
|
939
|
-
body: {
|
|
940
|
-
required: true,
|
|
941
|
-
content: {
|
|
942
|
-
'application/json': {
|
|
943
|
-
schema: resolveSchema(contract.request.body),
|
|
944
|
-
},
|
|
945
|
-
},
|
|
946
|
-
},
|
|
947
|
-
}
|
|
948
|
-
: {}),
|
|
949
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
950
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
951
|
-
},
|
|
952
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
for (const contract of modelCatalogContracts) {
|
|
957
|
-
const method = contract.method.toLowerCase();
|
|
958
|
-
if (!supportedHttpMethods.has(method)) {
|
|
959
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
registry.registerPath({
|
|
963
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
964
|
-
path: toOpenApiPath(MODEL_CATALOG_CONTROLLER, contract.path),
|
|
965
|
-
summary: contract.summary,
|
|
966
|
-
tags: ['Model Catalog'],
|
|
967
|
-
request: {
|
|
968
|
-
...(contract.request?.body
|
|
969
|
-
? {
|
|
970
|
-
body: {
|
|
971
|
-
required: true,
|
|
972
|
-
content: {
|
|
973
|
-
'application/json': {
|
|
974
|
-
schema: resolveSchema(contract.request.body),
|
|
975
|
-
},
|
|
976
|
-
},
|
|
977
|
-
},
|
|
978
|
-
}
|
|
979
|
-
: {}),
|
|
980
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
981
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
982
|
-
},
|
|
983
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
for (const contract of generationModelContracts) {
|
|
988
|
-
const method = contract.method.toLowerCase();
|
|
989
|
-
if (!supportedHttpMethods.has(method)) {
|
|
990
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
registry.registerPath({
|
|
994
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
995
|
-
path: toOpenApiPath(GENERATION_MODEL_CONTROLLER, contract.path),
|
|
996
|
-
summary: contract.summary,
|
|
997
|
-
tags: ['Generation Models'],
|
|
998
|
-
request: {
|
|
999
|
-
...(contract.request?.body
|
|
1000
|
-
? {
|
|
1001
|
-
body: {
|
|
1002
|
-
required: true,
|
|
1003
|
-
content: {
|
|
1004
|
-
'application/json': {
|
|
1005
|
-
schema: resolveSchema(contract.request.body),
|
|
1006
|
-
},
|
|
1007
|
-
},
|
|
1008
|
-
},
|
|
1009
|
-
}
|
|
1010
|
-
: {}),
|
|
1011
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
1012
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
1013
|
-
},
|
|
1014
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
1015
|
-
});
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
for (const contract of generationJobContracts) {
|
|
1019
|
-
const method = contract.method.toLowerCase();
|
|
1020
|
-
if (!supportedHttpMethods.has(method)) {
|
|
1021
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
registry.registerPath({
|
|
1025
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
1026
|
-
path: toOpenApiPath(GENERATION_JOB_CONTROLLER, contract.path),
|
|
1027
|
-
summary: contract.summary,
|
|
1028
|
-
tags: ['Generation Jobs'],
|
|
1029
|
-
request: {
|
|
1030
|
-
...(contract.request?.body
|
|
1031
|
-
? {
|
|
1032
|
-
body: {
|
|
1033
|
-
required: true,
|
|
1034
|
-
content: {
|
|
1035
|
-
'application/json': {
|
|
1036
|
-
schema: resolveSchema(contract.request.body),
|
|
1037
|
-
},
|
|
1038
|
-
},
|
|
1039
|
-
},
|
|
1040
|
-
}
|
|
1041
|
-
: {}),
|
|
1042
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
1043
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
1044
|
-
},
|
|
1045
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
for (const contract of generationJobChatContracts) {
|
|
1050
|
-
const method = contract.method.toLowerCase();
|
|
1051
|
-
if (!supportedHttpMethods.has(method)) {
|
|
1052
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
registry.registerPath({
|
|
1056
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
1057
|
-
path: toOpenApiPath(GENERATION_JOB_CHAT_CONTROLLER, contract.path),
|
|
1058
|
-
summary: contract.summary,
|
|
1059
|
-
tags: ['Generation Job Chats'],
|
|
1060
|
-
request: {
|
|
1061
|
-
...(contract.request?.body
|
|
1062
|
-
? {
|
|
1063
|
-
body: {
|
|
1064
|
-
required: true,
|
|
1065
|
-
content: {
|
|
1066
|
-
'application/json': {
|
|
1067
|
-
schema: resolveSchema(contract.request.body),
|
|
1068
|
-
},
|
|
1069
|
-
},
|
|
1070
|
-
},
|
|
1071
|
-
}
|
|
1072
|
-
: {}),
|
|
1073
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
1074
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
1075
|
-
},
|
|
1076
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
for (const contract of adminContracts) {
|
|
1081
|
-
const method = contract.method.toLowerCase();
|
|
1082
|
-
if (!supportedHttpMethods.has(method)) {
|
|
1083
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
registry.registerPath({
|
|
1087
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
1088
|
-
path: toOpenApiPath(ADMIN_CONTROLLER, contract.path),
|
|
1089
|
-
summary: contract.summary,
|
|
1090
|
-
tags: ['Admin'],
|
|
1091
|
-
request: {
|
|
1092
|
-
...(contract.request?.body
|
|
1093
|
-
? {
|
|
1094
|
-
body: {
|
|
1095
|
-
required: true,
|
|
1096
|
-
content: {
|
|
1097
|
-
'application/json': {
|
|
1098
|
-
schema: resolveSchema(contract.request.body),
|
|
1099
|
-
},
|
|
1100
|
-
},
|
|
1101
|
-
},
|
|
1102
|
-
}
|
|
1103
|
-
: {}),
|
|
1104
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
1105
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
1106
|
-
},
|
|
1107
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
1108
|
-
});
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
for (const contract of marketplaceCardContracts) {
|
|
1112
|
-
const method = contract.method.toLowerCase();
|
|
1113
|
-
if (!supportedHttpMethods.has(method)) {
|
|
1114
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
registry.registerPath({
|
|
1118
|
-
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
1119
|
-
path: toOpenApiPath(MARKETPLACE_CARD_CONTROLLER, contract.path),
|
|
1120
|
-
summary: contract.summary,
|
|
1121
|
-
tags: ['Marketplace Cards'],
|
|
1122
|
-
request: {
|
|
1123
|
-
...(contract.request?.body
|
|
1124
|
-
? {
|
|
1125
|
-
body: {
|
|
1126
|
-
required: true,
|
|
1127
|
-
content: {
|
|
1128
|
-
'application/json': {
|
|
1129
|
-
schema: resolveSchema(contract.request.body),
|
|
1130
|
-
},
|
|
1131
|
-
},
|
|
1132
|
-
},
|
|
1133
|
-
}
|
|
1134
|
-
: {}),
|
|
1135
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
1136
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
1137
|
-
},
|
|
1138
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
for (const contract of userContextContracts) {
|
|
1143
|
-
const method = contract.method.toLowerCase();
|
|
1144
|
-
if (!supportedHttpMethods.has(method)) {
|
|
1145
|
-
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
1146
|
-
}
|
|
843
|
+
const contractGroups: ContractGroup[] = [
|
|
844
|
+
{ controller: AUTH_CONTROLLER, tag: 'Auth', contracts: authContracts },
|
|
845
|
+
{ controller: CHAT_CONTROLLER, tag: 'Chat', contracts: chatContracts },
|
|
846
|
+
{ controller: MESSAGE_CONTROLLER, tag: 'Message', contracts: messageContracts },
|
|
847
|
+
{ controller: FILE_CONTROLLER, tag: 'File', contracts: fileContracts, bodyContentType: 'multipart/form-data' },
|
|
848
|
+
{ controller: SUPPORT_CONTROLLER, tag: 'Support', contracts: supportContracts },
|
|
849
|
+
{ controller: WALLET_CONTROLLER, tag: 'Wallet', contracts: walletContracts },
|
|
850
|
+
{ controller: PAYMENT_CONTROLLER, tag: 'Payment', contracts: paymentContracts },
|
|
851
|
+
{ controller: AI_MODELS_CONTROLLER, tag: 'AI Models', contracts: aiModelContracts },
|
|
852
|
+
{ controller: PUBLIC_MODEL_CONTROLLER, tag: 'Models (public)', contracts: publicModelContracts },
|
|
853
|
+
{ controller: PUBLIC_PAGE_CONTROLLER, tag: 'Pages (public)', contracts: publicPageContracts },
|
|
854
|
+
{ controller: MODEL_CATALOG_CONTROLLER, tag: 'Model Catalog', contracts: modelCatalogContracts },
|
|
855
|
+
{ controller: GENERATION_MODEL_CONTROLLER, tag: 'Generation Models', contracts: generationModelContracts },
|
|
856
|
+
{ controller: GENERATION_JOB_CONTROLLER, tag: 'Generation Jobs', contracts: generationJobContracts },
|
|
857
|
+
{
|
|
858
|
+
controller: GENERATION_JOB_CHAT_CONTROLLER,
|
|
859
|
+
tag: 'Generation Job Chats',
|
|
860
|
+
contracts: generationJobChatContracts,
|
|
861
|
+
},
|
|
862
|
+
{ controller: ADMIN_CONTROLLER, tag: 'Admin', contracts: adminContracts },
|
|
863
|
+
{ controller: MARKETPLACE_CARD_CONTROLLER, tag: 'Marketplace Cards', contracts: marketplaceCardContracts },
|
|
864
|
+
{ controller: ORGANIZATION_CONTROLLER, tag: 'Organization', contracts: organizationContracts },
|
|
865
|
+
{ controller: USER_CONTEXT_CONTROLLER, tag: 'User Context', contracts: userContextContracts },
|
|
866
|
+
];
|
|
1147
867
|
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
path: toOpenApiPath(USER_CONTEXT_CONTROLLER, contract.path),
|
|
1151
|
-
summary: contract.summary,
|
|
1152
|
-
tags: ['User Context'],
|
|
1153
|
-
request: {
|
|
1154
|
-
...(contract.request?.body
|
|
1155
|
-
? {
|
|
1156
|
-
body: {
|
|
1157
|
-
required: true,
|
|
1158
|
-
content: {
|
|
1159
|
-
'application/json': {
|
|
1160
|
-
schema: resolveSchema(contract.request.body),
|
|
1161
|
-
},
|
|
1162
|
-
},
|
|
1163
|
-
},
|
|
1164
|
-
}
|
|
1165
|
-
: {}),
|
|
1166
|
-
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
1167
|
-
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
1168
|
-
},
|
|
1169
|
-
responses: buildResponses(contract.responses, resolveSchema),
|
|
1170
|
-
});
|
|
868
|
+
for (const group of contractGroups) {
|
|
869
|
+
registerContractGroup(group);
|
|
1171
870
|
}
|
|
1172
871
|
|
|
1173
872
|
const generator = new OpenApiGeneratorV3(registry.definitions);
|