@sudobility/types 1.9.54 → 1.9.56
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/README.md +44 -280
- package/dist/index.js +28 -201
- package/dist/index.js.map +1 -1
- package/dist/types/blockchain/common.js +9 -16
- package/dist/types/blockchain/common.js.map +1 -1
- package/dist/types/blockchain/index.js +3 -17
- package/dist/types/blockchain/index.js.map +1 -1
- package/dist/types/blockchain/validation.js +6 -12
- package/dist/types/blockchain/validation.js.map +1 -1
- package/dist/types/business/enums.js +46 -49
- package/dist/types/business/enums.js.map +1 -1
- package/dist/types/business/wallet-status.js +10 -16
- package/dist/types/business/wallet-status.js.map +1 -1
- package/dist/types/common.js +1 -2
- package/dist/types/common.js.map +1 -1
- package/dist/types/config/app-config.js +1 -2
- package/dist/types/config/app-config.js.map +1 -1
- package/dist/types/config/environment.js +2 -5
- package/dist/types/config/environment.js.map +1 -1
- package/dist/types/consumables/index.js +1 -2
- package/dist/types/consumables/index.js.map +1 -1
- package/dist/types/entity/entity.js +6 -9
- package/dist/types/entity/entity.js.map +1 -1
- package/dist/types/entity/permissions.js +12 -17
- package/dist/types/entity/permissions.js.map +1 -1
- package/dist/types/entity/requests.js +1 -2
- package/dist/types/entity/requests.js.map +1 -1
- package/dist/types/entity/responses.js +1 -2
- package/dist/types/entity/responses.js.map +1 -1
- package/dist/types/infrastructure/analytics.js +3 -7
- package/dist/types/infrastructure/analytics.js.map +1 -1
- package/dist/types/infrastructure/api.js +5 -9
- package/dist/types/infrastructure/api.js.map +1 -1
- package/dist/types/infrastructure/firebase-user.js +1 -2
- package/dist/types/infrastructure/firebase-user.js.map +1 -1
- package/dist/types/infrastructure/navigation.js +1 -2
- package/dist/types/infrastructure/network.js +1 -4
- package/dist/types/infrastructure/network.js.map +1 -1
- package/dist/types/infrastructure/wallet.js +2 -5
- package/dist/types/infrastructure/wallet.js.map +1 -1
- package/dist/types/subscription/entitlements.js +1 -4
- package/dist/types/subscription/entitlements.js.map +1 -1
- package/dist/types/subscription/period.js +2 -5
- package/dist/types/subscription/period.js.map +1 -1
- package/dist/types/subscription/rate-limits.js +2 -5
- package/dist/types/subscription/rate-limits.js.map +1 -1
- package/dist/utils/async-helpers.js +7 -16
- package/dist/utils/async-helpers.js.map +1 -1
- package/dist/utils/auth/admin-emails.js +3 -8
- package/dist/utils/auth/admin-emails.js.map +1 -1
- package/dist/utils/auth/auth.js +14 -24
- package/dist/utils/auth/auth.js.map +1 -1
- package/dist/utils/blockchain/address.js +20 -31
- package/dist/utils/blockchain/address.js.map +1 -1
- package/dist/utils/blockchain/event-helpers.js +9 -20
- package/dist/utils/blockchain/event-helpers.js.map +1 -1
- package/dist/utils/constants/application.js +2 -20
- package/dist/utils/constants/application.js.map +1 -1
- package/dist/utils/constants/status-values.js +1 -4
- package/dist/utils/constants/status-values.js.map +1 -1
- package/dist/utils/formatting/currency.js +6 -11
- package/dist/utils/formatting/currency.js.map +1 -1
- package/dist/utils/formatting/date.js +7 -16
- package/dist/utils/formatting/date.js.map +1 -1
- package/dist/utils/formatting/string.js +16 -34
- package/dist/utils/formatting/string.js.map +1 -1
- package/dist/utils/logging/logger.js +2 -10
- package/dist/utils/logging/logger.js.map +1 -1
- package/dist/utils/url/url-params.js +1 -6
- package/dist/utils/url/url-params.js.map +1 -1
- package/dist/utils/validation/type-validation.js +27 -48
- package/dist/utils/validation/type-validation.js.map +1 -1
- package/dist/utils/validation/web3-username-validator.js +6 -10
- package/dist/utils/validation/web3-username-validator.js.map +1 -1
- package/package.json +3 -11
- package/dist/index.cjs +0 -243
- package/dist/types/blockchain/common.cjs +0 -127
- package/dist/types/blockchain/index.cjs +0 -30
- package/dist/types/blockchain/validation.cjs +0 -144
- package/dist/types/business/enums.cjs +0 -367
- package/dist/types/business/wallet-status.cjs +0 -38
- package/dist/types/common.cjs +0 -12
- package/dist/types/config/app-config.cjs +0 -6
- package/dist/types/config/environment.cjs +0 -24
- package/dist/types/consumables/index.cjs +0 -8
- package/dist/types/entity/entity.cjs +0 -51
- package/dist/types/entity/permissions.cjs +0 -93
- package/dist/types/entity/requests.cjs +0 -7
- package/dist/types/entity/responses.cjs +0 -7
- package/dist/types/infrastructure/analytics.cjs +0 -212
- package/dist/types/infrastructure/api.cjs +0 -43
- package/dist/types/infrastructure/firebase-user.cjs +0 -10
- package/dist/types/infrastructure/navigation.cjs +0 -3
- package/dist/types/infrastructure/network.cjs +0 -18
- package/dist/types/infrastructure/wallet.cjs +0 -37
- package/dist/types/subscription/entitlements.cjs +0 -14
- package/dist/types/subscription/period.cjs +0 -29
- package/dist/types/subscription/rate-limits.cjs +0 -20
- package/dist/utils/async-helpers.cjs +0 -244
- package/dist/utils/auth/admin-emails.cjs +0 -79
- package/dist/utils/auth/auth.cjs +0 -99
- package/dist/utils/blockchain/address.cjs +0 -225
- package/dist/utils/blockchain/event-helpers.cjs +0 -143
- package/dist/utils/constants/application.cjs +0 -152
- package/dist/utils/constants/status-values.cjs +0 -14
- package/dist/utils/formatting/currency.cjs +0 -39
- package/dist/utils/formatting/date.cjs +0 -197
- package/dist/utils/formatting/string.cjs +0 -326
- package/dist/utils/logging/logger.cjs +0 -92
- package/dist/utils/url/url-params.cjs +0 -128
- package/dist/utils/validation/type-validation.cjs +0 -250
- package/dist/utils/validation/web3-username-validator.cjs +0 -132
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Analytics types and interfaces
|
|
4
|
-
* Platform-agnostic analytics service interface for dependency injection
|
|
5
|
-
*
|
|
6
|
-
* @ai-context Core analytics interface for dependency injection
|
|
7
|
-
* @ai-pattern Service interface with comprehensive event tracking
|
|
8
|
-
* @ai-platform Cross-platform compatible (Web, React Native, Node.js)
|
|
9
|
-
* @ai-usage Implement this interface to create analytics services for Firebase, Mixpanel, etc.
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.AnalyticsEventBuilder = exports.AnalyticsEvent = void 0;
|
|
13
|
-
/**
|
|
14
|
-
* Standardized analytics events enumeration.
|
|
15
|
-
*
|
|
16
|
-
* Provides consistent event naming for common application analytics scenarios.
|
|
17
|
-
* Organized by functional categories for better code organization and analytics reporting.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* // Use predefined events for consistency
|
|
22
|
-
* analytics.track(AnalyticsEvent.USER_LOGIN, { method: 'email' });
|
|
23
|
-
* analytics.track(AnalyticsEvent.EMAIL_OPENED, { email_id: 'msg-123' });
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
var AnalyticsEvent;
|
|
27
|
-
(function (AnalyticsEvent) {
|
|
28
|
-
/** User successfully logged into the application */
|
|
29
|
-
AnalyticsEvent["USER_LOGIN"] = "user_login";
|
|
30
|
-
/** User logged out of the application */
|
|
31
|
-
AnalyticsEvent["USER_LOGOUT"] = "user_logout";
|
|
32
|
-
/** New user completed account registration */
|
|
33
|
-
AnalyticsEvent["USER_SIGNUP"] = "user_signup";
|
|
34
|
-
/** User sent an email message */
|
|
35
|
-
AnalyticsEvent["EMAIL_SENT"] = "email_sent";
|
|
36
|
-
/** User received a new email message */
|
|
37
|
-
AnalyticsEvent["EMAIL_RECEIVED"] = "email_received";
|
|
38
|
-
/** User opened an email message (consolidated from EMAIL_OPENED and EMAIL_OPEN) */
|
|
39
|
-
AnalyticsEvent["EMAIL_OPENED"] = "email_opened";
|
|
40
|
-
/** User replied to an email message */
|
|
41
|
-
AnalyticsEvent["EMAIL_REPLY"] = "email_reply";
|
|
42
|
-
/** User forwarded an email message */
|
|
43
|
-
AnalyticsEvent["EMAIL_FORWARD"] = "email_forward";
|
|
44
|
-
/** User deleted an email message */
|
|
45
|
-
AnalyticsEvent["EMAIL_DELETE"] = "email_delete";
|
|
46
|
-
/** User starred an email message */
|
|
47
|
-
AnalyticsEvent["EMAIL_STAR"] = "email_star";
|
|
48
|
-
/** User composed a new email */
|
|
49
|
-
AnalyticsEvent["EMAIL_COMPOSE"] = "email_compose";
|
|
50
|
-
/** User clicked a link within an email */
|
|
51
|
-
AnalyticsEvent["EMAIL_CLICKED"] = "email_clicked";
|
|
52
|
-
/** User viewed a web page */
|
|
53
|
-
AnalyticsEvent["PAGE_VIEW"] = "page_view";
|
|
54
|
-
/** User viewed a mobile screen */
|
|
55
|
-
AnalyticsEvent["SCREEN_VIEW"] = "screen_view";
|
|
56
|
-
/** User switched between folders */
|
|
57
|
-
AnalyticsEvent["FOLDER_SWITCH"] = "folder_switch";
|
|
58
|
-
/** User viewed subscription options */
|
|
59
|
-
AnalyticsEvent["SUBSCRIPTION_VIEW"] = "subscription_view";
|
|
60
|
-
/** User purchased a subscription */
|
|
61
|
-
AnalyticsEvent["SUBSCRIPTION_PURCHASE"] = "subscription_purchase";
|
|
62
|
-
/** User cancelled a subscription */
|
|
63
|
-
AnalyticsEvent["SUBSCRIPTION_CANCEL"] = "subscription_cancel";
|
|
64
|
-
/** User performed a search */
|
|
65
|
-
AnalyticsEvent["SEARCH_PERFORMED"] = "search_performed";
|
|
66
|
-
/** User changed application settings */
|
|
67
|
-
AnalyticsEvent["SETTINGS_CHANGED"] = "settings_changed";
|
|
68
|
-
/** An application error occurred */
|
|
69
|
-
AnalyticsEvent["ERROR_OCCURRED"] = "error_occurred";
|
|
70
|
-
/** User viewed an A/B test variant */
|
|
71
|
-
AnalyticsEvent["AB_TEST_VIEWED"] = "ab_test_viewed";
|
|
72
|
-
/** User converted on an A/B test */
|
|
73
|
-
AnalyticsEvent["AB_TEST_CONVERTED"] = "ab_test_converted";
|
|
74
|
-
/** Custom application-specific event */
|
|
75
|
-
AnalyticsEvent["CUSTOM_EVENT"] = "custom_event";
|
|
76
|
-
})(AnalyticsEvent || (exports.AnalyticsEvent = AnalyticsEvent = {}));
|
|
77
|
-
/**
|
|
78
|
-
* Utility class for building standardized analytics event properties.
|
|
79
|
-
*
|
|
80
|
-
* Provides static methods to create consistent event property objects
|
|
81
|
-
* for common analytics scenarios. Ensures proper naming conventions
|
|
82
|
-
* and includes standard fields like timestamps.
|
|
83
|
-
*
|
|
84
|
-
* @ai-utility-class Event property builders
|
|
85
|
-
* @ai-pattern Factory pattern for event properties
|
|
86
|
-
* @ai-standardization Ensures consistent event property naming
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* ```typescript
|
|
90
|
-
* // Use builders to create standardized event properties
|
|
91
|
-
* const properties = AnalyticsEventBuilder.emailAction('read', 'email-123', 'inbox');
|
|
92
|
-
* analytics.trackEvent(AnalyticsEvent.EMAIL_OPENED, properties);
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
class AnalyticsEventBuilder {
|
|
96
|
-
/**
|
|
97
|
-
* Build properties for email action events.
|
|
98
|
-
*
|
|
99
|
-
* @param action Email action performed (read, sent, archived, etc.)
|
|
100
|
-
* @param emailId Unique identifier for the email
|
|
101
|
-
* @param folder Email folder context (inbox, sent, trash, etc.)
|
|
102
|
-
* @returns Standardized event properties object
|
|
103
|
-
*
|
|
104
|
-
* @ai-builder Email action properties
|
|
105
|
-
* @ai-standardization Consistent email event tracking
|
|
106
|
-
*/
|
|
107
|
-
static emailAction(action, emailId, folder) {
|
|
108
|
-
return {
|
|
109
|
-
action,
|
|
110
|
-
email_id: emailId,
|
|
111
|
-
folder,
|
|
112
|
-
timestamp: Date.now(),
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Build properties for page/screen view events.
|
|
117
|
-
*
|
|
118
|
-
* @param pageName Human-readable page name
|
|
119
|
-
* @param pagePath URL path or screen identifier
|
|
120
|
-
* @returns Standardized page view properties
|
|
121
|
-
*
|
|
122
|
-
* @ai-builder Navigation tracking properties
|
|
123
|
-
* @ai-cross-platform Works for web pages and mobile screens
|
|
124
|
-
*/
|
|
125
|
-
static pageView(pageName, pagePath) {
|
|
126
|
-
return {
|
|
127
|
-
page_name: pageName,
|
|
128
|
-
page_path: pagePath,
|
|
129
|
-
timestamp: Date.now(),
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Build properties for error tracking events.
|
|
134
|
-
*
|
|
135
|
-
* @param errorType Category of error (network, validation, runtime, etc.)
|
|
136
|
-
* @param errorMessage Error message or description
|
|
137
|
-
* @param pageName Page/screen where error occurred
|
|
138
|
-
* @returns Standardized error event properties
|
|
139
|
-
*
|
|
140
|
-
* @ai-builder Error tracking properties
|
|
141
|
-
* @ai-debugging Consistent error event structure
|
|
142
|
-
*/
|
|
143
|
-
static error(errorType, errorMessage, pageName) {
|
|
144
|
-
return {
|
|
145
|
-
error_type: errorType,
|
|
146
|
-
error_message: errorMessage,
|
|
147
|
-
page_name: pageName,
|
|
148
|
-
timestamp: Date.now(),
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Build properties for subscription/revenue events.
|
|
153
|
-
*
|
|
154
|
-
* @param action Subscription action (subscribe, upgrade, cancel, etc.)
|
|
155
|
-
* @param planType Subscription plan type (free, premium, pro, etc.)
|
|
156
|
-
* @param amount Monetary amount (for revenue tracking)
|
|
157
|
-
* @param currency Currency code (USD, EUR, etc.)
|
|
158
|
-
* @returns Standardized subscription event properties
|
|
159
|
-
*
|
|
160
|
-
* @ai-builder Revenue tracking properties
|
|
161
|
-
* @ai-business-metrics Subscription and revenue analytics
|
|
162
|
-
*/
|
|
163
|
-
static subscription(action, planType, amount, currency) {
|
|
164
|
-
return {
|
|
165
|
-
action,
|
|
166
|
-
plan_type: planType,
|
|
167
|
-
amount,
|
|
168
|
-
currency,
|
|
169
|
-
timestamp: Date.now(),
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Build properties for user engagement events.
|
|
174
|
-
*
|
|
175
|
-
* @param feature Feature name or component identifier
|
|
176
|
-
* @param interaction Type of interaction (click, scroll, hover, etc.)
|
|
177
|
-
* @param duration Time spent on interaction (milliseconds)
|
|
178
|
-
* @returns Standardized engagement event properties
|
|
179
|
-
*
|
|
180
|
-
* @ai-builder User engagement properties
|
|
181
|
-
* @ai-ux-analytics User experience and interaction tracking
|
|
182
|
-
*/
|
|
183
|
-
static engagement(feature, interaction, duration) {
|
|
184
|
-
return {
|
|
185
|
-
feature,
|
|
186
|
-
interaction,
|
|
187
|
-
duration,
|
|
188
|
-
timestamp: Date.now(),
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Build properties for performance monitoring events.
|
|
193
|
-
*
|
|
194
|
-
* @param metric Performance metric name (load_time, api_response, etc.)
|
|
195
|
-
* @param value Metric value (usually in milliseconds)
|
|
196
|
-
* @param context Additional context about the performance event
|
|
197
|
-
* @returns Standardized performance event properties
|
|
198
|
-
*
|
|
199
|
-
* @ai-builder Performance monitoring properties
|
|
200
|
-
* @ai-performance Application performance tracking
|
|
201
|
-
*/
|
|
202
|
-
static performance(metric, value, context) {
|
|
203
|
-
return {
|
|
204
|
-
metric,
|
|
205
|
-
value,
|
|
206
|
-
context,
|
|
207
|
-
timestamp: Date.now(),
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
exports.AnalyticsEventBuilder = AnalyticsEventBuilder;
|
|
212
|
-
//# sourceMappingURL=analytics.js.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Core API Type Definitions
|
|
4
|
-
* @description Centralized type definitions for API requests/responses and data structures
|
|
5
|
-
* @version 2.0.0
|
|
6
|
-
*
|
|
7
|
-
* This file provides comprehensive type safety for:
|
|
8
|
-
* - API request/response interfaces
|
|
9
|
-
* - Multi-chain data structures
|
|
10
|
-
* - Database entity interfaces
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.ProcessedEventName = exports.ContractType = exports.ChainType = void 0;
|
|
14
|
-
// Re-export ChainType from business enums
|
|
15
|
-
var enums_1 = require("../business/enums");
|
|
16
|
-
Object.defineProperty(exports, "ChainType", { enumerable: true, get: function () { return enums_1.ChainType; } });
|
|
17
|
-
/**
|
|
18
|
-
* Contract types supported by the indexer
|
|
19
|
-
*/
|
|
20
|
-
var ContractType;
|
|
21
|
-
(function (ContractType) {
|
|
22
|
-
ContractType["Mailer"] = "Mailer";
|
|
23
|
-
ContractType["MailService"] = "MailService";
|
|
24
|
-
})(ContractType || (exports.ContractType = ContractType = {}));
|
|
25
|
-
/**
|
|
26
|
-
* Event names processed by the indexer
|
|
27
|
-
*/
|
|
28
|
-
var ProcessedEventName;
|
|
29
|
-
(function (ProcessedEventName) {
|
|
30
|
-
ProcessedEventName["MailSent"] = "MailSent";
|
|
31
|
-
ProcessedEventName["PreparedMailSent"] = "PreparedMailSent";
|
|
32
|
-
ProcessedEventName["DelegationSet"] = "DelegationSet";
|
|
33
|
-
ProcessedEventName["DelegationCleared"] = "DelegationCleared";
|
|
34
|
-
ProcessedEventName["DomainRegistered"] = "DomainRegistered";
|
|
35
|
-
ProcessedEventName["DomainExtended"] = "DomainExtended";
|
|
36
|
-
ProcessedEventName["DomainReleased"] = "DomainReleased";
|
|
37
|
-
ProcessedEventName["FeeUpdated"] = "FeeUpdated";
|
|
38
|
-
ProcessedEventName["SharesRecorded"] = "SharesRecorded";
|
|
39
|
-
ProcessedEventName["RecipientClaimed"] = "RecipientClaimed";
|
|
40
|
-
ProcessedEventName["OwnerClaimed"] = "OwnerClaimed";
|
|
41
|
-
ProcessedEventName["ExpiredSharesClaimed"] = "ExpiredSharesClaimed";
|
|
42
|
-
})(ProcessedEventName || (exports.ProcessedEventName = ProcessedEventName = {}));
|
|
43
|
-
//# sourceMappingURL=api.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Firebase user info types shared between frontend and backend.
|
|
4
|
-
*
|
|
5
|
-
* Used by:
|
|
6
|
-
* - @sudobility/auth_service (backend) - getUserInfo helper
|
|
7
|
-
* - @sudobility/auth_lib (frontend) - useSiteAdmin hook
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
//# sourceMappingURL=firebase-user.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Network client interface for dependency injection
|
|
4
|
-
* Platform-agnostic HTTP client interface
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.NetworkError = void 0;
|
|
8
|
-
class NetworkError extends Error {
|
|
9
|
-
constructor(message, status, statusText, response) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.name = 'NetworkError';
|
|
12
|
-
this.status = status;
|
|
13
|
-
this.statusText = statusText;
|
|
14
|
-
this.response = response;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.NetworkError = NetworkError;
|
|
18
|
-
//# sourceMappingURL=network.js.map
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Wallet and blockchain types
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.WalletType = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Cryptocurrency wallet type enumeration.
|
|
9
|
-
*
|
|
10
|
-
* Identifies different wallet providers and connection methods for blockchain interactions.
|
|
11
|
-
* Supports both browser extension wallets and protocol-based connections.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // Wallet-specific connection logic
|
|
16
|
-
* switch (walletType) {
|
|
17
|
-
* case WalletType.METAMASK:
|
|
18
|
-
* return connectMetaMask();
|
|
19
|
-
* case WalletType.WALLETCONNECT:
|
|
20
|
-
* return connectWalletConnect();
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
var WalletType;
|
|
25
|
-
(function (WalletType) {
|
|
26
|
-
/** MetaMask browser extension wallet */
|
|
27
|
-
WalletType["METAMASK"] = "metamask";
|
|
28
|
-
/** Phantom wallet (primarily for Solana) */
|
|
29
|
-
WalletType["PHANTOM"] = "phantom";
|
|
30
|
-
/** Coinbase Wallet */
|
|
31
|
-
WalletType["COINBASE"] = "coinbase";
|
|
32
|
-
/** WalletConnect protocol for mobile wallets */
|
|
33
|
-
WalletType["WALLETCONNECT"] = "walletconnect";
|
|
34
|
-
/** Generic injected wallet provider */
|
|
35
|
-
WalletType["INJECTED"] = "injected";
|
|
36
|
-
})(WalletType || (exports.WalletType = WalletType = {}));
|
|
37
|
-
//# sourceMappingURL=wallet.js.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Subscription Entitlement Constants
|
|
4
|
-
*
|
|
5
|
-
* Shared constants for subscription entitlement management.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.NONE_ENTITLEMENT = void 0;
|
|
9
|
-
/**
|
|
10
|
-
* The special entitlement name for users without any subscription.
|
|
11
|
-
* This is returned when a user has no active entitlements in RevenueCat.
|
|
12
|
-
*/
|
|
13
|
-
exports.NONE_ENTITLEMENT = "none";
|
|
14
|
-
//# sourceMappingURL=entitlements.js.map
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Subscription Period Types
|
|
4
|
-
*
|
|
5
|
-
* Standard subscription periods and utilities for period comparison.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ALL_PERIODS = exports.PERIOD_RANKS = void 0;
|
|
9
|
-
/**
|
|
10
|
-
* Period ranking for comparison (higher = longer)
|
|
11
|
-
*/
|
|
12
|
-
exports.PERIOD_RANKS = {
|
|
13
|
-
weekly: 1,
|
|
14
|
-
monthly: 2,
|
|
15
|
-
quarterly: 3,
|
|
16
|
-
yearly: 4,
|
|
17
|
-
lifetime: 5,
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* All supported periods in order
|
|
21
|
-
*/
|
|
22
|
-
exports.ALL_PERIODS = [
|
|
23
|
-
'weekly',
|
|
24
|
-
'monthly',
|
|
25
|
-
'quarterly',
|
|
26
|
-
'yearly',
|
|
27
|
-
'lifetime',
|
|
28
|
-
];
|
|
29
|
-
//# sourceMappingURL=period.js.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Rate Limit Type Definitions
|
|
4
|
-
* @description Types for rate limiting endpoints across sudojo_api, shapeshyft_api, and whisperly_api
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.RateLimitPeriodType = void 0;
|
|
8
|
-
// ========================================
|
|
9
|
-
// RATE LIMIT HISTORY TYPES
|
|
10
|
-
// ========================================
|
|
11
|
-
/**
|
|
12
|
-
* Valid period types for rate limit history.
|
|
13
|
-
*/
|
|
14
|
-
var RateLimitPeriodType;
|
|
15
|
-
(function (RateLimitPeriodType) {
|
|
16
|
-
RateLimitPeriodType["HOUR"] = "hour";
|
|
17
|
-
RateLimitPeriodType["DAY"] = "day";
|
|
18
|
-
RateLimitPeriodType["MONTH"] = "month";
|
|
19
|
-
})(RateLimitPeriodType || (exports.RateLimitPeriodType = RateLimitPeriodType = {}));
|
|
20
|
-
//# sourceMappingURL=rate-limits.js.map
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Common async operation patterns and helpers.
|
|
4
|
-
* Reduces boilerplate code for common async operations.
|
|
5
|
-
*
|
|
6
|
-
* @since 1.0.0
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.debounceAsync = exports.clearExpiredCache = exports.withCache = exports.withTimeout = exports.safeParallel = exports.withLoadingState = exports.safeAsync = void 0;
|
|
10
|
-
const logger_1 = require("./logging/logger");
|
|
11
|
-
/**
|
|
12
|
-
* Safely execute an async operation with error handling.
|
|
13
|
-
* Returns a result object instead of throwing.
|
|
14
|
-
*
|
|
15
|
-
* @template T - The success data type
|
|
16
|
-
* @param operation - Async function to execute
|
|
17
|
-
* @param context - Optional context string for logging
|
|
18
|
-
* @returns A promise resolving to an {@link AsyncResult}
|
|
19
|
-
* @since 1.0.0
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* const result = await safeAsync(() => fetchUser(id), 'fetchUser');
|
|
24
|
-
* if (result.success) {
|
|
25
|
-
* console.log(result.data);
|
|
26
|
-
* } else {
|
|
27
|
-
* console.error(result.error?.message);
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
const safeAsync = async (operation, context) => {
|
|
32
|
-
try {
|
|
33
|
-
const data = await operation();
|
|
34
|
-
return { data, success: true };
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
const errorObj = error instanceof Error ? error : new Error(String(error));
|
|
38
|
-
logger_1.logger.error(`Async operation failed: ${errorObj.message}`, context, error);
|
|
39
|
-
return { error: errorObj, success: false };
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
exports.safeAsync = safeAsync;
|
|
43
|
-
/**
|
|
44
|
-
* Execute async operation with loading state tracking.
|
|
45
|
-
* Manages `setLoading` and `setError` callbacks automatically.
|
|
46
|
-
*
|
|
47
|
-
* @template T - The success data type
|
|
48
|
-
* @param operation - Async function to execute
|
|
49
|
-
* @param setLoading - Callback to update loading state
|
|
50
|
-
* @param setError - Callback to update error state
|
|
51
|
-
* @param context - Optional context string for logging
|
|
52
|
-
* @returns The operation result, or undefined on error
|
|
53
|
-
* @since 1.0.0
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```typescript
|
|
57
|
-
* const data = await withLoadingState(
|
|
58
|
-
* () => api.getUsers(),
|
|
59
|
-
* setIsLoading,
|
|
60
|
-
* setErrorMsg,
|
|
61
|
-
* 'getUsers'
|
|
62
|
-
* );
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
const withLoadingState = async (operation, setLoading, setError, context) => {
|
|
66
|
-
setLoading(true);
|
|
67
|
-
setError(null);
|
|
68
|
-
try {
|
|
69
|
-
const result = await operation();
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
74
|
-
setError(errorMessage);
|
|
75
|
-
logger_1.logger.error(`Operation failed: ${errorMessage}`, context, error);
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
finally {
|
|
79
|
-
setLoading(false);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
exports.withLoadingState = withLoadingState;
|
|
83
|
-
/**
|
|
84
|
-
* Execute multiple async operations in parallel with error handling.
|
|
85
|
-
* All operations run concurrently via `Promise.all`.
|
|
86
|
-
*
|
|
87
|
-
* @template T - Tuple of result types
|
|
88
|
-
* @param operations - Array of async functions to execute in parallel
|
|
89
|
-
* @param context - Optional context string for logging
|
|
90
|
-
* @returns A promise resolving to an {@link AsyncResult} of the tuple
|
|
91
|
-
* @since 1.0.0
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* ```typescript
|
|
95
|
-
* const result = await safeParallel(
|
|
96
|
-
* [() => fetchUser(1), () => fetchPosts(1)] as const,
|
|
97
|
-
* 'loadProfile'
|
|
98
|
-
* );
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
const safeParallel = async (operations, context) => {
|
|
102
|
-
try {
|
|
103
|
-
const results = await Promise.all(operations.map(op => op()));
|
|
104
|
-
return { data: results, success: true };
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
const errorObj = error instanceof Error ? error : new Error(String(error));
|
|
108
|
-
logger_1.logger.error(`Parallel operations failed: ${errorObj.message}`, context, error);
|
|
109
|
-
return { error: errorObj, success: false };
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
exports.safeParallel = safeParallel;
|
|
113
|
-
/**
|
|
114
|
-
* Execute async operation with a timeout.
|
|
115
|
-
* Rejects if the operation does not complete within `timeoutMs`.
|
|
116
|
-
*
|
|
117
|
-
* @template T - The success data type
|
|
118
|
-
* @param operation - Async function to execute
|
|
119
|
-
* @param timeoutMs - Maximum time in milliseconds
|
|
120
|
-
* @param context - Optional context string for logging
|
|
121
|
-
* @returns The operation result
|
|
122
|
-
* @throws Error if the operation times out
|
|
123
|
-
* @since 1.0.0
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```typescript
|
|
127
|
-
* const data = await withTimeout(
|
|
128
|
-
* () => fetch('/api/data').then((r) => r.json()),
|
|
129
|
-
* 5000,
|
|
130
|
-
* 'fetchData'
|
|
131
|
-
* );
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
const withTimeout = async (operation, timeoutMs, context) => {
|
|
135
|
-
const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`Operation timed out after ${timeoutMs}ms`)), timeoutMs));
|
|
136
|
-
try {
|
|
137
|
-
return await Promise.race([operation(), timeoutPromise]);
|
|
138
|
-
}
|
|
139
|
-
catch (error) {
|
|
140
|
-
logger_1.logger.error(`Timeout operation failed`, context, error);
|
|
141
|
-
throw error;
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
exports.withTimeout = withTimeout;
|
|
145
|
-
/**
|
|
146
|
-
* In-memory cache for {@link withCache}.
|
|
147
|
-
*/
|
|
148
|
-
const cache = new Map();
|
|
149
|
-
/**
|
|
150
|
-
* Cache async operation results with TTL (time-to-live).
|
|
151
|
-
* Returns cached data if still valid; otherwise executes the operation
|
|
152
|
-
* and stores the result.
|
|
153
|
-
*
|
|
154
|
-
* @template T - The cached data type
|
|
155
|
-
* @param key - Unique cache key
|
|
156
|
-
* @param operation - Async function whose result is cached
|
|
157
|
-
* @param ttlMs - Cache TTL in milliseconds (default: 5 minutes)
|
|
158
|
-
* @returns The cached or freshly fetched data
|
|
159
|
-
* @since 1.0.0
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```typescript
|
|
163
|
-
* const user = await withCache(
|
|
164
|
-
* `user-${id}`,
|
|
165
|
-
* () => api.getUser(id),
|
|
166
|
-
* 60_000 // 1 minute
|
|
167
|
-
* );
|
|
168
|
-
* ```
|
|
169
|
-
*/
|
|
170
|
-
const withCache = async (key, operation, ttlMs = 5 * 60 * 1000 // 5 minutes default
|
|
171
|
-
) => {
|
|
172
|
-
const cached = cache.get(key);
|
|
173
|
-
const now = Date.now();
|
|
174
|
-
if (cached && now - cached.timestamp < cached.ttl) {
|
|
175
|
-
return cached.data;
|
|
176
|
-
}
|
|
177
|
-
const result = await operation();
|
|
178
|
-
cache.set(key, { data: result, timestamp: now, ttl: ttlMs });
|
|
179
|
-
return result;
|
|
180
|
-
};
|
|
181
|
-
exports.withCache = withCache;
|
|
182
|
-
/**
|
|
183
|
-
* Clear expired cache entries from the in-memory cache.
|
|
184
|
-
* @since 1.0.0
|
|
185
|
-
*/
|
|
186
|
-
const clearExpiredCache = () => {
|
|
187
|
-
const now = Date.now();
|
|
188
|
-
for (const [key, entry] of cache.entries()) {
|
|
189
|
-
if (now - entry.timestamp >= entry.ttl) {
|
|
190
|
-
cache.delete(key);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
exports.clearExpiredCache = clearExpiredCache;
|
|
195
|
-
/**
|
|
196
|
-
* Active debounce timers keyed by operation key.
|
|
197
|
-
*/
|
|
198
|
-
const debounceMap = new Map();
|
|
199
|
-
/**
|
|
200
|
-
* Debounce async function calls by key.
|
|
201
|
-
* Only the last call within the delay window will execute.
|
|
202
|
-
*
|
|
203
|
-
* @template T - Argument types
|
|
204
|
-
* @template R - Return type
|
|
205
|
-
* @param fn - The async function to debounce
|
|
206
|
-
* @param delay - Debounce delay in milliseconds
|
|
207
|
-
* @param key - Unique key identifying this debounced operation
|
|
208
|
-
* @returns A debounced version of `fn`
|
|
209
|
-
* @since 1.0.0
|
|
210
|
-
*
|
|
211
|
-
* @example
|
|
212
|
-
* ```typescript
|
|
213
|
-
* const debouncedSearch = debounceAsync(
|
|
214
|
-
* (query: string) => api.search(query),
|
|
215
|
-
* 300,
|
|
216
|
-
* 'search'
|
|
217
|
-
* );
|
|
218
|
-
* await debouncedSearch('hello');
|
|
219
|
-
* ```
|
|
220
|
-
*/
|
|
221
|
-
const debounceAsync = (fn, delay, key) => {
|
|
222
|
-
return (...args) => {
|
|
223
|
-
return new Promise(resolve => {
|
|
224
|
-
const existingTimeout = debounceMap.get(key);
|
|
225
|
-
if (existingTimeout) {
|
|
226
|
-
clearTimeout(existingTimeout);
|
|
227
|
-
}
|
|
228
|
-
const timeout = setTimeout(async () => {
|
|
229
|
-
debounceMap.delete(key);
|
|
230
|
-
try {
|
|
231
|
-
const result = await fn(...args);
|
|
232
|
-
resolve(result);
|
|
233
|
-
}
|
|
234
|
-
catch (error) {
|
|
235
|
-
logger_1.logger.error(`Debounced operation failed`, key, error);
|
|
236
|
-
resolve(undefined);
|
|
237
|
-
}
|
|
238
|
-
}, delay);
|
|
239
|
-
debounceMap.set(key, timeout);
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
exports.debounceAsync = debounceAsync;
|
|
244
|
-
//# sourceMappingURL=async-helpers.js.map
|