@purpleschool/multisite 0.0.35 → 0.0.41

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 (140) hide show
  1. package/api/controller/http/catalog.ts +6 -0
  2. package/api/controller/http/file.ts +1 -0
  3. package/api/controller/http/index.ts +2 -0
  4. package/api/controller/http/text-chat.ts +18 -0
  5. package/build/api/controller/http/catalog.d.ts +7 -0
  6. package/build/api/controller/http/catalog.d.ts.map +1 -0
  7. package/build/api/controller/http/catalog.js +9 -0
  8. package/build/api/controller/http/file.d.ts +1 -0
  9. package/build/api/controller/http/file.d.ts.map +1 -1
  10. package/build/api/controller/http/file.js +1 -0
  11. package/build/api/controller/http/index.d.ts +2 -0
  12. package/build/api/controller/http/index.d.ts.map +1 -1
  13. package/build/api/controller/http/index.js +2 -0
  14. package/build/api/controller/http/text-chat.d.ts +18 -0
  15. package/build/api/controller/http/text-chat.d.ts.map +1 -0
  16. package/build/api/controller/http/text-chat.js +20 -0
  17. package/build/commands/auth/verify-email.command.d.ts.map +1 -1
  18. package/build/commands/auth/verify-email.command.js +2 -1
  19. package/build/commands/catalog/index.d.ts +156 -0
  20. package/build/commands/catalog/index.d.ts.map +1 -0
  21. package/build/commands/catalog/index.js +23 -0
  22. package/build/commands/index.d.ts +2 -0
  23. package/build/commands/index.d.ts.map +1 -1
  24. package/build/commands/index.js +2 -0
  25. package/build/commands/page/create-page.command.d.ts +8 -0
  26. package/build/commands/page/create-page.command.d.ts.map +1 -1
  27. package/build/commands/page/find-page-by-alias.command.d.ts +16 -0
  28. package/build/commands/page/find-page-by-alias.command.d.ts.map +1 -1
  29. package/build/commands/page/find-page-by-criteria.command.d.ts +5 -0
  30. package/build/commands/page/find-page-by-criteria.command.d.ts.map +1 -1
  31. package/build/commands/page/find-page.command.d.ts +11 -0
  32. package/build/commands/page/find-page.command.d.ts.map +1 -1
  33. package/build/commands/page/update-page.command.d.ts +8 -0
  34. package/build/commands/page/update-page.command.d.ts.map +1 -1
  35. package/build/commands/product/fast-buy-product.command.d.ts.map +1 -1
  36. package/build/commands/product/fast-buy-product.command.js +2 -1
  37. package/build/commands/subscription/fast-buy-subscription.command.d.ts.map +1 -1
  38. package/build/commands/subscription/fast-buy-subscription.command.js +2 -1
  39. package/build/commands/text-chat/category.d.ts +321 -0
  40. package/build/commands/text-chat/category.d.ts.map +1 -0
  41. package/build/commands/text-chat/category.js +29 -0
  42. package/build/commands/text-chat/index.d.ts +292 -0
  43. package/build/commands/text-chat/index.d.ts.map +1 -0
  44. package/build/commands/text-chat/index.js +73 -0
  45. package/build/constants/catalog.d.ts +5 -0
  46. package/build/constants/catalog.d.ts.map +1 -0
  47. package/build/constants/catalog.js +8 -0
  48. package/build/constants/errors/errors.d.ts +72 -0
  49. package/build/constants/errors/errors.d.ts.map +1 -1
  50. package/build/constants/errors/errors.js +72 -0
  51. package/build/constants/files/enums/file-type.enum.d.ts +3 -1
  52. package/build/constants/files/enums/file-type.enum.d.ts.map +1 -1
  53. package/build/constants/files/enums/file-type.enum.js +2 -0
  54. package/build/constants/index.d.ts +3 -0
  55. package/build/constants/index.d.ts.map +1 -1
  56. package/build/constants/index.js +3 -0
  57. package/build/constants/text-chat/attachments.d.ts +12 -0
  58. package/build/constants/text-chat/attachments.d.ts.map +1 -0
  59. package/build/constants/text-chat/attachments.js +52 -0
  60. package/build/constants/text-chat/index.d.ts +38 -0
  61. package/build/constants/text-chat/index.d.ts.map +1 -0
  62. package/build/constants/text-chat/index.js +59 -0
  63. package/build/constants/text-provider/index.d.ts +37 -0
  64. package/build/constants/text-provider/index.d.ts.map +1 -0
  65. package/build/constants/text-provider/index.js +46 -0
  66. package/build/constants/tools/enums/tool-type.enum.d.ts +1 -0
  67. package/build/constants/tools/enums/tool-type.enum.d.ts.map +1 -1
  68. package/build/constants/tools/enums/tool-type.enum.js +1 -0
  69. package/build/helpers/index.d.ts +1 -0
  70. package/build/helpers/index.d.ts.map +1 -1
  71. package/build/helpers/index.js +1 -0
  72. package/build/helpers/text-chat/index.d.ts +23 -0
  73. package/build/helpers/text-chat/index.d.ts.map +1 -0
  74. package/build/helpers/text-chat/index.js +91 -0
  75. package/build/models/catalog/index.d.ts +181 -0
  76. package/build/models/catalog/index.d.ts.map +1 -0
  77. package/build/models/catalog/index.js +36 -0
  78. package/build/models/index.d.ts +2 -0
  79. package/build/models/index.d.ts.map +1 -1
  80. package/build/models/index.js +2 -0
  81. package/build/models/page.schema.d.ts +6 -0
  82. package/build/models/page.schema.d.ts.map +1 -1
  83. package/build/models/page.schema.js +1 -0
  84. package/build/models/text-chat/category.schema.d.ts +79 -0
  85. package/build/models/text-chat/category.schema.d.ts.map +1 -0
  86. package/build/models/text-chat/category.schema.js +38 -0
  87. package/build/models/text-chat/index.d.ts +319 -0
  88. package/build/models/text-chat/index.d.ts.map +1 -0
  89. package/build/models/text-chat/index.js +79 -0
  90. package/build/models/text-chat/provider-config.schema.d.ts +92 -0
  91. package/build/models/text-chat/provider-config.schema.d.ts.map +1 -0
  92. package/build/models/text-chat/provider-config.schema.js +42 -0
  93. package/build/models/text-chat/stream.schema.d.ts +83 -0
  94. package/build/models/text-chat/stream.schema.d.ts.map +1 -0
  95. package/build/models/text-chat/stream.schema.js +24 -0
  96. package/build/models/user.schema.d.ts +1 -0
  97. package/build/models/user.schema.d.ts.map +1 -1
  98. package/build/models/user.schema.js +3 -2
  99. package/build/queries/catalog/index.d.ts +259 -0
  100. package/build/queries/catalog/index.d.ts.map +1 -0
  101. package/build/queries/catalog/index.js +31 -0
  102. package/build/queries/index.d.ts +2 -0
  103. package/build/queries/index.d.ts.map +1 -1
  104. package/build/queries/index.js +2 -0
  105. package/build/queries/text-chat/category.d.ts +297 -0
  106. package/build/queries/text-chat/category.d.ts.map +1 -0
  107. package/build/queries/text-chat/category.js +45 -0
  108. package/build/queries/text-chat/index.d.ts +472 -0
  109. package/build/queries/text-chat/index.d.ts.map +1 -0
  110. package/build/queries/text-chat/index.js +61 -0
  111. package/commands/auth/verify-email.command.ts +2 -1
  112. package/commands/catalog/index.ts +26 -0
  113. package/commands/index.ts +2 -0
  114. package/commands/product/fast-buy-product.command.ts +2 -1
  115. package/commands/subscription/fast-buy-subscription.command.ts +2 -1
  116. package/commands/text-chat/category.ts +42 -0
  117. package/commands/text-chat/index.ts +71 -0
  118. package/constants/catalog.ts +4 -0
  119. package/constants/errors/errors.ts +73 -0
  120. package/constants/files/enums/file-type.enum.ts +2 -0
  121. package/constants/index.ts +3 -0
  122. package/constants/text-chat/attachments.ts +55 -0
  123. package/constants/text-chat/index.ts +43 -0
  124. package/constants/text-provider/index.ts +42 -0
  125. package/constants/tools/enums/tool-type.enum.ts +1 -0
  126. package/helpers/index.ts +1 -0
  127. package/helpers/text-chat/index.ts +91 -0
  128. package/models/catalog/index.ts +35 -0
  129. package/models/index.ts +2 -0
  130. package/models/page.schema.ts +1 -0
  131. package/models/text-chat/category.schema.ts +40 -0
  132. package/models/text-chat/index.ts +82 -0
  133. package/models/text-chat/provider-config.schema.ts +47 -0
  134. package/models/text-chat/stream.schema.ts +43 -0
  135. package/models/user.schema.ts +3 -1
  136. package/package.json +1 -1
  137. package/queries/catalog/index.ts +29 -0
  138. package/queries/index.ts +2 -0
  139. package/queries/text-chat/category.ts +51 -0
  140. package/queries/text-chat/index.ts +56 -0
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ import { TEXT_CHAT_ERROR_CODE, TEXT_CHAT_STREAM_EVENT } from '../../constants/text-chat';
3
+
4
+ const correlation = {
5
+ chatId: z.string().uuid(),
6
+ messageId: z.string().uuid(),
7
+ sequence: z.number().int().safe().nonnegative(),
8
+ };
9
+
10
+ export const TextChatStreamFrameSchema = z.discriminatedUnion('type', [
11
+ z
12
+ .object({
13
+ ...correlation,
14
+ type: z.literal(TEXT_CHAT_STREAM_EVENT.START),
15
+ userMessageId: z.string().uuid(),
16
+ modelId: z.string().uuid(),
17
+ })
18
+ .strict(),
19
+ z
20
+ .object({
21
+ ...correlation,
22
+ type: z.literal(TEXT_CHAT_STREAM_EVENT.DELTA),
23
+ delta: z.string().min(1),
24
+ })
25
+ .strict(),
26
+ z
27
+ .object({
28
+ ...correlation,
29
+ type: z.literal(TEXT_CHAT_STREAM_EVENT.FINISH),
30
+ price: z.number().int().safe().positive(),
31
+ })
32
+ .strict(),
33
+ z
34
+ .object({
35
+ ...correlation,
36
+ type: z.literal(TEXT_CHAT_STREAM_EVENT.ERROR),
37
+ code: z.nativeEnum(TEXT_CHAT_ERROR_CODE),
38
+ message: z.string().min(1).optional(),
39
+ })
40
+ .strict(),
41
+ ]);
42
+
43
+ export type TextChatStreamFrame = z.infer<typeof TextChatStreamFrameSchema>;
@@ -1,10 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  import { USER_ROLE, USER_STATUS } from '../constants';
3
3
 
