@purpleschool/gptbot 0.10.2 → 0.10.4

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,6 +5,7 @@ export const TEAM_ACCOUNT_ROUTES = {
5
5
  UPDATE_ME: 'me',
6
6
  UPDATE_MEMBER: 'members',
7
7
  INVITE_MEMBER: 'invite',
8
+ REVOKE_INVITE: 'invite/revoke',
8
9
  REMOVE_MEMBER: 'members/remove',
9
10
  ACCEPT_INVITE: 'invite/accept',
10
11
  GET_ME: 'me',
package/api/routes.ts CHANGED
@@ -188,6 +188,7 @@ export const REST_API = {
188
188
  UPDATE_ME: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.UPDATE_ME}`,
189
189
  UPDATE_MEMBER: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.UPDATE_MEMBER}`,
190
190
  INVITE_MEMBER: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.INVITE_MEMBER}`,
191
+ REVOKE_INVITE: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.REVOKE_INVITE}`,
191
192
  REMOVE_MEMBER: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.REMOVE_MEMBER}`,
192
193
  ACCEPT_INVITE: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ACCEPT_INVITE}`,
193
194
  GET_ME: `${ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_ME}`,
@@ -7,6 +7,7 @@ exports.TEAM_ACCOUNT_ROUTES = {
7
7
  UPDATE_ME: 'me',
8
8
  UPDATE_MEMBER: 'members',
9
9
  INVITE_MEMBER: 'invite',
10
+ REVOKE_INVITE: 'invite/revoke',
10
11
  REMOVE_MEMBER: 'members/remove',
11
12
  ACCEPT_INVITE: 'invite/accept',
12
13
  GET_ME: 'me',
@@ -187,6 +187,7 @@ exports.REST_API = {
187
187
  UPDATE_ME: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.UPDATE_ME}`,
188
188
  UPDATE_MEMBER: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.UPDATE_MEMBER}`,
189
189
  INVITE_MEMBER: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.INVITE_MEMBER}`,
190
+ REVOKE_INVITE: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.REVOKE_INVITE}`,
190
191
  REMOVE_MEMBER: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.REMOVE_MEMBER}`,
191
192
  ACCEPT_INVITE: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.ACCEPT_INVITE}`,
192
193
  GET_ME: `${exports.ROOT}/${CONTROLLERS.TEAM_ACCOUNT_CONTROLLER}/${CONTROLLERS.TEAM_ACCOUNT_ROUTES.GET_ME}`,
@@ -19,6 +19,7 @@ __exportStar(require("./update-team-account.command"), exports);
19
19
  __exportStar(require("./invite-team-account-member.command"), exports);
20
20
  __exportStar(require("./accept-team-account-invite.command"), exports);
21
21
  __exportStar(require("./remove-team-account-member.command"), exports);
22
+ __exportStar(require("./revoke-team-account-invite.command"), exports);
22
23
  __exportStar(require("./update-team-account-member.command"), exports);
23
24
  __exportStar(require("./get-my-team-account.command"), exports);
24
25
  __exportStar(require("./find-team-account-members.command"), exports);
@@ -3,15 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InviteTeamAccountMemberCommand = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const models_1 = require("../../models");
6
- const constants_1 = require("../../constants");
7
6
  var InviteTeamAccountMemberCommand;
8
7
  (function (InviteTeamAccountMemberCommand) {
9
8
  InviteTeamAccountMemberCommand.RequestSchema = zod_1.z.object({
10
- email: zod_1.z.string().email(),
11
- role: zod_1.z.enum([constants_1.TEAM_ACCOUNT_MEMBER_ROLE.ADMIN, constants_1.TEAM_ACCOUNT_MEMBER_ROLE.MEMBER]).optional(),
12
- tokenLimit: zod_1.z.number().int().positive().optional(),
9
+ emails: zod_1.z
10
+ .array(zod_1.z.string().email())
11
+ .min(1)
12
+ .refine((emails) => new Set(emails.map((email) => email.toLowerCase())).size === emails.length, {
13
+ message: 'Emails must be unique (case-insensitive)',
14
+ }),
13
15
  });
14
16
  InviteTeamAccountMemberCommand.ResponseSchema = zod_1.z.object({
15
- data: models_1.TeamAccountInviteSchema,
17
+ data: zod_1.z.array(models_1.TeamAccountInviteSchema),
16
18
  });
17
19
  })(InviteTeamAccountMemberCommand || (exports.InviteTeamAccountMemberCommand = InviteTeamAccountMemberCommand = {}));
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RevokeTeamAccountInviteCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ var RevokeTeamAccountInviteCommand;
6
+ (function (RevokeTeamAccountInviteCommand) {
7
+ RevokeTeamAccountInviteCommand.RequestSchema = zod_1.z.object({
8
+ email: zod_1.z.string().email(),
9
+ });
10
+ RevokeTeamAccountInviteCommand.ResponseSchema = zod_1.z.object({
11
+ data: zod_1.z.object({
12
+ revoked: zod_1.z.boolean(),
13
+ }),
14
+ });
15
+ })(RevokeTeamAccountInviteCommand || (exports.RevokeTeamAccountInviteCommand = RevokeTeamAccountInviteCommand = {}));
@@ -18,3 +18,4 @@ __exportStar(require("./team-account-invite-status.enum"), exports);
18
18
  __exportStar(require("./team-account-member-role.enum"), exports);
