@ai-grator/api 0.1.27 → 0.1.29

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.
Files changed (52) hide show
  1. package/build/errors/errors.d.ts +19 -0
  2. package/build/errors/errors.d.ts.map +1 -1
  3. package/build/errors/errors.js +19 -0
  4. package/build/index.d.ts +1 -0
  5. package/build/index.d.ts.map +1 -1
  6. package/build/index.js +1 -0
  7. package/build/scripts/generate-openapi.js +43 -0
  8. package/build/tsconfig.tsbuildinfo +1 -1
  9. package/build/user-context/endpoints/commands/index.d.ts +3 -0
  10. package/build/user-context/endpoints/commands/index.d.ts.map +1 -0
  11. package/build/user-context/endpoints/commands/index.js +18 -0
  12. package/build/user-context/endpoints/commands/toggle-user-context.command.d.ts +33 -0
  13. package/build/user-context/endpoints/commands/toggle-user-context.command.d.ts.map +1 -0
  14. package/build/user-context/endpoints/commands/toggle-user-context.command.js +25 -0
  15. package/build/user-context/endpoints/commands/upsert-user-context.command.d.ts +37 -0
  16. package/build/user-context/endpoints/commands/upsert-user-context.command.d.ts.map +1 -0
  17. package/build/user-context/endpoints/commands/upsert-user-context.command.js +27 -0
  18. package/build/user-context/endpoints/index.d.ts +4 -0
  19. package/build/user-context/endpoints/index.d.ts.map +1 -0
  20. package/build/user-context/endpoints/index.js +19 -0
  21. package/build/user-context/endpoints/queries/get-user-context.query.d.ts +23 -0
  22. package/build/user-context/endpoints/queries/get-user-context.query.d.ts.map +1 -0
  23. package/build/user-context/endpoints/queries/get-user-context.query.js +17 -0
  24. package/build/user-context/endpoints/queries/index.d.ts +2 -0
  25. package/build/user-context/endpoints/queries/index.d.ts.map +1 -0
  26. package/build/user-context/endpoints/queries/index.js +17 -0
  27. package/build/user-context/endpoints/user-context.d.ts +7 -0
  28. package/build/user-context/endpoints/user-context.d.ts.map +1 -0
  29. package/build/user-context/endpoints/user-context.js +9 -0
  30. package/build/user-context/index.d.ts +3 -0
  31. package/build/user-context/index.d.ts.map +1 -0
  32. package/build/user-context/index.js +18 -0
  33. package/build/user-context/models/index.d.ts +2 -0
  34. package/build/user-context/models/index.d.ts.map +1 -0
  35. package/build/user-context/models/index.js +17 -0
  36. package/build/user-context/models/user-context-response.schema.d.ts +10 -0
  37. package/build/user-context/models/user-context-response.schema.d.ts.map +1 -0
  38. package/build/user-context/models/user-context-response.schema.js +11 -0
  39. package/errors/errors.ts +19 -0
  40. package/index.ts +1 -0
  41. package/package.json +1 -1
  42. package/scripts/generate-openapi.ts +56 -0
  43. package/user-context/endpoints/commands/index.ts +2 -0
  44. package/user-context/endpoints/commands/toggle-user-context.command.ts +25 -0
  45. package/user-context/endpoints/commands/upsert-user-context.command.ts +27 -0
  46. package/user-context/endpoints/index.ts +3 -0
  47. package/user-context/endpoints/queries/get-user-context.query.ts +16 -0
  48. package/user-context/endpoints/queries/index.ts +1 -0
  49. package/user-context/endpoints/user-context.ts +7 -0
  50. package/user-context/index.ts +2 -0
  51. package/user-context/models/index.ts +1 -0
  52. package/user-context/models/user-context-response.schema.ts +12 -0
