@ai-grator/api 0.1.25 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/errors/errors.d.ts +26 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +26 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/model-catalog/endpoints/index.d.ts +3 -0
- package/build/model-catalog/endpoints/index.d.ts.map +1 -0
- package/build/model-catalog/endpoints/index.js +18 -0
- package/build/model-catalog/endpoints/model-catalog.d.ts +5 -0
- package/build/model-catalog/endpoints/model-catalog.d.ts.map +1 -0
- package/build/model-catalog/endpoints/model-catalog.js +7 -0
- package/build/model-catalog/endpoints/queries/get-model-catalog.query.d.ts +39 -0
- package/build/model-catalog/endpoints/queries/get-model-catalog.query.d.ts.map +1 -0
- package/build/model-catalog/endpoints/queries/get-model-catalog.query.js +19 -0
- package/build/model-catalog/endpoints/queries/index.d.ts +2 -0
- package/build/model-catalog/endpoints/queries/index.d.ts.map +1 -0
- package/build/model-catalog/endpoints/queries/index.js +17 -0
- package/build/model-catalog/enums/index.d.ts +3 -0
- package/build/model-catalog/enums/index.d.ts.map +1 -0
- package/build/model-catalog/enums/index.js +18 -0
- package/build/model-catalog/enums/model-category.enum.d.ts +7 -0
- package/build/model-catalog/enums/model-category.enum.d.ts.map +1 -0
- package/build/model-catalog/enums/model-category.enum.js +10 -0
- package/build/model-catalog/enums/price-unit.enum.d.ts +5 -0
- package/build/model-catalog/enums/price-unit.enum.d.ts.map +1 -0
- package/build/model-catalog/enums/price-unit.enum.js +8 -0
- package/build/model-catalog/index.d.ts +4 -0
- package/build/model-catalog/index.d.ts.map +1 -0
- package/build/model-catalog/index.js +19 -0
- package/build/model-catalog/models/index.d.ts +2 -0
- package/build/model-catalog/models/index.d.ts.map +1 -0
- package/build/model-catalog/models/index.js +17 -0
- package/build/model-catalog/models/model-catalog-item-response.schema.d.ts +16 -0
- package/build/model-catalog/models/model-catalog-item-response.schema.d.ts.map +1 -0
- package/build/model-catalog/models/model-catalog-item-response.schema.js +15 -0
- package/build/scripts/generate-openapi.js +76 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/user-context/endpoints/commands/index.d.ts +3 -0
- package/build/user-context/endpoints/commands/index.d.ts.map +1 -0
- package/build/user-context/endpoints/commands/index.js +18 -0
- package/build/user-context/endpoints/commands/toggle-user-context.command.d.ts +33 -0
- package/build/user-context/endpoints/commands/toggle-user-context.command.d.ts.map +1 -0
- package/build/user-context/endpoints/commands/toggle-user-context.command.js +25 -0
- package/build/user-context/endpoints/commands/upsert-user-context.command.d.ts +37 -0
- package/build/user-context/endpoints/commands/upsert-user-context.command.d.ts.map +1 -0
- package/build/user-context/endpoints/commands/upsert-user-context.command.js +27 -0
- package/build/user-context/endpoints/index.d.ts +4 -0
- package/build/user-context/endpoints/index.d.ts.map +1 -0
- package/build/user-context/endpoints/index.js +19 -0
- package/build/user-context/endpoints/queries/get-user-context.query.d.ts +23 -0
- package/build/user-context/endpoints/queries/get-user-context.query.d.ts.map +1 -0
- package/build/user-context/endpoints/queries/get-user-context.query.js +17 -0
- package/build/user-context/endpoints/queries/index.d.ts +2 -0
- package/build/user-context/endpoints/queries/index.d.ts.map +1 -0
- package/build/user-context/endpoints/queries/index.js +17 -0
- package/build/user-context/endpoints/user-context.d.ts +7 -0
- package/build/user-context/endpoints/user-context.d.ts.map +1 -0
- package/build/user-context/endpoints/user-context.js +9 -0
- package/build/user-context/index.d.ts +3 -0
- package/build/user-context/index.d.ts.map +1 -0
- package/build/user-context/index.js +18 -0
- package/build/user-context/models/index.d.ts +2 -0
- package/build/user-context/models/index.d.ts.map +1 -0
- package/build/user-context/models/index.js +17 -0
- package/build/user-context/models/user-context-response.schema.d.ts +10 -0
- package/build/user-context/models/user-context-response.schema.d.ts.map +1 -0
- package/build/user-context/models/user-context-response.schema.js +11 -0
- package/errors/errors.ts +26 -0
- package/index.ts +2 -0
- package/model-catalog/endpoints/index.ts +2 -0
- package/model-catalog/endpoints/model-catalog.ts +5 -0
- package/model-catalog/endpoints/queries/get-model-catalog.query.ts +18 -0
- package/model-catalog/endpoints/queries/index.ts +1 -0
- package/model-catalog/enums/index.ts +2 -0
- package/model-catalog/enums/model-category.enum.ts +6 -0
- package/model-catalog/enums/price-unit.enum.ts +4 -0
- package/model-catalog/index.ts +3 -0
- package/model-catalog/models/index.ts +1 -0
- package/model-catalog/models/model-catalog-item-response.schema.ts +15 -0
- package/package.json +1 -1
- package/scripts/generate-openapi.ts +94 -0
- package/user-context/endpoints/commands/index.ts +2 -0
- package/user-context/endpoints/commands/toggle-user-context.command.ts +25 -0
- package/user-context/endpoints/commands/upsert-user-context.command.ts +27 -0
- package/user-context/endpoints/index.ts +3 -0
- package/user-context/endpoints/queries/get-user-context.query.ts +16 -0
- package/user-context/endpoints/queries/index.ts +1 -0
- package/user-context/endpoints/user-context.ts +7 -0
- package/user-context/index.ts +2 -0
- package/user-context/models/index.ts +1 -0
- package/user-context/models/user-context-response.schema.ts +12 -0
|
@@ -221,6 +221,11 @@ import {
|
|
|
221
221
|
GetAiModelByUuidQueryResponse,
|
|
222
222
|
} from '../ai-model/endpoints/queries/get-ai-model-by-uuid.query';
|
|
223
223
|
import { GetAllAiModelsQuery, GetAllAiModelsQueryResponse } from '../ai-model/endpoints/queries/get-ai-models.query';
|
|
224
|
+
import { MODEL_CATALOG_CONTROLLER } from '../model-catalog/endpoints/model-catalog';
|
|
225
|
+
import {
|
|
226
|
+
GetModelCatalogQuery,
|
|
227
|
+
GetModelCatalogQueryResponse,
|
|
228
|
+
} from '../model-catalog/endpoints/queries/get-model-catalog.query';
|
|
224
229
|
import { GENERATION_MODEL_CONTROLLER } from '../generation-model/endpoints/generation-model';
|
|
225
230
|
import {
|
|
226
231
|
GetGenerationModelsQuery,
|
|
@@ -330,6 +335,21 @@ import {
|
|
|
330
335
|
GetMarketplaceCardConfigQuery,
|
|
331
336
|
GetMarketplaceCardConfigResponse,
|
|
332
337
|
} from '../marketplace-card/endpoints/queries/get-marketplace-card-config.query';
|
|
338
|
+
import { USER_CONTEXT_CONTROLLER } from '../user-context/endpoints/user-context';
|
|
339
|
+
import {
|
|
340
|
+
GetUserContextQuery,
|
|
341
|
+
GetUserContextQueryResponse,
|
|
342
|
+
} from '../user-context/endpoints/queries/get-user-context.query';
|
|
343
|
+
import {
|
|
344
|
+
UpsertUserContextCommand,
|
|
345
|
+
UpsertUserContextCommandBody,
|
|
346
|
+
UpsertUserContextCommandResponse,
|
|
347
|
+
} from '../user-context/endpoints/commands/upsert-user-context.command';
|
|
348
|
+
import {
|
|
349
|
+
ToggleUserContextCommand,
|
|
350
|
+
ToggleUserContextCommandBody,
|
|
351
|
+
ToggleUserContextCommandResponse,
|
|
352
|
+
} from '../user-context/endpoints/commands/toggle-user-context.command';
|
|
333
353
|
|
|
334
354
|
const supportedHttpMethods = new Set(['get', 'post', 'put', 'patch', 'delete']);
|
|
335
355
|
|
|
@@ -446,6 +466,7 @@ async function main() {
|
|
|
446
466
|
registerSchema('AiModelsGetAllResponse', GetAllAiModelsQueryResponse);
|
|
447
467
|
registerSchema('AiModelsGetByUuidParams', GetAiModelByUuidQueryParams);
|
|
448
468
|
registerSchema('AiModelsGetByUuidResponse', GetAiModelByUuidQueryResponse);
|
|
469
|
+
registerSchema('ModelCatalogGetAllResponse', GetModelCatalogQueryResponse);
|
|
449
470
|
registerSchema('GenerationModelGetAllResponse', GetGenerationModelsQueryResponse);
|
|
450
471
|
registerSchema('GenerationModelGetByTypeParams', GetGenerationModelsByTypeQueryParams);
|
|
451
472
|
registerSchema('GenerationModelGetByTypeResponse', GetGenerationModelsByTypeQueryResponse);
|
|
@@ -538,6 +559,11 @@ async function main() {
|
|
|
538
559
|
registerSchema('MarketplaceCardHistoryQuery', GetMarketplaceCardHistoryQueryQuery);
|
|
539
560
|
registerSchema('MarketplaceCardHistoryResponse', GetMarketplaceCardHistoryQueryResponse);
|
|
540
561
|
registerSchema('MarketplaceCardConfigResponse', GetMarketplaceCardConfigResponse);
|
|
562
|
+
registerSchema('UserContextGetResponse', GetUserContextQueryResponse);
|
|
563
|
+
registerSchema('UserContextUpsertRequest', UpsertUserContextCommandBody);
|
|
564
|
+
registerSchema('UserContextUpsertResponse', UpsertUserContextCommandResponse);
|
|
565
|
+
registerSchema('UserContextToggleRequest', ToggleUserContextCommandBody);
|
|
566
|
+
registerSchema('UserContextToggleResponse', ToggleUserContextCommandResponse);
|
|
541
567
|
|
|
542
568
|
const authContracts: HttpContract[] = [
|
|
543
569
|
RegisterCommand,
|
|
@@ -572,6 +598,11 @@ async function main() {
|
|
|
572
598
|
];
|
|
573
599
|
const walletContracts: HttpContract[] = [GetWalletBalanceQuery, GetWalletTransactionsQuery];
|
|
574
600
|
const paymentContracts: HttpContract[] = [CreatePaymentCommand];
|
|
601
|
+
const userContextContracts: HttpContract[] = [
|
|
602
|
+
GetUserContextQuery,
|
|
603
|
+
UpsertUserContextCommand,
|
|
604
|
+
ToggleUserContextCommand,
|
|
605
|
+
];
|
|
575
606
|
const marketplaceCardContracts: HttpContract[] = [
|
|
576
607
|
CreateMarketplaceCardCommand,
|
|
577
608
|
GetMarketplaceCardHistoryQuery,
|
|
@@ -581,6 +612,7 @@ async function main() {
|
|
|
581
612
|
DeleteMarketplaceCardCommand,
|
|
582
613
|
];
|
|
583
614
|
const aiModelContracts: HttpContract[] = [GetAllAiModelsQuery, GetAiModelByUuidQuery];
|
|
615
|
+
const modelCatalogContracts: HttpContract[] = [GetModelCatalogQuery];
|
|
584
616
|
const generationModelContracts: HttpContract[] = [
|
|
585
617
|
GetGenerationModelsQuery,
|
|
586
618
|
GetGenerationModelsByTypeQuery,
|
|
@@ -876,6 +908,37 @@ async function main() {
|
|
|
876
908
|
});
|
|
877
909
|
}
|
|
878
910
|
|
|
911
|
+
for (const contract of modelCatalogContracts) {
|
|
912
|
+
const method = contract.method.toLowerCase();
|
|
913
|
+
if (!supportedHttpMethods.has(method)) {
|
|
914
|
+
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
registry.registerPath({
|
|
918
|
+
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
919
|
+
path: toOpenApiPath(MODEL_CATALOG_CONTROLLER, contract.path),
|
|
920
|
+
summary: contract.summary,
|
|
921
|
+
tags: ['Model Catalog'],
|
|
922
|
+
request: {
|
|
923
|
+
...(contract.request?.body
|
|
924
|
+
? {
|
|
925
|
+
body: {
|
|
926
|
+
required: true,
|
|
927
|
+
content: {
|
|
928
|
+
'application/json': {
|
|
929
|
+
schema: resolveSchema(contract.request.body),
|
|
930
|
+
},
|
|
931
|
+
},
|
|
932
|
+
},
|
|
933
|
+
}
|
|
934
|
+
: {}),
|
|
935
|
+
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
936
|
+
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
937
|
+
},
|
|
938
|
+
responses: buildResponses(contract.responses, resolveSchema),
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
|
|
879
942
|
for (const contract of generationModelContracts) {
|
|
880
943
|
const method = contract.method.toLowerCase();
|
|
881
944
|
if (!supportedHttpMethods.has(method)) {
|
|
@@ -1031,6 +1094,37 @@ async function main() {
|
|
|
1031
1094
|
});
|
|
1032
1095
|
}
|
|
1033
1096
|
|
|
1097
|
+
for (const contract of userContextContracts) {
|
|
1098
|
+
const method = contract.method.toLowerCase();
|
|
1099
|
+
if (!supportedHttpMethods.has(method)) {
|
|
1100
|
+
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
registry.registerPath({
|
|
1104
|
+
method: method as 'get' | 'post' | 'put' | 'patch' | 'delete',
|
|
1105
|
+
path: toOpenApiPath(USER_CONTEXT_CONTROLLER, contract.path),
|
|
1106
|
+
summary: contract.summary,
|
|
1107
|
+
tags: ['User Context'],
|
|
1108
|
+
request: {
|
|
1109
|
+
...(contract.request?.body
|
|
1110
|
+
? {
|
|
1111
|
+
body: {
|
|
1112
|
+
required: true,
|
|
1113
|
+
content: {
|
|
1114
|
+
'application/json': {
|
|
1115
|
+
schema: resolveSchema(contract.request.body),
|
|
1116
|
+
},
|
|
1117
|
+
},
|
|
1118
|
+
},
|
|
1119
|
+
}
|
|
1120
|
+
: {}),
|
|
1121
|
+
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
1122
|
+
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
1123
|
+
},
|
|
1124
|
+
responses: buildResponses(contract.responses, resolveSchema),
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1034
1128
|
const generator = new OpenApiGeneratorV3(registry.definitions);
|
|
1035
1129
|
const document = generator.generateDocument({
|
|
1036
1130
|
openapi: '3.0.0',
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { UserContextResponseSchema } from '../../models';
|
|
4
|
+
import { USER_CONTEXT_ROUTES } from '../user-context';
|
|
5
|
+
|
|
6
|
+
export const ToggleUserContextCommandBody = z.object({
|
|
7
|
+
enabled: z.boolean(),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const ToggleUserContextCommandResponse = UserContextResponseSchema;
|
|
11
|
+
|
|
12
|
+
export const ToggleUserContextCommand = defineContract({
|
|
13
|
+
method: HTTP_METHODS.POST,
|
|
14
|
+
path: USER_CONTEXT_ROUTES.TOGGLE,
|
|
15
|
+
summary: 'Enable or disable applying the current user personalization context',
|
|
16
|
+
request: {
|
|
17
|
+
body: ToggleUserContextCommandBody,
|
|
18
|
+
},
|
|
19
|
+
responses: {
|
|
20
|
+
200: ToggleUserContextCommandResponse,
|
|
21
|
+
400: HttpErrorResponseSchema,
|
|
22
|
+
401: HttpErrorResponseSchema,
|
|
23
|
+
500: HttpErrorResponseSchema,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
3
|
+
import { USER_CONTEXT_FIELD_MAX_LENGTH, UserContextResponseSchema } from '../../models';
|
|
4
|
+
import { USER_CONTEXT_ROUTES } from '../user-context';
|
|
5
|
+
|
|
6
|
+
export const UpsertUserContextCommandBody = z.object({
|
|
7
|
+
name: z.string().max(USER_CONTEXT_FIELD_MAX_LENGTH).nullable().optional(),
|
|
8
|
+
aboutMe: z.string().max(USER_CONTEXT_FIELD_MAX_LENGTH).nullable().optional(),
|
|
9
|
+
preferences: z.string().max(USER_CONTEXT_FIELD_MAX_LENGTH).nullable().optional(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const UpsertUserContextCommandResponse = UserContextResponseSchema;
|
|
13
|
+
|
|
14
|
+
export const UpsertUserContextCommand = defineContract({
|
|
15
|
+
method: HTTP_METHODS.POST,
|
|
16
|
+
path: USER_CONTEXT_ROUTES.UPSERT,
|
|
17
|
+
summary: 'Create or update the current user personalization context',
|
|
18
|
+
request: {
|
|
19
|
+
body: UpsertUserContextCommandBody,
|
|
20
|
+
},
|
|
21
|
+
responses: {
|
|
22
|
+
200: UpsertUserContextCommandResponse,
|
|
23
|
+
400: HttpErrorResponseSchema,
|
|
24
|
+
401: HttpErrorResponseSchema,
|
|
25
|
+
500: HttpErrorResponseSchema,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineContract, HTTP_METHODS, HttpErrorResponseSchema } from '../../../_common';
|
|
2
|
+
import { UserContextResponseSchema } from '../../models';
|
|
3
|
+
import { USER_CONTEXT_ROUTES } from '../user-context';
|
|
4
|
+
|
|
5
|
+
export const GetUserContextQueryResponse = UserContextResponseSchema;
|
|
6
|
+
|
|
7
|
+
export const GetUserContextQuery = defineContract({
|
|
8
|
+
method: HTTP_METHODS.GET,
|
|
9
|
+
path: USER_CONTEXT_ROUTES.GET,
|
|
10
|
+
summary: 'Get the current user personalization context',
|
|
11
|
+
responses: {
|
|
12
|
+
200: GetUserContextQueryResponse,
|
|
13
|
+
401: HttpErrorResponseSchema,
|
|
14
|
+
500: HttpErrorResponseSchema,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './get-user-context.query';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './user-context-response.schema';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const USER_CONTEXT_FIELD_MAX_LENGTH = 2000;
|
|
4
|
+
|
|
5
|
+
export const UserContextResponseSchema = z.object({
|
|
6
|
+
name: z.string().max(USER_CONTEXT_FIELD_MAX_LENGTH).nullable(),
|
|
7
|
+
aboutMe: z.string().max(USER_CONTEXT_FIELD_MAX_LENGTH).nullable(),
|
|
8
|
+
preferences: z.string().max(USER_CONTEXT_FIELD_MAX_LENGTH).nullable(),
|
|
9
|
+
enabled: z.boolean(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type UserContextResponseSchemaType = z.infer<typeof UserContextResponseSchema>;
|