@jlandis1/guessphrase-shared 1.0.20 → 1.0.22

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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export type { ZodTypeAny } from 'zod';
2
2
  export { usernameSchema, registerSchema, loginSchema, tokenSchema, emailSchema, resetPasswordSchema } from './src/auth.js';
3
3
  export type { TUsernameSchema, TRegisterSchema, TLoginSchema, TTokenSchema, TEmailSchema, TResetPasswordSchema } from './src/auth.js';
4
- export type { TDateData } from './src/date.js';
5
4
  export { dateSchema, dateUserSchema, phraseIdSchema, submitPhraseAttemptSchema, createPhraseSchema, updatePhraseSchema, globalPhraseSchema, userPhraseSchema, wordsSchema } from './src/phrase.js';
6
5
  export type { TDateSchema, TDateUserSchema, TPhraseIdSchema, TSubmitPhraseAttemptSchema, TCreatePhraseSchema, TUpdatePhraseSchema, TGlobalPhraseSchema, TUserPhraseSchema, TWordsSchema } from './src/phrase.js';
@@ -28,7 +28,7 @@ export declare const phraseIdSchema: z.ZodObject<{
28
28
  export type TPhraseIdSchema = z.infer<typeof phraseIdSchema>;
29
29
  export declare const submitPhraseAttemptSchema: z.ZodObject<{
30
30
  phrase_id: z.ZodNumber;
31
- phrase: z.ZodString;
31
+ phrase: z.ZodEffects<z.ZodString, string, string>;
32
32
  }, "strip", z.ZodTypeAny, {
33
33
  phrase_id: number;
34
34
  phrase: string;
@@ -38,22 +38,25 @@ export declare const submitPhraseAttemptSchema: z.ZodObject<{
38
38
  }>;
39
39
  export type TSubmitPhraseAttemptSchema = z.infer<typeof submitPhraseAttemptSchema>;
40
40
  export declare const createPhraseSchema: z.ZodObject<{
41
- phrase: z.ZodString;
41
+ phrase: z.ZodEffects<z.ZodString, string, string>;
42
42
  hint: z.ZodNullable<z.ZodString>;
43
43
  date: z.ZodString;
44
+ to_user: z.ZodString;
44
45
  }, "strip", z.ZodTypeAny, {
45
46
  date: string;
46
47
  phrase: string;
47
48
  hint: string | null;
49
+ to_user: string;
48
50
  }, {
49
51
  date: string;
50
52
  phrase: string;
51
53
  hint: string | null;
54
+ to_user: string;
52
55
  }>;
53
56
  export type TCreatePhraseSchema = z.infer<typeof createPhraseSchema>;
54
57
  export declare const updatePhraseSchema: z.ZodObject<{
55
58
  phrase_id: z.ZodNumber;
56
- phrase: z.ZodString;
59
+ phrase: z.ZodEffects<z.ZodString, string, string>;
57
60
  hint: z.ZodNullable<z.ZodString>;
58
61
  }, "strip", z.ZodTypeAny, {
59
62
  phrase_id: number;
@@ -67,7 +70,7 @@ export declare const updatePhraseSchema: z.ZodObject<{
67
70
  export type TUpdatePhraseSchema = z.infer<typeof updatePhraseSchema>;
68
71
  export declare const globalPhraseSchema: z.ZodObject<{
69
72
  phrase_id: z.ZodNumber;
70
- phrase: z.ZodString;
73
+ phrase: z.ZodEffects<z.ZodString, string, string>;
71
74
  hint: z.ZodNullable<z.ZodString>;
72
75
  date: z.ZodString;
73
76
  }, "strip", z.ZodTypeAny, {
@@ -84,7 +87,7 @@ export declare const globalPhraseSchema: z.ZodObject<{
84
87
  export type TGlobalPhraseSchema = z.infer<typeof globalPhraseSchema>;
85
88
  export declare const userPhraseSchema: z.ZodObject<{
86
89
  phrase_id: z.ZodNumber;
87
- phrase: z.ZodString;
90
+ phrase: z.ZodEffects<z.ZodString, string, string>;
88
91
  hint: z.ZodNullable<z.ZodString>;
89
92
  date: z.ZodString;
90
93
  from_user: z.ZodString;
@@ -94,15 +97,15 @@ export declare const userPhraseSchema: z.ZodObject<{
94
97
  phrase_id: number;
95
98
  phrase: string;
96
99
  hint: string | null;
97
- from_user: string;
98
100
  to_user: string;
101
+ from_user: string;
99
102
  }, {
100
103
  date: string;
101
104
  phrase_id: number;
102
105
  phrase: string;
103
106
  hint: string | null;
104
- from_user: string;
105
107
  to_user: string;
108
+ from_user: string;
106
109
  }>;
107
110
  export type TUserPhraseSchema = z.infer<typeof userPhraseSchema>;
108
111
  export declare const wordsSchema: z.ZodObject<{
@@ -1,7 +1,11 @@
1
1
  import { z } from 'zod';
2
2
  import { username } from './auth.js';
3
3
  const phrase_id = z.coerce.number();
4
- const phrase = z.string().min(1, 'Phrase is required').max(255, 'Phrase cannot be more than 255 characters');
4
+ const phrase = z
5
+ .string()
6
+ .min(1, 'Phrase is required')
7
+ .max(255, 'Phrase cannot be more than 255 characters')
8
+ .transform((val) => val.toLowerCase());
5
9
  const hint = z.string().max(255, 'Hint cannot be more than 255 characters').nullable();
6
10
  const date = z.string().regex(/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/, {
7
11
  message: 'Date must be in format YYYY-MM-DD'
@@ -31,7 +35,8 @@ export const submitPhraseAttemptSchema = z.object({
31
35
  export const createPhraseSchema = z.object({
32
36
  phrase: phrase,
33
37
  hint: hint,
34
- date: date
38
+ date: date,
39
+ to_user: username
35
40
  });
36
41
  // ----------------------------------------------------------------------
37
42
  export const updatePhraseSchema = z.object({
@@ -1 +1 @@
1
- {"root":["../index.ts","../src/auth.ts","../src/date.ts","../src/phrase.ts"],"version":"5.9.2"}
1
+ {"root":["../index.ts","../src/auth.ts","../src/phrase.ts"],"version":"5.9.2"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jlandis1/guessphrase-shared",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "type": "module",
5
5
  "description": "Shared library between Frontend and Backend for GuessPhrase",
6
6
  "main": "dist/index.js",
@@ -1,4 +0,0 @@
1
- export type TDateData = {
2
- date: string;
3
- status: 'SOLVED' | 'ATTEMPTED';
4
- };
package/dist/src/date.js DELETED
@@ -1 +0,0 @@
1
- export {};