@plyaz/types 1.13.17 → 1.14.0
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/api/endpoints/infobip/types.d.ts +5 -0
- package/dist/auth/index.cjs +12 -4196
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +10 -6
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/schemas.d.ts +20 -21
- package/dist/errors/types.d.ts +42 -3
- package/dist/index.cjs +165 -4206
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +142 -6
- package/dist/index.js.map +1 -1
- package/dist/notifications/index.cjs +155 -4201
- package/dist/notifications/index.cjs.map +1 -1
- package/dist/notifications/index.d.ts +11 -0
- package/dist/notifications/index.js +133 -1
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/schemas.d.ts +13 -3
- package/dist/notifications/types.d.ts +66 -24
- package/dist/notifications/webhooks.schemas.d.ts +278 -0
- package/package.json +4 -4
package/dist/auth/index.js
CHANGED
|
@@ -42,13 +42,17 @@ var AUTH_PROVIDER_TYPE = /* @__PURE__ */ ((AUTH_PROVIDER_TYPE2) => {
|
|
|
42
42
|
AUTH_PROVIDER_TYPE2["InternalDb"] = "INTERNAL_DB";
|
|
43
43
|
return AUTH_PROVIDER_TYPE2;
|
|
44
44
|
})(AUTH_PROVIDER_TYPE || {});
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
var DEFAULT_PASSWORD = 8;
|
|
46
|
+
var ContactUsFormSchema = z.object({
|
|
47
|
+
name: z.string({ error: "errors.form.missingField" }).min(1, "errors.form.nameMissing"),
|
|
48
|
+
email: z.email({ error: "errors.form.emailInvalid" })
|
|
49
|
+
});
|
|
50
|
+
var SignupFormSchema = z.object({
|
|
51
|
+
name: z.string({ error: "errors.form.missingField" }).min(1, "errors.form.nameMissing"),
|
|
52
|
+
email: z.email({ error: "errors.form.emailInvalid" }),
|
|
53
|
+
password: z.string({ error: "errors.form.missingField" }).min(DEFAULT_PASSWORD, "errors.form.passwordTooShort")
|
|
50
54
|
});
|
|
51
55
|
|
|
52
|
-
export { AUTH_PROVIDER, AUTH_PROVIDER_TYPE, USER_ROLE, USER_STATUS
|
|
56
|
+
export { AUTH_PROVIDER, AUTH_PROVIDER_TYPE, ContactUsFormSchema, SignupFormSchema, USER_ROLE, USER_STATUS };
|
|
53
57
|
//# sourceMappingURL=index.js.map
|
|
54
58
|
//# sourceMappingURL=index.js.map
|
package/dist/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/enums.ts","../../src/auth/schemas.ts"],"names":["AUTH_PROVIDER_TYPE"],"mappings":";;;;;AAYO,IAAM,SAAA,GAAY;AAAA;AAAA,EAEvB,OAAA,EAAS,SAAA;AAAA;AAAA,EAGT,KAAA,EAAO,OAAA;AAAA;AAAA,EAGP,KAAA,EAAO,OAAA;AAAA;AAAA,EAGP,IAAA,EAAM,MAAA;AAAA;AAAA,EAGN,GAAA,EAAK,KAAA;AAAA;AAAA,EAGL,KAAA,EAAO,OAAA;AAAA;AAAA,EAGP,UAAA,EAAY;AACd;AAcO,IAAM,WAAA,GAAc;AAAA;AAAA,EAEzB,MAAA,EAAQ,QAAA;AAAA;AAAA,EAGR,QAAA,EAAU,UAAA;AAAA;AAAA,EAGV,OAAA,EAAS,SAAA;AAAA;AAAA,EAGT,SAAA,EAAW,WAAA;AAAA;AAAA,EAGX,MAAA,EAAQ;AACV;AAcO,IAAM,aAAA,GAAgB;AAAA;AAAA,EAE3B,KAAA,EAAO,OAAA;AAAA;AAAA,EAGP,MAAA,EAAQ;AACV;AAEO,IAAK,kBAAA,qBAAAA,mBAAAA,KAAL;AACL,EAAAA,oBAAA,eAAA,CAAA,GAAgB,gBAAA;AAChB,EAAAA,oBAAA,YAAA,CAAA,GAAa,aAAA;AAFH,EAAA,OAAAA,mBAAAA;A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E,MAAA,CAAO;AAAA,EACvC,IAAA,EAAM,CAAA,CAAE,MAAA,CAAO,EAAE,KAAA,EAAO,4BAA4B,CAAA,CAAE,GAAA,CAAI,CAAA,EAAG,yBAAyB,CAAA;AAAA,EACtF,OAAO,CAAA,CAAE,KAAA,CAAM,EAAE,KAAA,EAAO,4BAA4B,CAAA;AAAA,EACpD,QAAA,EAAU,CAAA,CACP,MAAA,CAAO,EAAE,KAAA,EAAO,4BAA4B,CAAA,CAC5C,GAAA,CAAI,gBAAA,EAAkB,8BAA8B;AACzD,CAAC","file":"index.js","sourcesContent":["/**\n * Enum representing the different roles a user can have within the system.\n * @description Roles are used to determine access levels, permissions, and user-specific experiences.\n *\n * @example\n * ```typescript\n * import { USER_ROLE } from '@plyaz/types';\n *\n * const userRole = USER_ROLE.Athlete; // 'athlete'\n * const isAdmin = userRole === USER_ROLE.Admin || userRole === USER_ROLE.SuperAdmin;\n * ```\n */\nexport const USER_ROLE = {\n /** A user who is an athlete and participates in sports activities. */\n Athlete: 'athlete',\n\n /** A user who scouts and discovers talent. */\n Scout: 'scout',\n\n /** A user who acts as an agent representing athletes or clubs. */\n Agent: 'agent',\n\n /** A user representing a sports club or organization. */\n Club: 'club',\n\n /** A fan or supporter of athletes or clubs. */\n Fan: 'fan',\n\n /** A system administrator with access to management tools. */\n Admin: 'admin',\n\n /** A super admin with the highest level of access and control. */\n SuperAdmin: 'super.admin',\n} as const;\n\n/**\n * Enum representing the current status of a user account.\n * @description Statuses are used to determine login availability, visibility, and user flow.\n *\n * @example\n * ```typescript\n * import { USER_STATUS } from '@plyaz/types';\n *\n * const isAccessible = status === USER_STATUS.Active;\n * const needsReview = status === USER_STATUS.Pending;\n * ```\n */\nexport const USER_STATUS = {\n /** Active user with full access. */\n Active: 'active',\n\n /** Inactive user, typically not currently using the platform. */\n Inactive: 'inactive',\n\n /** User account is awaiting approval or completion of setup. */\n Pending: 'pending',\n\n /** User has been temporarily suspended due to policy violations or manual review. */\n Suspended: 'suspended',\n\n /** User has been permanently banned from the platform. */\n Banned: 'banned',\n} as const;\n\n/**\n * Enum representing the supported authentication providers for user login.\n * @description Auth Providers allowed such as Email, Wallet, etc.\n *\n * @example\n * ```typescript\n * import { AUTH_PROVIDER } from '@plyaz/types';\n *\n * const provider = AUTH_PROVIDER.Wallet; // 'wallet'\n * const isWeb3Auth = provider === AUTH_PROVIDER.Wallet;\n * ```\n */\nexport const AUTH_PROVIDER = {\n /** Authentication via email and password. */\n Email: 'email',\n\n /** Authentication via connected blockchain wallet. */\n Wallet: 'wallet',\n} as const;\n\nexport enum AUTH_PROVIDER_TYPE {\n ClerkSupabase = 'CLERK_SUPABASE',\n InternalDb = 'INTERNAL_DB',\n}\n","import { z } from 'zod';\n\n/**\n * Password minimum character length\n */\nconst DEFAULT_PASSWORD = 8;\n\n/**\n * Contact Us Form Schema\n * Validates contact form submissions\n */\nexport const ContactUsFormSchema = z.object({\n name: z.string({ error: 'errors.form.missingField' }).min(1, 'errors.form.nameMissing'),\n email: z.email({ error: 'errors.form.emailInvalid' }),\n});\n\n/**\n * Contact Us Form Type\n */\nexport type ContactUsForm = z.infer<typeof ContactUsFormSchema>;\n\n/**\n * Signup Form Schema\n * Validates user registration form submissions\n */\nexport const SignupFormSchema = z.object({\n name: z.string({ error: 'errors.form.missingField' }).min(1, 'errors.form.nameMissing'),\n email: z.email({ error: 'errors.form.emailInvalid' }),\n password: z\n .string({ error: 'errors.form.missingField' })\n .min(DEFAULT_PASSWORD, 'errors.form.passwordTooShort'),\n});\n\n/**\n * Signup Form Type\n */\nexport type SignupForm = z.infer<typeof SignupFormSchema>;\n"]}
|
package/dist/auth/schemas.d.ts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* LoginCredentialsSchema.parse({
|
|
8
|
-
* email: "user@example.com",
|
|
9
|
-
* password: ""
|
|
10
|
-
* });
|
|
11
|
-
* ```
|
|
3
|
+
* Contact Us Form Schema
|
|
4
|
+
* Validates contact form submissions
|
|
12
5
|
*/
|
|
13
|
-
export declare const
|
|
14
|
-
|
|
6
|
+
export declare const ContactUsFormSchema: z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
email: z.ZodEmail;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
/**
|
|
11
|
+
* Contact Us Form Type
|
|
12
|
+
*/
|
|
13
|
+
export type ContactUsForm = z.infer<typeof ContactUsFormSchema>;
|
|
14
|
+
/**
|
|
15
|
+
* Signup Form Schema
|
|
16
|
+
* Validates user registration form submissions
|
|
17
|
+
*/
|
|
18
|
+
export declare const SignupFormSchema: z.ZodObject<{
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
email: z.ZodEmail;
|
|
15
21
|
password: z.ZodString;
|
|
16
|
-
},
|
|
17
|
-
email?: string;
|
|
18
|
-
password?: string;
|
|
19
|
-
}, {
|
|
20
|
-
email?: string;
|
|
21
|
-
password?: string;
|
|
22
|
-
}>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @description Represents the shape of validated login credentials input.
|
|
24
|
+
* Signup Form Type
|
|
26
25
|
*/
|
|
27
|
-
export type
|
|
26
|
+
export type SignupForm = z.infer<typeof SignupFormSchema>;
|
package/dist/errors/types.d.ts
CHANGED
|
@@ -306,7 +306,7 @@ export interface PackageErrorLike extends Error {
|
|
|
306
306
|
/** Convert error to string representation */
|
|
307
307
|
toString(): string;
|
|
308
308
|
/** Get user-friendly message for display to end users */
|
|
309
|
-
getUserMessage(): string;
|
|
309
|
+
getUserMessage(locale?: string): string;
|
|
310
310
|
}
|
|
311
311
|
export type AsyncMiddleware<TReturn = void> = (req: Request, res: Response, next: NextFunction) => Promise<TReturn>;
|
|
312
312
|
export type MiddlewareWrapper = <TReturn>(fn: AsyncMiddleware<TReturn>) => (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
@@ -531,9 +531,10 @@ export interface ApiPackageErrorOptions<TEndpoints = unknown, TClient = ApiClien
|
|
|
531
531
|
metadata?: Record<string, string | number | boolean | null>;
|
|
532
532
|
}
|
|
533
533
|
/**
|
|
534
|
-
*
|
|
534
|
+
* Generic configuration for package error classes
|
|
535
|
+
* Used by all @plyaz packages (api, notifications, errors, etc.)
|
|
535
536
|
*/
|
|
536
|
-
export interface
|
|
537
|
+
export interface PackageErrorConfig {
|
|
537
538
|
/** Package namespace for event emission */
|
|
538
539
|
namespace?: string;
|
|
539
540
|
/** Event factory for scoped events */
|
|
@@ -697,3 +698,41 @@ export type StatusCodeValue = number | InternalStatusCodeValue;
|
|
|
697
698
|
export interface I18nContext {
|
|
698
699
|
[key: string]: string | number | boolean | null | undefined;
|
|
699
700
|
}
|
|
701
|
+
/**
|
|
702
|
+
* ===== Sanitization Configuration =====
|
|
703
|
+
*/
|
|
704
|
+
/**
|
|
705
|
+
* Configuration for value sanitization in error messages
|
|
706
|
+
* Used to prevent injection attacks when interpolating values into error messages
|
|
707
|
+
*
|
|
708
|
+
* @example
|
|
709
|
+
* ```typescript
|
|
710
|
+
* const config: SanitizeConfig = {
|
|
711
|
+
* maxLength: 500,
|
|
712
|
+
* stripHtml: true,
|
|
713
|
+
* escapeNewlines: true
|
|
714
|
+
* };
|
|
715
|
+
* ```
|
|
716
|
+
*/
|
|
717
|
+
export interface SanitizeConfig {
|
|
718
|
+
/**
|
|
719
|
+
* Maximum length for interpolated string values
|
|
720
|
+
* @default 1000
|
|
721
|
+
*/
|
|
722
|
+
maxLength?: number;
|
|
723
|
+
/**
|
|
724
|
+
* Whether to strip all HTML tags
|
|
725
|
+
* @default true
|
|
726
|
+
*/
|
|
727
|
+
stripHtml?: boolean;
|
|
728
|
+
/**
|
|
729
|
+
* Whether to escape newlines to prevent log injection
|
|
730
|
+
* @default true
|
|
731
|
+
*/
|
|
732
|
+
escapeNewlines?: boolean;
|
|
733
|
+
/**
|
|
734
|
+
* Whether to limit object/array string representation
|
|
735
|
+
* @default true
|
|
736
|
+
*/
|
|
737
|
+
limitComplexTypes?: boolean;
|
|
738
|
+
}
|