shared_schemas 1.0.0 → 1.0.3

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/app.js CHANGED
@@ -15,4 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./schemas/auth.schemas"), exports);
18
+ // npm run build
19
+ // npm version patch
20
+ // npm publish
18
21
  //# sourceMappingURL=app.js.map
package/dist/app.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC"}
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC;AAEtC,gBAAgB;AAChB,oBAAoB;AACpB,cAAc"}
@@ -1,14 +1,15 @@
1
1
  import { z } from "zod";
2
- export declare const authSchema: {
3
- login: z.ZodObject<{
4
- email: z.ZodString;
5
- password: z.ZodString;
6
- }, z.core.$strip>;
7
- register: z.ZodObject<{
8
- name: z.ZodString;
9
- email: z.ZodString;
10
- password: z.ZodString;
11
- number: z.ZodString;
12
- }, z.core.$strip>;
13
- };
2
+ declare const loginSchema: z.ZodObject<{
3
+ email: z.ZodString;
4
+ password: z.ZodString;
5
+ }, z.core.$strip>;
6
+ declare const registerSchema: z.ZodObject<{
7
+ name: z.ZodString;
8
+ email: z.ZodString;
9
+ password: z.ZodString;
10
+ phoneNumber: z.ZodString;
11
+ }, z.core.$strip>;
12
+ export type LoginCredentials = z.infer<typeof loginSchema>;
13
+ export type SignupCredentials = z.infer<typeof registerSchema>;
14
+ export {};
14
15
  //# sourceMappingURL=auth.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/auth.schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAetB,eAAO,MAAO,UAAU;;;;;;;;;;;CAGvB,CAAA"}
1
+ {"version":3,"file":"auth.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/auth.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,QAAA,MAAM,WAAW;;;iBAIf,CAAC;AAEH,QAAA,MAAM,cAAc;;;;;iBAKlB,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AAC1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
@@ -1,19 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.authSchema = void 0;
4
3
  const zod_1 = require("zod");
5
- const login = zod_1.z.object({
4
+ const loginSchema = zod_1.z.object({
6
5
  email: zod_1.z.string().trim().min(1, "Email is required").email({ message: "Invalid Email format" }),
7
6
  password: zod_1.z.string().min(1, "Password is required")
8
7
  });
9
- const register = zod_1.z.object({
10
- name: zod_1.z.string(),
8
+ const registerSchema = zod_1.z.object({
9
+ name: zod_1.z.string().min(1, "Name is required"),
11
10
  email: zod_1.z.string().trim().min(1, "Email is required").email({ message: "Invalid email format" }),
12
11
  password: zod_1.z.string(),
13
- number: zod_1.z.string()
12
+ phoneNumber: zod_1.z.string().length(10, "Phone number must be 10 digits")
14
13
  });
15
- exports.authSchema = {
16
- login,
17
- register
18
- };
14
+ //Zod Does 2 thing at run time
15
+ // -> 1. Validation
16
+ // -> 2. Runtime Safety
19
17
  //# sourceMappingURL=auth.schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.schemas.js","sourceRoot":"","sources":["../../src/schemas/auth.schemas.ts"],"names":[],"mappings":";;;AACA,6BAAsB;AAEtB,MAAM,KAAK,GAAG,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AC,CAAC,EAAE,kBAAkB,CAAC;IAC3C,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAC/F,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,gCAAgC,CAAC;CACvE,CAAC,CAAC;AAKH,8BAA8B;AAC9B,mBAAmB;AACnB,uBAAuB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shared_schemas",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "main": "dist/app.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
package/src/app.ts CHANGED
@@ -1 +1,5 @@
1
- export * from "./schemas/auth.schemas"
1
+ export * from "./schemas/auth.schemas"
2
+
3
+ // npm run build
4
+ // npm version patch
5
+ // npm publish
@@ -1,20 +1,21 @@
1
-
2
1
  import {z} from "zod";
3
2
 
4
- const login = z.object({
3
+ const loginSchema = z.object({
5
4
  email: z.string().trim().min(1, "Email is required").email({message: "Invalid Email format"}),
6
5
  password: z.string().min(1, "Password is required")
7
6
 
8
7
  });
9
8
 
10
- const register = z.object({
11
- name: z.string(),
9
+ const registerSchema = z.object({
10
+ name: z.string().min(1, "Name is required"),
12
11
  email: z.string().trim().min(1, "Email is required").email({ message: "Invalid email format" }),
13
12
  password: z.string(),
14
- number: z.string()
13
+ phoneNumber: z.string().length(10, "Phone number must be 10 digits")
15
14
  });
16
15
 
17
- export const authSchema = {
18
- login,
19
- register
20
- }
16
+ export type LoginCredentials = z.infer<typeof loginSchema>
17
+ export type SignupCredentials = z.infer<typeof registerSchema>
18
+
19
+ //Zod Does 2 thing at run time
20
+ // -> 1. Validation
21
+ // -> 2. Runtime Safety
package/tsconfig.json CHANGED
@@ -3,6 +3,7 @@
3
3
  "compilerOptions": {
4
4
  // File Layout
5
5
  "outDir": "./dist",
6
+ "rootDir": "./src",
6
7
 
7
8
  // Environment Settings
8
9
  // See also https://aka.ms/tsconfig/module