@purpleschool/gptbot 0.5.8 → 0.5.14

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 (125) hide show
  1. package/api/controllers/index.ts +11 -8
  2. package/api/controllers/payment.ts +5 -0
  3. package/api/controllers/referral.ts +5 -0
  4. package/api/controllers/subscription.ts +3 -0
  5. package/build/api/controllers/index.js +11 -8
  6. package/build/api/controllers/payment.js +7 -0
  7. package/build/api/controllers/referral.js +7 -0
  8. package/build/api/controllers/subscription.js +3 -0
  9. package/build/commands/ai-model/index.js +2 -2
  10. package/build/commands/auth/index.js +4 -3
  11. package/build/commands/auth/register-user.command.js +3 -4
  12. package/build/commands/blog/index.js +2 -2
  13. package/build/commands/category/index.js +2 -2
  14. package/build/commands/chat/index.js +9 -8
  15. package/build/commands/index.js +8 -6
  16. package/build/commands/message/index.js +1 -1
  17. package/build/commands/page/index.js +3 -3
  18. package/build/commands/payment/get-payment-history.command.js +11 -0
  19. package/build/commands/payment/index.js +18 -0
  20. package/build/commands/product/buy-product.command.js +1 -0
  21. package/build/commands/product/index.js +3 -3
  22. package/build/commands/question/index.js +2 -2
  23. package/build/commands/referral/get-by-bonuses.command.js +15 -0
  24. package/build/commands/referral/index.js +17 -0
  25. package/build/commands/subscription/buy-subscription.command.js +1 -0
  26. package/build/commands/subscription/create-custom-subscription-plan.command.js +24 -0
  27. package/build/commands/subscription/find-subscription.command.js +1 -1
  28. package/build/commands/subscription/get-available-upgrades.command.js +13 -0
  29. package/build/commands/subscription/index.js +7 -3
  30. package/build/commands/subscription/upgrade-subscription.command.js +41 -0
  31. package/build/commands/user/index.js +1 -1
  32. package/build/constants/category/enums/index.js +1 -1
  33. package/build/constants/chat/enums/index.js +1 -1
  34. package/build/constants/domains/index.js +17 -0
  35. package/build/constants/email/index.js +18 -0
  36. package/build/constants/errors/errors.js +65 -0
  37. package/build/constants/index.js +13 -7
  38. package/build/constants/order/enums/index.js +1 -0
  39. package/build/constants/order/enums/order-type.enum.js +8 -0
  40. package/build/constants/payment/enums/index.js +1 -0
  41. package/build/constants/payment/enums/payment-history-item-type.enum.js +8 -0
  42. package/build/constants/referral/enums/index.js +17 -0
  43. package/build/constants/referral/enums/referral-bonus-type.enum.js +8 -0
  44. package/build/constants/referral/index.js +17 -0
  45. package/build/constants/subscription/enums/index.js +4 -0
  46. package/build/constants/subscription/enums/subscription-action.enum.js +10 -0
  47. package/build/constants/subscription/enums/subscription-plan.enum.js +8 -0
  48. package/build/constants/subscription/enums/subscription-status.enum.js +1 -0
  49. package/build/constants/subscription/enums/subscription-type.enum.js +8 -0
  50. package/build/constants/subscription/enums/user-to-subscription-type.enum.js +8 -0
  51. package/build/constants/transaction/enums/index.js +17 -0
  52. package/build/constants/transaction/enums/user-balance-status.enum.js +1 -0
  53. package/build/constants/transaction/index.js +17 -0
  54. package/build/constants/user/enums/index.js +17 -0
  55. package/build/constants/user/index.js +18 -0
  56. package/build/helpers/index.js +17 -0
  57. package/build/helpers/subscription/calc-custom-subscription-price.helper.js +19 -0
  58. package/build/helpers/subscription/index.js +17 -0
  59. package/build/index.js +3 -2
  60. package/build/models/index.js +11 -7
  61. package/build/models/message.schema.js +1 -1
  62. package/build/models/payment-history-item.schema.js +14 -0
  63. package/build/models/referral-bonus.schema.js +19 -0
  64. package/build/models/subscription-upgrade-schema.js +8 -0
  65. package/build/models/subscription.schema.js +14 -2
  66. package/build/models/user-to-subscription.schema.js +1 -0
  67. package/commands/ai-model/index.ts +2 -2
  68. package/commands/auth/index.ts +4 -3
  69. package/commands/auth/register-user.command.ts +6 -4
  70. package/commands/blog/index.ts +2 -2
  71. package/commands/category/index.ts +2 -2
  72. package/commands/chat/index.ts +9 -8
  73. package/commands/index.ts +8 -6
  74. package/commands/message/index.ts +1 -1
  75. package/commands/page/index.ts +3 -3
  76. package/commands/payment/get-payment-history.command.ts +10 -0
  77. package/commands/payment/index.ts +2 -0
  78. package/commands/product/buy-product.command.ts +1 -0
  79. package/commands/product/index.ts +3 -3
  80. package/commands/question/index.ts +2 -2
  81. package/commands/referral/get-by-bonuses.command.ts +14 -0
  82. package/commands/referral/index.ts +1 -0
  83. package/commands/subscription/buy-subscription.command.ts +1 -0
  84. package/commands/subscription/create-custom-subscription-plan.command.ts +26 -0
  85. package/commands/subscription/find-subscription.command.ts +2 -2
  86. package/commands/subscription/get-available-upgrades.command.ts +15 -0
  87. package/commands/subscription/index.ts +7 -3
  88. package/commands/subscription/upgrade-subscription.command.ts +46 -0
  89. package/commands/user/index.ts +1 -1
  90. package/constants/category/enums/index.ts +1 -1
  91. package/constants/chat/enums/index.ts +1 -1
  92. package/constants/domains/index.ts +1 -0
  93. package/constants/email/index.ts +2 -0
  94. package/constants/errors/errors.ts +65 -0
  95. package/constants/index.ts +13 -7
  96. package/constants/order/enums/index.ts +1 -0
  97. package/constants/order/enums/order-type.enum.ts +4 -0
  98. package/constants/payment/enums/index.ts +1 -0
  99. package/constants/payment/enums/payment-history-item-type.enum.ts +4 -0
  100. package/constants/referral/enums/index.ts +1 -0
  101. package/constants/referral/enums/referral-bonus-type.enum.ts +4 -0
  102. package/constants/referral/index.ts +1 -0
  103. package/constants/subscription/enums/index.ts +4 -0
  104. package/constants/subscription/enums/subscription-action.enum.ts +6 -0
  105. package/constants/subscription/enums/subscription-plan.enum.ts +4 -0
  106. package/constants/subscription/enums/subscription-status.enum.ts +1 -0
  107. package/constants/subscription/enums/subscription-type.enum.ts +4 -0
  108. package/constants/subscription/enums/user-to-subscription-type.enum.ts +4 -0
  109. package/constants/transaction/enums/index.ts +2 -0
  110. package/constants/transaction/enums/user-balance-status.enum.ts +1 -0
  111. package/constants/transaction/index.ts +1 -0
  112. package/constants/user/enums/index.ts +1 -0
  113. package/constants/user/index.ts +2 -0
  114. package/helpers/index.ts +1 -0
  115. package/helpers/subscription/calc-custom-subscription-price.helper.ts +19 -0
  116. package/helpers/subscription/index.ts +1 -0
  117. package/index.ts +3 -2
  118. package/models/index.ts +11 -7
  119. package/models/message.schema.ts +1 -1
  120. package/models/payment-history-item.schema.ts +12 -0
  121. package/models/referral-bonus.schema.ts +18 -0
  122. package/models/subscription-upgrade-schema.ts +9 -0
  123. package/models/subscription.schema.ts +21 -1
  124. package/models/user-to-subscription.schema.ts +1 -0
  125. package/package.json +1 -1
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./order-status.enum"), exports);
18
+ __exportStar(require("./order-type.enum"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ORDER_TYPE = void 0;
4
+ var ORDER_TYPE;
5
+ (function (ORDER_TYPE) {
6
+ ORDER_TYPE["purchase"] = "purchase";
7
+ ORDER_TYPE["upgrade"] = "upgrade";
8
+ })(ORDER_TYPE || (exports.ORDER_TYPE = ORDER_TYPE = {}));
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./payment-history-item-type.enum"), exports);
17
18
  __exportStar(require("./payment-status.enum"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PAYMENT_HISTORY_ITEM_TYPE = void 0;
4
+ var PAYMENT_HISTORY_ITEM_TYPE;
5
+ (function (PAYMENT_HISTORY_ITEM_TYPE) {
6
+ PAYMENT_HISTORY_ITEM_TYPE["SUBSCRIPTION"] = "subscription";
7
+ PAYMENT_HISTORY_ITEM_TYPE["PRODUCT"] = "product";
8
+ })(PAYMENT_HISTORY_ITEM_TYPE || (exports.PAYMENT_HISTORY_ITEM_TYPE = PAYMENT_HISTORY_ITEM_TYPE = {}));
@@ -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("./referral-bonus-type.enum"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReferralBonusType = void 0;
4
+ var ReferralBonusType;
5
+ (function (ReferralBonusType) {
6
+ ReferralBonusType["PARTNER"] = "partner";
7
+ ReferralBonusType["REFERRAL"] = "referral";
8
+ })(ReferralBonusType || (exports.ReferralBonusType = ReferralBonusType = {}));
@@ -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("./enums"), exports);
@@ -14,4 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./subscription-action.enum"), exports);
18
+ __exportStar(require("./subscription-plan.enum"), exports);
17
19
  __exportStar(require("./subscription-status.enum"), exports);
20
+ __exportStar(require("./subscription-type.enum"), exports);
21
+ __exportStar(require("./user-to-subscription-type.enum"), exports);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUBSCRIPTION_ACTION = void 0;
4
+ var SUBSCRIPTION_ACTION;
5
+ (function (SUBSCRIPTION_ACTION) {
6
+ SUBSCRIPTION_ACTION["disabled"] = "disabled";
7
+ SUBSCRIPTION_ACTION["buy"] = "buy";
8
+ SUBSCRIPTION_ACTION["upgrade"] = "upgrade";
9
+ SUBSCRIPTION_ACTION["possible_upgrade"] = "possible_upgrade";
10
+ })(SUBSCRIPTION_ACTION || (exports.SUBSCRIPTION_ACTION = SUBSCRIPTION_ACTION = {}));
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUBSCRIPTION_PLAN = void 0;
4
+ var SUBSCRIPTION_PLAN;
5
+ (function (SUBSCRIPTION_PLAN) {
6
+ SUBSCRIPTION_PLAN["system"] = "system";
7
+ SUBSCRIPTION_PLAN["custom"] = "custom";
8
+ })(SUBSCRIPTION_PLAN || (exports.SUBSCRIPTION_PLAN = SUBSCRIPTION_PLAN = {}));
@@ -6,4 +6,5 @@ var SUBSCRIPTION_STATUS;
6
6
  SUBSCRIPTION_STATUS["active"] = "active";
7
7
  SUBSCRIPTION_STATUS["canceled"] = "canceled";
8
8
  SUBSCRIPTION_STATUS["expired"] = "expired";
9
+ SUBSCRIPTION_STATUS["upgraded"] = "upgraded";
9
10
  })(SUBSCRIPTION_STATUS || (exports.SUBSCRIPTION_STATUS = SUBSCRIPTION_STATUS = {}));
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUBSCRIPTION_TYPE = void 0;
4
+ var SUBSCRIPTION_TYPE;
5
+ (function (SUBSCRIPTION_TYPE) {
6
+ SUBSCRIPTION_TYPE["main"] = "main";
7
+ SUBSCRIPTION_TYPE["sub"] = "sub";
8
+ })(SUBSCRIPTION_TYPE || (exports.SUBSCRIPTION_TYPE = SUBSCRIPTION_TYPE = {}));
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_TO_SUBSCRIPTION_TYPE = void 0;
4
+ var USER_TO_SUBSCRIPTION_TYPE;
5
+ (function (USER_TO_SUBSCRIPTION_TYPE) {
6
+ USER_TO_SUBSCRIPTION_TYPE["paid"] = "paid";
7
+ USER_TO_SUBSCRIPTION_TYPE["interval"] = "interval";
8
+ })(USER_TO_SUBSCRIPTION_TYPE || (exports.USER_TO_SUBSCRIPTION_TYPE = USER_TO_SUBSCRIPTION_TYPE = {}));
@@ -1 +1,18 @@
1
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("./transaction-status.enum"), exports);
18
+ __exportStar(require("./user-balance-status.enum"), exports);
@@ -6,4 +6,5 @@ var USER_BALANCE_STATUS;
6
6
  USER_BALANCE_STATUS["bonus_balance"] = "bonus_balance";
7
7
  USER_BALANCE_STATUS["subscription_balance"] = "subscription_balance";
8
8
  USER_BALANCE_STATUS["product_balance"] = "product_balance";
9
+ USER_BALANCE_STATUS["referral_bonus_balance"] = "referral_bonus_balance";
9
10
  })(USER_BALANCE_STATUS || (exports.USER_BALANCE_STATUS = USER_BALANCE_STATUS = {}));
