@polyester/sdk 0.36.0-devnet-20261118123359 → 0.36.0-devnet-20261118184607
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 +60 -8
- package/dist/catalogs/index.d.ts +2 -2
- package/dist/catalogs/snapshot-validation.js +10 -1
- package/dist/catalogs/snapshot-validation.js.map +1 -1
- package/dist/catalogs/zipper-catalog.d.ts +2 -0
- package/dist/catalogs/zipper-catalog.d.ts.map +1 -1
- package/dist/catalogs/zipper-catalog.js.map +1 -1
- package/dist/catalogs/zipper-supply.d.ts +2 -0
- package/dist/catalogs/zipper-supply.d.ts.map +1 -1
- package/dist/catalogs/zipper-supply.js +7 -5
- package/dist/catalogs/zipper-supply.js.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +679 -13
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.js +355 -97
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts +33 -4
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts.map +1 -1
- package/dist/gen/alerts/v1/price_alerts_pb.js +23 -2
- package/dist/gen/alerts/v1/price_alerts_pb.js.map +1 -1
- package/dist/gen/auth/v1/activity_pb.d.ts +148 -0
- package/dist/gen/auth/v1/activity_pb.d.ts.map +1 -0
- package/dist/gen/auth/v1/activity_pb.js +40 -0
- package/dist/gen/auth/v1/activity_pb.js.map +1 -0
- package/dist/gen/auth/v1/api_keys_pb.d.ts +10 -4
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js +3 -1
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +61 -5
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +23 -6
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.d.ts +140 -2
- package/dist/gen/auth/v1/mfa_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.js +80 -8
- package/dist/gen/auth/v1/mfa_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +18 -3
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +18 -3
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +36 -15
- package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +15 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +6 -2
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +104 -6
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js +49 -3
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +76 -3
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.js +46 -2
- package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
- package/dist/gen/index.d.ts +3 -1
- package/dist/gen/index.js +4 -2
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +21 -139
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +16 -17
- package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
- package/dist/gen/ledger/read/v1/statement_export_pb.d.ts +236 -20
- package/dist/gen/ledger/read/v1/statement_export_pb.d.ts.map +1 -1
- package/dist/gen/ledger/read/v1/statement_export_pb.js +44 -10
- package/dist/gen/ledger/read/v1/statement_export_pb.js.map +1 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts +9 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts.map +1 -1
- package/dist/gen/ledger/v1/catalog_pb.js +9 -1
- package/dist/gen/ledger/v1/catalog_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/asset_info_pb.d.ts +158 -7
- package/dist/gen/marketdata/v1/asset_info_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/asset_info_pb.js +56 -6
- package/dist/gen/marketdata/v1/asset_info_pb.js.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.d.ts +45 -6
- package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.js +23 -5
- package/dist/gen/notifications/v1/notifications_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +105 -29
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +14 -2
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +50 -20
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/polyester/api/options_pb.d.ts +11 -2
- package/dist/gen/polyester/api/options_pb.d.ts.map +1 -1
- package/dist/gen/polyester/api/options_pb.js +13 -3
- package/dist/gen/polyester/api/options_pb.js.map +1 -1
- package/dist/gen/privatews/v1/private_ws_pb.d.ts +13 -3
- package/dist/gen/privatews/v1/private_ws_pb.d.ts.map +1 -1
- package/dist/gen/privatews/v1/private_ws_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +126 -10
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +14 -6
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts +665 -0
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js +216 -0
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +166 -52
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +50 -12
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/system/v1/system_pb.d.ts +49 -2
- package/dist/gen/system/v1/system_pb.d.ts.map +1 -1
- package/dist/gen/system/v1/system_pb.js +18 -6
- package/dist/gen/system/v1/system_pb.js.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +150 -71
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js +56 -34
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +117 -16
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +45 -2
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +13 -9
- package/dist/realtime/ready-gated-subscription.js +1 -1
- package/dist/realtime/snapshot-then-stream.js +2 -0
- package/dist/realtime/snapshot-then-stream.js.map +1 -1
- package/dist/services/account-activity/account-activity.d.ts +22 -0
- package/dist/services/account-activity/account-activity.d.ts.map +1 -0
- package/dist/services/account-activity/account-activity.js +32 -0
- package/dist/services/account-activity/account-activity.js.map +1 -0
- package/dist/services/account-activity/account-activity.schemas.d.ts +78 -0
- package/dist/services/account-activity/account-activity.schemas.d.ts.map +1 -0
- package/dist/services/account-activity/account-activity.schemas.js +44 -0
- package/dist/services/account-activity/account-activity.schemas.js.map +1 -0
- package/dist/services/account-activity/account-activity.types.d.ts +2 -0
- package/dist/services/account-activity/service.d.ts +8 -0
- package/dist/services/account-activity/service.d.ts.map +1 -0
- package/dist/services/account-activity/service.js +9 -0
- package/dist/services/account-activity/service.js.map +1 -0
- package/dist/services/address-book/address-book.schemas.d.ts +2 -2
- package/dist/services/address-book/address-book.schemas.js +2 -2
- package/dist/services/api-keys/api-keys.schemas.js +2 -2
- package/dist/services/assistant/assistant-events.schemas.d.ts +25 -25
- package/dist/services/assistant/assistant.codecs.d.ts +7 -2
- package/dist/services/assistant/assistant.codecs.d.ts.map +1 -1
- package/dist/services/assistant/assistant.codecs.js +18 -2
- package/dist/services/assistant/assistant.codecs.js.map +1 -1
- package/dist/services/assistant/assistant.d.ts +29 -2
- package/dist/services/assistant/assistant.d.ts.map +1 -1
- package/dist/services/assistant/assistant.js +44 -2
- package/dist/services/assistant/assistant.js.map +1 -1
- package/dist/services/assistant/assistant.schemas.d.ts +111 -6
- package/dist/services/assistant/assistant.schemas.d.ts.map +1 -1
- package/dist/services/assistant/assistant.schemas.js +74 -6
- package/dist/services/assistant/assistant.schemas.js.map +1 -1
- package/dist/services/assistant/assistant.types.d.ts +3 -3
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts +3 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +21 -19
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -0
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js.map +1 -1
- package/dist/services/balances/balances.d.ts +1 -13
- package/dist/services/balances/balances.d.ts.map +1 -1
- package/dist/services/balances/balances.js +1 -45
- package/dist/services/balances/balances.js.map +1 -1
- package/dist/services/balances/balances.schemas.d.ts +1 -67
- package/dist/services/balances/balances.schemas.d.ts.map +1 -1
- package/dist/services/balances/balances.schemas.js +1 -22
- package/dist/services/balances/balances.schemas.js.map +1 -1
- package/dist/services/balances/balances.types.d.ts +2 -2
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/changelog/changelog.schemas.d.ts +38 -38
- package/dist/services/claims/claims.schemas.d.ts +2 -2
- package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +2 -2
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.codecs.d.ts +11 -6
- package/dist/services/internal-transfers/internal-transfers.codecs.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.codecs.js +6 -6
- package/dist/services/internal-transfers/internal-transfers.codecs.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.d.ts +17 -10
- package/dist/services/internal-transfers/internal-transfers.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.js +21 -10
- package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +43 -31
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.js +23 -12
- package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.types.d.ts +2 -2
- package/dist/services/lifecycle/lifecycle.js +1 -1
- package/dist/services/lifecycle/lifecycle.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +55 -55
- package/dist/services/market-data/market-data.codecs.d.ts +8 -0
- package/dist/services/market-data/market-data.codecs.d.ts.map +1 -0
- package/dist/services/market-data/market-data.codecs.js +7 -1
- package/dist/services/market-data/market-data.codecs.js.map +1 -1
- package/dist/services/market-data/market-data.d.ts +3 -2
- package/dist/services/market-data/market-data.d.ts.map +1 -1
- package/dist/services/market-data/market-data.js +3 -2
- package/dist/services/market-data/market-data.js.map +1 -1
- package/dist/services/market-data/market-data.schemas.d.ts +332 -4
- package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
- package/dist/services/market-data/market-data.schemas.js +56 -8
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.types.d.ts +3 -2
- package/dist/services/notifications/notifications.codecs.d.ts +1 -1
- package/dist/services/notifications/notifications.codecs.d.ts.map +1 -1
- package/dist/services/notifications/notifications.codecs.js +2 -1
- package/dist/services/notifications/notifications.codecs.js.map +1 -1
- package/dist/services/notifications/notifications.d.ts +4 -2
- package/dist/services/notifications/notifications.d.ts.map +1 -1
- package/dist/services/notifications/notifications.js +4 -2
- package/dist/services/notifications/notifications.js.map +1 -1
- package/dist/services/notifications/notifications.schemas.d.ts +50 -6
- package/dist/services/notifications/notifications.schemas.d.ts.map +1 -1
- package/dist/services/notifications/notifications.schemas.js +5 -0
- package/dist/services/notifications/notifications.schemas.js.map +1 -1
- package/dist/services/orderbook/orderbook.js +1 -1
- package/dist/services/orders/order-enums.codecs.d.ts +2 -0
- package/dist/services/orders/order-errors.schemas.d.ts +49 -4
- package/dist/services/orders/order-errors.schemas.d.ts.map +1 -1
- package/dist/services/orders/order-errors.schemas.js +13 -3
- package/dist/services/orders/order-errors.schemas.js.map +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +290 -50
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +55 -8
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +10 -10
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +47 -43
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +1 -1
- package/dist/services/policies/shared.codecs.js +12 -6
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/shared.js +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +9 -9
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +3 -3
- package/dist/services/price-alerts/price-alerts.d.ts +5 -2
- package/dist/services/price-alerts/price-alerts.d.ts.map +1 -1
- package/dist/services/price-alerts/price-alerts.js +5 -2
- package/dist/services/price-alerts/price-alerts.js.map +1 -1
- package/dist/services/price-alerts/price-alerts.schemas.js +1 -1
- package/dist/services/social-verification/social-verification.schemas.d.ts +9 -0
- package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +9 -2
- package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
- package/dist/services/statement-exports/statement-exports.codecs.d.ts +3 -2
- package/dist/services/statement-exports/statement-exports.codecs.d.ts.map +1 -1
- package/dist/services/statement-exports/statement-exports.codecs.js +2 -1
- package/dist/services/statement-exports/statement-exports.codecs.js.map +1 -1
- package/dist/services/statement-exports/statement-exports.d.ts +25 -10
- package/dist/services/statement-exports/statement-exports.d.ts.map +1 -1
- package/dist/services/statement-exports/statement-exports.js +33 -10
- package/dist/services/statement-exports/statement-exports.js.map +1 -1
- package/dist/services/statement-exports/statement-exports.schemas.d.ts +37 -9
- package/dist/services/statement-exports/statement-exports.schemas.d.ts.map +1 -1
- package/dist/services/statement-exports/statement-exports.schemas.js +24 -5
- package/dist/services/statement-exports/statement-exports.schemas.js.map +1 -1
- package/dist/services/statement-exports/statement-exports.types.d.ts +2 -2
- package/dist/services/subaccounts/subaccounts.codecs.js +112 -38
- package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.js +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +22 -15
- package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.js +10 -3
- package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
- package/dist/services/system/system.d.ts +12 -1
- package/dist/services/system/system.d.ts.map +1 -1
- package/dist/services/system/system.js +5 -0
- package/dist/services/system/system.js.map +1 -1
- package/dist/services/system/system.schemas.d.ts +13 -13
- package/dist/services/system/system.types.d.ts +2 -2
- package/dist/services/trades/trades.d.ts.map +1 -1
- package/dist/services/trades/trades.js +12 -4
- package/dist/services/trades/trades.js.map +1 -1
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.codecs.d.ts +8 -0
- package/dist/services/trading-withdraws/trading-withdraws.codecs.d.ts.map +1 -0
- package/dist/services/trading-withdraws/trading-withdraws.codecs.js +7 -1
- package/dist/services/trading-withdraws/trading-withdraws.codecs.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +2 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +2 -1
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +15 -0
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +16 -2
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +2 -1
- package/dist/services/transfers/transfers.schemas.d.ts +4 -4
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +153 -35
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.js +13 -3
- package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
- package/dist/services/triggers/triggers.codecs.d.ts +10 -0
- package/dist/services/triggers/triggers.codecs.d.ts.map +1 -0
- package/dist/services/triggers/triggers.codecs.js +7 -1
- package/dist/services/triggers/triggers.codecs.js.map +1 -1
- package/dist/services/triggers/triggers.d.ts +2 -2
- package/dist/services/triggers/triggers.d.ts.map +1 -1
- package/dist/services/triggers/triggers.js +16 -12
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/services/zipper/zipper.d.ts.map +1 -1
- package/dist/services/zipper/zipper.js +13 -7
- package/dist/services/zipper/zipper.js.map +1 -1
- package/dist/services/zipper/zipper.schemas.d.ts +7 -2
- package/dist/services/zipper/zipper.schemas.d.ts.map +1 -1
- package/dist/services/zipper/zipper.schemas.js +29 -9
- package/dist/services/zipper/zipper.schemas.js.map +1 -1
- package/dist/services/zipper/zipper.types.d.ts +2 -2
- package/dist/shared/catalog-config.d.ts +16 -2
- package/dist/shared/catalog-config.d.ts.map +1 -1
- package/dist/shared/catalog-config.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +7 -2
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/decimal-surface.d.ts +6 -0
- package/dist/shared/decimal-surface.d.ts.map +1 -1
- package/dist/shared/decimal-surface.js +65 -1
- package/dist/shared/decimal-surface.js.map +1 -1
- package/dist/shared/error-detail.d.ts +10 -0
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/auth.js +6 -0
- package/dist/shared/error-details/auth.js.map +1 -1
- package/dist/shared/ledger-codes.d.ts +3 -1
- package/dist/shared/ledger-codes.d.ts.map +1 -1
- package/dist/shared/ledger-codes.js +6 -3
- package/dist/shared/ledger-codes.js.map +1 -1
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +3 -1
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -33,7 +33,8 @@ function transformVerification(v) {
|
|
|
33
33
|
lastError: v.lastError,
|
|
34
34
|
errorCode: enumLabel(SocialVerificationErrorCodeCodec.protoToOutput, v.errorCode),
|
|
35
35
|
updatedAt: v.updatedAt,
|
|
36
|
-
retryAfter: v.retryAfter
|
|
36
|
+
retryAfter: v.retryAfter,
|
|
37
|
+
changeAvailableAt: v.changeAvailableAt
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
40
|
v.object({
|
|
@@ -62,7 +63,13 @@ v.object({
|
|
|
62
63
|
* When a new verification may succeed, after this one failed with
|
|
63
64
|
* `social_account_cooldown` or `social_change_limit_reached`; absent otherwise.
|
|
64
65
|
*/
|
|
65
|
-
retryAfter: v.optional(TimestampSchema)
|
|
66
|
+
retryAfter: v.optional(TimestampSchema),
|
|
67
|
+
/**
|
|
68
|
+
* X and Discord only: when the linked account may be changed or unlinked again, while the
|
|
69
|
+
* once-per-30-days limit applies; absent when a change or unlink is allowed now. A first
|
|
70
|
+
* link and re-verifying the linked X handle are not changes.
|
|
71
|
+
*/
|
|
72
|
+
changeAvailableAt: v.optional(TimestampSchema)
|
|
66
73
|
});
|
|
67
74
|
const StartVerificationInputSchema = v.pipe(v.variant("provider", [
|
|
68
75
|
v.strictObject({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-verification.schemas.js","names":[],"sources":["../../../src/services/social-verification/social-verification.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { TimestampSchema } from \"../../shared/schemas.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_ERROR_CODE_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n SocialProviderCodec,\n SocialVerificationErrorCodeCodec,\n SocialVerificationMethodCodec,\n SocialVerificationStatusCodec,\n} from \"./social-verification.codecs.js\";\n\nexport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_ERROR_CODE_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n} from \"./social-verification.codecs.js\";\n\nexport const SocialProviderSchema = v.picklist(SOCIAL_PROVIDER_VALUES);\nexport type SocialProvider = v.InferInput<typeof SocialProviderSchema>;\n\nexport const SocialVerificationMethodSchema = v.picklist(SOCIAL_VERIFICATION_METHOD_VALUES);\nexport type SocialVerificationMethod = v.InferInput<typeof SocialVerificationMethodSchema>;\n\nexport const SocialVerificationErrorCodeSchema = v.picklist(SOCIAL_VERIFICATION_ERROR_CODE_VALUES);\nexport type SocialVerificationErrorCode = v.InferOutput<typeof SocialVerificationErrorCodeSchema>;\n\nexport const SocialVerificationStatusSchema = v.picklist(SOCIAL_VERIFICATION_STATUS_VALUES);\nexport type SocialVerificationStatus = v.InferOutput<typeof SocialVerificationStatusSchema>;\n\nfunction normalizeHandle(input: string): string {\n return (input ?? \"\").trim().replace(/^@+/, \"\");\n}\n\nconst TWITTER_HANDLE_PATTERN = /^[A-Za-z0-9_]{1,15}$/;\n\n/**\n * Normalizes a social verification response into the SDK verification shape.\n */\nexport function transformVerification(\n v: Proto.SocialVerification | undefined,\n): SocialVerification | undefined {\n if (!v) return undefined;\n return {\n id: v.id,\n provider: enumLabel(SocialProviderCodec.protoToOutput, v.provider),\n method: enumLabel(SocialVerificationMethodCodec.protoToOutput, v.method),\n handle: v.handle,\n providerUserId: v.providerUserId,\n displayName: v.displayName,\n challengeCode: v.challengeCode,\n status: enumLabel(SocialVerificationStatusCodec.protoToOutput, v.status),\n requestedAt: v.requestedAt,\n expiresAt: v.expiresAt,\n verifiedAt: v.verifiedAt,\n attempts: v.attempts,\n lastError: v.lastError,\n errorCode: enumLabel(SocialVerificationErrorCodeCodec.protoToOutput, v.errorCode),\n updatedAt: v.updatedAt,\n retryAfter: v.retryAfter,\n };\n}\n\nexport const SocialVerificationSchema = v.object({\n id: v.bigint(),\n provider: SocialProviderSchema,\n method: SocialVerificationMethodSchema,\n handle: v.string(),\n /**\n * Provider-side user ID of the linked account, empty while none is linked. A restarted\n * X or Discord verification keeps the current link, and this value, until it succeeds.\n * For Telegram in `awaiting_confirmation`, the\n * decimal user ID of the account that sent the code: pass it to `confirm` as is.\n */\n providerUserId: v.string(),\n /** Telegram only: the account's name once the code is submitted; empty otherwise. */\n displayName: v.string(),\n challengeCode: v.string(),\n status: SocialVerificationStatusSchema,\n requestedAt: v.optional(TimestampSchema),\n expiresAt: v.optional(TimestampSchema),\n verifiedAt: v.optional(TimestampSchema),\n attempts: v.number(),\n lastError: v.string(),\n updatedAt: v.optional(TimestampSchema),\n /**\n * When a new verification may succeed, after this one failed with\n * `social_account_cooldown` or `social_change_limit_reached`; absent otherwise.\n */\n retryAfter: v.optional(TimestampSchema),\n});\n\ntype SocialVerificationBase = v.InferOutput<typeof SocialVerificationSchema>;\nexport type SocialVerification = Omit<SocialVerificationBase, \"provider\" | \"method\" | \"status\"> & {\n provider: DecodedEnum<SocialProvider>;\n method: DecodedEnum<SocialVerificationMethod>;\n status: DecodedEnum<SocialVerificationStatus>;\n /**\n * Machine-readable failure for the current state; branch on this, not `lastError`.\n * `\"unspecified\"` when no typed failure applies or the code is newer than this SDK.\n * `\"social_account_already_linked\"` is non-retryable for this account: send the\n * user to the account already linked to that identity instead of restarting.\n */\n errorCode: DecodedEnum<SocialVerificationErrorCode>;\n};\n\nexport const StartVerificationInputSchema = v.pipe(\n v.variant(\"provider\", [\n v.strictObject({\n provider: v.literal(\"twitter\"),\n handle: v.pipe(\n v.string(),\n v.transform(normalizeHandle),\n v.minLength(1),\n v.regex(\n TWITTER_HANDLE_PATTERN,\n \"Twitter handle must be 1-15 letters, digits, or underscores\",\n ),\n ),\n method: v.optional(v.literal(\"profile\")),\n }),\n v.strictObject({\n provider: v.literal(\"discord\"),\n method: v.optional(v.picklist([\"channel\", \"dm\"])),\n }),\n v.strictObject({\n provider: v.literal(\"telegram\"),\n method: v.optional(v.literal(\"dm\")),\n }),\n ]),\n v.transform(({ provider, method, ...input }) => ({\n ...input,\n provider: SocialProviderCodec.inputToProto[provider],\n // METHOD_UNSPECIFIED lets the API choose Twitter's profile or Discord's channel default.\n method:\n method === undefined\n ? Proto.SocialVerificationMethod.METHOD_UNSPECIFIED\n : SocialVerificationMethodCodec.inputToProto[method],\n })),\n);\n\nexport type StartVerificationInput = v.InferInput<typeof StartVerificationInputSchema>;\n\nexport const ProviderInputSchema = v.pipe(\n SocialProviderSchema,\n v.transform((v) => SocialProviderCodec.inputToProto[v]),\n);\n\nexport const SocialProviderInputSchema = v.strictObject({\n provider: ProviderInputSchema,\n});\n\nexport type SocialProviderInput = v.InferInput<typeof SocialProviderInputSchema>;\n\nexport const StartVerificationResponseSchema = v.pipe(\n v.object({\n challengeCode: v.string(),\n expiresAt: v.optional(TimestampSchema),\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n /** Telegram: the `https://t.me/...` link that sends the code to the bot; empty otherwise. */\n actionUrl: v.optional(v.string(), \"\"),\n }),\n v.transform((res) => ({\n challengeCode: res.challengeCode,\n expiresAt: res.expiresAt,\n actionUrl: res.actionUrl,\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type StartVerificationResponse = v.InferOutput<typeof StartVerificationResponseSchema>;\n\nexport const VerificationReadyResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type VerificationReadyResponse = v.InferOutput<typeof VerificationReadyResponseSchema>;\n\nexport const GetVerificationResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type GetVerificationResponse = v.InferOutput<typeof GetVerificationResponseSchema>;\n\n/** Only Telegram links through confirmation. */\nconst TelegramProviderInputSchema = v.pipe(\n v.literal(\"telegram\"),\n v.transform(() => Proto.SocialProvider.TELEGRAM),\n);\n\nexport const ConfirmVerificationInputSchema = v.strictObject({\n provider: TelegramProviderInputSchema,\n /** The verification's `providerUserId` in `awaiting_confirmation`: a decimal 64-bit ID. */\n providerUserId: v.pipe(\n v.string(),\n v.regex(/^[1-9]\\d{0,19}$/u, \"providerUserId must be a decimal Telegram user ID\"),\n ),\n});\n\nexport type ConfirmVerificationInput = v.InferInput<typeof ConfirmVerificationInputSchema>;\n\nexport const UnlinkSocialAccountInputSchema = v.strictObject({\n provider: ProviderInputSchema,\n});\n\nexport type UnlinkSocialAccountInput = v.InferInput<typeof UnlinkSocialAccountInputSchema>;\n"],"mappings":";;;;;;AAuBA,MAAa,uBAAuB,EAAE,SAAS,sBAAsB;AAGrE,MAAa,iCAAiC,EAAE,SAAS,iCAAiC;AAGzC,EAAE,SAAS,qCAAqC;AAGjG,MAAa,iCAAiC,EAAE,SAAS,iCAAiC;AAG1F,SAAS,gBAAgB,OAAuB;CAC5C,QAAQ,SAAS,GAAA,CAAI,KAAK,CAAC,CAAC,QAAQ,OAAO,EAAE;AACjD;AAEA,MAAM,yBAAyB;;;;AAK/B,SAAgB,sBACZ,GAC8B;CAC9B,IAAI,CAAC,GAAG,OAAO,KAAA;CACf,OAAO;EACH,IAAI,EAAE;EACN,UAAU,UAAU,oBAAoB,eAAe,EAAE,QAAQ;EACjE,QAAQ,UAAU,8BAA8B,eAAe,EAAE,MAAM;EACvE,QAAQ,EAAE;EACV,gBAAgB,EAAE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|
|
1
|
+
{"version":3,"file":"social-verification.schemas.js","names":[],"sources":["../../../src/services/social-verification/social-verification.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { TimestampSchema } from \"../../shared/schemas.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_ERROR_CODE_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n SocialProviderCodec,\n SocialVerificationErrorCodeCodec,\n SocialVerificationMethodCodec,\n SocialVerificationStatusCodec,\n} from \"./social-verification.codecs.js\";\n\nexport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_ERROR_CODE_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n} from \"./social-verification.codecs.js\";\n\nexport const SocialProviderSchema = v.picklist(SOCIAL_PROVIDER_VALUES);\nexport type SocialProvider = v.InferInput<typeof SocialProviderSchema>;\n\nexport const SocialVerificationMethodSchema = v.picklist(SOCIAL_VERIFICATION_METHOD_VALUES);\nexport type SocialVerificationMethod = v.InferInput<typeof SocialVerificationMethodSchema>;\n\nexport const SocialVerificationErrorCodeSchema = v.picklist(SOCIAL_VERIFICATION_ERROR_CODE_VALUES);\nexport type SocialVerificationErrorCode = v.InferOutput<typeof SocialVerificationErrorCodeSchema>;\n\nexport const SocialVerificationStatusSchema = v.picklist(SOCIAL_VERIFICATION_STATUS_VALUES);\nexport type SocialVerificationStatus = v.InferOutput<typeof SocialVerificationStatusSchema>;\n\nfunction normalizeHandle(input: string): string {\n return (input ?? \"\").trim().replace(/^@+/, \"\");\n}\n\nconst TWITTER_HANDLE_PATTERN = /^[A-Za-z0-9_]{1,15}$/;\n\n/**\n * Normalizes a social verification response into the SDK verification shape.\n */\nexport function transformVerification(\n v: Proto.SocialVerification | undefined,\n): SocialVerification | undefined {\n if (!v) return undefined;\n return {\n id: v.id,\n provider: enumLabel(SocialProviderCodec.protoToOutput, v.provider),\n method: enumLabel(SocialVerificationMethodCodec.protoToOutput, v.method),\n handle: v.handle,\n providerUserId: v.providerUserId,\n displayName: v.displayName,\n challengeCode: v.challengeCode,\n status: enumLabel(SocialVerificationStatusCodec.protoToOutput, v.status),\n requestedAt: v.requestedAt,\n expiresAt: v.expiresAt,\n verifiedAt: v.verifiedAt,\n attempts: v.attempts,\n lastError: v.lastError,\n errorCode: enumLabel(SocialVerificationErrorCodeCodec.protoToOutput, v.errorCode),\n updatedAt: v.updatedAt,\n retryAfter: v.retryAfter,\n changeAvailableAt: v.changeAvailableAt,\n };\n}\n\nexport const SocialVerificationSchema = v.object({\n id: v.bigint(),\n provider: SocialProviderSchema,\n method: SocialVerificationMethodSchema,\n handle: v.string(),\n /**\n * Provider-side user ID of the linked account, empty while none is linked. A restarted\n * X or Discord verification keeps the current link, and this value, until it succeeds.\n * For Telegram in `awaiting_confirmation`, the\n * decimal user ID of the account that sent the code: pass it to `confirm` as is.\n */\n providerUserId: v.string(),\n /** Telegram only: the account's name once the code is submitted; empty otherwise. */\n displayName: v.string(),\n challengeCode: v.string(),\n status: SocialVerificationStatusSchema,\n requestedAt: v.optional(TimestampSchema),\n expiresAt: v.optional(TimestampSchema),\n verifiedAt: v.optional(TimestampSchema),\n attempts: v.number(),\n lastError: v.string(),\n updatedAt: v.optional(TimestampSchema),\n /**\n * When a new verification may succeed, after this one failed with\n * `social_account_cooldown` or `social_change_limit_reached`; absent otherwise.\n */\n retryAfter: v.optional(TimestampSchema),\n /**\n * X and Discord only: when the linked account may be changed or unlinked again, while the\n * once-per-30-days limit applies; absent when a change or unlink is allowed now. A first\n * link and re-verifying the linked X handle are not changes.\n */\n changeAvailableAt: v.optional(TimestampSchema),\n});\n\ntype SocialVerificationBase = v.InferOutput<typeof SocialVerificationSchema>;\nexport type SocialVerification = Omit<SocialVerificationBase, \"provider\" | \"method\" | \"status\"> & {\n provider: DecodedEnum<SocialProvider>;\n method: DecodedEnum<SocialVerificationMethod>;\n status: DecodedEnum<SocialVerificationStatus>;\n /**\n * Machine-readable failure for the current state; branch on this, not `lastError`.\n * `\"unspecified\"` when no typed failure applies or the code is newer than this SDK.\n * `\"social_account_already_linked\"` is non-retryable for this account: send the\n * user to the account already linked to that identity instead of restarting.\n */\n errorCode: DecodedEnum<SocialVerificationErrorCode>;\n};\n\nexport const StartVerificationInputSchema = v.pipe(\n v.variant(\"provider\", [\n v.strictObject({\n provider: v.literal(\"twitter\"),\n handle: v.pipe(\n v.string(),\n v.transform(normalizeHandle),\n v.minLength(1),\n v.regex(\n TWITTER_HANDLE_PATTERN,\n \"Twitter handle must be 1-15 letters, digits, or underscores\",\n ),\n ),\n method: v.optional(v.literal(\"profile\")),\n }),\n v.strictObject({\n provider: v.literal(\"discord\"),\n method: v.optional(v.picklist([\"channel\", \"dm\"])),\n }),\n v.strictObject({\n provider: v.literal(\"telegram\"),\n method: v.optional(v.literal(\"dm\")),\n }),\n ]),\n v.transform(({ provider, method, ...input }) => ({\n ...input,\n provider: SocialProviderCodec.inputToProto[provider],\n // METHOD_UNSPECIFIED lets the API choose Twitter's profile or Discord's channel default.\n method:\n method === undefined\n ? Proto.SocialVerificationMethod.METHOD_UNSPECIFIED\n : SocialVerificationMethodCodec.inputToProto[method],\n })),\n);\n\nexport type StartVerificationInput = v.InferInput<typeof StartVerificationInputSchema>;\n\nexport const ProviderInputSchema = v.pipe(\n SocialProviderSchema,\n v.transform((v) => SocialProviderCodec.inputToProto[v]),\n);\n\nexport const SocialProviderInputSchema = v.strictObject({\n provider: ProviderInputSchema,\n});\n\nexport type SocialProviderInput = v.InferInput<typeof SocialProviderInputSchema>;\n\nexport const StartVerificationResponseSchema = v.pipe(\n v.object({\n challengeCode: v.string(),\n expiresAt: v.optional(TimestampSchema),\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n /** Telegram: the `https://t.me/...` link that sends the code to the bot; empty otherwise. */\n actionUrl: v.optional(v.string(), \"\"),\n }),\n v.transform((res) => ({\n challengeCode: res.challengeCode,\n expiresAt: res.expiresAt,\n actionUrl: res.actionUrl,\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type StartVerificationResponse = v.InferOutput<typeof StartVerificationResponseSchema>;\n\nexport const VerificationReadyResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type VerificationReadyResponse = v.InferOutput<typeof VerificationReadyResponseSchema>;\n\nexport const GetVerificationResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type GetVerificationResponse = v.InferOutput<typeof GetVerificationResponseSchema>;\n\n/** Only Telegram links through confirmation. */\nconst TelegramProviderInputSchema = v.pipe(\n v.literal(\"telegram\"),\n v.transform(() => Proto.SocialProvider.TELEGRAM),\n);\n\nexport const ConfirmVerificationInputSchema = v.strictObject({\n provider: TelegramProviderInputSchema,\n /** The verification's `providerUserId` in `awaiting_confirmation`: a decimal 64-bit ID. */\n providerUserId: v.pipe(\n v.string(),\n v.regex(/^[1-9]\\d{0,19}$/u, \"providerUserId must be a decimal Telegram user ID\"),\n ),\n});\n\nexport type ConfirmVerificationInput = v.InferInput<typeof ConfirmVerificationInputSchema>;\n\nexport const UnlinkSocialAccountInputSchema = v.strictObject({\n provider: ProviderInputSchema,\n});\n\nexport type UnlinkSocialAccountInput = v.InferInput<typeof UnlinkSocialAccountInputSchema>;\n"],"mappings":";;;;;;AAuBA,MAAa,uBAAuB,EAAE,SAAS,sBAAsB;AAGrE,MAAa,iCAAiC,EAAE,SAAS,iCAAiC;AAGzC,EAAE,SAAS,qCAAqC;AAGjG,MAAa,iCAAiC,EAAE,S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AE,OAAO,EACL,cAAc,EAAE,SAAS,EAAE,aAAuC,IAAI,CAAC,EAC3E,CAAC,GACD,EAAE,WAAW,SAAS,EAClB,cAAc,sBAAsB,IAAI,YAAY,EACxD,EAAE,CACN;;AAKA,MAAM,8BAA8B,EAAE,KAClC,EAAE,QAAQ,UAAU,GACpB,EAAE,gBAAA,CAA6C,CACnD;AAEA,MAAa,iCAAiC,EAAE,aAAa;CACzD,UAAU;;CAEV,gBAAgB,EAAE,KACd,EAAE,OAAO,GACT,EAAE,MAAM,oBAAoB,mDAAmD,CACnF;AACJ,CAAC;AAID,MAAa,iCAAiC,EAAE,aAAa,EACzD,UAAU,oBACd,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
//#region src/services/statement-exports/statement-exports.codecs.d.ts
|
|
2
|
-
declare const STATEMENT_EXPORT_STATUS_VALUES: readonly ["queued", "processing", "ready", "failed", "expired"];
|
|
2
|
+
declare const STATEMENT_EXPORT_STATUS_VALUES: readonly ["queued", "processing", "ready", "failed", "expired", "canceled"];
|
|
3
3
|
/**
|
|
4
4
|
* `queued` waits for the account history to cover the period and for the account's other
|
|
5
5
|
* export to finish, `processing` is writing the file, `ready` can be downloaded until
|
|
6
|
-
* `expiresAt`, `failed` has no file (see `failureReason`),
|
|
6
|
+
* `expiresAt`, `failed` has no file (see `failureReason`), `expired` had its file deleted, and
|
|
7
|
+
* `canceled` was stopped with `statementExports.cancel` before it finished and has no file.
|
|
7
8
|
*/
|
|
8
9
|
type StatementExportStatus = (typeof STATEMENT_EXPORT_STATUS_VALUES)[number];
|
|
9
10
|
declare const STATEMENT_EXPORT_FAILURE_REASON_VALUES: readonly ["too_large", "unavailable"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statement-exports.codecs.d.ts","names":[],"sources":["../../../src/services/statement-exports/statement-exports.codecs.ts"],"mappings":";cAGa
|
|
1
|
+
{"version":3,"file":"statement-exports.codecs.d.ts","names":[],"sources":["../../../src/services/statement-exports/statement-exports.codecs.ts"],"mappings":";cAGa;;;;;;;KAcD,gCAAgC;cAE/B;;;;;KAKD,uCAAuC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statement-exports.codecs.js","names":[],"sources":["../../../src/services/statement-exports/statement-exports.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/ledger/read/v1/statement_export_pb.js\";\nimport type { ProtoToOutput } from \"../../utils/types.js\";\n\nexport const STATEMENT_EXPORT_STATUS_VALUES = [\n \"queued\",\n \"processing\",\n \"ready\",\n \"failed\",\n \"expired\",\n] as const;\n/**\n * `queued` waits for the account history to cover the period and for the account's other\n * export to finish, `processing` is writing the file, `ready` can be downloaded until\n * `expiresAt`, `failed` has no file (see `failureReason`),
|
|
1
|
+
{"version":3,"file":"statement-exports.codecs.js","names":[],"sources":["../../../src/services/statement-exports/statement-exports.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/ledger/read/v1/statement_export_pb.js\";\nimport type { ProtoToOutput } from \"../../utils/types.js\";\n\nexport const STATEMENT_EXPORT_STATUS_VALUES = [\n \"queued\",\n \"processing\",\n \"ready\",\n \"failed\",\n \"expired\",\n \"canceled\",\n] as const;\n/**\n * `queued` waits for the account history to cover the period and for the account's other\n * export to finish, `processing` is writing the file, `ready` can be downloaded until\n * `expiresAt`, `failed` has no file (see `failureReason`), `expired` had its file deleted, and\n * `canceled` was stopped with `statementExports.cancel` before it finished and has no file.\n */\nexport type StatementExportStatus = (typeof STATEMENT_EXPORT_STATUS_VALUES)[number];\n\nexport const STATEMENT_EXPORT_FAILURE_REASON_VALUES = [\"too_large\", \"unavailable\"] as const;\n/**\n * `too_large`: the period holds more than 4,000,000 ledger movements; split it into shorter\n * exports. `unavailable`: the file could not be produced in time; create a new export.\n */\nexport type StatementExportFailureReason = (typeof STATEMENT_EXPORT_FAILURE_REASON_VALUES)[number];\n\nexport const StatementExportStatusCodec = {\n protoToOutput: {\n [Proto.StatementExportStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.StatementExportStatus.QUEUED]: \"queued\",\n [Proto.StatementExportStatus.PROCESSING]: \"processing\",\n [Proto.StatementExportStatus.READY]: \"ready\",\n [Proto.StatementExportStatus.FAILED]: \"failed\",\n [Proto.StatementExportStatus.EXPIRED]: \"expired\",\n [Proto.StatementExportStatus.CANCELED]: \"canceled\",\n } satisfies ProtoToOutput<Proto.StatementExportStatus, StatementExportStatus>,\n} as const;\n\nexport const StatementExportFailureReasonCodec = {\n protoToOutput: {\n [Proto.StatementExportFailureReason.UNSPECIFIED]: \"unspecified\",\n [Proto.StatementExportFailureReason.TOO_LARGE]: \"too_large\",\n [Proto.StatementExportFailureReason.UNAVAILABLE]: \"unavailable\",\n } satisfies ProtoToOutput<Proto.StatementExportFailureReason, StatementExportFailureReason>,\n} as const;\n"],"mappings":";;AA0BA,MAAa,6BAA6B,EACtC,eAAe;EACgC,IAAA;EACL,IAAA;EACI,IAAA;EACL,IAAA;EACC,IAAA;EACC,IAAA;EACC,IAAA;AAC5C,EACJ;AAEA,MAAa,oCAAoC,EAC7C,eAAe;EACuC,IAAA;EACF,IAAA;EACE,IAAA;AACtD,EACJ"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { AuthApiTransports } from "../../shared/transports.js";
|
|
2
2
|
import { PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
3
3
|
import { SubaccountResolver } from "../subaccount-resolver.js";
|
|
4
|
-
import { CreateStatementExportInput, GetStatementExportInput, ListStatementExportsInput, ListStatementExportsResult, StatementExport } from "./statement-exports.schemas.js";
|
|
4
|
+
import { CancelStatementExportInput, CreateStatementExportInput, GetStatementExportDownloadUrlInput, GetStatementExportInput, ListStatementExportsInput, ListStatementExportsResult, StatementExport, StatementExportDownloadUrl } from "./statement-exports.schemas.js";
|
|
5
5
|
//#region src/services/statement-exports/statement-exports.d.ts
|
|
6
6
|
/**
|
|
7
|
-
* Produces whole-period account statements in the background, one CSV file each:
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Produces whole-period account statements in the background, one RFC 4180 CSV file each: one
|
|
8
|
+
* account, optionally one asset, for a period of at most 366 days. API keys need
|
|
9
|
+
* `read-statements`. A root account has at most 5 exports queued or processing, each account
|
|
10
|
+
* produces one at a time, and a ready file can be downloaded for 7 days.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* returns `text/csv` and
|
|
14
|
-
*
|
|
12
|
+
* Download a ready file in a browser from `getDownloadUrl`. Servers and CLIs can instead send
|
|
13
|
+
* an authenticated `GET /v1/statements/exports/{exportId}/file`, which returns `text/csv` and
|
|
14
|
+
* supports `Range`; an expired export's file answers 410.
|
|
15
15
|
*/
|
|
16
16
|
declare class StatementExportsService {
|
|
17
17
|
#private;
|
|
@@ -24,9 +24,24 @@ declare class StatementExportsService {
|
|
|
24
24
|
* with the same request.
|
|
25
25
|
*/
|
|
26
26
|
create(input: CreateStatementExportInput, options?: PolyesterRequestOptions): Promise<StatementExport>;
|
|
27
|
-
/** Returns one export; poll it until `status` is `ready`, `failed` or `
|
|
27
|
+
/** Returns one export; poll it until `status` is `ready`, `failed`, `expired` or `canceled`. */
|
|
28
28
|
get(input: GetStatementExportInput, options?: PolyesterRequestOptions): Promise<StatementExport>;
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Returns a link valid for 60 seconds that downloads a ready export's file without
|
|
31
|
+
* credentials, for a browser to save; each call returns a new link. Never log `url`. Throws
|
|
32
|
+
* `PreconditionFailedError` before the file is ready (`STATEMENT_EXPORT_NOT_READY`) and for
|
|
33
|
+
* a `failed`, `canceled` or `expired` export, or one with less than 5 seconds left
|
|
34
|
+
* (`STATEMENT_EXPORT_FAILED`, `STATEMENT_EXPORT_CANCELED`, `STATEMENT_EXPORT_EXPIRED`).
|
|
35
|
+
*/
|
|
36
|
+
getDownloadUrl(input: GetStatementExportDownloadUrlInput, options?: PolyesterRequestOptions): Promise<StatementExportDownloadUrl>;
|
|
37
|
+
/**
|
|
38
|
+
* Cancels a queued or processing export and returns it `canceled`: it frees its place under
|
|
39
|
+
* the root account's 5, the account's next queued export can start, and any partial file is
|
|
40
|
+
* deleted. Canceling a `canceled` export returns it as it is; a finished one throws
|
|
41
|
+
* `PreconditionFailedError` (`STATEMENT_EXPORT_NOT_CANCELABLE`).
|
|
42
|
+
*/
|
|
43
|
+
cancel(input: CancelStatementExportInput, options?: PolyesterRequestOptions): Promise<StatementExport>;
|
|
44
|
+
/** Lists the resolved account's exports, newest first, with the root's in-progress count. */
|
|
30
45
|
list(input?: ListStatementExportsInput, options?: PolyesterRequestOptions): Promise<ListStatementExportsResult>;
|
|
31
46
|
}
|
|
32
47
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statement-exports.d.ts","names":[],"sources":["../../../src/services/statement-exports/statement-exports.ts"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"statement-exports.d.ts","names":[],"sources":["../../../src/services/statement-exports/statement-exports.ts"],"mappings":";;;;;;;;;;;;;;;cAoCa;;EAIG,YAAA,YAAY,mBAAmB,WAAW;;;;;;;;EAYhD,OACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;EAaL,IACF,OAAO,yBACP,UAAU,0BACX,QAAQ;;;;;;;;EAgBL,eACF,OAAO,oCACP,UAAU,0BACX,QAAQ;;;;;;;EAeL,OACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;EAUL,KACF,QAAO,2BACP,UAAU,0BACX,QAAQ"}
|
|
@@ -2,18 +2,18 @@ import { parse } from "../../shared/validation.js";
|
|
|
2
2
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
3
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
4
4
|
import { StatementExportService } from "../../gen/ledger/read/v1/statement_export_pb.js";
|
|
5
|
-
import { CreateStatementExportInputSchema, GetStatementExportInputSchema, ListStatementExportsInputSchema, ListStatementExportsResultSchema, StatementExportSchema } from "./statement-exports.schemas.js";
|
|
5
|
+
import { CreateStatementExportInputSchema, GetStatementExportInputSchema, ListStatementExportsInputSchema, ListStatementExportsResultSchema, StatementExportDownloadUrlSchema, StatementExportSchema } from "./statement-exports.schemas.js";
|
|
6
6
|
import { createClient } from "@connectrpc/connect";
|
|
7
7
|
//#region src/services/statement-exports/statement-exports.ts
|
|
8
8
|
/**
|
|
9
|
-
* Produces whole-period account statements in the background, one CSV file each:
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Produces whole-period account statements in the background, one RFC 4180 CSV file each: one
|
|
10
|
+
* account, optionally one asset, for a period of at most 366 days. API keys need
|
|
11
|
+
* `read-statements`. A root account has at most 5 exports queued or processing, each account
|
|
12
|
+
* produces one at a time, and a ready file can be downloaded for 7 days.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
* returns `text/csv` and
|
|
16
|
-
*
|
|
14
|
+
* Download a ready file in a browser from `getDownloadUrl`. Servers and CLIs can instead send
|
|
15
|
+
* an authenticated `GET /v1/statements/exports/{exportId}/file`, which returns `text/csv` and
|
|
16
|
+
* supports `Range`; an expired export's file answers 410.
|
|
17
17
|
*/
|
|
18
18
|
var StatementExportsService = class {
|
|
19
19
|
#client;
|
|
@@ -34,13 +34,36 @@ var StatementExportsService = class {
|
|
|
34
34
|
const response = await this.#client.createStatementExport(request, toConnectCallOptions(options));
|
|
35
35
|
return parse(StatementExportSchema, response.export);
|
|
36
36
|
}
|
|
37
|
-
/** Returns one export; poll it until `status` is `ready`, `failed` or `
|
|
37
|
+
/** Returns one export; poll it until `status` is `ready`, `failed`, `expired` or `canceled`. */
|
|
38
38
|
async get(input, options) {
|
|
39
39
|
const request = parse(GetStatementExportInputSchema, input);
|
|
40
40
|
const response = await this.#client.getStatementExport(request, toConnectCallOptions(options));
|
|
41
41
|
return parse(StatementExportSchema, response.export);
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Returns a link valid for 60 seconds that downloads a ready export's file without
|
|
45
|
+
* credentials, for a browser to save; each call returns a new link. Never log `url`. Throws
|
|
46
|
+
* `PreconditionFailedError` before the file is ready (`STATEMENT_EXPORT_NOT_READY`) and for
|
|
47
|
+
* a `failed`, `canceled` or `expired` export, or one with less than 5 seconds left
|
|
48
|
+
* (`STATEMENT_EXPORT_FAILED`, `STATEMENT_EXPORT_CANCELED`, `STATEMENT_EXPORT_EXPIRED`).
|
|
49
|
+
*/
|
|
50
|
+
async getDownloadUrl(input, options) {
|
|
51
|
+
const request = parse(GetStatementExportInputSchema, input);
|
|
52
|
+
const response = await this.#client.getStatementExportDownloadUrl(request, toConnectCallOptions(options));
|
|
53
|
+
return parse(StatementExportDownloadUrlSchema, response);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Cancels a queued or processing export and returns it `canceled`: it frees its place under
|
|
57
|
+
* the root account's 5, the account's next queued export can start, and any partial file is
|
|
58
|
+
* deleted. Canceling a `canceled` export returns it as it is; a finished one throws
|
|
59
|
+
* `PreconditionFailedError` (`STATEMENT_EXPORT_NOT_CANCELABLE`).
|
|
60
|
+
*/
|
|
61
|
+
async cancel(input, options) {
|
|
62
|
+
const request = parse(GetStatementExportInputSchema, input);
|
|
63
|
+
const response = await this.#client.cancelStatementExport(request, toConnectCallOptions(options));
|
|
64
|
+
return parse(StatementExportSchema, response.export);
|
|
65
|
+
}
|
|
66
|
+
/** Lists the resolved account's exports, newest first, with the root's in-progress count. */
|
|
44
67
|
async list(input = {}, options) {
|
|
45
68
|
const request = parse(ListStatementExportsInputSchema, resolveAccountScopedInput(input, this.#resolver));
|
|
46
69
|
const response = await this.#client.listStatementExports(request, toConnectCallOptions(options));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statement-exports.js","names":["#client","Proto.StatementExportService","#resolver"],"sources":["../../../src/services/statement-exports/statement-exports.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/ledger/read/v1/statement_export_pb.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport {\n CreateStatementExportInputSchema,\n GetStatementExportInputSchema,\n ListStatementExportsInputSchema,\n ListStatementExportsResultSchema,\n StatementExportSchema,\n type CreateStatementExportInput,\n type GetStatementExportInput,\n type ListStatementExportsInput,\n type ListStatementExportsResult,\n type StatementExport,\n} from \"./statement-exports.schemas.js\";\n\n/**\n * Produces whole-period account statements in the background, one CSV file each:
|
|
1
|
+
{"version":3,"file":"statement-exports.js","names":["#client","Proto.StatementExportService","#resolver"],"sources":["../../../src/services/statement-exports/statement-exports.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/ledger/read/v1/statement_export_pb.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport {\n CreateStatementExportInputSchema,\n GetStatementExportInputSchema,\n ListStatementExportsInputSchema,\n ListStatementExportsResultSchema,\n StatementExportDownloadUrlSchema,\n StatementExportSchema,\n type CancelStatementExportInput,\n type CreateStatementExportInput,\n type GetStatementExportDownloadUrlInput,\n type GetStatementExportInput,\n type ListStatementExportsInput,\n type ListStatementExportsResult,\n type StatementExport,\n type StatementExportDownloadUrl,\n} from \"./statement-exports.schemas.js\";\n\n/**\n * Produces whole-period account statements in the background, one RFC 4180 CSV file each: one\n * account, optionally one asset, for a period of at most 366 days. API keys need\n * `read-statements`. A root account has at most 5 exports queued or processing, each account\n * produces one at a time, and a ready file can be downloaded for 7 days.\n *\n * Download a ready file in a browser from `getDownloadUrl`. Servers and CLIs can instead send\n * an authenticated `GET /v1/statements/exports/{exportId}/file`, which returns `text/csv` and\n * supports `Range`; an expired export's file answers 410.\n */\nexport class StatementExportsService {\n #client: Client<typeof Proto.StatementExportService>;\n #resolver?: SubaccountResolver;\n\n constructor(transports: AuthApiTransports, resolver?: SubaccountResolver) {\n this.#client = createClient(Proto.StatementExportService, transports.authApi);\n this.#resolver = resolver;\n }\n\n /**\n * Creates an export of the resolved account's statement, or returns the existing one for the\n * same `idempotencyKey`. Throws `PreconditionFailedError` when the key was used with other\n * fields (`IDEMPOTENCY_KEY_REUSED`) or the root account already has 5 exports queued or\n * processing (`STATEMENT_EXPORT_LIMIT_REACHED`). A `ServiceUnavailableError` can be retried\n * with the same request.\n */\n async create(\n input: CreateStatementExportInput,\n options?: PolyesterRequestOptions,\n ): Promise<StatementExport> {\n const request = parse(\n CreateStatementExportInputSchema,\n resolveAccountScopedInput(input, this.#resolver),\n );\n const response = await this.#client.createStatementExport(\n request,\n toConnectCallOptions(options),\n );\n return parse(StatementExportSchema, response.export);\n }\n\n /** Returns one export; poll it until `status` is `ready`, `failed`, `expired` or `canceled`. */\n async get(\n input: GetStatementExportInput,\n options?: PolyesterRequestOptions,\n ): Promise<StatementExport> {\n const request = parse(GetStatementExportInputSchema, input);\n const response = await this.#client.getStatementExport(\n request,\n toConnectCallOptions(options),\n );\n return parse(StatementExportSchema, response.export);\n }\n\n /**\n * Returns a link valid for 60 seconds that downloads a ready export's file without\n * credentials, for a browser to save; each call returns a new link. Never log `url`. Throws\n * `PreconditionFailedError` before the file is ready (`STATEMENT_EXPORT_NOT_READY`) and for\n * a `failed`, `canceled` or `expired` export, or one with less than 5 seconds left\n * (`STATEMENT_EXPORT_FAILED`, `STATEMENT_EXPORT_CANCELED`, `STATEMENT_EXPORT_EXPIRED`).\n */\n async getDownloadUrl(\n input: GetStatementExportDownloadUrlInput,\n options?: PolyesterRequestOptions,\n ): Promise<StatementExportDownloadUrl> {\n const request = parse(GetStatementExportInputSchema, input);\n const response = await this.#client.getStatementExportDownloadUrl(\n request,\n toConnectCallOptions(options),\n );\n return parse(StatementExportDownloadUrlSchema, response);\n }\n\n /**\n * Cancels a queued or processing export and returns it `canceled`: it frees its place under\n * the root account's 5, the account's next queued export can start, and any partial file is\n * deleted. Canceling a `canceled` export returns it as it is; a finished one throws\n * `PreconditionFailedError` (`STATEMENT_EXPORT_NOT_CANCELABLE`).\n */\n async cancel(\n input: CancelStatementExportInput,\n options?: PolyesterRequestOptions,\n ): Promise<StatementExport> {\n const request = parse(GetStatementExportInputSchema, input);\n const response = await this.#client.cancelStatementExport(\n request,\n toConnectCallOptions(options),\n );\n return parse(StatementExportSchema, response.export);\n }\n\n /** Lists the resolved account's exports, newest first, with the root's in-progress count. */\n async list(\n input: ListStatementExportsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListStatementExportsResult> {\n const request = parse(\n ListStatementExportsInputSchema,\n resolveAccountScopedInput(input, this.#resolver),\n );\n const response = await this.#client.listStatementExports(\n request,\n toConnectCallOptions(options),\n );\n return parse(ListStatementExportsResultSchema, response);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,IAAa,0BAAb,MAAqC;CACjC;CACA;CAEA,YAAY,YAA+B,UAA+B;EACtE,KAAKA,UAAU,aAAaC,wBAA8B,WAAW,OAAO;EAC5E,KAAKC,YAAY;CACrB;;;;;;;;CASA,MAAM,OACF,OACA,SACwB;EACxB,MAAM,UAAU,MACZ,kCACA,0BAA0B,OAAO,KAAKA,SAAS,CACnD;EACA,MAAM,WAAW,MAAM,KAAKF,QAAQ,sBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,uBAAuB,SAAS,MAAM;CACvD;;CAGA,MAAM,IACF,OACA,SACwB;EACxB,MAAM,UAAU,MAAM,+BAA+B,KAAK;EAC1D,MAAM,WAAW,MAAM,KAAKA,QAAQ,mBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,uBAAuB,SAAS,MAAM;CACvD;;;;;;;;CASA,MAAM,eACF,OACA,SACmC;EACnC,MAAM,UAAU,MAAM,+BAA+B,KAAK;EAC1D,MAAM,WAAW,MAAM,KAAKA,QAAQ,8BAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,kCAAkC,QAAQ;CAC3D;;;;;;;CAQA,MAAM,OACF,OACA,SACwB;EACxB,MAAM,UAAU,MAAM,+BAA+B,KAAK;EAC1D,MAAM,WAAW,MAAM,KAAKA,QAAQ,sBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,uBAAuB,SAAS,MAAM;CACvD;;CAGA,MAAM,KACF,QAAmC,CAAC,GACpC,SACmC;EACnC,MAAM,UAAU,MACZ,iCACA,0BAA0B,OAAO,KAAKE,SAAS,CACnD;EACA,MAAM,WAAW,MAAM,KAAKF,QAAQ,qBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,kCAAkC,QAAQ;CAC3D;AACJ"}
|
|
@@ -4,8 +4,9 @@ declare const CreateStatementExportInputSchema: v.SchemaWithPipe<readonly [v.Str
|
|
|
4
4
|
/** Period start, inclusive, in epoch milliseconds (UTC); after the epoch and not in the future. */
|
|
5
5
|
readonly startTime: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, "startTime must be after 1970-01-01T00:00:00Z.">]>;
|
|
6
6
|
/**
|
|
7
|
-
* Period end, exclusive, in epoch milliseconds (UTC), by 2262-04-11T23:47:16Z
|
|
8
|
-
* still open when the export is created ends then;
|
|
7
|
+
* Period end, exclusive, in epoch milliseconds (UTC), by 2262-04-11T23:47:16Z and at most
|
|
8
|
+
* 366 days after `startTime`. A period still open when the export is created ends then;
|
|
9
|
+
* see `completeThrough`.
|
|
9
10
|
*/
|
|
10
11
|
readonly endTime: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MaxValueAction<number, number, "endTime must be by 2262-04-11T23:47:16Z.">]>;
|
|
11
12
|
/** Ledger asset ID to cover only that asset; omit or `0` for every asset. */
|
|
@@ -47,6 +48,8 @@ declare const GetStatementExportInputSchema: v.StrictObjectSchema<{
|
|
|
47
48
|
readonly exportId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
48
49
|
}, undefined>;
|
|
49
50
|
type GetStatementExportInput = v.InferInput<typeof GetStatementExportInputSchema>;
|
|
51
|
+
type CancelStatementExportInput = GetStatementExportInput;
|
|
52
|
+
type GetStatementExportDownloadUrlInput = GetStatementExportInput;
|
|
50
53
|
declare const ListStatementExportsInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
51
54
|
/** Page size, at most 100; 0 or omitted uses the server default of 20. */
|
|
52
55
|
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 100, undefined>]>, 0>;
|
|
@@ -87,7 +90,7 @@ declare const StatementExportSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
87
90
|
}, number>]>;
|
|
88
91
|
readonly assetId: v.NumberSchema<undefined>;
|
|
89
92
|
readonly idempotencyKey: v.StringSchema<undefined>;
|
|
90
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
93
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "processing" | "queued" | "ready" | "expired" | "canceled">]>;
|
|
91
94
|
readonly completeThrough: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
92
95
|
readonly seconds: v.BigintSchema<undefined>;
|
|
93
96
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -126,7 +129,7 @@ declare const StatementExportSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
126
129
|
endTime: number;
|
|
127
130
|
assetId: number;
|
|
128
131
|
idempotencyKey: string;
|
|
129
|
-
status: "unspecified" | "
|
|
132
|
+
status: "unspecified" | "failed" | "processing" | "queued" | "ready" | "expired" | "canceled";
|
|
130
133
|
completeThrough: number;
|
|
131
134
|
movements: string;
|
|
132
135
|
bytes: string;
|
|
@@ -145,7 +148,7 @@ declare const StatementExportSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
145
148
|
/** Ledger asset ID the statement is limited to; 0 for every asset. */
|
|
146
149
|
assetId: number;
|
|
147
150
|
idempotencyKey: string;
|
|
148
|
-
status: "unspecified" | "
|
|
151
|
+
status: "unspecified" | "failed" | "processing" | "queued" | "ready" | "expired" | "canceled";
|
|
149
152
|
/**
|
|
150
153
|
* End of what the file covers, exclusive: the earlier of `endTime` and when the export
|
|
151
154
|
* was created. Every movement recorded before both is in the file.
|
|
@@ -184,7 +187,7 @@ declare const ListStatementExportsResultSchema: v.ObjectSchema<{
|
|
|
184
187
|
}, number>]>;
|
|
185
188
|
readonly assetId: v.NumberSchema<undefined>;
|
|
186
189
|
readonly idempotencyKey: v.StringSchema<undefined>;
|
|
187
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
190
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "processing" | "queued" | "ready" | "expired" | "canceled">]>;
|
|
188
191
|
readonly completeThrough: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
189
192
|
readonly seconds: v.BigintSchema<undefined>;
|
|
190
193
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -223,7 +226,7 @@ declare const ListStatementExportsResultSchema: v.ObjectSchema<{
|
|
|
223
226
|
endTime: number;
|
|
224
227
|
assetId: number;
|
|
225
228
|
idempotencyKey: string;
|
|
226
|
-
status: "unspecified" | "
|
|
229
|
+
status: "unspecified" | "failed" | "processing" | "queued" | "ready" | "expired" | "canceled";
|
|
227
230
|
completeThrough: number;
|
|
228
231
|
movements: string;
|
|
229
232
|
bytes: string;
|
|
@@ -242,7 +245,7 @@ declare const ListStatementExportsResultSchema: v.ObjectSchema<{
|
|
|
242
245
|
/** Ledger asset ID the statement is limited to; 0 for every asset. */
|
|
243
246
|
assetId: number;
|
|
244
247
|
idempotencyKey: string;
|
|
245
|
-
status: "unspecified" | "
|
|
248
|
+
status: "unspecified" | "failed" | "processing" | "queued" | "ready" | "expired" | "canceled";
|
|
246
249
|
/**
|
|
247
250
|
* End of what the file covers, exclusive: the earlier of `endTime` and when the export
|
|
248
251
|
* was created. Every movement recorded before both is in the file.
|
|
@@ -261,9 +264,34 @@ declare const ListStatementExportsResultSchema: v.ObjectSchema<{
|
|
|
261
264
|
failureReason: "unspecified" | "unavailable" | "too_large";
|
|
262
265
|
}>]>, undefined>;
|
|
263
266
|
readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
267
|
+
/**
|
|
268
|
+
* Exports queued or processing across the whole root account, subaccounts included,
|
|
269
|
+
* whichever account the list selects.
|
|
270
|
+
*/
|
|
271
|
+
readonly inProgressExports: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
272
|
+
/** Most exports the root account may have queued or processing; `create` refuses at it. */
|
|
273
|
+
readonly maxInProgressExports: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
264
274
|
}, undefined>;
|
|
265
275
|
/** One page of exports, newest first; an empty `nextPageToken` means no more. */
|
|
266
276
|
type ListStatementExportsResult = v.InferOutput<typeof ListStatementExportsResultSchema>;
|
|
277
|
+
declare const StatementExportDownloadUrlSchema: v.ObjectSchema<{
|
|
278
|
+
/**
|
|
279
|
+
* Link to the file that needs no credentials, for a browser to save. Anyone who holds it can
|
|
280
|
+
* download the file until `expiresAt`: do not share, store or log it.
|
|
281
|
+
*/
|
|
282
|
+
readonly url: v.StringSchema<undefined>;
|
|
283
|
+
/** When the link stops working, epoch ms: 60 seconds after signing or when the file expires. */
|
|
284
|
+
readonly expiresAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
285
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
286
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
287
|
+
}, undefined>, v.TransformAction<{
|
|
288
|
+
seconds: bigint;
|
|
289
|
+
nanos: number;
|
|
290
|
+
}, number>]>;
|
|
291
|
+
/** Name the download saves the file as, `statement-<exportId>.csv`. */
|
|
292
|
+
readonly filename: v.StringSchema<undefined>;
|
|
293
|
+
}, undefined>;
|
|
294
|
+
type StatementExportDownloadUrl = v.InferOutput<typeof StatementExportDownloadUrlSchema>;
|
|
267
295
|
//#endregion
|
|
268
|
-
export { CreateStatementExportInput, CreateStatementExportInputSchema, GetStatementExportInput, GetStatementExportInputSchema, ListStatementExportsInput, ListStatementExportsInputSchema, ListStatementExportsResult, ListStatementExportsResultSchema, StatementExport, StatementExportSchema };
|
|
296
|
+
export { CancelStatementExportInput, CreateStatementExportInput, CreateStatementExportInputSchema, GetStatementExportDownloadUrlInput, GetStatementExportInput, GetStatementExportInputSchema, ListStatementExportsInput, ListStatementExportsInputSchema, ListStatementExportsResult, ListStatementExportsResultSchema, StatementExport, StatementExportDownloadUrl, StatementExportDownloadUrlSchema, StatementExportSchema };
|
|
269
297
|
//# sourceMappingURL=statement-exports.schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statement-exports.schemas.d.ts","names":[],"sources":["../../../src/services/statement-exports/statement-exports.schemas.ts"],"mappings":";;cAgCa,kCAAgC,EAAA,yBAAA,EAAA
|
|
1
|
+
{"version":3,"file":"statement-exports.schemas.d.ts","names":[],"sources":["../../../src/services/statement-exports/statement-exports.schemas.ts"],"mappings":";;cAgCa,kCAAgC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwCjC,6BAA6B,EAAE,kBAAkB;cAEhD,+BAA6B,EAAA;;;KAI9B,0BAA0B,EAAE,kBAAkB;KAC9C,6BAA6B;KAC7B,qCAAqC;cAEpC,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;KAchC,4BAA4B,EAAE,kBAAkB;;cAG/C,uBAAqB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgDtB,kBAAkB,EAAE,mBAAmB;cAEtC,kCAAgC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAajC,6BAA6B,EAAE,mBAAmB;cAEjD,kCAAgC,EAAA;;;;;;;;;;;;;;;;;KAYjC,6BAA6B,EAAE,mBAAmB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PROTOBUF_UINT32_MAX } from "../../shared/wire-bounds.js";
|
|
2
2
|
import { BigIntStringSchema, OptionalPublicIdSchema, OptionalTimestampMsSchema, PublicIdSchema, TimestampMsSchema, idInputSchema } from "../../shared/schemas.js";
|
|
3
3
|
import { enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
4
|
-
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
5
4
|
import { msToTimestamp } from "../../utils/timestamp.js";
|
|
5
|
+
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
6
6
|
import { StatementExportFailureReasonCodec, StatementExportStatusCodec } from "./statement-exports.codecs.js";
|
|
7
7
|
import * as v from "valibot";
|
|
8
8
|
//#region src/services/statement-exports/statement-exports.schemas.ts
|
|
@@ -14,8 +14,9 @@ const CreateStatementExportInputSchema = v.pipe(v.strictObject({
|
|
|
14
14
|
/** Period start, inclusive, in epoch milliseconds (UTC); after the epoch and not in the future. */
|
|
15
15
|
startTime: v.pipe(v.number(), v.integer(), v.minValue(1, "startTime must be after 1970-01-01T00:00:00Z.")),
|
|
16
16
|
/**
|
|
17
|
-
* Period end, exclusive, in epoch milliseconds (UTC), by 2262-04-11T23:47:16Z
|
|
18
|
-
* still open when the export is created ends then;
|
|
17
|
+
* Period end, exclusive, in epoch milliseconds (UTC), by 2262-04-11T23:47:16Z and at most
|
|
18
|
+
* 366 days after `startTime`. A period still open when the export is created ends then;
|
|
19
|
+
* see `completeThrough`.
|
|
19
20
|
*/
|
|
20
21
|
endTime: v.pipe(v.number(), v.integer(), v.maxValue(LATEST_END_TIME_MS, "endTime must be by 2262-04-11T23:47:16Z.")),
|
|
21
22
|
/** Ledger asset ID to cover only that asset; omit or `0` for every asset. */
|
|
@@ -90,9 +91,27 @@ const StatementExportSchema = v.pipe(v.object({
|
|
|
90
91
|
})));
|
|
91
92
|
const ListStatementExportsResultSchema = v.object({
|
|
92
93
|
exports: v.array(StatementExportSchema),
|
|
93
|
-
nextPageToken: v.optional(v.string(), "")
|
|
94
|
+
nextPageToken: v.optional(v.string(), ""),
|
|
95
|
+
/**
|
|
96
|
+
* Exports queued or processing across the whole root account, subaccounts included,
|
|
97
|
+
* whichever account the list selects.
|
|
98
|
+
*/
|
|
99
|
+
inProgressExports: v.optional(v.number(), 0),
|
|
100
|
+
/** Most exports the root account may have queued or processing; `create` refuses at it. */
|
|
101
|
+
maxInProgressExports: v.optional(v.number(), 0)
|
|
102
|
+
});
|
|
103
|
+
const StatementExportDownloadUrlSchema = v.object({
|
|
104
|
+
/**
|
|
105
|
+
* Link to the file that needs no credentials, for a browser to save. Anyone who holds it can
|
|
106
|
+
* download the file until `expiresAt`: do not share, store or log it.
|
|
107
|
+
*/
|
|
108
|
+
url: v.string(),
|
|
109
|
+
/** When the link stops working, epoch ms: 60 seconds after signing or when the file expires. */
|
|
110
|
+
expiresAt: TimestampMsSchema,
|
|
111
|
+
/** Name the download saves the file as, `statement-<exportId>.csv`. */
|
|
112
|
+
filename: v.string()
|
|
94
113
|
});
|
|
95
114
|
//#endregion
|
|
96
|
-
export { CreateStatementExportInputSchema, GetStatementExportInputSchema, ListStatementExportsInputSchema, ListStatementExportsResultSchema, StatementExportSchema };
|
|
115
|
+
export { CreateStatementExportInputSchema, GetStatementExportInputSchema, ListStatementExportsInputSchema, ListStatementExportsResultSchema, StatementExportDownloadUrlSchema, StatementExportSchema };
|
|
97
116
|
|
|
98
117
|
//# sourceMappingURL=statement-exports.schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statement-exports.schemas.js","names":[],"sources":["../../../src/services/statement-exports/statement-exports.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n BigIntStringSchema,\n OptionalPublicIdSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampMsSchema,\n idInputSchema,\n} from \"../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport { msToTimestamp } from \"../../utils/timestamp.js\";\nimport {\n StatementExportFailureReasonCodec,\n StatementExportStatusCodec,\n} from \"./statement-exports.codecs.js\";\n\n/** Latest period end the server accepts: 2262-04-11T23:47:16Z, the int64-nanosecond limit. */\nconst LATEST_END_TIME_MS = Date.UTC(2262, 3, 11, 23, 47, 16);\n\nconst IdempotencyKeySchema = v.pipe(\n v.string(),\n v.regex(\n /^[A-Za-z0-9._:-]{1,64}$/u,\n \"idempotencyKey must be 1 to 64 letters, digits, '.', '_', ':' or '-'.\",\n ),\n);\n\nexport const CreateStatementExportInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** Period start, inclusive, in epoch milliseconds (UTC); after the epoch and not in the future. */\n startTime: v.pipe(\n v.number(),\n v.integer(),\n v.minValue(1, \"startTime must be after 1970-01-01T00:00:00Z.\"),\n ),\n /**\n * Period end, exclusive, in epoch milliseconds (UTC), by 2262-04-11T23:47:16Z
|
|
1
|
+
{"version":3,"file":"statement-exports.schemas.js","names":[],"sources":["../../../src/services/statement-exports/statement-exports.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n BigIntStringSchema,\n OptionalPublicIdSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampMsSchema,\n idInputSchema,\n} from \"../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport { msToTimestamp } from \"../../utils/timestamp.js\";\nimport {\n StatementExportFailureReasonCodec,\n StatementExportStatusCodec,\n} from \"./statement-exports.codecs.js\";\n\n/** Latest period end the server accepts: 2262-04-11T23:47:16Z, the int64-nanosecond limit. */\nconst LATEST_END_TIME_MS = Date.UTC(2262, 3, 11, 23, 47, 16);\n\nconst IdempotencyKeySchema = v.pipe(\n v.string(),\n v.regex(\n /^[A-Za-z0-9._:-]{1,64}$/u,\n \"idempotencyKey must be 1 to 64 letters, digits, '.', '_', ':' or '-'.\",\n ),\n);\n\nexport const CreateStatementExportInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** Period start, inclusive, in epoch milliseconds (UTC); after the epoch and not in the future. */\n startTime: v.pipe(\n v.number(),\n v.integer(),\n v.minValue(1, \"startTime must be after 1970-01-01T00:00:00Z.\"),\n ),\n /**\n * Period end, exclusive, in epoch milliseconds (UTC), by 2262-04-11T23:47:16Z and at most\n * 366 days after `startTime`. A period still open when the export is created ends then;\n * see `completeThrough`.\n */\n endTime: v.pipe(\n v.number(),\n v.integer(),\n v.maxValue(LATEST_END_TIME_MS, \"endTime must be by 2262-04-11T23:47:16Z.\"),\n ),\n /** Ledger asset ID to cover only that asset; omit or `0` for every asset. */\n assetId: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)),\n 0,\n ),\n /**\n * 1 to 64 letters, digits, `.`, `_`, `:` or `-`, unique per root account. Repeating the\n * request with the same key returns the same export; the same key with other fields\n * throws `PreconditionFailedError` (`IDEMPOTENCY_KEY_REUSED`).\n */\n idempotencyKey: IdempotencyKeySchema,\n }),\n v.check(({ startTime, endTime }) => endTime > startTime, \"endTime must be after startTime.\"),\n v.transform(({ account, startTime, endTime, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n startTime: msToTimestamp(startTime),\n endTime: msToTimestamp(endTime),\n })),\n);\n\nexport type CreateStatementExportInput = v.InferInput<typeof CreateStatementExportInputSchema>;\n\nexport const GetStatementExportInputSchema = v.strictObject({\n exportId: idInputSchema(\"exportId\"),\n});\n\nexport type GetStatementExportInput = v.InferInput<typeof GetStatementExportInputSchema>;\nexport type CancelStatementExportInput = GetStatementExportInput;\nexport type GetStatementExportDownloadUrlInput = GetStatementExportInput;\n\nexport const ListStatementExportsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** Page size, at most 100; 0 or omitted uses the server default of 20. */\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), 0),\n /** Previous `nextPageToken`; reuse only with the same account. */\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ListStatementExportsInput = v.InferInput<typeof ListStatementExportsInputSchema>;\n\n/** A whole-period statement file being produced, ready, failed or expired. Times are epoch ms. */\nexport const StatementExportSchema = v.pipe(\n v.object({\n exportId: PublicIdSchema,\n subaccountId: OptionalPublicIdSchema,\n startTime: TimestampMsSchema,\n endTime: TimestampMsSchema,\n assetId: v.number(),\n idempotencyKey: v.string(),\n status: enumLabelSchema(StatementExportStatusCodec.protoToOutput),\n completeThrough: TimestampMsSchema,\n movements: BigIntStringSchema,\n bytes: BigIntStringSchema,\n createdAt: TimestampMsSchema,\n readyAt: OptionalTimestampMsSchema,\n expiresAt: OptionalTimestampMsSchema,\n failureReason: enumLabelSchema(StatementExportFailureReasonCodec.protoToOutput),\n }),\n v.transform((statement) => ({\n exportId: statement.exportId,\n /** Public subaccount ID the statement covers; null for the root account. */\n subaccountId: statement.subaccountId ?? null,\n /** Period start, inclusive. */\n startTime: statement.startTime,\n /** Requested period end, exclusive. */\n endTime: statement.endTime,\n /** Ledger asset ID the statement is limited to; 0 for every asset. */\n assetId: statement.assetId,\n idempotencyKey: statement.idempotencyKey,\n status: statement.status,\n /**\n * End of what the file covers, exclusive: the earlier of `endTime` and when the export\n * was created. Every movement recorded before both is in the file.\n */\n completeThrough: statement.completeThrough,\n /** Ledger movements written so far, as a uint64 decimal string; the total once ready. */\n movements: statement.movements,\n /** Bytes written so far, as a uint64 decimal string; the file size once ready. */\n bytes: statement.bytes,\n createdAt: statement.createdAt,\n /** When the file became ready; null before. */\n readyAt: statement.readyAt ?? null,\n /** When a ready file expires, 7 days after `readyAt`; null before ready. */\n expiresAt: statement.expiresAt ?? null,\n /** Why the export failed; `unspecified` unless `status` is `failed`. */\n failureReason: statement.failureReason,\n })),\n);\n\nexport type StatementExport = v.InferOutput<typeof StatementExportSchema>;\n\nexport const ListStatementExportsResultSchema = v.object({\n exports: v.array(StatementExportSchema),\n nextPageToken: v.optional(v.string(), \"\"),\n /**\n * Exports queued or processing across the whole root account, subaccounts included,\n * whichever account the list selects.\n */\n inProgressExports: v.optional(v.number(), 0),\n /** Most exports the root account may have queued or processing; `create` refuses at it. */\n maxInProgressExports: v.optional(v.number(), 0),\n});\n\n/** One page of exports, newest first; an empty `nextPageToken` means no more. */\nexport type ListStatementExportsResult = v.InferOutput<typeof ListStatementExportsResultSchema>;\n\nexport const StatementExportDownloadUrlSchema = v.object({\n /**\n * Link to the file that needs no credentials, for a browser to save. Anyone who holds it can\n * download the file until `expiresAt`: do not share, store or log it.\n */\n url: v.string(),\n /** When the link stops working, epoch ms: 60 seconds after signing or when the file expires. */\n expiresAt: TimestampMsSchema,\n /** Name the download saves the file as, `statement-<exportId>.csv`. */\n filename: v.string(),\n});\n\nexport type StatementExportDownloadUrl = v.InferOutput<typeof StatementExportDownloadUrlSchema>;\n"],"mappings":";;;;;;;;;AAsBA,MAAM,qBAAqB,KAAK,IAAI,MAAM,GAAG,IAAI,IAAI,IAAI,EAAE;AAE3D,MAAM,uBAAuB,EAAE,KAC3B,EAAE,OAAO,GACT,EAAE,MACE,4BACA,uEACJ,CACJ;AAEA,MAAa,mCAAmC,EAAE,KAC9C,EAAE,aAAa;CACX,GAAG;;CAEH,WAAW,EAAE,KACT,EAAE,OAAO,GACT,EAAE,QAAQ,GACV,EAAE,SAAS,GAAG,+CAA+C,CACjE;;;;;;CAMA,SAAS,EAAE,KACP,EAAE,OAAO,GACT,EAAE,QAAQ,GACV,EAAE,SAAS,oBAAoB,0CAA0C,CAC7E;;CAEA,SAAS,EAAE,SACP,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,mBAAmB,CAAC,GAC9E,CACJ;;;;;;CAMA,gBAAgB;AACpB,CAAC,GACD,EAAE,OAAO,EAAE,WAAW,cAAc,UAAU,WAAW,kCAAkC,GAC3F,EAAE,WAAW,EAAE,SAAS,WAAW,SAAS,GAAG,aAAa;CACxD,GAAG;CACH,cAAc,2BAA2B,OAAO;CAChD,WAAW,cAAc,SAAS;CAClC,SAAS,cAAc,OAAO;AAClC,EAAE,CACN;AAIA,MAAa,gCAAgC,EAAE,aAAa,EACxD,UAAU,cAAc,UAAU,EACtC,CAAC;AAMD,MAAa,kCAAkC,EAAE,KAC7C,EAAE,aAAa;CACX,GAAG;;CAEH,OAA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AAK,EAAE,OAAO;;CAEd,WAAW;;CAEX,UAAU,EAAE,OAAO;AACvB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CreateStatementExportInput, GetStatementExportInput, ListStatementExportsInput, ListStatementExportsResult, StatementExport } from "./statement-exports.schemas.js";
|
|
1
|
+
import { CancelStatementExportInput, CreateStatementExportInput, GetStatementExportDownloadUrlInput, GetStatementExportInput, ListStatementExportsInput, ListStatementExportsResult, StatementExport, StatementExportDownloadUrl } from "./statement-exports.schemas.js";
|
|
2
2
|
import { StatementExportFailureReason, StatementExportStatus } from "./statement-exports.codecs.js";
|
|
3
|
-
export type { CreateStatementExportInput, GetStatementExportInput, ListStatementExportsInput, ListStatementExportsResult, StatementExport, StatementExportFailureReason, StatementExportStatus };
|
|
3
|
+
export type { CancelStatementExportInput, CreateStatementExportInput, GetStatementExportDownloadUrlInput, GetStatementExportInput, ListStatementExportsInput, ListStatementExportsResult, StatementExport, StatementExportDownloadUrl, StatementExportFailureReason, StatementExportStatus };
|