4
+ export const EmailInputSchema = z.string().trim().toLowerCase().email();
5
+
4
6
  export const UserSchema = z.object({
5
7
  uuid: z.string().uuid().optional(),
6
8
  siteId: z.string().uuid().optional(),
7
- email: z.string().email(),
9
+ email: EmailInputSchema,
8
10
  password: z.string().min(6).max(128),
9
11
  role: z.nativeEnum(USER_ROLE).optional(),
10
12
  status: z.nativeEnum(USER_STATUS).optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/multisite",
3
- "version": "0.0.35",
3
+ "version": "0.0.41",
4
4
  "description": "Multisite API contracts (DTO schemas, routes, constants)",
5
5
  "type": "commonjs",
6
6
  "main": "build/index.js",
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { CatalogGroupAdminSchema, PublicCatalogGroupSchema } from '../../models/catalog';
3
+
4
+ export namespace GetCatalogCommand {
5
+ export const ResponseSchema = z.object({ data: z.array(PublicCatalogGroupSchema) });
6
+ export type Response = z.infer<typeof ResponseSchema>;
7
+ }
8
+ export namespace GetCatalogGroupCommand {
9
+ export const RequestParamsSchema = z.object({ uuid: z.string().uuid() }).strict();
10
+ export const ResponseSchema = z.object({ data: CatalogGroupAdminSchema });
11
+ export type Response = z.infer<typeof ResponseSchema>;
12
+ }
13
+ export namespace FindCatalogGroupsCommand {
14
+ export const RequestQuerySchema = z
15
+ .object({
16
+ limit: z.coerce.number().int().min(1).max(100).default(20),
17
+ offset: z.coerce.number().int().min(0).default(0),
18
+ })
19
+ .strict();
20
+ export const ResponseSchema = z.object({
21
+ data: z.array(CatalogGroupAdminSchema),
22
+ meta: z.object({
23
+ limit: z.number().int().positive(),
24
+ offset: z.number().int().nonnegative(),
25
+ total: z.number().int().nonnegative(),
26
+ }),
27
+ });
28
+ export type Response = z.infer<typeof ResponseSchema>;
29
+ }
package/queries/index.ts CHANGED
@@ -10,3 +10,5 @@ export * from './page';
10
10
  export * from './marketplace-card';
11
11
  export * from './stt';
12
12
  export * from './tts';
13
+ export * from './text-chat';
14
+ export * from './catalog';
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ import { TOOL_TYPE } from '../../constants/tools';
3
+ import { TEXT_CHAT_CATEGORY_SCOPE } from '../../constants/text-chat';
4
+ import {
5
+ TextChatCategoryAdminSchema,
6
+ TextChatCategoryPublicSchema,
7
+ } from '../../models/text-chat/category.schema';
8
+
9
+ const PaginationSchema = z.object({
10
+ limit: z.coerce.number().int().min(1).max(100).default(20),
11
+ offset: z.coerce.number().int().min(0).default(0),
12
+ });
13
+ const MetaSchema = z.object({
14
+ limit: z.number().int().positive(),
15
+ offset: z.number().int().nonnegative(),
16
+ total: z.number().int().nonnegative(),
17
+ });
18
+
19
+ export namespace FindTextChatCategoriesCommand {
20
+ export const RequestQuerySchema = PaginationSchema.strict();
21
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
22
+ export const ResponseSchema = z.object({
23
+ data: z.array(TextChatCategoryPublicSchema),
24
+ meta: MetaSchema,
25
+ });
26
+ export type Response = z.infer<typeof ResponseSchema>;
27
+ }
28
+ export namespace GetTextChatCategoryCommand {
29
+ export const RequestParamsSchema = z.object({ uuid: z.string().uuid() }).strict();
30
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
31
+ export const ResponseSchema = z.object({ data: TextChatCategoryPublicSchema });
32
+ export type Response = z.infer<typeof ResponseSchema>;
33
+ }
34
+ export namespace FindAdminTextChatCategoriesCommand {
35
+ export const RequestQuerySchema = PaginationSchema.extend({
36
+ toolType: z.nativeEnum(TOOL_TYPE).optional(),
37
+ scope: z.nativeEnum(TEXT_CHAT_CATEGORY_SCOPE).default(TEXT_CHAT_CATEGORY_SCOPE.ACTIVE),
38
+ }).strict();
39
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
40
+ export const ResponseSchema = z.object({
41
+ data: z.array(TextChatCategoryAdminSchema),
42
+ meta: MetaSchema,
43
+ });
44
+ export type Response = z.infer<typeof ResponseSchema>;
45
+ }
46
+ export namespace GetAdminTextChatCategoryCommand {
47
+ export const RequestParamsSchema = GetTextChatCategoryCommand.RequestParamsSchema;
48
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
49
+ export const ResponseSchema = z.object({ data: TextChatCategoryAdminSchema });
50
+ export type Response = z.infer<typeof ResponseSchema>;
51
+ }
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ export * from './category';
3
+ import {
4
+ TextChatConfigSchema,
5
+ TextChatMessageSchema,
6
+ TextChatSchema,
7
+ } from '../../models/text-chat';
8
+
9
+ export namespace GetTextChatConfigCommand {
10
+ export const ResponseSchema = z.object({ data: TextChatConfigSchema });
11
+ export type Response = z.infer<typeof ResponseSchema>;
12
+ }
13
+
14
+ export namespace FindTextChatsCommand {
15
+ export const RequestQuerySchema = z.object({
16
+ limit: z.coerce.number().int().min(1).max(100).default(20),
17
+ offset: z.coerce.number().int().min(0).default(0),
18
+ search: z.string().trim().max(200).optional(),
19
+ });
20
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
21
+ export const ResponseSchema = z.object({
22
+ data: z.array(TextChatSchema),
23
+ meta: z.object({
24
+ limit: z.number().int().positive(),
25
+ offset: z.number().int().nonnegative(),
26
+ total: z.number().int().nonnegative(),
27
+ }),
28
+ });
29
+ export type Response = z.infer<typeof ResponseSchema>;
30
+ }
31
+
32
+ export namespace GetTextChatCommand {
33
+ export const RequestParamsSchema = z.object({ uuid: z.string().uuid() });
34
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
35
+ export const ResponseSchema = z.object({ data: TextChatSchema });
36
+ export type Response = z.infer<typeof ResponseSchema>;
37
+ }
38
+
39
+ export namespace FindTextChatMessagesCommand {
40
+ export const RequestParamsSchema = z.object({ uuid: z.string().uuid() });
41
+ export type RequestParams = z.infer<typeof RequestParamsSchema>;
42
+ export const RequestQuerySchema = z.object({
43
+ limit: z.coerce.number().int().min(1).max(100).default(50),
44
+ offset: z.coerce.number().int().min(0).default(0),
45
+ });
46
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
47
+ export const ResponseSchema = z.object({
48
+ data: z.array(TextChatMessageSchema),
49
+ meta: z.object({
50
+ limit: z.number().int().positive(),
51
+ offset: z.number().int().nonnegative(),
52
+ total: z.number().int().nonnegative(),
53
+ }),
54
+ });
55
+ export type Response = z.infer<typeof ResponseSchema>;
56
+ }