@@ -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("./enums"), 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("./user-status"), exports);
@@ -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("./enums"), exports);
18
+ __exportStar(require("./user-public"), 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("./subscription"), exports);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calcCustomSubscriptionPrice = calcCustomSubscriptionPrice;
4
+ function calcCustomSubscriptionPrice(tokenCount, period) {
5
+ const MIN_TOKEN_COUNT = 1000;
6
+ const MAX_DISCOUNT = 0.85;
7
+ const DISCOUNT_PER_STEP = 0.005;
8
+ const STEP = 500;
9
+ const BASE_PRICE = 0.95;
10
+ if (tokenCount < 0) {
11
+ throw new Error('Token count must be a non-negative integer');
12
+ }
13
+ if (tokenCount < MIN_TOKEN_COUNT) {
14
+ throw new Error(`Token count must be at least ${MIN_TOKEN_COUNT}`);
15
+ }
16
+ const discount = Math.max(0, (tokenCount - MIN_TOKEN_COUNT) / STEP) * DISCOUNT_PER_STEP;
17
+ const priceMultiplier = Math.max(BASE_PRICE - discount, MAX_DISCOUNT);
18
+ return Math.round(tokenCount * priceMultiplier * period);
19
+ }
@@ -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("./calc-custom-subscription-price.helper"), exports);
package/build/index.js CHANGED
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./constants"), exports);
18
- __exportStar(require("./commands"), exports);
19
17
  __exportStar(require("./api"), exports);
