@jlandis1/guessphrase-shared 1.0.9 → 1.0.11

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/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  Contains types and Zod schemas used in both frontend and backend applications.
4
4
 
5
5
  ### Workflow when updating package:
6
+ - Commit changes
6
7
  - Increment version number in **package.json** by running ```npm version patch```
7
8
  - Push changes to Github - Github Actions will automatically publish the package
8
9
  - Install the latest version of the package in other repositories by running ```npm install @jlandis1/guessphrase-shared@latest```
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { ZodTypeAny } from 'zod';
2
2
  import { TRegisterSchema, TLoginSchema } from './src/auth.js';
3
+ import { TPhraseSchema } from './src/phrase.js';
3
4
  export { registerSchema, loginSchema } from './src/auth.js';
4
5
  export type { ZodTypeAny };
5
6
  export type { TRegisterSchema, TLoginSchema };
7
+ export type { TPhraseSchema };
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ export declare const phraseSchema: z.ZodObject<{
3
+ phrase_id: z.ZodNumber;
4
+ phrase: z.ZodString;
5
+ hint: z.ZodNullable<z.ZodString>;
6
+ date: z.ZodString;
7
+ from_user: z.ZodNullable<z.ZodString>;
8
+ to_user: z.ZodNullable<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ phrase_id: number;
11
+ phrase: string;
12
+ hint: string | null;
13
+ date: string;
14
+ from_user: string | null;
15
+ to_user: string | null;
16
+ }, {
17
+ phrase_id: number;
18
+ phrase: string;
19
+ hint: string | null;
20
+ date: string;
21
+ from_user: string | null;
22
+ to_user: string | null;
23
+ }>;
24
+ export type TPhraseSchema = z.infer<typeof phraseSchema>;
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export const phraseSchema = z.object({
3
+ phrase_id: z.number(),
4
+ phrase: z.string().min(1, 'Phrase is required').max(255, 'Phrase cannot be more than 255 characters'),
5
+ hint: z.string().max(255, 'Hint cannot be more than 255 characters').nullable(),
6
+ date: z.string().regex(/^([1-9]|1[0-2])-([1-9]|[12]\d|3[01])-\d{4}$/, {
7
+ message: "Date must be in format m-d-yyyy",
8
+ }),
9
+ from_user: z.string().nullable(),
10
+ to_user: z.string().nullable(),
11
+ });
@@ -1 +1 @@
1
- {"root":["../index.ts","../src/auth.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.9",
3
+ "version": "1.0.11",
4
4
  "type": "module",
5
5
  "description": "Shared library between Frontend and Backend for GuessPhrase",
6
6
  "main": "dist/index.js",