@@ -0,0 +1,3 @@
1
+ export * from './upsert-user-context.command';
2
+ export * from './toggle-user-context.command';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../user-context/endpoints/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./upsert-user-context.command"), exports);
18
+ __exportStar(require("./toggle-user-context.command"), exports);
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { HTTP_METHODS } from '../../../_common';
3
+ export declare const ToggleUserContextCommandBody: z.ZodObject<{
4
+ enabled: z.ZodBoolean;
5
+ }, z.core.$strip>;
6
+ export declare const ToggleUserContextCommandResponse: z.ZodObject<{
7
+ name: z.ZodNullable<z.ZodString>;
8
+ aboutMe: z.ZodNullable<z.ZodString>;
9
+ preferences: z.ZodNullable<z.ZodString>;
10
+ enabled: z.ZodBoolean;
11
+ }, z.core.$strip>;
12
+ export declare const ToggleUserContextCommand: {
13
+ method: HTTP_METHODS.POST;
14
+ path: "toggle";
15
+ summary: string;
16
+ request: {
17
+ body: z.ZodObject<{
18
+ enabled: z.ZodBoolean;
19
+ }, z.core.$strip>;
20
+ };
21
+ responses: {
22
+ 200: z.ZodObject<{
23
+ name: z.ZodNullable<z.ZodString>;
24
+ aboutMe: z.ZodNullable<z.ZodString>;
25
+ preferences: z.ZodNullable<z.ZodString>;
26
+ enabled: z.ZodBoolean;
27
+ }, z.core.$strip>;
28
+ 400: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
29
+ 401: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
30
+ 500: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
31
+ };
32
+ };
33
+ //# sourceMappingURL=toggle-user-context.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggle-user-context.command.d.ts","sourceRoot":"","sources":["../../../../user-context/endpoints/commands/toggle-user-context.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,YAAY,EAA2B,MAAM,kBAAkB,CAAC;AAIzF,eAAO,MAAM,4BAA4B;;iBAEvC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;iBAA4B,CAAC;AAE1E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;CAanC,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ToggleUserContextCommand = exports.ToggleUserContextCommandResponse = exports.ToggleUserContextCommandBody = void 0;
4
+ const zod_1 = require("zod");
5
+ const _common_1 = require("../../../_common");
6
+ const models_1 = require("../../models");
7
+ const user_context_1 = require("../user-context");
8
+ exports.ToggleUserContextCommandBody = zod_1.z.object({
9
+ enabled: zod_1.z.boolean(),
10
+ });
11
+ exports.ToggleUserContextCommandResponse = models_1.UserContextResponseSchema;
12
+ exports.ToggleUserContextCommand = (0, _common_1.defineContract)({
13
+ method: _common_1.HTTP_METHODS.POST,
14
+ path: user_context_1.USER_CONTEXT_ROUTES.TOGGLE,
15
+ summary: 'Enable or disable applying the current user personalization context',
16
+ request: {
17
+ body: exports.ToggleUserContextCommandBody,
18
+ },
19
+ responses: {
20
+ 200: exports.ToggleUserContextCommandResponse,
21
+ 400: _common_1.HttpErrorResponseSchema,
22
+ 401: _common_1.HttpErrorResponseSchema,
23
+ 500: _common_1.HttpErrorResponseSchema,
24
+ },
25
+ });
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ import { HTTP_METHODS } from '../../../_common';
3
+ export declare const UpsertUserContextCommandBody: z.ZodObject<{
4
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5
+ aboutMe: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
+ preferences: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
+ }, z.core.$strip>;
8
+ export declare const UpsertUserContextCommandResponse: z.ZodObject<{
9
+ name: z.ZodNullable<z.ZodString>;
10
+ aboutMe: z.ZodNullable<z.ZodString>;
11
+ preferences: z.ZodNullable<z.ZodString>;
12
+ enabled: z.ZodBoolean;
13
+ }, z.core.$strip>;
14
+ export declare const UpsertUserContextCommand: {
15
+ method: HTTP_METHODS.POST;
16
+ path: "";
17
+ summary: string;
18
+ request: {
19
+ body: z.ZodObject<{
20
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
+ aboutMe: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
+ preferences: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ }, z.core.$strip>;
24
+ };
25
+ responses: {
26
+ 200: z.ZodObject<{
27
+ name: z.ZodNullable<z.ZodString>;
28
+ aboutMe: z.ZodNullable<z.ZodString>;
29
+ preferences: z.ZodNullable<z.ZodString>;
30
+ enabled: z.ZodBoolean;
31
+ }, z.core.$strip>;
32
+ 400: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
33
+ 401: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
34
+ 500: z.ZodType<import("../../../_common").HttpErrorResponse, unknown, z.core.$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
35
+ };
36
+ };
37
+ //# sourceMappingURL=upsert-user-context.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upsert-user-context.command.d.ts","sourceRoot":"","sources":["../../../../user-context/endpoints/commands/upsert-user-context.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,YAAY,EAA2B,MAAM,kBAAkB,CAAC;AAIzF,eAAO,MAAM,4BAA4B;;;;iBAIvC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;iBAA4B,CAAC;AAE1E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;CAanC,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpsertUserContextCommand = exports.UpsertUserContextCommandResponse = exports.UpsertUserContextCommandBody = void 0;
4
+ const zod_1 = require("zod");
5
+ const _common_1 = require("../../../_common");
6
+ const models_1 = require("../../models");
7
+ const user_context_1 = require("../user-context");
8
+ exports.UpsertUserContextCommandBody = zod_1.z.object({
9
+ name: zod_1.z.string().max(models_1.USER_CONTEXT_FIELD_MAX_LENGTH).nullable().optional(),
10
+ aboutMe: zod_1.z.string().max(models_1.USER_CONTEXT_FIELD_MAX_LENGTH).nullable().optional(),
11
+ preferences: zod_1.z.string().max(models_1.USER_CONTEXT_FIELD_MAX_LENGTH).nullable().optional(),
12
+ });
13
+ exports.UpsertUserContextCommandResponse = models_1.UserContextResponseSchema;
14
+ exports.UpsertUserContextCommand = (0, _common_1.defineContract)({
15
+ method: _common_1.HTTP_METHODS.POST,
16
+ path: user_context_1.USER_CONTEXT_ROUTES.UPSERT,
17
+ summary: 'Create or update the current user personalization context',
18
+ request: {
19
+ body: exports.UpsertUserContextCommandBody,
20
+ },
21
+ responses: {
22
+ 200: exports.UpsertUserContextCommandResponse,
23
+ 400: _common_1.HttpErrorResponseSchema,
24
+ 401: _common_1.HttpErrorResponseSchema,
25
+ 500: _common_1.HttpErrorResponseSchema,
26
+ },
27
+ });
@@ -0,0 +1,4 @@
1
+ export * from './user-context';
2
+ export * from './commands';
3
+ export * from './queries';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../user-context/endpoints/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./user-context"), exports);
18
+ __exportStar(require("./commands"), exports);
19
+ __exportStar(require("./queries"), exports);
@@ -0,0 +1,23 @@
1
+ import { HTTP_METHODS } from '../../../_common';
2
+ export declare const GetUserContextQueryResponse: import("zod").ZodObject<{
3
+ name: import("zod").ZodNullable<import("zod").ZodString>;
4
+ aboutMe: import("zod").ZodNullable<import("zod").ZodString>;
5
+ preferences: import("zod").ZodNullable<import("zod").ZodString>;
6
+ enabled: import("zod").ZodBoolean;
7
+ }, import("zod/v4/core").$strip>;
8
+ export declare const GetUserContextQuery: {
9
+ method: HTTP_METHODS.GET;
10
+ path: "";
11
+ summary: string;
12
+ responses: {
13
+ 200: import("zod").ZodObject<{
14
+ name: import("zod").ZodNullable<import("zod").ZodString>;
15
+ aboutMe: import("zod").ZodNullable<import("zod").ZodString>;
16
+ preferences: import("zod").ZodNullable<import("zod").ZodString>;
17
+ enabled: import("zod").ZodBoolean;
18
+ }, import("zod/v4/core").$strip>;
19
+ 401: import("zod").ZodType<import("../../../_common").HttpErrorResponse, unknown, import("zod/v4/core").$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
20
+ 500: import("zod").ZodType<import("../../../_common").HttpErrorResponse, unknown, import("zod/v4/core").$ZodTypeInternals<import("../../../_common").HttpErrorResponse, unknown>>;
21
+ };
22
+ };
23
+ //# sourceMappingURL=get-user-context.query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-user-context.query.d.ts","sourceRoot":"","sources":["../../../../user-context/endpoints/queries/get-user-context.query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,YAAY,EAA2B,MAAM,kBAAkB,CAAC;AAIzF,eAAO,MAAM,2BAA2B;;;;;gCAA4B,CAAC;AAErE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;CAS9B,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetUserContextQuery = exports.GetUserContextQueryResponse = void 0;
4
+ const _common_1 = require("../../../_common");
5
+ const models_1 = require("../../models");
6
+ const user_context_1 = require("../user-context");
7
+ exports.GetUserContextQueryResponse = models_1.UserContextResponseSchema;
8
+ exports.GetUserContextQuery = (0, _common_1.defineContract)({
9
+ method: _common_1.HTTP_METHODS.GET,
10
+ path: user_context_1.USER_CONTEXT_ROUTES.GET,
11
+ summary: 'Get the current user personalization context',
12
+ responses: {
13
+ 200: exports.GetUserContextQueryResponse,
14
+ 401: _common_1.HttpErrorResponseSchema,
15
+ 500: _common_1.HttpErrorResponseSchema,
16
+ },
17
+ });
@@ -0,0 +1,2 @@
1
+ export * from './get-user-context.query';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../user-context/endpoints/queries/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./get-user-context.query"), exports);
@@ -0,0 +1,7 @@
1
+ export declare const USER_CONTEXT_CONTROLLER: "user-context";
2
+ export declare const USER_CONTEXT_ROUTES: {
3
+ readonly GET: "";
4
+ readonly UPSERT: "";
5
+ readonly TOGGLE: "toggle";
6
+ };
7
+ //# sourceMappingURL=user-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-context.d.ts","sourceRoot":"","sources":["../../../user-context/endpoints/user-context.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,EAAG,cAAuB,CAAC;AAE/D,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_CONTEXT_ROUTES = exports.USER_CONTEXT_CONTROLLER = void 0;
4
+ exports.USER_CONTEXT_CONTROLLER = 'user-context';
5
+ exports.USER_CONTEXT_ROUTES = {
6
+ GET: '',
7
+ UPSERT: '',
8
+ TOGGLE: 'toggle',
9
+ };
@@ -0,0 +1,3 @@
1
+ export * from './models';
2
+ export * from './endpoints';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../user-context/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./models"), exports);
18
+ __exportStar(require("./endpoints"), exports);
@@ -0,0 +1,2 @@
1
+ export * from './user-context-response.schema';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../user-context/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./user-context-response.schema"), exports);
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ export declare const USER_CONTEXT_FIELD_MAX_LENGTH = 2000;
3
+ export declare const UserContextResponseSchema: z.ZodObject<{
4
+ name: z.ZodNullable<z.ZodString>;
5
+ aboutMe: z.ZodNullable<z.ZodString>;
6
+ preferences: z.ZodNullable<z.ZodString>;
7
+ enabled: z.ZodBoolean;
8
+ }, z.core.$strip>;
9
+ export type UserContextResponseSchemaType = z.infer<typeof UserContextResponseSchema>;
10
+ //# sourceMappingURL=user-context-response.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-context-response.schema.d.ts","sourceRoot":"","sources":["../../../user-context/models/user-context-response.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD,eAAO,MAAM,yBAAyB;;;;;iBAKpC,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserContextResponseSchema = exports.USER_CONTEXT_FIELD_MAX_LENGTH = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.USER_CONTEXT_FIELD_MAX_LENGTH = 2000;
6
+ exports.UserContextResponseSchema = zod_1.z.object({
7
+ name: zod_1.z.string().max(exports.USER_CONTEXT_FIELD_MAX_LENGTH).nullable(),
8
+ aboutMe: zod_1.z.string().max(exports.USER_CONTEXT_FIELD_MAX_LENGTH).nullable(),
9
+ preferences: zod_1.z.string().max(exports.USER_CONTEXT_FIELD_MAX_LENGTH).nullable(),
10
+ enabled: zod_1.z.boolean(),
11
+ });
package/errors/errors.ts CHANGED
@@ -744,6 +744,13 @@ export const ERRORS = {
744
744
  message: 'Модель перегружена. Попробуйте позже или выберите другую модель',
745
745
  },
