@wavy/util 0.0.9 → 0.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/dist/main.d.ts CHANGED
@@ -185,6 +185,10 @@ type TaskStatus = z.infer<typeof taskStatuses>;
185
185
 
186
186
  declare const currencies: z.ZodEnum<{
187
187
  JMD: "JMD";
188
+ USD: "USD";
189
+ EUR: "EUR";
190
+ GBP: "GBP";
191
+ CAD: "CAD";
188
192
  }>;
189
193
  type Currency = z.infer<typeof currencies>;
190
194
 
@@ -257,4 +261,13 @@ type AddPrefix<T, P extends string> = {
257
261
  [Key in keyof T extends string ? `${P}${Capitalize<keyof T>}` : keyof T]: Key extends keyof T ? T[Key] : Key extends `${P}${infer Prop}` ? Uncapitalize<Prop> extends keyof T ? T[Uncapitalize<Prop>] : never : never;
258
262
  };
259
263
 
260
- export { type AddPrefix, Address, type AuthProvider, type CastArray, type CastFn, type Currency, Email, type ErrorCode, ErrorMessage, FILE_MIME_TYPES, type FileAlias, FileDetails, type FlatDictionary, type FlattenDictionary, type KeysWithType, type KeysWithoutType, type KnownFileAlias, type MDSADelim, type MultiDimStringArrayId, Name, type NoUndefinedField, type NonFunction, type OmitType, type Partialize, PersonIdentity, PhoneNumber, type Prettify, type PropertyToString, type RemovePrefix, type RemoveSuffix, type ReplaceProperty, type ReplaceReturnType, type RevertMultiDimStringArrayId, type RevertStringArrayId, type SafeExclude, type SafeExtract, type SafeOmit, type SmartFn, type Split, type SplitMDSA, type StringArrayId, SuccessMessage, TaskLog, type TaskResult, type TaskStatus, type TypeOrGetType, type UnionToIntersection, type UnsubscribeFunction, UserModel, type WithExpiryDate, type WithMultiDimArray, type WithStringArray, authProviders, currencies, errorCodes, fileAliases, knownFileAliases, nameKeys, taskStatuses };
264
+ declare class TaskError {
265
+ constructor(message: ErrorMessage);
266
+ constructor(code: ErrorCode, message: string);
267
+ code: ErrorCode;
268
+ title?: string;
269
+ cause?: string;
270
+ message: string;
271
+ }
272
+
273
+ export { type AddPrefix, Address, type AuthProvider, type CastArray, type CastFn, type Currency, Email, type ErrorCode, ErrorMessage, FILE_MIME_TYPES, type FileAlias, FileDetails, type FlatDictionary, type FlattenDictionary, type KeysWithType, type KeysWithoutType, type KnownFileAlias, type MDSADelim, type MultiDimStringArrayId, Name, type NoUndefinedField, type NonFunction, type OmitType, type Partialize, PersonIdentity, PhoneNumber, type Prettify, type PropertyToString, type RemovePrefix, type RemoveSuffix, type ReplaceProperty, type ReplaceReturnType, type RevertMultiDimStringArrayId, type RevertStringArrayId, type SafeExclude, type SafeExtract, type SafeOmit, type SmartFn, type Split, type SplitMDSA, type StringArrayId, SuccessMessage, TaskError, TaskLog, type TaskResult, type TaskStatus, type TypeOrGetType, type UnionToIntersection, type UnsubscribeFunction, UserModel, type WithExpiryDate, type WithMultiDimArray, type WithStringArray, authProviders, currencies, errorCodes, fileAliases, knownFileAliases, nameKeys, taskStatuses };
package/dist/main.js CHANGED
@@ -46,18 +46,21 @@ var FILE_MIME_TYPES = {
46
46
  import * as z3 from "zod";
47
47
  var PhoneNumber = z3.string().regex(/^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$/);
48
48
  var nameKeys = z3.enum(["first", "last"]);
49
- var Name = z3.record(nameKeys, z3.string().trim());
49
+ var Name = z3.record(
50
+ nameKeys,
51
+ z3.string().trim().min(2, "A name must atleast have (2) characters.").max(25, "A name can't have more than (25) characters.")
52
+ );
50
53
  var addressValue = z3.string().trim();
51
54
  var Address = z3.object({
52
- streetAddress: addressValue,
53
- city: addressValue.optional(),
54
- parish: addressValue,
55
- country: addressValue
55
+ streetAddress: addressValue.min(3, "A street address must have at least (3) characters.").max(200, "A street address can't have more than (200) characters."),
56
+ city: addressValue.min(3, "A city must have at least (3) characters.").max(50, "A city can't have more than (50) characters.").optional(),
57
+ parish: addressValue.min(3, "A parish must have at least (3) characters.").max(50, "A parish can't have more than (50) characters."),
58
+ country: addressValue.min(4, "A country must have at least (4) characters.").max(45, "A country can't have more than (45) characters.")
56
59
  });
57
60
  var PersonIdentity = z3.object({
58
61
  name: Name,
59
- photoUrl: z3.string().nullish(),
60
- email: z3.email(),
62
+ photoUrl: z3.string().max(1500).nullish(),
63
+ email: z3.email().max(50, "An email can't have more than (50) characters."),
61
64
  phoneNumber: PhoneNumber.optional()
62
65
  });
63
66
  var UserModel = z3.object({ uid: z3.string(), ...PersonIdentity.shape });
@@ -111,7 +114,26 @@ var taskStatuses = z5.enum(["success", "pending", "error"]);
111
114
 
112
115
  // src/schemas/Billing.ts
113
116
  import * as z6 from "zod";
114
- var currencies = z6.enum(["JMD"]);
117
+ var currencies = z6.enum(["JMD", "USD", "EUR", "GBP", "CAD"]);
118
+
119
+ // src/classes/TaskError.ts
120
+ var TaskError = class {
121
+ constructor(param, message) {
122
+ if (typeof param === "string") {
123
+ this.code = param;
124
+ this.message = message ?? "";
125
+ } else {
126
+ this.code = param.code;
127
+ this.title = param.title;
128
+ this.message = param.message;
129
+ this.cause = param.cause;
130
+ }
131
+ }
132
+ code;
133
+ title;
134
+ cause;
135
+ message;
136
+ };
115
137
  export {
116
138
  Address,
117
139
  Email,
@@ -122,6 +144,7 @@ export {
122
144
  PersonIdentity,
123
145
  PhoneNumber,
124
146
  SuccessMessage,
147
+ TaskError,
125
148
  TaskLog,
126
149
  UserModel,
127
150
  authProviders,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavy/util",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Yay, utils!",
5
5
  "main": "./dist/main.js",
6
6
  "types": "./dist/main.d.ts",