@plyaz/types 1.5.3 → 1.5.5
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/index.js.map +1 -1
- package/dist/testing/common/utils/types.d.ts +230 -10
- package/package.json +4 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/auth/enums.ts","../src/errors/enums.ts","../src/events/enums.ts","../src/web3/enums.ts"],"names":[],"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;;;AClEO,IAAM,UAAA,GAAa;AAAA;AAAA,EAExB,eAAA,EAAiB,kBAAA;AAAA;AAAA,EAGjB,qBAAA,EAAuB,yBAAA;AAAA;AAAA,EAGvB,aAAA,EAAe,uBAAA;AAAA;AAAA,EAGf,kBAAA,EAAoB,4BAAA;AAAA;AAAA,EAGpB,YAAA,EAAc,gBAAA;AAAA;AAAA,EAGd,iBAAA,EAAmB;AACrB;AAcO,IAAM,cAAA,GAAiB;AAAA;AAAA,EAE5B,GAAA,EAAK,KAAA;AAAA;AAAA,EAGL,MAAA,EAAQ,QAAA;AAAA;AAAA,EAGR,IAAA,EAAM,MAAA;AAAA;AAAA,EAGN,QAAA,EAAU;AACZ;AAcO,IAAM,cAAA,GAAiB;AAAA;AAAA,EAE5B,MAAA,EAAQ,QAAA;AAAA;AAAA,EAGR,MAAA,EAAQ,QAAA;AAAA;AAAA,EAGR,OAAA,EAAS,SAAA;AAAA;AAAA,EAGT,UAAA,EAAY,YAAA;AAAA;AAAA,EAGZ,UAAA,EAAY;AACd;;;AC9EO,IAAM,UAAA,GAAa;AAAA;AAAA,EAExB,OAAA,EAAS;AACX;AAaO,IAAM,cAAA,GAAiB;AAAA;AAAA,EAE5B,GAAA,EAAK,KAAA;AAAA;AAAA,EAEL,MAAA,EAAQ,QAAA;AAAA;AAAA,EAER,IAAA,EAAM,MAAA;AAAA;AAAA,EAEN,QAAA,EAAU;AACZ;AAkBO,IAAM,YAAA,GAAe;AAAA;AAAA,EAE1B,OAAA,EAAS,SAAA;AAAA;AAAA,EAET,UAAA,EAAY,YAAA;AAAA;AAAA,EAEZ,SAAA,EAAW,WAAA;AAAA;AAAA,EAEX,MAAA,EAAQ,QAAA;AAAA;AAAA,EAER,QAAA,EAAU;AACZ;;;ACpDO,IAAM,QAAA,GAAW;AAAA;AAAA,EAEtB,eAAA,EAAiB,CAAA;AAAA;AAAA,EAGjB,eAAA,EAAiB,QAAA;AAAA;AAAA,EAGjB,QAAA,EAAU,EAAA;AAAA;AAAA,EAGV,eAAA,EAAiB,QAAA;AAAA;AAAA,EAGjB,QAAA,EAAU,KAAA;AAAA;AAAA,EAGV,eAAA,EAAiB,MAAA;AAAA;AAAA,EAGjB,OAAA,EAAS,GAAA;AAAA;AAAA,EAGT,WAAA,EAAa,KAAA;AAAA;AAAA,EAGb,IAAA,EAAM,IAAA;AAAA;AAAA,EAGN,WAAA,EAAa;AACf","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","/**\n * Enum representing standardized error types used across the application.\n * @description These error types help classify different categories of errors such as validation issues and system-level failures.\n *\n * @example\n * ```typescript\n * import { ERROR_TYPE } from '@plyaz/types';\n *\n * const errorType = ERROR_TYPE.ValidationError; // 'validation.error'\n *\n * // Error handling example\n * if (error.type === ERROR_TYPE.RateLimitExceeded) {\n * // Handle rate limiting\n * }\n * ```\n */\nexport const ERROR_TYPE = {\n /** A general validation error (e.g., form or input errors). */\n ValidationError: 'validation.error',\n\n /** Error related to schema validation, such as JSON schema or API payload checks. */\n SchemaValidationError: 'validation.schema.error',\n\n /** Unhandled or unexpected system error. */\n InternalError: 'system.internal.error',\n\n /** System dependency is currently unavailable (e.g., database or external API). */\n ServiceUnavailable: 'system.service.unavailable',\n\n /** The request took too long and timed out. */\n TimeoutError: 'system.timeout',\n\n /** Too many requests made in a short period of time. */\n RateLimitExceeded: 'system.rate.limit.exceeded',\n} as const;\n\n/**\n * Enum representing the severity level of an error.\n * @description This allows categorization of errors by their potential impact on the system or user.\n *\n * @example\n * ```typescript\n * import { ERROR_SEVERITY } from '@plyaz/types';\n *\n * const severity = ERROR_SEVERITY.Critical; // 'critical'\n * const shouldAlert = severity === ERROR_SEVERITY.High || severity === ERROR_SEVERITY.Critical;\n * ```\n */\nexport const ERROR_SEVERITY = {\n /** Low severity - does not impact functionality significantly. */\n Low: 'low',\n\n /** Medium severity - minor disruption or warning. */\n Medium: 'medium',\n\n /** High severity - major issue requiring attention. */\n High: 'high',\n\n /** Critical severity - blocking or crashing issue. */\n Critical: 'critical',\n} as const;\n\n/**\n * Enum representing the category or origin of an error.\n * @description Useful for filtering or logging errors based on their source or nature.\n *\n * @example\n * ```typescript\n * import { ERROR_CATEGORY } from '@plyaz/types';\n *\n * const category = ERROR_CATEGORY.Blockchain; // 'blockchain'\n * const isClientError = category === ERROR_CATEGORY.Client;\n * ```\n */\nexport const ERROR_CATEGORY = {\n /** Client-side error (e.g., invalid request). */\n Client: 'client',\n\n /** Server-side error (e.g., logic failure or exception). */\n Server: 'server',\n\n /** Network-related error (e.g., unreachable endpoint). */\n Network: 'network',\n\n /** Blockchain-related error (e.g., transaction failure, gas limit). */\n Blockchain: 'blockchain',\n\n // Validation-specific error (e.g., failed constraints or field errors).\n Validation: 'validation',\n} as const;\n","/**\n * Enum representing the types of events in the application.\n * Uses dot notation for event naming convention.\n *\n * @example\n * ```typescript\n * import { EVENT_TYPE } from '@plyaz/types';\n *\n * const eventType = EVENT_TYPE.AppInit; // 'app.init'\n * ```\n */\nexport const EVENT_TYPE = {\n /** Application initialization event. */\n AppInit: 'app.init',\n} as const;\n\n/**\n * Const representing the priority levels for events.\n * Used to determine processing order and resource allocation.\n *\n * @example\n * ```typescript\n * import { EVENT_PRIORITY } from '@plyaz/types';\n *\n * const priority = EVENT_PRIORITY.High; // 'high'\n * ```\n */\nexport const EVENT_PRIORITY = {\n /** Low priority event. */\n Low: 'low',\n /** Normal priority event. */\n Normal: 'normal',\n /** High priority event. */\n High: 'high',\n /** Critical priority event. */\n Critical: 'critical',\n} as const;\n\n/**\n * Const representing the status of an event.\n * Tracks the lifecycle of event processing from creation to completion.\n *\n * @example\n * ```typescript\n * import { EVENT_STATUS } from '@plyaz/types';\n *\n * const status = EVENT_STATUS.Processing; // 'processing'\n *\n * // Typical event lifecycle:\n * // Pending -> Processing -> Completed\n * // or\n * // Pending -> Processing -> Failed -> Retrying -> Processing -> Completed\n * ```\n */\nexport const EVENT_STATUS = {\n /** Event is pending and has not started processing. */\n Pending: 'pending',\n /** Event is currently being processed. */\n Processing: 'processing',\n /** Event has been completed successfully. */\n Completed: 'completed',\n /** Event processing failed. */\n Failed: 'failed',\n /** Event is being retried after a failure. */\n Retrying: 'retrying',\n} as const;\n","/**\n * Enum representing supported EVM-compatible blockchain networks by their numeric chain IDs.\n * @description These IDs are used to identify the specific network when interacting with wallets or smart contracts.\n * @see https://chainlist.org for reference chain IDs\n *\n * @example\n * ```typescript\n * import { CHAIN_ID } from '@plyaz/types';\n *\n * const chainId = CHAIN_ID.EthereumMainnet; // 1\n * const isTestnet = chainId === CHAIN_ID.EthereumSepolia || chainId === CHAIN_ID.PolygonAmoy;\n * ```\n */\nexport const CHAIN_ID = {\n /** Ethereum Mainnet (Chain ID: 1). */\n EthereumMainnet: 1,\n\n /** Ethereum Sepolia Testnet (Chain ID: 11155111). */\n EthereumSepolia: 11_155_111,\n\n /** Optimism Mainnet (Chain ID: 10). */\n Optimism: 10,\n\n /** Optimism Sepolia Testnet (Chain ID: 11155420). */\n OptimismSepolia: 11_155_420,\n\n /** Arbitrum One Mainnet (Chain ID: 42161). */\n Arbitrum: 42_161,\n\n /** Arbitrum Sepolia Testnet (Chain ID: 421614). */\n ArbitrumSepolia: 421_614,\n\n /** Polygon Mainnet (Chain ID: 137). */\n Polygon: 137,\n\n /** Polygon Amoy Testnet (Chain ID: 80002). */\n PolygonAmoy: 80_002,\n\n /** Base Mainnet (Chain ID: 8453). */\n Base: 8_453,\n\n /** Base Sepolia Testnet (Chain ID: 84532). */\n BaseSepolia: 84_532,\n} as const;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/auth/enums.ts","../src/errors/enums.ts","../src/events/enums.ts","../src/web3/enums.ts"],"names":[],"mappings":";;;AAYO,IAAM,SAAY,GAAA;AAAA;AAAA,EAEvB,OAAS,EAAA,SAAA;AAAA;AAAA,EAGT,KAAO,EAAA,OAAA;AAAA;AAAA,EAGP,KAAO,EAAA,OAAA;AAAA;AAAA,EAGP,IAAM,EAAA,MAAA;AAAA;AAAA,EAGN,GAAK,EAAA,KAAA;AAAA;AAAA,EAGL,KAAO,EAAA,OAAA;AAAA;AAAA,EAGP,UAAY,EAAA;AACd;AAcO,IAAM,WAAc,GAAA;AAAA;AAAA,EAEzB,MAAQ,EAAA,QAAA;AAAA;AAAA,EAGR,QAAU,EAAA,UAAA;AAAA;AAAA,EAGV,OAAS,EAAA,SAAA;AAAA;AAAA,EAGT,SAAW,EAAA,WAAA;AAAA;AAAA,EAGX,MAAQ,EAAA;AACV;AAcO,IAAM,aAAgB,GAAA;AAAA;AAAA,EAE3B,KAAO,EAAA,OAAA;AAAA;AAAA,EAGP,MAAQ,EAAA;AACV;;;AClEO,IAAM,UAAa,GAAA;AAAA;AAAA,EAExB,eAAiB,EAAA,kBAAA;AAAA;AAAA,EAGjB,qBAAuB,EAAA,yBAAA;AAAA;AAAA,EAGvB,aAAe,EAAA,uBAAA;AAAA;AAAA,EAGf,kBAAoB,EAAA,4BAAA;AAAA;AAAA,EAGpB,YAAc,EAAA,gBAAA;AAAA;AAAA,EAGd,iBAAmB,EAAA;AACrB;AAcO,IAAM,cAAiB,GAAA;AAAA;AAAA,EAE5B,GAAK,EAAA,KAAA;AAAA;AAAA,EAGL,MAAQ,EAAA,QAAA;AAAA;AAAA,EAGR,IAAM,EAAA,MAAA;AAAA;AAAA,EAGN,QAAU,EAAA;AACZ;AAcO,IAAM,cAAiB,GAAA;AAAA;AAAA,EAE5B,MAAQ,EAAA,QAAA;AAAA;AAAA,EAGR,MAAQ,EAAA,QAAA;AAAA;AAAA,EAGR,OAAS,EAAA,SAAA;AAAA;AAAA,EAGT,UAAY,EAAA,YAAA;AAAA;AAAA,EAGZ,UAAY,EAAA;AACd;;;AC9EO,IAAM,UAAa,GAAA;AAAA;AAAA,EAExB,OAAS,EAAA;AACX;AAaO,IAAM,cAAiB,GAAA;AAAA;AAAA,EAE5B,GAAK,EAAA,KAAA;AAAA;AAAA,EAEL,MAAQ,EAAA,QAAA;AAAA;AAAA,EAER,IAAM,EAAA,MAAA;AAAA;AAAA,EAEN,QAAU,EAAA;AACZ;AAkBO,IAAM,YAAe,GAAA;AAAA;AAAA,EAE1B,OAAS,EAAA,SAAA;AAAA;AAAA,EAET,UAAY,EAAA,YAAA;AAAA;AAAA,EAEZ,SAAW,EAAA,WAAA;AAAA;AAAA,EAEX,MAAQ,EAAA,QAAA;AAAA;AAAA,EAER,QAAU,EAAA;AACZ;;;ACpDO,IAAM,QAAW,GAAA;AAAA;AAAA,EAEtB,eAAiB,EAAA,CAAA;AAAA;AAAA,EAGjB,eAAiB,EAAA,QAAA;AAAA;AAAA,EAGjB,QAAU,EAAA,EAAA;AAAA;AAAA,EAGV,eAAiB,EAAA,QAAA;AAAA;AAAA,EAGjB,QAAU,EAAA,KAAA;AAAA;AAAA,EAGV,eAAiB,EAAA,MAAA;AAAA;AAAA,EAGjB,OAAS,EAAA,GAAA;AAAA;AAAA,EAGT,WAAa,EAAA,KAAA;AAAA;AAAA,EAGb,IAAM,EAAA,IAAA;AAAA;AAAA,EAGN,WAAa,EAAA;AACf","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","/**\n * Enum representing standardized error types used across the application.\n * @description These error types help classify different categories of errors such as validation issues and system-level failures.\n *\n * @example\n * ```typescript\n * import { ERROR_TYPE } from '@plyaz/types';\n *\n * const errorType = ERROR_TYPE.ValidationError; // 'validation.error'\n *\n * // Error handling example\n * if (error.type === ERROR_TYPE.RateLimitExceeded) {\n * // Handle rate limiting\n * }\n * ```\n */\nexport const ERROR_TYPE = {\n /** A general validation error (e.g., form or input errors). */\n ValidationError: 'validation.error',\n\n /** Error related to schema validation, such as JSON schema or API payload checks. */\n SchemaValidationError: 'validation.schema.error',\n\n /** Unhandled or unexpected system error. */\n InternalError: 'system.internal.error',\n\n /** System dependency is currently unavailable (e.g., database or external API). */\n ServiceUnavailable: 'system.service.unavailable',\n\n /** The request took too long and timed out. */\n TimeoutError: 'system.timeout',\n\n /** Too many requests made in a short period of time. */\n RateLimitExceeded: 'system.rate.limit.exceeded',\n} as const;\n\n/**\n * Enum representing the severity level of an error.\n * @description This allows categorization of errors by their potential impact on the system or user.\n *\n * @example\n * ```typescript\n * import { ERROR_SEVERITY } from '@plyaz/types';\n *\n * const severity = ERROR_SEVERITY.Critical; // 'critical'\n * const shouldAlert = severity === ERROR_SEVERITY.High || severity === ERROR_SEVERITY.Critical;\n * ```\n */\nexport const ERROR_SEVERITY = {\n /** Low severity - does not impact functionality significantly. */\n Low: 'low',\n\n /** Medium severity - minor disruption or warning. */\n Medium: 'medium',\n\n /** High severity - major issue requiring attention. */\n High: 'high',\n\n /** Critical severity - blocking or crashing issue. */\n Critical: 'critical',\n} as const;\n\n/**\n * Enum representing the category or origin of an error.\n * @description Useful for filtering or logging errors based on their source or nature.\n *\n * @example\n * ```typescript\n * import { ERROR_CATEGORY } from '@plyaz/types';\n *\n * const category = ERROR_CATEGORY.Blockchain; // 'blockchain'\n * const isClientError = category === ERROR_CATEGORY.Client;\n * ```\n */\nexport const ERROR_CATEGORY = {\n /** Client-side error (e.g., invalid request). */\n Client: 'client',\n\n /** Server-side error (e.g., logic failure or exception). */\n Server: 'server',\n\n /** Network-related error (e.g., unreachable endpoint). */\n Network: 'network',\n\n /** Blockchain-related error (e.g., transaction failure, gas limit). */\n Blockchain: 'blockchain',\n\n // Validation-specific error (e.g., failed constraints or field errors).\n Validation: 'validation',\n} as const;\n","/**\n * Enum representing the types of events in the application.\n * Uses dot notation for event naming convention.\n *\n * @example\n * ```typescript\n * import { EVENT_TYPE } from '@plyaz/types';\n *\n * const eventType = EVENT_TYPE.AppInit; // 'app.init'\n * ```\n */\nexport const EVENT_TYPE = {\n /** Application initialization event. */\n AppInit: 'app.init',\n} as const;\n\n/**\n * Const representing the priority levels for events.\n * Used to determine processing order and resource allocation.\n *\n * @example\n * ```typescript\n * import { EVENT_PRIORITY } from '@plyaz/types';\n *\n * const priority = EVENT_PRIORITY.High; // 'high'\n * ```\n */\nexport const EVENT_PRIORITY = {\n /** Low priority event. */\n Low: 'low',\n /** Normal priority event. */\n Normal: 'normal',\n /** High priority event. */\n High: 'high',\n /** Critical priority event. */\n Critical: 'critical',\n} as const;\n\n/**\n * Const representing the status of an event.\n * Tracks the lifecycle of event processing from creation to completion.\n *\n * @example\n * ```typescript\n * import { EVENT_STATUS } from '@plyaz/types';\n *\n * const status = EVENT_STATUS.Processing; // 'processing'\n *\n * // Typical event lifecycle:\n * // Pending -> Processing -> Completed\n * // or\n * // Pending -> Processing -> Failed -> Retrying -> Processing -> Completed\n * ```\n */\nexport const EVENT_STATUS = {\n /** Event is pending and has not started processing. */\n Pending: 'pending',\n /** Event is currently being processed. */\n Processing: 'processing',\n /** Event has been completed successfully. */\n Completed: 'completed',\n /** Event processing failed. */\n Failed: 'failed',\n /** Event is being retried after a failure. */\n Retrying: 'retrying',\n} as const;\n","/**\n * Enum representing supported EVM-compatible blockchain networks by their numeric chain IDs.\n * @description These IDs are used to identify the specific network when interacting with wallets or smart contracts.\n * @see https://chainlist.org for reference chain IDs\n *\n * @example\n * ```typescript\n * import { CHAIN_ID } from '@plyaz/types';\n *\n * const chainId = CHAIN_ID.EthereumMainnet; // 1\n * const isTestnet = chainId === CHAIN_ID.EthereumSepolia || chainId === CHAIN_ID.PolygonAmoy;\n * ```\n */\nexport const CHAIN_ID = {\n /** Ethereum Mainnet (Chain ID: 1). */\n EthereumMainnet: 1,\n\n /** Ethereum Sepolia Testnet (Chain ID: 11155111). */\n EthereumSepolia: 11_155_111,\n\n /** Optimism Mainnet (Chain ID: 10). */\n Optimism: 10,\n\n /** Optimism Sepolia Testnet (Chain ID: 11155420). */\n OptimismSepolia: 11_155_420,\n\n /** Arbitrum One Mainnet (Chain ID: 42161). */\n Arbitrum: 42_161,\n\n /** Arbitrum Sepolia Testnet (Chain ID: 421614). */\n ArbitrumSepolia: 421_614,\n\n /** Polygon Mainnet (Chain ID: 137). */\n Polygon: 137,\n\n /** Polygon Amoy Testnet (Chain ID: 80002). */\n PolygonAmoy: 80_002,\n\n /** Base Mainnet (Chain ID: 8453). */\n Base: 8_453,\n\n /** Base Sepolia Testnet (Chain ID: 84532). */\n BaseSepolia: 84_532,\n} as const;\n"]}
|
|
@@ -2415,25 +2415,75 @@ export interface NextPageResult {
|
|
|
2415
2415
|
};
|
|
2416
2416
|
notFound?: boolean;
|
|
2417
2417
|
}
|
|
2418
|
+
/**
|
|
2419
|
+
* Result of a mocked function call.
|
|
2420
|
+
* Captures arguments, return value, and any errors.
|
|
2421
|
+
*
|
|
2422
|
+
* @example
|
|
2423
|
+
* ```typescript
|
|
2424
|
+
* const result: MockCallResult = {
|
|
2425
|
+
* args: ['user123', { name: 'John' }],
|
|
2426
|
+
* result: { id: 1, success: true },
|
|
2427
|
+
* error: undefined
|
|
2428
|
+
* };
|
|
2429
|
+
* ```
|
|
2430
|
+
*/
|
|
2418
2431
|
export interface MockCallResult {
|
|
2419
2432
|
args: unknown[];
|
|
2420
2433
|
result: unknown;
|
|
2421
2434
|
error?: unknown;
|
|
2422
2435
|
}
|
|
2436
|
+
/**
|
|
2437
|
+
* File system watcher mock for testing file change events.
|
|
2438
|
+
* Simulates file watching with change, add, and unlink events.
|
|
2439
|
+
*
|
|
2440
|
+
* @example
|
|
2441
|
+
* ```typescript
|
|
2442
|
+
* const watcher: FileWatcher = createFileWatcher();
|
|
2443
|
+
* watcher.simulateChange('/src/app.ts');
|
|
2444
|
+
* watcher.simulateAdd('/src/new-file.ts');
|
|
2445
|
+
* watcher.simulateUnlink('/src/deleted.ts');
|
|
2446
|
+
* watcher.close();
|
|
2447
|
+
* ```
|
|
2448
|
+
*/
|
|
2423
2449
|
export interface FileWatcher extends MockEventEmitter {
|
|
2424
2450
|
add: Vitest.Mock;
|
|
2425
2451
|
unwatch: Vitest.Mock;
|
|
2426
|
-
close:
|
|
2452
|
+
close: () => void;
|
|
2427
2453
|
getWatched: Vitest.Mock;
|
|
2428
2454
|
simulateChange: (path: string) => void;
|
|
2429
2455
|
simulateAdd: (path: string) => void;
|
|
2430
2456
|
simulateUnlink: (path: string) => void;
|
|
2431
2457
|
}
|
|
2458
|
+
/**
|
|
2459
|
+
* NestJS testing module for unit and integration tests.
|
|
2460
|
+
* Provides dependency injection and module management.
|
|
2461
|
+
*
|
|
2462
|
+
* @example
|
|
2463
|
+
* ```typescript
|
|
2464
|
+
* const testBed: NestJSTestBed = await createTestBed();
|
|
2465
|
+
* const service = testBed.get<UserService>(UserService);
|
|
2466
|
+
* expect(service).toBeDefined();
|
|
2467
|
+
* await testBed.close();
|
|
2468
|
+
* ```
|
|
2469
|
+
*/
|
|
2432
2470
|
export interface NestJSTestBed {
|
|
2433
2471
|
get: <T>(token: unknown) => T;
|
|
2434
2472
|
close: () => Promise<void>;
|
|
2435
2473
|
moduleRef: Map<unknown, unknown>;
|
|
2436
2474
|
}
|
|
2475
|
+
/**
|
|
2476
|
+
* Test harness for module testing.
|
|
2477
|
+
* Provides module reference and dependency resolution.
|
|
2478
|
+
*
|
|
2479
|
+
* @example
|
|
2480
|
+
* ```typescript
|
|
2481
|
+
* const harness: ModuleTestHarness = await createModuleHarness();
|
|
2482
|
+
* const controller = harness.get<AppController>(AppController);
|
|
2483
|
+
* const result = await controller.getData();
|
|
2484
|
+
* await harness.close();
|
|
2485
|
+
* ```
|
|
2486
|
+
*/
|
|
2437
2487
|
export interface ModuleTestHarness {
|
|
2438
2488
|
moduleRef: {
|
|
2439
2489
|
get: <T>(token: unknown) => T;
|
|
@@ -2443,6 +2493,18 @@ export interface ModuleTestHarness {
|
|
|
2443
2493
|
get: <T>(token: unknown) => T;
|
|
2444
2494
|
close: () => Promise<void>;
|
|
2445
2495
|
}
|
|
2496
|
+
/**
|
|
2497
|
+
* Helper utilities for Next.js router testing.
|
|
2498
|
+
* Provides navigation simulation and route change testing.
|
|
2499
|
+
*
|
|
2500
|
+
* @example
|
|
2501
|
+
* ```typescript
|
|
2502
|
+
* const helpers: NextRouterHelpers = createRouterHelpers();
|
|
2503
|
+
* await helpers.navigateTo('/dashboard');
|
|
2504
|
+
* helpers.simulateRouteChange('/home', '/about');
|
|
2505
|
+
* helpers.expectNavigation('/login', 'push');
|
|
2506
|
+
* ```
|
|
2507
|
+
*/
|
|
2446
2508
|
export interface NextRouterHelpers {
|
|
2447
2509
|
navigateTo: (url: string, options?: NavigationOptions) => Promise<void>;
|
|
2448
2510
|
simulateRouteChange: (fromUrl: string, toUrl: string) => void;
|
|
@@ -2450,11 +2512,38 @@ export interface NextRouterHelpers {
|
|
|
2450
2512
|
expectNavigation: (url: string, type?: 'push' | 'replace') => void;
|
|
2451
2513
|
expectNoNavigation: () => void;
|
|
2452
2514
|
}
|
|
2515
|
+
/**
|
|
2516
|
+
* Complete Next.js router mock with restoration.
|
|
2517
|
+
* Includes router instance and useRouter hook mock.
|
|
2518
|
+
*
|
|
2519
|
+
* @example
|
|
2520
|
+
* ```typescript
|
|
2521
|
+
* const mock: MockNextRouterReturn = mockNextRouter();
|
|
2522
|
+
* mock.router.push('/new-route');
|
|
2523
|
+
* const { pathname } = mock.useRouter();
|
|
2524
|
+
* mock.restore();
|
|
2525
|
+
* ```
|
|
2526
|
+
*/
|
|
2453
2527
|
export interface MockNextRouterReturn {
|
|
2454
2528
|
router: MockNextRouter;
|
|
2455
2529
|
useRouter: CreateMockUseRouterReturn;
|
|
2456
2530
|
restore: () => void;
|
|
2457
2531
|
}
|
|
2532
|
+
/**
|
|
2533
|
+
* Mock Next.js request object for API route testing.
|
|
2534
|
+
* Simulates incoming HTTP requests with headers, body, and metadata.
|
|
2535
|
+
*
|
|
2536
|
+
* @example
|
|
2537
|
+
* ```typescript
|
|
2538
|
+
* const request: MockNextRequest = {
|
|
2539
|
+
* url: '/api/users',
|
|
2540
|
+
* method: 'POST',
|
|
2541
|
+
* headers: new Headers({ 'content-type': 'application/json' }),
|
|
2542
|
+
* body: { name: 'John' },
|
|
2543
|
+
* ip: '192.168.1.1'
|
|
2544
|
+
* };
|
|
2545
|
+
* ```
|
|
2546
|
+
*/
|
|
2458
2547
|
export interface MockNextRequest {
|
|
2459
2548
|
url: string;
|
|
2460
2549
|
method: string;
|
|
@@ -2481,6 +2570,18 @@ export interface MockNextRequest {
|
|
|
2481
2570
|
longitude: string;
|
|
2482
2571
|
};
|
|
2483
2572
|
}
|
|
2573
|
+
/**
|
|
2574
|
+
* Mock Next.js response object for API route testing.
|
|
2575
|
+
* Provides response methods for redirects, rewrites, and JSON responses.
|
|
2576
|
+
*
|
|
2577
|
+
* @example
|
|
2578
|
+
* ```typescript
|
|
2579
|
+
* const response: MockNextResponse = createMockResponse();
|
|
2580
|
+
* response.status = 200;
|
|
2581
|
+
* response.json({ success: true });
|
|
2582
|
+
* response.redirect('/login');
|
|
2583
|
+
* ```
|
|
2584
|
+
*/
|
|
2484
2585
|
export interface MockNextResponse {
|
|
2485
2586
|
cookies: {
|
|
2486
2587
|
set: Vitest.Mock;
|
|
@@ -2493,6 +2594,18 @@ export interface MockNextResponse {
|
|
|
2493
2594
|
next: Vitest.Mock;
|
|
2494
2595
|
json: Vitest.Mock;
|
|
2495
2596
|
}
|
|
2597
|
+
/**
|
|
2598
|
+
* Mock WebSocket server for testing real-time connections.
|
|
2599
|
+
* Simulates WebSocket server with client management and broadcasting.
|
|
2600
|
+
*
|
|
2601
|
+
* @example
|
|
2602
|
+
* ```typescript
|
|
2603
|
+
* const server: MockWebSocketServer = createMockWebSocketServer();
|
|
2604
|
+
* const client = server.simulateConnection('client-1');
|
|
2605
|
+
* server.simulateBroadcast({ type: 'message', data: 'Hello' });
|
|
2606
|
+
* server.simulateClientDisconnect('client-1');
|
|
2607
|
+
* ```
|
|
2608
|
+
*/
|
|
2496
2609
|
export interface MockWebSocketServer extends MockEventEmitter {
|
|
2497
2610
|
clients: Set<CreateMockWebSocketReturn>;
|
|
2498
2611
|
port: number;
|
|
@@ -2507,14 +2620,52 @@ export interface MockWebSocketServer extends MockEventEmitter {
|
|
|
2507
2620
|
simulateBroadcast: (data: unknown, excludeClient?: string) => void;
|
|
2508
2621
|
simulateClientDisconnect: (clientId: string) => void;
|
|
2509
2622
|
}
|
|
2623
|
+
/**
|
|
2624
|
+
* Global WebSocket mock with restoration capability.
|
|
2625
|
+
* Replaces global WebSocket constructor for testing.
|
|
2626
|
+
*
|
|
2627
|
+
* @example
|
|
2628
|
+
* ```typescript
|
|
2629
|
+
* const mock: MockWebSocketGlobal = mockGlobalWebSocket();
|
|
2630
|
+
* const ws = new WebSocket('ws://localhost:8080');
|
|
2631
|
+
* // Test WebSocket functionality
|
|
2632
|
+
* mock.restore();
|
|
2633
|
+
* ```
|
|
2634
|
+
*/
|
|
2510
2635
|
export interface MockWebSocketGlobal {
|
|
2511
2636
|
restore: () => void;
|
|
2512
2637
|
}
|
|
2638
|
+
/**
|
|
2639
|
+
* System date mock for time-based testing.
|
|
2640
|
+
* Controls system time for testing time-dependent code.
|
|
2641
|
+
*
|
|
2642
|
+
* @example
|
|
2643
|
+
* ```typescript
|
|
2644
|
+
* const dateMock: MockSystemDateReturn = mockSystemDate();
|
|
2645
|
+
* dateMock.setDate('2024-01-01');
|
|
2646
|
+
* dateMock.advanceBy(3600000); // Advance 1 hour
|
|
2647
|
+
* ```
|
|
2648
|
+
*/
|
|
2513
2649
|
export interface MockSystemDateReturn {
|
|
2514
2650
|
setDate: (newDate: Date | string | number) => void;
|
|
2515
2651
|
advanceBy: (ms: number) => void;
|
|
2516
2652
|
}
|
|
2517
2653
|
export type GetStaticPathsResult = NextGetStaticPathsResult;
|
|
2654
|
+
/**
|
|
2655
|
+
* Expectations for Next.js getStaticPaths testing.
|
|
2656
|
+
* Validates static path generation behavior.
|
|
2657
|
+
*
|
|
2658
|
+
* @example
|
|
2659
|
+
* ```typescript
|
|
2660
|
+
* const expectations: GetStaticPathsExpectations = {
|
|
2661
|
+
* pathCount: 10,
|
|
2662
|
+
* fallback: 'blocking',
|
|
2663
|
+
* validatePaths: (paths) => {
|
|
2664
|
+
* expect(paths).toContainEqual({ params: { id: '1' } });
|
|
2665
|
+
* }
|
|
2666
|
+
* };
|
|
2667
|
+
* ```
|
|
2668
|
+
*/
|
|
2518
2669
|
export interface GetStaticPathsExpectations {
|
|
2519
2670
|
pathCount?: number;
|
|
2520
2671
|
fallback: boolean | 'blocking';
|
|
@@ -2522,6 +2673,22 @@ export interface GetStaticPathsExpectations {
|
|
|
2522
2673
|
params: Record<string, string | string[] | undefined>;
|
|
2523
2674
|
}>) => void;
|
|
2524
2675
|
}
|
|
2676
|
+
/**
|
|
2677
|
+
* Image optimization test scenario.
|
|
2678
|
+
* Defines expected image optimization behavior in Next.js.
|
|
2679
|
+
*
|
|
2680
|
+
* @example
|
|
2681
|
+
* ```typescript
|
|
2682
|
+
* const scenario: ImageOptimizationScenario = {
|
|
2683
|
+
* src: '/images/hero.jpg',
|
|
2684
|
+
* width: 1200,
|
|
2685
|
+
* quality: 85,
|
|
2686
|
+
* expectedUrl: '/_next/image?url=%2Fimages%2Fhero.jpg&w=1200&q=85',
|
|
2687
|
+
* alt: 'Hero image',
|
|
2688
|
+
* priority: true
|
|
2689
|
+
* };
|
|
2690
|
+
* ```
|
|
2691
|
+
*/
|
|
2525
2692
|
export interface ImageOptimizationScenario {
|
|
2526
2693
|
src: string;
|
|
2527
2694
|
width: number;
|
|
@@ -2531,20 +2698,75 @@ export interface ImageOptimizationScenario {
|
|
|
2531
2698
|
priority?: boolean;
|
|
2532
2699
|
height?: number;
|
|
2533
2700
|
}
|
|
2701
|
+
/**
|
|
2702
|
+
* Options for drag and drop testing.
|
|
2703
|
+
* Configures drag data and expected drop effects.
|
|
2704
|
+
*
|
|
2705
|
+
* @example
|
|
2706
|
+
* ```typescript
|
|
2707
|
+
* const options: DragAndDropOptions = {
|
|
2708
|
+
* dragData: { 'text/plain': 'Dragged item' },
|
|
2709
|
+
* expectedDropEffect: 'move'
|
|
2710
|
+
* };
|
|
2711
|
+
* ```
|
|
2712
|
+
*/
|
|
2534
2713
|
export interface DragAndDropOptions {
|
|
2535
2714
|
dragData?: Record<string, string>;
|
|
2536
2715
|
expectedDropEffect?: 'copy' | 'move' | 'link' | 'none';
|
|
2537
2716
|
}
|
|
2717
|
+
/**
|
|
2718
|
+
* Options for realistic typing simulation.
|
|
2719
|
+
* Simulates human-like typing with pauses and typos.
|
|
2720
|
+
*
|
|
2721
|
+
* @example
|
|
2722
|
+
* ```typescript
|
|
2723
|
+
* const options: TypeRealisticOptions = {
|
|
2724
|
+
* pauseBetweenChars: 50,
|
|
2725
|
+
* typos: true,
|
|
2726
|
+
* speed: 'normal'
|
|
2727
|
+
* };
|
|
2728
|
+
* ```
|
|
2729
|
+
*/
|
|
2538
2730
|
export interface TypeRealisticOptions {
|
|
2539
2731
|
pauseBetweenChars?: number;
|
|
2540
2732
|
typos?: boolean;
|
|
2541
2733
|
speed?: 'slow' | 'normal' | 'fast';
|
|
2542
2734
|
}
|
|
2735
|
+
/**
|
|
2736
|
+
* Expectations for loading component testing.
|
|
2737
|
+
* Validates loading state UI elements.
|
|
2738
|
+
*
|
|
2739
|
+
* @example
|
|
2740
|
+
* ```typescript
|
|
2741
|
+
* const expectations: LoadingComponentExpectations = {
|
|
2742
|
+
* testId: 'loading-spinner',
|
|
2743
|
+
* text: 'Loading...',
|
|
2744
|
+
* className: 'spinner-active'
|
|
2745
|
+
* };
|
|
2746
|
+
* ```
|
|
2747
|
+
*/
|
|
2543
2748
|
export interface LoadingComponentExpectations {
|
|
2544
2749
|
testId?: string;
|
|
2545
2750
|
text?: string;
|
|
2546
2751
|
className?: string;
|
|
2547
2752
|
}
|
|
2753
|
+
/**
|
|
2754
|
+
* Test scenario for Next.js middleware.
|
|
2755
|
+
* Defines request and expected middleware behavior.
|
|
2756
|
+
*
|
|
2757
|
+
* @example
|
|
2758
|
+
* ```typescript
|
|
2759
|
+
* const scenario: MiddlewareTestScenarioWithRequest = {
|
|
2760
|
+
* name: 'Auth redirect',
|
|
2761
|
+
* request: ['/admin', { headers: {} }],
|
|
2762
|
+
* expected: {
|
|
2763
|
+
* type: 'redirect',
|
|
2764
|
+
* url: '/login',
|
|
2765
|
+
* status: 302
|
|
2766
|
+
* }
|
|
2767
|
+
* };
|
|
2768
|
+
* ```
|
|
2769
|
+
*/
|
|
2548
2770
|
export interface MiddlewareTestScenarioWithRequest {
|
|
2549
2771
|
name: string;
|
|
2550
2772
|
request: Parameters<CreateMockNextRequestFunction>;
|
|
@@ -4822,6 +5044,7 @@ export interface PerformanceMonitor {
|
|
|
4822
5044
|
memory?: number[];
|
|
4823
5045
|
timestamps: number[];
|
|
4824
5046
|
};
|
|
5047
|
+
reset: () => void;
|
|
4825
5048
|
}
|
|
4826
5049
|
/**
|
|
4827
5050
|
* Options for memory leak testing.
|
|
@@ -5126,13 +5349,11 @@ export interface SwipeGestureParams {
|
|
|
5126
5349
|
* @interface PinchGestureParams
|
|
5127
5350
|
*/
|
|
5128
5351
|
export interface PinchGestureParams {
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
duration?: number;
|
|
5135
|
-
rotation?: number;
|
|
5352
|
+
element: Element;
|
|
5353
|
+
centerX: number;
|
|
5354
|
+
centerY: number;
|
|
5355
|
+
startDistance: number;
|
|
5356
|
+
endDistance: number;
|
|
5136
5357
|
}
|
|
5137
5358
|
/**
|
|
5138
5359
|
* Animation frame data
|
|
@@ -5430,7 +5651,7 @@ export interface FileSnapshot {
|
|
|
5430
5651
|
* Environment configuration
|
|
5431
5652
|
* @interface EnvConfig
|
|
5432
5653
|
*/
|
|
5433
|
-
interface EnvConfig {
|
|
5654
|
+
export interface EnvConfig {
|
|
5434
5655
|
baseDir?: string;
|
|
5435
5656
|
envFile?: string;
|
|
5436
5657
|
override?: boolean;
|
|
@@ -5534,4 +5755,3 @@ export interface AsyncHook {
|
|
|
5534
5755
|
after?: (asyncId: number) => void;
|
|
5535
5756
|
destroy?: (asyncId: number) => void;
|
|
5536
5757
|
}
|
|
5537
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plyaz/types",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
4
4
|
"author": "Redeemer Pace",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "Provides shared TypeScript types and schema utilities for validation and parsing in the @playz ecosystem.",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"pnpm": ">=8.0.0"
|
|
32
32
|
},
|
|
33
33
|
"keywords": [],
|
|
34
|
-
"packageManager": "pnpm@10.11.0",
|
|
35
34
|
"dependencies": {
|
|
36
35
|
"type-fest": "^4.41.0"
|
|
37
36
|
},
|
|
@@ -127,6 +126,8 @@
|
|
|
127
126
|
"audit:critical": "pnpm audit --audit-level critical",
|
|
128
127
|
"audit:fix": "pnpm audit --fix",
|
|
129
128
|
"audit:enhanced": "npx audit-ci --moderate",
|
|
130
|
-
"security:check": "pnpm audit:moderate && npx audit-ci --moderate"
|
|
129
|
+
"security:check": "pnpm audit:moderate && npx audit-ci --moderate",
|
|
130
|
+
"deploy:local": "bash ../deploy-local.sh",
|
|
131
|
+
"publish:local": "bash ../publish-local.sh"
|
|
131
132
|
}
|
|
132
133
|
}
|