@careflair/common 1.0.7 → 1.0.9

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.
@@ -1,6 +1,7 @@
1
- export { UserRegistrationSchema, UserRegistrationInput } from './userValiationSchema';
2
- export { EducationAndTrainingSchema, EducationAndTrainingInputValidation } from './educationSchemas';
3
- export { WorkHistorySchema, WorkHistoryInputValidation } from './workHistorySchema';
4
- export { AvailabilitiesSchemaZod, AvailabilityZodInput } from './availabilitySchemaValidation';
5
- export { HourlyRateInputZod, HourlyRateInputZodType } from './hourlyRateSchemaValidation';
6
- export { validateServices, ServicesSchema, SupportWorkerServicesSchema, validateSupportWorkerServices } from './businessServicesValidation';
1
+ export { UserRegistrationInput, UserRegistrationSchema, } from "./userValiationSchema";
2
+ export { EducationAndTrainingInputValidation, EducationAndTrainingSchema, } from "./educationSchemas";
3
+ export { WorkHistoryInputValidation, WorkHistorySchema, } from "./workHistorySchema";
4
+ export { AvailabilitiesSchemaZod, AvailabilityZodInput, } from "./availabilitySchemaValidation";
5
+ export { HourlyRateInputZod, HourlyRateInputZodType, } from "./hourlyRateSchemaValidation";
6
+ export { ServicesSchema, SupportWorkerServicesSchema, validateServices, validateSupportWorkerServices, } from "./businessServicesValidation";
7
+ export { generalOTPSchema, pinSchema, ResetPasswordSchema } from "./otp";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateSupportWorkerServices = exports.SupportWorkerServicesSchema = exports.ServicesSchema = exports.validateServices = exports.HourlyRateInputZod = exports.AvailabilitiesSchemaZod = exports.WorkHistorySchema = exports.EducationAndTrainingSchema = exports.UserRegistrationSchema = void 0;
3
+ exports.ResetPasswordSchema = exports.pinSchema = exports.generalOTPSchema = exports.validateSupportWorkerServices = exports.validateServices = exports.SupportWorkerServicesSchema = exports.ServicesSchema = exports.HourlyRateInputZod = exports.AvailabilitiesSchemaZod = exports.WorkHistorySchema = exports.EducationAndTrainingSchema = exports.UserRegistrationSchema = void 0;
4
4
  var userValiationSchema_1 = require("./userValiationSchema");
5
5
  Object.defineProperty(exports, "UserRegistrationSchema", { enumerable: true, get: function () { return userValiationSchema_1.UserRegistrationSchema; } });
6
6
  var educationSchemas_1 = require("./educationSchemas");