19
19
  __exportStar(require("./team-account-member-status.enum"), exports);
20
20
  __exportStar(require("./team-account-operation-type.enum"), exports);
21
+ __exportStar(require("./team-subscription-feature-key.enum"), exports);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TEAM_SUBSCRIPTION_FEATURE_KEY = void 0;
4
+ var TEAM_SUBSCRIPTION_FEATURE_KEY;
5
+ (function (TEAM_SUBSCRIPTION_FEATURE_KEY) {
6
+ TEAM_SUBSCRIPTION_FEATURE_KEY["TOKENS"] = "tokens";
7
+ TEAM_SUBSCRIPTION_FEATURE_KEY["MAX_TEAM_MEMBERS"] = "max_team_members";
8
+ TEAM_SUBSCRIPTION_FEATURE_KEY["CARRYOVER_PERCENT"] = "carryover_percent";
9
+ TEAM_SUBSCRIPTION_FEATURE_KEY["ALL_MODELS_ACCESS"] = "all_models_access";
10
+ })(TEAM_SUBSCRIPTION_FEATURE_KEY || (exports.TEAM_SUBSCRIPTION_FEATURE_KEY = TEAM_SUBSCRIPTION_FEATURE_KEY = {}));
@@ -45,6 +45,7 @@ __exportStar(require("./question.schema"), exports);
45
45
  __exportStar(require("./referral-bonus.schema"), exports);
46
46
  __exportStar(require("./section.schema"), exports);
47
47
  __exportStar(require("./subscription-feature.schema"), exports);
48
+ __exportStar(require("./team-subscription-feature.schema"), exports);
48
49
  __exportStar(require("./subscription-upgrade-schema"), exports);
49
50
  __exportStar(require("./subscription.schema"), exports);
50
51
  __exportStar(require("./telegram-user-data.schema"), exports);
@@ -4,6 +4,7 @@ exports.SubscriptionWithFeaturesSchema = exports.SubscriptionWithSubTypesSchema
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../constants");
6
6
  const subscription_feature_schema_1 = require("./subscription-feature.schema");
