@purpleschool/rugpt-lib-common 0.0.28 → 0.0.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.
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ICommandResponseSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const ICommandResponseSchema = (dataSchema) => zod_1.z.object({
6
+ isSuccess: zod_1.z.boolean(),
7
+ data: dataSchema.optional(),
8
+ code: zod_1.z.string().optional(),
9
+ message: zod_1.z.string().optional(),
10
+ });
11
+ exports.ICommandResponseSchema = ICommandResponseSchema;
@@ -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("./command-response.schema"), exports);
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ai-model-status.enum"), exports);
18
18
  __exportStar(require("./locale.enum"), exports);
19
19
  __exportStar(require("./statistics"), exports);
20
+ __exportStar(require("./tools-api"), exports);
@@ -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("./save-file.command"), exports);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SaveFileCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../../../common");
6
+ var SaveFileCommand;
7
+ (function (SaveFileCommand) {
8
+ SaveFileCommand.RequestSchema = zod_1.z.object({
9
+ userId: zod_1.z.string().uuid().nullable().optional(),
10
+ unregisteredUserId: zod_1.z.string().uuid().nullable().optional(),
11
+ fileUrls: zod_1.z.array(zod_1.z.string().url()).min(1),
12
+ });
13
+ const fileWithUuid = zod_1.z.object({
14
+ uuid: zod_1.z.string().uuid(),
15
+ url: zod_1.z.string().url(),
16
+ });
17
+ SaveFileCommand.ResponseSchema = (0, common_1.ICommandResponseSchema)(zod_1.z.object({
18
+ data: zod_1.z.array(fileWithUuid),
19
+ }));
20
+ })(SaveFileCommand || (exports.SaveFileCommand = SaveFileCommand = {}));
@@ -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("./commands"), exports);
18
+ __exportStar(require("./tools-api.amqp.routes"), exports);
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TOOLS_API_AMQP_ROUTES = void 0;
4
+ exports.TOOLS_API_AMQP_ROUTES = {
5
+ SAVE_FILES: 'tools-api.save-files.rpc',
6
+ };
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+
3
+ export const ICommandResponseSchema = <T>(dataSchema: z.ZodType<T>) =>
4
+ z.object({
5
+ isSuccess: z.boolean(),
6
+ data: dataSchema.optional(),
7
+ code: z.string().optional(),
8
+ message: z.string().optional(),
9
+ });
@@ -0,0 +1 @@
1
+ export * from './command-response.schema';
package/enums/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './ai-model-status.enum';
2
2
  export * from './locale.enum';
3
- export * from './statistics';
3
+ export * from './statistics';
4
+ export * from './tools-api';
@@ -0,0 +1 @@
1
+ export * from './save-file.command';
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ import { ICommandResponseSchema } from "../../../common";
3
+
4
+ export namespace SaveFileCommand {
5
+ export const RequestSchema = z.object({
6
+ userId: z.string().uuid().nullable().optional(),
7
+ unregisteredUserId: z.string().uuid().nullable().optional(),
8
+ fileUrls: z.array(z.string().url()).min(1),
9
+ });
10
+
11
+ export type Request = z.infer<typeof RequestSchema>;
12
+
13
+ const fileWithUuid = z.object({
14
+ uuid: z.string().uuid(),
15
+ url: z.string().url(),
16
+ });
17
+
18
+ export const ResponseSchema = ICommandResponseSchema(
19
+ z.object({
20
+ data: z.array(
21
+ fileWithUuid
22
+ ),
23
+ }),
24
+ );
25
+
26
+ export type Response = z.infer<typeof ResponseSchema>;
27
+ }
@@ -0,0 +1,2 @@
1
+ export * from './commands';
2
+ export * from './tools-api.amqp.routes';
@@ -0,0 +1,3 @@
1
+ export const TOOLS_API_AMQP_ROUTES = {
2
+ SAVE_FILES: 'tools-api.save-files.rpc',
3
+ } as const;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/rugpt-lib-common",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",