746
746
  },
747
+ AI_EMBEDDING: {
748
+ REQUEST_ERROR: {
749
+ httpCode: 500,
750
+ code: 'AI_EMBEDDING.REQUEST_ERROR',
751
+ message: 'Ошибка запроса эмбеддингов к AI',
752
+ },
753
+ },
747
754
  GENERATION_PROVIDER: {
748
755
  UNAUTHORIZED: {
749
756
  httpCode: 401,
@@ -830,4 +837,16 @@ export const ERRORS = {
830
837
  message: 'Не удалось получить каталог моделей',
831
838
  },
832
839
  },
840
+ USER_CONTEXT: {
841
+ FIND_ERROR: {
842
+ httpCode: 500,
843
+ code: 'USER_CONTEXT.FIND_ERROR',
844
+ message: 'Не удалось найти контекст пользователя',
845
+ },
846
+ UPSERT_ERROR: {
847
+ httpCode: 500,
848
+ code: 'USER_CONTEXT.UPSERT_ERROR',
849
+ message: 'Не удалось сохранить контекст пользователя',
850
+ },
851
+ },
833
852
  } as const;
package/index.ts CHANGED
@@ -18,3 +18,4 @@ export * from './file';
18
18
  export * from './generation-job-chat';
19
19
  export * from './marketplace-card';