@@ -12,7 +12,11 @@ Object.defineProperty(exports, "AvailabilitiesSchemaZod", { enumerable: true, ge
12
12
  var hourlyRateSchemaValidation_1 = require("./hourlyRateSchemaValidation");
13
13
  Object.defineProperty(exports, "HourlyRateInputZod", { enumerable: true, get: function () { return hourlyRateSchemaValidation_1.HourlyRateInputZod; } });
14
14
  var businessServicesValidation_1 = require("./businessServicesValidation");
15
- Object.defineProperty(exports, "validateServices", { enumerable: true, get: function () { return businessServicesValidation_1.validateServices; } });
16
15
  Object.defineProperty(exports, "ServicesSchema", { enumerable: true, get: function () { return businessServicesValidation_1.ServicesSchema; } });
17
16
  Object.defineProperty(exports, "SupportWorkerServicesSchema", { enumerable: true, get: function () { return businessServicesValidation_1.SupportWorkerServicesSchema; } });
17
+ Object.defineProperty(exports, "validateServices", { enumerable: true, get: function () { return businessServicesValidation_1.validateServices; } });
18
18
  Object.defineProperty(exports, "validateSupportWorkerServices", { enumerable: true, get: function () { return businessServicesValidation_1.validateSupportWorkerServices; } });
19
+ var otp_1 = require("./otp");
20
+ Object.defineProperty(exports, "generalOTPSchema", { enumerable: true, get: function () { return otp_1.generalOTPSchema; } });
21
+ Object.defineProperty(exports, "pinSchema", { enumerable: true, get: function () { return otp_1.pinSchema; } });
22
+ Object.defineProperty(exports, "ResetPasswordSchema", { enumerable: true, get: function () { return otp_1.ResetPasswordSchema; } });
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * PIN/OTP validation schema
4
+ */
5
+ export declare const pinSchema: z.ZodString;
6
+ /**
7
+ * General OTP schema
8
+ * Validates OTP pin only
9
+ */
10
+ export declare const generalOTPSchema: z.ZodObject<{
11
+ pin: z.ZodString;
12
+ }, "strip", z.ZodTypeAny, {
13
+ pin: string;
14
+ }, {
15
+ pin: string;
16
+ }>;
17
+ /**
18
+ * Reset password schema
19
+ * Validates OTP pin, new password, and password confirmation
20
+ */
21
+ export declare const ResetPasswordSchema: z.ZodEffects<z.ZodObject<{
22
+ pin: z.ZodString;
23
+ password: z.ZodString;
24
+ confirmPassword: z.ZodString;
25
+ }, "strip", z.ZodTypeAny, {
26
+ password: string;
27
+ confirmPassword: string;
28
+ pin: string;
29
+ }, {
30
+ password: string;
31
+ confirmPassword: string;
32
+ pin: string;
33
+ }>, {
34
+ password: string;
35
+ confirmPassword: string;
36
+ pin: string;
37
+ }, {
38
+ password: string;
39
+ confirmPassword: string;
40
+ pin: string;
41
+ }>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResetPasswordSchema = exports.generalOTPSchema = exports.pinSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const limits_1 = require("../constants/limits");
6
+ /**
7
+ * PIN/OTP validation schema
8
+ */
9
+ exports.pinSchema = zod_1.z
10
+ .string()
11
+ .min(6, "OTP must be 6 characters long")
12
+ .max(6, "OTP must be 6 characters long");
13
+ /**
14
+ * General OTP schema
15
+ * Validates OTP pin only
16
+ */
17
+ exports.generalOTPSchema = zod_1.z.object({
18
+ pin: exports.pinSchema,
19
+ });
20
+ /**
21
+ * Reset password schema
22
+ * Validates OTP pin, new password, and password confirmation
23
+ */
24
+ exports.ResetPasswordSchema = zod_1.z
25
+ .object({
26
+ pin: exports.pinSchema,
27
+ password: zod_1.z
28
+ .string()
29
+ .min(1, "Password is required")
30
+ .min(limits_1.PASSWORD_MIN_LENGTH, `Password must be at least ${limits_1.PASSWORD_MIN_LENGTH} characters long`)
31
+ .max(limits_1.PASSWORD_MAX_LENGTH, `Password must be at most ${limits_1.PASSWORD_MAX_LENGTH} characters long`),
32
+ confirmPassword: zod_1.z
33
+ .string()
34
+ .min(1, "Confirm password is required")
35
+ .min(limits_1.PASSWORD_MIN_LENGTH, `Password must be at least ${limits_1.PASSWORD_MIN_LENGTH} characters long`)
36
+ .max(limits_1.PASSWORD_MAX_LENGTH, `Password must be at most ${limits_1.PASSWORD_MAX_LENGTH} characters long`),
37
+ })
38
+ .refine((data) => data.password === data.confirmPassword, {
39
+ message: "Passwords do not match",
40
+ path: ["confirmPassword"],
41
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@careflair/common",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Shared assets for CareFlair",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,8 +18,10 @@
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
20
  "date-fns": "^4.1.0",
21
- "libphonenumber-js": "^1.12.25",
22
- "zod": "^3.23.8"
21
+ "libphonenumber-js": "^1.12.25"
22
+ },
23
+ "peerDependencies": {
24
+ "zod": "^3.22.4 || ^3.23.8"
23
25
  },
24
26
  "files": [
25
27
  "dist"