@ai-grator/api 0.1.27 → 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 +19 -0
- package/build/errors/errors.d.ts.map +1 -1
- package/build/errors/errors.js +19 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/scripts/generate-openapi.js +43 -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 +19 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/scripts/generate-openapi.ts +56 -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
package/build/errors/errors.d.ts
CHANGED
|
@@ -743,6 +743,13 @@ export declare const ERRORS: {
|
|
|
743
743
|
readonly message: "Модель перегружена. Попробуйте позже или выберите другую модель";
|
|
744
744
|
};
|
|
745
745
|
};
|
|
746
|
+
readonly AI_EMBEDDING: {
|
|
747
|
+
readonly REQUEST_ERROR: {
|
|
748
|
+
readonly httpCode: 500;
|
|
749
|
+
readonly code: "AI_EMBEDDING.REQUEST_ERROR";
|
|
750
|
+
readonly message: "Ошибка запроса эмбеддингов к AI";
|
|
751
|
+
};
|
|
752
|
+
};
|
|
746
753
|
readonly GENERATION_PROVIDER: {
|
|
747
754
|
readonly UNAUTHORIZED: {
|
|
748
755
|
readonly httpCode: 401;
|
|
@@ -829,5 +836,17 @@ export declare const ERRORS: {
|
|
|
829
836
|
readonly message: "Не удалось получить каталог моделей";
|
|
830
837
|
};
|
|
831
838
|
};
|
|
839
|
+
readonly USER_CONTEXT: {
|
|
840
|
+
readonly FIND_ERROR: {
|
|
841
|
+
readonly httpCode: 500;
|
|
842
|
+
readonly code: "USER_CONTEXT.FIND_ERROR";
|
|
843
|
+
readonly message: "Не удалось найти контекст пользователя";
|
|
844
|
+
};
|
|
845
|
+
readonly UPSERT_ERROR: {
|
|
846
|
+
readonly httpCode: 500;
|
|
847
|
+
readonly code: "USER_CONTEXT.UPSERT_ERROR";
|
|
848
|
+
readonly message: "Не удалось сохранить контекст пользователя";
|
|
849
|
+
};
|
|
850
|
+
};
|
|
832
851
|
};
|
|
833
852
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../errors/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../errors/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAm1BT,CAAC"}
|
package/build/errors/errors.js
CHANGED
|
@@ -746,6 +746,13 @@ exports.ERRORS = {
|
|
|
746
746
|
message: 'Модель перегружена. Попробуйте позже или выберите другую модель',
|
|
747
747
|
},
|
|
748
748
|
},
|
|
749
|
+
AI_EMBEDDING: {
|
|
750
|
+
REQUEST_ERROR: {
|
|
751
|
+
httpCode: 500,
|
|
752
|
+
code: 'AI_EMBEDDING.REQUEST_ERROR',
|
|
753
|
+
message: 'Ошибка запроса эмбеддингов к AI',
|
|
754
|
+
},
|
|
755
|
+
},
|
|
749
756
|
GENERATION_PROVIDER: {
|
|
750
757
|
UNAUTHORIZED: {
|
|
751
758
|
httpCode: 401,
|
|
@@ -832,4 +839,16 @@ exports.ERRORS = {
|
|
|
832
839
|
message: 'Не удалось получить каталог моделей',
|
|
833
840
|
},
|
|
834
841
|
},
|
|
842
|
+
USER_CONTEXT: {
|
|
843
|
+
FIND_ERROR: {
|
|
844
|
+
httpCode: 500,
|
|
845
|
+
code: 'USER_CONTEXT.FIND_ERROR',
|
|
846
|
+
message: 'Не удалось найти контекст пользователя',
|
|
847
|
+
},
|
|
848
|
+
UPSERT_ERROR: {
|
|
849
|
+
httpCode: 500,
|
|
850
|
+
code: 'USER_CONTEXT.UPSERT_ERROR',
|
|
851
|
+
message: 'Не удалось сохранить контекст пользователя',
|
|
852
|
+
},
|
|
853
|
+
},
|
|
835
854
|
};
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -89,6 +89,10 @@ const update_marketplace_card_command_1 = require("../marketplace-card/endpoints
|
|
|
89
89
|
const get_marketplace_card_query_1 = require("../marketplace-card/endpoints/queries/get-marketplace-card.query");
|
|
90
90
|
const get_marketplace_card_history_query_1 = require("../marketplace-card/endpoints/queries/get-marketplace-card-history.query");
|
|
91
91
|
const get_marketplace_card_config_query_1 = require("../marketplace-card/endpoints/queries/get-marketplace-card-config.query");
|
|
92
|
+
const user_context_1 = require("../user-context/endpoints/user-context");
|
|
93
|
+
const get_user_context_query_1 = require("../user-context/endpoints/queries/get-user-context.query");
|
|
94
|
+
const upsert_user_context_command_1 = require("../user-context/endpoints/commands/upsert-user-context.command");
|
|
95
|
+
const toggle_user_context_command_1 = require("../user-context/endpoints/commands/toggle-user-context.command");
|
|
92
96
|
const supportedHttpMethods = new Set(['get', 'post', 'put', 'patch', 'delete']);
|
|
93
97
|
function toOpenApiPath(controller, routePath) {
|
|
94
98
|
const normalizedController = controller.replace(/^\/+|\/+$/g, '');
|
|
@@ -279,6 +283,11 @@ async function main() {
|
|
|
279
283
|
registerSchema('MarketplaceCardHistoryQuery', get_marketplace_card_history_query_1.GetMarketplaceCardHistoryQueryQuery);
|
|
280
284
|
registerSchema('MarketplaceCardHistoryResponse', get_marketplace_card_history_query_1.GetMarketplaceCardHistoryQueryResponse);
|
|
281
285
|
registerSchema('MarketplaceCardConfigResponse', get_marketplace_card_config_query_1.GetMarketplaceCardConfigResponse);
|
|
286
|
+
registerSchema('UserContextGetResponse', get_user_context_query_1.GetUserContextQueryResponse);
|
|
287
|
+
registerSchema('UserContextUpsertRequest', upsert_user_context_command_1.UpsertUserContextCommandBody);
|
|
288
|
+
registerSchema('UserContextUpsertResponse', upsert_user_context_command_1.UpsertUserContextCommandResponse);
|
|
289
|
+
registerSchema('UserContextToggleRequest', toggle_user_context_command_1.ToggleUserContextCommandBody);
|
|
290
|
+
registerSchema('UserContextToggleResponse', toggle_user_context_command_1.ToggleUserContextCommandResponse);
|
|
282
291
|
const authContracts = [
|
|
283
292
|
register_command_1.RegisterCommand,
|
|
284
293
|
login_command_1.LoginCommand,
|
|
@@ -312,6 +321,11 @@ async function main() {
|
|
|
312
321
|
];
|
|
313
322
|
const walletContracts = [get_wallet_balance_query_1.GetWalletBalanceQuery, get_wallet_transactions_query_1.GetWalletTransactionsQuery];
|
|
314
323
|
const paymentContracts = [create_payment_command_1.CreatePaymentCommand];
|
|
324
|
+
const userContextContracts = [
|
|
325
|
+
get_user_context_query_1.GetUserContextQuery,
|
|
326
|
+
upsert_user_context_command_1.UpsertUserContextCommand,
|
|
327
|
+
toggle_user_context_command_1.ToggleUserContextCommand,
|
|
328
|
+
];
|
|
315
329
|
const marketplaceCardContracts = [
|
|
316
330
|
create_marketplace_card_command_1.CreateMarketplaceCardCommand,
|
|
317
331
|
get_marketplace_card_history_query_1.GetMarketplaceCardHistoryQuery,
|
|
@@ -773,6 +787,35 @@ async function main() {
|
|
|
773
787
|
responses: buildResponses(contract.responses, resolveSchema),
|
|
774
788
|
});
|
|
775
789
|
}
|
|
790
|
+
for (const contract of userContextContracts) {
|
|
791
|
+
const method = contract.method.toLowerCase();
|
|
792
|
+
if (!supportedHttpMethods.has(method)) {
|
|
793
|
+
throw new Error(`Unsupported HTTP method: ${contract.method}`);
|
|
794
|
+
}
|
|
795
|
+
registry.registerPath({
|
|
796
|
+
method: method,
|
|
797
|
+
path: toOpenApiPath(user_context_1.USER_CONTEXT_CONTROLLER, contract.path),
|
|
798
|
+
summary: contract.summary,
|
|
799
|
+
tags: ['User Context'],
|
|
800
|
+
request: {
|
|
801
|
+
...(contract.request?.body
|
|
802
|
+
? {
|
|
803
|
+
body: {
|
|
804
|
+
required: true,
|
|
805
|
+
content: {
|
|
806
|
+
'application/json': {
|
|
807
|
+
schema: resolveSchema(contract.request.body),
|
|
808
|
+
},
|
|
809
|
+
},
|
|
810
|
+
},
|
|
811
|
+
}
|
|
812
|
+
: {}),
|
|
813
|
+
...(contract.request?.query ? { query: resolveSchema(contract.request.query) } : {}),
|
|
814
|
+
...(contract.request?.params ? { params: resolveSchema(contract.request.params) } : {}),
|
|
815
|
+
},
|
|
816
|
+
responses: buildResponses(contract.responses, resolveSchema),
|
|
817
|
+
});
|
|
818
|
+
}
|
|
776
819
|
const generator = new zod_to_openapi_1.OpenApiGeneratorV3(registry.definitions);
|
|
777
820
|
const document = generator.generateDocument({
|
|
778
821
|
openapi: '3.0.0',
|