@sudobility/types 1.9.55 → 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../src/types/entity/responses.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../src/types/entity/responses.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Analytics types and interfaces
|
|
4
3
|
* Platform-agnostic analytics service interface for dependency injection
|
|
@@ -8,8 +7,6 @@
|
|
|
8
7
|
* @ai-platform Cross-platform compatible (Web, React Native, Node.js)
|
|
9
8
|
* @ai-usage Implement this interface to create analytics services for Firebase, Mixpanel, etc.
|
|
10
9
|
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.AnalyticsEventBuilder = exports.AnalyticsEvent = void 0;
|
|
13
10
|
/**
|
|
14
11
|
* Standardized analytics events enumeration.
|
|
15
12
|
*
|
|
@@ -23,7 +20,7 @@ exports.AnalyticsEventBuilder = exports.AnalyticsEvent = void 0;
|
|
|
23
20
|
* analytics.track(AnalyticsEvent.EMAIL_OPENED, { email_id: 'msg-123' });
|
|
24
21
|
* ```
|
|
25
22
|
*/
|
|
26
|
-
var AnalyticsEvent;
|
|
23
|
+
export var AnalyticsEvent;
|
|
27
24
|
(function (AnalyticsEvent) {
|
|
28
25
|
/** User successfully logged into the application */
|
|
29
26
|
AnalyticsEvent["USER_LOGIN"] = "user_login";
|
|
@@ -73,7 +70,7 @@ var AnalyticsEvent;
|
|
|
73
70
|
AnalyticsEvent["AB_TEST_CONVERTED"] = "ab_test_converted";
|
|
74
71
|
/** Custom application-specific event */
|
|
75
72
|
AnalyticsEvent["CUSTOM_EVENT"] = "custom_event";
|
|
76
|
-
})(AnalyticsEvent || (
|
|
73
|
+
})(AnalyticsEvent || (AnalyticsEvent = {}));
|
|
77
74
|
/**
|
|
78
75
|
* Utility class for building standardized analytics event properties.
|
|
79
76
|
*
|
|
@@ -92,7 +89,7 @@ var AnalyticsEvent;
|
|
|
92
89
|
* analytics.trackEvent(AnalyticsEvent.EMAIL_OPENED, properties);
|
|
93
90
|
* ```
|
|
94
91
|
*/
|
|
95
|
-
class AnalyticsEventBuilder {
|
|
92
|
+
export class AnalyticsEventBuilder {
|
|
96
93
|
/**
|
|
97
94
|
* Build properties for email action events.
|
|
98
95
|
*
|
|
@@ -208,5 +205,4 @@ class AnalyticsEventBuilder {
|
|
|
208
205
|
};
|
|
209
206
|
}
|
|
210
207
|
}
|
|
211
|
-
exports.AnalyticsEventBuilder = AnalyticsEventBuilder;
|
|
212
208
|
//# sourceMappingURL=analytics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/types/infrastructure/analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/types/infrastructure/analytics.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAeH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAN,IAAY,cAsDX;AAtDD,WAAY,cAAc;IACxB,oDAAoD;IACpD,2CAAyB,CAAA;IACzB,yCAAyC;IACzC,6CAA2B,CAAA;IAC3B,8CAA8C;IAC9C,6CAA2B,CAAA;IAE3B,iCAAiC;IACjC,2CAAyB,CAAA;IACzB,wCAAwC;IACxC,mDAAiC,CAAA;IACjC,mFAAmF;IACnF,+CAA6B,CAAA;IAC7B,uCAAuC;IACvC,6CAA2B,CAAA;IAC3B,sCAAsC;IACtC,iDAA+B,CAAA;IAC/B,oCAAoC;IACpC,+CAA6B,CAAA;IAC7B,oCAAoC;IACpC,2CAAyB,CAAA;IACzB,gCAAgC;IAChC,iDAA+B,CAAA;IAC/B,0CAA0C;IAC1C,iDAA+B,CAAA;IAE/B,6BAA6B;IAC7B,yCAAuB,CAAA;IACvB,kCAAkC;IAClC,6CAA2B,CAAA;IAC3B,oCAAoC;IACpC,iDAA+B,CAAA;IAE/B,uCAAuC;IACvC,yDAAuC,CAAA;IACvC,oCAAoC;IACpC,iEAA+C,CAAA;IAC/C,oCAAoC;IACpC,6DAA2C,CAAA;IAE3C,8BAA8B;IAC9B,uDAAqC,CAAA;IACrC,wCAAwC;IACxC,uDAAqC,CAAA;IACrC,oCAAoC;IACpC,mDAAiC,CAAA;IACjC,sCAAsC;IACtC,mDAAiC,CAAA;IACjC,oCAAoC;IACpC,yDAAuC,CAAA;IAEvC,wCAAwC;IACxC,+CAA6B,CAAA;AAC/B,CAAC,EAtDW,cAAc,KAAd,cAAc,QAsDzB;AAyUD;;;;;;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AAO;YACP,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @fileoverview Core API Type Definitions
|
|
4
3
|
* @description Centralized type definitions for API requests/responses and data structures
|
|
@@ -9,23 +8,20 @@
|
|
|
9
8
|
* - Multi-chain data structures
|
|
10
9
|
* - Database entity interfaces
|
|
11
10
|
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.ProcessedEventName = exports.ContractType = exports.ChainType = void 0;
|
|
14
11
|
// Re-export ChainType from business enums
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(exports, "ChainType", { enumerable: true, get: function () { return enums_1.ChainType; } });
|
|
12
|
+
export { ChainType } from '../business/enums';
|
|
17
13
|
/**
|
|
18
14
|
* Contract types supported by the indexer
|
|
19
15
|
*/
|
|
20
|
-
var ContractType;
|
|
16
|
+
export var ContractType;
|
|
21
17
|
(function (ContractType) {
|
|
22
18
|
ContractType["Mailer"] = "Mailer";
|
|
23
19
|
ContractType["MailService"] = "MailService";
|
|
24
|
-
})(ContractType || (
|
|
20
|
+
})(ContractType || (ContractType = {}));
|
|
25
21
|
/**
|
|
26
22
|
* Event names processed by the indexer
|
|
27
23
|
*/
|
|
28
|
-
var ProcessedEventName;
|
|
24
|
+
export var ProcessedEventName;
|
|
29
25
|
(function (ProcessedEventName) {
|
|
30
26
|
ProcessedEventName["MailSent"] = "MailSent";
|
|
31
27
|
ProcessedEventName["PreparedMailSent"] = "PreparedMailSent";
|
|
@@ -39,5 +35,5 @@ var ProcessedEventName;
|
|
|
39
35
|
ProcessedEventName["RecipientClaimed"] = "RecipientClaimed";
|
|
40
36
|
ProcessedEventName["OwnerClaimed"] = "OwnerClaimed";
|
|
41
37
|
ProcessedEventName["ExpiredSharesClaimed"] = "ExpiredSharesClaimed";
|
|
42
|
-
})(ProcessedEventName || (
|
|
38
|
+
})(ProcessedEventName || (ProcessedEventName = {}));
|
|
43
39
|
//# sourceMappingURL=api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/types/infrastructure/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/types/infrastructure/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,0CAA0C;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AA0L9C;;GAEG;AACH,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,2CAA2B,CAAA;AAC7B,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAaX;AAbD,WAAY,kBAAkB;IAC5B,2CAAqB,CAAA;IACrB,2DAAqC,CAAA;IACrC,qDAA+B,CAAA;IAC/B,6DAAuC,CAAA;IACvC,2DAAqC,CAAA;IACrC,uDAAiC,CAAA;IACjC,uDAAiC,CAAA;IACjC,+CAAyB,CAAA;IACzB,uDAAiC,CAAA;IACjC,2DAAqC,CAAA;IACrC,mDAA6B,CAAA;IAC7B,mEAA6C,CAAA;AAC/C,CAAC,EAbW,kBAAkB,KAAlB,kBAAkB,QAa7B"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @fileoverview Firebase user info types shared between frontend and backend.
|
|
4
3
|
*
|
|
@@ -6,5 +5,5 @@
|
|
|
6
5
|
* - @sudobility/auth_service (backend) - getUserInfo helper
|
|
7
6
|
* - @sudobility/auth_lib (frontend) - useSiteAdmin hook
|
|
8
7
|
*/
|
|
9
|
-
|
|
8
|
+
export {};
|
|
10
9
|
//# sourceMappingURL=firebase-user.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase-user.js","sourceRoot":"","sources":["../../../src/types/infrastructure/firebase-user.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"firebase-user.js","sourceRoot":"","sources":["../../../src/types/infrastructure/firebase-user.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Network client interface for dependency injection
|
|
4
3
|
* Platform-agnostic HTTP client interface
|
|
5
4
|
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.NetworkError = void 0;
|
|
8
5
|
class NetworkError extends Error {
|
|
9
6
|
constructor(message, status, statusText, response) {
|
|
10
7
|
super(message);
|
|
@@ -14,5 +11,5 @@ class NetworkError extends Error {
|
|
|
14
11
|
this.response = response;
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
|
-
|
|
14
|
+
export { NetworkError, };
|
|
18
15
|
//# sourceMappingURL=network.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../../src/types/infrastructure/network.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../../src/types/infrastructure/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+DH,MAAM,YAAa,SAAQ,KAAK;IAK9B,YACE,OAAe,EACf,MAAc,EACd,UAAkB,EAClB,QAA4B;QAE5B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAED,OAAO,EAIL,YAAY,GACb,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Wallet and blockchain types
|
|
4
3
|
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.WalletType = void 0;
|
|
7
4
|
/**
|
|
8
5
|
* Cryptocurrency wallet type enumeration.
|
|
9
6
|
*
|
|
@@ -21,7 +18,7 @@ exports.WalletType = void 0;
|
|
|
21
18
|
* }
|
|
22
19
|
* ```
|
|
23
20
|
*/
|
|
24
|
-
var WalletType;
|
|
21
|
+
export var WalletType;
|
|
25
22
|
(function (WalletType) {
|
|
26
23
|
/** MetaMask browser extension wallet */
|
|
27
24
|
WalletType["METAMASK"] = "metamask";
|
|
@@ -33,5 +30,5 @@ var WalletType;
|
|
|
33
30
|
WalletType["WALLETCONNECT"] = "walletconnect";
|
|
34
31
|
/** Generic injected wallet provider */
|
|
35
32
|
WalletType["INJECTED"] = "injected";
|
|
36
|
-
})(WalletType || (
|
|
33
|
+
})(WalletType || (WalletType = {}));
|
|
37
34
|
//# sourceMappingURL=wallet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../src/types/infrastructure/wallet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../src/types/infrastructure/wallet.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAN,IAAY,UAWX;AAXD,WAAY,UAAU;IACpB,wCAAwC;IACxC,mCAAqB,CAAA;IACrB,4CAA4C;IAC5C,iCAAmB,CAAA;IACnB,sBAAsB;IACtB,mCAAqB,CAAA;IACrB,gDAAgD;IAChD,6CAA+B,CAAA;IAC/B,uCAAuC;IACvC,mCAAqB,CAAA;AACvB,CAAC,EAXW,UAAU,KAAV,UAAU,QAWrB"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Subscription Entitlement Constants
|
|
4
3
|
*
|
|
5
4
|
* Shared constants for subscription entitlement management.
|
|
6
5
|
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.NONE_ENTITLEMENT = void 0;
|
|
9
6
|
/**
|
|
10
7
|
* The special entitlement name for users without any subscription.
|
|
11
8
|
* This is returned when a user has no active entitlements in RevenueCat.
|
|
12
9
|
*/
|
|
13
|
-
|
|
10
|
+
export const NONE_ENTITLEMENT = "none";
|
|
14
11
|
//# sourceMappingURL=entitlements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entitlements.js","sourceRoot":"","sources":["../../../src/types/subscription/entitlements.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entitlements.js","sourceRoot":"","sources":["../../../src/types/subscription/entitlements.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAe,CAAC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Subscription Period Types
|
|
4
3
|
*
|
|
5
4
|
* Standard subscription periods and utilities for period comparison.
|
|
6
5
|
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ALL_PERIODS = exports.PERIOD_RANKS = void 0;
|
|
9
6
|
/**
|
|
10
7
|
* Period ranking for comparison (higher = longer)
|
|
11
8
|
*/
|
|
12
|
-
|
|
9
|
+
export const PERIOD_RANKS = {
|
|
13
10
|
weekly: 1,
|
|
14
11
|
monthly: 2,
|
|
15
12
|
quarterly: 3,
|
|
@@ -19,7 +16,7 @@ exports.PERIOD_RANKS = {
|
|
|
19
16
|
/**
|
|
20
17
|
* All supported periods in order
|
|
21
18
|
*/
|
|
22
|
-
|
|
19
|
+
export const ALL_PERIODS = [
|
|
23
20
|
'weekly',
|
|
24
21
|
'monthly',
|
|
25
22
|
'quarterly',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"period.js","sourceRoot":"","sources":["../../../src/types/subscription/period.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"period.js","sourceRoot":"","sources":["../../../src/types/subscription/period.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAuC;IAC9D,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,CAAC;IACZ,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAyB;IAC/C,QAAQ;IACR,SAAS;IACT,WAAW;IACX,QAAQ;IACR,UAAU;CACX,CAAC"}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @fileoverview Rate Limit Type Definitions
|
|
4
3
|
* @description Types for rate limiting endpoints across sudojo_api, shapeshyft_api, and whisperly_api
|
|
5
4
|
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.RateLimitPeriodType = void 0;
|
|
8
5
|
// ========================================
|
|
9
6
|
// RATE LIMIT HISTORY TYPES
|
|
10
7
|
// ========================================
|
|
11
8
|
/**
|
|
12
9
|
* Valid period types for rate limit history.
|
|
13
10
|
*/
|
|
14
|
-
var RateLimitPeriodType;
|
|
11
|
+
export var RateLimitPeriodType;
|
|
15
12
|
(function (RateLimitPeriodType) {
|
|
16
13
|
RateLimitPeriodType["HOUR"] = "hour";
|
|
17
14
|
RateLimitPeriodType["DAY"] = "day";
|
|
18
15
|
RateLimitPeriodType["MONTH"] = "month";
|
|
19
|
-
})(RateLimitPeriodType || (
|
|
16
|
+
})(RateLimitPeriodType || (RateLimitPeriodType = {}));
|
|
20
17
|
//# sourceMappingURL=rate-limits.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limits.js","sourceRoot":"","sources":["../../../src/types/subscription/rate-limits.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rate-limits.js","sourceRoot":"","sources":["../../../src/types/subscription/rate-limits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+EH,2CAA2C;AAC3C,2BAA2B;AAC3B,2CAA2C;AAE3C;;GAEG;AACH,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,kCAAW,CAAA;IACX,sCAAe,CAAA;AACjB,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Common async operation patterns and helpers.
|
|
4
3
|
* Reduces boilerplate code for common async operations.
|
|
5
4
|
*
|
|
6
5
|
* @since 1.0.0
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
exports.debounceAsync = exports.clearExpiredCache = exports.withCache = exports.withTimeout = exports.safeParallel = exports.withLoadingState = exports.safeAsync = void 0;
|
|
10
|
-
const logger_1 = require("./logging/logger");
|
|
7
|
+
import { logger } from './logging/logger';
|
|
11
8
|
/**
|
|
12
9
|
* Safely execute an async operation with error handling.
|
|
13
10
|
* Returns a result object instead of throwing.
|
|
@@ -35,11 +32,10 @@ const safeAsync = async (operation, context) => {
|
|
|
35
32
|
}
|
|
36
33
|
catch (error) {
|
|
37
34
|
const errorObj = error instanceof Error ? error : new Error(String(error));
|
|
38
|
-
|
|
35
|
+
logger.error(`Async operation failed: ${errorObj.message}`, context, error);
|
|
39
36
|
return { error: errorObj, success: false };
|
|
40
37
|
}
|
|
41
38
|
};
|
|
42
|
-
exports.safeAsync = safeAsync;
|
|
43
39
|
/**
|
|
44
40
|
* Execute async operation with loading state tracking.
|
|
45
41
|
* Manages `setLoading` and `setError` callbacks automatically.
|
|
@@ -72,14 +68,13 @@ const withLoadingState = async (operation, setLoading, setError, context) => {
|
|
|
72
68
|
catch (error) {
|
|
73
69
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
74
70
|
setError(errorMessage);
|
|
75
|
-
|
|
71
|
+
logger.error(`Operation failed: ${errorMessage}`, context, error);
|
|
76
72
|
return undefined;
|
|
77
73
|
}
|
|
78
74
|
finally {
|
|
79
75
|
setLoading(false);
|
|
80
76
|
}
|
|
81
77
|
};
|
|
82
|
-
exports.withLoadingState = withLoadingState;
|
|
83
78
|
/**
|
|
84
79
|
* Execute multiple async operations in parallel with error handling.
|
|
85
80
|
* All operations run concurrently via `Promise.all`.
|
|
@@ -105,11 +100,10 @@ const safeParallel = async (operations, context) => {
|
|
|
105
100
|
}
|
|
106
101
|
catch (error) {
|
|
107
102
|
const errorObj = error instanceof Error ? error : new Error(String(error));
|
|
108
|
-
|
|
103
|
+
logger.error(`Parallel operations failed: ${errorObj.message}`, context, error);
|
|
109
104
|
return { error: errorObj, success: false };
|
|
110
105
|
}
|
|
111
106
|
};
|
|
112
|
-
exports.safeParallel = safeParallel;
|
|
113
107
|
/**
|
|
114
108
|
* Execute async operation with a timeout.
|
|
115
109
|
* Rejects if the operation does not complete within `timeoutMs`.
|
|
@@ -137,11 +131,10 @@ const withTimeout = async (operation, timeoutMs, context) => {
|
|
|
137
131
|
return await Promise.race([operation(), timeoutPromise]);
|
|
138
132
|
}
|
|
139
133
|
catch (error) {
|
|
140
|
-
|
|
134
|
+
logger.error(`Timeout operation failed`, context, error);
|
|
141
135
|
throw error;
|
|
142
136
|
}
|
|
143
137
|
};
|
|
144
|
-
exports.withTimeout = withTimeout;
|
|
145
138
|
/**
|
|
146
139
|
* In-memory cache for {@link withCache}.
|
|
147
140
|
*/
|
|
@@ -178,7 +171,6 @@ const withCache = async (key, operation, ttlMs = 5 * 60 * 1000 // 5 minutes defa
|
|
|
178
171
|
cache.set(key, { data: result, timestamp: now, ttl: ttlMs });
|
|
179
172
|
return result;
|
|
180
173
|
};
|
|
181
|
-
exports.withCache = withCache;
|
|
182
174
|
/**
|
|
183
175
|
* Clear expired cache entries from the in-memory cache.
|
|
184
176
|
* @since 1.0.0
|
|
@@ -191,7 +183,6 @@ const clearExpiredCache = () => {
|
|
|
191
183
|
}
|
|
192
184
|
}
|
|
193
185
|
};
|
|
194
|
-
exports.clearExpiredCache = clearExpiredCache;
|
|
195
186
|
/**
|
|
196
187
|
* Active debounce timers keyed by operation key.
|
|
197
188
|
*/
|
|
@@ -232,7 +223,7 @@ const debounceAsync = (fn, delay, key) => {
|
|
|
232
223
|
resolve(result);
|
|
233
224
|
}
|
|
234
225
|
catch (error) {
|
|
235
|
-
|
|
226
|
+
logger.error(`Debounced operation failed`, key, error);
|
|
236
227
|
resolve(undefined);
|
|
237
228
|
}
|
|
238
229
|
}, delay);
|
|
@@ -240,5 +231,5 @@ const debounceAsync = (fn, delay, key) => {
|
|
|
240
231
|
});
|
|
241
232
|
};
|
|
242
233
|
};
|
|
243
|
-
|
|
234
|
+
export { safeAsync, withLoadingState, safeParallel, withTimeout, withCache, clearExpiredCache, debounceAsync, };
|
|
244
235
|
//# sourceMappingURL=async-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-helpers.js","sourceRoot":"","sources":["../../src/utils/async-helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"async-helpers.js","sourceRoot":"","sources":["../../src/utils/async-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAgB1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,SAAS,GAAG,KAAK,EACrB,SAA2B,EAC3B,OAAgB,EACS,EAAE;IAC3B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,SAAS,EAAE,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,KAAK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G,CAAC,GAAG,CAAC,CAAC;YAC7C,IAAI,eAAe,EAAE,CAAC;gBACpB,YAAY,CAAC,eAAe,CAAC,CAAC;YAChC,CAAC;YAED,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,IAAI,EAAE;gBACpC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACxB,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;oBACjC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAClB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;oBACvD,OAAO,CAAC,SAAS,CAAC,CAAC;gBACrB,CAAC;YACH,CAAC,EAAE,KAAK,CAAC,CAAC;YAEV,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,aAAa,GAEd,CAAC"}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @fileoverview Admin email whitelist utilities
|
|
4
3
|
*
|
|
5
4
|
* Pure utility functions for parsing and checking admin email whitelists.
|
|
6
5
|
* Used by both frontend (auth_lib) and backend (auth_service) packages.
|
|
7
6
|
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.parseAdminEmails = parseAdminEmails;
|
|
10
|
-
exports.isAdminEmail = isAdminEmail;
|
|
11
|
-
exports.createAdminChecker = createAdminChecker;
|
|
12
7
|
/**
|
|
13
8
|
* Parse admin emails from environment variable or string
|
|
14
9
|
*
|
|
@@ -21,7 +16,7 @@ exports.createAdminChecker = createAdminChecker;
|
|
|
21
16
|
* // Returns: ["admin@example.com", "other@example.com"]
|
|
22
17
|
* ```
|
|
23
18
|
*/
|
|
24
|
-
function parseAdminEmails(input) {
|
|
19
|
+
export function parseAdminEmails(input) {
|
|
25
20
|
if (!input) {
|
|
26
21
|
return [];
|
|
27
22
|
}
|
|
@@ -45,7 +40,7 @@ function parseAdminEmails(input) {
|
|
|
45
40
|
* }
|
|
46
41
|
* ```
|
|
47
42
|
*/
|
|
48
|
-
function isAdminEmail(email, adminEmails) {
|
|
43
|
+
export function isAdminEmail(email, adminEmails) {
|
|
49
44
|
if (!email) {
|
|
50
45
|
return false;
|
|
51
46
|
}
|
|
@@ -70,7 +65,7 @@ function isAdminEmail(email, adminEmails) {
|
|
|
70
65
|
* }
|
|
71
66
|
* ```
|
|
72
67
|
*/
|
|
73
|
-
function createAdminChecker(input) {
|
|
68
|
+
export function createAdminChecker(input) {
|
|
74
69
|
const adminEmails = parseAdminEmails(input);
|
|
75
70
|
return (email) => {
|
|
76
71
|
return isAdminEmail(email, adminEmails);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-emails.js","sourceRoot":"","sources":["../../../src/utils/auth/admin-emails.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"admin-emails.js","sourceRoot":"","sources":["../../../src/utils/auth/admin-emails.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAgC;IAC/D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SAC1C,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAgC,EAChC,WAAqB;IAErB,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAgC;IAEhC,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAE5C,OAAO,CAAC,KAAgC,EAAW,EAAE;QACnD,OAAO,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAC1C,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/utils/auth/auth.js
CHANGED
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Authentication utilities for wallet-based authentication
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
exports.generateAuthMessage = generateAuthMessage;
|
|
7
|
-
exports.isAuthExpired = isAuthExpired;
|
|
8
|
-
exports.getAuthStatusText = getAuthStatusText;
|
|
9
|
-
exports.canAccessProtectedFeatures = canAccessProtectedFeatures;
|
|
10
|
-
exports.isAuthStatusConnected = isAuthStatusConnected;
|
|
11
|
-
exports.generateNonce = generateNonce;
|
|
12
|
-
exports.extractNonceFromMessage = extractNonceFromMessage;
|
|
13
|
-
exports.isValidNonce = isValidNonce;
|
|
14
|
-
const enums_1 = require("../../types/business/enums");
|
|
4
|
+
import { AuthStatus } from '../../types/business/enums';
|
|
15
5
|
/**
|
|
16
6
|
* Generate an authentication message with a nonce
|
|
17
7
|
* @param emailDomain - The email domain/service name to display in the auth message
|
|
18
8
|
* @param nonce - Optional nonce value. If not provided, a random one will be generated
|
|
19
9
|
* @returns Authentication message string
|
|
20
10
|
*/
|
|
21
|
-
function generateAuthMessage(emailDomain, nonce) {
|
|
11
|
+
export function generateAuthMessage(emailDomain, nonce) {
|
|
22
12
|
const actualNonce = nonce || `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
23
13
|
return `Authenticate with ${emailDomain}\nNonce: ${actualNonce}`;
|
|
24
14
|
}
|
|
@@ -27,20 +17,20 @@ function generateAuthMessage(emailDomain, nonce) {
|
|
|
27
17
|
* @param createdAt - The date when authentication was created
|
|
28
18
|
* @param expirationHours - Number of hours until expiration (default: 24)
|
|
29
19
|
*/
|
|
30
|
-
function isAuthExpired(createdAt, expirationHours = 24) {
|
|
20
|
+
export function isAuthExpired(createdAt, expirationHours = 24) {
|
|
31
21
|
const expirationTime = new Date(createdAt.getTime() + expirationHours * 60 * 60 * 1000);
|
|
32
22
|
return new Date() > expirationTime;
|
|
33
23
|
}
|
|
34
24
|
/**
|
|
35
25
|
* Get human-readable text for authentication status
|
|
36
26
|
*/
|
|
37
|
-
function getAuthStatusText(status) {
|
|
27
|
+
export function getAuthStatusText(status) {
|
|
38
28
|
switch (status) {
|
|
39
|
-
case
|
|
29
|
+
case AuthStatus.DISCONNECTED:
|
|
40
30
|
return 'Not connected';
|
|
41
|
-
case
|
|
31
|
+
case AuthStatus.CONNECTED:
|
|
42
32
|
return 'Connected - Please verify';
|
|
43
|
-
case
|
|
33
|
+
case AuthStatus.VERIFIED:
|
|
44
34
|
return 'Authenticated';
|
|
45
35
|
default:
|
|
46
36
|
return 'Unknown status';
|
|
@@ -49,32 +39,32 @@ function getAuthStatusText(status) {
|
|
|
49
39
|
/**
|
|
50
40
|
* Check if user can access protected features
|
|
51
41
|
*/
|
|
52
|
-
function canAccessProtectedFeatures(status) {
|
|
53
|
-
return status ===
|
|
42
|
+
export function canAccessProtectedFeatures(status) {
|
|
43
|
+
return status === AuthStatus.VERIFIED;
|
|
54
44
|
}
|
|
55
45
|
/**
|
|
56
46
|
* Check if auth status indicates wallet is connected (either connected or verified)
|
|
57
47
|
*/
|
|
58
|
-
function isAuthStatusConnected(status) {
|
|
59
|
-
return status ===
|
|
48
|
+
export function isAuthStatusConnected(status) {
|
|
49
|
+
return status === AuthStatus.CONNECTED || status === AuthStatus.VERIFIED;
|
|
60
50
|
}
|
|
61
51
|
/**
|
|
62
52
|
* Generate a random nonce for authentication
|
|
63
53
|
*/
|
|
64
|
-
function generateNonce() {
|
|
54
|
+
export function generateNonce() {
|
|
65
55
|
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
66
56
|
}
|
|
67
57
|
/**
|
|
68
58
|
* Extract nonce from an authentication message
|
|
69
59
|
*/
|
|
70
|
-
function extractNonceFromMessage(message) {
|
|
60
|
+
export function extractNonceFromMessage(message) {
|
|
71
61
|
const match = message.match(/Nonce:\s*(.+)$/m);
|
|
72
62
|
return match ? match[1].trim() : undefined;
|
|
73
63
|
}
|
|
74
64
|
/**
|
|
75
65
|
* Validate that a nonce meets basic requirements
|
|
76
66
|
*/
|
|
77
|
-
function isValidNonce(nonce) {
|
|
67
|
+
export function isValidNonce(nonce) {
|
|
78
68
|
if (!nonce || typeof nonce !== 'string') {
|
|
79
69
|
return false;
|
|
80
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/utils/auth/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/utils/auth/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,WAAmB,EACnB,KAAwB;IAExB,MAAM,WAAW,GACf,KAAK,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAA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