18
+ __exportStar(require("./commands"), exports);
19
+ __exportStar(require("./constants"), exports);
20
+ __exportStar(require("./helpers"), exports);
20
21
  __exportStar(require("./models"), exports);
@@ -14,16 +14,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./user.schema"), exports);
18
- __exportStar(require("./page.schema"), exports);
17
+ __exportStar(require("./ai-model.schema"), exports);
19
18
  __exportStar(require("./category.schema"), exports);
20
- __exportStar(require("./question.schema"), exports);
21
- __exportStar(require("./unregistered-user.schema"), exports);
22
19
  __exportStar(require("./chat.schema"), exports);
23
20
  __exportStar(require("./message.schema"), exports);
24
- __exportStar(require("./ai-model.schema"), exports);
25
- __exportStar(require("./product.schema"), exports);
26
- __exportStar(require("./subscription.schema"), exports);
27
21
  __exportStar(require("./order.schema"), exports);
22
+ __exportStar(require("./page.schema"), exports);
23
+ __exportStar(require("./payment-history-item.schema"), exports);
24
+ __exportStar(require("./payment.schema"), exports);
28
25
  __exportStar(require("./post.schema"), exports);
26
+ __exportStar(require("./product.schema"), exports);
27
+ __exportStar(require("./question.schema"), exports);
28
+ __exportStar(require("./referral-bonus.schema"), exports);
29
+ __exportStar(require("./subscription-upgrade-schema"), exports);
30
+ __exportStar(require("./subscription.schema"), exports);
31
+ __exportStar(require("./unregistered-user.schema"), exports);
29
32
  __exportStar(require("./user-to-subscription.schema"), exports);
