@sudobility/types 1.9.46 → 1.9.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/types/infrastructure/firebase-user.cjs +10 -0
- package/dist/types/infrastructure/firebase-user.d.ts +27 -0
- package/dist/types/infrastructure/firebase-user.d.ts.map +1 -0
- package/dist/types/infrastructure/firebase-user.js +10 -0
- package/dist/types/infrastructure/firebase-user.js.map +1 -0
- package/dist/utils/auth/admin-emails.cjs +79 -0
- package/dist/utils/auth/admin-emails.d.ts +56 -0
- package/dist/utils/auth/admin-emails.d.ts.map +1 -0
- package/dist/utils/auth/admin-emails.js +79 -0
- package/dist/utils/auth/admin-emails.js.map +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.MANAGER_PERMISSIONS = exports.OWNER_PERMISSIONS = exports.InvitationStatus = exports.EntityRole = exports.EntityType = exports.RateLimitPeriodType = exports.WalletType = exports.NetworkError = exports.ProcessedEventName = exports.ContractType = exports.AnalyticsEventBuilder = exports.AnalyticsEvent = exports.StorageType = exports.validateMessage = exports.validateDomain = exports.validateAmount = exports.validateAddress = exports.isSolanaRecipient = exports.isSolanaAddress = exports.isEvmRecipient = exports.isEvmAddress = exports.TransactionStatus = exports.PROTOCOL_CONSTANTS = exports.MessageType = exports.isWalletVerified = exports.isWalletConnected = exports.getWalletConnectionState = exports.Theme = exports.SubscriptionAction = exports.SortOrder = exports.RequestStatus = exports.PlatformType = exports.NotificationType = exports.MobileView = exports.MediumView = exports.InfoType = exports.FontSize = exports.FeatureFlag = exports.ErrorType = exports.EmailValidationState = exports.EmailSortCriteria = exports.EmailComposeType = exports.EmailAddressType = exports.EmailAction = exports.Currency = exports.ConnectionType = exports.ConnectionState = exports.ChainType = exports.Chain = exports.AuthStatus = void 0;
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.debounceAsync = exports.clearExpiredCache = exports.withCache = exports.withTimeout = exports.safeParallel = exports.withLoadingState = exports.safeAsync = exports.parseSearchParams = exports.searchParamsToString = exports.createSearchParams = exports.createURLSearchParams = void 0;
|
|
14
|
+
exports.isAdminEmail = exports.parseAdminEmails = exports.isValidNonce = exports.isAuthStatusConnected = exports.isAuthExpired = exports.getAuthStatusText = exports.generateNonce = exports.generateAuthMessage = exports.extractNonceFromMessage = exports.canAccessProtectedFeatures = exports.validateEventArgs = exports.normalizeAddress = exports.isZeroAddress = exports.isTestNet = exports.formatBigInt = exports.createUserMultiChainId = exports.createMultiChainId = exports.createDelegationId = exports.createChainStatsId = exports.parseEmailAddress = exports.isValidWalletAddress = exports.isValidSignature = exports.isSNSName = exports.isENSName = exports.getChainDisplayName = exports.getAddressType = exports.formatWalletAddress = exports.AddressType = exports.validateArray = exports.parseJson = exports.optional = exports.isValidDate = exports.isUrl = exports.isSuccessResponse = exports.isString = exports.isObject = exports.isNumber = exports.isNullish = exports.isErrorResponse = exports.isEmail = exports.isBoolean = exports.isArray = exports.isApiResponse = exports.hasRequiredProperties = exports.createValidator = exports.createAssertion = exports.Web3UsernameValidator = exports.hasPermission = exports.getPermissionsForRole = exports.MEMBER_PERMISSIONS = void 0;
|
|
15
|
+
exports.apiLogger = exports.authLogger = exports.logger = exports.LogLevel = exports.STATUS_VALUES = exports.Z_INDEX = exports.ANIMATION = exports.NETWORK_IDS = exports.WALLET_NAMES = exports.CONTACT_INFO = exports.ROUTES = exports.SUCCESS_MESSAGES = exports.ERROR_MESSAGES = exports.TIME_FORMAT = exports.SUBSCRIPTION_TIERS = exports.EMAIL_CONFIG = exports.STORAGE_KEYS = exports.CHAIN_TYPE = exports.AUTH_STATUS = exports.API_RETRY_DELAY = exports.API_RETRY_ATTEMPTS = exports.API_TIMEOUT = exports.truncate = exports.toTitleCase = exports.toSnakeCase = exports.toKebabCase = exports.toCamelCase = exports.stripHtml = exports.randomString = exports.pluralize = exports.normalizeWhitespace = exports.isNotBlank = exports.isBlank = exports.getInitials = exports.formatNumber = exports.formatBytes = exports.escapeHtml = exports.capitalize = exports.parseDate = exports.isDateInRange = exports.formatTimestamp = exports.formatRelativeTime = exports.formatEmailDate = exports.addHours = exports.addDays = exports.parseUSDC = exports.formatUSDC = exports.USDC_DECIMALS = exports.CLAIM_PERIOD_DAYS = exports.createAdminChecker = void 0;
|
|
16
|
+
exports.debounceAsync = exports.clearExpiredCache = exports.withCache = exports.withTimeout = exports.safeParallel = exports.withLoadingState = exports.safeAsync = exports.parseSearchParams = exports.searchParamsToString = exports.createSearchParams = exports.createURLSearchParams = exports.storageLogger = exports.ensLogger = exports.contractLogger = void 0;
|
|
17
17
|
// ============================================================================
|
|
18
18
|
// TYPES - Business
|
|
19
19
|
// ============================================================================
|
|
@@ -141,6 +141,10 @@ Object.defineProperty(exports, "getAuthStatusText", { enumerable: true, get: fun
|
|
|
141
141
|
Object.defineProperty(exports, "isAuthExpired", { enumerable: true, get: function () { return auth_1.isAuthExpired; } });
|
|
142
142
|
Object.defineProperty(exports, "isAuthStatusConnected", { enumerable: true, get: function () { return auth_1.isAuthStatusConnected; } });
|
|
143
143
|
Object.defineProperty(exports, "isValidNonce", { enumerable: true, get: function () { return auth_1.isValidNonce; } });
|
|
144
|
+
var admin_emails_1 = require("./utils/auth/admin-emails");
|
|
145
|
+
Object.defineProperty(exports, "parseAdminEmails", { enumerable: true, get: function () { return admin_emails_1.parseAdminEmails; } });
|
|
146
|
+
Object.defineProperty(exports, "isAdminEmail", { enumerable: true, get: function () { return admin_emails_1.isAdminEmail; } });
|
|
147
|
+
Object.defineProperty(exports, "createAdminChecker", { enumerable: true, get: function () { return admin_emails_1.createAdminChecker; } });
|
|
144
148
|
// ============================================================================
|
|
145
149
|
// UTILS - Formatting
|
|
146
150
|
// ============================================================================
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export type { NetworkClient, NetworkRequestOptions, NetworkResponse, } from './t
|
|
|
26
26
|
export { NetworkError } from './types/infrastructure/network';
|
|
27
27
|
export type { UILocationHook, UINavigationConfig, UINavigationHook, UINavigationOptions, UINavigationService, UINavigationState, } from './types/infrastructure/navigation';
|
|
28
28
|
export { WalletType } from './types/infrastructure/wallet';
|
|
29
|
+
export type { UserInfoResponse } from './types/infrastructure/firebase-user';
|
|
29
30
|
export type { RateLimits, RateLimitTier, RateLimitsConfigData, RateLimitUsage, RateLimitsConfigResponse, RateLimitHistoryEntry, RateLimitHistoryData, RateLimitHistoryResponse, } from './types/subscription/rate-limits';
|
|
30
31
|
export { RateLimitPeriodType } from './types/subscription/rate-limits';
|
|
31
32
|
export { EntityType, EntityRole, InvitationStatus, } from './types/entity/entity';
|
|
@@ -43,6 +44,7 @@ export { AddressType, formatWalletAddress, getAddressType, getChainDisplayName,
|
|
|
43
44
|
export type { MultiChainIdGenerator, UserChainIdGenerator, } from './utils/blockchain/event-helpers';
|
|
44
45
|
export { createChainStatsId, createDelegationId, createMultiChainId, createUserMultiChainId, formatBigInt, isTestNet, isZeroAddress, normalizeAddress, validateEventArgs, } from './utils/blockchain/event-helpers';
|
|
45
46
|
export { canAccessProtectedFeatures, extractNonceFromMessage, generateAuthMessage, generateNonce, getAuthStatusText, isAuthExpired, isAuthStatusConnected, isValidNonce, } from './utils/auth/auth';
|
|
47
|
+
export { parseAdminEmails, isAdminEmail, createAdminChecker, } from './utils/auth/admin-emails';
|
|
46
48
|
export { CLAIM_PERIOD_DAYS, USDC_DECIMALS, formatUSDC, parseUSDC, } from './utils/formatting/currency';
|
|
47
49
|
export { addDays, addHours, formatEmailDate, formatRelativeTime, formatTimestamp, isDateInRange, parseDate, } from './utils/formatting/date';
|
|
48
50
|
export { capitalize, escapeHtml, formatBytes, formatNumber, getInitials, isBlank, isNotBlank, normalizeWhitespace, pluralize, randomString, stripHtml, toCamelCase, toKebabCase, toSnakeCase, toTitleCase, truncate, } from './utils/formatting/string';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,YAAY,EACV,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,MAAM,EACN,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EACL,UAAU,EACV,KAAK,EACL,SAAS,EACT,eAAe,EACf,cAAc,EACd,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,KAAK,GACN,MAAM,wBAAwB,CAAC;AAGhC,YAAY,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AAMxC,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,+BAA+B,CAAC;AAMvC,YAAY,EACV,WAAW,EACX,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAO3E,YAAY,EACV,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,qBAAqB,GACtB,MAAM,kCAAkC,CAAC;AAG1C,YAAY,EACV,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,yBAAyB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,YAAY,EACZ,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAGpC,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,eAAe,GAChB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,YAAY,EACV,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,MAAM,EACN,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EACL,UAAU,EACV,KAAK,EACL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AiB,EACjB,aAAa,EACb,UAAU,EACV,SAAS,GACV,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,OAAO,EACP,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,SAAS,GACV,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,OAAO,EACP,UAAU,EACV,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,SAAS,EACT,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,QAAQ,GACT,MAAM,2BAA2B,CAAC;AAMnC,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,OAAO,GACR,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAMnE,OAAO,EACL,QAAQ,EACR,KAAK,QAAQ,EACb,MAAM,EACN,UAAU,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,aAAa,GACd,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,KAAK,WAAW,GACjB,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.MANAGER_PERMISSIONS = exports.OWNER_PERMISSIONS = exports.InvitationStatus = exports.EntityRole = exports.EntityType = exports.RateLimitPeriodType = exports.WalletType = exports.NetworkError = exports.ProcessedEventName = exports.ContractType = exports.AnalyticsEventBuilder = exports.AnalyticsEvent = exports.StorageType = exports.validateMessage = exports.validateDomain = exports.validateAmount = exports.validateAddress = exports.isSolanaRecipient = exports.isSolanaAddress = exports.isEvmRecipient = exports.isEvmAddress = exports.TransactionStatus = exports.PROTOCOL_CONSTANTS = exports.MessageType = exports.isWalletVerified = exports.isWalletConnected = exports.getWalletConnectionState = exports.Theme = exports.SubscriptionAction = exports.SortOrder = exports.RequestStatus = exports.PlatformType = exports.NotificationType = exports.MobileView = exports.MediumView = exports.InfoType = exports.FontSize = exports.FeatureFlag = exports.ErrorType = exports.EmailValidationState = exports.EmailSortCriteria = exports.EmailComposeType = exports.EmailAddressType = exports.EmailAction = exports.Currency = exports.ConnectionType = exports.ConnectionState = exports.ChainType = exports.Chain = exports.AuthStatus = void 0;
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.debounceAsync = exports.clearExpiredCache = exports.withCache = exports.withTimeout = exports.safeParallel = exports.withLoadingState = exports.safeAsync = exports.parseSearchParams = exports.searchParamsToString = exports.createSearchParams = exports.createURLSearchParams = void 0;
|
|
14
|
+
exports.isAdminEmail = exports.parseAdminEmails = exports.isValidNonce = exports.isAuthStatusConnected = exports.isAuthExpired = exports.getAuthStatusText = exports.generateNonce = exports.generateAuthMessage = exports.extractNonceFromMessage = exports.canAccessProtectedFeatures = exports.validateEventArgs = exports.normalizeAddress = exports.isZeroAddress = exports.isTestNet = exports.formatBigInt = exports.createUserMultiChainId = exports.createMultiChainId = exports.createDelegationId = exports.createChainStatsId = exports.parseEmailAddress = exports.isValidWalletAddress = exports.isValidSignature = exports.isSNSName = exports.isENSName = exports.getChainDisplayName = exports.getAddressType = exports.formatWalletAddress = exports.AddressType = exports.validateArray = exports.parseJson = exports.optional = exports.isValidDate = exports.isUrl = exports.isSuccessResponse = exports.isString = exports.isObject = exports.isNumber = exports.isNullish = exports.isErrorResponse = exports.isEmail = exports.isBoolean = exports.isArray = exports.isApiResponse = exports.hasRequiredProperties = exports.createValidator = exports.createAssertion = exports.Web3UsernameValidator = exports.hasPermission = exports.getPermissionsForRole = exports.MEMBER_PERMISSIONS = void 0;
|
|
15
|
+
exports.apiLogger = exports.authLogger = exports.logger = exports.LogLevel = exports.STATUS_VALUES = exports.Z_INDEX = exports.ANIMATION = exports.NETWORK_IDS = exports.WALLET_NAMES = exports.CONTACT_INFO = exports.ROUTES = exports.SUCCESS_MESSAGES = exports.ERROR_MESSAGES = exports.TIME_FORMAT = exports.SUBSCRIPTION_TIERS = exports.EMAIL_CONFIG = exports.STORAGE_KEYS = exports.CHAIN_TYPE = exports.AUTH_STATUS = exports.API_RETRY_DELAY = exports.API_RETRY_ATTEMPTS = exports.API_TIMEOUT = exports.truncate = exports.toTitleCase = exports.toSnakeCase = exports.toKebabCase = exports.toCamelCase = exports.stripHtml = exports.randomString = exports.pluralize = exports.normalizeWhitespace = exports.isNotBlank = exports.isBlank = exports.getInitials = exports.formatNumber = exports.formatBytes = exports.escapeHtml = exports.capitalize = exports.parseDate = exports.isDateInRange = exports.formatTimestamp = exports.formatRelativeTime = exports.formatEmailDate = exports.addHours = exports.addDays = exports.parseUSDC = exports.formatUSDC = exports.USDC_DECIMALS = exports.CLAIM_PERIOD_DAYS = exports.createAdminChecker = void 0;
|
|
16
|
+
exports.debounceAsync = exports.clearExpiredCache = exports.withCache = exports.withTimeout = exports.safeParallel = exports.withLoadingState = exports.safeAsync = exports.parseSearchParams = exports.searchParamsToString = exports.createSearchParams = exports.createURLSearchParams = exports.storageLogger = exports.ensLogger = exports.contractLogger = void 0;
|
|
17
17
|
// ============================================================================
|
|
18
18
|
// TYPES - Business
|
|
19
19
|
// ============================================================================
|
|
@@ -141,6 +141,10 @@ Object.defineProperty(exports, "getAuthStatusText", { enumerable: true, get: fun
|
|
|
141
141
|
Object.defineProperty(exports, "isAuthExpired", { enumerable: true, get: function () { return auth_1.isAuthExpired; } });
|
|
142
142
|
Object.defineProperty(exports, "isAuthStatusConnected", { enumerable: true, get: function () { return auth_1.isAuthStatusConnected; } });
|
|
143
143
|
Object.defineProperty(exports, "isValidNonce", { enumerable: true, get: function () { return auth_1.isValidNonce; } });
|
|
144
|
+
var admin_emails_1 = require("./utils/auth/admin-emails");
|
|
145
|
+
Object.defineProperty(exports, "parseAdminEmails", { enumerable: true, get: function () { return admin_emails_1.parseAdminEmails; } });
|
|
146
|
+
Object.defineProperty(exports, "isAdminEmail", { enumerable: true, get: function () { return admin_emails_1.isAdminEmail; } });
|
|
147
|
+
Object.defineProperty(exports, "createAdminChecker", { enumerable: true, get: function () { return admin_emails_1.createAdminChecker; } });
|
|
144
148
|
// ============================================================================
|
|
145
149
|
// UTILS - Formatting
|
|
146
150
|
// ============================================================================
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;AAoBH,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,QAAQ;AACR,gDAwBgC;AAvB9B,mGAAA,UAAU,OAAA;AACV,8FAAA,KAAK,OAAA;AACL,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA;AACf,uGAAA,cAAc,OAAA;AACd,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,yGAAA,gBAAgB,OAAA;AAChB,yGAAA,gBAAgB,OAAA;AAChB,0GAAA,iBAAiB,OAAA;AACjB,6GAAA,oBAAoB,OAAA;AACpB,kGAAA,SAAS,OAAA;AACT,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,mGAAA,UAAU,OAAA;AACV,mGAAA,UAAU,O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ClB,8GAAA,eAAe,OAAA;AACf,0GAAA,WAAW,OAAA;AACX,yGAAA,UAAU,OAAA;AACV,2GAAA,YAAY,OAAA;AACZ,2GAAA,YAAY,OAAA;AACZ,iHAAA,kBAAkB,OAAA;AAClB,0GAAA,WAAW,OAAA;AACX,6GAAA,cAAc,OAAA;AACd,+GAAA,gBAAgB,OAAA;AAChB,qGAAA,MAAM,OAAA;AACN,2GAAA,YAAY,OAAA;AACZ,2GAAA,YAAY,OAAA;AACZ,0GAAA,WAAW,OAAA;AACX,wGAAA,SAAS,OAAA;AACT,sGAAA,OAAO,OAAA;AAGT,iEAAgE;AAAvD,8GAAA,aAAa,OAAA;AAGtB,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E,iDASgC;AAR9B,kGAAA,QAAQ,OAAA;AAER,gGAAA,MAAM,OAAA;AACN,oGAAA,UAAU,OAAA;AACV,mGAAA,SAAS,OAAA;AACT,wGAAA,cAAc,OAAA;AACd,mGAAA,SAAS,OAAA;AACT,uGAAA,aAAa,OAAA;AAGf,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,qDAMgC;AAL9B,mHAAA,qBAAqB,OAAA;AACrB,gHAAA,kBAAkB,OAAA;AAClB,kHAAA,oBAAoB,OAAA;AACpB,+GAAA,iBAAiB,OAAA;AAInB,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E,uDAS+B;AAR7B,0GAAA,SAAS,OAAA;AACT,iHAAA,gBAAgB,OAAA;AAChB,6GAAA,YAAY,OAAA;AACZ,4GAAA,WAAW,OAAA;AACX,0GAAA,SAAS,OAAA;AACT,kHAAA,iBAAiB,OAAA;AACjB,8GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Firebase user info types shared between frontend and backend.
|
|
3
|
+
*
|
|
4
|
+
* Used by:
|
|
5
|
+
* - @sudobility/auth_service (backend) - getUserInfo helper
|
|
6
|
+
* - @sudobility/auth_lib (frontend) - useSiteAdmin hook
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* User info response from GET /users/:userId endpoint.
|
|
10
|
+
* This type represents the user information returned by the backend API
|
|
11
|
+
* and consumed by the frontend useSiteAdmin hook.
|
|
12
|
+
*/
|
|
13
|
+
export interface UserInfoResponse {
|
|
14
|
+
uid: string;
|
|
15
|
+
email: string | null;
|
|
16
|
+
displayName: string | null;
|
|
17
|
+
emailVerified: boolean;
|
|
18
|
+
siteAdmin: boolean;
|
|
19
|
+
photoURL: string | null;
|
|
20
|
+
phoneNumber: string | null;
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
metadata: {
|
|
23
|
+
creationTime: string | null;
|
|
24
|
+
lastSignInTime: string | null;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=firebase-user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firebase-user.d.ts","sourceRoot":"","sources":["../../../src/types/infrastructure/firebase-user.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE;QACR,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,CAAC;CACH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firebase-user.js","sourceRoot":"","sources":["../../../src/types/infrastructure/firebase-user.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Admin email whitelist utilities
|
|
4
|
+
*
|
|
5
|
+
* Pure utility functions for parsing and checking admin email whitelists.
|
|
6
|
+
* Used by both frontend (auth_lib) and backend (auth_service) packages.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.parseAdminEmails = parseAdminEmails;
|
|
10
|
+
exports.isAdminEmail = isAdminEmail;
|
|
11
|
+
exports.createAdminChecker = createAdminChecker;
|
|
12
|
+
/**
|
|
13
|
+
* Parse admin emails from environment variable or string
|
|
14
|
+
*
|
|
15
|
+
* @param input - Comma-separated string of admin emails (e.g., "admin@example.com, other@example.com")
|
|
16
|
+
* @returns Array of normalized (lowercase, trimmed) email addresses
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const adminEmails = parseAdminEmails(process.env.ADMIN_EMAILS || "");
|
|
21
|
+
* // Returns: ["admin@example.com", "other@example.com"]
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
function parseAdminEmails(input) {
|
|
25
|
+
if (!input) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
return input
|
|
29
|
+
.split(',')
|
|
30
|
+
.map((email) => email.trim().toLowerCase())
|
|
31
|
+
.filter((email) => email.length > 0 && email.includes('@'));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Check if an email is in the admin whitelist
|
|
35
|
+
*
|
|
36
|
+
* @param email - Email address to check
|
|
37
|
+
* @param adminEmails - Array of admin emails (from parseAdminEmails)
|
|
38
|
+
* @returns True if the email is an admin
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const adminEmails = parseAdminEmails(process.env.ADMIN_EMAILS || "");
|
|
43
|
+
* if (isAdminEmail(user.email, adminEmails)) {
|
|
44
|
+
* // Skip rate limiting, subscription checks, etc.
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
function isAdminEmail(email, adminEmails) {
|
|
49
|
+
if (!email) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return adminEmails.includes(email.toLowerCase());
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a cached admin email checker
|
|
56
|
+
*
|
|
57
|
+
* Parses the admin emails once and returns a checker function.
|
|
58
|
+
* Useful for middleware where you don't want to re-parse on every request.
|
|
59
|
+
*
|
|
60
|
+
* @param input - Comma-separated string of admin emails
|
|
61
|
+
* @returns Function that checks if an email is an admin
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const isAdmin = createAdminChecker(process.env.ADMIN_EMAILS);
|
|
66
|
+
*
|
|
67
|
+
* // In middleware:
|
|
68
|
+
* if (isAdmin(user.email)) {
|
|
69
|
+
* // Bypass checks
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
function createAdminChecker(input) {
|
|
74
|
+
const adminEmails = parseAdminEmails(input);
|
|
75
|
+
return (email) => {
|
|
76
|
+
return isAdminEmail(email, adminEmails);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=admin-emails.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Admin email whitelist utilities
|
|
3
|
+
*
|
|
4
|
+
* Pure utility functions for parsing and checking admin email whitelists.
|
|
5
|
+
* Used by both frontend (auth_lib) and backend (auth_service) packages.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Parse admin emails from environment variable or string
|
|
9
|
+
*
|
|
10
|
+
* @param input - Comma-separated string of admin emails (e.g., "admin@example.com, other@example.com")
|
|
11
|
+
* @returns Array of normalized (lowercase, trimmed) email addresses
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const adminEmails = parseAdminEmails(process.env.ADMIN_EMAILS || "");
|
|
16
|
+
* // Returns: ["admin@example.com", "other@example.com"]
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseAdminEmails(input: string | undefined | null): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Check if an email is in the admin whitelist
|
|
22
|
+
*
|
|
23
|
+
* @param email - Email address to check
|
|
24
|
+
* @param adminEmails - Array of admin emails (from parseAdminEmails)
|
|
25
|
+
* @returns True if the email is an admin
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const adminEmails = parseAdminEmails(process.env.ADMIN_EMAILS || "");
|
|
30
|
+
* if (isAdminEmail(user.email, adminEmails)) {
|
|
31
|
+
* // Skip rate limiting, subscription checks, etc.
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function isAdminEmail(email: string | undefined | null, adminEmails: string[]): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Create a cached admin email checker
|
|
38
|
+
*
|
|
39
|
+
* Parses the admin emails once and returns a checker function.
|
|
40
|
+
* Useful for middleware where you don't want to re-parse on every request.
|
|
41
|
+
*
|
|
42
|
+
* @param input - Comma-separated string of admin emails
|
|
43
|
+
* @returns Function that checks if an email is an admin
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const isAdmin = createAdminChecker(process.env.ADMIN_EMAILS);
|
|
48
|
+
*
|
|
49
|
+
* // In middleware:
|
|
50
|
+
* if (isAdmin(user.email)) {
|
|
51
|
+
* // Bypass checks
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function createAdminChecker(input: string | undefined | null): (email: string | undefined | null) => boolean;
|
|
56
|
+
//# sourceMappingURL=admin-emails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-emails.d.ts","sourceRoot":"","sources":["../../../src/utils/auth/admin-emails.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,EAAE,CAS3E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EAChC,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAMT;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAC/B,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,KAAK,OAAO,CAM/C"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Admin email whitelist utilities
|
|
4
|
+
*
|
|
5
|
+
* Pure utility functions for parsing and checking admin email whitelists.
|
|
6
|
+
* Used by both frontend (auth_lib) and backend (auth_service) packages.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.parseAdminEmails = parseAdminEmails;
|
|
10
|
+
exports.isAdminEmail = isAdminEmail;
|
|
11
|
+
exports.createAdminChecker = createAdminChecker;
|
|
12
|
+
/**
|
|
13
|
+
* Parse admin emails from environment variable or string
|
|
14
|
+
*
|
|
15
|
+
* @param input - Comma-separated string of admin emails (e.g., "admin@example.com, other@example.com")
|
|
16
|
+
* @returns Array of normalized (lowercase, trimmed) email addresses
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const adminEmails = parseAdminEmails(process.env.ADMIN_EMAILS || "");
|
|
21
|
+
* // Returns: ["admin@example.com", "other@example.com"]
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
function parseAdminEmails(input) {
|
|
25
|
+
if (!input) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
return input
|
|
29
|
+
.split(',')
|
|
30
|
+
.map((email) => email.trim().toLowerCase())
|
|
31
|
+
.filter((email) => email.length > 0 && email.includes('@'));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Check if an email is in the admin whitelist
|
|
35
|
+
*
|
|
36
|
+
* @param email - Email address to check
|
|
37
|
+
* @param adminEmails - Array of admin emails (from parseAdminEmails)
|
|
38
|
+
* @returns True if the email is an admin
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const adminEmails = parseAdminEmails(process.env.ADMIN_EMAILS || "");
|
|
43
|
+
* if (isAdminEmail(user.email, adminEmails)) {
|
|
44
|
+
* // Skip rate limiting, subscription checks, etc.
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
function isAdminEmail(email, adminEmails) {
|
|
49
|
+
if (!email) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return adminEmails.includes(email.toLowerCase());
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a cached admin email checker
|
|
56
|
+
*
|
|
57
|
+
* Parses the admin emails once and returns a checker function.
|
|
58
|
+
* Useful for middleware where you don't want to re-parse on every request.
|
|
59
|
+
*
|
|
60
|
+
* @param input - Comma-separated string of admin emails
|
|
61
|
+
* @returns Function that checks if an email is an admin
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const isAdmin = createAdminChecker(process.env.ADMIN_EMAILS);
|
|
66
|
+
*
|
|
67
|
+
* // In middleware:
|
|
68
|
+
* if (isAdmin(user.email)) {
|
|
69
|
+
* // Bypass checks
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
function createAdminChecker(input) {
|
|
74
|
+
const adminEmails = parseAdminEmails(input);
|
|
75
|
+
return (email) => {
|
|
76
|
+
return isAdminEmail(email, adminEmails);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=admin-emails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-emails.js","sourceRoot":"","sources":["../../../src/utils/auth/admin-emails.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAcH,4CASC;AAiBD,oCASC;AAqBD,gDAQC;AA5ED;;;;;;;;;;;GAWG;AACH,SAAgB,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,SAAgB,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,SAAgB,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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudobility/types",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.48",
|
|
4
4
|
"description": "Comprehensive TypeScript types, interfaces, and utilities for Web3 email applications - optimized for AI-assisted development",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|