@sudobility/types 1.8.21
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/CLAUDE.md +285 -0
- package/README.md +310 -0
- package/dist/index.cjs +62 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/types/blockchain/common.cjs +102 -0
- package/dist/types/blockchain/common.d.ts +262 -0
- package/dist/types/blockchain/common.d.ts.map +1 -0
- package/dist/types/blockchain/common.js +102 -0
- package/dist/types/blockchain/common.js.map +1 -0
- package/dist/types/blockchain/index.cjs +18 -0
- package/dist/types/blockchain/index.d.ts +4 -0
- package/dist/types/blockchain/index.d.ts.map +1 -0
- package/dist/types/blockchain/index.js +18 -0
- package/dist/types/blockchain/index.js.map +1 -0
- package/dist/types/blockchain/validation.cjs +88 -0
- package/dist/types/blockchain/validation.d.ts +9 -0
- package/dist/types/blockchain/validation.d.ts.map +1 -0
- package/dist/types/blockchain/validation.js +88 -0
- package/dist/types/blockchain/validation.js.map +1 -0
- package/dist/types/business/enums.cjs +314 -0
- package/dist/types/business/enums.d.ts +227 -0
- package/dist/types/business/enums.d.ts.map +1 -0
- package/dist/types/business/enums.js +314 -0
- package/dist/types/business/enums.js.map +1 -0
- package/dist/types/business/index.cjs +33 -0
- package/dist/types/business/index.d.ts +5 -0
- package/dist/types/business/index.d.ts.map +1 -0
- package/dist/types/business/index.js +33 -0
- package/dist/types/business/index.js.map +1 -0
- package/dist/types/business/wallet-status.cjs +38 -0
- package/dist/types/business/wallet-status.d.ts +32 -0
- package/dist/types/business/wallet-status.d.ts.map +1 -0
- package/dist/types/business/wallet-status.js +38 -0
- package/dist/types/business/wallet-status.js.map +1 -0
- package/dist/types/common.cjs +6 -0
- package/dist/types/common.d.ts +142 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +6 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/config/app-config.cjs +6 -0
- package/dist/types/config/app-config.d.ts +67 -0
- package/dist/types/config/app-config.d.ts.map +1 -0
- package/dist/types/config/app-config.js +6 -0
- package/dist/types/config/app-config.js.map +1 -0
- package/dist/types/config/environment.cjs +24 -0
- package/dist/types/config/environment.d.ts +68 -0
- package/dist/types/config/environment.d.ts.map +1 -0
- package/dist/types/config/environment.js +24 -0
- package/dist/types/config/environment.js.map +1 -0
- package/dist/types/config/index.cjs +6 -0
- package/dist/types/config/index.d.ts +4 -0
- package/dist/types/config/index.d.ts.map +1 -0
- package/dist/types/config/index.js +6 -0
- package/dist/types/config/index.js.map +1 -0
- package/dist/types/index.cjs +35 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +35 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/indexer/index.cjs +19 -0
- package/dist/types/indexer/index.d.ts +3 -0
- package/dist/types/indexer/index.d.ts.map +1 -0
- package/dist/types/indexer/index.js +19 -0
- package/dist/types/indexer/index.js.map +1 -0
- package/dist/types/indexer/indexer-guards.cjs +145 -0
- package/dist/types/indexer/indexer-guards.d.ts +26 -0
- package/dist/types/indexer/indexer-guards.d.ts.map +1 -0
- package/dist/types/indexer/indexer-guards.js +145 -0
- package/dist/types/indexer/indexer-guards.js.map +1 -0
- package/dist/types/indexer/indexer-responses.cjs +8 -0
- package/dist/types/indexer/indexer-responses.d.ts +136 -0
- package/dist/types/indexer/indexer-responses.d.ts.map +1 -0
- package/dist/types/indexer/indexer-responses.js +8 -0
- package/dist/types/indexer/indexer-responses.js.map +1 -0
- package/dist/types/infrastructure/analytics.cjs +212 -0
- package/dist/types/infrastructure/analytics.d.ts +449 -0
- package/dist/types/infrastructure/analytics.d.ts.map +1 -0
- package/dist/types/infrastructure/analytics.js +212 -0
- package/dist/types/infrastructure/analytics.js.map +1 -0
- package/dist/types/infrastructure/api.cjs +17 -0
- package/dist/types/infrastructure/api.d.ts +152 -0
- package/dist/types/infrastructure/api.d.ts.map +1 -0
- package/dist/types/infrastructure/api.js +17 -0
- package/dist/types/infrastructure/api.js.map +1 -0
- package/dist/types/infrastructure/index.cjs +14 -0
- package/dist/types/infrastructure/index.d.ts +9 -0
- package/dist/types/infrastructure/index.d.ts.map +1 -0
- package/dist/types/infrastructure/index.js +14 -0
- package/dist/types/infrastructure/index.js.map +1 -0
- package/dist/types/infrastructure/navigation.cjs +3 -0
- package/dist/types/infrastructure/navigation.d.ts +56 -0
- package/dist/types/infrastructure/navigation.d.ts.map +1 -0
- package/dist/types/infrastructure/navigation.js +3 -0
- package/dist/types/infrastructure/navigation.js.map +1 -0
- package/dist/types/infrastructure/network.cjs +18 -0
- package/dist/types/infrastructure/network.d.ts +48 -0
- package/dist/types/infrastructure/network.d.ts.map +1 -0
- package/dist/types/infrastructure/network.js +18 -0
- package/dist/types/infrastructure/network.js.map +1 -0
- package/dist/types/infrastructure/wallet.cjs +37 -0
- package/dist/types/infrastructure/wallet.d.ts +33 -0
- package/dist/types/infrastructure/wallet.d.ts.map +1 -0
- package/dist/types/infrastructure/wallet.js +37 -0
- package/dist/types/infrastructure/wallet.js.map +1 -0
- package/dist/types/kyc/index.cjs +19 -0
- package/dist/types/kyc/index.d.ts +2 -0
- package/dist/types/kyc/index.d.ts.map +1 -0
- package/dist/types/kyc/index.js +19 -0
- package/dist/types/kyc/index.js.map +1 -0
- package/dist/types/kyc/kyc-types.cjs +12 -0
- package/dist/types/kyc/kyc-types.d.ts +260 -0
- package/dist/types/kyc/kyc-types.d.ts.map +1 -0
- package/dist/types/kyc/kyc-types.js +12 -0
- package/dist/types/kyc/kyc-types.js.map +1 -0
- package/dist/types/mailer/index.cjs +19 -0
- package/dist/types/mailer/index.d.ts +2 -0
- package/dist/types/mailer/index.d.ts.map +1 -0
- package/dist/types/mailer/index.js +19 -0
- package/dist/types/mailer/index.js.map +1 -0
- package/dist/types/mailer/mail-types.cjs +38 -0
- package/dist/types/mailer/mail-types.d.ts +296 -0
- package/dist/types/mailer/mail-types.d.ts.map +1 -0
- package/dist/types/mailer/mail-types.js +38 -0
- package/dist/types/mailer/mail-types.js.map +1 -0
- package/dist/types/wildduck/index.cjs +19 -0
- package/dist/types/wildduck/index.d.ts +2 -0
- package/dist/types/wildduck/index.d.ts.map +1 -0
- package/dist/types/wildduck/index.js +19 -0
- package/dist/types/wildduck/index.js.map +1 -0
- package/dist/types/wildduck/wildduck-types.cjs +48 -0
- package/dist/types/wildduck/wildduck-types.d.ts +1239 -0
- package/dist/types/wildduck/wildduck-types.d.ts.map +1 -0
- package/dist/types/wildduck/wildduck-types.js +48 -0
- package/dist/types/wildduck/wildduck-types.js.map +1 -0
- package/dist/utils/async-helpers.cjs +130 -0
- package/dist/utils/async-helpers.d.ts +35 -0
- package/dist/utils/async-helpers.d.ts.map +1 -0
- package/dist/utils/async-helpers.js +130 -0
- package/dist/utils/async-helpers.js.map +1 -0
- package/dist/utils/auth/auth.cjs +96 -0
- package/dist/utils/auth/auth.d.ts +40 -0
- package/dist/utils/auth/auth.d.ts.map +1 -0
- package/dist/utils/auth/auth.js +96 -0
- package/dist/utils/auth/auth.js.map +1 -0
- package/dist/utils/auth/index.cjs +14 -0
- package/dist/utils/auth/index.d.ts +2 -0
- package/dist/utils/auth/index.d.ts.map +1 -0
- package/dist/utils/auth/index.js +14 -0
- package/dist/utils/auth/index.js.map +1 -0
- package/dist/utils/blockchain/address.cjs +231 -0
- package/dist/utils/blockchain/address.d.ts +65 -0
- package/dist/utils/blockchain/address.d.ts.map +1 -0
- package/dist/utils/blockchain/address.js +231 -0
- package/dist/utils/blockchain/address.js.map +1 -0
- package/dist/utils/blockchain/event-helpers.cjs +143 -0
- package/dist/utils/blockchain/event-helpers.d.ts +87 -0
- package/dist/utils/blockchain/event-helpers.d.ts.map +1 -0
- package/dist/utils/blockchain/event-helpers.js +143 -0
- package/dist/utils/blockchain/event-helpers.js.map +1 -0
- package/dist/utils/blockchain/index.cjs +30 -0
- package/dist/utils/blockchain/index.d.ts +8 -0
- package/dist/utils/blockchain/index.d.ts.map +1 -0
- package/dist/utils/blockchain/index.js +30 -0
- package/dist/utils/blockchain/index.js.map +1 -0
- package/dist/utils/blockchain/rpc-helpers.cjs +865 -0
- package/dist/utils/blockchain/rpc-helpers.d.ts +251 -0
- package/dist/utils/blockchain/rpc-helpers.d.ts.map +1 -0
- package/dist/utils/blockchain/rpc-helpers.js +865 -0
- package/dist/utils/blockchain/rpc-helpers.js.map +1 -0
- package/dist/utils/constants/application.cjs +158 -0
- package/dist/utils/constants/application.d.ts +119 -0
- package/dist/utils/constants/application.d.ts.map +1 -0
- package/dist/utils/constants/application.js +158 -0
- package/dist/utils/constants/application.js.map +1 -0
- package/dist/utils/constants/index.cjs +30 -0
- package/dist/utils/constants/index.d.ts +7 -0
- package/dist/utils/constants/index.d.ts.map +1 -0
- package/dist/utils/constants/index.js +30 -0
- package/dist/utils/constants/index.js.map +1 -0
- package/dist/utils/constants/status-values.cjs +14 -0
- package/dist/utils/constants/status-values.d.ts +12 -0
- package/dist/utils/constants/status-values.d.ts.map +1 -0
- package/dist/utils/constants/status-values.js +14 -0
- package/dist/utils/constants/status-values.js.map +1 -0
- package/dist/utils/formatting/currency.cjs +36 -0
- package/dist/utils/formatting/currency.d.ts +26 -0
- package/dist/utils/formatting/currency.d.ts.map +1 -0
- package/dist/utils/formatting/currency.js +36 -0
- package/dist/utils/formatting/currency.js.map +1 -0
- package/dist/utils/formatting/date.cjs +138 -0
- package/dist/utils/formatting/date.d.ts +33 -0
- package/dist/utils/formatting/date.d.ts.map +1 -0
- package/dist/utils/formatting/date.js +138 -0
- package/dist/utils/formatting/date.js.map +1 -0
- package/dist/utils/formatting/index.cjs +37 -0
- package/dist/utils/formatting/index.d.ts +4 -0
- package/dist/utils/formatting/index.d.ts.map +1 -0
- package/dist/utils/formatting/index.js +37 -0
- package/dist/utils/formatting/index.js.map +1 -0
- package/dist/utils/formatting/string.cjs +193 -0
- package/dist/utils/formatting/string.d.ts +69 -0
- package/dist/utils/formatting/string.d.ts.map +1 -0
- package/dist/utils/formatting/string.js +193 -0
- package/dist/utils/formatting/string.js.map +1 -0
- package/dist/utils/index.cjs +28 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +28 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logging/index.cjs +16 -0
- package/dist/utils/logging/index.d.ts +5 -0
- package/dist/utils/logging/index.d.ts.map +1 -0
- package/dist/utils/logging/index.js +16 -0
- package/dist/utils/logging/index.js.map +1 -0
- package/dist/utils/logging/logger.cjs +92 -0
- package/dist/utils/logging/logger.d.ts +70 -0
- package/dist/utils/logging/logger.d.ts.map +1 -0
- package/dist/utils/logging/logger.js +92 -0
- package/dist/utils/logging/logger.js.map +1 -0
- package/dist/utils/url/index.cjs +13 -0
- package/dist/utils/url/index.d.ts +5 -0
- package/dist/utils/url/index.d.ts.map +1 -0
- package/dist/utils/url/index.js +13 -0
- package/dist/utils/url/index.js.map +1 -0
- package/dist/utils/url/url-params.cjs +128 -0
- package/dist/utils/url/url-params.d.ts +36 -0
- package/dist/utils/url/url-params.d.ts.map +1 -0
- package/dist/utils/url/url-params.js +128 -0
- package/dist/utils/url/url-params.js.map +1 -0
- package/dist/utils/validation/index.cjs +25 -0
- package/dist/utils/validation/index.d.ts +5 -0
- package/dist/utils/validation/index.d.ts.map +1 -0
- package/dist/utils/validation/index.js +25 -0
- package/dist/utils/validation/index.js.map +1 -0
- package/dist/utils/validation/type-validation.cjs +167 -0
- package/dist/utils/validation/type-validation.d.ts +68 -0
- package/dist/utils/validation/type-validation.d.ts.map +1 -0
- package/dist/utils/validation/type-validation.js +167 -0
- package/dist/utils/validation/type-validation.js.map +1 -0
- package/dist/utils/validation/web3-username-validator.cjs +132 -0
- package/dist/utils/validation/web3-username-validator.d.ts +43 -0
- package/dist/utils/validation/web3-username-validator.d.ts.map +1 -0
- package/dist/utils/validation/web3-username-validator.js +132 -0
- package/dist/utils/validation/web3-username-validator.js.map +1 -0
- package/package.json +80 -0
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# Claude AI Assistant Configuration
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
This is `@johnqh/types` v1.6.2, a comprehensive TypeScript types library for the 0xmail.box ecosystem. It provides shared type definitions, interfaces, enums, and utility functions used across multiple projects in the 0xmail.box Web3 email platform.
|
|
6
|
+
|
|
7
|
+
## Key Architecture
|
|
8
|
+
|
|
9
|
+
- **Framework Agnostic**: Pure TypeScript with zero external runtime dependencies
|
|
10
|
+
- **Tree Shakeable**: Optimized for modern bundlers with barrel exports
|
|
11
|
+
- **Dual Module Support**: ESM + CommonJS builds for maximum compatibility
|
|
12
|
+
- **AI-Optimized**: Enhanced documentation and patterns for AI-assisted development
|
|
13
|
+
- **Type-Safe**: Strict TypeScript configuration with comprehensive coverage
|
|
14
|
+
- **Modular Structure**: Domain-organized architecture (business, blockchain, infrastructure, etc.)
|
|
15
|
+
|
|
16
|
+
## Project Structure
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
src/
|
|
20
|
+
├── types/ # Type definitions organized by domain
|
|
21
|
+
│ ├── api/ # API request/response types
|
|
22
|
+
│ │ ├── index.ts # Barrel exports for API types
|
|
23
|
+
│ │ ├── indexer-guards.ts # Type guards for API responses
|
|
24
|
+
│ │ └── indexer-responses.ts # Complete API response definitions
|
|
25
|
+
│ ├── blockchain/ # Web3 and blockchain-related types
|
|
26
|
+
│ │ ├── common.ts # Multi-chain messaging types
|
|
27
|
+
│ │ ├── index.ts # Blockchain type exports
|
|
28
|
+
│ │ └── validation.ts # Blockchain validation utilities
|
|
29
|
+
│ ├── business/ # Core business logic types
|
|
30
|
+
│ │ ├── email.ts # Email and user types
|
|
31
|
+
│ │ ├── enums.ts # Business logic enums
|
|
32
|
+
│ │ ├── mailbox.ts # Mailbox and folder types
|
|
33
|
+
│ │ └── wallet-status.ts # Wallet connection state
|
|
34
|
+
│ ├── common.ts # Shared utility types (Optional<T>, Result<T>)
|
|
35
|
+
│ ├── config/ # Configuration and environment types
|
|
36
|
+
│ └── infrastructure/ # Infrastructure abstractions
|
|
37
|
+
│ ├── analytics.ts # Analytics service interface
|
|
38
|
+
│ ├── api.ts # Database entity interfaces
|
|
39
|
+
│ ├── navigation.ts # UI navigation abstractions
|
|
40
|
+
│ └── network.ts # Network client interface
|
|
41
|
+
├── utils/ # Pure utility functions
|
|
42
|
+
│ ├── auth/ # Authentication utilities
|
|
43
|
+
│ ├── blockchain/ # Blockchain utilities
|
|
44
|
+
│ │ ├── address.ts # Address validation and parsing
|
|
45
|
+
│ │ ├── event-helpers.ts # Multi-chain event utilities
|
|
46
|
+
│ │ └── network-config.ts # Network configuration
|
|
47
|
+
│ ├── constants/ # Shared constants
|
|
48
|
+
│ │ └── status-values.ts # Shared enum values
|
|
49
|
+
│ ├── formatting/ # Formatting utilities
|
|
50
|
+
│ ├── logging/ # Logging utilities
|
|
51
|
+
│ ├── url/ # URL utilities
|
|
52
|
+
│ └── validation/ # Validation utilities
|
|
53
|
+
│ ├── type-validation.ts # Generic type validation
|
|
54
|
+
│ └── web3-username-validator.ts # Web3 address validation
|
|
55
|
+
├── wildduck-requests.ts # WildDuck email server API types
|
|
56
|
+
└── index.ts # Main export file
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Essential Commands
|
|
60
|
+
|
|
61
|
+
### Development Commands
|
|
62
|
+
```bash
|
|
63
|
+
# Build the project (dual ESM/CJS output)
|
|
64
|
+
npm run build
|
|
65
|
+
|
|
66
|
+
# Watch mode for development
|
|
67
|
+
npm run dev
|
|
68
|
+
|
|
69
|
+
# Run all 267 tests
|
|
70
|
+
npm test
|
|
71
|
+
|
|
72
|
+
# Type checking
|
|
73
|
+
npm run typecheck
|
|
74
|
+
|
|
75
|
+
# Linting (ESLint v9)
|
|
76
|
+
npm run lint
|
|
77
|
+
|
|
78
|
+
# Fix linting issues
|
|
79
|
+
npm run lint:fix
|
|
80
|
+
|
|
81
|
+
# Format code (Prettier)
|
|
82
|
+
npm run format
|
|
83
|
+
|
|
84
|
+
# Check formatting
|
|
85
|
+
npm run format:check
|
|
86
|
+
|
|
87
|
+
# Clean build artifacts
|
|
88
|
+
npm run clean
|
|
89
|
+
|
|
90
|
+
# Full verification (build + test + lint + typecheck)
|
|
91
|
+
npm run verify
|
|
92
|
+
|
|
93
|
+
# AI development tools
|
|
94
|
+
npm run ai:analyze # Analyze type structure
|
|
95
|
+
npm run ai:validate # Validate exports
|
|
96
|
+
npm run ai:docs # Generate AI documentation
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Testing Strategy
|
|
100
|
+
|
|
101
|
+
- **Framework**: Vitest for fast unit testing
|
|
102
|
+
- **Coverage**: 267 comprehensive tests covering all utilities and type guards
|
|
103
|
+
- **Structure**: Tests mirror source structure in `test/` directory
|
|
104
|
+
- **Focus**: Type guards, validation functions, utility functions, and API contracts
|
|
105
|
+
|
|
106
|
+
## Code Style and Standards
|
|
107
|
+
|
|
108
|
+
- **TypeScript**: Strict mode with `noUncheckedIndexedAccess` and `exactOptionalPropertyTypes`
|
|
109
|
+
- **ESLint**: Flat config format (ESLint v9+) with TypeScript rules
|
|
110
|
+
- **Prettier**: Code formatting with consistent style
|
|
111
|
+
- **Naming**: PascalCase for types/interfaces, camelCase for functions
|
|
112
|
+
- **Exports**: Barrel exports from index.ts files for tree-shaking
|
|
113
|
+
|
|
114
|
+
## Domain Knowledge
|
|
115
|
+
|
|
116
|
+
### 0xmail.box Context
|
|
117
|
+
- **Web3-native email platform**: Blockchain-based messaging system
|
|
118
|
+
- **Multi-chain support**: Ethereum, Polygon, Arbitrum, Optimism, Base, Solana
|
|
119
|
+
- **Wallet-centric**: User management tied to crypto wallet addresses
|
|
120
|
+
- **WildDuck integration**: Email server backend integration
|
|
121
|
+
- **Decentralized identity**: ENS and SNS name support
|
|
122
|
+
|
|
123
|
+
### Key Types to Know
|
|
124
|
+
|
|
125
|
+
#### Core Business Types
|
|
126
|
+
- `Email`: Core email message interface with Web3 extensions
|
|
127
|
+
- `User`/`WalletUserData`: User account types with wallet integration
|
|
128
|
+
- `MailBox`, `Folder`: Email organization structures
|
|
129
|
+
- `AuthStatus`, `ConnectionState`: Authentication and connection states
|
|
130
|
+
|
|
131
|
+
#### Blockchain Types
|
|
132
|
+
- `Message`/`PreparedMessage`: Multi-chain messaging interfaces
|
|
133
|
+
- `MessageRecipient`: Universal address type (EVM/Solana)
|
|
134
|
+
- `TransactionResult`, `TransactionStatus`: Transaction handling
|
|
135
|
+
- `NetworkConfig`, `DeploymentAddresses`: Network configuration
|
|
136
|
+
|
|
137
|
+
#### Utility Types
|
|
138
|
+
- `Optional<T>`: Null/undefined safe typing (`T | undefined | null`)
|
|
139
|
+
- `Result<T, E>`: Error handling pattern for operations
|
|
140
|
+
- `ValidationResult<T>`: Validation result pattern
|
|
141
|
+
- `PaginatedResponse<T>`: API pagination wrapper
|
|
142
|
+
|
|
143
|
+
#### Infrastructure Types
|
|
144
|
+
- `ApiResponse<T>`: Unified API response structure
|
|
145
|
+
- `AnalyticsService`: Analytics abstraction interface
|
|
146
|
+
- `NetworkClient`: HTTP client abstraction
|
|
147
|
+
- `UINavigationService`: Navigation abstraction
|
|
148
|
+
|
|
149
|
+
## Development Guidelines
|
|
150
|
+
|
|
151
|
+
### Adding New Types
|
|
152
|
+
1. Place in appropriate domain directory under `src/types/`
|
|
153
|
+
2. Export from domain's `index.ts`
|
|
154
|
+
3. Add to main `src/index.ts` if commonly used
|
|
155
|
+
4. Write comprehensive JSDoc comments with examples
|
|
156
|
+
5. Add unit tests for type guards/validators
|
|
157
|
+
6. Update TYPE_CHANGES.md documentation
|
|
158
|
+
|
|
159
|
+
### Adding Utilities
|
|
160
|
+
1. Place in appropriate utility directory under `src/utils/`
|
|
161
|
+
2. Keep functions pure (no side effects)
|
|
162
|
+
3. Add comprehensive tests with edge cases
|
|
163
|
+
4. Export from utility's `index.ts`
|
|
164
|
+
5. Document with JSDoc including usage examples
|
|
165
|
+
|
|
166
|
+
### Type Safety Best Practices
|
|
167
|
+
1. Use `Optional<T>` instead of manual `| null | undefined`
|
|
168
|
+
2. Prefer `unknown` over `any` for type safety
|
|
169
|
+
3. Use `Result<T, E>` pattern for error-prone operations
|
|
170
|
+
4. Implement type guards for runtime validation
|
|
171
|
+
5. Leverage utility types for consistent patterns
|
|
172
|
+
|
|
173
|
+
### Testing New Code
|
|
174
|
+
```bash
|
|
175
|
+
# Run tests in watch mode during development
|
|
176
|
+
npm run test:watch
|
|
177
|
+
|
|
178
|
+
# Run specific test file
|
|
179
|
+
npm test -- path/to/test.file.ts
|
|
180
|
+
|
|
181
|
+
# Generate coverage report
|
|
182
|
+
npm run test:coverage
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## AI Assistant Specific Notes
|
|
186
|
+
|
|
187
|
+
### When Working on This Project:
|
|
188
|
+
1. **Always run verification after changes**: `npm run verify`
|
|
189
|
+
2. **Maintain zero dependencies**: Don't add runtime dependencies
|
|
190
|
+
3. **Keep utilities pure**: No side effects in utility functions
|
|
191
|
+
4. **Follow naming conventions**: Established patterns for consistency
|
|
192
|
+
5. **Update documentation**: Keep TYPE_CHANGES.md current
|
|
193
|
+
6. **Test comprehensively**: All new utilities need tests
|
|
194
|
+
|
|
195
|
+
### Common Tasks:
|
|
196
|
+
- **Adding API response types**: Use consistent `ApiResponse<T>` pattern
|
|
197
|
+
- **Creating type guards**: Follow existing validation patterns
|
|
198
|
+
- **Updating blockchain types**: Consider multi-chain compatibility
|
|
199
|
+
- **Adding utility functions**: Ensure pure functions with comprehensive tests
|
|
200
|
+
- **Consolidating duplicates**: Use established utility types like `Optional<T>`
|
|
201
|
+
|
|
202
|
+
### Important Files:
|
|
203
|
+
- `src/index.ts`: Main export file - update for commonly used types
|
|
204
|
+
- `src/types/common.ts`: Core utility types - home of `Optional<T>`, `Result<T>`
|
|
205
|
+
- `src/types/business/enums.ts`: Business logic enums with shared constants
|
|
206
|
+
- `TYPE_CHANGES.md`: Comprehensive change documentation
|
|
207
|
+
- `package.json`: Dependencies and scripts (maintain zero runtime deps)
|
|
208
|
+
|
|
209
|
+
### Build Process:
|
|
210
|
+
1. **Dual output**: TypeScript compilation to both ESM and CJS
|
|
211
|
+
2. **Type definitions**: Generates `.d.ts` files for full TypeScript support
|
|
212
|
+
3. **Tree-shaking**: Optimized exports for modern bundlers
|
|
213
|
+
4. **Verification**: Comprehensive quality pipeline
|
|
214
|
+
|
|
215
|
+
### Quality Standards:
|
|
216
|
+
- **267 tests passing**: Complete test coverage maintained
|
|
217
|
+
- **Zero lint errors**: ESLint v9 with strict TypeScript rules
|
|
218
|
+
- **Perfect formatting**: Prettier integration
|
|
219
|
+
- **Type safety**: Strict TypeScript with comprehensive checking
|
|
220
|
+
- **Documentation**: JSDoc comments on all public APIs
|
|
221
|
+
|
|
222
|
+
## Recent Changes (v1.6.2)
|
|
223
|
+
|
|
224
|
+
### Type System Improvements
|
|
225
|
+
- **Optional<T> Consistency**: Standardized optional type usage throughout
|
|
226
|
+
- **Enhanced Type Safety**: Replaced all `any` types with `unknown`
|
|
227
|
+
- **Shared Constants**: STATUS_VALUES for enum consistency
|
|
228
|
+
- **Field Standardization**: Consistent `txHash` usage across blockchain types
|
|
229
|
+
|
|
230
|
+
### New Features
|
|
231
|
+
- **Comprehensive Indexer Types**: HeliusTransaction, ErrorResponse, DelegationInfo
|
|
232
|
+
- **Enhanced Validation**: Web3UsernameValidator with multi-chain support
|
|
233
|
+
- **Improved Analytics**: Type-safe analytics event properties
|
|
234
|
+
- **Better Error Handling**: UnifiedError with structured details
|
|
235
|
+
|
|
236
|
+
### Documentation
|
|
237
|
+
- **AI-Optimized README**: Comprehensive examples and usage patterns
|
|
238
|
+
- **TYPE_CHANGES.md**: Complete change log with migration guidance
|
|
239
|
+
- **Enhanced JSDoc**: Better documentation coverage across all APIs
|
|
240
|
+
- **Development Guides**: Improved contributor documentation
|
|
241
|
+
|
|
242
|
+
## Migration Guidance
|
|
243
|
+
|
|
244
|
+
### For Type Consumers
|
|
245
|
+
```typescript
|
|
246
|
+
// Recommended patterns
|
|
247
|
+
import { Optional, Result, ValidationResult } from '@johnqh/types';
|
|
248
|
+
import { ChainType, AuthStatus } from '@johnqh/types';
|
|
249
|
+
import { isEvmAddress, formatWalletAddress } from '@johnqh/types';
|
|
250
|
+
|
|
251
|
+
// Use Optional<T> for nullable values
|
|
252
|
+
const user: Optional<User> = getUser(); // instead of User | null | undefined
|
|
253
|
+
|
|
254
|
+
// Use Result<T> for error-prone operations
|
|
255
|
+
const result: Result<User> = validateUser(data); // instead of throwing
|
|
256
|
+
|
|
257
|
+
// Use proper type guards
|
|
258
|
+
if (isEvmAddress(address)) {
|
|
259
|
+
// TypeScript knows address is EVM format
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### For Library Maintainers
|
|
264
|
+
1. **Backward Compatibility**: All changes maintain compatibility via type aliases
|
|
265
|
+
2. **Deprecation Timeline**: Gradual migration with clear documentation
|
|
266
|
+
3. **Version Strategy**: Semantic versioning with comprehensive change logs
|
|
267
|
+
|
|
268
|
+
## Future Considerations
|
|
269
|
+
|
|
270
|
+
### Planned Improvements
|
|
271
|
+
1. **Enhanced Analytics Types**: More comprehensive event tracking
|
|
272
|
+
2. **Advanced Validation**: Schema-based validation utilities
|
|
273
|
+
3. **Better Error Types**: More specific error categorization
|
|
274
|
+
4. **Performance Optimization**: Further tree-shaking improvements
|
|
275
|
+
5. **Documentation**: Interactive type explorer
|
|
276
|
+
|
|
277
|
+
### Monitoring
|
|
278
|
+
- Track usage of deprecated patterns
|
|
279
|
+
- Monitor for type safety regressions
|
|
280
|
+
- Evaluate bundle size impact
|
|
281
|
+
- Collect developer feedback
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
*This configuration optimizes @johnqh/types for AI-assisted development while maintaining enterprise-grade quality standards.*
|
package/README.md
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# @johnqh/types
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/@johnqh%2Ftypes)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
**Comprehensive TypeScript type definitions and utilities for the 0xmail.box Web3 email ecosystem.**
|
|
8
|
+
|
|
9
|
+
## 🚀 Overview
|
|
10
|
+
|
|
11
|
+
This package provides a complete type-safe foundation for 0xmail.box applications, featuring:
|
|
12
|
+
|
|
13
|
+
- **267 comprehensive tests** ensuring type reliability
|
|
14
|
+
- **Zero runtime dependencies** for optimal performance
|
|
15
|
+
- **Dual module support** (ESM + CommonJS)
|
|
16
|
+
- **Complete TypeScript coverage** with strict type checking
|
|
17
|
+
- **AI-friendly documentation** for enhanced development experience
|
|
18
|
+
|
|
19
|
+
## 📦 Features
|
|
20
|
+
|
|
21
|
+
### Core Type System
|
|
22
|
+
- **Business Logic Types**: Email, User, WalletData, MailBox interfaces
|
|
23
|
+
- **Blockchain Types**: Multi-chain support (Ethereum, Solana, Polygon, etc.)
|
|
24
|
+
- **API Types**: Complete request/response type definitions
|
|
25
|
+
- **Infrastructure Types**: Analytics, navigation, network client abstractions
|
|
26
|
+
- **Utility Types**: `Optional<T>`, `Result<T, E>`, `ValidationResult<T>`
|
|
27
|
+
|
|
28
|
+
### Utilities & Helpers
|
|
29
|
+
- **Address Validation**: EVM, Solana, ENS, SNS address validation
|
|
30
|
+
- **Blockchain Utilities**: Network configuration, chain detection, event helpers
|
|
31
|
+
- **Formatting**: Date, currency, string formatting utilities
|
|
32
|
+
- **Validation**: Type guards, schema validation, Web3 username validation
|
|
33
|
+
- **URL Management**: Type-safe URL parameter handling
|
|
34
|
+
|
|
35
|
+
### Development Features
|
|
36
|
+
- **Tree Shakeable**: Import only what you need
|
|
37
|
+
- **Framework Agnostic**: Works with React, Vue, Node.js, React Native
|
|
38
|
+
- **Zero Config**: Ready to use out of the box
|
|
39
|
+
- **Type-Safe**: Complete IntelliSense support
|
|
40
|
+
|
|
41
|
+
## 🛠 Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install @johnqh/types
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 📖 Usage Examples
|
|
48
|
+
|
|
49
|
+
### Basic Types
|
|
50
|
+
```typescript
|
|
51
|
+
import {
|
|
52
|
+
Email,
|
|
53
|
+
User,
|
|
54
|
+
WalletUserData,
|
|
55
|
+
AuthStatus,
|
|
56
|
+
ChainType,
|
|
57
|
+
Optional
|
|
58
|
+
} from '@johnqh/types';
|
|
59
|
+
|
|
60
|
+
// Email handling
|
|
61
|
+
const email: Email = {
|
|
62
|
+
from: 'sender@0xmail.box',
|
|
63
|
+
to: 'recipient@0xmail.box',
|
|
64
|
+
subject: 'Web3 Email',
|
|
65
|
+
body: 'Hello from the blockchain!',
|
|
66
|
+
id: 'msg_123',
|
|
67
|
+
timestamp: Date.now(),
|
|
68
|
+
read: false
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// User management with optional fields
|
|
72
|
+
const user: WalletUserData = {
|
|
73
|
+
walletAddress: '0x742d35Cc6634C0532925a3b8D2C36B7f12345678',
|
|
74
|
+
chainType: ChainType.EVM,
|
|
75
|
+
emails: [email],
|
|
76
|
+
folders: []
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Optional type usage
|
|
80
|
+
const maybeUser: Optional<User> = null; // T | undefined | null
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Blockchain Integration
|
|
84
|
+
```typescript
|
|
85
|
+
import {
|
|
86
|
+
Message,
|
|
87
|
+
TransactionResult,
|
|
88
|
+
MessageType,
|
|
89
|
+
isEvmAddress,
|
|
90
|
+
isSolanaAddress
|
|
91
|
+
} from '@johnqh/types';
|
|
92
|
+
|
|
93
|
+
// Multi-chain message
|
|
94
|
+
const message: Message = {
|
|
95
|
+
from: '0x742d35Cc6634C0532925a3b8D2C36B7f12345678',
|
|
96
|
+
to: '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM',
|
|
97
|
+
subject: 'Cross-chain message',
|
|
98
|
+
body: 'EVM to Solana communication',
|
|
99
|
+
timestamp: Date.now(),
|
|
100
|
+
txHash: '0x123abc...',
|
|
101
|
+
messageType: MessageType.PRIORITY
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Address validation
|
|
105
|
+
const evmValid = isEvmAddress('0x742d35Cc6634C0532925a3b8D2C36B7f12345678'); // true
|
|
106
|
+
const solanaValid = isSolanaAddress('9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM'); // true
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### API Integration
|
|
110
|
+
```typescript
|
|
111
|
+
import {
|
|
112
|
+
ApiResponse,
|
|
113
|
+
ValidationResult,
|
|
114
|
+
IndexerApiResponse,
|
|
115
|
+
Result
|
|
116
|
+
} from '@johnqh/types';
|
|
117
|
+
|
|
118
|
+
// Type-safe API responses
|
|
119
|
+
const apiResponse: ApiResponse<User> = {
|
|
120
|
+
success: true,
|
|
121
|
+
data: user,
|
|
122
|
+
timestamp: new Date().toISOString()
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Result pattern for error handling
|
|
126
|
+
const validateUser = (data: unknown): Result<User> => {
|
|
127
|
+
// Validation logic...
|
|
128
|
+
return { success: true, data: user as User };
|
|
129
|
+
};
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Utilities
|
|
133
|
+
```typescript
|
|
134
|
+
import {
|
|
135
|
+
formatWalletAddress,
|
|
136
|
+
parseEmailAddress,
|
|
137
|
+
createMultiChainId,
|
|
138
|
+
Web3UsernameValidator
|
|
139
|
+
} from '@johnqh/types';
|
|
140
|
+
|
|
141
|
+
// Address formatting
|
|
142
|
+
const formatted = formatWalletAddress('0x742d35Cc6634C0532925a3b8D2C36B7f12345678');
|
|
143
|
+
// Result: "0x742d...5678"
|
|
144
|
+
|
|
145
|
+
// Email parsing
|
|
146
|
+
const parsed = parseEmailAddress('user@domain.eth');
|
|
147
|
+
// Result: { address: 'user', domain: 'domain.eth', type: AddressType.ENSName }
|
|
148
|
+
|
|
149
|
+
// Multi-chain ID generation
|
|
150
|
+
const id = createMultiChainId(1, '0x123...', 0);
|
|
151
|
+
// Result: "1-0x123...-0"
|
|
152
|
+
|
|
153
|
+
// Web3 username validation
|
|
154
|
+
const validation = Web3UsernameValidator.validate('vitalik.eth');
|
|
155
|
+
// Result: { name: 'vitalik.eth', address: null, chainType: ChainType.EVM }
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## 🏗 Project Structure
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
src/
|
|
162
|
+
├── types/ # Type definitions by domain
|
|
163
|
+
│ ├── indexer/ # Indexer API request/response types
|
|
164
|
+
│ ├── blockchain/ # Web3 and blockchain types
|
|
165
|
+
│ ├── business/ # Core business logic types
|
|
166
|
+
│ ├── common.ts # Shared utility types (Optional<T>, Result<T>)
|
|
167
|
+
│ ├── config/ # Configuration types
|
|
168
|
+
│ └── infrastructure/ # Infrastructure abstractions
|
|
169
|
+
├── utils/ # Pure utility functions
|
|
170
|
+
│ ├── auth/ # Authentication utilities
|
|
171
|
+
│ ├── blockchain/ # Blockchain utilities
|
|
172
|
+
│ ├── constants/ # Shared constants
|
|
173
|
+
│ ├── formatting/ # Formatting utilities
|
|
174
|
+
│ ├── logging/ # Logging utilities
|
|
175
|
+
│ ├── url/ # URL utilities
|
|
176
|
+
│ └── validation/ # Validation utilities
|
|
177
|
+
├── wildduck-requests.ts # WildDuck email server types
|
|
178
|
+
└── index.ts # Main exports
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## 🧪 Development
|
|
182
|
+
|
|
183
|
+
### Available Scripts
|
|
184
|
+
```bash
|
|
185
|
+
# Development
|
|
186
|
+
npm run build # Build both ESM and CommonJS
|
|
187
|
+
npm run dev # Watch mode development
|
|
188
|
+
npm test # Run all 267 tests
|
|
189
|
+
npm run test:watch # Watch mode testing
|
|
190
|
+
npm run test:coverage # Generate coverage report
|
|
191
|
+
|
|
192
|
+
# Quality Assurance
|
|
193
|
+
npm run lint # ESLint checking
|
|
194
|
+
npm run lint:fix # Fix linting issues
|
|
195
|
+
npm run format # Format with Prettier
|
|
196
|
+
npm run typecheck # TypeScript type checking
|
|
197
|
+
npm run verify # Complete verification pipeline
|
|
198
|
+
|
|
199
|
+
# AI Development Tools
|
|
200
|
+
npm run ai:analyze # Analyze type structure
|
|
201
|
+
npm run ai:validate # Validate exports
|
|
202
|
+
npm run ai:docs # Generate AI documentation
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Quality Standards
|
|
206
|
+
- **100% TypeScript**: Strict mode enabled with comprehensive coverage
|
|
207
|
+
- **267 Tests**: Complete test suite with Vitest
|
|
208
|
+
- **Zero Lint Errors**: ESLint v9 with flat config
|
|
209
|
+
- **Perfect Formatting**: Prettier integration
|
|
210
|
+
- **Dual Module Support**: ESM + CommonJS builds
|
|
211
|
+
|
|
212
|
+
## 🤖 AI Development Optimization
|
|
213
|
+
|
|
214
|
+
This project is optimized for AI-assisted development with:
|
|
215
|
+
|
|
216
|
+
### Enhanced Documentation
|
|
217
|
+
- **Comprehensive JSDoc comments** on all public APIs
|
|
218
|
+
- **Usage examples** for common patterns
|
|
219
|
+
- **Type relationships** clearly documented
|
|
220
|
+
- **Change logs** with migration guides
|
|
221
|
+
|
|
222
|
+
### AI-Friendly Patterns
|
|
223
|
+
- **Consistent naming conventions** across all types
|
|
224
|
+
- **Semantic type organization** by domain
|
|
225
|
+
- **Clear export patterns** with barrel exports
|
|
226
|
+
- **Utility type composition** for complex scenarios
|
|
227
|
+
|
|
228
|
+
### Development Support
|
|
229
|
+
- **CLAUDE.md** with project-specific instructions
|
|
230
|
+
- **TYPE_CHANGES.md** documenting all type evolution
|
|
231
|
+
- **AI analysis scripts** for type validation
|
|
232
|
+
- **Comprehensive test coverage** for validation
|
|
233
|
+
|
|
234
|
+
## 📚 Key Type Categories
|
|
235
|
+
|
|
236
|
+
### Core Business Types
|
|
237
|
+
- `Email`, `User`, `WalletUserData` - Core application entities
|
|
238
|
+
- `MailBox`, `Folder` - Email organization structures
|
|
239
|
+
- `AuthStatus`, `ConnectionState` - Authentication states
|
|
240
|
+
|
|
241
|
+
### Blockchain Types
|
|
242
|
+
- `Message`, `PreparedMessage` - Multi-chain messaging
|
|
243
|
+
- `TransactionResult`, `TransactionStatus` - Transaction handling
|
|
244
|
+
- `NetworkConfig`, `DeploymentAddresses` - Network configuration
|
|
245
|
+
|
|
246
|
+
### Utility Types
|
|
247
|
+
- `Optional<T>` - Null/undefined safe typing
|
|
248
|
+
- `Result<T, E>` - Error handling patterns
|
|
249
|
+
- `ValidationResult<T>` - Validation patterns
|
|
250
|
+
- `PaginatedResponse<T>` - API pagination
|
|
251
|
+
|
|
252
|
+
### Infrastructure Types
|
|
253
|
+
- `AnalyticsService` - Analytics abstraction
|
|
254
|
+
- `NetworkClient` - HTTP client interface
|
|
255
|
+
- `UINavigationService` - Navigation abstraction
|
|
256
|
+
|
|
257
|
+
## 🔧 Configuration
|
|
258
|
+
|
|
259
|
+
### TypeScript Config
|
|
260
|
+
The package is built with strict TypeScript settings:
|
|
261
|
+
```json
|
|
262
|
+
{
|
|
263
|
+
"compilerOptions": {
|
|
264
|
+
"strict": true,
|
|
265
|
+
"noUncheckedIndexedAccess": true,
|
|
266
|
+
"exactOptionalPropertyTypes": true
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Import Patterns
|
|
272
|
+
```typescript
|
|
273
|
+
// Main exports
|
|
274
|
+
import { Email, User, Optional } from '@johnqh/types';
|
|
275
|
+
|
|
276
|
+
// Specific modules (tree-shakeable)
|
|
277
|
+
import { ChainType } from '@johnqh/types/enums';
|
|
278
|
+
import { ValidationResponse } from '@johnqh/types/indexer';
|
|
279
|
+
|
|
280
|
+
// Utilities
|
|
281
|
+
import { formatWalletAddress } from '@johnqh/types/utils';
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## 🔄 Recent Updates (v1.6.2)
|
|
285
|
+
|
|
286
|
+
- ✅ **Optional<T> Consistency**: Standardized optional type usage
|
|
287
|
+
- ✅ **Enhanced Type Safety**: Replaced `any` with `unknown` throughout
|
|
288
|
+
- ✅ **Improved Documentation**: Comprehensive JSDoc coverage
|
|
289
|
+
- ✅ **Better AI Support**: Enhanced for AI-assisted development
|
|
290
|
+
- ✅ **Performance**: Zero runtime dependencies maintained
|
|
291
|
+
|
|
292
|
+
## 🤝 Contributing
|
|
293
|
+
|
|
294
|
+
This project follows strict quality standards:
|
|
295
|
+
|
|
296
|
+
1. **All types must have JSDoc documentation**
|
|
297
|
+
2. **Comprehensive tests required for utilities**
|
|
298
|
+
3. **Zero external runtime dependencies**
|
|
299
|
+
4. **Backward compatibility maintained**
|
|
300
|
+
5. **AI-friendly code patterns**
|
|
301
|
+
|
|
302
|
+
## 📄 License
|
|
303
|
+
|
|
304
|
+
MIT © 0xmail.box
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
**Built with ❤️ for the Web3 email revolution**
|
|
309
|
+
|
|
310
|
+
*This package powers the type-safe foundation of 0xmail.box, the first Web3-native email platform.*
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @johnqh/types - Common TypeScript types for 0xmail.box projects
|
|
4
|
+
*
|
|
5
|
+
* This package contains all shared TypeScript definitions used across
|
|
6
|
+
* the 0xmail.box ecosystem including business logic types, blockchain
|
|
7
|
+
* types, configuration interfaces, infrastructure types, and utility functions.
|
|
8
|
+
*
|
|
9
|
+
* @version 1.0.0
|
|
10
|
+
* @license MIT
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
24
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.StorageType = exports.WalletType = exports.ChainType = exports.AnalyticsEvent = exports.TransactionStatus = exports.MessageType = exports.NotificationType = exports.RequestStatus = exports.MobileView = exports.EmailComposeType = exports.FontSize = exports.Theme = exports.Chain = exports.AuthStatus = exports.debounceAsync = exports.clearExpiredCache = exports.withCache = exports.withTimeout = exports.safeParallel = exports.withLoadingState = exports.safeAsync = exports.RpcHelpers = void 0;
|
|
28
|
+
// Re-export all types from the types module
|
|
29
|
+
__exportStar(require("./types"), exports);
|
|
30
|
+
// Re-export all utilities
|
|
31
|
+
__exportStar(require("./utils"), exports);
|
|
32
|
+
var utils_1 = require("./utils");
|
|
33
|
+
Object.defineProperty(exports, "RpcHelpers", { enumerable: true, get: function () { return utils_1.RpcHelpers; } });
|
|
34
|
+
// Export async utilities
|
|
35
|
+
var utils_2 = require("./utils");
|
|
36
|
+
Object.defineProperty(exports, "safeAsync", { enumerable: true, get: function () { return utils_2.safeAsync; } });
|
|
37
|
+
Object.defineProperty(exports, "withLoadingState", { enumerable: true, get: function () { return utils_2.withLoadingState; } });
|
|
38
|
+
Object.defineProperty(exports, "safeParallel", { enumerable: true, get: function () { return utils_2.safeParallel; } });
|
|
39
|
+
Object.defineProperty(exports, "withTimeout", { enumerable: true, get: function () { return utils_2.withTimeout; } });
|
|
40
|
+
Object.defineProperty(exports, "withCache", { enumerable: true, get: function () { return utils_2.withCache; } });
|
|
41
|
+
Object.defineProperty(exports, "clearExpiredCache", { enumerable: true, get: function () { return utils_2.clearExpiredCache; } });
|
|
42
|
+
Object.defineProperty(exports, "debounceAsync", { enumerable: true, get: function () { return utils_2.debounceAsync; } });
|
|
43
|
+
// Export the most commonly used enums
|
|
44
|
+
var types_1 = require("./types");
|
|
45
|
+
// Business enums
|
|
46
|
+
Object.defineProperty(exports, "AuthStatus", { enumerable: true, get: function () { return types_1.AuthStatus; } });
|
|
47
|
+
Object.defineProperty(exports, "Chain", { enumerable: true, get: function () { return types_1.Chain; } });
|
|
48
|
+
Object.defineProperty(exports, "Theme", { enumerable: true, get: function () { return types_1.Theme; } });
|
|
49
|
+
Object.defineProperty(exports, "FontSize", { enumerable: true, get: function () { return types_1.FontSize; } });
|
|
50
|
+
Object.defineProperty(exports, "EmailComposeType", { enumerable: true, get: function () { return types_1.EmailComposeType; } });
|
|
51
|
+
Object.defineProperty(exports, "MobileView", { enumerable: true, get: function () { return types_1.MobileView; } });
|
|
52
|
+
Object.defineProperty(exports, "RequestStatus", { enumerable: true, get: function () { return types_1.RequestStatus; } });
|
|
53
|
+
Object.defineProperty(exports, "NotificationType", { enumerable: true, get: function () { return types_1.NotificationType; } });
|
|
54
|
+
// Blockchain enums
|
|
55
|
+
Object.defineProperty(exports, "MessageType", { enumerable: true, get: function () { return types_1.MessageType; } });
|
|
56
|
+
Object.defineProperty(exports, "TransactionStatus", { enumerable: true, get: function () { return types_1.TransactionStatus; } });
|
|
57
|
+
// Infrastructure enums
|
|
58
|
+
Object.defineProperty(exports, "AnalyticsEvent", { enumerable: true, get: function () { return types_1.AnalyticsEvent; } });
|
|
59
|
+
Object.defineProperty(exports, "ChainType", { enumerable: true, get: function () { return types_1.ChainType; } });
|
|
60
|
+
Object.defineProperty(exports, "WalletType", { enumerable: true, get: function () { return types_1.WalletType; } });
|
|
61
|
+
Object.defineProperty(exports, "StorageType", { enumerable: true, get: function () { return types_1.StorageType; } });
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @johnqh/types - Common TypeScript types for 0xmail.box projects
|
|
3
|
+
*
|
|
4
|
+
* This package contains all shared TypeScript definitions used across
|
|
5
|
+
* the 0xmail.box ecosystem including business logic types, blockchain
|
|
6
|
+
* types, configuration interfaces, infrastructure types, and utility functions.
|
|
7
|
+
*
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
export * from './types';
|
|
12
|
+
export * from './utils';
|
|
13
|
+
export type { AppConfig, FirebaseConfig, EnvironmentVariables, ChainConfig, Message, MessageRecipient, TransactionResult, AnalyticsEventProperties, AnalyticsService, NetworkClient, NetworkResponse, UINavigationService, BaseTransactionResponse, TransactionReceipt, MessageSendResponse, PreparedMessageSendResponse, ClaimableInfo, ClaimRevenueResponse, ClaimableAmountResponse, DomainRegistrationResponse, MailboxDelegationResponse, DelegationRejectionResponse, FeeInfo, FeeUpdateResponse, PauseInfo, PauseResponse, EmergencyDistributionResponse, EVMTransactionResponse, SolanaTransactionResponse, UnifiedClientResponse, BatchOperationResponse, MessageHistoryResponse, DelegationStatusResponse, ContractError, IndexerNameServiceAccount, IndexerWalletAccount, IndexerEmailAccountsResult, IndexerEmailAccountsResponse, IndexerRewardData, IndexerRewardHistoryData, IndexerRewardsResponse, IndexerAddressValidationData, IndexerAddressValidationResponse, IndexerDelegateData, IndexerDelegatedToResponse, IndexerDelegatedFromData, IndexerDelegatedFromResponse, IndexerNonceData, IndexerNonceResponse, IndexerEntitlementInfo, IndexerEntitlementData, IndexerEntitlementResponse, IndexerSignInMessageData, IndexerSignInMessageResponse, IndexerPointsData, IndexerPointsResponse, IndexerLeaderboardData, IndexerLeaderboardResponse, IndexerSiteStatsData, IndexerSiteStatsResponse, IndexerReferralCodeData, IndexerReferralCodeResponse, IndexerReferralConsumptionData, IndexerReferralStatsData, IndexerReferralStatsResponse, IndexerAuthenticationStatusData, IndexerAuthenticationStatusResponse, IndexerChainBlockInfo, IndexerBlockStatusData, IndexerBlockStatusResponse, IndexerNameServiceData, IndexerNameServiceResponse, IndexerNameResolutionData, IndexerNameResolutionResponse, IndexerErrorResponse, IndexerApiResponse, KYCApplication, VerificationResult, UserConsent, InitiateKYCRequest, InitiateKYCResponse, GetKYCStatusResponse, VerifyUserRequest, VerifyUserResponse, KYCVerificationLevel, KYCApplicationStatus, } from './types';
|
|
14
|
+
export type { BlockchainApis } from './utils';
|
|
15
|
+
export { RpcHelpers } from './utils';
|
|
16
|
+
export { safeAsync, withLoadingState, safeParallel, withTimeout, withCache, clearExpiredCache, debounceAsync, type AsyncResult, } from './utils';
|
|
17
|
+
export { AuthStatus, Chain, Theme, FontSize, EmailComposeType, MobileView, RequestStatus, NotificationType, MessageType, TransactionStatus, AnalyticsEvent, ChainType, WalletType, StorageType, } from './types';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAIxB,YAAY,EAEV,SAAS,EACT,cAAc,EACd,oBAAoB,EAGpB,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EAGjB,wBAAwB,EACxB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,mBAAmB,EAGnB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,aAAa,EACb,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,6BAA6B,EAC7B,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,aAAa,EAGb,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,4BAA4B,EAC5B,gCAAgC,EAChC,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,4BAA4B,EAC5B,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,EAC9B,wBAAwB,EACxB,4BAA4B,EAC5B,+BAA+B,EAC/B,mCAAmC,EACnC,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,6BAA6B,EAC7B,oBAAoB,EACpB,kBAAkB,EAGlB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,KAAK,WAAW,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAEL,UAAU,EACV,KAAK,EACL,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,gBAAgB,EAGhB,WAAW,EACX,iBAAiB,EAGjB,cAAc,EACd,SAAS,EACT,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAC"}
|