33
+ __exportStar(require("./user.schema"), exports);
@@ -5,7 +5,7 @@ const zod_1 = require("zod");
5
5
  const constants_1 = require("../constants");
6
6
  exports.MessageSchema = zod_1.z.object({
7
7
  uuid: zod_1.z.string().uuid(),
8
- text: zod_1.z.string(),
8
+ text: zod_1.z.string().max(10000),
9
9
  chatId: zod_1.z.nullable(zod_1.z.string().uuid()),
10
10
  role: zod_1.z.string(),
11
11
  tokenUsage: zod_1.z.number(),
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentHistoryItemSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../constants");
6
+ exports.PaymentHistoryItemSchema = zod_1.z.object({
7
+ uuid: zod_1.z.string().uuid(),
8
+ status: zod_1.z.nativeEnum(constants_1.PAYMENT_STATUS),
9
+ sum: zod_1.z.number(),
10
+ description: zod_1.z.string(),
11
+ type: zod_1.z.nativeEnum(constants_1.PAYMENT_HISTORY_ITEM_TYPE),
12
+ createdAt: zod_1.z.date(),
13
+ updatedAt: zod_1.z.date(),
14
+ });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReferralBonusStatisticsSchema = exports.ReferralBonusSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const referral_1 = require("../constants/referral");
6
+ exports.ReferralBonusSchema = zod_1.z.object({
7
+ uuid: zod_1.z.string().uuid(),
8
+ partnerId: zod_1.z.string().uuid(),
9
+ referralId: zod_1.z.string().uuid(),
10
+ initial: zod_1.z.number(),
11
+ total: zod_1.z.number(),
12
+ type: zod_1.z.nativeEnum(referral_1.ReferralBonusType),
13
+ createdAt: zod_1.z.date(),
14
+ updatedAt: zod_1.z.date(),
15
+ });
16
+ exports.ReferralBonusStatisticsSchema = zod_1.z.object({
17
+ initial: zod_1.z.number(),
18
+ weekStart: zod_1.z.date(),
19
+ });
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubscriptionUpgradeSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const subscription_schema_1 = require("./subscription.schema");
6
+ exports.SubscriptionUpgradeSchema = zod_1.z.intersection(subscription_schema_1.SubscriptionSchema, zod_1.z.object({
7
+ upgradePrice: zod_1.z.number(),
8
+ }));
@@ -1,15 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubscriptionSchema = void 0;
3
+ exports.SubscriptionWithSubTypesSchema = exports.SubscriptionWithActionSchema = exports.SubscriptionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const product_schema_1 = require("./product.schema");
6
+ const constants_1 = require("../constants");
6
7
  exports.SubscriptionSchema = zod_1.z.object({
7
8
  uuid: zod_1.z.string().uuid(),
9
+ mainSubscriptionId: zod_1.z.nullable(zod_1.z.string().uuid()),
8
10
  name: zod_1.z.string().min(3).max(16384),
9
11
  requests: zod_1.z.number(),
10
12
  price: zod_1.z.number(),
11
13
  features: zod_1.z.array(product_schema_1.FeaturesSchema),
12
- lengthInDays: zod_1.z.number(),
14
+ plan: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_PLAN),
15
+ type: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_TYPE),
16
+ discount: zod_1.z.number(),
17
+ period: zod_1.z.number(),
18
+ tokens: zod_1.z.number(),
13
19
  createdAt: zod_1.z.date(),
14
20
  updatedAt: zod_1.z.date(),
15
21
  });
