@polyester/sdk 0.29.2 → 0.30.1
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/CHANGELOG.md +22 -0
- package/dist/browser-client.d.ts +7 -34
- package/dist/browser-client.d.ts.map +1 -1
- package/dist/browser-client.js +7 -59
- package/dist/browser-client.js.map +1 -1
- package/dist/browser-core.d.ts +41 -0
- package/dist/browser-core.d.ts.map +1 -0
- package/dist/browser-core.js +71 -0
- package/dist/browser-core.js.map +1 -0
- package/dist/catalogs/index.js +2 -2
- package/dist/catalogs/readers.js +1 -1
- package/dist/client.d.ts +74 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +85 -0
- package/dist/client.js.map +1 -0
- package/dist/core-client.d.ts +18 -91
- package/dist/core-client.d.ts.map +1 -1
- package/dist/core-client.js +58 -164
- package/dist/core-client.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
- package/dist/gen/index.d.ts +2 -1
- package/dist/gen/index.js +19 -18
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js +1 -1
- package/dist/gen/rewards/v1/rewards_pb.d.ts +284 -0
- package/dist/gen/rewards/v1/rewards_pb.d.ts.map +1 -0
- package/dist/gen/rewards/v1/rewards_pb.js +117 -0
- package/dist/gen/rewards/v1/rewards_pb.js.map +1 -0
- package/dist/index.d.ts +17 -11
- package/dist/index.js +10 -6
- package/dist/realtime/snapshot-then-stream.js +1 -1
- package/dist/server-client.d.ts +7 -81
- package/dist/server-client.d.ts.map +1 -1
- package/dist/server-client.js +10 -115
- package/dist/server-client.js.map +1 -1
- package/dist/server-core.d.ts +97 -0
- package/dist/server-core.d.ts.map +1 -0
- package/dist/server-core.js +150 -0
- package/dist/server-core.js.map +1 -0
- package/dist/services/accounts/accounts.js +1 -1
- package/dist/services/accounts/accounts.schemas.d.ts +1 -1
- package/dist/services/accounts/accounts.schemas.js +1 -1
- package/dist/services/accounts/service.d.ts +8 -0
- package/dist/services/accounts/service.d.ts.map +1 -0
- package/dist/services/accounts/service.js +9 -0
- package/dist/services/accounts/service.js.map +1 -0
- package/dist/services/address-book/address-book.js +2 -2
- package/dist/services/address-book/address-book.schemas.d.ts +9 -9
- package/dist/services/address-book/address-book.schemas.js +4 -4
- package/dist/services/address-book/service.d.ts +8 -0
- package/dist/services/address-book/service.d.ts.map +1 -0
- package/dist/services/address-book/service.js +9 -0
- package/dist/services/address-book/service.js.map +1 -0
- package/dist/services/api-keys/api-keys.js +2 -2
- package/dist/services/api-keys/api-keys.schemas.d.ts +5 -5
- package/dist/services/api-keys/api-keys.schemas.js +3 -3
- package/dist/services/api-keys/service.d.ts +8 -0
- package/dist/services/api-keys/service.d.ts.map +1 -0
- package/dist/services/api-keys/service.js +9 -0
- package/dist/services/api-keys/service.js.map +1 -0
- package/dist/services/auth/account-signer-auth.d.ts +6 -4
- package/dist/services/auth/account-signer-auth.d.ts.map +1 -1
- package/dist/services/auth/account-signer-auth.js +3 -2
- package/dist/services/auth/account-signer-auth.js.map +1 -1
- package/dist/services/auth/auth.js +1 -1
- package/dist/services/auth/profile/profile.js +2 -2
- package/dist/services/balances/balances.js +1 -1
- package/dist/services/balances/balances.schemas.js +2 -2
- package/dist/services/balances/service.d.ts +8 -0
- package/dist/services/balances/service.d.ts.map +1 -0
- package/dist/services/balances/service.js +9 -0
- package/dist/services/balances/service.js.map +1 -0
- package/dist/services/candles/candles.js +1 -1
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/candles/candles.schemas.js +2 -2
- package/dist/services/candles/service.d.ts +8 -0
- package/dist/services/candles/service.d.ts.map +1 -0
- package/dist/services/candles/service.js +9 -0
- package/dist/services/candles/service.js.map +1 -0
- package/dist/services/chain-analytics/chain-analytics.schemas.js +2 -2
- package/dist/services/chain-analytics/service.d.ts +8 -0
- package/dist/services/chain-analytics/service.d.ts.map +1 -0
- package/dist/services/chain-analytics/service.js +9 -0
- package/dist/services/chain-analytics/service.js.map +1 -0
- package/dist/services/claims/claims.js +1 -1
- package/dist/services/claims/claims.schemas.js +1 -1
- package/dist/services/claims/service.d.ts +8 -0
- package/dist/services/claims/service.d.ts.map +1 -0
- package/dist/services/claims/service.js +9 -0
- package/dist/services/claims/service.js.map +1 -0
- package/dist/services/deposit/deposit.js +1 -1
- package/dist/services/deposit/service.d.ts +8 -0
- package/dist/services/deposit/service.d.ts.map +1 -0
- package/dist/services/deposit/service.js +9 -0
- package/dist/services/deposit/service.js.map +1 -0
- package/dist/services/fees/fees.js +1 -1
- package/dist/services/fees/service.d.ts +8 -0
- package/dist/services/fees/service.d.ts.map +1 -0
- package/dist/services/fees/service.js +9 -0
- package/dist/services/fees/service.js.map +1 -0
- package/dist/services/guard-signer/guard-signer.js +2 -2
- package/dist/services/guard-signer/guard-signer.schemas.js +1 -1
- package/dist/services/guard-signer/service.d.ts +8 -0
- package/dist/services/guard-signer/service.d.ts.map +1 -0
- package/dist/services/guard-signer/service.js +9 -0
- package/dist/services/guard-signer/service.js.map +1 -0
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/heatmap/heatmap.schemas.js +2 -2
- package/dist/services/heatmap/service.d.ts +8 -0
- package/dist/services/heatmap/service.d.ts.map +1 -0
- package/dist/services/heatmap/service.js +9 -0
- package/dist/services/heatmap/service.js.map +1 -0
- package/dist/services/internal-transfers/internal-transfers.js +2 -2
- package/dist/services/internal-transfers/internal-transfers.schemas.js +1 -1
- package/dist/services/internal-transfers/service.d.ts +8 -0
- package/dist/services/internal-transfers/service.d.ts.map +1 -0
- package/dist/services/internal-transfers/service.js +9 -0
- package/dist/services/internal-transfers/service.js.map +1 -0
- package/dist/services/lifecycle/lifecycle.js +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +40 -40
- package/dist/services/lifecycle/lifecycle.schemas.js +2 -2
- package/dist/services/lifecycle/service.d.ts +8 -0
- package/dist/services/lifecycle/service.d.ts.map +1 -0
- package/dist/services/lifecycle/service.js +9 -0
- package/dist/services/lifecycle/service.js.map +1 -0
- package/dist/services/market-data/market-data.js +2 -2
- package/dist/services/market-data/market-data.schemas.js +2 -2
- package/dist/services/market-data/service.d.ts +8 -0
- package/dist/services/market-data/service.d.ts.map +1 -0
- package/dist/services/market-data/service.js +9 -0
- package/dist/services/market-data/service.js.map +1 -0
- package/dist/services/market-overview/market-overview.js +1 -1
- package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
- package/dist/services/market-overview/market-overview.schemas.js +3 -3
- package/dist/services/market-overview/service.d.ts +8 -0
- package/dist/services/market-overview/service.d.ts.map +1 -0
- package/dist/services/market-overview/service.js +9 -0
- package/dist/services/market-overview/service.js.map +1 -0
- package/dist/services/mfa/mfa.js +1 -1
- package/dist/services/mfa/mfa.schemas.js +1 -1
- package/dist/services/mfa/service.d.ts +8 -0
- package/dist/services/mfa/service.d.ts.map +1 -0
- package/dist/services/mfa/service.js +9 -0
- package/dist/services/mfa/service.js.map +1 -0
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orderbook/orderbook.schemas.js +1 -1
- package/dist/services/orderbook/service.d.ts +8 -0
- package/dist/services/orderbook/service.d.ts.map +1 -0
- package/dist/services/orderbook/service.js +9 -0
- package/dist/services/orderbook/service.js.map +1 -0
- package/dist/services/orders/order-errors.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +45 -45
- package/dist/services/orders/orders-batch.schemas.js +5 -5
- package/dist/services/orders/orders-input.schemas.d.ts +39 -39
- package/dist/services/orders/orders-input.schemas.js +6 -6
- package/dist/services/orders/orders-modify.schemas.d.ts +18 -18
- package/dist/services/orders/orders-modify.schemas.js +4 -4
- package/dist/services/orders/orders-output.schemas.d.ts +12 -12
- package/dist/services/orders/orders-output.schemas.js +4 -4
- package/dist/services/orders/orders-risk.schemas.d.ts +15 -15
- package/dist/services/orders/orders-risk.schemas.js +3 -3
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +5 -3
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/orders/service.d.ts +8 -0
- package/dist/services/orders/service.d.ts.map +1 -0
- package/dist/services/orders/service.js +9 -0
- package/dist/services/orders/service.js.map +1 -0
- package/dist/services/policies/api-key-policies/api-key-policies.js +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.js +2 -2
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +3 -3
- package/dist/services/rate-limits/rate-limits.js +1 -1
- package/dist/services/rate-limits/rate-limits.schemas.js +1 -1
- package/dist/services/rate-limits/service.d.ts +8 -0
- package/dist/services/rate-limits/service.d.ts.map +1 -0
- package/dist/services/rate-limits/service.js +9 -0
- package/dist/services/rate-limits/service.js.map +1 -0
- package/dist/services/rewards/rewards.codecs.d.ts +8 -0
- package/dist/services/rewards/rewards.codecs.d.ts.map +1 -0
- package/dist/services/rewards/rewards.codecs.js +19 -0
- package/dist/services/rewards/rewards.codecs.js.map +1 -0
- package/dist/services/rewards/rewards.d.ts +23 -0
- package/dist/services/rewards/rewards.d.ts.map +1 -0
- package/dist/services/rewards/rewards.js +36 -0
- package/dist/services/rewards/rewards.js.map +1 -0
- package/dist/services/rewards/rewards.schemas.d.ts +85 -0
- package/dist/services/rewards/rewards.schemas.d.ts.map +1 -0
- package/dist/services/rewards/rewards.schemas.js +38 -0
- package/dist/services/rewards/rewards.schemas.js.map +1 -0
- package/dist/services/rewards/rewards.types.d.ts +3 -0
- package/dist/services/rewards/service.d.ts +8 -0
- package/dist/services/rewards/service.d.ts.map +1 -0
- package/dist/services/rewards/service.js +9 -0
- package/dist/services/rewards/service.js.map +1 -0
- package/dist/services/social-verification/service.d.ts +8 -0
- package/dist/services/social-verification/service.d.ts.map +1 -0
- package/dist/services/social-verification/service.js +9 -0
- package/dist/services/social-verification/service.js.map +1 -0
- package/dist/services/social-verification/social-verification.schemas.js +1 -1
- package/dist/services/subaccounts/service.d.ts +8 -0
- package/dist/services/subaccounts/service.d.ts.map +1 -0
- package/dist/services/subaccounts/service.js +9 -0
- package/dist/services/subaccounts/service.js.map +1 -0
- package/dist/services/subaccounts/subaccounts.js +2 -2
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +21 -21
- package/dist/services/subaccounts/subaccounts.schemas.js +3 -3
- package/dist/services/trades/service.d.ts +8 -0
- package/dist/services/trades/service.d.ts.map +1 -0
- package/dist/services/trades/service.js +9 -0
- package/dist/services/trades/service.js.map +1 -0
- package/dist/services/trades/trades.js +1 -1
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/trades/trades.schemas.js +4 -4
- package/dist/services/trading-withdraws/service.d.ts +8 -0
- package/dist/services/trading-withdraws/service.d.ts.map +1 -0
- package/dist/services/trading-withdraws/service.js +12 -0
- package/dist/services/trading-withdraws/service.js.map +1 -0
- package/dist/services/trading-withdraws/trading-withdraws.js +3 -3
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +2 -2
- package/dist/services/trading-withdraws/wallet-message.js +1 -1
- package/dist/services/transfers/service.d.ts +8 -0
- package/dist/services/transfers/service.d.ts.map +1 -0
- package/dist/services/transfers/service.js +9 -0
- package/dist/services/transfers/service.js.map +1 -0
- package/dist/services/transfers/transfers.js +2 -2
- package/dist/services/transfers/transfers.schemas.js +2 -2
- package/dist/services/triggers/service.d.ts +8 -0
- package/dist/services/triggers/service.d.ts.map +1 -0
- package/dist/services/triggers/service.js +9 -0
- package/dist/services/triggers/service.js.map +1 -0
- package/dist/services/triggers/trigger-child-order.schemas.js +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +27 -27
- package/dist/services/triggers/trigger-input.schemas.js +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +3 -3
- package/dist/services/triggers/triggers-output.schemas.js +1 -1
- package/dist/services/triggers/triggers.js +1 -1
- package/dist/services/vip/service.d.ts +8 -0
- package/dist/services/vip/service.d.ts.map +1 -0
- package/dist/services/vip/service.js +9 -0
- package/dist/services/vip/service.js.map +1 -0
- package/dist/services/vip/vip.js +1 -1
- package/dist/services/whiteboard/service.d.ts +8 -0
- package/dist/services/whiteboard/service.d.ts.map +1 -0
- package/dist/services/whiteboard/service.js +9 -0
- package/dist/services/whiteboard/service.js.map +1 -0
- package/dist/services/whiteboard/whiteboard.js +1 -1
- package/dist/services/whiteboard/whiteboard.schemas.d.ts +49 -49
- package/dist/services/whiteboard/whiteboard.schemas.js +1 -1
- package/dist/services/zipper/service.d.ts +8 -0
- package/dist/services/zipper/service.d.ts.map +1 -0
- package/dist/services/zipper/service.js +9 -0
- package/dist/services/zipper/service.js.map +1 -0
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +7 -5
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +9 -1
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +45 -96
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/auth.js +16 -0
- package/dist/shared/error-details/auth.js.map +1 -0
- package/dist/shared/error-details/claims.js +15 -0
- package/dist/shared/error-details/claims.js.map +1 -0
- package/dist/shared/error-details/internal-transfer.js +15 -0
- package/dist/shared/error-details/internal-transfer.js.map +1 -0
- package/dist/shared/error-details/ledger.js +15 -0
- package/dist/shared/error-details/ledger.js.map +1 -0
- package/dist/shared/error-details/market-overview.js +15 -0
- package/dist/shared/error-details/market-overview.js.map +1 -0
- package/dist/shared/error-details/orders.js +18 -0
- package/dist/shared/error-details/orders.js.map +1 -0
- package/dist/shared/error-details/profile.js +17 -0
- package/dist/shared/error-details/profile.js.map +1 -0
- package/dist/shared/error-details/withdraw.js +15 -0
- package/dist/shared/error-details/withdraw.js.map +1 -0
- package/dist/shared/rate-limit.schemas.d.ts +1 -1
- package/dist/shared/rate-limit.schemas.js +2 -2
- package/dist/shared/transports.d.ts.map +1 -1
- package/dist/shared/transports.js +7 -6
- package/dist/shared/transports.js.map +1 -1
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +16 -14
- package/dist/wired-services.js.map +1 -1
- package/package.json +7 -1
- package/dist/services/accounts/index.d.ts +0 -3
- package/dist/services/address-book/address-book.codecs.d.ts +0 -1
- package/dist/services/address-book/index.d.ts +0 -4
- package/dist/services/balances/index.d.ts +0 -4
- package/dist/services/candles/index.d.ts +0 -3
- package/dist/services/chain-analytics/index.d.ts +0 -4
- package/dist/services/claims/index.d.ts +0 -5
- package/dist/services/deposit/index.d.ts +0 -3
- package/dist/services/fees/index.d.ts +0 -3
- package/dist/services/guard-signer/guard-signer.codecs.d.ts +0 -1
- package/dist/services/guard-signer/index.d.ts +0 -4
- package/dist/services/heatmap/index.d.ts +0 -4
- package/dist/services/internal-transfers/index.d.ts +0 -3
- package/dist/services/lifecycle/index.d.ts +0 -4
- package/dist/services/market-data/index.d.ts +0 -4
- package/dist/services/market-overview/index.d.ts +0 -4
- package/dist/services/mfa/index.d.ts +0 -4
- package/dist/services/mfa/mfa.codecs.d.ts +0 -1
- package/dist/services/orderbook/index.d.ts +0 -3
- package/dist/services/orders/index.d.ts +0 -10
- package/dist/services/rate-limits/index.d.ts +0 -4
- package/dist/services/social-verification/index.d.ts +0 -3
- package/dist/services/trades/index.d.ts +0 -3
- package/dist/services/trading-withdraws/index.d.ts +0 -4
- package/dist/services/trading-withdraws/trading-withdraws.codecs.d.ts +0 -1
- package/dist/services/transfers/index.d.ts +0 -4
- package/dist/services/triggers/index.d.ts +0 -5
- package/dist/services/vip/index.d.ts +0 -3
- package/dist/services/whiteboard/index.d.ts +0 -3
- package/dist/services/zipper/index.d.ts +0 -4
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { CreatePolyesterAccountSignerParams } from "./account-signer/create-poly
|
|
|
4
4
|
import "./account-signer/index.js";
|
|
5
5
|
import { AssetConfig, DepositWithdrawConfig, PairConfig, PairStatus, SpotConfig, ZipperAssetChainVariant, ZipperAssetConfig, ZipperChainConfig, ZipperChainContractConfig } from "./shared/catalog-config.js";
|
|
6
6
|
import { OrderErrorCode, OrderErrorDetail } from "./services/orders/order-errors.schemas.js";
|
|
7
|
-
import { PolyesterErrorDetail } from "./shared/error-detail.js";
|
|
7
|
+
import { PolyesterErrorDetail, loadErrorDetailDecoders } from "./shared/error-detail.js";
|
|
8
8
|
import { RateLimitDetail, RateLimitFailureReason, RateLimitPolicyClass, RateLimitRefillModel, RateLimitScope } from "./shared/rate-limit.schemas.js";
|
|
9
9
|
import { AlreadyExistsError, AuthenticationError, ConfigurationError, InternalServerError, MfaEnrollmentRequiredError, MfaLastFactorRequiredError, MfaRequiredError, MfaVerificationError, MfaVerificationFailureReason, NetworkError, NotImplementedError, PermissionError, PolicyInUseError, PolicyLockedError, PolicyScopeMismatchError, PolyesterError, PolyesterErrorCode, PolyesterErrorOptions, PreconditionFailedError, RateLimitError, RateLimitErrorOptions, RequestError, ResourceNotFoundError, RevisionConflictError, ServiceUnavailableError, SessionElevationRequiredError, StaleQuoteError, StepUpRequiredError, SubaccountChallengeInvalidError, TimeoutError, TimestampSkewError, TransientError, ValidationError, errorFromHttpStatus, isAbortError, normalizeErrorMessage } from "./shared/errors.js";
|
|
10
10
|
import { ApiKeyEd25519AuthProvider, JwtAuthProvider, Transports } from "./shared/transports.js";
|
|
@@ -16,8 +16,6 @@ import { ConnectChannelParams, PolyesterRealtime, SubscribeHandlers } from "./re
|
|
|
16
16
|
import "./realtime/index.js";
|
|
17
17
|
import { ApiKeyPolicy, ApiKeyPolicyApplyInput, ApiKeyPolicyCreateInput, ApiKeyPolicyUpdateInput, ListApiKeyPoliciesResponse } from "./services/policies/api-key-policies/api-key-policies.schemas.js";
|
|
18
18
|
import { ApiKey, ApiKeyIdInput, ApiKeyStatus, ApiKeysCreateInput, ApiKeysListInput, ApiKeysUpdateInput } from "./services/api-keys/api-keys.schemas.js";
|
|
19
|
-
import { AccountIdentity, ClaimGeneratedUsernameInput, GeneratedUsernameOffer, Profile, UpdateProfileInput, UsernameHistoryEntry } from "./services/auth/profile/profile.schemas.js";
|
|
20
|
-
import { CreateWalletChallengeInput, LoginWithWalletInput, LoginWithWalletResponse, Me, WalletChallenge } from "./services/auth/auth.js";
|
|
21
19
|
import { SubaccountPolicy, SubaccountPolicyApplyInput, SubaccountPolicyCreateInput, SubaccountPolicyUpdateInput } from "./services/policies/subaccount-policies/subaccount-policies.schemas.js";
|
|
22
20
|
import { CreateSubaccountChallengeInput, CreateSubaccountInput, CreateSubaccountResult as CreateSubaccountResult$1, EffectiveSubaccountPermissions, InviteSubaccountMemberInput, ListSubaccountInvitesInput, RemoveSubaccountMemberInput, RespondSubaccountInviteInput, SetSubaccountMemberMfaRequirementInput, Subaccount, SubaccountActivityInput, SubaccountChallenge, SubaccountEvent, SubaccountIdInput, SubaccountInvite, SubaccountInviteStatus, SubaccountMember, SubaccountPermission, SubaccountPermissionDefinition, SubaccountRole, SubaccountRoleCatalog, SubaccountRoleDefinition, SubaccountStatus, UpdateSubaccountInput, UpdateSubaccountMemberRoleInput } from "./services/subaccounts/subaccounts.schemas.js";
|
|
23
21
|
import { Candle, CandleColumnar, CandleColumnarInt, CandleInt, GetCandlesColumnsInput, GetCandlesInput, Timeframe } from "./services/candles/candles.schemas.js";
|
|
@@ -41,9 +39,7 @@ import { CancelTriggerResult, CreateTriggerResult, LadderDetailsOutput, ListTrig
|
|
|
41
39
|
import { ListTriggersResult } from "./services/triggers/triggers.js";
|
|
42
40
|
import { AccountCodeValue, TransferCodeValue } from "./shared/ledger-codes.js";
|
|
43
41
|
import { BalanceHistoryInput, BalanceHistoryResponse, BalanceRange, EquityGroupBy, EquityHistoryInput, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySnapshotResponse } from "./services/balances/balances.schemas.js";
|
|
44
|
-
import { mergeLedgerBalances } from "./services/balances/balances.merge.js";
|
|
45
42
|
import { LedgerTransfer, LedgerTransferSide, ListTransfersInput } from "./services/transfers/transfers.schemas.js";
|
|
46
|
-
import { TransferSideKind } from "./services/transfers/transfers.codecs.js";
|
|
47
43
|
import { CreateInternalTransferInput, CreateInternalTransferResult, InternalTransferDestination, ResolvedInternalTransferDestination } from "./services/internal-transfers/internal-transfers.schemas.js";
|
|
48
44
|
import { CreateTradingWithdrawResult, CreateTradingWithdrawToExternalChainInput, CreateTradingWithdrawToFundingInput, ValidateWithdrawDestinationInput, ValidateWithdrawDestinationResult } from "./services/trading-withdraws/trading-withdraws.schemas.js";
|
|
49
45
|
import { CreateTradingWithdrawToExternalChainServiceInput, CreateTradingWithdrawToFundingServiceInput, PreparedTradingWithdraw, TradingWithdrawSigningConfig, TradingWithdrawWalletSigner } from "./services/trading-withdraws/trading-withdraws.js";
|
|
@@ -56,24 +52,29 @@ import { ZippedAssetSupplyBatch, ZippedAssetSupplyUpdate } from "./services/zipp
|
|
|
56
52
|
import { SubscribeZippedAssetSupplyInput } from "./services/zipper/zipper.js";
|
|
57
53
|
import { BeginMfaChallengeInput, BeginMfaChallengeResult, BeginPasskeyEnrollmentInput, BeginPasskeyEnrollmentResult, BeginTotpEnrollmentInput, BeginTotpEnrollmentResult, ClaimFreshStepUpInput, ClaimFreshStepUpResult, CompleteMfaChallengeResult, ConsumeFreshStepUpInput, DeleteMfaFactorInput, FinishPasskeyChallengeInput, FinishPasskeyEnrollmentInput, FinishPasskeyEnrollmentResult, FinishTotpEnrollmentInput, FinishTotpEnrollmentResult, ListMfaFactorsResult, MfaFactor, MfaSessionInfo, RegenerateRecoveryCodesInput, RegenerateRecoveryCodesResult, ReleaseFreshStepUpInput, UpdateMfaFactorInput, UpdateMfaFactorResult, VerifyRecoveryCodeChallengeInput, VerifyTotpChallengeInput } from "./services/mfa/mfa.schemas.js";
|
|
58
54
|
import { ClaimCampaign, ClaimDailyRewardResult, DailyClaimReward, DailyClaimStatus, DailyClaimTransfer } from "./services/claims/claims.schemas.js";
|
|
59
|
-
import {
|
|
60
|
-
import "./services/claims/claims.types.js";
|
|
55
|
+
import { ListRewardAwardsInput, ListRewardAwardsResult, RewardAward, SetRewardDestinationInput, SetRewardDestinationResult } from "./services/rewards/rewards.schemas.js";
|
|
61
56
|
import { NextVipTierThresholds, VipStatus, VipTier, VipTierCatalog } from "./services/vip/vip.schemas.js";
|
|
62
57
|
import { GetSpotFeeRatesInput, SpotFeeRate } from "./services/fees/fees.schemas.js";
|
|
63
58
|
import { TradingRateLimitClass } from "./services/rate-limits/rate-limits.codecs.js";
|
|
64
59
|
import { RateLimitConfig, TradingRateLimitRule, TradingRateLimits } from "./services/rate-limits/rate-limits.schemas.js";
|
|
65
|
-
import {
|
|
60
|
+
import { AccountIdentity, ClaimGeneratedUsernameInput, GeneratedUsernameOffer, Profile, UpdateProfileInput, UsernameHistoryEntry } from "./services/auth/profile/profile.schemas.js";
|
|
61
|
+
import { CreateWalletChallengeInput, LoginWithWalletInput, LoginWithWalletResponse, Me, WalletChallenge } from "./services/auth/auth.js";
|
|
62
|
+
import { PolyesterClientBaseConfig, PolyesterClientConfig, PolyesterCore, PolyesterRealtimeAuthConfig } from "./core-client.js";
|
|
63
|
+
import { PolyesterClient, PolyesterServices } from "./client.js";
|
|
66
64
|
import { AuthCookieLocation, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME, resolveAuthCookieName } from "./services/auth/cookie-constants.js";
|
|
67
65
|
import { AuthTokenStorage, AuthTokenStorageSetOptions, CookieAuthTokenStorageOptions, createCookieAuthTokenStorage, createMemoryAuthTokenStorage } from "./services/auth/token-storage.js";
|
|
68
66
|
import { ActiveAccountInfo, AuthHydrationData, AuthLoginMethod, AuthState, ServerSessionSnapshot, SessionData } from "./services/auth/session.types.js";
|
|
69
67
|
import { ServerSessionCookieOptions } from "./services/auth/session.js";
|
|
70
68
|
import { AccountSignerAuthEvents, CreateSubaccountParams, CreateSubaccountResult, LoginOptions, LoginResult } from "./services/auth/account-signer-auth.js";
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
69
|
+
import { PolyesterBrowserClientConfig, PolyesterBrowserCore } from "./browser-core.js";
|
|
70
|
+
import { PolyesterBrowserClient } from "./browser-client.js";
|
|
71
|
+
import { CreateServerClientFromCookiesParams, CreateServerClientFromRequestParams, PolyesterServerClientConfig, PolyesterServerCore, createPolyesterServerCoreFromCookies, createPolyesterServerCoreFromRequest } from "./server-core.js";
|
|
72
|
+
import { PolyesterServerClient, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest } from "./server-client.js";
|
|
73
73
|
import { connectErrorToPolyesterError, createErrorMappingInterceptor, toPolyesterError } from "./shared/connect-error-mapping.js";
|
|
74
74
|
import { isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isSessionElevationRequiredError } from "./utils/connect-mfa-errors.js";
|
|
75
75
|
import { formatConnectError, formatUserFacingError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError } from "./utils/errors.js";
|
|
76
76
|
import { ColumnarTimeWindow, columnarTimestampSecAt, expandColumnarTimestampsSec } from "./utils/columnar-time.js";
|
|
77
|
+
import { mergeLedgerBalances } from "./services/balances/balances.merge.js";
|
|
77
78
|
import { compareUnsignedIntegerStrings, shouldApplyReconciliationUpdate } from "./shared/reconciliation.js";
|
|
78
79
|
import { tsObjToNsString } from "./utils/time.js";
|
|
79
80
|
import { EvmHex, checksumEvmAddress, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, isEvmAddress, isEvmAddressStrict, keccak256Hex } from "./utils/evm.js";
|
|
@@ -85,6 +86,8 @@ import "./services/auth/profile/profile.types.js";
|
|
|
85
86
|
import "./services/balances/balances.types.js";
|
|
86
87
|
import "./services/candles/candles.types.js";
|
|
87
88
|
import "./services/chain-analytics/chain-analytics.types.js";
|
|
89
|
+
import { ClaimPolicy, DailyClaimState } from "./services/claims/claims.codecs.js";
|
|
90
|
+
import "./services/claims/claims.types.js";
|
|
88
91
|
import "./services/deposit/deposit.types.js";
|
|
89
92
|
import "./services/fees/fees.types.js";
|
|
90
93
|
import "./services/guard-signer/guard-signer.types.js";
|
|
@@ -101,13 +104,16 @@ import { PolicyAction, PolicyMarketScope } from "./services/policies/shared.js";
|
|
|
101
104
|
import "./services/policies/policies.types.js";
|
|
102
105
|
import "./services/policies/subaccount-policies/subaccount-policies.types.js";
|
|
103
106
|
import "./services/rate-limits/rate-limits.types.js";
|
|
107
|
+
import { RewardFulfillmentMethod, RewardFulfillmentState } from "./services/rewards/rewards.codecs.js";
|
|
108
|
+
import "./services/rewards/rewards.types.js";
|
|
104
109
|
import "./services/social-verification/social-verification.types.js";
|
|
105
110
|
import "./services/subaccounts/subaccounts.types.js";
|
|
106
111
|
import "./services/trades/trades.types.js";
|
|
107
112
|
import "./services/trading-withdraws/trading-withdraws.types.js";
|
|
113
|
+
import { TransferSideKind } from "./services/transfers/transfers.codecs.js";
|
|
108
114
|
import "./services/transfers/transfers.types.js";
|
|
109
115
|
import "./services/triggers/triggers.types.js";
|
|
110
116
|
import "./services/vip/vip.types.js";
|
|
111
117
|
import "./services/whiteboard/whiteboard.types.js";
|
|
112
118
|
import "./services/zipper/zipper.types.js";
|
|
113
|
-
export { type AccountCodeValue, type AccountIdentity, type AccountScope, type AccountScopedInput, type AccountSigner, type AccountSignerAuthEvents, type AccountSignerConfig, type CreateSubaccountResult as AccountSignerCreateSubaccountResult, type AccountSignerFactory, type ActiveAccountInfo, type AddressBook, type AddressBookAccountScope, type AddressBookEntries, type AddressBookEntriesView, type AddressBookEntry, type AddressBookRecentDestinationsView, type AddressBookTag, type AddressBookTagSummary, type AddressBookView, type AddressBookViewInvalidated, AlreadyExistsError, type ApiKey, type ApiKeyEd25519AuthProvider, type ApiKeyIdInput, type ApiKeyPolicy, type ApiKeyPolicyApplyInput, type ApiKeyPolicyCreateInput, type ApiKeyPolicyUpdateInput, type ApiKeyStatus, type ApiKeysCreateInput, type ApiKeysListInput, type ApiKeysUpdateInput, type ArchiveWhiteboardBoardInput, type ArchiveWhiteboardBoardResult, type AssetConfig, type AuthCookieLocation, type AuthHydrationData, type AuthLoginMethod, type AuthState, type AuthTokenStorage, type AuthTokenStorageSetOptions, AuthenticationError, type BalanceHistoryInput, type BalanceHistoryResponse, type BalanceRange, type BatchCancelOrderInput, type BatchCancelOrderResult, type BatchCancelOrdersInput, type BatchCancelOrdersResult, type BatchCreateOrderResult, type BatchCreateOrdersInput, type BatchCreateOrdersResult, type BatchGuardApprovals, type BatchReplaceAdmissionItem, type BatchReplaceOrdersInput, type BatchReplaceOrdersResult, type BatchSignProtectedActionInput, type BeginMfaChallengeInput, type BeginMfaChallengeResult, type BeginPasskeyEnrollmentInput, type BeginPasskeyEnrollmentResult, type BeginTotpEnrollmentInput, type BeginTotpEnrollmentResult, type CancelAllAfterInput, type CancelAllAfterResult, type CancelAllOrdersInput, type CancelAllOrdersResponse, type CancelOrderInput, type CancelOrderResult, type CancelTriggerInput, type CancelTriggerResult, type Candle, type CandleColumnar, type CandleColumnarInt, type CandleInt, type ChainAnalyticsRange, type ClaimCampaign, type ClaimDailyRewardResult, type ClaimFreshStepUpInput, type ClaimFreshStepUpResult, type ClaimGeneratedUsernameInput, type ClaimPolicy, type ColumnarTimeWindow, type CompleteMfaChallengeResult, ConfigurationError, type ConnectChannelParams, type ConsumeFreshStepUpInput, type CookieAuthTokenStorageOptions, type CopyAddressBookEntryInput, type CreateAddressBookEntryInput, type CreateAddressBookTagInput, type CreateDepositAddressInput, type CreateGuardSignerWalletResult, type CreateInternalTransferInput, type CreateInternalTransferResult, type CreateOrderResult, type CreateOrderbookSubscriptionInput, type CreatePolyesterAccountSignerParams, type CreatePolyesterEnvironmentParams, type CreateServerClientFromCookiesParams, type CreateServerClientFromRequestParams, type CreateSubaccountChallengeInput, type CreateSubaccountInput, type CreateSubaccountParams, type CreateSubaccountResult$1 as CreateSubaccountResult, type CreateSubaccountResult$1 as CreateSubaccountServiceResult, type CreateTradingWithdrawResult, type CreateTradingWithdrawToExternalChainInput, type CreateTradingWithdrawToExternalChainServiceInput, type CreateTradingWithdrawToFundingInput, type CreateTradingWithdrawToFundingServiceInput, type CreateTriggerInput, type CreateTriggerResult, type CreateWalletChallengeInput, type CreateWhiteboardBoardInput, type CreateWhiteboardBoardResult, type CurrencyConversionConfig, type CurrencyConversionRates, type CurrencyMetadata, type DailyClaimReward, type DailyClaimState, type DailyClaimStatus, type DailyClaimTransfer, type DeleteAddressBookEntryInput, type DeleteAddressBookTagInput, type DeleteMfaFactorInput, type DepositAddress, type DepositWithdrawConfig, type EffectiveSubaccountPermissions, type EquityGroupBy, type EquityHistoryInput, type EquityHistoryResponse, type EquitySeries, type EquitySeriesGrouping, type EvmHex, type ExportGuardSignerWalletResult, type FiatConversionRate, type FiatConversionSnapshot, type FinishPasskeyChallengeInput, type FinishPasskeyEnrollmentInput, type FinishPasskeyEnrollmentResult, type FinishTotpEnrollmentInput, type FinishTotpEnrollmentResult, type GeneratedUsernameOffer, type GetAddressBookViewInput, type GetBatchReplaceStatusInput, type GetBatchReplaceStatusResult, type GetCandlesColumnsInput, type GetCandlesInput, type GetLifecycleFlowInput, type GetLifecycleFlowOutput, type GetMarketTradesInput, type GetOrderDetailsInput, type GetOrderbookHeatmapInput, type GetOrderbookInput, type GetSpotFeeRatesInput, type GetTriggerInput, type GetUnifiedAssetBalancesInput, type GetUserTradesInput, type GetVerificationResponse, type GetWhiteboardBoardInput, type GetWhiteboardBoardResult, type GetZippedAssetSupplyGroupInput, type GetZippedAssetSupplyInput, type GuardApproval, type GuardSignerScopedInput, type GuardSignerStatus, type HeatmapDepthValue, type HeatmapIntervalValue, type HeatmapQuantityModeValue, type HexAddress, InternalServerError, type InternalTransferDestination, type InternalTransferWhitelistEntries, type InternalTransferWhitelistEntry, type InviteSubaccountMemberInput, type JwtAuthProvider, type LadderDetailsOutput, type LedgerBalance, type LedgerTransfer, type LedgerTransferSide, type LifecycleAssetIds, type LifecycleFlowDetail, type LifecycleFlowState, type LifecycleFlowStep, type LifecycleFlowStepActivity, type LifecycleFlowSummary, type LifecycleFlowSummaryProgress, type LifecycleFlowTimelineItem, type LifecycleFlowTxMatch, type LifecycleListOrderBy, type LifecycleListScope, type LifecycleReason, type LifecycleRequestFee, type LifecycleRequestFeeStatus, type LifecycleSort, type LifecycleTxLookupKind, type LifecycleZipperReason, type ListAddressBookEntriesInput, type ListApiKeyPoliciesResponse, type ListDepositAddressesInput, type ListInternalTransferWhitelistEntriesInput, type ListLifecycleFlowsByTxInput, type ListLifecycleFlowsByTxOutput, type ListLifecycleFlowsInput, type ListLifecycleFlowsOutput, type ListMarketOverviewInput, type ListMfaFactorsResult, type ListSubaccountInvitesInput, type ListTransferCounterpartiesInput, type ListTransferDestinationsInput, type ListTransfersInput, type ListTriggerEventsInput, type ListTriggerEventsResult, type ListTriggersInput, type ListTriggersResult, type ListWhiteboardBoardsInput, type ListWhiteboardBoardsResult, type LoginOptions, type LoginResult, type LoginWithWalletInput, type LoginWithWalletResponse, type MarketOverview, type MarketOverviewOrderBy, type MarketOverviewSort, type MarketOverviewSparkline, type MarketTrade, type Me, MfaEnrollmentRequiredError, type MfaFactor, MfaLastFactorRequiredError, MfaRequiredError, type MfaSessionInfo, MfaVerificationError, type MfaVerificationFailureReason, type MintWhiteboardJoinTokenInput, type MirroredWithdrawWhitelistEntry, type ModifyOrderInput, type ModifyOrderResult, type ModifyTriggerInput, type ModifyTriggerResult, NetworkError, type NewOrderInput, type NextVipTierThresholds, NotImplementedError, type OpenOrdersInput, type Order, type OrderDetails, type OrderErrorCode, type OrderErrorDetail, type OrderHistoryInput, type OrderIntentInput, type OrderLineage, type OrderTransfer, type OrderbookData, type OrderbookHeatmapDeltaBucket, type OrderbookHeatmapDeltaChain, type OrderbookHeatmapDeltaLevels, type OrderbookHeatmapKeyframe, type OrderbookHeatmapLevels, type OrderbookHeatmapLiveBucket, type OrderbookHeatmapResponse, type OrderbookLevel, type OrderbookStreamHandlers, type OrderbookSubscription, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_DEVNET_ENVIRONMENT, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, type PairConfig, type PairStatus, type PauseTriggerInput, type PauseTriggerResult, PermissionError, type PolicyAction, PolicyInUseError, PolicyLockedError, type PolicyMarketScope, PolicyScopeMismatchError, type PolyesterAccountAbstractionEnvironment, PolyesterBrowserClient, type PolyesterBrowserClientConfig, PolyesterClient, type PolyesterClientBaseConfig, type PolyesterClientConfig, type PolyesterContractsEnvironment, type PolyesterEntryPointConfig, type PolyesterEnvironment, PolyesterError, type PolyesterErrorCode, type PolyesterErrorDetail, type PolyesterErrorOptions, type PolyesterMutationOptions, type PolyesterRealtime, type PolyesterRealtimeAuthConfig, type PolyesterRequestOptions, type PolyesterSafeDeploymentConfig, PolyesterServerClient, type PolyesterServerClientConfig, type PortfolioEquityHistoryInput, type PortfolioEquityHistoryResponse, type PortfolioEquitySeries, type PortfolioEquitySeriesGrouping, type PortfolioEquitySnapshotResponse, PreconditionFailedError, type PreparedTradingWithdraw, type PreviewOrderResult, type Profile, type RateLimitConfig, type RateLimitDetail, RateLimitError, type RateLimitErrorOptions, type RateLimitFailureReason, type RateLimitPolicyClass, type RateLimitRefillModel, type RateLimitScope, type RegenerateRecoveryCodesInput, type RegenerateRecoveryCodesResult, type ReleaseFreshStepUpInput, type RemoveSubaccountMemberInput, RequestError, type ResolveAccountInput, type ResolvedAccount, type ResolvedInternalTransferDestination, ResourceNotFoundError, type RespondSubaccountInviteInput, type ResumeTriggerInput, type ResumeTriggerResult, RevisionConflictError, type RiskPolicyInput, type RotateGuardSignerWalletResult, type SdkSubscriptionErrorContext, type ServerSessionCookieOptions, type ServerSessionSnapshot, ServiceUnavailableError, type SessionData, SessionElevationRequiredError, type SetSubaccountMemberMfaRequirementInput, type SignProtectedActionInput, type SocialProvider, type SocialProviderInput, type SocialVerification, type SocialVerificationErrorCode, type SocialVerificationMethod, type SocialVerificationStatus, type SparklineIntervalName, type SpotConfig, type SpotFeeRate, type SpotPairVolumeSeries, type SpotVolumeHistoryInput, type SpotVolumeHistoryResponse, type StablecoinConversionRate, StaleQuoteError, type StartVerificationInput, type StartVerificationResponse, StepUpRequiredError, type StopDetailsOutput, type StopLossInput, type Subaccount, type SubaccountActivityInput, type SubaccountChallenge, SubaccountChallengeInvalidError, type SubaccountEvent, type SubaccountIdInput, type SubaccountInvite, type SubaccountInviteStatus, type SubaccountMember, type SubaccountPermission, type SubaccountPermissionDefinition, type SubaccountPolicy, type SubaccountPolicyApplyInput, type SubaccountPolicyCreateInput, type SubaccountPolicyUpdateInput, type SubaccountRole, type SubaccountRoleCatalog, type SubaccountRoleDefinition, type SubaccountScopedInput, type SubaccountStatus, type SubscribeHandlers, type SubscribeZippedAssetSupplyInput, type TakeProfitInput, type Timeframe, TimeoutError, TimestampSkewError, type Trade, type TradingRateLimitClass, type TradingRateLimitRule, type TradingRateLimits, type TradingWithdrawSigningConfig, type TradingWithdrawWalletSigner, type TrailingDetailsOutput, type TrailingStopInput, type TransferCodeValue, type TransferCounterparties, type TransferCounterparty, type TransferDestination, type TransferDestinations, type TransferSideKind, TransientError, type Transports, type Trigger, type TriggerDetailsOutput, type TriggerEvent, type TwapDetailsOutput, type UnifiedAssetBalancesResponse, type UpdateAddressBookEntryInput, type UpdateAddressBookTagInput, type UpdateMfaFactorInput, type UpdateMfaFactorResult, type UpdateProfileInput, type UpdateSubaccountInput, type UpdateSubaccountMemberRoleInput, type UpdateWhiteboardBoardAclInput, type UpdateWhiteboardBoardAclResult, type UpdateWhiteboardBoardInput, type UpdateWhiteboardBoardResult, type UsernameHistoryEntry, type ValidateWithdrawDestinationInput, type ValidateWithdrawDestinationResult, ValidationError, type VerificationReadyResponse, type VerifyRecoveryCodeChallengeInput, type VerifyTotpChallengeInput, type VipStatus, type VipTier, type VipTierCatalog, type WalletChallenge, type WhiteboardAccess, type WhiteboardAclEntry, type WhiteboardAclEntryInput, type WhiteboardAclSubjectType, type WhiteboardAudience, type WhiteboardBoard, type WhiteboardBoardDetails, type WhiteboardBoardListItem, type WhiteboardJoinTokenResult, type WhiteboardPermissions, type WhiteboardPresencePayload, type WhiteboardResolvedRole, type WhiteboardSnapshot, type WhiteboardWritableRole, type WithdrawWhitelistView, type ZippedAssetSupplyBatch, type ZippedAssetSupplyGroupResponse, type ZippedAssetSupplyResponse, type ZippedAssetSupplySeries, type ZippedAssetSupplyUpdate, type ZipperAssetChainVariant, type ZipperAssetConfig, type ZipperChainConfig, type ZipperChainContractConfig, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, keccak256Hex, mergeLedgerBalances, normalizeErrorMessage, resolveAuthCookieName, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
|
|
119
|
+
export { type AccountCodeValue, type AccountIdentity, type AccountScope, type AccountScopedInput, type AccountSigner, type AccountSignerAuthEvents, type AccountSignerConfig, type CreateSubaccountResult as AccountSignerCreateSubaccountResult, type AccountSignerFactory, type ActiveAccountInfo, type AddressBook, type AddressBookAccountScope, type AddressBookEntries, type AddressBookEntriesView, type AddressBookEntry, type AddressBookRecentDestinationsView, type AddressBookTag, type AddressBookTagSummary, type AddressBookView, type AddressBookViewInvalidated, AlreadyExistsError, type ApiKey, type ApiKeyEd25519AuthProvider, type ApiKeyIdInput, type ApiKeyPolicy, type ApiKeyPolicyApplyInput, type ApiKeyPolicyCreateInput, type ApiKeyPolicyUpdateInput, type ApiKeyStatus, type ApiKeysCreateInput, type ApiKeysListInput, type ApiKeysUpdateInput, type ArchiveWhiteboardBoardInput, type ArchiveWhiteboardBoardResult, type AssetConfig, type AuthCookieLocation, type AuthHydrationData, type AuthLoginMethod, type AuthState, type AuthTokenStorage, type AuthTokenStorageSetOptions, AuthenticationError, type BalanceHistoryInput, type BalanceHistoryResponse, type BalanceRange, type BatchCancelOrderInput, type BatchCancelOrderResult, type BatchCancelOrdersInput, type BatchCancelOrdersResult, type BatchCreateOrderResult, type BatchCreateOrdersInput, type BatchCreateOrdersResult, type BatchGuardApprovals, type BatchReplaceAdmissionItem, type BatchReplaceOrdersInput, type BatchReplaceOrdersResult, type BatchSignProtectedActionInput, type BeginMfaChallengeInput, type BeginMfaChallengeResult, type BeginPasskeyEnrollmentInput, type BeginPasskeyEnrollmentResult, type BeginTotpEnrollmentInput, type BeginTotpEnrollmentResult, type CancelAllAfterInput, type CancelAllAfterResult, type CancelAllOrdersInput, type CancelAllOrdersResponse, type CancelOrderInput, type CancelOrderResult, type CancelTriggerInput, type CancelTriggerResult, type Candle, type CandleColumnar, type CandleColumnarInt, type CandleInt, type ChainAnalyticsRange, type ClaimCampaign, type ClaimDailyRewardResult, type ClaimFreshStepUpInput, type ClaimFreshStepUpResult, type ClaimGeneratedUsernameInput, type ClaimPolicy, type ColumnarTimeWindow, type CompleteMfaChallengeResult, ConfigurationError, type ConnectChannelParams, type ConsumeFreshStepUpInput, type CookieAuthTokenStorageOptions, type CopyAddressBookEntryInput, type CreateAddressBookEntryInput, type CreateAddressBookTagInput, type CreateDepositAddressInput, type CreateGuardSignerWalletResult, type CreateInternalTransferInput, type CreateInternalTransferResult, type CreateOrderResult, type CreateOrderbookSubscriptionInput, type CreatePolyesterAccountSignerParams, type CreatePolyesterEnvironmentParams, type CreateServerClientFromCookiesParams, type CreateServerClientFromRequestParams, type CreateSubaccountChallengeInput, type CreateSubaccountInput, type CreateSubaccountParams, type CreateSubaccountResult$1 as CreateSubaccountResult, type CreateSubaccountResult$1 as CreateSubaccountServiceResult, type CreateTradingWithdrawResult, type CreateTradingWithdrawToExternalChainInput, type CreateTradingWithdrawToExternalChainServiceInput, type CreateTradingWithdrawToFundingInput, type CreateTradingWithdrawToFundingServiceInput, type CreateTriggerInput, type CreateTriggerResult, type CreateWalletChallengeInput, type CreateWhiteboardBoardInput, type CreateWhiteboardBoardResult, type CurrencyConversionConfig, type CurrencyConversionRates, type CurrencyMetadata, type DailyClaimReward, type DailyClaimState, type DailyClaimStatus, type DailyClaimTransfer, type DeleteAddressBookEntryInput, type DeleteAddressBookTagInput, type DeleteMfaFactorInput, type DepositAddress, type DepositWithdrawConfig, type EffectiveSubaccountPermissions, type EquityGroupBy, type EquityHistoryInput, type EquityHistoryResponse, type EquitySeries, type EquitySeriesGrouping, type EvmHex, type ExportGuardSignerWalletResult, type FiatConversionRate, type FiatConversionSnapshot, type FinishPasskeyChallengeInput, type FinishPasskeyEnrollmentInput, type FinishPasskeyEnrollmentResult, type FinishTotpEnrollmentInput, type FinishTotpEnrollmentResult, type GeneratedUsernameOffer, type GetAddressBookViewInput, type GetBatchReplaceStatusInput, type GetBatchReplaceStatusResult, type GetCandlesColumnsInput, type GetCandlesInput, type GetLifecycleFlowInput, type GetLifecycleFlowOutput, type GetMarketTradesInput, type GetOrderDetailsInput, type GetOrderbookHeatmapInput, type GetOrderbookInput, type GetSpotFeeRatesInput, type GetTriggerInput, type GetUnifiedAssetBalancesInput, type GetUserTradesInput, type GetVerificationResponse, type GetWhiteboardBoardInput, type GetWhiteboardBoardResult, type GetZippedAssetSupplyGroupInput, type GetZippedAssetSupplyInput, type GuardApproval, type GuardSignerScopedInput, type GuardSignerStatus, type HeatmapDepthValue, type HeatmapIntervalValue, type HeatmapQuantityModeValue, type HexAddress, InternalServerError, type InternalTransferDestination, type InternalTransferWhitelistEntries, type InternalTransferWhitelistEntry, type InviteSubaccountMemberInput, type JwtAuthProvider, type LadderDetailsOutput, type LedgerBalance, type LedgerTransfer, type LedgerTransferSide, type LifecycleAssetIds, type LifecycleFlowDetail, type LifecycleFlowState, type LifecycleFlowStep, type LifecycleFlowStepActivity, type LifecycleFlowSummary, type LifecycleFlowSummaryProgress, type LifecycleFlowTimelineItem, type LifecycleFlowTxMatch, type LifecycleListOrderBy, type LifecycleListScope, type LifecycleReason, type LifecycleRequestFee, type LifecycleRequestFeeStatus, type LifecycleSort, type LifecycleTxLookupKind, type LifecycleZipperReason, type ListAddressBookEntriesInput, type ListApiKeyPoliciesResponse, type ListDepositAddressesInput, type ListInternalTransferWhitelistEntriesInput, type ListLifecycleFlowsByTxInput, type ListLifecycleFlowsByTxOutput, type ListLifecycleFlowsInput, type ListLifecycleFlowsOutput, type ListMarketOverviewInput, type ListMfaFactorsResult, type ListRewardAwardsInput, type ListRewardAwardsResult, type ListSubaccountInvitesInput, type ListTransferCounterpartiesInput, type ListTransferDestinationsInput, type ListTransfersInput, type ListTriggerEventsInput, type ListTriggerEventsResult, type ListTriggersInput, type ListTriggersResult, type ListWhiteboardBoardsInput, type ListWhiteboardBoardsResult, type LoginOptions, type LoginResult, type LoginWithWalletInput, type LoginWithWalletResponse, type MarketOverview, type MarketOverviewOrderBy, type MarketOverviewSort, type MarketOverviewSparkline, type MarketTrade, type Me, MfaEnrollmentRequiredError, type MfaFactor, MfaLastFactorRequiredError, MfaRequiredError, type MfaSessionInfo, MfaVerificationError, type MfaVerificationFailureReason, type MintWhiteboardJoinTokenInput, type MirroredWithdrawWhitelistEntry, type ModifyOrderInput, type ModifyOrderResult, type ModifyTriggerInput, type ModifyTriggerResult, NetworkError, type NewOrderInput, type NextVipTierThresholds, NotImplementedError, type OpenOrdersInput, type Order, type OrderDetails, type OrderErrorCode, type OrderErrorDetail, type OrderHistoryInput, type OrderIntentInput, type OrderLineage, type OrderTransfer, type OrderbookData, type OrderbookHeatmapDeltaBucket, type OrderbookHeatmapDeltaChain, type OrderbookHeatmapDeltaLevels, type OrderbookHeatmapKeyframe, type OrderbookHeatmapLevels, type OrderbookHeatmapLiveBucket, type OrderbookHeatmapResponse, type OrderbookLevel, type OrderbookStreamHandlers, type OrderbookSubscription, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_DEVNET_ENVIRONMENT, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, type PairConfig, type PairStatus, type PauseTriggerInput, type PauseTriggerResult, PermissionError, type PolicyAction, PolicyInUseError, PolicyLockedError, type PolicyMarketScope, PolicyScopeMismatchError, type PolyesterAccountAbstractionEnvironment, PolyesterBrowserClient, type PolyesterBrowserClientConfig, PolyesterBrowserCore, PolyesterClient, type PolyesterClientBaseConfig, type PolyesterClientConfig, type PolyesterContractsEnvironment, PolyesterCore, type PolyesterEntryPointConfig, type PolyesterEnvironment, PolyesterError, type PolyesterErrorCode, type PolyesterErrorDetail, type PolyesterErrorOptions, type PolyesterMutationOptions, type PolyesterRealtime, type PolyesterRealtimeAuthConfig, type PolyesterRequestOptions, type PolyesterSafeDeploymentConfig, PolyesterServerClient, type PolyesterServerClientConfig, PolyesterServerCore, type PolyesterServices, type PortfolioEquityHistoryInput, type PortfolioEquityHistoryResponse, type PortfolioEquitySeries, type PortfolioEquitySeriesGrouping, type PortfolioEquitySnapshotResponse, PreconditionFailedError, type PreparedTradingWithdraw, type PreviewOrderResult, type Profile, type RateLimitConfig, type RateLimitDetail, RateLimitError, type RateLimitErrorOptions, type RateLimitFailureReason, type RateLimitPolicyClass, type RateLimitRefillModel, type RateLimitScope, type RegenerateRecoveryCodesInput, type RegenerateRecoveryCodesResult, type ReleaseFreshStepUpInput, type RemoveSubaccountMemberInput, RequestError, type ResolveAccountInput, type ResolvedAccount, type ResolvedInternalTransferDestination, ResourceNotFoundError, type RespondSubaccountInviteInput, type ResumeTriggerInput, type ResumeTriggerResult, RevisionConflictError, type RewardAward, type RewardFulfillmentMethod, type RewardFulfillmentState, type RiskPolicyInput, type RotateGuardSignerWalletResult, type SdkSubscriptionErrorContext, type ServerSessionCookieOptions, type ServerSessionSnapshot, ServiceUnavailableError, type SessionData, SessionElevationRequiredError, type SetRewardDestinationInput, type SetRewardDestinationResult, type SetSubaccountMemberMfaRequirementInput, type SignProtectedActionInput, type SocialProvider, type SocialProviderInput, type SocialVerification, type SocialVerificationErrorCode, type SocialVerificationMethod, type SocialVerificationStatus, type SparklineIntervalName, type SpotConfig, type SpotFeeRate, type SpotPairVolumeSeries, type SpotVolumeHistoryInput, type SpotVolumeHistoryResponse, type StablecoinConversionRate, StaleQuoteError, type StartVerificationInput, type StartVerificationResponse, StepUpRequiredError, type StopDetailsOutput, type StopLossInput, type Subaccount, type SubaccountActivityInput, type SubaccountChallenge, SubaccountChallengeInvalidError, type SubaccountEvent, type SubaccountIdInput, type SubaccountInvite, type SubaccountInviteStatus, type SubaccountMember, type SubaccountPermission, type SubaccountPermissionDefinition, type SubaccountPolicy, type SubaccountPolicyApplyInput, type SubaccountPolicyCreateInput, type SubaccountPolicyUpdateInput, type SubaccountRole, type SubaccountRoleCatalog, type SubaccountRoleDefinition, type SubaccountScopedInput, type SubaccountStatus, type SubscribeHandlers, type SubscribeZippedAssetSupplyInput, type TakeProfitInput, type Timeframe, TimeoutError, TimestampSkewError, type Trade, type TradingRateLimitClass, type TradingRateLimitRule, type TradingRateLimits, type TradingWithdrawSigningConfig, type TradingWithdrawWalletSigner, type TrailingDetailsOutput, type TrailingStopInput, type TransferCodeValue, type TransferCounterparties, type TransferCounterparty, type TransferDestination, type TransferDestinations, type TransferSideKind, TransientError, type Transports, type Trigger, type TriggerDetailsOutput, type TriggerEvent, type TwapDetailsOutput, type UnifiedAssetBalancesResponse, type UpdateAddressBookEntryInput, type UpdateAddressBookTagInput, type UpdateMfaFactorInput, type UpdateMfaFactorResult, type UpdateProfileInput, type UpdateSubaccountInput, type UpdateSubaccountMemberRoleInput, type UpdateWhiteboardBoardAclInput, type UpdateWhiteboardBoardAclResult, type UpdateWhiteboardBoardInput, type UpdateWhiteboardBoardResult, type UsernameHistoryEntry, type ValidateWithdrawDestinationInput, type ValidateWithdrawDestinationResult, ValidationError, type VerificationReadyResponse, type VerifyRecoveryCodeChallengeInput, type VerifyTotpChallengeInput, type VipStatus, type VipTier, type VipTierCatalog, type WalletChallenge, type WhiteboardAccess, type WhiteboardAclEntry, type WhiteboardAclEntryInput, type WhiteboardAclSubjectType, type WhiteboardAudience, type WhiteboardBoard, type WhiteboardBoardDetails, type WhiteboardBoardListItem, type WhiteboardJoinTokenResult, type WhiteboardPermissions, type WhiteboardPresencePayload, type WhiteboardResolvedRole, type WhiteboardSnapshot, type WhiteboardWritableRole, type WithdrawWhitelistView, type ZippedAssetSupplyBatch, type ZippedAssetSupplyGroupResponse, type ZippedAssetSupplyResponse, type ZippedAssetSupplySeries, type ZippedAssetSupplyUpdate, type ZipperAssetChainVariant, type ZipperAssetConfig, type ZipperChainConfig, type ZipperChainContractConfig, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, createPolyesterServerCoreFromCookies, createPolyesterServerCoreFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, keccak256Hex, loadErrorDetailDecoders, mergeLedgerBalances, normalizeErrorMessage, resolveAuthCookieName, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { AlreadyExistsError, AuthenticationError, ConfigurationError, InternalServerError, MfaEnrollmentRequiredError, MfaLastFactorRequiredError, MfaRequiredError, MfaVerificationError, NetworkError, NotImplementedError, PermissionError, PolicyInUseError, PolicyLockedError, PolicyScopeMismatchError, PolyesterError, PreconditionFailedError, RateLimitError, RequestError, ResourceNotFoundError, RevisionConflictError, ServiceUnavailableError, SessionElevationRequiredError, StaleQuoteError, StepUpRequiredError, SubaccountChallengeInvalidError, TimeoutError, TimestampSkewError, TransientError, ValidationError, errorFromHttpStatus, isAbortError, normalizeErrorMessage } from "./shared/errors.js";
|
|
2
|
-
import {
|
|
2
|
+
import { loadErrorDetailDecoders } from "./shared/error-detail.js";
|
|
3
3
|
import { connectErrorToPolyesterError, createErrorMappingInterceptor, toPolyesterError } from "./shared/connect-error-mapping.js";
|
|
4
4
|
import { checksumEvmAddress, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, isEvmAddress, isEvmAddressStrict, keccak256Hex } from "./utils/evm.js";
|
|
5
5
|
import { POLYESTER_DEVNET_ENVIRONMENT, POLYESTER_TESTNET_ENVIRONMENT, createPolyesterEnvironment } from "./environment.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { mergeLedgerBalances } from "./services/balances/balances.merge.js";
|
|
6
|
+
import { tsObjToNsString } from "./utils/time.js";
|
|
7
|
+
import { PolyesterCore } from "./core-client.js";
|
|
9
8
|
import { validateCreateAddressBookEntryInput } from "./services/address-book/address-book.schemas.js";
|
|
10
|
-
import {
|
|
9
|
+
import { formatConnectError, formatUserFacingError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError } from "./utils/errors.js";
|
|
10
|
+
import { PolyesterClient } from "./client.js";
|
|
11
11
|
import { POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME, resolveAuthCookieName } from "./services/auth/cookie-constants.js";
|
|
12
12
|
import { createCookieAuthTokenStorage, createMemoryAuthTokenStorage } from "./services/auth/token-storage.js";
|
|
13
|
+
import { PolyesterBrowserCore } from "./browser-core.js";
|
|
13
14
|
import { PolyesterBrowserClient } from "./browser-client.js";
|
|
15
|
+
import { PolyesterServerCore, createPolyesterServerCoreFromCookies, createPolyesterServerCoreFromRequest } from "./server-core.js";
|
|
14
16
|
import { PolyesterServerClient, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest } from "./server-client.js";
|
|
15
17
|
import { isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isSessionElevationRequiredError } from "./utils/connect-mfa-errors.js";
|
|
16
18
|
import { columnarTimestampSecAt, expandColumnarTimestampsSec } from "./utils/columnar-time.js";
|
|
17
|
-
|
|
19
|
+
import { compareUnsignedIntegerStrings, shouldApplyReconciliationUpdate } from "./shared/reconciliation.js";
|
|
20
|
+
import { mergeLedgerBalances } from "./services/balances/balances.merge.js";
|
|
21
|
+
export { AlreadyExistsError, AuthenticationError, ConfigurationError, InternalServerError, MfaEnrollmentRequiredError, MfaLastFactorRequiredError, MfaRequiredError, MfaVerificationError, NetworkError, NotImplementedError, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_DEVNET_ENVIRONMENT, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, PermissionError, PolicyInUseError, PolicyLockedError, PolicyScopeMismatchError, PolyesterBrowserClient, PolyesterBrowserCore, PolyesterClient, PolyesterCore, PolyesterError, PolyesterServerClient, PolyesterServerCore, PreconditionFailedError, RateLimitError, RequestError, ResourceNotFoundError, RevisionConflictError, ServiceUnavailableError, SessionElevationRequiredError, StaleQuoteError, StepUpRequiredError, SubaccountChallengeInvalidError, TimeoutError, TimestampSkewError, TransientError, ValidationError, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, createPolyesterServerCoreFromCookies, createPolyesterServerCoreFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, keccak256Hex, loadErrorDetailDecoders, mergeLedgerBalances, normalizeErrorMessage, resolveAuthCookieName, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSdkSubscriptionErrorContext } from "../shared/subscription-errors.js";
|
|
2
|
-
import { isDev } from "../utils/is-dev.js";
|
|
3
2
|
import { formatConnectError } from "../utils/errors.js";
|
|
3
|
+
import { isDev } from "../utils/is-dev.js";
|
|
4
4
|
//#region src/realtime/snapshot-then-stream.ts
|
|
5
5
|
/**
|
|
6
6
|
* Snapshot-then-stream for feed state. By default, the buffer caps at
|
package/dist/server-client.d.ts
CHANGED
|
@@ -1,87 +1,13 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { ApiKeyEd25519AuthProvider, JwtAuthProvider } from "./shared/transports.js";
|
|
3
|
-
import { SubaccountResolver } from "./services/subaccount-resolver.js";
|
|
4
|
-
import { Me } from "./services/auth/auth.js";
|
|
5
|
-
import { PolyesterClient, PolyesterClientBaseConfig } from "./core-client.js";
|
|
6
|
-
import { CookieGetter } from "./utils/cookies.js";
|
|
7
|
-
import { AuthCookieLocation, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME } from "./services/auth/cookie-constants.js";
|
|
1
|
+
import { PolyesterServices } from "./client.js";
|
|
8
2
|
import { ServerSessionSnapshot } from "./services/auth/session.types.js";
|
|
9
|
-
import "./
|
|
3
|
+
import { CreateServerClientFromCookiesParams, CreateServerClientFromRequestParams, PolyesterServerClientConfig, PolyesterServerCore } from "./server-core.js";
|
|
10
4
|
//#region src/server-client.d.ts
|
|
11
|
-
|
|
12
|
-
type PolyesterServerClientConfig = PolyesterClientBaseConfig & {
|
|
13
|
-
/** Auth provider config for HTTP/Connect endpoints. */
|
|
14
|
-
auth?: JwtAuthProvider | ApiKeyEd25519AuthProvider;
|
|
15
|
-
/** Bearer authentication and display-only session data parsed from cookies. */
|
|
16
|
-
session?: ServerSessionSnapshot;
|
|
17
|
-
/**
|
|
18
|
-
* Use unsigned display-session `activeAccount` as the default subaccount for
|
|
19
|
-
* calls that omit `subaccountId`. This preserves account-switcher intent for
|
|
20
|
-
* apps that explicitly opt in; backend authorization must still decide what
|
|
21
|
-
* the authenticated user can access.
|
|
22
|
-
*/
|
|
23
|
-
useDisplaySessionActiveAccountAsDefault?: boolean;
|
|
24
|
-
};
|
|
5
|
+
interface PolyesterServerClient extends PolyesterServices {}
|
|
25
6
|
/**
|
|
26
|
-
* Server-side SDK client that can parse display-session cookies and verify
|
|
7
|
+
* Server-side SDK client that can parse display-session cookies and verify
|
|
8
|
+
* bearer-token sessions with the backend, with a lazy getter for every public service.
|
|
27
9
|
*/
|
|
28
|
-
declare class PolyesterServerClient extends
|
|
29
|
-
#private;
|
|
30
|
-
constructor(config: PolyesterServerClientConfig);
|
|
31
|
-
/**
|
|
32
|
-
* Creates a resolver for server-side subaccount defaults. Display-session
|
|
33
|
-
* `activeAccount` is only used as caller intent when explicitly enabled;
|
|
34
|
-
* backend auth remains authoritative.
|
|
35
|
-
*/
|
|
36
|
-
protected createSubaccountResolver(): SubaccountResolver;
|
|
37
|
-
get hasAuthProvider(): boolean;
|
|
38
|
-
get hasBearerToken(): boolean;
|
|
39
|
-
get hasUsableBearerToken(): boolean;
|
|
40
|
-
get hasDisplaySession(): boolean;
|
|
41
|
-
get session(): ServerSessionSnapshot;
|
|
42
|
-
/**
|
|
43
|
-
* Verifies the current server session. Returns null only when credentials
|
|
44
|
-
* are absent or rejected as unauthenticated. Transport, configuration, and
|
|
45
|
-
* other backend failures are rethrown so callers do not treat outages as logout.
|
|
46
|
-
*/
|
|
47
|
-
verifySession(): Promise<Me | null>;
|
|
48
|
-
}
|
|
49
|
-
type ServerClientFactoryBaseConfig<TConfig> = TConfig extends PolyesterClientBaseConfig ? Pick<TConfig, "environment" | "interceptors" | "realtime" | "wireFormat" | "catalog" | "catalogSnapshot" | "catalogCell" | "transports" | "realtimeClient"> : never;
|
|
50
|
-
/** Parameters for creating a server client from cookies. */
|
|
51
|
-
type CreateServerClientFromCookiesParams = ServerClientFactoryBaseConfig<PolyesterClientBaseConfig> & {
|
|
52
|
-
/**
|
|
53
|
-
* A Request, name-value record, or synchronous cookie store whose `get`
|
|
54
|
-
* method returns either a string or an object with a string `value`.
|
|
55
|
-
* Await asynchronous framework cookie helpers before passing their result.
|
|
56
|
-
*/
|
|
57
|
-
cookies: CookieGetter;
|
|
58
|
-
/**
|
|
59
|
-
* The page or request location that supplied `cookies`. Required for
|
|
60
|
-
* local framework cookie stores so their port-scoped auth cookies can
|
|
61
|
-
* be parsed; a `Request` source derives this from `request.url`.
|
|
62
|
-
*/
|
|
63
|
-
cookieLocation?: AuthCookieLocation;
|
|
64
|
-
/** Base name configured for the browser bearer-token cookie. */
|
|
65
|
-
tokenCookieName?: string;
|
|
66
|
-
/**
|
|
67
|
-
* Use unsigned display-session `activeAccount` as the default subaccount for
|
|
68
|
-
* calls that omit `subaccountId`. This is caller intent from UI hydration,
|
|
69
|
-
* not proof of authority; backend authorization remains authoritative.
|
|
70
|
-
*/
|
|
71
|
-
useDisplaySessionActiveAccountAsDefault?: boolean;
|
|
72
|
-
};
|
|
73
|
-
/** Parameters for creating a server client from a request. */
|
|
74
|
-
type CreateServerClientFromRequestParams = ServerClientFactoryBaseConfig<PolyesterClientBaseConfig> & {
|
|
75
|
-
request: Request;
|
|
76
|
-
/** Base name configured for the browser bearer-token cookie. */
|
|
77
|
-
tokenCookieName?: string;
|
|
78
|
-
/**
|
|
79
|
-
* Use unsigned display-session `activeAccount` as the default subaccount for
|
|
80
|
-
* calls that omit `subaccountId`. This is caller intent from UI hydration,
|
|
81
|
-
* not proof of authority; backend authorization remains authoritative.
|
|
82
|
-
*/
|
|
83
|
-
useDisplaySessionActiveAccountAsDefault?: boolean;
|
|
84
|
-
};
|
|
10
|
+
declare class PolyesterServerClient extends PolyesterServerCore {}
|
|
85
11
|
/**
|
|
86
12
|
* Creates a server SDK client from a Request, cookie record, or synchronous cookie store.
|
|
87
13
|
*/
|
|
@@ -91,5 +17,5 @@ declare function createPolyesterServerClientFromCookies(params: CreateServerClie
|
|
|
91
17
|
*/
|
|
92
18
|
declare function createPolyesterServerClientFromRequest(params: CreateServerClientFromRequestParams): PolyesterServerClient;
|
|
93
19
|
//#endregion
|
|
94
|
-
export {
|
|
20
|
+
export { PolyesterServerClient, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest };
|
|
95
21
|
//# sourceMappingURL=server-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-client.d.ts","names":[],"sources":["../src/server-client.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-client.d.ts","names":[],"sources":["../src/server-client.ts"],"mappings":";;;;UAiBiB,8BAA8B;;;;;cAOlC,8BAA8B;;;;iBAS3B,uCACZ,QAAQ,sCACT;;;;iBAOa,uCACZ,QAAQ,sCACT"}
|
package/dist/server-client.js
CHANGED
|
@@ -1,133 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { PolyesterClient, parsePolyesterClientConfig, pickPolyesterCatalogConfig } from "./core-client.js";
|
|
4
|
-
import "./services/auth/cookie-constants.js";
|
|
5
|
-
import { emptyServerSessionSnapshot, parseServerSessionSnapshot } from "./services/auth/session.js";
|
|
6
|
-
import { isJwtValid } from "./utils/jwt.js";
|
|
1
|
+
import { installServiceGetters } from "./client.js";
|
|
2
|
+
import { PolyesterServerCore, serverClientConfigFromCookies, serverClientConfigFromRequest } from "./server-core.js";
|
|
7
3
|
//#region src/server-client.ts
|
|
8
4
|
/**
|
|
9
|
-
*
|
|
5
|
+
* Server-side SDK client that can parse display-session cookies and verify
|
|
6
|
+
* bearer-token sessions with the backend, with a lazy getter for every public service.
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Server-side SDK client that can parse display-session cookies and verify bearer-token sessions with the backend.
|
|
16
|
-
*/
|
|
17
|
-
var PolyesterServerClient = class extends PolyesterClient {
|
|
18
|
-
#hasAuthProvider;
|
|
19
|
-
#session;
|
|
20
|
-
#useDisplaySessionActiveAccountAsDefault;
|
|
21
|
-
constructor(config) {
|
|
22
|
-
config = parsePolyesterClientConfig(config);
|
|
23
|
-
const auth = config.auth ?? void 0;
|
|
24
|
-
super({
|
|
25
|
-
environment: config.environment,
|
|
26
|
-
interceptors: config.interceptors,
|
|
27
|
-
auth,
|
|
28
|
-
wireFormat: config.wireFormat,
|
|
29
|
-
realtime: config.realtime,
|
|
30
|
-
...pickPolyesterCatalogConfig(config),
|
|
31
|
-
transports: config.transports,
|
|
32
|
-
realtimeClient: config.realtimeClient
|
|
33
|
-
});
|
|
34
|
-
this.#hasAuthProvider = !!auth;
|
|
35
|
-
this.#session = config.session ?? emptyServerSessionSnapshot();
|
|
36
|
-
this.#useDisplaySessionActiveAccountAsDefault = config.useDisplaySessionActiveAccountAsDefault ?? false;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Creates a resolver for server-side subaccount defaults. Display-session
|
|
40
|
-
* `activeAccount` is only used as caller intent when explicitly enabled;
|
|
41
|
-
* backend auth remains authoritative.
|
|
42
|
-
*/
|
|
43
|
-
createSubaccountResolver() {
|
|
44
|
-
return {
|
|
45
|
-
getDefaultSubaccountId: () => {
|
|
46
|
-
if (!this.#useDisplaySessionActiveAccountAsDefault) return null;
|
|
47
|
-
const activeAccount = this.#session.activeAccount;
|
|
48
|
-
if (activeAccount && !activeAccount.isMain) return activeAccount.accountId;
|
|
49
|
-
return null;
|
|
50
|
-
},
|
|
51
|
-
getActiveAccountId: () => this.#session.activeAccount?.accountId ?? null,
|
|
52
|
-
getMainAccountId: () => this.#session.activeAccount?.mainAccountId ?? null
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
get hasAuthProvider() {
|
|
56
|
-
return this.#hasAuthProvider;
|
|
57
|
-
}
|
|
58
|
-
get hasBearerToken() {
|
|
59
|
-
return !!this.#session.bearerToken;
|
|
60
|
-
}
|
|
61
|
-
get hasUsableBearerToken() {
|
|
62
|
-
return isJwtValid(this.#session.bearerToken);
|
|
63
|
-
}
|
|
64
|
-
get hasDisplaySession() {
|
|
65
|
-
return this.#session.hasDisplaySession;
|
|
66
|
-
}
|
|
67
|
-
get session() {
|
|
68
|
-
return this.#session;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Verifies the current server session. Returns null only when credentials
|
|
72
|
-
* are absent or rejected as unauthenticated. Transport, configuration, and
|
|
73
|
-
* other backend failures are rethrown so callers do not treat outages as logout.
|
|
74
|
-
*/
|
|
75
|
-
async verifySession() {
|
|
76
|
-
if (!this.#hasAuthProvider) return null;
|
|
77
|
-
try {
|
|
78
|
-
return await this.auth.me();
|
|
79
|
-
} catch (error) {
|
|
80
|
-
const mappedError = toPolyesterError(error);
|
|
81
|
-
if (mappedError instanceof AuthenticationError) return null;
|
|
82
|
-
throw mappedError;
|
|
83
|
-
}
|
|
8
|
+
var PolyesterServerClient = class extends PolyesterServerCore {
|
|
9
|
+
static {
|
|
10
|
+
installServiceGetters(this);
|
|
84
11
|
}
|
|
85
12
|
};
|
|
86
13
|
/**
|
|
87
14
|
* Creates a server SDK client from a Request, cookie record, or synchronous cookie store.
|
|
88
15
|
*/
|
|
89
16
|
function createPolyesterServerClientFromCookies(params) {
|
|
90
|
-
|
|
91
|
-
cookieLocation: params.cookieLocation,
|
|
92
|
-
tokenCookieName: params.tokenCookieName
|
|
93
|
-
});
|
|
94
|
-
const auth = isJwtValid(session.bearerToken) ? {
|
|
95
|
-
kind: "jwt",
|
|
96
|
-
getToken: () => session.bearerToken
|
|
97
|
-
} : void 0;
|
|
98
|
-
return new PolyesterServerClient({
|
|
99
|
-
environment: params.environment,
|
|
100
|
-
interceptors: params.interceptors,
|
|
101
|
-
session,
|
|
102
|
-
wireFormat: params.wireFormat,
|
|
103
|
-
realtime: params.realtime,
|
|
104
|
-
...pickPolyesterCatalogConfig(params),
|
|
105
|
-
transports: params.transports,
|
|
106
|
-
realtimeClient: params.realtimeClient,
|
|
107
|
-
auth,
|
|
108
|
-
useDisplaySessionActiveAccountAsDefault: params.useDisplaySessionActiveAccountAsDefault
|
|
109
|
-
});
|
|
17
|
+
return new PolyesterServerClient(serverClientConfigFromCookies(params));
|
|
110
18
|
}
|
|
111
19
|
/**
|
|
112
20
|
* Creates a server SDK client from a Request object.
|
|
113
21
|
*/
|
|
114
22
|
function createPolyesterServerClientFromRequest(params) {
|
|
115
|
-
|
|
116
|
-
return createPolyesterServerClientFromCookies({
|
|
117
|
-
cookies: params.request,
|
|
118
|
-
cookieLocation: new URL(params.request.url),
|
|
119
|
-
tokenCookieName: params.tokenCookieName,
|
|
120
|
-
environment: params.environment,
|
|
121
|
-
interceptors: params.interceptors,
|
|
122
|
-
wireFormat: params.wireFormat,
|
|
123
|
-
realtime: params.realtime,
|
|
124
|
-
...pickPolyesterCatalogConfig(params),
|
|
125
|
-
transports: params.transports,
|
|
126
|
-
realtimeClient: params.realtimeClient,
|
|
127
|
-
useDisplaySessionActiveAccountAsDefault: params.useDisplaySessionActiveAccountAsDefault
|
|
128
|
-
});
|
|
23
|
+
return new PolyesterServerClient(serverClientConfigFromRequest(params));
|
|
129
24
|
}
|
|
130
25
|
//#endregion
|
|
131
|
-
export { PolyesterServerClient, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest
|
|
26
|
+
export { PolyesterServerClient, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest };
|
|
132
27
|
|
|
133
28
|
//# sourceMappingURL=server-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-client.js","names":["#hasAuthProvider","#session","#useDisplaySessionActiveAccountAsDefault"],"sources":["../src/server-client.ts"],"sourcesContent":["import {\n parsePolyesterClientConfig,\n pickPolyesterCatalogConfig,\n PolyesterClient,\n type PolyesterClientBaseConfig,\n} from \"./core-client.js\";\nimport {\n POLYESTER_AUTH_TOKEN_COOKIE_NAME,\n POLYESTER_SESSION_COOKIE_NAME,\n type AuthCookieLocation,\n} from \"./services/auth/cookie-constants.js\";\nimport type { ServerSessionSnapshot } from \"./services/auth/session.types.js\";\nimport {\n emptyServerSessionSnapshot,\n parseServerSessionSnapshot,\n type ServerSessionCookieOptions,\n} from \"./services/auth/session.js\";\nimport type { CookieGetter } from \"./utils/cookies.js\";\nimport type { JwtAuthProvider, ApiKeyEd25519AuthProvider } from \"./shared/transports.js\";\nimport type { SubaccountResolver } from \"./services/subaccount-resolver.js\";\nimport { isJwtValid } from \"./utils/jwt.js\";\nimport type { Me } from \"./services/auth/auth.js\";\nimport type { PolyesterEnvironment } from \"./environment.js\";\nimport { AuthenticationError, ConfigurationError } from \"./shared/errors.js\";\nimport { toPolyesterError } from \"./shared/connect-error-mapping.js\";\n\nexport type { ServerSessionSnapshot };\n\n/**\n * Parses a serialized session cookie into SDK session data.\n */\nexport function parseSessionCookie(\n cookies: CookieGetter,\n environment: PolyesterEnvironment,\n options?: ServerSessionCookieOptions,\n): ServerSessionSnapshot {\n return parseServerSessionSnapshot(cookies, environment, options);\n}\n\n/** Configuration for the server Polyester client. */\nexport type PolyesterServerClientConfig = PolyesterClientBaseConfig & {\n /** Auth provider config for HTTP/Connect endpoints. */\n auth?: JwtAuthProvider | ApiKeyEd25519AuthProvider;\n /** Bearer authentication and display-only session data parsed from cookies. */\n session?: ServerSessionSnapshot;\n /**\n * Use unsigned display-session `activeAccount` as the default subaccount for\n * calls that omit `subaccountId`. This preserves account-switcher intent for\n * apps that explicitly opt in; backend authorization must still decide what\n * the authenticated user can access.\n */\n useDisplaySessionActiveAccountAsDefault?: boolean;\n};\n\n/**\n * Server-side SDK client that can parse display-session cookies and verify bearer-token sessions with the backend.\n */\nexport class PolyesterServerClient extends PolyesterClient {\n #hasAuthProvider: boolean;\n #session: ServerSessionSnapshot;\n #useDisplaySessionActiveAccountAsDefault: boolean;\n\n constructor(config: PolyesterServerClientConfig) {\n config = parsePolyesterClientConfig(config);\n const auth = config.auth ?? undefined;\n\n super({\n environment: config.environment,\n interceptors: config.interceptors,\n auth,\n wireFormat: config.wireFormat,\n realtime: config.realtime,\n ...pickPolyesterCatalogConfig(config),\n transports: config.transports,\n realtimeClient: config.realtimeClient,\n });\n this.#hasAuthProvider = !!auth;\n this.#session = config.session ?? emptyServerSessionSnapshot();\n this.#useDisplaySessionActiveAccountAsDefault =\n config.useDisplaySessionActiveAccountAsDefault ?? false;\n }\n\n /**\n * Creates a resolver for server-side subaccount defaults. Display-session\n * `activeAccount` is only used as caller intent when explicitly enabled;\n * backend auth remains authoritative.\n */\n protected override createSubaccountResolver(): SubaccountResolver {\n return {\n getDefaultSubaccountId: () => {\n if (!this.#useDisplaySessionActiveAccountAsDefault) return null;\n\n const activeAccount = this.#session.activeAccount;\n if (activeAccount && !activeAccount.isMain) return activeAccount.accountId;\n return null;\n },\n getActiveAccountId: () => this.#session.activeAccount?.accountId ?? null,\n getMainAccountId: () => this.#session.activeAccount?.mainAccountId ?? null,\n };\n }\n\n get hasAuthProvider(): boolean {\n return this.#hasAuthProvider;\n }\n\n get hasBearerToken(): boolean {\n return !!this.#session.bearerToken;\n }\n\n get hasUsableBearerToken(): boolean {\n return isJwtValid(this.#session.bearerToken);\n }\n\n get hasDisplaySession(): boolean {\n return this.#session.hasDisplaySession;\n }\n\n get session(): ServerSessionSnapshot {\n return this.#session;\n }\n\n /**\n * Verifies the current server session. Returns null only when credentials\n * are absent or rejected as unauthenticated. Transport, configuration, and\n * other backend failures are rethrown so callers do not treat outages as logout.\n */\n async verifySession(): Promise<Me | null> {\n if (!this.#hasAuthProvider) return null;\n\n try {\n return await this.auth.me();\n } catch (error) {\n const mappedError = toPolyesterError(error);\n if (mappedError instanceof AuthenticationError) return null;\n throw mappedError;\n }\n }\n}\n\ntype ServerClientFactoryBaseConfig<TConfig> = TConfig extends PolyesterClientBaseConfig\n ? Pick<\n TConfig,\n | \"environment\"\n | \"interceptors\"\n | \"realtime\"\n | \"wireFormat\"\n | \"catalog\"\n | \"catalogSnapshot\"\n | \"catalogCell\"\n | \"transports\"\n | \"realtimeClient\"\n >\n : never;\n\n/** Parameters for creating a server client from cookies. */\nexport type CreateServerClientFromCookiesParams =\n ServerClientFactoryBaseConfig<PolyesterClientBaseConfig> & {\n /**\n * A Request, name-value record, or synchronous cookie store whose `get`\n * method returns either a string or an object with a string `value`.\n * Await asynchronous framework cookie helpers before passing their result.\n */\n cookies: CookieGetter;\n /**\n * The page or request location that supplied `cookies`. Required for\n * local framework cookie stores so their port-scoped auth cookies can\n * be parsed; a `Request` source derives this from `request.url`.\n */\n cookieLocation?: AuthCookieLocation;\n /** Base name configured for the browser bearer-token cookie. */\n tokenCookieName?: string;\n /**\n * Use unsigned display-session `activeAccount` as the default subaccount for\n * calls that omit `subaccountId`. This is caller intent from UI hydration,\n * not proof of authority; backend authorization remains authoritative.\n */\n useDisplaySessionActiveAccountAsDefault?: boolean;\n };\n\n/** Parameters for creating a server client from a request. */\nexport type CreateServerClientFromRequestParams =\n ServerClientFactoryBaseConfig<PolyesterClientBaseConfig> & {\n request: Request;\n /** Base name configured for the browser bearer-token cookie. */\n tokenCookieName?: string;\n /**\n * Use unsigned display-session `activeAccount` as the default subaccount for\n * calls that omit `subaccountId`. This is caller intent from UI hydration,\n * not proof of authority; backend authorization remains authoritative.\n */\n useDisplaySessionActiveAccountAsDefault?: boolean;\n };\n\n/**\n * Creates a server SDK client from a Request, cookie record, or synchronous cookie store.\n */\nexport function createPolyesterServerClientFromCookies(\n params: CreateServerClientFromCookiesParams,\n): PolyesterServerClient {\n const session = parseSessionCookie(params.cookies, params.environment, {\n cookieLocation: params.cookieLocation,\n tokenCookieName: params.tokenCookieName,\n });\n const auth = isJwtValid(session.bearerToken)\n ? ({\n kind: \"jwt\",\n getToken: () => session.bearerToken,\n } satisfies JwtAuthProvider)\n : undefined;\n\n return new PolyesterServerClient({\n environment: params.environment,\n interceptors: params.interceptors,\n session,\n wireFormat: params.wireFormat,\n realtime: params.realtime,\n ...pickPolyesterCatalogConfig(params),\n transports: params.transports,\n realtimeClient: params.realtimeClient,\n auth,\n useDisplaySessionActiveAccountAsDefault: params.useDisplaySessionActiveAccountAsDefault,\n });\n}\n\n/**\n * Creates a server SDK client from a Request object.\n */\nexport function createPolyesterServerClientFromRequest(\n params: CreateServerClientFromRequestParams,\n): PolyesterServerClient {\n if (!(params?.request instanceof Request)) {\n throw new ConfigurationError(\"request is required and must be a Request.\");\n }\n return createPolyesterServerClientFromCookies({\n cookies: params.request,\n cookieLocation: new URL(params.request.url),\n tokenCookieName: params.tokenCookieName,\n environment: params.environment,\n interceptors: params.interceptors,\n wireFormat: params.wireFormat,\n realtime: params.realtime,\n ...pickPolyesterCatalogConfig(params),\n transports: params.transports,\n realtimeClient: params.realtimeClient,\n useDisplaySessionActiveAccountAsDefault: params.useDisplaySessionActiveAccountAsDefault,\n });\n}\n\n/**\n * Reads a bearer token from supported auth cookies.\n */\nexport function getBearerTokenFromCookies(\n cookies: CookieGetter,\n environment: PolyesterEnvironment,\n options?: ServerSessionCookieOptions,\n): string | null {\n return parseSessionCookie(cookies, environment, options).bearerToken;\n}\n\nexport { POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME };\n"],"mappings":";;;;;;;;;;AA+BA,SAAgB,mBACZ,SACA,aACA,SACqB;CACrB,OAAO,2BAA2B,SAAS,aAAa,OAAO;AACnE;;;;AAoBA,IAAa,wBAAb,cAA2C,gBAAgB;CACvD;CACA;CACA;CAEA,YAAY,QAAqC;EAC7C,SAAS,2BAA2B,MAAM;EAC1C,MAAM,OAAO,OAAO,QAAQ,KAAA;EAE5B,MAAM;GACF,aAAa,OAAO;GACpB,cAAc,OAAO;GACrB;GACA,YAAY,OAAO;GACnB,UAAU,OAAO;GACjB,GAAG,2BAA2B,MAAM;GACpC,YAAY,OAAO;GACnB,gBAAgB,OAAO;EAC3B,CAAC;EACD,KAAKA,mBAAmB,CAAC,CAAC;EAC1B,KAAKC,WAAW,OAAO,WAAW,2BAA2B;EAC7D,KAAKC,2CACD,OAAO,2CAA2C;CAC1D;;;;;;CAOA,2BAAkE;EAC9D,OAAO;GACH,8BAA8B;IAC1B,IAAI,CAAC,KAAKA,0CAA0C,OAAO;IAE3D,MAAM,gBAAgB,KAAKD,SAAS;IACpC,IAAI,iBAAiB,CAAC,cAAc,QAAQ,OAAO,cAAc;IACjE,OAAO;GACX;GACA,0BAA0B,KAAKA,SAAS,eAAe,aAAa;GACpE,wBAAwB,KAAKA,SAAS,eAAe,iBAAiB;EAC1E;CACJ;CAEA,IAAI,kBAA2B;EAC3B,OAAO,KAAKD;CAChB;CAEA,IAAI,iBAA0B;EAC1B,OAAO,CAAC,CAAC,KAAKC,SAAS;CAC3B;CAEA,IAAI,uBAAgC;EAChC,OAAO,WAAW,KAAKA,SAAS,WAAW;CAC/C;CAEA,IAAI,oBAA6B;EAC7B,OAAO,KAAKA,SAAS;CACzB;CAEA,IAAI,UAAiC;EACjC,OAAO,KAAKA;CAChB;;;;;;CAOA,MAAM,gBAAoC;EACtC,IAAI,CAAC,KAAKD,kBAAkB,OAAO;EAEnC,IAAI;GACA,OAAO,MAAM,KAAK,KAAK,GAAG;EAC9B,SAAS,OAAO;GACZ,MAAM,cAAc,iBAAiB,KAAK;GAC1C,IAAI,uBAAuB,qBAAqB,OAAO;GACvD,MAAM;EACV;CACJ;AACJ;;;;AA2DA,SAAgB,uCACZ,QACqB;CACrB,MAAM,UAAU,mBAAmB,OAAO,SAAS,OAAO,aAAa;EACnE,gBAAgB,OAAO;EACvB,iBAAiB,OAAO;CAC5B,CAAC;CACD,MAAM,OAAO,WAAW,QAAQ,WAAW,IACpC;EACG,MAAM;EACN,gBAAgB,QAAQ;CAC5B,IACA,KAAA;CAEN,OAAO,IAAI,sBAAsB;EAC7B,aAAa,OAAO;EACpB,cAAc,OAAO;EACrB;EACA,YAAY,OAAO;EACnB,UAAU,OAAO;EACjB,GAAG,2BAA2B,MAAM;EACpC,YAAY,OAAO;EACnB,gBAAgB,OAAO;EACvB;EACA,yCAAyC,OAAO;CACpD,CAAC;AACL;;;;AAKA,SAAgB,uCACZ,QACqB;CACrB,IAAI,EAAE,QAAQ,mBAAmB,UAC7B,MAAM,IAAI,mBAAmB,4CAA4C;CAE7E,OAAO,uCAAuC;EAC1C,SAAS,OAAO;EAChB,gBAAgB,IAAI,IAAI,OAAO,QAAQ,GAAG;EAC1C,iBAAiB,OAAO;EACxB,aAAa,OAAO;EACpB,cAAc,OAAO;EACrB,YAAY,OAAO;EACnB,UAAU,OAAO;EACjB,GAAG,2BAA2B,MAAM;EACpC,YAAY,OAAO;EACnB,gBAAgB,OAAO;EACvB,yCAAyC,OAAO;CACpD,CAAC;AACL"}
|
|
1
|
+
{"version":3,"file":"server-client.js","names":[],"sources":["../src/server-client.ts"],"sourcesContent":["import { installServiceGetters, type PolyesterServices } from \"./client.js\";\nimport {\n PolyesterServerCore,\n serverClientConfigFromCookies,\n serverClientConfigFromRequest,\n type CreateServerClientFromCookiesParams,\n type CreateServerClientFromRequestParams,\n} from \"./server-core.js\";\n\nexport type {\n CreateServerClientFromCookiesParams,\n CreateServerClientFromRequestParams,\n PolyesterServerClientConfig,\n ServerSessionSnapshot,\n} from \"./server-core.js\";\n\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- getters are installed below\nexport interface PolyesterServerClient extends PolyesterServices {}\n\n/**\n * Server-side SDK client that can parse display-session cookies and verify\n * bearer-token sessions with the backend, with a lazy getter for every public service.\n */\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- getters are installed below\nexport class PolyesterServerClient extends PolyesterServerCore {\n static {\n installServiceGetters(this);\n }\n}\n\n/**\n * Creates a server SDK client from a Request, cookie record, or synchronous cookie store.\n */\nexport function createPolyesterServerClientFromCookies(\n params: CreateServerClientFromCookiesParams,\n): PolyesterServerClient {\n return new PolyesterServerClient(serverClientConfigFromCookies(params));\n}\n\n/**\n * Creates a server SDK client from a Request object.\n */\nexport function createPolyesterServerClientFromRequest(\n params: CreateServerClientFromRequestParams,\n): PolyesterServerClient {\n return new PolyesterServerClient(serverClientConfigFromRequest(params));\n}\n"],"mappings":";;;;;;;AAwBA,IAAa,wBAAb,cAA2C,oBAAoB;CAC3D;EACI,sBAAsB,IAAI;CAC9B;AACJ;;;;AAKA,SAAgB,uCACZ,QACqB;CACrB,OAAO,IAAI,sBAAsB,8BAA8B,MAAM,CAAC;AAC1E;;;;AAKA,SAAgB,uCACZ,QACqB;CACrB,OAAO,IAAI,sBAAsB,8BAA8B,MAAM,CAAC;AAC1E"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import "./environment.js";
|
|
2
|
+
import { ApiKeyEd25519AuthProvider, JwtAuthProvider } from "./shared/transports.js";
|
|
3
|
+
import { SubaccountResolver } from "./services/subaccount-resolver.js";
|
|
4
|
+
import { Me } from "./services/auth/auth.js";
|
|
5
|
+
import { PolyesterClientBaseConfig, PolyesterCore } from "./core-client.js";
|
|
6
|
+
import { CookieGetter } from "./utils/cookies.js";
|
|
7
|
+
import { AuthCookieLocation, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME } from "./services/auth/cookie-constants.js";
|
|
8
|
+
import { ServerSessionSnapshot } from "./services/auth/session.types.js";
|
|
9
|
+
import "./services/auth/session.js";
|
|
10
|
+
//#region src/server-core.d.ts
|
|
11
|
+
/** Configuration for the server Polyester client. */
|
|
12
|
+
type PolyesterServerClientConfig = PolyesterClientBaseConfig & {
|
|
13
|
+
/** Auth provider config for HTTP/Connect endpoints. */
|
|
14
|
+
auth?: JwtAuthProvider | ApiKeyEd25519AuthProvider;
|
|
15
|
+
/** Bearer authentication and display-only session data parsed from cookies. */
|
|
16
|
+
session?: ServerSessionSnapshot;
|
|
17
|
+
/**
|
|
18
|
+
* Use unsigned display-session `activeAccount` as the default subaccount for
|
|
19
|
+
* calls that omit `subaccountId`. This preserves account-switcher intent for
|
|
20
|
+
* apps that explicitly opt in; backend authorization must still decide what
|
|
21
|
+
* the authenticated user can access.
|
|
22
|
+
*/
|
|
23
|
+
useDisplaySessionActiveAccountAsDefault?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Tree-shakable server client core that can parse display-session cookies and verify
|
|
27
|
+
* bearer-token sessions with the backend. Reach other services through
|
|
28
|
+
* `@polyester/sdk/services/*` accessors, or use `PolyesterServerClient` for a getter per service.
|
|
29
|
+
*/
|
|
30
|
+
declare class PolyesterServerCore extends PolyesterCore {
|
|
31
|
+
#private;
|
|
32
|
+
constructor(config: PolyesterServerClientConfig);
|
|
33
|
+
/**
|
|
34
|
+
* Creates a resolver for server-side subaccount defaults. Display-session
|
|
35
|
+
* `activeAccount` is only used as caller intent when explicitly enabled;
|
|
36
|
+
* backend auth remains authoritative.
|
|
37
|
+
*/
|
|
38
|
+
protected createSubaccountResolver(): SubaccountResolver;
|
|
39
|
+
get hasAuthProvider(): boolean;
|
|
40
|
+
get hasBearerToken(): boolean;
|
|
41
|
+
get hasUsableBearerToken(): boolean;
|
|
42
|
+
get hasDisplaySession(): boolean;
|
|
43
|
+
get session(): ServerSessionSnapshot;
|
|
44
|
+
/**
|
|
45
|
+
* Verifies the current server session. Returns null only when credentials
|
|
46
|
+
* are absent or rejected as unauthenticated. Transport, configuration, and
|
|
47
|
+
* other backend failures are rethrown so callers do not treat outages as logout.
|
|
48
|
+
*/
|
|
49
|
+
verifySession(): Promise<Me | null>;
|
|
50
|
+
}
|
|
51
|
+
type ServerClientFactoryBaseConfig<TConfig> = TConfig extends PolyesterClientBaseConfig ? Pick<TConfig, "environment" | "interceptors" | "realtime" | "wireFormat" | "fetch" | "catalog" | "catalogSnapshot" | "catalogCell" | "transports" | "realtimeClient"> : never;
|
|
52
|
+
/** Parameters for creating a server client from cookies. */
|
|
53
|
+
type CreateServerClientFromCookiesParams = ServerClientFactoryBaseConfig<PolyesterClientBaseConfig> & {
|
|
54
|
+
/**
|
|
55
|
+
* A Request, name-value record, or synchronous cookie store whose `get`
|
|
56
|
+
* method returns either a string or an object with a string `value`.
|
|
57
|
+
* Await asynchronous framework cookie helpers before passing their result.
|
|
58
|
+
*/
|
|
59
|
+
cookies: CookieGetter;
|
|
60
|
+
/**
|
|
61
|
+
* The page or request location that supplied `cookies`. Required for
|
|
62
|
+
* local framework cookie stores so their port-scoped auth cookies can
|
|
63
|
+
* be parsed; a `Request` source derives this from `request.url`.
|
|
64
|
+
*/
|
|
65
|
+
cookieLocation?: AuthCookieLocation;
|
|
66
|
+
/** Base name configured for the browser bearer-token cookie. */
|
|
67
|
+
tokenCookieName?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Use unsigned display-session `activeAccount` as the default subaccount for
|
|
70
|
+
* calls that omit `subaccountId`. This is caller intent from UI hydration,
|
|
71
|
+
* not proof of authority; backend authorization remains authoritative.
|
|
72
|
+
*/
|
|
73
|
+
useDisplaySessionActiveAccountAsDefault?: boolean;
|
|
74
|
+
};
|
|
75
|
+
/** Parameters for creating a server client from a request. */
|
|
76
|
+
type CreateServerClientFromRequestParams = ServerClientFactoryBaseConfig<PolyesterClientBaseConfig> & {
|
|
77
|
+
request: Request;
|
|
78
|
+
/** Base name configured for the browser bearer-token cookie. */
|
|
79
|
+
tokenCookieName?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Use unsigned display-session `activeAccount` as the default subaccount for
|
|
82
|
+
* calls that omit `subaccountId`. This is caller intent from UI hydration,
|
|
83
|
+
* not proof of authority; backend authorization remains authoritative.
|
|
84
|
+
*/
|
|
85
|
+
useDisplaySessionActiveAccountAsDefault?: boolean;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Creates a server client core from a Request, cookie record, or synchronous cookie store.
|
|
89
|
+
*/
|
|
90
|
+
declare function createPolyesterServerCoreFromCookies(params: CreateServerClientFromCookiesParams): PolyesterServerCore;
|
|
91
|
+
/**
|
|
92
|
+
* Creates a server client core from a Request object.
|
|
93
|
+
*/
|
|
94
|
+
declare function createPolyesterServerCoreFromRequest(params: CreateServerClientFromRequestParams): PolyesterServerCore;
|
|
95
|
+
//#endregion
|
|
96
|
+
export { CreateServerClientFromCookiesParams, CreateServerClientFromRequestParams, PolyesterServerClientConfig, PolyesterServerCore, type ServerSessionSnapshot, createPolyesterServerCoreFromCookies, createPolyesterServerCoreFromRequest };
|
|
97
|
+
//# sourceMappingURL=server-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-core.d.ts","names":[],"sources":["../src/server-core.ts"],"mappings":";;;;;;;;;;;KAwCY,8BAA8B;;EAEtC,OAAO,kBAAkB;;EAEzB,UAAU;;;;;;;EAOV;;;;;;;cAQS,4BAA4B;;EAKzB,YAAA,QAAQ;;;;;;YA0BD,4BAA4B;MAc3C;MAIA;MAIA;MAIA;MAIA,WAAW;;;;;;EAST,iBAAiB,QAAQ;;KAa9B,8BAA8B,WAAW,gBAAgB,4BACxD,KACI;;KAeE,sCACR,8BAA8B;;;;;;EAM1B,SAAS;;;;;;EAMT,iBAAiB;;EAEjB;;;;;;EAMA;;;KAII,sCACR,8BAA8B;EAC1B,SAAS;;EAET;;;;;;EAMA;;;;;iBA+DQ,qCACZ,QAAQ,sCACT;;;;iBAOa,qCACZ,QAAQ,sCACT"}
|