20
20
  export * from './support';
21
+ export * from './user-context';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-grator/api",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "scripts": {
@@ -335,6 +335,21 @@ import {
335
335
  GetMarketplaceCardConfigQuery,
336
336
  GetMarketplaceCardConfigResponse,
337
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';
338
353
 
339
354
  const supportedHttpMethods = new Set(['get', 'post', 'put', 'patch', 'delete']);
340
355
 
@@ -544,6 +559,11 @@ async function main() {
544
559
  registerSchema('MarketplaceCardHistoryQuery', GetMarketplaceCardHistoryQueryQuery);
545
560
  registerSchema('MarketplaceCardHistoryResponse', GetMarketplaceCardHistoryQueryResponse);
546
561
  registerSchema('MarketplaceCardConfigResponse', GetMarketplaceCardConfigResponse);
562
+ registerSchema('UserContextGetResponse', GetUserContextQueryResponse);
563
+ registerSchema('UserContextUpsertRequest', UpsertUserContextCommandBody);
564
+ registerSchema('UserContextUpsertResponse', UpsertUserContextCommandResponse);
565
+ registerSchema('UserContextToggleRequest', ToggleUserContextCommandBody);
566
+ registerSchema('UserContextToggleResponse', ToggleUserContextCommandResponse);
547
567
 
548
568
  const authContracts: HttpContract[] = [
549
569
  RegisterCommand,
@@ -578,6 +598,11 @@ async function main() {
578
598
  ];
579
599
  const walletContracts: HttpContract[] = [GetWalletBalanceQuery, GetWalletTransactionsQuery];
580
600
  const paymentContracts: HttpContract[] = [CreatePaymentCommand];
601
+ const userContextContracts: HttpContract[] = [
602
+ GetUserContextQuery,
603
+ UpsertUserContextCommand,
604
+ ToggleUserContextCommand,
605
+ ];
581
606
  const marketplaceCardContracts: HttpContract[] = [
582
607
  CreateMarketplaceCardCommand,
583
608
  GetMarketplaceCardHistoryQuery,
@@ -1069,6 +1094,37 @@ async function main() {
1069
1094
  });
1070
1095
  }
1071
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
+
1072
1128
  const generator = new OpenApiGeneratorV3(registry.definitions);
1073
1129
  const document = generator.generateDocument({
1074
1130
  openapi: '3.0.0',
@@ -0,0 +1,2 @@
1
+ export * from './upsert-user-context.command';
2
+ export * from './toggle-user-context.command';
@@ -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,3 @@
1
+ export * from './user-context';
2
+ export * from './commands';
3
+ export * from './queries';
@@ -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,7 @@
1
+ export const USER_CONTEXT_CONTROLLER = 'user-context' as const;
2
+
3
+ export const USER_CONTEXT_ROUTES = {
4
+ GET: '',
5
+ UPSERT: '',
6
+ TOGGLE: 'toggle',
7
+ } as const;
@@ -0,0 +1,2 @@
1
+ export * from './models';
2
+ export * from './endpoints';
@@ -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>;