22
+ exports.SubscriptionWithActionSchema = zod_1.z.intersection(exports.SubscriptionSchema, zod_1.z.object({
23
+ action: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_ACTION),
24
+ }));
25
+ exports.SubscriptionWithSubTypesSchema = zod_1.z.intersection(exports.SubscriptionWithActionSchema, zod_1.z.object({
26
+ subTypes: zod_1.z.array(exports.SubscriptionWithActionSchema),
27
+ }));
@@ -11,6 +11,7 @@ exports.UserToSubscriptionSchema = zod_1.z.object({
11
11
  tokenBalance: zod_1.z.number(),
12
12
  status: zod_1.z.string(),
13
13
  endDate: zod_1.z.date().nullable(),
14
+ intervalEndDate: zod_1.z.date().nullable(),
14
15
  createdAt: zod_1.z.date(),
15
16
  updatedAt: zod_1.z.date(),
16
17
  });
@@ -1,4 +1,4 @@
1
- export * from './update-ai-model.command';
2
- export * from './delete-ai-model.command';
3
1
  export * from './create-ai-model.command';
2
+ export * from './delete-ai-model.command';
4
3
  export * from './find-ai-model.command';
4
+ export * from './update-ai-model.command';
@@ -1,6 +1,7 @@
1
- export * from './reset-password.command';
2
- export * from './restore-password.command';
1
+ export * from './create-user.command';
3
2
  export * from './login.command';
