@polyester/sdk 0.36.0-devnet-20261118141710 → 0.36.0-devnet-20261119010940
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 +32 -2
- 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 +5 -6
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
- package/dist/gen/auth/v1/address_book_pb.d.ts +1 -1
- package/dist/gen/auth/v1/address_book_pb.js +1 -1
- package/dist/gen/auth/v1/address_book_pb.js.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +70 -9
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js +16 -1
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +74 -5
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +58 -6
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/connected_apps_pb.d.ts +382 -0
- package/dist/gen/auth/v1/connected_apps_pb.d.ts.map +1 -0
- package/dist/gen/auth/v1/connected_apps_pb.js +107 -0
- package/dist/gen/auth/v1/connected_apps_pb.js.map +1 -0
- package/dist/gen/auth/v1/mfa_pb.d.ts +2 -140
- package/dist/gen/auth/v1/mfa_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.js +8 -80
- package/dist/gen/auth/v1/mfa_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +164 -41
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +36 -3
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +4 -4
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +17 -10
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +3 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/fees/v1/fees_pb.d.ts +2 -1
- package/dist/gen/fees/v1/fees_pb.d.ts.map +1 -1
- package/dist/gen/fees/v1/fees_pb.js.map +1 -1
- package/dist/gen/index.d.ts +8 -5
- package/dist/gen/index.js +8 -5
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +3 -2
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts +9 -58
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.js +8 -57
- package/dist/gen/marketdata/v1/heatmap_pb.js.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.d.ts +141 -4
- package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.js +94 -16
- package/dist/gen/notifications/v1/notifications_pb.js.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts +14 -12
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js +6 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +66 -18
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +1 -1
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +8 -0
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/polyester/api/options_pb.d.ts +2 -1
- package/dist/gen/polyester/api/options_pb.d.ts.map +1 -1
- package/dist/gen/polyester/api/options_pb.js +2 -1
- package/dist/gen/polyester/api/options_pb.js.map +1 -1
- package/dist/gen/polyester/api/v1/request_error_pb.d.ts +66 -0
- package/dist/gen/polyester/api/v1/request_error_pb.d.ts.map +1 -0
- package/dist/gen/polyester/api/v1/request_error_pb.js +49 -0
- package/dist/gen/polyester/api/v1/request_error_pb.js.map +1 -0
- package/dist/gen/polyester/type/v1/depth_tier_pb.d.ts +98 -0
- package/dist/gen/polyester/type/v1/depth_tier_pb.d.ts.map +1 -0
- package/dist/gen/polyester/type/v1/depth_tier_pb.js +104 -0
- package/dist/gen/polyester/type/v1/depth_tier_pb.js.map +1 -0
- package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +42 -23
- package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts.map +1 -1
- package/dist/gen/ratelimit/v1/ratelimit_pb.js +14 -2
- package/dist/gen/ratelimit/v1/ratelimit_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +126 -13
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +100 -28
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +5 -3
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +25 -3
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +18 -1
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +5 -3
- 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.schemas.d.ts +4 -4
- package/dist/services/address-book/address-book.js +1 -1
- package/dist/services/address-book/address-book.schemas.d.ts +2 -2
- package/dist/services/api-keys/api-keys.codecs.d.ts +6 -1
- package/dist/services/api-keys/api-keys.codecs.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.codecs.js +19 -7
- package/dist/services/api-keys/api-keys.codecs.js.map +1 -1
- package/dist/services/api-keys/api-keys.js +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +12 -4
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +15 -6
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/api-keys/api-keys.types.d.ts +2 -2
- package/dist/services/assistant/assistant-events.schemas.d.ts +30 -30
- package/dist/services/assistant/assistant.schemas.d.ts +2 -2
- package/dist/services/auth/auth.d.ts +4 -0
- package/dist/services/auth/auth.d.ts.map +1 -1
- package/dist/services/auth/auth.js +12 -2
- package/dist/services/auth/auth.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +3 -3
- package/dist/services/balances/balances.js +1 -1
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/changelog/changelog.schemas.d.ts +22 -22
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +1 -1
- package/dist/services/connected-apps/connected-apps.d.ts +46 -0
- package/dist/services/connected-apps/connected-apps.d.ts.map +1 -0
- package/dist/services/connected-apps/connected-apps.js +69 -0
- package/dist/services/connected-apps/connected-apps.js.map +1 -0
- package/dist/services/connected-apps/connected-apps.schemas.d.ts +132 -0
- package/dist/services/connected-apps/connected-apps.schemas.d.ts.map +1 -0
- package/dist/services/connected-apps/connected-apps.schemas.js +68 -0
- package/dist/services/connected-apps/connected-apps.schemas.js.map +1 -0
- package/dist/services/connected-apps/connected-apps.types.d.ts +2 -0
- package/dist/services/connected-apps/service.d.ts +8 -0
- package/dist/services/connected-apps/service.d.ts.map +1 -0
- package/dist/services/connected-apps/service.js +9 -0
- package/dist/services/connected-apps/service.js.map +1 -0
- package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +2 -2
- package/dist/services/heatmap/heatmap.codecs.d.ts +1 -0
- package/dist/services/heatmap/heatmap.codecs.d.ts.map +1 -1
- package/dist/services/heatmap/heatmap.codecs.js +2 -27
- package/dist/services/heatmap/heatmap.codecs.js.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +9 -8
- package/dist/services/heatmap/heatmap.schemas.d.ts.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.js +4 -3
- package/dist/services/heatmap/heatmap.schemas.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +6 -6
- 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 +91 -91
- package/dist/services/notifications/notifications.codecs.d.ts +6 -3
- package/dist/services/notifications/notifications.codecs.d.ts.map +1 -1
- package/dist/services/notifications/notifications.codecs.js +14 -3
- package/dist/services/notifications/notifications.codecs.js.map +1 -1
- package/dist/services/notifications/notifications.schemas.d.ts +97 -3
- package/dist/services/notifications/notifications.schemas.d.ts.map +1 -1
- package/dist/services/notifications/notifications.schemas.js +18 -1
- package/dist/services/notifications/notifications.schemas.js.map +1 -1
- package/dist/services/notifications/notifications.types.d.ts +2 -2
- package/dist/services/orderbook/orderbook.codecs.js +1 -1
- package/dist/services/orderbook/orderbook.codecs.js.map +1 -1
- package/dist/services/orderbook/orderbook.d.ts +2 -2
- package/dist/services/orderbook/orderbook.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.js +8 -10
- package/dist/services/orderbook/orderbook.js.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +3 -6
- package/dist/services/orderbook/orderbook.schemas.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.js +5 -5
- package/dist/services/orderbook/orderbook.schemas.js.map +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +9 -9
- package/dist/services/orders/orders-batch.schemas.d.ts +106 -102
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +2 -0
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +23 -15
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +7 -2
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +8 -8
- 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.d.ts +4 -1
- package/dist/services/policies/api-key-policies/api-key-policies.d.ts.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.js +5 -2
- package/dist/services/policies/api-key-policies/api-key-policies.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +25 -15
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +3 -0
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js.map +1 -1
- package/dist/services/policies/shared.codecs.js +25 -5
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts +4 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.js +5 -2
- package/dist/services/policies/subaccount-policies/subaccount-policies.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +11 -3
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +4 -0
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
- package/dist/services/rate-limits/rate-limits.codecs.d.ts +1 -1
- package/dist/services/rate-limits/rate-limits.codecs.js +2 -1
- package/dist/services/rate-limits/rate-limits.codecs.js.map +1 -1
- package/dist/services/rate-limits/rate-limits.schemas.d.ts +4 -4
- package/dist/services/statement-exports/statement-exports.schemas.d.ts +6 -6
- package/dist/services/subaccounts/subaccounts.js +2 -2
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +20 -20
- package/dist/services/system/system.schemas.d.ts +13 -13
- 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/transfers/transfers.js +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +57 -57
- package/dist/services/triggers/triggers.codecs.d.ts.map +1 -1
- package/dist/services/triggers/triggers.codecs.js +2 -0
- package/dist/services/triggers/triggers.codecs.js.map +1 -1
- package/dist/services/triggers/triggers.d.ts.map +1 -1
- package/dist/services/triggers/triggers.js +14 -10
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +5 -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/depth-tier.js +46 -0
- package/dist/shared/depth-tier.js.map +1 -0
- package/dist/shared/error-detail.d.ts +6 -0
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +2 -1
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/request.js +16 -0
- package/dist/shared/error-details/request.js.map +1 -0
- package/dist/shared/rate-limit.schemas.d.ts +1 -1
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +6 -4
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ declare const ListChangelogChangesInputSchema: v.SchemaWithPipe<readonly [v.Stri
|
|
|
31
31
|
}, undefined>, v.CheckAction<{
|
|
32
32
|
categories: ("breaking_change" | "new_feature" | "improvement" | "bug_fix")[];
|
|
33
33
|
actionRequired?: boolean | undefined;
|
|
34
|
-
surfaces: ("assistant" | "
|
|
34
|
+
surfaces: ("assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
35
35
|
audiences: ("all_users" | "traders" | "market_makers" | "developers")[];
|
|
36
36
|
startTime?: number | undefined;
|
|
37
37
|
endTime?: number | undefined;
|
|
@@ -42,7 +42,7 @@ declare const ListChangelogChangesInputSchema: v.SchemaWithPipe<readonly [v.Stri
|
|
|
42
42
|
}, "endTime: must be after startTime">, v.TransformAction<{
|
|
43
43
|
categories: ("breaking_change" | "new_feature" | "improvement" | "bug_fix")[];
|
|
44
44
|
actionRequired?: boolean | undefined;
|
|
45
|
-
surfaces: ("assistant" | "
|
|
45
|
+
surfaces: ("assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
46
46
|
audiences: ("all_users" | "traders" | "market_makers" | "developers")[];
|
|
47
47
|
startTime?: number | undefined;
|
|
48
48
|
endTime?: number | undefined;
|
|
@@ -77,7 +77,7 @@ declare const ChangelogChangeSchema: v.ObjectSchema<{
|
|
|
77
77
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
78
78
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
79
79
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
80
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "
|
|
80
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>, undefined>, readonly []>;
|
|
81
81
|
readonly environmentExceptions: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
82
82
|
readonly environment: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "devnet" | "testnet" | "mainnet">]>;
|
|
83
83
|
readonly availability: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "unavailable" | "ahead" | "pending">]>;
|
|
@@ -95,7 +95,7 @@ type ChangelogChange = v.InferOutput<typeof ChangelogChangeSchema>;
|
|
|
95
95
|
declare const ChangelogSectionSchema: v.ObjectSchema<{
|
|
96
96
|
readonly heading: v.StringSchema<undefined>;
|
|
97
97
|
readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
98
|
-
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "
|
|
98
|
+
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>;
|
|
99
99
|
readonly changes: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
100
100
|
readonly id: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
101
101
|
readonly title: v.StringSchema<undefined>;
|
|
@@ -105,7 +105,7 @@ declare const ChangelogSectionSchema: v.ObjectSchema<{
|
|
|
105
105
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
106
106
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
107
107
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
108
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "
|
|
108
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>, undefined>, readonly []>;
|
|
109
109
|
readonly environmentExceptions: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
110
110
|
readonly environment: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "devnet" | "testnet" | "mainnet">]>;
|
|
111
111
|
readonly availability: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "unavailable" | "ahead" | "pending">]>;
|
|
@@ -278,7 +278,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
278
278
|
readonly sections: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
279
279
|
readonly heading: v.StringSchema<undefined>;
|
|
280
280
|
readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
281
|
-
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "
|
|
281
|
+
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>;
|
|
282
282
|
readonly changes: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
283
283
|
readonly id: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
284
284
|
readonly title: v.StringSchema<undefined>;
|
|
@@ -288,7 +288,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
288
288
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
289
289
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
290
290
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
291
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "
|
|
291
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>, undefined>, readonly []>;
|
|
292
292
|
readonly environmentExceptions: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
293
293
|
readonly environment: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "devnet" | "testnet" | "mainnet">]>;
|
|
294
294
|
readonly availability: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "unavailable" | "ahead" | "pending">]>;
|
|
@@ -327,7 +327,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
327
327
|
sections: {
|
|
328
328
|
heading: string;
|
|
329
329
|
summary?: string | undefined;
|
|
330
|
-
surface: "unspecified" | "assistant" | "
|
|
330
|
+
surface: "unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap";
|
|
331
331
|
changes: {
|
|
332
332
|
id: string;
|
|
333
333
|
title: string;
|
|
@@ -337,7 +337,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
337
337
|
actionRequired: boolean;
|
|
338
338
|
migrationGuidance?: string | undefined;
|
|
339
339
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
340
|
-
surfaces: ("unspecified" | "assistant" | "
|
|
340
|
+
surfaces: ("unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
341
341
|
environmentExceptions: {
|
|
342
342
|
environment: "unspecified" | "devnet" | "testnet" | "mainnet";
|
|
343
343
|
availability: "unspecified" | "unavailable" | "ahead" | "pending";
|
|
@@ -349,7 +349,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
349
349
|
sections: {
|
|
350
350
|
heading: string;
|
|
351
351
|
summary?: string | undefined;
|
|
352
|
-
surface: "unspecified" | "assistant" | "
|
|
352
|
+
surface: "unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap";
|
|
353
353
|
changes: {
|
|
354
354
|
id: string;
|
|
355
355
|
title: string;
|
|
@@ -359,7 +359,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
359
359
|
actionRequired: boolean;
|
|
360
360
|
migrationGuidance?: string | undefined;
|
|
361
361
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
362
|
-
surfaces: ("unspecified" | "assistant" | "
|
|
362
|
+
surfaces: ("unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
363
363
|
environmentExceptions: {
|
|
364
364
|
environment: "unspecified" | "devnet" | "testnet" | "mainnet";
|
|
365
365
|
availability: "unspecified" | "unavailable" | "ahead" | "pending";
|
|
@@ -398,7 +398,7 @@ declare const ChangelogChangeEntrySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
398
398
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
399
399
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
400
400
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
401
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "
|
|
401
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>, undefined>, readonly []>;
|
|
402
402
|
readonly environmentExceptions: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
403
403
|
readonly environment: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "devnet" | "testnet" | "mainnet">]>;
|
|
404
404
|
readonly availability: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "unavailable" | "ahead" | "pending">]>;
|
|
@@ -430,7 +430,7 @@ declare const ChangelogChangeEntrySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
430
430
|
actionRequired: boolean;
|
|
431
431
|
migrationGuidance?: string | undefined;
|
|
432
432
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
433
|
-
surfaces: ("unspecified" | "assistant" | "
|
|
433
|
+
surfaces: ("unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
434
434
|
environmentExceptions: {
|
|
435
435
|
environment: "unspecified" | "devnet" | "testnet" | "mainnet";
|
|
436
436
|
availability: "unspecified" | "unavailable" | "ahead" | "pending";
|
|
@@ -452,7 +452,7 @@ declare const ChangelogChangeEntrySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
452
452
|
actionRequired: boolean;
|
|
453
453
|
migrationGuidance?: string | undefined;
|
|
454
454
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
455
|
-
surfaces: ("unspecified" | "assistant" | "
|
|
455
|
+
surfaces: ("unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
456
456
|
environmentExceptions: {
|
|
457
457
|
environment: "unspecified" | "devnet" | "testnet" | "mainnet";
|
|
458
458
|
availability: "unspecified" | "unavailable" | "ahead" | "pending";
|
|
@@ -472,7 +472,7 @@ declare const ListChangelogChangesResultSchema: v.ObjectSchema<{
|
|
|
472
472
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
473
473
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
474
474
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
475
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "
|
|
475
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>, undefined>, readonly []>;
|
|
476
476
|
readonly environmentExceptions: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
477
477
|
readonly environment: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "devnet" | "testnet" | "mainnet">]>;
|
|
478
478
|
readonly availability: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "unavailable" | "ahead" | "pending">]>;
|
|
@@ -504,7 +504,7 @@ declare const ListChangelogChangesResultSchema: v.ObjectSchema<{
|
|
|
504
504
|
actionRequired: boolean;
|
|
505
505
|
migrationGuidance?: string | undefined;
|
|
506
506
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
507
|
-
surfaces: ("unspecified" | "assistant" | "
|
|
507
|
+
surfaces: ("unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
508
508
|
environmentExceptions: {
|
|
509
509
|
environment: "unspecified" | "devnet" | "testnet" | "mainnet";
|
|
510
510
|
availability: "unspecified" | "unavailable" | "ahead" | "pending";
|
|
@@ -526,7 +526,7 @@ declare const ListChangelogChangesResultSchema: v.ObjectSchema<{
|
|
|
526
526
|
actionRequired: boolean;
|
|
527
527
|
migrationGuidance?: string | undefined;
|
|
528
528
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
529
|
-
surfaces: ("unspecified" | "assistant" | "
|
|
529
|
+
surfaces: ("unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
530
530
|
environmentExceptions: {
|
|
531
531
|
environment: "unspecified" | "devnet" | "testnet" | "mainnet";
|
|
532
532
|
availability: "unspecified" | "unavailable" | "ahead" | "pending";
|
|
@@ -678,7 +678,7 @@ declare const ChangelogDeploymentGroupSchema: v.SchemaWithPipe<readonly [v.Objec
|
|
|
678
678
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
679
679
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
680
680
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
681
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "
|
|
681
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap">]>, undefined>, readonly []>;
|
|
682
682
|
readonly environmentExceptions: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
683
683
|
readonly environment: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "devnet" | "testnet" | "mainnet">]>;
|
|
684
684
|
readonly availability: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "unavailable" | "ahead" | "pending">]>;
|
|
@@ -703,7 +703,7 @@ declare const ChangelogDeploymentGroupSchema: v.SchemaWithPipe<readonly [v.Objec
|
|
|
703
703
|
actionRequired: boolean;
|
|
704
704
|
migrationGuidance?: string | undefined;
|
|
705
705
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
706
|
-
surfaces: ("unspecified" | "assistant" | "
|
|
706
|
+
surfaces: ("unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
707
707
|
environmentExceptions: {
|
|
708
708
|
environment: "unspecified" | "devnet" | "testnet" | "mainnet";
|
|
709
709
|
availability: "unspecified" | "unavailable" | "ahead" | "pending";
|
|
@@ -723,7 +723,7 @@ declare const ChangelogDeploymentGroupSchema: v.SchemaWithPipe<readonly [v.Objec
|
|
|
723
723
|
actionRequired: boolean;
|
|
724
724
|
migrationGuidance?: string | undefined;
|
|
725
725
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
726
|
-
surfaces: ("unspecified" | "assistant" | "
|
|
726
|
+
surfaces: ("unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
727
727
|
environmentExceptions: {
|
|
728
728
|
environment: "unspecified" | "devnet" | "testnet" | "mainnet";
|
|
729
729
|
availability: "unspecified" | "unavailable" | "ahead" | "pending";
|
|
@@ -765,7 +765,7 @@ declare const ChangelogDeploymentGroupSchema: v.SchemaWithPipe<readonly [v.Objec
|
|
|
765
765
|
actionRequired: boolean;
|
|
766
766
|
migrationGuidance?: string | undefined;
|
|
767
767
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
768
|
-
surfaces: ("unspecified" | "assistant" | "
|
|
768
|
+
surfaces: ("unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
769
769
|
environmentExceptions: {
|
|
770
770
|
environment: "unspecified" | "devnet" | "testnet" | "mainnet";
|
|
771
771
|
availability: "unspecified" | "unavailable" | "ahead" | "pending";
|
|
@@ -789,7 +789,7 @@ declare const ChangelogDeploymentGroupSchema: v.SchemaWithPipe<readonly [v.Objec
|
|
|
789
789
|
actionRequired: boolean;
|
|
790
790
|
migrationGuidance?: string | undefined;
|
|
791
791
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
792
|
-
surfaces: ("unspecified" | "assistant" | "
|
|
792
|
+
surfaces: ("unspecified" | "assistant" | "api" | "rewards" | "trading" | "funding" | "accounts" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap")[];
|
|
793
793
|
environmentExceptions: {
|
|
794
794
|
environment: "unspecified" | "devnet" | "testnet" | "mainnet";
|
|
795
795
|
availability: "unspecified" | "unavailable" | "ahead" | "pending";
|
|
@@ -427,7 +427,7 @@ declare const CheckpointSchema: v.ObjectSchema<{
|
|
|
427
427
|
readonly seasonResultUsd: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
428
428
|
readonly subaccounts: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.MaxValueAction<bigint, bigint, undefined>, v.TransformAction<any, number>]>;
|
|
429
429
|
/** Values computed from partial evidence; show them with an approximation marker. */
|
|
430
|
-
readonly incomplete: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
430
|
+
readonly incomplete: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "tools" | "deposits" | "withdrawals" | "volume" | "top_pairs" | "order_types" | "time_in_force" | "order_status" | "median_limit_rest" | "internal_transfers" | "daily_claim_amounts" | "portfolio_value" | "trading_balances" | "funding_balances" | "transfers" | "season_result">]>, undefined>, readonly []>;
|
|
431
431
|
}, undefined>;
|
|
432
432
|
/**
|
|
433
433
|
* One frozen season recap of a root account and all of its subaccounts. An absent USD value
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AuthApiTransports } from "../../shared/transports.js";
|
|
2
|
+
import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
3
|
+
import { AppAuthorization, AppAuthorizationInput, AppAuthorizationRedirect, ConnectedApp, RevokeConnectedAppInput } from "./connected-apps.schemas.js";
|
|
4
|
+
//#region src/services/connected-apps/connected-apps.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Connects outside apps, such as an AI assistant, to the account with OAuth ("Sign in with
|
|
7
|
+
* Polyester"), and lists and disconnects them. Session only: the website's consent page and
|
|
8
|
+
* settings call these, and API keys are refused. A connected app uses the account as the
|
|
9
|
+
* signed-in website does, for the scopes granted; it never moves money out of the account or
|
|
10
|
+
* changes its security settings. A connection lasts until it is disconnected or expires; signing
|
|
11
|
+
* out does not end it.
|
|
12
|
+
*/
|
|
13
|
+
declare class ConnectedAppsService {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(transports: AuthApiTransports);
|
|
16
|
+
/**
|
|
17
|
+
* Reads a pending app connection request to show the consent page. An unknown, expired or
|
|
18
|
+
* already answered request throws `ResourceNotFoundError`.
|
|
19
|
+
*/
|
|
20
|
+
getAuthorization(input: AppAuthorizationInput, options?: PolyesterRequestOptions): Promise<AppAuthorization>;
|
|
21
|
+
/**
|
|
22
|
+
* Approves a pending app connection request; send the browser to the returned `redirectUrl`,
|
|
23
|
+
* which carries a one-time authorization code valid for 60 seconds. Needs MFA enrolled and a
|
|
24
|
+
* fresh `stepUpToken`. An unknown, expired or already answered request throws
|
|
25
|
+
* `ResourceNotFoundError`; an account with 20 connected apps throws `PreconditionFailedError`
|
|
26
|
+
* (`AUTH_CONNECTED_APP_LIMIT_REACHED`).
|
|
27
|
+
*/
|
|
28
|
+
approveAuthorization(input: AppAuthorizationInput, options?: PolyesterMutationOptions): Promise<AppAuthorizationRedirect>;
|
|
29
|
+
/**
|
|
30
|
+
* Denies a pending app connection request; send the browser to the returned `redirectUrl`,
|
|
31
|
+
* which carries the `access_denied` error. An unknown, expired or already answered request
|
|
32
|
+
* throws `ResourceNotFoundError`.
|
|
33
|
+
*/
|
|
34
|
+
denyAuthorization(input: AppAuthorizationInput, options?: PolyesterRequestOptions): Promise<AppAuthorizationRedirect>;
|
|
35
|
+
/** Lists the apps connected to the account, newest first; at most 20. */
|
|
36
|
+
list(options?: PolyesterRequestOptions): Promise<ConnectedApp[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Disconnects an app; its access and refresh tokens stop working at once. Disconnecting an
|
|
39
|
+
* app already disconnected or expired succeeds; an ID that is not one of the account's
|
|
40
|
+
* connected apps throws `ResourceNotFoundError`.
|
|
41
|
+
*/
|
|
42
|
+
revoke(input: RevokeConnectedAppInput, options?: PolyesterRequestOptions): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { ConnectedAppsService };
|
|
46
|
+
//# sourceMappingURL=connected-apps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connected-apps.d.ts","names":[],"sources":["../../../src/services/connected-apps/connected-apps.ts"],"mappings":";;;;;;;;;;;;cA8Ba;;EAGG,YAAA,YAAY;;;;;EAQlB,iBACF,OAAO,uBACP,UAAU,0BACX,QAAQ;;;;;;;;EAgBL,qBACF,OAAO,uBACP,UAAU,2BACX,QAAQ;;;;;;EAcL,kBACF,OAAO,uBACP,UAAU,0BACX,QAAQ;;EAUL,KAAK,UAAU,0BAA0B,QAAQ;;;;;;EAUjD,OAAO,OAAO,yBAAyB,UAAU,0BAA0B"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { parse } from "../../shared/validation.js";
|
|
2
|
+
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
+
import { ConnectedAppService } from "../../gen/auth/v1/connected_apps_pb.js";
|
|
4
|
+
import { AppAuthorizationInputSchema, AppAuthorizationRedirectSchema, AppAuthorizationSchema, ConnectedAppsSchema, RevokeConnectedAppInputSchema } from "./connected-apps.schemas.js";
|
|
5
|
+
import { createClient } from "@connectrpc/connect";
|
|
6
|
+
//#region src/services/connected-apps/connected-apps.ts
|
|
7
|
+
/**
|
|
8
|
+
* Connects outside apps, such as an AI assistant, to the account with OAuth ("Sign in with
|
|
9
|
+
* Polyester"), and lists and disconnects them. Session only: the website's consent page and
|
|
10
|
+
* settings call these, and API keys are refused. A connected app uses the account as the
|
|
11
|
+
* signed-in website does, for the scopes granted; it never moves money out of the account or
|
|
12
|
+
* changes its security settings. A connection lasts until it is disconnected or expires; signing
|
|
13
|
+
* out does not end it.
|
|
14
|
+
*/
|
|
15
|
+
var ConnectedAppsService = class {
|
|
16
|
+
#client;
|
|
17
|
+
constructor(transports) {
|
|
18
|
+
this.#client = createClient(ConnectedAppService, transports.authApi);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Reads a pending app connection request to show the consent page. An unknown, expired or
|
|
22
|
+
* already answered request throws `ResourceNotFoundError`.
|
|
23
|
+
*/
|
|
24
|
+
async getAuthorization(input, options) {
|
|
25
|
+
const request = parse(AppAuthorizationInputSchema, input);
|
|
26
|
+
const response = await this.#client.getAppAuthorization(request, toConnectCallOptions(options));
|
|
27
|
+
return parse(AppAuthorizationSchema, response.authorization);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Approves a pending app connection request; send the browser to the returned `redirectUrl`,
|
|
31
|
+
* which carries a one-time authorization code valid for 60 seconds. Needs MFA enrolled and a
|
|
32
|
+
* fresh `stepUpToken`. An unknown, expired or already answered request throws
|
|
33
|
+
* `ResourceNotFoundError`; an account with 20 connected apps throws `PreconditionFailedError`
|
|
34
|
+
* (`AUTH_CONNECTED_APP_LIMIT_REACHED`).
|
|
35
|
+
*/
|
|
36
|
+
async approveAuthorization(input, options) {
|
|
37
|
+
const request = parse(AppAuthorizationInputSchema, input);
|
|
38
|
+
const response = await this.#client.approveAppAuthorization(request, toConnectCallOptions(options));
|
|
39
|
+
return parse(AppAuthorizationRedirectSchema, response);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Denies a pending app connection request; send the browser to the returned `redirectUrl`,
|
|
43
|
+
* which carries the `access_denied` error. An unknown, expired or already answered request
|
|
44
|
+
* throws `ResourceNotFoundError`.
|
|
45
|
+
*/
|
|
46
|
+
async denyAuthorization(input, options) {
|
|
47
|
+
const request = parse(AppAuthorizationInputSchema, input);
|
|
48
|
+
const response = await this.#client.denyAppAuthorization(request, toConnectCallOptions(options));
|
|
49
|
+
return parse(AppAuthorizationRedirectSchema, response);
|
|
50
|
+
}
|
|
51
|
+
/** Lists the apps connected to the account, newest first; at most 20. */
|
|
52
|
+
async list(options) {
|
|
53
|
+
const response = await this.#client.listConnectedApps({}, toConnectCallOptions(options));
|
|
54
|
+
return parse(ConnectedAppsSchema, response.apps);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Disconnects an app; its access and refresh tokens stop working at once. Disconnecting an
|
|
58
|
+
* app already disconnected or expired succeeds; an ID that is not one of the account's
|
|
59
|
+
* connected apps throws `ResourceNotFoundError`.
|
|
60
|
+
*/
|
|
61
|
+
async revoke(input, options) {
|
|
62
|
+
const request = parse(RevokeConnectedAppInputSchema, input);
|
|
63
|
+
await this.#client.revokeConnectedApp(request, toConnectCallOptions(options));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { ConnectedAppsService };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=connected-apps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connected-apps.js","names":["#client","Proto.ConnectedAppService"],"sources":["../../../src/services/connected-apps/connected-apps.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/connected_apps_pb.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n AppAuthorizationInputSchema,\n AppAuthorizationRedirectSchema,\n AppAuthorizationSchema,\n ConnectedAppsSchema,\n RevokeConnectedAppInputSchema,\n type AppAuthorization,\n type AppAuthorizationInput,\n type AppAuthorizationRedirect,\n type ConnectedApp,\n type RevokeConnectedAppInput,\n} from \"./connected-apps.schemas.js\";\n\n/**\n * Connects outside apps, such as an AI assistant, to the account with OAuth (\"Sign in with\n * Polyester\"), and lists and disconnects them. Session only: the website's consent page and\n * settings call these, and API keys are refused. A connected app uses the account as the\n * signed-in website does, for the scopes granted; it never moves money out of the account or\n * changes its security settings. A connection lasts until it is disconnected or expires; signing\n * out does not end it.\n */\nexport class ConnectedAppsService {\n #client: Client<typeof Proto.ConnectedAppService>;\n\n constructor(transports: AuthApiTransports) {\n this.#client = createClient(Proto.ConnectedAppService, transports.authApi);\n }\n\n /**\n * Reads a pending app connection request to show the consent page. An unknown, expired or\n * already answered request throws `ResourceNotFoundError`.\n */\n async getAuthorization(\n input: AppAuthorizationInput,\n options?: PolyesterRequestOptions,\n ): Promise<AppAuthorization> {\n const request = parse(AppAuthorizationInputSchema, input);\n const response = await this.#client.getAppAuthorization(\n request,\n toConnectCallOptions(options),\n );\n return parse(AppAuthorizationSchema, response.authorization);\n }\n\n /**\n * Approves a pending app connection request; send the browser to the returned `redirectUrl`,\n * which carries a one-time authorization code valid for 60 seconds. Needs MFA enrolled and a\n * fresh `stepUpToken`. An unknown, expired or already answered request throws\n * `ResourceNotFoundError`; an account with 20 connected apps throws `PreconditionFailedError`\n * (`AUTH_CONNECTED_APP_LIMIT_REACHED`).\n */\n async approveAuthorization(\n input: AppAuthorizationInput,\n options?: PolyesterMutationOptions,\n ): Promise<AppAuthorizationRedirect> {\n const request = parse(AppAuthorizationInputSchema, input);\n const response = await this.#client.approveAppAuthorization(\n request,\n toConnectCallOptions(options),\n );\n return parse(AppAuthorizationRedirectSchema, response);\n }\n\n /**\n * Denies a pending app connection request; send the browser to the returned `redirectUrl`,\n * which carries the `access_denied` error. An unknown, expired or already answered request\n * throws `ResourceNotFoundError`.\n */\n async denyAuthorization(\n input: AppAuthorizationInput,\n options?: PolyesterRequestOptions,\n ): Promise<AppAuthorizationRedirect> {\n const request = parse(AppAuthorizationInputSchema, input);\n const response = await this.#client.denyAppAuthorization(\n request,\n toConnectCallOptions(options),\n );\n return parse(AppAuthorizationRedirectSchema, response);\n }\n\n /** Lists the apps connected to the account, newest first; at most 20. */\n async list(options?: PolyesterRequestOptions): Promise<ConnectedApp[]> {\n const response = await this.#client.listConnectedApps({}, toConnectCallOptions(options));\n return parse(ConnectedAppsSchema, response.apps);\n }\n\n /**\n * Disconnects an app; its access and refresh tokens stop working at once. Disconnecting an\n * app already disconnected or expired succeeds; an ID that is not one of the account's\n * connected apps throws `ResourceNotFoundError`.\n */\n async revoke(input: RevokeConnectedAppInput, options?: PolyesterRequestOptions): Promise<void> {\n const request = parse(RevokeConnectedAppInputSchema, input);\n await this.#client.revokeConnectedApp(request, toConnectCallOptions(options));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA8BA,IAAa,uBAAb,MAAkC;CAC9B;CAEA,YAAY,YAA+B;EACvC,KAAKA,UAAU,aAAaC,qBAA2B,WAAW,OAAO;CAC7E;;;;;CAMA,MAAM,iBACF,OACA,SACyB;EACzB,MAAM,UAAU,MAAM,6BAA6B,KAAK;EACxD,MAAM,WAAW,MAAM,KAAKD,QAAQ,oBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,wBAAwB,SAAS,aAAa;CAC/D;;;;;;;;CASA,MAAM,qBACF,OACA,SACiC;EACjC,MAAM,UAAU,MAAM,6BAA6B,KAAK;EACxD,MAAM,WAAW,MAAM,KAAKA,QAAQ,wBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,gCAAgC,QAAQ;CACzD;;;;;;CAOA,MAAM,kBACF,OACA,SACiC;EACjC,MAAM,UAAU,MAAM,6BAA6B,KAAK;EACxD,MAAM,WAAW,MAAM,KAAKA,QAAQ,qBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,gCAAgC,QAAQ;CACzD;;CAGA,MAAM,KAAK,SAA4D;EACnE,MAAM,WAAW,MAAM,KAAKA,QAAQ,kBAAkB,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACvF,OAAO,MAAM,qBAAqB,SAAS,IAAI;CACnD;;;;;;CAOA,MAAM,OAAO,OAAgC,SAAkD;EAC3F,MAAM,UAAU,MAAM,+BAA+B,KAAK;EAC1D,MAAM,KAAKA,QAAQ,mBAAmB,SAAS,qBAAqB,OAAO,CAAC;CAChF;AACJ"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
//#region src/services/connected-apps/connected-apps.schemas.d.ts
|
|
3
|
+
/** Selects a pending app connection request. */
|
|
4
|
+
declare const AppAuthorizationInputSchema: v.StrictObjectSchema<{
|
|
5
|
+
/** The `request` query parameter the authorization endpoint gave the consent page. */
|
|
6
|
+
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
7
|
+
}, undefined>;
|
|
8
|
+
type AppAuthorizationInput = v.InferInput<typeof AppAuthorizationInputSchema>;
|
|
9
|
+
declare const RevokeConnectedAppInputSchema: v.StrictObjectSchema<{
|
|
10
|
+
/** `connectedAppId` from `connectedApps.list`. */
|
|
11
|
+
readonly connectedAppId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
12
|
+
}, undefined>;
|
|
13
|
+
type RevokeConnectedAppInput = v.InferInput<typeof RevokeConnectedAppInputSchema>;
|
|
14
|
+
/** The OAuth client of an app, as it presents itself on the consent page. */
|
|
15
|
+
declare const ConnectedAppClientSchema: v.ObjectSchema<{
|
|
16
|
+
readonly clientId: v.StringSchema<undefined>;
|
|
17
|
+
readonly name: v.StringSchema<undefined>;
|
|
18
|
+
}, undefined>;
|
|
19
|
+
type ConnectedAppClient = v.InferOutput<typeof ConnectedAppClientSchema>;
|
|
20
|
+
/** A pending request from an app to connect to the account. Times are epoch milliseconds. */
|
|
21
|
+
declare const AppAuthorizationSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
22
|
+
readonly client: v.OptionalSchema<v.ObjectSchema<{
|
|
23
|
+
readonly clientId: v.StringSchema<undefined>;
|
|
24
|
+
readonly name: v.StringSchema<undefined>;
|
|
25
|
+
}, undefined>, {
|
|
26
|
+
readonly clientId: "";
|
|
27
|
+
readonly name: "";
|
|
28
|
+
}>;
|
|
29
|
+
readonly scopes: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
30
|
+
readonly resource: v.StringSchema<undefined>;
|
|
31
|
+
readonly redirectHost: v.StringSchema<undefined>;
|
|
32
|
+
readonly expiresAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
33
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
34
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
35
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
36
|
+
seconds: bigint;
|
|
37
|
+
nanos: number;
|
|
38
|
+
} | undefined, number | undefined>]>;
|
|
39
|
+
}, undefined>, v.TransformAction<{
|
|
40
|
+
client: {
|
|
41
|
+
clientId: string;
|
|
42
|
+
name: string;
|
|
43
|
+
};
|
|
44
|
+
scopes: string[];
|
|
45
|
+
resource: string;
|
|
46
|
+
redirectHost: string;
|
|
47
|
+
expiresAt?: number | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
client: {
|
|
50
|
+
clientId: string;
|
|
51
|
+
name: string;
|
|
52
|
+
};
|
|
53
|
+
/** OAuth scopes the app asks for, e.g. `"account:read"`. */
|
|
54
|
+
scopes: string[];
|
|
55
|
+
/** Absolute URL of the server the app will use the account through. */
|
|
56
|
+
resource: string;
|
|
57
|
+
/** Host the app receives the answer on. */
|
|
58
|
+
redirectHost: string;
|
|
59
|
+
/** After this the request can no longer be approved or denied. */
|
|
60
|
+
expiresAt: number | null;
|
|
61
|
+
}>]>;
|
|
62
|
+
type AppAuthorization = v.InferOutput<typeof AppAuthorizationSchema>;
|
|
63
|
+
/** An app connected to the account. Times are epoch milliseconds. */
|
|
64
|
+
declare const ConnectedAppSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
65
|
+
readonly connectedAppId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
66
|
+
readonly client: v.OptionalSchema<v.ObjectSchema<{
|
|
67
|
+
readonly clientId: v.StringSchema<undefined>;
|
|
68
|
+
readonly name: v.StringSchema<undefined>;
|
|
69
|
+
}, undefined>, {
|
|
70
|
+
readonly clientId: "";
|
|
71
|
+
readonly name: "";
|
|
72
|
+
}>;
|
|
73
|
+
readonly scopes: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
74
|
+
readonly resource: v.StringSchema<undefined>;
|
|
75
|
+
readonly connectedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
76
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
77
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
78
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
79
|
+
seconds: bigint;
|
|
80
|
+
nanos: number;
|
|
81
|
+
} | undefined, number | undefined>]>;
|
|
82
|
+
readonly lastUsedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
83
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
84
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
85
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
86
|
+
seconds: bigint;
|
|
87
|
+
nanos: number;
|
|
88
|
+
} | undefined, number | undefined>]>;
|
|
89
|
+
readonly expiresAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
90
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
91
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
92
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
93
|
+
seconds: bigint;
|
|
94
|
+
nanos: number;
|
|
95
|
+
} | undefined, number | undefined>]>;
|
|
96
|
+
}, undefined>, v.TransformAction<{
|
|
97
|
+
connectedAppId: string;
|
|
98
|
+
client: {
|
|
99
|
+
clientId: string;
|
|
100
|
+
name: string;
|
|
101
|
+
};
|
|
102
|
+
scopes: string[];
|
|
103
|
+
resource: string;
|
|
104
|
+
connectedAt?: number | undefined;
|
|
105
|
+
lastUsedAt?: number | undefined;
|
|
106
|
+
expiresAt?: number | undefined;
|
|
107
|
+
}, {
|
|
108
|
+
/** Pass to `connectedApps.revoke`. */
|
|
109
|
+
connectedAppId: string;
|
|
110
|
+
client: {
|
|
111
|
+
clientId: string;
|
|
112
|
+
name: string;
|
|
113
|
+
};
|
|
114
|
+
/** OAuth scopes the account granted the app. */
|
|
115
|
+
scopes: string[];
|
|
116
|
+
/** Absolute URL of the server the app uses the account through. */
|
|
117
|
+
resource: string;
|
|
118
|
+
connectedAt: number | null;
|
|
119
|
+
/** Last use or refresh, at minute precision; null until the app first uses its access. */
|
|
120
|
+
lastUsedAt: number | null;
|
|
121
|
+
/** The connection ends then unless it is disconnected first. */
|
|
122
|
+
expiresAt: number | null;
|
|
123
|
+
}>]>;
|
|
124
|
+
type ConnectedApp = v.InferOutput<typeof ConnectedAppSchema>;
|
|
125
|
+
/** Where to send the browser to hand the app its answer. */
|
|
126
|
+
declare const AppAuthorizationRedirectSchema: v.ObjectSchema<{
|
|
127
|
+
readonly redirectUrl: v.StringSchema<undefined>;
|
|
128
|
+
}, undefined>;
|
|
129
|
+
type AppAuthorizationRedirect = v.InferOutput<typeof AppAuthorizationRedirectSchema>;
|
|
130
|
+
//#endregion
|
|
131
|
+
export { AppAuthorization, AppAuthorizationInput, AppAuthorizationInputSchema, AppAuthorizationRedirect, AppAuthorizationRedirectSchema, AppAuthorizationSchema, ConnectedApp, ConnectedAppClient, ConnectedAppClientSchema, ConnectedAppSchema, RevokeConnectedAppInput, RevokeConnectedAppInputSchema };
|
|
132
|
+
//# sourceMappingURL=connected-apps.schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connected-apps.schemas.d.ts","names":[],"sources":["../../../src/services/connected-apps/connected-apps.schemas.ts"],"mappings":";;;cAKa,6BAA2B,EAAA;;;;KAK5B,wBAAwB,EAAE,kBAAkB;cAE3C,+BAA6B,EAAA;;;;KAK9B,0BAA0B,EAAE,kBAAkB;;cAG7C,0BAAwB,EAAA;;;;KAKzB,qBAAqB,EAAE,mBAAmB;;cAKzC,wBAAsB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqBvB,mBAAmB,EAAE,mBAAmB;;cAGvC,oBAAkB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0BnB,eAAe,EAAE,mBAAmB;;cAKnC,gCAA8B,EAAA;wBAA9B,EAAA;;KAED,2BAA2B,EAAE,mBAAmB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { OptionalTimestampMsSchema, PublicIdSchema, idInputSchema } from "../../shared/schemas.js";
|
|
2
|
+
import { PositiveStringInputSchema } from "../shared.js";
|
|
3
|
+
import * as v from "valibot";
|
|
4
|
+
//#region src/services/connected-apps/connected-apps.schemas.ts
|
|
5
|
+
/** Selects a pending app connection request. */
|
|
6
|
+
const AppAuthorizationInputSchema = v.strictObject({
|
|
7
|
+
/** The `request` query parameter the authorization endpoint gave the consent page. */
|
|
8
|
+
requestId: PositiveStringInputSchema });
|
|
9
|
+
const RevokeConnectedAppInputSchema = v.strictObject({
|
|
10
|
+
/** `connectedAppId` from `connectedApps.list`. */
|
|
11
|
+
connectedAppId: idInputSchema("connectedAppId") });
|
|
12
|
+
/** The OAuth client of an app, as it presents itself on the consent page. */
|
|
13
|
+
const ConnectedAppClientSchema = v.object({
|
|
14
|
+
clientId: v.string(),
|
|
15
|
+
name: v.string()
|
|
16
|
+
});
|
|
17
|
+
const ClientSchema = v.optional(ConnectedAppClientSchema, {
|
|
18
|
+
clientId: "",
|
|
19
|
+
name: ""
|
|
20
|
+
});
|
|
21
|
+
/** A pending request from an app to connect to the account. Times are epoch milliseconds. */
|
|
22
|
+
const AppAuthorizationSchema = v.pipe(v.object({
|
|
23
|
+
client: ClientSchema,
|
|
24
|
+
scopes: v.array(v.string()),
|
|
25
|
+
resource: v.string(),
|
|
26
|
+
redirectHost: v.string(),
|
|
27
|
+
expiresAt: OptionalTimestampMsSchema
|
|
28
|
+
}), v.transform((authorization) => ({
|
|
29
|
+
client: authorization.client,
|
|
30
|
+
/** OAuth scopes the app asks for, e.g. `"account:read"`. */
|
|
31
|
+
scopes: authorization.scopes,
|
|
32
|
+
/** Absolute URL of the server the app will use the account through. */
|
|
33
|
+
resource: authorization.resource,
|
|
34
|
+
/** Host the app receives the answer on. */
|
|
35
|
+
redirectHost: authorization.redirectHost,
|
|
36
|
+
/** After this the request can no longer be approved or denied. */
|
|
37
|
+
expiresAt: authorization.expiresAt ?? null
|
|
38
|
+
})));
|
|
39
|
+
/** An app connected to the account. Times are epoch milliseconds. */
|
|
40
|
+
const ConnectedAppSchema = v.pipe(v.object({
|
|
41
|
+
connectedAppId: PublicIdSchema,
|
|
42
|
+
client: ClientSchema,
|
|
43
|
+
scopes: v.array(v.string()),
|
|
44
|
+
resource: v.string(),
|
|
45
|
+
connectedAt: OptionalTimestampMsSchema,
|
|
46
|
+
lastUsedAt: OptionalTimestampMsSchema,
|
|
47
|
+
expiresAt: OptionalTimestampMsSchema
|
|
48
|
+
}), v.transform((app) => ({
|
|
49
|
+
/** Pass to `connectedApps.revoke`. */
|
|
50
|
+
connectedAppId: app.connectedAppId,
|
|
51
|
+
client: app.client,
|
|
52
|
+
/** OAuth scopes the account granted the app. */
|
|
53
|
+
scopes: app.scopes,
|
|
54
|
+
/** Absolute URL of the server the app uses the account through. */
|
|
55
|
+
resource: app.resource,
|
|
56
|
+
connectedAt: app.connectedAt ?? null,
|
|
57
|
+
/** Last use or refresh, at minute precision; null until the app first uses its access. */
|
|
58
|
+
lastUsedAt: app.lastUsedAt ?? null,
|
|
59
|
+
/** The connection ends then unless it is disconnected first. */
|
|
60
|
+
expiresAt: app.expiresAt ?? null
|
|
61
|
+
})));
|
|
62
|
+
const ConnectedAppsSchema = v.array(ConnectedAppSchema);
|
|
63
|
+
/** Where to send the browser to hand the app its answer. */
|
|
64
|
+
const AppAuthorizationRedirectSchema = v.object({ redirectUrl: v.string() });
|
|
65
|
+
//#endregion
|
|
66
|
+
export { AppAuthorizationInputSchema, AppAuthorizationRedirectSchema, AppAuthorizationSchema, ConnectedAppClientSchema, ConnectedAppSchema, ConnectedAppsSchema, RevokeConnectedAppInputSchema };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=connected-apps.schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connected-apps.schemas.js","names":[],"sources":["../../../src/services/connected-apps/connected-apps.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { OptionalTimestampMsSchema, PublicIdSchema, idInputSchema } from \"../../shared/schemas.js\";\nimport { PositiveStringInputSchema } from \"../shared.js\";\n\n/** Selects a pending app connection request. */\nexport const AppAuthorizationInputSchema = v.strictObject({\n /** The `request` query parameter the authorization endpoint gave the consent page. */\n requestId: PositiveStringInputSchema,\n});\n\nexport type AppAuthorizationInput = v.InferInput<typeof AppAuthorizationInputSchema>;\n\nexport const RevokeConnectedAppInputSchema = v.strictObject({\n /** `connectedAppId` from `connectedApps.list`. */\n connectedAppId: idInputSchema(\"connectedAppId\"),\n});\n\nexport type RevokeConnectedAppInput = v.InferInput<typeof RevokeConnectedAppInputSchema>;\n\n/** The OAuth client of an app, as it presents itself on the consent page. */\nexport const ConnectedAppClientSchema = v.object({\n clientId: v.string(),\n name: v.string(),\n});\n\nexport type ConnectedAppClient = v.InferOutput<typeof ConnectedAppClientSchema>;\n\nconst ClientSchema = v.optional(ConnectedAppClientSchema, { clientId: \"\", name: \"\" });\n\n/** A pending request from an app to connect to the account. Times are epoch milliseconds. */\nexport const AppAuthorizationSchema = v.pipe(\n v.object({\n client: ClientSchema,\n scopes: v.array(v.string()),\n resource: v.string(),\n redirectHost: v.string(),\n expiresAt: OptionalTimestampMsSchema,\n }),\n v.transform((authorization) => ({\n client: authorization.client,\n /** OAuth scopes the app asks for, e.g. `\"account:read\"`. */\n scopes: authorization.scopes,\n /** Absolute URL of the server the app will use the account through. */\n resource: authorization.resource,\n /** Host the app receives the answer on. */\n redirectHost: authorization.redirectHost,\n /** After this the request can no longer be approved or denied. */\n expiresAt: authorization.expiresAt ?? null,\n })),\n);\n\nexport type AppAuthorization = v.InferOutput<typeof AppAuthorizationSchema>;\n\n/** An app connected to the account. Times are epoch milliseconds. */\nexport const ConnectedAppSchema = v.pipe(\n v.object({\n connectedAppId: PublicIdSchema,\n client: ClientSchema,\n scopes: v.array(v.string()),\n resource: v.string(),\n connectedAt: OptionalTimestampMsSchema,\n lastUsedAt: OptionalTimestampMsSchema,\n expiresAt: OptionalTimestampMsSchema,\n }),\n v.transform((app) => ({\n /** Pass to `connectedApps.revoke`. */\n connectedAppId: app.connectedAppId,\n client: app.client,\n /** OAuth scopes the account granted the app. */\n scopes: app.scopes,\n /** Absolute URL of the server the app uses the account through. */\n resource: app.resource,\n connectedAt: app.connectedAt ?? null,\n /** Last use or refresh, at minute precision; null until the app first uses its access. */\n lastUsedAt: app.lastUsedAt ?? null,\n /** The connection ends then unless it is disconnected first. */\n expiresAt: app.expiresAt ?? null,\n })),\n);\n\nexport type ConnectedApp = v.InferOutput<typeof ConnectedAppSchema>;\n\nexport const ConnectedAppsSchema = v.array(ConnectedAppSchema);\n\n/** Where to send the browser to hand the app its answer. */\nexport const AppAuthorizationRedirectSchema = v.object({ redirectUrl: v.string() });\n\nexport type AppAuthorizationRedirect = v.InferOutput<typeof AppAuthorizationRedirectSchema>;\n"],"mappings":";;;;;AAKA,MAAa,8BAA8B,EAAE,aAAa;;AAEtD,WAAW,0BACf,CAAC;AAID,MAAa,gCAAgC,EAAE,aAAa;;AAExD,gBAAgB,cAAc,gBAAgB,EAClD,CAAC;;AAKD,MAAa,2BAA2B,EAAE,OAAO;CAC7C,UAAU,EAAE,OAAO;CACnB,MAAM,EAAE,OAAO;AACnB,CAAC;AAID,MAAM,eAAe,EAAE,SAAS,0BAA0B;CAAE,UAAU;CAAI,MAAM;AAAG,CAAC;;AAGpF,MAAa,yBAAyB,EAAE,KACpC,EAAE,OAAO;CACL,QAAQ;CACR,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;CAC1B,UAAU,EAAE,OAAO;CACnB,cAAc,EAAE,OAAO;CACvB,WAAW;AACf,CAAC,GACD,EAAE,WAAW,mBAAmB;CAC5B,QAAQ,cAAc;;CAEtB,QAAQ,cAAc;;CAEtB,UAAU,cAAc;;CAExB,cAAc,cAAc;;CAE5B,WAAW,cAAc,aAAa;AAC1C,EAAE,CACN;;AAKA,MAAa,qBAAqB,EAAE,KAChC,EAAE,OAAO;CACL,gBAAgB;CAChB,QAAQ;CACR,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;CAC1B,UAAU,EAAE,OAAO;CACnB,aAAa;CACb,YAAY;CACZ,WAAW;AACf,CAAC,GACD,EAAE,WAAW,SAAS;;CAElB,gBAAgB,IAAI;CACpB,QAAQ,IAAI;;CAEZ,QAAQ,IAAI;;CAEZ,UAAU,IAAI;CACd,aAAa,IAAI,eAAe;;CAEhC,YAAY,IAAI,cAAc;;CAE9B,WAAW,IAAI,aAAa;AAChC,EAAE,CACN;AAIA,MAAa,sBAAsB,EAAE,MAAM,kBAAkB;;AAG7D,MAAa,iCAAiC,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AppAuthorization, AppAuthorizationInput, AppAuthorizationRedirect, ConnectedApp, ConnectedAppClient, RevokeConnectedAppInput } from "./connected-apps.schemas.js";
|
|
2
|
+
export type { AppAuthorization, AppAuthorizationInput, AppAuthorizationRedirect, ConnectedApp, ConnectedAppClient, RevokeConnectedAppInput };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConnectedAppsService } from "./connected-apps.js";
|
|
2
|
+
import { PolyesterCore } from "../../core-client.js";
|
|
3
|
+
//#region src/services/connected-apps/service.d.ts
|
|
4
|
+
/** Returns the client's ConnectedAppsService, creating it on first use. */
|
|
5
|
+
declare const connectedAppsService: (client: PolyesterCore) => ConnectedAppsService;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { connectedAppsService };
|
|
8
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","names":[],"sources":["../../../src/services/connected-apps/service.ts"],"mappings":";;;;cAIa,uBAAoB,QAApB,kBAAoB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineService } from "../../core-client.js";
|
|
2
|
+
import { ConnectedAppsService } from "./connected-apps.js";
|
|
3
|
+
//#region src/services/connected-apps/service.ts
|
|
4
|
+
/** Returns the client's ConnectedAppsService, creating it on first use. */
|
|
5
|
+
const connectedAppsService = defineService((context) => new ConnectedAppsService(context.transports));
|
|
6
|
+
//#endregion
|
|
7
|
+
export { connectedAppsService };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","names":[],"sources":["../../../src/services/connected-apps/service.ts"],"sourcesContent":["import { defineService } from \"../../core-client.js\";\nimport { ConnectedAppsService } from \"./connected-apps.js\";\n\n/** Returns the client's ConnectedAppsService, creating it on first use. */\nexport const connectedAppsService = defineService(\n (context) => new ConnectedAppsService(context.transports),\n);\n"],"mappings":";;;;AAIA,MAAa,uBAAuB,eAC/B,YAAY,IAAI,qBAAqB,QAAQ,UAAU,CAC5D"}
|