@purpleschool/gptbot 0.12.63 → 0.12.64

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.
@@ -6,10 +6,28 @@ const models_1 = require("../../models");
6
6
  const constants_1 = require("../../constants");
7
7
  var FindTeamAccountsByNameCommand;
8
8
  (function (FindTeamAccountsByNameCommand) {
9
+ const BooleanQuerySchema = zod_1.z
10
+ .union([zod_1.z.boolean(), zod_1.z.string().trim().toLowerCase()])
11
+ .transform((value, ctx) => {
12
+ if (typeof value === 'boolean') {
13
+ return value;
14
+ }
15
+ if (value === 'true') {
16
+ return true;
17
+ }
18
+ if (value === 'false') {
19
+ return false;
20
+ }
21
+ ctx.addIssue({
22
+ code: zod_1.z.ZodIssueCode.custom,
23
+ message: 'Expected boolean value: true or false',
24
+ });
25
+ return zod_1.z.NEVER;
26
+ });
9
27
  FindTeamAccountsByNameCommand.RequestSchema = zod_1.z.object({
10
28
  name: zod_1.z.string().trim().min(1).optional(),
11
29
  creatorEmail: zod_1.z.string().trim().min(1).optional(),
12
- hasPaidSubscription: zod_1.z.boolean().optional(),
30
+ hasPaidSubscription: BooleanQuerySchema.optional(),
13
31
  limit: zod_1.z.coerce.number().int().min(1).max(100).default(20).optional(),
14
32
  offset: zod_1.z.coerce.number().int().min(0).default(0).optional(),
15
33
  sortBy: zod_1.z
@@ -3,10 +3,33 @@ import { TeamAccountWithBalanceSchema } from '../../models';
3
3
  import { SORT_ORDER, TEAM_ACCOUNT_ADMIN_SORT_BY } from '../../constants';
4
4
 
5
5
  export namespace FindTeamAccountsByNameCommand {
6
+ const BooleanQuerySchema = z
7
+ .union([z.boolean(), z.string().trim().toLowerCase()])
8
+ .transform((value, ctx) => {
9
+ if (typeof value === 'boolean') {
10
+ return value;
11
+ }
12
+
13
+ if (value === 'true') {
14
+ return true;
15
+ }
16
+
17
+ if (value === 'false') {
18
+ return false;
19
+ }
20
+
21
+ ctx.addIssue({
22
+ code: z.ZodIssueCode.custom,
23
+ message: 'Expected boolean value: true or false',
24
+ });
25
+
26
+ return z.NEVER;
27
+ });
28
+
6
29
  export const RequestSchema = z.object({
7
30
  name: z.string().trim().min(1).optional(),
8
31
  creatorEmail: z.string().trim().min(1).optional(),
9
- hasPaidSubscription: z.boolean().optional(),
32
+ hasPaidSubscription: BooleanQuerySchema.optional(),
10
33
  limit: z.coerce.number().int().min(1).max(100).default(20).optional(),
11
34
  offset: z.coerce.number().int().min(0).default(0).optional(),
12
35
  sortBy: z
@@ -135,4 +135,4 @@ export function calculateGptImage2PriceInStarsByTier(params: {
135
135
  outputTokens,
136
136
  ...priced,
137
137
  };
138
- }
138
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpleschool/gptbot",
3
- "version": "0.12.63",
3
+ "version": "0.12.64",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",