4
3
  export * from './register-user.command';
5
- export * from './create-user.command';
4
+ export * from './reset-password.command';
5
+ export * from './restore-password.command';
6
+ export * from './verify-email-retry.command';
6
7
  export * from './verify-email.command';
@@ -2,10 +2,12 @@ import { UserSchema } from '../../models';
2
2
  import { z } from 'zod';
3
3
 
4
4
  export namespace RegisterUserCommand {
5
- export const RequestSchema = UserSchema.pick({
6
- email: true,
7
- password: true,
8
- });
5
+ export const RequestSchema = z.intersection(
6
+ UserSchema.pick({ email: true, password: true }),
7
+ z.object({
8
+ partnerId: z.string().uuid().optional(),
9
+ }),
10
+ );
9
11
 
10
12
  export type Request = z.infer<typeof RequestSchema>;
11
13
 
@@ -1,6 +1,6 @@
1
1
  export * from './create-post.command';
2
- export * from './update-post.command';
3
2
  export * from './delete-post.command';
4
- export * from './find-post-by-uuid.command';
5
3
  export * from './find-post-by-alias.command';
4
+ export * from './find-post-by-uuid.command';
6
5
  export * from './find-post.command';
6
+ export * from './update-post.command';
@@ -1,4 +1,4 @@
1
- export * from './update-category.command';
2
- export * from './delete-category.command';
3
1
  export * from './create-category.command';
2
+ export * from './delete-category.command';
4
3
  export * from './find-category.command';
4
+ export * from './update-category.command';
@@ -1,12 +1,13 @@
1
- export * from './update-chat.command';
2
- export * from './delete-chat.command';
3
- export * from './create-chat.command';
4
- export * from './find-chat.command';
5
- export * from './get-my-last-active-chat.command';
1
+ export * from './archive-all.command';
6
2
  export * from './check-limit.command';
7
3
  export * from './check-limit.command.v2';
8
- export * from './get-my-last-active-chat-command.v2';
4
+ export * from './create-chat.command';
9
5
  export * from './create-chat.command.v2';
10
- export * from './find-chat-by-uuid.command';
11
- export * from './archive-all.command';
6
+ export * from './delete-chat.command';
12
7
  export * from './delete-chat.command.v2';
8
+ export * from './find-chat-by-uuid.command';
9
+ export * from './find-chat.command';
10
+ export * from './find-chats.command';
11
+ export * from './get-my-last-active-chat-command.v2';
12
+ export * from './get-my-last-active-chat.command';
13
+ export * from './update-chat.command';
package/commands/index.ts CHANGED
@@ -1,13 +1,15 @@
1
+ export * from './ai-model';
1
2
  export * from './auth';
2
- export * from './user';
3
- export * from './page';
3
+ export * from './blog';
4
4
  export * from './category';
5
- export * from './question';
6
- export * from './unregistered-user';
7
- export * from './ai-model';
8
5
  export * from './chat';
9
6
  export * from './message';
7
+ export * from './page';
8
+ export * from './payment';
10
9
  export * from './product';
10
+ export * from './question';
11
+ export * from './referral';
11
12
  export * from './subscription';
12
- export * from './blog';
13
+ export * from './unregistered-user';
14
+ export * from './user';
13
15
  export * from './user-to-subscription';
@@ -1,4 +1,4 @@
1
+ export * from './create-image-message.command';
1
2
  export * from './create-message.command';
2
3
  export * from './create-text-message.command';
3
- export * from './create-image-message.command';
4
4
  export * from './rate-message.command';
@@ -1,5 +1,5 @@
1
- export * from './update-page.command';
2
- export * from './delete-page.command';
3
1
  export * from './create-page.command';
4
- export * from './find-page.command';
2
+ export * from './delete-page.command';
5
3
  export * from './find-page-by-alias.command';
4
+ export * from './find-page.command';
5
+ export * from './update-page.command';
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { PaymentHistoryItemSchema } from '../../models/payment-history-item.schema';
3
+
4
+ export namespace GetPaymentHistoryCommand {
5
+ export const ResponseSchema = z.object({
6
+ data: z.array(PaymentHistoryItemSchema),
7
+ });
8
+
9
+ export type Response = z.infer<typeof ResponseSchema>;
10
+ }
@@ -0,0 +1,2 @@
1
+ export * from './get-payment-history.command';
2
+ export * from './pay.command';
@@ -33,6 +33,7 @@ export namespace BuyProductCommand {
33
33
 
34
34
  export const RequestFastSchema = z.object({
35
35
  email: z.string().email(),
36
+ partnerId: z.string().uuid().optional(),
36
37
  });
37
38
 
38
39
  export type RequestFast = z.infer<typeof RequestFastSchema>;
@@ -1,5 +1,5 @@
1
- export * from './update-product.command';
2
- export * from './delete-product.command';
1
+ export * from './buy-product.command';
3
2
  export * from './create-product.command';
3
+ export * from './delete-product.command';
4
4
  export * from './find-product.command';
5
- export * from './buy-product.command';
5
+ export * from './update-product.command';
@@ -1,4 +1,4 @@
1
- export * from './update-question.command';
2
- export * from './delete-question.command';
3
1
  export * from './create-question.command';
2
+ export * from './delete-question.command';
4
3
  export * from './find-question.command';
4
+ export * from './update-question.command';
@@ -0,0 +1,14 @@
1
+ import { ReferralBonusStatisticsSchema } from '../../models';
2
+ import { z } from 'zod';
3
+
4
+ export namespace GetMyBonusesCommand {
5
+ export const ResponseSchema = z.object({
6
+ data: z.object({
7
+ sumTotal: z.number(),
8
+ sumInitial: z.number(),
9
+ statistics: z.array(ReferralBonusStatisticsSchema),
10
+ }),
11
+ });
12
+
13
+ export type Response = z.infer<typeof ResponseSchema>;
14
+ }
@@ -0,0 +1 @@
1
+ export * from './get-by-bonuses.command';
@@ -13,6 +13,7 @@ export namespace BuySubscriptionCommand {
13
13
  export type Request = z.infer<typeof RequestSchema>;
14
14
  export const RequestFastSchema = z.object({
15
15
  email: z.string().email(),
16
+ partnerId: z.string().uuid().optional(),
16
17
  });
17
18
 
18
19
  export type RequestFast = z.infer<typeof RequestFastSchema>;