@explorins/pers-sdk 2.1.37 → 2.1.39
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/business/api/business-api.d.ts +4 -0
- package/dist/business/api/business-api.d.ts.map +1 -1
- package/dist/business/index.d.ts +1 -1
- package/dist/business/index.d.ts.map +1 -1
- package/dist/business.cjs +1 -1
- package/dist/business.js +1 -1
- package/dist/chunks/{base-token-service-BGuuZX4b.js → base-token-service-N1gwRD8N.js} +2 -2
- package/dist/chunks/{base-token-service-BGuuZX4b.js.map → base-token-service-N1gwRD8N.js.map} +1 -1
- package/dist/chunks/{base-token-service-DSye0WD2.cjs → base-token-service-W7TU23qU.cjs} +2 -2
- package/dist/chunks/{base-token-service-DSye0WD2.cjs.map → base-token-service-W7TU23qU.cjs.map} +1 -1
- package/dist/chunks/{business-membership-service-B9ItWZ2_.cjs → business-membership-service-Dkb780NX.cjs} +21 -1
- package/dist/chunks/business-membership-service-Dkb780NX.cjs.map +1 -0
- package/dist/chunks/{business-membership-service-CPcE-AW0.js → business-membership-service-NLoqoFpG.js} +21 -1
- package/dist/chunks/business-membership-service-NLoqoFpG.js.map +1 -0
- package/dist/chunks/{pers-sdk-Dds2lB27.js → pers-sdk-CNIfzWYX.js} +155 -75
- package/dist/chunks/pers-sdk-CNIfzWYX.js.map +1 -0
- package/dist/chunks/{pers-sdk-DemghJ3a.cjs → pers-sdk-Cwlrl8jb.cjs} +155 -75
- package/dist/chunks/pers-sdk-Cwlrl8jb.cjs.map +1 -0
- package/dist/chunks/{redemption-service-Dc_0Kzd0.cjs → redemption-service-KamEndzB.cjs} +7 -1
- package/dist/chunks/{redemption-service-Dc_0Kzd0.cjs.map → redemption-service-KamEndzB.cjs.map} +1 -1
- package/dist/chunks/{redemption-service-DWhZgrZT.js → redemption-service-w0GMdF0m.js} +7 -1
- package/dist/chunks/{redemption-service-DWhZgrZT.js.map → redemption-service-w0GMdF0m.js.map} +1 -1
- package/dist/chunks/{token-service-qRSYG9uT.js → token-service-BcuDj292.js} +79 -14
- package/dist/chunks/token-service-BcuDj292.js.map +1 -0
- package/dist/chunks/{token-service-BJqu5Xap.cjs → token-service-CnnrCOsg.cjs} +79 -14
- package/dist/chunks/token-service-CnnrCOsg.cjs.map +1 -0
- package/dist/core/auth/refresh-manager.d.ts +12 -2
- package/dist/core/auth/refresh-manager.d.ts.map +1 -1
- package/dist/core/auth/services/auth-service.d.ts +4 -1
- package/dist/core/auth/services/auth-service.d.ts.map +1 -1
- package/dist/core/pers-api-client.d.ts.map +1 -1
- package/dist/core.cjs +4 -4
- package/dist/core.js +4 -4
- package/dist/index.cjs +5 -5
- package/dist/index.js +5 -5
- package/dist/managers/redemption-manager.d.ts +13 -0
- package/dist/managers/redemption-manager.d.ts.map +1 -1
- package/dist/managers/token-manager.d.ts +63 -39
- package/dist/managers/token-manager.d.ts.map +1 -1
- package/dist/node.cjs +4 -4
- package/dist/node.js +4 -4
- package/dist/package.json +2 -2
- package/dist/redemption/services/redemption-service.d.ts +4 -0
- package/dist/redemption/services/redemption-service.d.ts.map +1 -1
- package/dist/redemption.cjs +1 -1
- package/dist/redemption.js +1 -1
- package/dist/token/api/token-api.d.ts +50 -12
- package/dist/token/api/token-api.d.ts.map +1 -1
- package/dist/token/index.d.ts +1 -1
- package/dist/token/index.d.ts.map +1 -1
- package/dist/token/services/token-service.d.ts +40 -9
- package/dist/token/services/token-service.d.ts.map +1 -1
- package/dist/token.cjs +2 -2
- package/dist/token.js +2 -2
- package/dist/trigger-source/api/trigger-source-api.d.ts +9 -10
- package/dist/trigger-source/api/trigger-source-api.d.ts.map +1 -1
- package/dist/trigger-source/index.d.ts +1 -0
- package/dist/trigger-source/index.d.ts.map +1 -1
- package/dist/trigger-source/models/index.d.ts +5 -13
- package/dist/trigger-source/models/index.d.ts.map +1 -1
- package/dist/trigger-source/services/trigger-source-service.d.ts +3 -11
- package/dist/trigger-source/services/trigger-source-service.d.ts.map +1 -1
- package/dist/trigger-source.cjs +20 -1
- package/dist/trigger-source.cjs.map +1 -1
- package/dist/trigger-source.js +20 -1
- package/dist/trigger-source.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunks/business-membership-service-B9ItWZ2_.cjs.map +0 -1
- package/dist/chunks/business-membership-service-CPcE-AW0.js.map +0 -1
- package/dist/chunks/pers-sdk-Dds2lB27.js.map +0 -1
- package/dist/chunks/pers-sdk-DemghJ3a.cjs.map +0 -1
- package/dist/chunks/token-service-BJqu5Xap.cjs.map +0 -1
- package/dist/chunks/token-service-qRSYG9uT.js.map +0 -1
|
@@ -2,10 +2,10 @@ import { AccountOwnerType, MembershipRole, WebhookMethod, WebhookExecutionStatus
|
|
|
2
2
|
import { i as isTokenExpired, d as decodeJwtPayload, e as getTokenTimeToLive, E as ErrorUtils, A as AuthenticationError, b as PersApiError } from './index--OssIds0.js';
|
|
3
3
|
import { UserService, UserApi } from '../user.js';
|
|
4
4
|
import { createUserStatusSDK } from '../user-status.js';
|
|
5
|
-
import { a as TokenService, T as TokenApi } from './token-service-
|
|
6
|
-
import { B as BusinessApi, b as BusinessService, a as BusinessMembershipApi, c as BusinessMembershipService } from './business-membership-service-
|
|
5
|
+
import { a as TokenService, T as TokenApi } from './token-service-BcuDj292.js';
|
|
6
|
+
import { B as BusinessApi, b as BusinessService, a as BusinessMembershipApi, c as BusinessMembershipService } from './business-membership-service-NLoqoFpG.js';
|
|
7
7
|
import { CampaignService, CampaignApi } from '../campaign.js';
|
|
8
|
-
import { a as RedemptionService, R as RedemptionApi } from './redemption-service-
|
|
8
|
+
import { a as RedemptionService, R as RedemptionApi } from './redemption-service-w0GMdF0m.js';
|
|
9
9
|
import { a as TransactionService, T as TransactionApi } from './transaction-request.builder-BZ6Uq6Qe.js';
|
|
10
10
|
import { a as PaymentService, P as PurchaseApi } from './payment-service-IvM6rryM.js';
|
|
11
11
|
import { T as TenantManager } from './tenant-manager-xmYKBFGu.js';
|
|
@@ -502,6 +502,9 @@ class AuthService {
|
|
|
502
502
|
* Extracts context (tenantId/businessId) from the current refresh token to ensure
|
|
503
503
|
* the recovered session maintains the same context.
|
|
504
504
|
*
|
|
505
|
+
* This is a PUBLIC method that can be called by TokenRefreshManager when internal
|
|
506
|
+
* refresh fails, to try external (provider token) recovery before giving up.
|
|
507
|
+
*
|
|
505
508
|
* @returns true if session was successfully recovered
|
|
506
509
|
*/
|
|
507
510
|
async attemptProviderTokenRecovery() {
|
|
@@ -654,6 +657,8 @@ class TokenRefreshManager {
|
|
|
654
657
|
// Retry configuration for transient failures
|
|
655
658
|
this.MAX_RETRY_ATTEMPTS = 3;
|
|
656
659
|
this.RETRY_DELAY_MS = 1000;
|
|
660
|
+
// Active refresh promise for deduplication
|
|
661
|
+
this.activeRefreshPromise = null;
|
|
657
662
|
}
|
|
658
663
|
/**
|
|
659
664
|
* Ensures the access token is valid, refreshing if needed.
|
|
@@ -754,11 +759,27 @@ class TokenRefreshManager {
|
|
|
754
759
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
755
760
|
}
|
|
756
761
|
/**
|
|
757
|
-
*
|
|
762
|
+
* Attempt token refresh: internal first, then provider token fallback.
|
|
763
|
+
* DEDUPLICATES concurrent calls - all callers share the same promise.
|
|
758
764
|
*/
|
|
759
765
|
async attemptInternalRefresh() {
|
|
760
|
-
|
|
761
|
-
|
|
766
|
+
if (this.activeRefreshPromise) {
|
|
767
|
+
return this.activeRefreshPromise;
|
|
768
|
+
}
|
|
769
|
+
this.activeRefreshPromise = (async () => {
|
|
770
|
+
const result = await this.attemptRefreshWithRetry();
|
|
771
|
+
if (result.success)
|
|
772
|
+
return result;
|
|
773
|
+
// Internal failed - try provider token recovery
|
|
774
|
+
const recovered = await this.authService.attemptProviderTokenRecovery();
|
|
775
|
+
return recovered ? { success: true, retryable: false } : result;
|
|
776
|
+
})();
|
|
777
|
+
try {
|
|
778
|
+
return await this.activeRefreshPromise;
|
|
779
|
+
}
|
|
780
|
+
finally {
|
|
781
|
+
this.activeRefreshPromise = null;
|
|
782
|
+
}
|
|
762
783
|
}
|
|
763
784
|
}
|
|
764
785
|
|
|
@@ -1564,7 +1585,7 @@ class DefaultAuthProvider {
|
|
|
1564
1585
|
/** SDK package name */
|
|
1565
1586
|
const SDK_NAME = "@explorins/pers-sdk";
|
|
1566
1587
|
/** SDK version - injected from package.json at build time */
|
|
1567
|
-
const SDK_VERSION = "2.1.
|
|
1588
|
+
const SDK_VERSION = "2.1.39";
|
|
1568
1589
|
/** Full SDK identifier for headers */
|
|
1569
1590
|
const SDK_USER_AGENT = `${SDK_NAME}/${SDK_VERSION}`;
|
|
1570
1591
|
|
|
@@ -1674,12 +1695,16 @@ class PersApiClient {
|
|
|
1674
1695
|
}
|
|
1675
1696
|
const { retryCount = 0, responseType = 'json', bypassAuth = false } = options || {};
|
|
1676
1697
|
const url = `${this.apiRoot}${endpoint}`;
|
|
1677
|
-
//
|
|
1698
|
+
// TOKEN VALIDATION: Ensure token is valid before request
|
|
1699
|
+
// This blocks the request until token validation completes - prevents 401s from expired tokens
|
|
1678
1700
|
if (!bypassAuth && this.mergedConfig.authProvider && retryCount === 0) {
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1701
|
+
try {
|
|
1702
|
+
await this.ensureValidToken();
|
|
1703
|
+
}
|
|
1704
|
+
catch (error) {
|
|
1705
|
+
console.debug('[PersApiClient] Token validation failed:', error);
|
|
1706
|
+
// Continue with request - it will fail with 401 and trigger retry logic
|
|
1707
|
+
}
|
|
1683
1708
|
}
|
|
1684
1709
|
const requestOptions = {
|
|
1685
1710
|
headers: await this.getHeaders(!bypassAuth, method, url),
|
|
@@ -1707,49 +1732,63 @@ class PersApiClient {
|
|
|
1707
1732
|
return result;
|
|
1708
1733
|
}
|
|
1709
1734
|
catch (error) {
|
|
1710
|
-
// Error handling - proactive token refresh should prevent most 401s
|
|
1711
1735
|
const status = ErrorUtils.getStatus(error);
|
|
1712
1736
|
const errorMessage = ErrorUtils.getMessage(error);
|
|
1713
|
-
// Handle 401 errors
|
|
1737
|
+
// Handle 401 Unauthorized errors
|
|
1714
1738
|
if (status === 401) {
|
|
1715
1739
|
const backendError = ErrorUtils.extractBackendErrorDetails(error);
|
|
1716
|
-
//
|
|
1717
|
-
//
|
|
1718
|
-
//
|
|
1740
|
+
// ===========================================
|
|
1741
|
+
// FATAL AUTH ERRORS → Immediate logout
|
|
1742
|
+
// ===========================================
|
|
1743
|
+
// Fatal codes: REFRESH_TOKEN_EXPIRED, TOKEN_REVOKED, INVALID_REFRESH_TOKEN, etc.
|
|
1719
1744
|
if (this.authService.isFatalAuthError(backendError.code)) {
|
|
1720
|
-
|
|
1745
|
+
console.warn(`[PersApiClient] Fatal auth error: ${backendError.code}`);
|
|
1721
1746
|
await this.authService.handleAuthFailure();
|
|
1722
1747
|
this.emitErrorEvent(backendError, errorMessage, endpoint, method, status, error);
|
|
1723
1748
|
throw new AuthenticationError(errorMessage, endpoint, method, backendError);
|
|
1724
1749
|
}
|
|
1725
|
-
//
|
|
1750
|
+
// ===========================================
|
|
1751
|
+
// REFRESH REQUEST FAILED → Logout (prevents infinite loop)
|
|
1752
|
+
// ===========================================
|
|
1726
1753
|
if (options?.isRefreshRequest) {
|
|
1727
|
-
|
|
1754
|
+
console.warn('[PersApiClient] Refresh request itself failed with 401');
|
|
1728
1755
|
await this.authService.handleAuthFailure();
|
|
1729
1756
|
this.emitErrorEvent(backendError, errorMessage, endpoint, method, status, error);
|
|
1730
1757
|
throw new AuthenticationError(errorMessage, endpoint, method, backendError);
|
|
1731
1758
|
}
|
|
1732
|
-
//
|
|
1759
|
+
// ===========================================
|
|
1760
|
+
// RETRYABLE 401 (TOKEN_EXPIRED) → Try refresh, then retry
|
|
1761
|
+
// ===========================================
|
|
1733
1762
|
if (retryCount === 0 && this.mergedConfig.authProvider) {
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1763
|
+
const refreshResult = await this.refreshManager.attemptInternalRefresh();
|
|
1764
|
+
if (refreshResult.success) {
|
|
1765
|
+
// Refresh succeeded → retry request with new token
|
|
1766
|
+
this._events?.emitSuccess({
|
|
1767
|
+
type: 'token_refreshed',
|
|
1768
|
+
domain: 'authentication',
|
|
1769
|
+
userMessage: 'Authentication token refreshed',
|
|
1770
|
+
});
|
|
1771
|
+
return await this.request(method, endpoint, body, { ...options, retryCount: 1 });
|
|
1772
|
+
}
|
|
1773
|
+
// Refresh failed - check if it's a definitive failure
|
|
1774
|
+
if (!refreshResult.retryable) {
|
|
1775
|
+
// Non-retryable failure (e.g., refresh token expired) → logout
|
|
1776
|
+
console.warn('[PersApiClient] Refresh failed with non-retryable error, logging out');
|
|
1777
|
+
await this.authService.handleAuthFailure();
|
|
1746
1778
|
}
|
|
1747
|
-
|
|
1748
|
-
//
|
|
1779
|
+
else {
|
|
1780
|
+
// Retryable failure (network error, etc.) → DON'T logout, let app retry later
|
|
1781
|
+
console.warn('[PersApiClient] Refresh failed with retryable error, NOT logging out');
|
|
1749
1782
|
}
|
|
1783
|
+
this.emitErrorEvent(backendError, errorMessage, endpoint, method, status, error);
|
|
1784
|
+
throw new AuthenticationError(errorMessage, endpoint, method, backendError);
|
|
1750
1785
|
}
|
|
1751
|
-
//
|
|
1752
|
-
|
|
1786
|
+
// ===========================================
|
|
1787
|
+
// RETRY FAILED (retryCount > 0) → Something wrong, but DON'T logout
|
|
1788
|
+
// ===========================================
|
|
1789
|
+
// We already refreshed successfully, but retry still got 401
|
|
1790
|
+
// This is unexpected - don't logout, let app investigate
|
|
1791
|
+
console.warn('[PersApiClient] Retry with new token still got 401 - not logging out');
|
|
1753
1792
|
this.emitErrorEvent(backendError, errorMessage, endpoint, method, status, error);
|
|
1754
1793
|
throw new AuthenticationError(errorMessage, endpoint, method, backendError);
|
|
1755
1794
|
}
|
|
@@ -3414,16 +3453,17 @@ class TokenManager {
|
|
|
3414
3453
|
return this.tokenService.getTokenByContractAddress(contractAddress, contractTokenId);
|
|
3415
3454
|
}
|
|
3416
3455
|
/**
|
|
3417
|
-
* Get all token metadata with filtering and
|
|
3456
|
+
* Get all token metadata with filtering, pagination, and include relations
|
|
3418
3457
|
*
|
|
3419
|
-
* Retrieves token metadata (rewards/stamps) with server-side filtering
|
|
3458
|
+
* Retrieves token metadata (rewards/stamps) with server-side filtering, pagination,
|
|
3459
|
+
* and optional include relations for additional data.
|
|
3420
3460
|
* Useful for displaying rewards (ERC1155) or stamps (ERC721) in admin tables.
|
|
3421
3461
|
* Non-admin users always get active metadata only.
|
|
3422
3462
|
*
|
|
3423
|
-
* @param options - Filter and
|
|
3463
|
+
* @param options - Filter, pagination, and include options
|
|
3424
3464
|
* @returns Promise resolving to paginated token metadata
|
|
3425
3465
|
*
|
|
3426
|
-
* @example Get paginated rewards
|
|
3466
|
+
* @example Get paginated rewards with counts
|
|
3427
3467
|
* ```typescript
|
|
3428
3468
|
* const rewards = await sdk.tokens.getTokenMetadata({
|
|
3429
3469
|
* tokenType: 'ERC1155',
|
|
@@ -3431,19 +3471,26 @@ class TokenManager {
|
|
|
3431
3471
|
* page: 1,
|
|
3432
3472
|
* limit: 10,
|
|
3433
3473
|
* sortBy: 'name',
|
|
3434
|
-
* sortOrder: 'ASC'
|
|
3474
|
+
* sortOrder: 'ASC',
|
|
3475
|
+
* include: ['mintCount', 'burnCount', 'token']
|
|
3435
3476
|
* });
|
|
3436
3477
|
*
|
|
3437
|
-
*
|
|
3438
|
-
*
|
|
3478
|
+
* rewards.data.forEach(r => {
|
|
3479
|
+
* console.log(`${r.name}: ${r.mintCount} minted, ${r.burnCount} burned`);
|
|
3480
|
+
* console.log(`Contract: ${r.included?.token?.contractAddress}`);
|
|
3481
|
+
* });
|
|
3439
3482
|
* ```
|
|
3440
3483
|
*
|
|
3441
|
-
* @example Get stamps with
|
|
3484
|
+
* @example Get stamps with owner business
|
|
3442
3485
|
* ```typescript
|
|
3443
3486
|
* const stamps = await sdk.tokens.getTokenMetadata({
|
|
3444
3487
|
* tokenType: 'ERC721',
|
|
3445
3488
|
* search: 'gold',
|
|
3446
|
-
*
|
|
3489
|
+
* include: ['ownerBusiness', 'token']
|
|
3490
|
+
* });
|
|
3491
|
+
*
|
|
3492
|
+
* stamps.data.forEach(s => {
|
|
3493
|
+
* console.log(`${s.name} owned by ${s.included?.ownerBusiness?.displayName}`);
|
|
3447
3494
|
* });
|
|
3448
3495
|
* ```
|
|
3449
3496
|
*/
|
|
@@ -3451,31 +3498,27 @@ class TokenManager {
|
|
|
3451
3498
|
return this.tokenService.getTokenMetadata(options);
|
|
3452
3499
|
}
|
|
3453
3500
|
/**
|
|
3454
|
-
* Get rewards (ERC1155 token metadata) with filtering and
|
|
3501
|
+
* Get rewards (ERC1155 token metadata) with filtering, pagination, and include relations
|
|
3455
3502
|
*
|
|
3456
3503
|
* Convenience method for fetching reward metadata. Rewards are ERC1155 tokens
|
|
3457
3504
|
* that represent collectible items, vouchers, or other redeemable rewards.
|
|
3458
3505
|
*
|
|
3459
|
-
* @param options - Filter and
|
|
3506
|
+
* @param options - Filter, pagination, and include options (tokenType is set automatically)
|
|
3460
3507
|
* @returns Promise resolving to paginated reward metadata
|
|
3461
3508
|
*
|
|
3462
|
-
* @example Get active rewards
|
|
3509
|
+
* @example Get active rewards with mint counts
|
|
3463
3510
|
* ```typescript
|
|
3464
3511
|
* const rewards = await sdk.tokens.getRewards({
|
|
3465
3512
|
* active: true,
|
|
3466
|
-
* limit: 10
|
|
3513
|
+
* limit: 10,
|
|
3514
|
+
* include: ['mintCount', 'burnCount', 'token', 'ownerBusiness']
|
|
3467
3515
|
* });
|
|
3468
3516
|
*
|
|
3469
|
-
*
|
|
3470
|
-
*
|
|
3471
|
-
*
|
|
3472
|
-
*
|
|
3473
|
-
*
|
|
3474
|
-
* ```typescript
|
|
3475
|
-
* const discountRewards = await sdk.tokens.getRewards({
|
|
3476
|
-
* search: 'discount',
|
|
3477
|
-
* sortBy: 'name',
|
|
3478
|
-
* sortOrder: 'ASC'
|
|
3517
|
+
* rewards.data.forEach(r => {
|
|
3518
|
+
* console.log(`${r.name}: ${r.mintCount ?? 0} minted`);
|
|
3519
|
+
* if (r.included?.token) {
|
|
3520
|
+
* console.log(` Chain: ${r.included.token.chainId}, Contract: ${r.included.token.contractAddress}`);
|
|
3521
|
+
* }
|
|
3479
3522
|
* });
|
|
3480
3523
|
* ```
|
|
3481
3524
|
*/
|
|
@@ -3483,31 +3526,27 @@ class TokenManager {
|
|
|
3483
3526
|
return this.tokenService.getRewards(options);
|
|
3484
3527
|
}
|
|
3485
3528
|
/**
|
|
3486
|
-
* Get stamps (ERC721 token metadata) with filtering and
|
|
3529
|
+
* Get stamps (ERC721 token metadata) with filtering, pagination, and include relations
|
|
3487
3530
|
*
|
|
3488
3531
|
* Convenience method for fetching stamp metadata. Stamps are ERC721 tokens
|
|
3489
3532
|
* that represent achievements, badges, or collectible status markers.
|
|
3490
3533
|
*
|
|
3491
|
-
* @param options - Filter and
|
|
3534
|
+
* @param options - Filter, pagination, and include options (tokenType is set automatically)
|
|
3492
3535
|
* @returns Promise resolving to paginated stamp metadata
|
|
3493
3536
|
*
|
|
3494
|
-
* @example Get active stamps
|
|
3537
|
+
* @example Get active stamps with all includes
|
|
3495
3538
|
* ```typescript
|
|
3496
3539
|
* const stamps = await sdk.tokens.getStamps({
|
|
3497
3540
|
* active: true,
|
|
3498
|
-
* limit: 10
|
|
3541
|
+
* limit: 10,
|
|
3542
|
+
* include: ['mintCount', 'burnCount', 'token', 'ownerBusiness']
|
|
3499
3543
|
* });
|
|
3500
3544
|
*
|
|
3501
|
-
*
|
|
3502
|
-
*
|
|
3503
|
-
*
|
|
3504
|
-
*
|
|
3505
|
-
*
|
|
3506
|
-
* ```typescript
|
|
3507
|
-
* const goldStamps = await sdk.tokens.getStamps({
|
|
3508
|
-
* tags: ['gold', 'premium'],
|
|
3509
|
-
* sortBy: 'createdAt',
|
|
3510
|
-
* sortOrder: 'DESC'
|
|
3545
|
+
* stamps.data.forEach(s => {
|
|
3546
|
+
* console.log(`${s.name}: ${s.mintCount ?? 0} minted`);
|
|
3547
|
+
* if (s.included?.ownerBusiness) {
|
|
3548
|
+
* console.log(` Owner: ${s.included.ownerBusiness.displayName}`);
|
|
3549
|
+
* }
|
|
3511
3550
|
* });
|
|
3512
3551
|
* ```
|
|
3513
3552
|
*/
|
|
@@ -3605,6 +3644,32 @@ class TokenManager {
|
|
|
3605
3644
|
async toggleTokenActive(tokenId) {
|
|
3606
3645
|
return this.tokenService.toggleTokenActive(tokenId);
|
|
3607
3646
|
}
|
|
3647
|
+
/**
|
|
3648
|
+
* Admin: Delete token metadata (soft delete)
|
|
3649
|
+
*
|
|
3650
|
+
* Soft deletes token metadata by setting deletedAt timestamp.
|
|
3651
|
+
* Requires administrator privileges. Will fail with 409 Conflict
|
|
3652
|
+
* if metadata is currently in use by active campaigns or redemptions.
|
|
3653
|
+
*
|
|
3654
|
+
* @param metadataId - ID of the token metadata to delete
|
|
3655
|
+
* @throws {PersApiError} When not authenticated as admin
|
|
3656
|
+
* @throws {PersApiError} 409 Conflict if metadata is in use
|
|
3657
|
+
*
|
|
3658
|
+
* @example
|
|
3659
|
+
* ```typescript
|
|
3660
|
+
* try {
|
|
3661
|
+
* await sdk.tokens.deleteTokenMetadata('metadata-123');
|
|
3662
|
+
* console.log('Token metadata deleted');
|
|
3663
|
+
* } catch (error) {
|
|
3664
|
+
* if (error.statusCode === 409) {
|
|
3665
|
+
* console.log('Cannot delete: metadata is used by campaigns/redemptions');
|
|
3666
|
+
* }
|
|
3667
|
+
* }
|
|
3668
|
+
* ```
|
|
3669
|
+
*/
|
|
3670
|
+
async deleteTokenMetadata(metadataId) {
|
|
3671
|
+
return this.tokenService.deleteTokenMetadata(metadataId);
|
|
3672
|
+
}
|
|
3608
3673
|
/**
|
|
3609
3674
|
* Get the full token SDK for advanced operations
|
|
3610
3675
|
*
|
|
@@ -5998,6 +6063,21 @@ class RedemptionManager {
|
|
|
5998
6063
|
async deleteRedemptionType(id) {
|
|
5999
6064
|
return this.redemptionService.deleteRedemptionType(id);
|
|
6000
6065
|
}
|
|
6066
|
+
/**
|
|
6067
|
+
* Delete a redemption (soft delete)
|
|
6068
|
+
*
|
|
6069
|
+
* @param id - Redemption ID to delete
|
|
6070
|
+
* @returns Promise resolving to true if deleted successfully
|
|
6071
|
+
*
|
|
6072
|
+
* @example
|
|
6073
|
+
* ```typescript
|
|
6074
|
+
* const success = await sdk.redemptions.deleteRedemption('redemption-123');
|
|
6075
|
+
* console.log('Deleted:', success);
|
|
6076
|
+
* ```
|
|
6077
|
+
*/
|
|
6078
|
+
async deleteRedemption(id) {
|
|
6079
|
+
return this.redemptionService.deleteRedemption(id);
|
|
6080
|
+
}
|
|
6001
6081
|
/**
|
|
6002
6082
|
* Get the full redemption service for advanced operations
|
|
6003
6083
|
*
|
|
@@ -10820,4 +10900,4 @@ function createPersSDK(httpClient, config) {
|
|
|
10820
10900
|
}
|
|
10821
10901
|
|
|
10822
10902
|
export { AuthStatus as A, BusinessManager as B, CampaignManager as C, DefaultAuthProvider as D, WebhookManager as E, FATAL_AUTH_CODES as F, WalletEventsManager as G, FileApi as H, IndexedDBTokenStorage as I, FileService as J, ApiKeyApi as K, LocalStorageTokenStorage as L, MemoryTokenStorage as M, WebhookApi as N, WebhookService as O, PersSDK as P, PersEventsClient as Q, RedemptionManager as R, SDK_NAME as S, TokenManager as T, UserManager as U, createPersEventsClient as V, WebDPoPCryptoProvider as W, AuthTokenManager as a, AUTH_STORAGE_KEYS as b, createPersSDK as c, DPOP_STORAGE_KEYS as d, SDK_VERSION as e, SDK_USER_AGENT as f, PersApiClient as g, DEFAULT_PERS_CONFIG as h, buildApiRoot as i, buildWalletEventsWsUrl as j, StaticJwtAuthProvider as k, AuthApi as l, mergeWithDefaults as m, isFatalAuthErrorInMessage as n, AuthService as o, DPoPManager as p, PersEventEmitter as q, AuthManager as r, UserStatusManager as s, TransactionManager as t, PurchaseManager as u, FileManager as v, ApiKeyManager as w, AnalyticsManager as x, DonationManager as y, TriggerSourceManager as z };
|
|
10823
|
-
//# sourceMappingURL=pers-sdk-
|
|
10903
|
+
//# sourceMappingURL=pers-sdk-CNIfzWYX.js.map
|