@purpleschool/gptbot 0.1.7 → 0.2.0

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.
@@ -5,5 +5,6 @@ export const CHAT_PRIVATE_ROUTES = {
5
5
  GET_BY_UUID: 'by/uuid',
6
6
  GET_MY: 'get/my',
7
7
  GET_LAST_ACTIVE_CHAT: `last-active-chat`,
8
+ GET_LIMIT: 'limit',
8
9
  CREATE_MESSAGE: (uuid: string) => `my/${uuid}/send`,
9
10
  } as const;
@@ -3,4 +3,5 @@ export const PRODUCT_CONTROLLER = 'product' as const;
3
3
  export const PRODUCT_ROUTES = {
4
4
  FIND_BY_UUID: 'by/uuid',
5
5
  GET_ALL: 'all',
6
+ BUY: `buy`,
6
7
  } as const;
@@ -3,4 +3,5 @@ export const SUBSCRIPTION_CONTROLLER = 'subscription' as const;
3
3
  export const SUBSCRIPTION_ROUTES = {
4
4
  FIND_BY_UUID: 'by/uuid',
5
5
  GET_ALL: 'all',
6
+ BUY: 'buy',
6
7
  } as const;
@@ -7,5 +7,6 @@ exports.CHAT_PRIVATE_ROUTES = {
7
7
  GET_BY_UUID: 'by/uuid',
8
8
  GET_MY: 'get/my',
9
9
  GET_LAST_ACTIVE_CHAT: `last-active-chat`,
10
+ GET_LIMIT: 'limit',
10
11
  CREATE_MESSAGE: (uuid) => `my/${uuid}/send`,
11
12
  };
@@ -5,4 +5,5 @@ exports.PRODUCT_CONTROLLER = 'product';
5
5
  exports.PRODUCT_ROUTES = {
6
6
  FIND_BY_UUID: 'by/uuid',
7
7
  GET_ALL: 'all',
8
+ BUY: `buy`,
8
9
  };
@@ -5,4 +5,5 @@ exports.SUBSCRIPTION_CONTROLLER = 'subscription';
5
5
  exports.SUBSCRIPTION_ROUTES = {
6
6
  FIND_BY_UUID: 'by/uuid',
7
7
  GET_ALL: 'all',
8
+ BUY: 'buy',
8
9
  };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckLimitCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var CheckLimitCommand;
6
+ (function (CheckLimitCommand) {
7
+ CheckLimitCommand.ResponseSchema = zod_1.z.object({
8
+ totalTokenBalance: zod_1.z.number(),
9
+ });
10
+ })(CheckLimitCommand || (exports.CheckLimitCommand = CheckLimitCommand = {}));
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuyProductCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var BuyProductCommand;
7
+ (function (BuyProductCommand) {
8
+ BuyProductCommand.RequestSchema = models_1.ProductSchema.pick({
9
+ uuid: true,
10
+ });
11
+ const IReceiptOrderSchema = zod_1.z.object({
12
+ items: zod_1.z.array(zod_1.z.object({
13
+ label: zod_1.z.string(),
14
+ price: zod_1.z.number(),
15
+ quantity: zod_1.z.number(),
16
+ amount: zod_1.z.number(),
17
+ vat: zod_1.z.number(),
18
+ })),
19
+ email: zod_1.z.string(),
20
+ isBso: zod_1.z.boolean(),
21
+ amounts: zod_1.z.object({
22
+ electronic: zod_1.z.number(),
23
+ }),
24
+ });
25
+ BuyProductCommand.ResponseSchema = zod_1.z.object({
26
+ publicId: zod_1.z.string(),
27
+ amount: zod_1.z.number(),
28
+ currency: zod_1.z.string(),
29
+ accountId: zod_1.z.string(),
30
+ description: zod_1.z.string(),
31
+ invoiceId: zod_1.z.string(),
32
+ email: zod_1.z.string(),
33
+ skin: zod_1.z.string(),
34
+ autoClose: zod_1.z.number(),
35
+ data: zod_1.z.object({
36
+ CloudPayments: zod_1.z.object({
37
+ CustomerReceipt: IReceiptOrderSchema,
38
+ }),
39
+ }),
40
+ });
41
+ })(BuyProductCommand || (exports.BuyProductCommand = BuyProductCommand = {}));
@@ -18,3 +18,4 @@ __exportStar(require("./update-product.command"), exports);
18
18
  __exportStar(require("./delete-product.command"), exports);
19
19
  __exportStar(require("./create-product.command"), exports);
20
20
  __exportStar(require("./find-product.command"), exports);
