@timothyw/pat-common 1.0.27 → 1.0.29

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.
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ export declare const createAccountRequestSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ email: z.ZodString;
5
+ password: z.ZodString;
6
+ skipVerificationEmail: z.ZodOptional<z.ZodBoolean>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ email: string;
9
+ name: string;
10
+ password: string;
11
+ skipVerificationEmail?: boolean | undefined;
12
+ }, {
13
+ email: string;
14
+ name: string;
15
+ password: string;
16
+ skipVerificationEmail?: boolean | undefined;
17
+ }>;
18
+ export type CreateAccountRequest = z.infer<typeof createAccountRequestSchema>;
19
+ export interface CreateAccountResponse {
20
+ id: string;
21
+ name: string;
22
+ email: string;
23
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createAccountRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.createAccountRequestSchema = zod_1.z.object({
6
+ name: zod_1.z.string().trim().min(1),
7
+ email: zod_1.z.string().trim().email(),
8
+ password: zod_1.z.string().min(4),
9
+ skipVerificationEmail: zod_1.z.boolean().optional()
10
+ });
@@ -1,5 +1,5 @@
1
- export * from './login-types';
1
+ export * from './sign-in-types';
2
2
  export * from './refresh-auth-types';
3
- export * from './register-types';
3
+ export * from './create-account-types';
4
4
  export * from './resend-verification-types';
5
5
  export * from './verify-email-types';
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./login-types"), exports);
17
+ __exportStar(require("./sign-in-types"), exports);
18
18
  __exportStar(require("./refresh-auth-types"), exports);
19
- __exportStar(require("./register-types"), exports);
19
+ __exportStar(require("./create-account-types"), exports);
20
20
  __exportStar(require("./resend-verification-types"), exports);
21
21
  __exportStar(require("./verify-email-types"), exports);
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ import { AuthTokens } from "../../auth-tokens";
3
+ import { PublicAuthData, UserData } from "../../models";
4
+ export declare const signInRequestSchema: z.ZodObject<{
5
+ email: z.ZodString;
6
+ password: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ email: string;
9
+ password: string;
10
+ }, {
11
+ email: string;
12
+ password: string;
13
+ }>;
14
+ export type SignInRequest = z.infer<typeof signInRequestSchema>;
15
+ export interface SignInResponse {
16
+ tokenData: AuthTokens;
17
+ authData: PublicAuthData;
18
+ user: UserData;
19
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.signInRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.signInRequestSchema = zod_1.z.object({
6
+ email: zod_1.z.string().email(),
7
+ password: zod_1.z.string()
8
+ });
@@ -2,3 +2,4 @@ export * from './api';
2
2
  export * from './models';
3
3
  export * from './auth-tokens';
4
4
  export * from './id-types';
5
+ export * from './socket-message-types';
@@ -18,3 +18,4 @@ __exportStar(require("./api"), exports);
18
18
  __exportStar(require("./models"), exports);
19
19
  __exportStar(require("./auth-tokens"), exports);
20
20
  __exportStar(require("./id-types"), exports);
21
+ __exportStar(require("./socket-message-types"), exports);
@@ -0,0 +1,11 @@
1
+ export declare enum SocketMessageType {
2
+ CLIENT_HEARTBEAT_ACK = "client_heartbeat_ack",
3
+ CLIENT_CHECK_EMAIL_RESPONSE = "client_check_email_response",
4
+ SERVER_HEARTBEAT = "server_heartbeat",
5
+ SERVER_CHECK_EMAIL = "server_check_email"
6
+ }
7
+ export interface SocketMessage<T> {
8
+ type: string;
9
+ userId: string;
10
+ data: T;
11
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SocketMessageType = void 0;
4
+ var SocketMessageType;
5
+ (function (SocketMessageType) {
6
+ // client bound packets
7
+ SocketMessageType["CLIENT_HEARTBEAT_ACK"] = "client_heartbeat_ack";
8
+ SocketMessageType["CLIENT_CHECK_EMAIL_RESPONSE"] = "client_check_email_response";
9
+ // server bound packets
10
+ SocketMessageType["SERVER_HEARTBEAT"] = "server_heartbeat";
11
+ SocketMessageType["SERVER_CHECK_EMAIL"] = "server_check_email";
12
+ })(SocketMessageType || (exports.SocketMessageType = SocketMessageType = {}));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@timothyw/pat-common",
3
3
  "description": "",
4
4
  "author": "Timothy Washburn",
5
- "version": "1.0.27",
5
+ "version": "1.0.29",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -1,15 +1,15 @@
1
1
  import { z } from "zod";
2
2
 
3
- export const registerRequestSchema = z.object({
3
+ export const createAccountRequestSchema = z.object({
4
4
  name: z.string().trim().min(1),
5
5
  email: z.string().trim().email(),
6
6
  password: z.string().min(4),
7
7
  skipVerificationEmail: z.boolean().optional()
8
8
  });
9
9
 
10
- export type RegisterRequest = z.infer<typeof registerRequestSchema>;
10
+ export type CreateAccountRequest = z.infer<typeof createAccountRequestSchema>;
11
11
 
12
- export interface RegisterResponse {
12
+ export interface CreateAccountResponse {
13
13
  id: string;
14
14
  name: string;
15
15
  email: string;
@@ -1,5 +1,5 @@
1
- export * from './login-types'
1
+ export * from './sign-in-types'
2
2
  export * from './refresh-auth-types'
3
- export * from './register-types'
3
+ export * from './create-account-types'
4
4
  export * from './resend-verification-types'
5
5
  export * from './verify-email-types'
@@ -2,14 +2,14 @@ import { z } from "zod";
2
2
  import { AuthTokens } from "../../auth-tokens";
3
3
  import { PublicAuthData, UserData } from "../../models";
4
4
 
5
- export const loginRequestSchema = z.object({
5
+ export const signInRequestSchema = z.object({
6
6
  email: z.string().email(),
7
7
  password: z.string()
8
8
  });
9
9
 
10
- export type LoginRequest = z.infer<typeof loginRequestSchema>;
10
+ export type SignInRequest = z.infer<typeof signInRequestSchema>;
11
11
 
12
- export interface LoginResponse {
12
+ export interface SignInResponse {
13
13
  tokenData: AuthTokens;
14
14
  authData: PublicAuthData;
15
15
  user: UserData;
@@ -1,4 +1,5 @@
1
1
  export * from './api'
2
2
  export * from './models'
3
3
  export * from './auth-tokens'
4
- export * from './id-types'
4
+ export * from './id-types'
5
+ export * from './socket-message-types'
@@ -0,0 +1,15 @@
1
+ export enum SocketMessageType {
2
+ // client bound packets
3
+ CLIENT_HEARTBEAT_ACK = 'client_heartbeat_ack',
4
+ CLIENT_CHECK_EMAIL_RESPONSE = 'client_check_email_response',
5
+
6
+ // server bound packets
7
+ SERVER_HEARTBEAT = 'server_heartbeat',
8
+ SERVER_CHECK_EMAIL = 'server_check_email',
9
+ }
10
+
11
+ export interface SocketMessage<T> {
12
+ type: string;
13
+ userId: string;
14
+ data: T;
15
+ }