7
+ const team_subscription_feature_schema_1 = require("./team-subscription-feature.schema");
7
8
  exports.SubscriptionSchema = zod_1.z.object({
8
9
  uuid: zod_1.z.string().uuid(),
9
10
  mainSubscriptionId: zod_1.z.nullable(zod_1.z.string().uuid()),
@@ -29,6 +30,7 @@ exports.SubscriptionSchema = zod_1.z.object({
29
30
  }),
30
31
  action: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_ACTION).optional().nullable(),
31
32
  features: zod_1.z.array(subscription_feature_schema_1.SubscriptionFeatureSchema),
33
+ teamFeatures: zod_1.z.array(team_subscription_feature_schema_1.TeamSubscriptionFeatureSchema).default([]),
32
34
  maxInputLength: zod_1.z.number(),
33
35
  maxInputTokens: zod_1.z.number(),
34
36
  carryoverPercent: zod_1.z.number(),
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TeamSubscriptionFeatureSchema = void 0;
4
+ const constants_1 = require("../constants");
5
+ const zod_1 = require("zod");
6
+ const icon_variants_schema_1 = require("./icon-variants.schema");
7
+ exports.TeamSubscriptionFeatureSchema = zod_1.z.object({
8
+ key: zod_1.z.nativeEnum(constants_1.TEAM_SUBSCRIPTION_FEATURE_KEY),
9
+ title: zod_1.z.string().min(1),
10
+ value: zod_1.z.union([zod_1.z.boolean(), zod_1.z.number(), zod_1.z.string()]),
11
+ icon: icon_variants_schema_1.IconVariantsSchema,
12
+ order: zod_1.z.number().int().nonnegative().default(0),
13
+ });
@@ -3,6 +3,7 @@ export * from './update-team-account.command';
3
3
  export * from './invite-team-account-member.command';
4
4
  export * from './accept-team-account-invite.command';
5
5
  export * from './remove-team-account-member.command';
6
+ export * from './revoke-team-account-invite.command';
6
7
  export * from './update-team-account-member.command';
7
8
  export * from './get-my-team-account.command';
8
9
  export * from './find-team-account-members.command';
@@ -1,18 +1,23 @@
1
1
  import { z } from 'zod';
2
2
  import { TeamAccountInviteSchema } from '../../models';
3
- import { TEAM_ACCOUNT_MEMBER_ROLE } from '../../constants';
4
3
 
5
4
  export namespace InviteTeamAccountMemberCommand {
6
5
  export const RequestSchema = z.object({
7
- email: z.string().email(),
8
- role: z.enum([TEAM_ACCOUNT_MEMBER_ROLE.ADMIN, TEAM_ACCOUNT_MEMBER_ROLE.MEMBER]).optional(),
9
- tokenLimit: z.number().int().positive().optional(),
6
+ emails: z
7
+ .array(z.string().email())
8
+ .min(1)
9
+ .refine(
10
+ (emails) => new Set(emails.map((email) => email.toLowerCase())).size === emails.length,
11
+ {
12
+ message: 'Emails must be unique (case-insensitive)',
13
+ },
14
+ ),
10
15
  });
11
16
 
12
17
  export type Request = z.infer<typeof RequestSchema>;
13
18
 
14
19
  export const ResponseSchema = z.object({
15
- data: TeamAccountInviteSchema,
20
+ data: z.array(TeamAccountInviteSchema),
16
21
  });
17
22
 
18
23
  export type Response = z.infer<typeof ResponseSchema>;
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+
3
+ export namespace RevokeTeamAccountInviteCommand {
4
+ export const RequestSchema = z.object({
5
+ email: z.string().email(),
6
+ });
7
+
8
+ export type Request = z.infer<typeof RequestSchema>;
9
+
10
+ export const ResponseSchema = z.object({
11
+ data: z.object({
12
+ revoked: z.boolean(),
13
+ }),
14
+ });
15
+
16
+ export type Response = z.infer<typeof ResponseSchema>;
17
+ }
@@ -2,3 +2,4 @@ export * from './team-account-invite-status.enum';
2
2
  export * from './team-account-member-role.enum';
3
3
  export * from './team-account-member-status.enum';
4
4
  export * from './team-account-operation-type.enum';
5
+ export * from './team-subscription-feature-key.enum';
@@ -0,0 +1,6 @@
1
+ export enum TEAM_SUBSCRIPTION_FEATURE_KEY {
2
+ TOKENS = 'tokens',
3
+ MAX_TEAM_MEMBERS = 'max_team_members',
4
+ CARRYOVER_PERCENT = 'carryover_percent',
5
+ ALL_MODELS_ACCESS = 'all_models_access',
6
+ }
package/models/index.ts CHANGED
@@ -29,6 +29,7 @@ export * from './question.schema';
29
29
  export * from './referral-bonus.schema';
30
30
  export * from './section.schema';
31
31
  export * from './subscription-feature.schema';
32
+ export * from './team-subscription-feature.schema';
32
33
  export * from './subscription-upgrade-schema';
33
34
  export * from './subscription.schema';
34
35
  export * from './telegram-user-data.schema';
@@ -6,6 +6,7 @@ import {
6
6
  SUBSCRIPTION_TYPE,
7
7
  } from '../constants';
8
8
  import { SubscriptionFeatureSchema } from './subscription-feature.schema';
9
+ import { TeamSubscriptionFeatureSchema } from './team-subscription-feature.schema';
9
10
 
10
11
  export const SubscriptionSchema = z.object({
11
12
  uuid: z.string().uuid(),
@@ -32,6 +33,7 @@ export const SubscriptionSchema = z.object({
32
33
  }),
33
34
  action: z.nativeEnum(SUBSCRIPTION_ACTION).optional().nullable(),
34
35
  features: z.array(SubscriptionFeatureSchema),
36
+ teamFeatures: z.array(TeamSubscriptionFeatureSchema).default([]),
35
37
  maxInputLength: z.number(),
36
38
  maxInputTokens: z.number(),
37
39
  carryoverPercent: z.number(),
@@ -0,0 +1,13 @@
1
+ import { TEAM_SUBSCRIPTION_FEATURE_KEY } from '../constants';
2
+ import { z } from 'zod';
3
+ import { IconVariantsSchema } from './icon-variants.schema';
4
+
5
+ export const TeamSubscriptionFeatureSchema = z.object({
6
+ key: z.nativeEnum(TEAM_SUBSCRIPTION_FEATURE_KEY),
7
+ title: z.string().min(1),
8
+ value: z.union([z.boolean(), z.number(), z.string()]),
9
+ icon: IconVariantsSchema,
10
+ order: z.number().int().nonnegative().default(0),
11
+ });
12
+
13
+ export type TeamSubscriptionFeature = z.infer<typeof TeamSubscriptionFeatureSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",