21
+ __exportStar(require("./buy-product.command"), exports);
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuySubscriptionCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ var BuySubscriptionCommand;
7
+ (function (BuySubscriptionCommand) {
8
+ BuySubscriptionCommand.RequestSchema = models_1.SubscriptionSchema.pick({
9
+ uuid: true,
10
+ });
11
+ const IReceiptOrderSchema = zod_1.z.object({
12
+ items: zod_1.z.array(zod_1.z.object({
13
+ label: zod_1.z.string(),
14
+ price: zod_1.z.number(),
15
+ quantity: zod_1.z.number(),
16
+ amount: zod_1.z.number(),
17
+ vat: zod_1.z.number(),
18
+ })),
19
+ email: zod_1.z.string(),
20
+ isBso: zod_1.z.boolean(),
21
+ amounts: zod_1.z.object({
22
+ electronic: zod_1.z.number(),
23
+ }),
24
+ });
25
+ BuySubscriptionCommand.ResponseSchema = zod_1.z.object({
26
+ publicId: zod_1.z.string(),
27
+ amount: zod_1.z.number(),
28
+ currency: zod_1.z.string(),
29
+ accountId: zod_1.z.string(),
30
+ description: zod_1.z.string(),
31
+ invoiceId: zod_1.z.string(),
32
+ email: zod_1.z.string(),
33
+ skin: zod_1.z.string(),
34
+ autoClose: zod_1.z.number(),
35
+ data: zod_1.z.object({
36
+ CloudPayments: zod_1.z.object({
37
+ CustomerReceipt: IReceiptOrderSchema,
38
+ recurrent: zod_1.z.object({
39
+ period: zod_1.z.number(),
40
+ interval: zod_1.z.string(),
41
+ customerReceipt: IReceiptOrderSchema,
42
+ }),
43
+ }),
44
+ }),
45
+ });
46
+ })(BuySubscriptionCommand || (exports.BuySubscriptionCommand = BuySubscriptionCommand = {}));
@@ -390,4 +390,14 @@ exports.ERRORS = {
390
390
  message: 'Пользователь не был обновлен',
391
391
  httpCode: 500,
392
392
  },
393
+ ORDER_PAYLOAD_CREATE_ERROR: {
394
+ code: 'A095',
395
+ message: 'Ордер payload не был создан',
396
+ httpCode: 500,
397
+ },
398
+ MESSAGE_GET_COUNT_ERROR: {
399
+ code: 'A096',
400
+ message: 'Не удалось получить количество сообщений',
401
+ httpCode: 500,
402
+ },
393
403
  };
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace CheckLimitCommand {
4
+ export const ResponseSchema = z.object({
5
+ totalTokenBalance: z.number(),
6
+ });
7
+ export type Response = z.infer<typeof ResponseSchema>;
8
+ }
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ import { ProductSchema } from '../../models';
3
+
4
+ export namespace BuyProductCommand {
5
+ export const RequestSchema = ProductSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ const IReceiptOrderSchema = z.object({
12
+ items: z.array(
13
+ z.object({
14
+ label: z.string(),
15
+ price: z.number(),
16
+ quantity: z.number(),
17
+ amount: z.number(),
18
+ vat: z.number(),
19
+ }),
20
+ ),
21
+ email: z.string(),
22
+ isBso: z.boolean(),
23
+ amounts: z.object({
24
+ electronic: z.number(),
25
+ }),
26
+ });
27
+
28
+ export const ResponseSchema = z.object({
29
+ publicId: z.string(),
30
+ amount: z.number(),
31
+ currency: z.string(),
32
+ accountId: z.string(),
33
+ description: z.string(),
34
+ invoiceId: z.string(),
35
+ email: z.string(),
36
+ skin: z.string(),
37
+ autoClose: z.number(),
38
+ data: z.object({
39
+ CloudPayments: z.object({
40
+ CustomerReceipt: IReceiptOrderSchema,
41
+ }),
42
+ }),
43
+ });
44
+
45
+ export type Response = z.infer<typeof ResponseSchema>;
46
+ }
@@ -2,3 +2,4 @@ export * from './update-product.command';
2
2
  export * from './delete-product.command';
3
3
  export * from './create-product.command';
4
4
  export * from './find-product.command';
5
+ export * from './buy-product.command';
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ import { SubscriptionSchema } from '../../models';
3
+
4
+ export namespace BuySubscriptionCommand {
5
+ export const RequestSchema = SubscriptionSchema.pick({
6
+ uuid: true,
7
+ });
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ const IReceiptOrderSchema = z.object({
12
+ items: z.array(
13
+ z.object({
14
+ label: z.string(),
15
+ price: z.number(),
16
+ quantity: z.number(),
17
+ amount: z.number(),
18
+ vat: z.number(),
19
+ }),
20
+ ),
21
+ email: z.string(),
22
+ isBso: z.boolean(),
23
+ amounts: z.object({
24
+ electronic: z.number(),
25
+ }),
26
+ });
27
+
28
+ export const ResponseSchema = z.object({
29
+ publicId: z.string(),
30
+ amount: z.number(),
31
+ currency: z.string(),
32
+ accountId: z.string(),
33
+ description: z.string(),
34
+ invoiceId: z.string(),
35
+ email: z.string(),
36
+ skin: z.string(),
37
+ autoClose: z.number(),
38
+ data: z.object({
39
+ CloudPayments: z.object({
40
+ CustomerReceipt: IReceiptOrderSchema,
41
+ recurrent: z.object({
42
+ period: z.number(),
43
+ interval: z.string(),
44
+ customerReceipt: IReceiptOrderSchema,
45
+ }),
46
+ }),
47
+ }),
48
+ });
49
+
50
+ export type Response = z.infer<typeof ResponseSchema>;
51
+ }
@@ -389,4 +389,14 @@ export const ERRORS = {
389
389
  message: 'Пользователь не был обновлен',
390
390
  httpCode: 500,
391
391
  },
392
+ ORDER_PAYLOAD_CREATE_ERROR: {
393
+ code: 'A095',
394
+ message: 'Ордер payload не был создан',
395
+ httpCode: 500,
396
+ },
397
+ MESSAGE_GET_COUNT_ERROR: {
398
+ code: 'A096',
399
+ message: 'Не удалось получить количество сообщений',
400
+ httpCode: 500,
401
+ },
392
402
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {